[charconv.from.chars] Clarify how from_chars treats the sign of zero in floating-point underflow #8595
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This clarification is meant to prevent bugs like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123078
Consider parsing
"-1e-1000000000000000"withstd::from_chars.From https://eel.is/c++draft/charconv.from.chars#1.sentence-7, it follows that this tiny value is rounded according to
round_to_nearest, which is supposed to correspond to the ISO/IEC 605559 rounding mode roundTiesToEven. See also https://cplusplus.github.io/LWG/issue4474 (this is not tentatively ready yet, but so far no one in LWG objected thatfloat_round_stylecorresponds to ISO/IEC 60559 rounding modes) (or to C23FLT_ROUNDS).All ISO/IEC 60559 rounding modes preserve the sign in the case of underflow, so a value too small to be represented should result in negative zero.