Bug 10145 – "real" datatype on x64 doesn't accurately represent a floating point number

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2013-05-23T03:30:00Z
Last change time
2013-11-21T07:37:26Z
Assigned to
nobody
Creator
gooberman

Comments

Comment #0 by gooberman — 2013-05-23T03:30:56Z
When converting float variables to and from real variables, the actual value gets munged up in to something indecipherable. real values converted to strings print out wrong values, and converting them back to floats keep garbage values about. I discovered this one when using std.json, which uses the real type to track floating point values rather than float/double. Currently working around it by making a copy of std.json, sticking it in another namespace, and replacing real with double. Tested with latest beta.
Comment #1 by bearophile_hugs — 2013-05-23T04:15:13Z
I suggest to add a small test case that shows the problem.
Comment #2 by yebblies — 2013-11-21T07:37:26Z
Can't fix without a test case.