[charconv.from.chars] Ambiguous specification of floating-point rounding #6730
Labels
lwg
Issue must be reviewed by LWG.
not-editorial
Issue is not deemed editorial; the editorial issue is kept open for tracking.
[charconv.from.chars]/6.4 says:
This is ambiguous. It could mean either:
The resulting value is the implementation's choice of one of a set of values, and that set contains the two values closest to the value of the string.
The resulting value is the implementation's choice of one of a set of values, and that set contains all values that are closest to the value of the string (of which it turns out there can be up to two).
I think the normal English interpretation would be (1), but the intended interpretation is actually (2).
(Under (1), the string "1.0" can produce the value one ULP less than 1.0 or it can produce 1.0, and the string "1.00<lots of 0s>1" can produce those same two values, because the value one ULP less than 1.0 is closer to that string than the value one ULP greater than 1.0.)
Perhaps the wording from [conv.double]/2 and [expr.static.cast]/11 can be used instead:
The text was updated successfully, but these errors were encountered: