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

Printf.sprintf "%F" misbehavior #6727

Closed
vicuna opened this issue Dec 19, 2014 · 2 comments
Closed

Printf.sprintf "%F" misbehavior #6727

vicuna opened this issue Dec 19, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Dec 19, 2014

Original bug ID: 6727
Reporter: Vassili Karpov
Status: closed (set by @damiendoligez on 2014-12-24T19:58:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: Any
OS: Any
Version: 4.02.1
Fixed in version: 4.02.2+dev / +rc1
Category: standard library
Monitored by: @hcarty

Bug description

let t = 1000001. in t, float_of_string (Printf.sprintf "%F" t);;

  • : float * float = (1000001., 1000000.)

This used to work properly before GADT implementation of formatting.

Steps to reproduce

let t = 1000001. in t, float_of_string (Printf.sprintf "%F" t);;
in repl

File attachments

@vicuna
Copy link
Author

vicuna commented Dec 19, 2014

Comment author: bvaugon

Ok, the problem is that, when using %F in a format, the float was originaly printed with 12 significant digits, and now with 6.

I attach a patch that restore the legacy behaviour.

@vicuna
Copy link
Author

vicuna commented Dec 24, 2014

Comment author: @damiendoligez

patch applied to 4.02 (rev 15745) and trunk (rev 15746)

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