Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004948OCamlOCaml documentationpublic2009-12-23 03:332015-12-11 19:04
Assigned To 
StatusclosedResolutionwon't fix 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version 
Summary0004948: There are many NaNs
DescriptionThe 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.
TagsNo tags attached.
Attached Files

- Relationships
related to 0005038closedxleroy Int64.float_of_bits weirdness on x86 ports 

-  Notes
xleroy (administrator)
2009-12-30 16:00

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 So, I don't see the need to complicate the documentation to talk about something that is invisible to the programmer.
dbuenzli (reporter)
2009-12-30 17:42

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
doligez (administrator)
2012-04-10 17:58

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

- Issue History
Date Modified Username Field Change
2009-12-23 03:33 dbuenzli New Issue
2009-12-30 16:00 xleroy Note Added: 0005212
2009-12-30 16:00 xleroy Status new => feedback
2009-12-30 17:42 dbuenzli Note Added: 0005215
2010-04-29 19:28 xleroy Relationship added related to 0005038
2012-04-10 17:58 doligez Note Added: 0007314
2012-04-10 17:58 doligez Status feedback => resolved
2012-04-10 17:58 doligez Resolution open => won't fix
2015-12-11 19:04 xleroy Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker