ChezScheme
ChezScheme copied to clipboard
(/ 0 4.0) is 0.0, not 0
(/ 0 4.0) evaluates to 0.0. I'm not sure this is a bug, but I was expecting 0, like (* 0 0.25). Is there a good reason for the current behavior?
(/ 0 4.0) evaluates to 0.0. I'm not sure this is a bug, but I was expecting 0, like (* 0 0.25). Is there a good reason for the current behavior?
R6RS has the following example:
(/ 0 3.5) ⇒ 0.0
http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.7.4.3
Thanks.
After thinking about it some more, I guess the argument is that 3.5, as an inexact number, could conceivably be so inaccurate that it's actually zero, in which case the quotient is undefined, not zero.
Actually, it doesn't make sense for (/ 0 x), where x is a floating-point number, to be anything other than 0, since a floating-point number is never true 0 (just very small on either side of 0) and never truly infinite (just possibly very large, i.e., the reciprocal of a very small number). We got this wrong in R6RS. We should correct it for the version of / exported by (chezscheme) and leave the broken behavior for (rnrs).
(/ 0 4.0) is now 0. That / is no longer R6RS's / is a new issue, though, which I'll open next.