Opened 8 years ago
Last modified 8 years ago
#10188 assigned Bugs
Loses floating point precision on round trip
Reported by: | Owned by: | Sebastian Redl | |
---|---|---|---|
Milestone: | To Be Determined | Component: | property_tree |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
ptrees stream_translator uses a precision of std::numeric_limits<F>::digits10 + 1 when converting floating point values. This is not always enough, and a more correct value would be digits10+2 or max_digits10 (c++11 only). See ticket:9177 for a similar issue.
The attached test produces the following output pre-patch:
in : -1.8312345000098765e-08 out: -1.8312345000098762e-08 Wrong
and after patch:
in : -1.8312345000098765e-08 out: -1.8312345000098765e-08 Right
Attachments (2)
Note:
See TracTickets
for help on using tickets.
Test-case showing the problem