[Issue 15885] float serialized to JSON loses precision

2020-03-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

Basile-z  changed:

   What|Removed |Added

 CC|b2.t...@gmx.com |

--


[Issue 15885] float serialized to JSON loses precision

2016-10-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

--- Comment #5 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/7a486d9d038448595c74aa4ef4bd7d9e952a4b64
Fix issue 15885 - numeric values serialized to JSON lose precision.

https://github.com/dlang/phobos/commit/f4ad734aad6e3b2dd4881508d2b15eebb732a26c
Merge pull request #4345 from tsbockman/issue-15885-tsb

--


[Issue 15885] float serialized to JSON loses precision

2016-05-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/7a486d9d038448595c74aa4ef4bd7d9e952a4b64
Fix issue 15885 - numeric values serialized to JSON lose precision.

https://github.com/dlang/phobos/commit/f4ad734aad6e3b2dd4881508d2b15eebb732a26c
Merge pull request #4345 from tsbockman/issue-15885-tsb

Fix issue 15885 - float serialized to JSON loses precision

--



[Issue 15885] float serialized to JSON loses precision

2016-05-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--


[Issue 15885] float serialized to JSON loses precision

2016-05-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

thomas.bock...@gmail.com changed:

   What|Removed |Added

 CC||thomas.bock...@gmail.com

--- Comment #3 from thomas.bock...@gmail.com ---
The correct format specifier is ACTUALLY "%.18g", assuming that you want full
lossless conversion. This is because:

1) JSON_TYPE.FLOAT is a 64-bit double, not 32-bit float!

2) cast(int)ceil(log(pow(2.0L, F.mant_dig - 1)) / log(10.0L) + 1) decimal
digits are needed to represent some floating-point values, such as (1 +
F.epsilon).

See this DPaste: https://dpaste.dzfl.pl/1bd14e5c3f83#line-25

--


[Issue 15885] float serialized to JSON loses precision

2016-05-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||b2.t...@gmx.com
   Assignee|nob...@puremagic.com|b2.t...@gmx.com

--- Comment #2 from b2.t...@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

--


[Issue 15885] float serialized to JSON loses precision

2016-04-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15885

--- Comment #1 from Rory  ---
Created attachment 1594
  --> https://issues.dlang.org/attachment.cgi?id=1594=edit
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_

--