glibc/sysdeps/ieee754
Joseph Myers 739babd775 Fix fma spurious underflows (bug 18824).
Various fma implementations have logic that, when computing fma (x, y,
z) where z is large (so care needs taking to avoid internal overflow)
but x * y is small, scale x * y up instead of down to avoid internal
underflows resulting from scaling down.  (In these cases, x * y is
small enough that only its sign actually matters rather than the exact
value.)

The threshold for scaling up instead of down was correct for "if the
unscaled values were multiplied, the low part of the multiplication
could underflow", and the scaling was sufficient to ensure that the
low part of the multiplication did not underflow (given that cases of
very small x * y - less than half the least subnormal - were
previously dealt with).  However, the choice in the functions wasn't
between scaling up or no scaling, but between scaling up and scaling
down (scaling down actually being needed when x * y isn't so small
compared to z and so the exact value does matter).  Thus a larger
threshold is needed to ensure that scaling down doesn't produce values
the multiplication of whose low parts underflows.  This patch
increases the thresholds accordingly.

Tested for x86_64, x86 and mips64 (with the MIPS version of s_fmal.c
removed so that the ldbl-128 version gets tested instead of the
soft-fp one).

	[BZ #18824]
	* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Increase threshold for
	scaling x * y up instead of down.
	* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Likewise.
	* math/auto-libm-test-in: Add more tests of fma.
	* math/auto-libm-test-out: Regenerated.
2015-08-14 17:15:06 +00:00
..
bits Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dbl-64 Fix fma spurious underflows (bug 18824). 2015-08-14 17:15:06 +00:00
flt-32 Fix tanh missing underflows (bug 16520). 2015-08-13 16:40:39 +00:00
ldbl-64-128 Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
ldbl-96 Fix fma spurious underflows (bug 18824). 2015-08-14 17:15:06 +00:00
ldbl-128 Fix fma spurious underflows (bug 18824). 2015-08-14 17:15:06 +00:00
ldbl-128ibm Fix tanh missing underflows (bug 16520). 2015-08-13 16:40:39 +00:00
ldbl-opt Fixed powerpc64 build. 2015-06-19 20:42:34 +03:00
ieee754.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
k_standard.c Add comment to CSTR macro in k_standard.c. 2015-02-27 01:12:19 +00:00
k_standardf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
k_standardl.c Fix spurious "inexact" exceptions from __kernel_standard_l (bug 18245, bug 18583). 2015-06-23 17:26:46 +00:00
Makefile Avoid -Wno-write-strings for k_standard.c. 2015-02-26 22:50:54 +00:00
s_lib_version.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
s_matherr.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_signgam.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00