Re: std::from_chars limitation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 19 Jun 2025, 12:34 Mathieu Malaterre via Gcc-help, <
gcc-help@xxxxxxxxxxx> wrote:

> Dear all,
>
> I am reading the following note taken from url (*)
>
> [...]
> The guarantee that std::from_chars can recover every floating-point
> value formatted by std::to_chars exactly is only provided if both
> functions are from the same implementation.
> [...]
>
> Could some gurus please confirm my understanding of the above note for
> *finite* and/or *normal* numbers (not interested in the special
> nan/inf case) ?
>
> My understanding is that: GCC and MSVC may output a different ASCII
> text given the same inupt floating-point value (bitwise identical).
>

Or in other words, you're assuming that the note refers to formatting
bitwise identical values. It doesn't. The point is that a 'double' on one
implementation is not required to be bitwise identical to a 'double' on a
different implementation. C++ does not require IEEE representations, and so
there's no guarantee of identical bit patterns for any given value.







>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux