modulus redux
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Jul 13 05:45:05 PDT 2009
Don wrote:
> Close, but that's technically not true in the case where abs(a/b) >
> long.max. (The integer doesn't have to fit into a 'long').
But if real is 79-bit long (as on Intel), the largest integer that could
fit without loss in 1 << 63, and that would fit in a long. Are you
saying r could spill into large integers that cannot be represented
without loss?
> In IEEE754, r= a % b is defined by the mathematical relation r = a – b
> * n , where n is the integer nearest the exact number a/b ; whenever
> abs( n – a/b) = 0.5 , then n is even. If r == 0 , its sign is the same
> as a.
I take it D does not define a % b the IEEE 754 way (that's why I
eliminated that mention). Is that correct?
Andrei
More information about the Digitalmars-d
mailing list