[Cfp-interest 1975] Re: remquo( )

David Hough CFP pcfp at oakapple.net
Wed Apr 14 15:43:08 PDT 2021


The general property of

x mod y -> (q,r)

is that x = q*y + r, exactly;  the difference between mod and remainder
is how q is rounded to an integral value.

So if q is integral and y is 0, then q is irrelevant and r is x.

So which q?   inf or NaN messes up the property.

Offhand I'd say q could be zero.

But looking at limiting cases of x mod y as y approaches 0, q gets bigger
and bigger and r gets smaller and smaller.    q does not approach 0 and r
does not approach x.    So from that point of view, q should be inf and
r should be zero, both signed appropriately, but that means q*y should
approach inf*0 which is indeterminate in general but should be defined to
be x here!    In exact cases when x is an integral multiple of y, then
r is 0, and q*y is indeed exactly x.


More information about the Cfp-interest mailing list