This changes fast_float's handling of overflow/underflow to be
consistent with the standard: instead of returning errc{} and setting
value to +-0 or +-infinity, just return errc::result_out_of_range and
don't modify value, as per [charconv.from.chars]/1.
libstdc++-v3/ChangeLog:
* src/c++17/fast_float/LOCAL_PATCHES: Update.
* src/c++17/fast_float/fast_float.h (from_chars_advanced): In
case of over/underflow, return errc::result_out_of_range and don't
modify 'value'.
// If we called compute_float<binary_format<T>>(pns.exponent, pns.mantissa) and we have an invalid power (am.power2 < 0),
// then we need to go the long way around again. This is very uncommon.
if(am.power2 < 0) { am = digit_comp<T>(pns, am); }
+
+ if((pns.mantissa != 0 && am.mantissa == 0 && am.power2 == 0) || am.power2 == binary_format<T>::infinite_power()) {
+ // In case of over/underflow, return result_out_of_range and don't modify value,
+ // as per [charconv.from.chars]/1. Note that LWG 3081 wants to modify value in
+ // this case too.
+ answer.ec = std::errc::result_out_of_range;
+ return answer;
+ }
+
to_float(pns.negative, am, value);
return answer;
}