gcc/libstdc++-v3
Patrick Palka 6d9dbdf51f libstdc++: Improve ERANGE behavior for fallback FP std::from_chars
The fallback implementation of floating-point std::from_chars (used for
formats other than binary32/64) just calls the C library's strtod family
of functions.  In case of overflow, the behavior of these functions is
rigidly specified:

  If the correct value overflows and default rounding is in effect, plus
  or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to
  the return type and sign of the value), and the value of the macro
  ERANGE is stored in errno.

But in case of underflow, implementations are given more leeway:

  If the result underflows the functions return a value whose magnitude
  is no greater than the smallest normalized positive number in the
  return type; whether errno acquires the value ERANGE is
  implementation-defined.

Thus the fallback implementation can (and does) portably detect overflow,
but it can't portably detect underflow.  However, glibc (and presumably
other high-quality C library implementations) will reliably set errno to
ERANGE in case of underflow as well, and it'll also return the nearest
denormal number to the correct value (zero in case of true underflow),
which allows callers to succesfully parse denormal numbers.

So since we can't be perfect here, this patch takes the best effort
approach of assuming a high quality C library implementation with
respect to this underflow behavior, and refines our implementation
to try to distiguish between a denormal result and true underflow
by inspecting strtod's return value.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc (from_chars_impl): In the
	ERANGE case, distinguish between a denormal result and true
	underflow by checking if the return value is 0.
2022-11-02 08:56:59 -04:00
..
config libstdc++: std::from_chars std::{,b}float16_t support 2022-11-01 13:41:57 +01:00
doc libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
include libstdc++: Remove unnecessary variant member in std::expected 2022-11-02 12:54:16 +00:00
libsupc++ libstdc++: _Bfloat16 for <compare> 2022-11-02 13:35:53 +01:00
po libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
python libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
scripts
src libstdc++: Improve ERANGE behavior for fallback FP std::from_chars 2022-11-02 08:56:59 -04:00
testsuite libstdc++: Shortest denormal hex std::to_chars 2022-11-02 10:06:24 +01:00
acinclude.m4 libstdc++: respect with-{headers, newlib} for default hosted value 2022-10-21 10:41:12 +01:00
aclocal.m4 libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
ChangeLog Daily bump. 2022-11-02 00:17:38 +00:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-2021
config.h.in libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
configure libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
configure.ac libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
configure.host
crossconfig.m4 libstdc++: Allow emergency EH alloc pool size to be tuned [PR68606] 2022-10-11 16:21:48 +01:00
fragment.am
linkage.m4
Makefile.am
Makefile.in libstdc++: Don't use gstdint.h anymore 2022-10-29 00:55:42 +01:00
README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.