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). > > Using google/chatgpt I could not find one such number. > Try a long double value X that can't be represented in 64-bit double. Now consider that MSVC has 64-bit long double. Obviously, you cannot recover the full value of X if you read it into a long double with MSVC. The note you quoted is intended to cover cases like this, where a 'long double' written by one implementation cannot be accurately read as a 'long double' in another implementation where 'long double' means something different on the two implementations. For float and double you shouldn't be able to find any such values, because GCC and MSVC both use IEEE binary32 for float and IEEE binary64 for double. But in theory, 'float' on one platform might not be able to represent all the values of 'float' on an arbitrary different platform.