Jump to page: 1 2
Thread overview
[Issue 13013] Failed unittests in std.json - does not parse doubles correctly
Jun 30, 2014
David Nadlinger
Jun 30, 2014
Mark Isaacson
Jun 30, 2014
Dmitry Olshansky
Jun 30, 2014
Mark Isaacson
Jun 30, 2014
Dmitry Olshansky
Jul 01, 2014
Mark Isaacson
Jul 02, 2014
Mark Isaacson
Jul 03, 2014
Mark Isaacson
June 30, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

David Nadlinger <code@klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@klickverbot.at

--- Comment #1 from David Nadlinger <code@klickverbot.at> ---
When porting LDC to Windows, I had to deal with a large number of such issues that manifested in a similar way (absurd floating point results). The root cause always was that the MSVC runtime does not support reals ("long double" in C land, i.e. x87 80 bit floats) at all. This leads to situations where D code is calling a function (say snprintf) with some floating point arguments on the x87 stack, but the called function reads them from the XMM registers or the regular stack.

If I remember correctly, DMD also uses 80 bit reals on Win64. This can't work unless it comes with its own string formatting/math/etc. routines. For LDC/MinGW, we just use the MinGW ones which do properly support long doubles, but I'm not sure what the intended solution for DMD is.

--
June 30, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #2 from Mark Isaacson <markisaa@umich.edu> ---
Thanks for the insight David! I added a:
version (Win64) {
  alias FloatingType = double;
} else {
  alias FloatingType = real;
}

to the top and changed the appropriate union type to use that alias. The unittests ran perfectly.

I doubt that this is the fix we want to ship, but it seems that your analysis is spot-on.

--
June 30, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com

--- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
JavaScript uses double exclusively why use 'real' in JSON to begin with?

--
June 30, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #4 from Mark Isaacson <markisaa@umich.edu> ---
Dimitry - Just had the same conversation with a co-worker :). Checked the blame log; was unable to quickly find the person who initially coded it up as real to find the rationale.

--
June 30, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #5 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
(In reply to Mark Isaacson from comment #4)
> Dimitry - Just had the same conversation with a co-worker :). Checked the blame log; was unable to quickly find the person who initially coded it up as real to find the rationale.

That stuff is old...
I'd pull a patch that fixes it to double without a second thought.

It still leaves the question of ABI violation as something separate. From the bug report I guess that not every test is run on Win64 ATM.

--
July 01, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #6 from Mark Isaacson <markisaa@umich.edu> ---
Pull request: https://github.com/D-Programming-Language/phobos/pull/2291

--
July 02, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #6 from Mark Isaacson <markisaa@umich.edu> ---
Pull request: https://github.com/D-Programming-Language/phobos/pull/2291

--
July 03, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #7 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/333e7e734f30067acbb935adfdf6d2ef64f50b8c Issue 13013 - Converted real to double in std.json.JSONValue

https://github.com/D-Programming-Language/phobos/commit/f518343f3e85c7b0ae0a9d2486dd18390dd592d6 Merge pull request #2291 from markisaa/realToDouble

Issue 13013 - Converted real to double in std.json.JSONValue

--
July 03, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

Mark Isaacson <markisaa@umich.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
July 08, 2014
https://issues.dlang.org/show_bug.cgi?id=13013

--- Comment #8 from github-bugzilla@puremagic.com ---
Commit pushed to 2.066 at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/4b98a776cbb4e42cd271c57d238621174d5fb0ff Merge pull request #2291 from markisaa/realToDouble

Issue 13013 - Converted real to double in std.json.JSONValue

--
« First   ‹ Prev
1 2