[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


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

see https://github.com/dlang/phobos/pull/4343


More information about the Digitalmars-d-bugs mailing list