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

Comments

Projects
None yet
1 participant
@vicuna
Copy link

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Author

commented Dec 24, 2014

Comment author: @damiendoligez

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

@vicuna vicuna closed this Dec 24, 2014

@vicuna vicuna added stdlib bug labels Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.