https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123078

--- Comment #9 from Jan Schultke <janschultke at googlemail dot com> ---
> "There are conflicting interpretations of "not in the range representable" 
> for floating-point types.
> One view is that 1e-10000 and 1e+10000 are outside the representable range 
> for a 64-bit double-precision double (which has min/max exponents of -1022 
> and 1023)."

The range of representable values as per its definition in [basic.fundamental]
includes all real numbers for an ISO/IEC-605559-adhering type, or generally,
for any type with infinities. I don't see any conflicting interpretations
relevant to the example.

This means that according to the current wording, there exists no possible
exponent value (neither E- nor E+) for which std::from_chars would fail.
However, that definition in [basic.fundamental] is quite recent and the
std::from_chars wording predates it.

Either way, E-1000000 denotes a ludicrously small number that is so close to
zero that it ends up rounded to zero. I don't see how any interpretation of
current or future wording would permit std::from_chars to reject all values
that are rounded to zero. libc++ and MSVC STL handle those inputs properly as
well. Even if one interpreted "range of representable values" as only including
finite values, a value very close to zero obviously falls into that range, even
if it's not exactly representable.

Reply via email to