Re: ifstream bug in VS2005 Beta2 & Platform SDK

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Sergei Nikolaev wrote:
> Thank you, Carl. The bug report has been submitted.
>
>> The C++ standard does not guarantee that it's possible to write out
>> a double as text and read it back in exactly no matter how many
>> digits of precision you specify. Unfortunately, the behavior you're
>> seeing is probably standard conformant, and hence probably won't be
>> changed.
>
> That is correct. But if someone wrote some number into some media,
> this would be reasonable to expect this data to be read exacly as it
> was written. May be an assert in my code is not guaranteed to be
> satisfied all the time, but IMHO at least all digits have to be read
> correctly.

That's exactly what's not guaranteed. It seems a resonable assumption, but
this very question came up a few months back and the conclusion was that
there's no guarantee that you can write out a double and read it back and be
guaranteed to get the same value bit for bit.

-cd


.



Relevant Pages

  • Re: Is this SET of computable numbers computable?
    ... All digits up to the diagonal are specified. ... We can't guarantee infinite decimals on every number, ... the algorithm is just white box inspected to see 'what' number ... of a function work most likely all values will. ...
    (comp.theory)
  • Re: isodigit
    ... But if char is unsigned, it could be the same width as int, couldn't it? ... Yes, but even so, the basic characters aren't allowed to have ... Does the standard guarantee that all the characters in the basic character ... In some locale where the set of digits includes non-basic ...
    (comp.std.c)
  • Re: ifstream bug in VS2005 Beta2 & Platform SDK
    ... The bug report has been submitted. ... > The C++ standard does not guarantee that it's possible to write out a double ... the behavior you're seeing is probably standard ... but IMHO at least all digits have to be read correctly. ...
    (microsoft.public.vc.stl)
  • Re: Hey CANTORIANS!! HOW MANY DIGITS?
    ... though you've not given an explicit computation ... >> at least 5, and probably more, digits thereof). ... >> may have to be redone over that accumulator. ... I can guarantee that there's a UTM that can compute pi's digits. ...
    (sci.logic)
  • Re: Hey CANTORIANS!! HOW MANY DIGITS?
    ... though you've not given an explicit computation ... >> at least 5, and probably more, digits thereof). ... >> may have to be redone over that accumulator. ... I can guarantee that there's a UTM that can compute pi's digits. ...
    (sci.math)