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

There are many NaNs #4948

Closed
vicuna opened this issue Dec 23, 2009 · 3 comments
Closed

There are many NaNs #4948

vicuna opened this issue Dec 23, 2009 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Dec 23, 2009

Original bug ID: 4948
Reporter: @dbuenzli
Status: closed (set by @xavierleroy on 2015-12-11T18:04:29Z)
Resolution: won't fix
Priority: normal
Severity: tweak
Version: 3.11.1
Category: documentation
Related to: #5038
Monitored by: @dbuenzli @Chris00

Bug description

The documentation makes it sound like there exists a single NaN value.

The following improvements could be done :

  1. In the documentation of compare, note that compare equates all NaN value.
  2. In the paragraph preceding floating point functions, indicate that
    0. /. 0. returns a NaN value (instead of Pervasives.nan) and that
    any function taking a NaN (instead of Pervasives.nan) value returns a
    NaN value (instead of Pervasives.nan).
  3. In the documentation of Pervasives.nan, indicate that nan is a NaN value
    but that may not be the one you get in 0. /. 0.
@vicuna
Copy link
Author

vicuna commented Dec 30, 2009

Comment author: @xavierleroy

Yes, IEEE 754 allows for multiple NaN values, and I've never seen a program take advantage of that. But the point is that all these NaNs are not distinguishable from Caml: as you noticed, they compare equal according to Pervasives.compare. So, I don't see the need to complicate the documentation to talk about something that is invisible to the programmer.

@vicuna
Copy link
Author

vicuna commented Dec 30, 2009

Comment author: @dbuenzli

Maybe you are right, it's not worth it for the casual user.

In fact I was just surprised by this :

compare nan (0. /. 0.);;

  • : int = 0

compare (Int64.bits_of_float nan) (Int64.bits_of_float (0. /. 0.));;

  • : int = 1

@vicuna
Copy link
Author

vicuna commented Apr 10, 2012

Comment author: @damiendoligez

I think we agree we don't want to trouble normal users with the minute details of NaN specifications.
I'm closing this PR.

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

No branches or pull requests

1 participant