Fix issue 15885 - float serialized to JSON loses precision#4345
Fix issue 15885 - float serialized to JSON loses precision#4345andralex merged 1 commit intodlang:masterfrom
Conversation
|
f3d05ca to
e1277e9
Compare
std/json.d
Outdated
| import std.stdio; | ||
| writefln("%.18g : %.18g : %.18g : %s", num0, num1, num2, feqrel(num2, num0)); | ||
|
|
||
| version(Windows) |
There was a problem hiding this comment.
What 's happening on Windows ? If the failure is related to DigitalMars snn.lib then the version should be changed to CRuntime_DigitalMars because MS C standard lib might not have the issue.
There was a problem hiding this comment.
What 's happening on Windows ?
I don't know. Win_32 failed on win-farm-2at assert(test(1.223e+24)), so I added the debug printout and re-ran the test... which then passed on win-farm-1.
Originally I thought it was just imprecision in the Windows snprintf() - which is indirectly called by toJSON() - but now I'm wondering if it's actually a code gen bug, or maybe flaky hardware on one/both of the Windows test servers.
e635222 to
4692b02
Compare
|
@bbasile I think there is a code gen bug on And from another run, printing the bit pattern instead: Reducing this could be a pain though, since I don't have a |
12e5883 to
1d87b20
Compare
|
We have missed this: https://issues.dlang.org/show_bug.cgi?id=15861. The fix should be OK now ! |
426b117 to
503760c
Compare
You are correct. Excellent! It's now 100% precise on all platforms except |
|
Ping @klickverbot @CyberShadow . This important JSON bug fix passes the auto-tester now; does anyone want to merge it? |
503760c to
7a486d9
Compare
|
Auto-merge toggled on |
This is a continuation of @bbasile 's PR #4343 .