modulus redux

Walter Bright newshound1 at digitalmars.com
Mon Jul 13 11:26:42 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').
> 
> 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 hope you don't mind if I cut & paste this into the spec pages!



More information about the Digitalmars-d mailing list