Integer division

Andrew Koenig ark at alice.UucP
Fri Feb 7 14:11:12 AEST 1986


To add some more fuel to the fire, consider extending a%b to
floating-point operands.  If we do this, we find that defining
a%b to have the sign of a in all cases allows a%b to be represented
exactly as a floating-point number, whereas giving a%b the sign
of b does not.  Consider, for instance, the case where b is huge
and positive and a is tiny and negative.



More information about the Comp.lang.c mailing list