Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(/ 0 4.0) is 0.0, not 0 #400

Closed
ocyzl opened this issue Feb 14, 2019 · 4 comments
Closed

(/ 0 4.0) is 0.0, not 0 #400

ocyzl opened this issue Feb 14, 2019 · 4 comments

Comments

@ocyzl
Copy link

ocyzl commented Feb 14, 2019

(/ 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?

@soegaard
Copy link

soegaard commented Feb 14, 2019 via email

@ocyzl
Copy link
Author

ocyzl commented Feb 14, 2019

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.

@ocyzl ocyzl closed this as completed Feb 14, 2019
@dybvig
Copy link
Member

dybvig commented Feb 14, 2019

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).

@mflatt
Copy link
Contributor

mflatt commented Dec 8, 2023

(/ 0 4.0) is now 0. That / is no longer R6RS's / is a new issue, though, which I'll open next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants