[R6RS] division by exact zero (again, sorry)
R. Kent Dybvig
dyb at cs.indiana.edu
Tue Mar 6 09:22:30 EST 2007
> I would make the changes to which I thought Kent
> had agreed. I must have misinterpreted Kent's
> position on (/ 0 0).
Yes, and that's probably my fault for not being more precise. I agreed to
this (for nonnegative x):
> (* x 0) => 0 or +nan.0 if x = +nan.0 or x = +inf.0
> => 0 or 0.0 otherwise
>
> (/ 0 x) => 0 or +nan.0 if x = +nan.0
> => 0 or 0.0 otherwise
>
> (/ x 0) => +nan.0 or raise exception if x = +nan.0 or x = 0.0
> => +inf.0 or raise exception otherwise
This was in the context of a discussion about division of inexact numbers
by exact zero, and I meant these to apply only if x is inexact. I should
have said so explicitly at the time. If x is exact, (* x 0) and (/ x 0)
should evaluate to exact 0 and (/ x 0) should raise an exception.
> I would prefer (/ 0 0) be forbidden to evaluate
> to any number at all.
Then I think we agree on this point and can change the example to read
(/ 0.0 0) => &assertion exception or +nan.0
and add
(/ 1.0 0) => &assertion exception or +inf.0
(/ 0 0) => &assertion exception
(/ 3 0) => &assertion exception
possibly with words to the effect that division of an exact number by
exact zero raises an exception.
Also, based on middle rule in the quoted agreement, the example that reads
(/ 0 3.5) => 0.0 ; inexact
should actually read
(/ 0 3.5) => 0 or 0.0
Kent
More information about the R6RS
mailing list