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
2022-03-19 00:16:22 +00:00
2022-10-20 00:17:52 +00:00
2022-10-21 00:17:52 +00:00
2022-10-08 00:17:29 +00:00
2022-09-01 00:17:39 +00:00
2022-08-31 00:16:45 +00:00
2022-11-01 00:19:02 +00:00
2021-11-30 00:16:44 +00:00
2022-08-26 00:16:21 +00:00
2022-10-20 00:17:52 +00:00
2022-10-13 00:17:37 +00:00
2022-11-02 00:17:38 +00:00
2022-06-04 00:16:27 +00:00
2022-10-20 00:17:52 +00:00
2022-10-08 00:17:29 +00:00
2022-10-13 00:17:37 +00:00
2022-10-24 00:16:31 +00:00
2022-10-13 00:17:37 +00:00
2022-10-29 00:17:49 +00:00
2022-10-19 00:19:08 +00:00
2022-11-01 00:19:02 +00:00
2022-10-21 00:17:52 +00:00
2022-10-13 00:17:37 +00:00
2022-10-30 00:16:29 +00:00
2022-10-13 00:17:37 +00:00
2022-10-20 00:17:52 +00:00
2022-10-13 00:17:37 +00:00
2022-11-01 00:19:02 +00:00
2022-10-13 00:17:37 +00:00
2022-07-29 00:16:21 +00:00
2022-10-13 00:17:37 +00:00
2022-07-19 17:07:04 +03:00
2022-11-01 00:19:02 +00:00
2021-12-21 09:10:57 +01:00
2022-10-31 11:15:45 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
S
Description
Yggdrasil port of the GNU Compiler Collection
Readme 978 MiB
Languages
C++ 33%
C 27.4%
Ada 13%
Go 7.1%
D 7%
Other 12.1%