[Bug libstdc++/123078] std::from_chars handles signedness of zero in underflow inconsistently with floating-point literals

janschultke at googlemail dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 9 18:22:44 GMT 2025


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

--- Comment #1 from Jan Schultke <janschultke at googlemail dot com> ---
Actually, I think this is a compliance bug.

ISO/IEC 60559:2020 specifies the following in 4.3 Rounding-direction
attributes:

> Except where stated otherwise,
> the rounding-direction attribute affects all computational operations that might be inexact.
> Inexact numeric floating-point results always have the same sign as the unrounded result.

roundTiesToEven has no exception that would apply here, and
https://eel.is/c++draft/charconv.from.chars#lib:from_chars specifies that
round_to_nearest is to be used, which is intended to mirror those ISO/IEC 60559
modes.


More information about the Gcc-bugs mailing list