Arithmetic/Rational: Difference between revisions

Updated D entry
(Fixed typo in D entry)
(Updated D entry)
Line 443:
real toReal() pure const /*nothrow*/ {
static if (is(T == BigInt))
return num.toLong / cast(real)(den.toLong);
else
return num / cast(real)(den);
}
 
Line 533:
foreach (immutable p; 2 .. 2 ^^ 19) {
auto sum = RatL(1, p);
immutable limit = 1 + cast(uint)sqrtreal(cast(real)p).sqrt;
foreach (immutable factor; 2 .. limit)
if (p % factor == 0)