Menu

#63 Roundtrip double -> string -> double doesn't reproduce input double

0.5.0
closed-fixed
nobody
None
3
2015-01-06
2013-07-19
osx
No

The current double serialization code doesn't work as good as possible for doubles - the round trip double -> string -> double creates different double output from input in a lot of cases.

The reason for this is that the number of digits (16) used to print the double to string is too low.

This http://stackoverflow.com/a/16941784/2520006 links to some background reading.

The fix is quite simple: Just print 17 digits.

The attached test case demonstrates problem and fix.

1 Attachments

Discussion

  • Christopher Dunn

    Fixed in GitHub, 1.1.0.

     
  • Christopher Dunn

    • status: open --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.