Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005739OCamlOCaml standard librarypublic2012-08-25 15:482012-09-27 14:53
Reportersmimram 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version3.12.1 
Target Version4.00.2+devFixed in Version 
Summary0005739: Printf.printf "%F" (-.nan) returns -nan
DescriptionWhen trying to generate code for OCaml (in OCaml) I expected Printf.printf "%F" to generate a float which is a valid expression in OCaml syntax: according to the documentation "%F converts a floating-point argument to Caml syntax". However,

# -nan;;
Error: This expression has type float but an expression was expected of type
         int
# Printf.printf "%F\n" (-.nan);;
-nan
- : unit = ()

Maybe should the last expression return "-.nan" (or the syntax could be modified to allow -nan).
Steps To ReproducePrintf.printf "%F\n" (-.nan);;
TagsNo tags attached.
Attached Files

- Relationships
related to 0004688resolvedfrisch Special floating-point values aren't converted to strings correctly under Windows 

-  Notes
(0007985)
gasche (developer)
2012-08-25 18:53
edited on: 2012-08-25 19:04

Confirmed under 3.12.1 and 4.00.

printf "%F" neg_infinity also prints "-inf" which suffers from the same problem. I think this was already discussed in 0004688.

If I understand correctly the patch of "dra" in 0004688, the effect of (printf "%F" (-.nan)) on the Windows platform (mingw or MSVC) could be to return "nan" instead of the negative nan on 4.00 -- I can't test myself, though.


- Issue History
Date Modified Username Field Change
2012-08-25 15:48 smimram New Issue
2012-08-25 18:50 gasche Relationship added related to 0004688
2012-08-25 18:53 gasche Note Added: 0007985
2012-08-25 18:53 gasche Status new => confirmed
2012-08-25 19:04 gasche Note Edited: 0007985 View Revisions
2012-09-06 16:43 doligez Target Version => 4.00.1+dev
2012-09-27 14:53 doligez Target Version 4.00.1+dev => 4.00.2+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker