Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004902OCamlOCaml generalpublic2009-10-30 05:062009-10-30 13:45
Reporterfuruse 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version3.11.2+dev 
Summary0004902: Printf.sprintf "%1.F" 123.456 returns "12." !!
DescriptionThe summary tells everything.

The fix is easy:

diff --git a/stdlib/printf.ml b/stdlib/printf.ml
--- a/stdlib/printf.ml
+++ b/stdlib/printf.ml
@@ -435,7 +435,7 @@
       let add_dot sfmt s =
         if s.[0] = ' ' || s.[0] = '+' || s.[0] = '0'
         then String.sub s 1 (l - 1) ^ "."
- else String.sub s 0 (l - 1) ^ "." in
+ else String.sub s 0 l ^ "." in
 
       let rec loop i =
         if i >= l then add_dot sfmt s else
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005144)
furuse (reporter)
2009-10-30 05:35

I see the function format_float_lexem is largely rewritten in the trunk version. The issue is gone in the trunk, but I think it is still worth reporting.

- Issue History
Date Modified Username Field Change
2009-10-30 05:06 furuse New Issue
2009-10-30 05:35 furuse Note Added: 0005144
2009-10-30 13:45 doligez Status new => closed
2009-10-30 13:45 doligez Resolution open => fixed
2009-10-30 13:45 doligez Fixed in Version => 3.11.2+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker