|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2006-03-16 05:28:04
> but honestly - there must be a bug somewhere (I belive it's in
> lexical_cast), right? Maybe authors of lexical_cast should add one
> significant place to the string? If not - then why this won't work? Is
> it really impossible to avoid losing data in conversions?
No, as already discussed the problem is that many iostreams libraries do not
round trip the binary floating point representation to decimal and back
again. This is technically possible to do (albeit with quite heroic
efforts), but apparently std lib vendors don't consider it crucial :-(
That was why I suggested using the C99 style hex format for floats in the
serialisation lib: that format is both portable and readily round-trippable
since there's no binary-to-decimal conversion involved (just binary to hex).
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk