[Issue 15885] float serialized to JSON loses precision
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 21 13:40:56 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15885
b2.temp at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |b2.temp at gmx.com
Assignee|nobody at puremagic.com |b2.temp at gmx.com
--- Comment #2 from b2.temp at gmx.com ---
(In reply to Rory from comment #1)
> Created attachment 1594 [details]
> possible patch
>
> this patch just makes sure we always output using %f. I'm guessing %g
> technically has the bug because surely it shouldn't just remove part of the
> number _by default_
%f doesn't work. It breaks some unittest.
the correct format specifier would be "%.9g" (9 comes from the constant
FLT_DECIMAL_DIG).
see https://github.com/dlang/phobos/pull/4343
--
More information about the Digitalmars-d-bugs
mailing list