glibc/sysdeps/ieee754/ldbl-128ibm
Joseph Myers 58307649fb Fix hypot sNaN handling (bug 20940).
TS 18661-1 generally defines libm functions taking sNaN arguments to
return qNaN and raise "invalid", even for the cases where a
corresponding qNaN argument would not result in a qNaN return.  This
includes hypot with one argument being an infinity and the other being
an sNaN.  This patch duly fixes hypot implementatations in glibc
(generic and powerpc) to ensure qNaN, computed by arithmetic on the
arguments, is returned in that case.

Various implementations do their checks for infinities and NaNs inline
by manipulating the representations of the arguments.  For simplicity,
this patch just uses issignaling to check for sNaN arguments.  This
could be inlined like the existing code (with due care about reversed
quiet NaN conventions, for implementations where that is relevant),
but given that all these checks are in cases where it's already known
at least one argument is not finite, which should be the uncommon
case, that doesn't seem worthwhile unless performance issues are
observed in practice.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #20940]
	* sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Do not
	return Inf for arguments Inf and sNaN.
	* sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Likewise.
	* sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl):
	Likewise.
	* sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise.
	* sysdeps/powerpc/fpu/e_hypot.c (TEST_INF_NAN): Do not return Inf
	for arguments Inf and sNaN.  When returning a NaN, compute it by
	arithmetic on the arguments.
	* sysdeps/powerpc/fpu/e_hypotf.c (TEST_INF_NAN): Likewise.
	* math/libm-test.inc (pow_test_data): Add tests of sNaN arguments.
2016-12-07 01:16:36 +00:00
..
bits Refactor some libm type-generic macros. 2016-11-10 21:41:56 +00:00
include/bits Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
e_acoshl.c Fix ldbl-128ibm acoshl inaccuracy (bug 18019). 2015-02-25 00:01:15 +00:00
e_acosl.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_asinl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
e_atan2l.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
e_atanhl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
e_coshl.c Fix cosh spurious underflows from expm1 (bug 16354), inaccurate results near 0 (bug 17061). 2014-06-23 20:20:10 +00:00
e_exp10l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_expl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
e_fmodl.c Fix ldbl-128ibm fmodl handling of equal arguments with low part zero (bug 19602). 2016-02-18 22:54:07 +00:00
e_gammal_r.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_hypotl.c Fix hypot sNaN handling (bug 20940). 2016-12-07 01:16:36 +00:00
e_ilogbl.c Fix ldbl-128ibm ilogbl near powers of 2 (bug 18029). 2015-02-26 12:57:21 +00:00
e_j0l.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
e_j1l.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
e_jnl.c Fix j1, jn missing errno setting on underflow (bug 18611). 2015-10-23 21:37:33 +00:00
e_lgammal_r.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
e_log2l.c Convert 231 sysdeps function definitions to prototype style. 2015-10-19 12:04:33 +00:00
e_log10l.c Fix log10 (1) in round-downward mode (bug 16977). 2014-05-23 12:07:50 +00:00
e_logl.c Fix ldbl-128ibm logl inaccuracy near 1 (bug 19351). 2015-12-09 23:51:11 +00:00
e_powl.c Fix sysdeps/ieee754 pow handling of sNaN arguments (bug 20916). 2016-12-02 23:21:15 +00:00
e_rem_pio2l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_remainderl.c Fix ldbl-128ibm remainderl equality test for zero low part (bug 19677). 2016-03-08 00:27:21 +00:00
e_sinhl.c Fix ldbl-128ibm sinhl spurious overflows (bug 19350). 2015-12-09 22:37:08 +00:00
e_sqrtl.c Fix ldbl-128ibm sqrtl (sNaN) (bug 20153). 2016-05-26 22:58:36 +00:00
gamma_productl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ieee754.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_cosl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_sincosl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_sinl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_tanl.c Remove GCC version conditionals on -Wmaybe-uninitialized pragmas. 2015-10-27 23:42:20 +00:00
ldbl2mpn.c Increase internal precision of ldbl-128ibm decimal printf [BZ #19853] 2016-03-31 12:14:33 -05:00
lgamma_negl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lgamma_productl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Makefile Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
math_ldbl.h Fix ldbl-128ibm floorl for non-default rounding modes (bug 17899). 2016-02-18 21:31:10 +00:00
mpn2ldbl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
printf_fphex.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_asinhl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_atanl.c Refactor code forcing underflow exceptions. 2015-09-23 22:42:30 +00:00
s_cbrtl.c ldbl-128: Rename 'long double' to '_Float128' 2016-08-31 10:38:11 -05:00
s_ceill.c Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156). 2016-05-27 13:59:24 +00:00
s_copysignl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_cosl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_erfl.c Remove unused variables 2016-01-27 09:30:16 +01:00
s_expm1l.c Fix ldbl-128ibm expm1l (sNaN) (bug 20233). 2016-06-09 17:24:52 +00:00
s_fabsl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_finitel.c Reduce number of constants in __finite* (bug 15384). 2015-09-17 16:47:14 +00:00
s_floorl.c Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156). 2016-05-27 13:59:24 +00:00
s_fmal.c Merge common usage of mul_split function 2016-08-19 11:29:43 -05:00
s_fpclassifyl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_frexpl.c Fix frexp (NaN) (bug 20250). 2016-06-13 17:27:19 +00:00
s_getpayloadl.c Add getpayload, getpayloadf, getpayloadl. 2016-10-19 01:49:09 +00:00
s_iscanonicall.c Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
s_isinfl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_isnanl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_issignalingl.c Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1. 2016-10-17 22:48:51 +00:00
s_llrintl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llroundl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_log1pl.c Fix ldbl-128ibm log1pl (sNaN) (bug 20234). 2016-06-09 17:25:54 +00:00
s_logbl.c Work around powerpc32 integer 0 converting to -0 (bug 887, bug 19049, bug 19050). 2015-10-05 17:46:50 +00:00
s_lrintl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_lroundl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_modfl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_nearbyintl.c Fix ldbl-128ibm nearbyintl in non-default rounding modes (bug 19790). 2016-03-09 00:30:59 +00:00
s_nextafterl.c Fix ldbl-128ibm nextafterl, nexttowardl sign of zero result (bug 19678). 2016-02-19 17:19:53 +00:00
s_nexttoward.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nexttowardf.c Make nextafter, nexttoward set errno (bug 6799). 2015-11-02 18:54:19 +00:00
s_nextupl.c Add nextup and nextdown math functions 2016-06-16 21:37:45 +05:30
s_remquol.c Fix ldbl-128ibm remainderl, remquol equality tests (bug 19603). 2016-02-19 00:55:46 +00:00
s_rintl.c Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156). 2016-05-27 13:59:24 +00:00
s_roundl.c Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156). 2016-05-27 13:59:24 +00:00
s_scalblnl.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
s_scalbnl.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_setpayloadl_main.c Add setpayload, setpayloadf, setpayloadl. 2016-11-19 00:16:28 +00:00
s_setpayloadl.c Add setpayload, setpayloadf, setpayloadl. 2016-11-19 00:16:28 +00:00
s_setpayloadsigl.c Add setpayloadsig, setpayloadsigf, setpayloadsigl. 2016-11-24 23:56:48 +00:00
s_signbitl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_sincosl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_sinl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_tanhl.c Fix ldbl-128ibm tanhl inaccuracy for small arguments (bug 19349). 2015-12-09 21:20:18 +00:00
s_tanl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_totalorderl.c Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1. 2016-10-17 22:48:51 +00:00
s_totalordermagl.c Define HIGH_ORDER_BIT_IS_SET_FOR_SNAN to 0 or 1. 2016-10-17 22:48:51 +00:00
s_truncl.c Fix ldbl-128ibm ceill, rintl etc. for sNaN arguments (bug 20156). 2016-05-27 13:59:24 +00:00
strtod_nan_ldouble.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strtold_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
t_sincosl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
test-canonical-ldbl-128ibm.c Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
test-fmodl-ldbl-128ibm.c Fix ldbl-128ibm remainderl equality test for zero low part (bug 19677). 2016-03-08 00:27:21 +00:00
test-fmodrem-ldbl-128ibm.c Fix ldbl-128ibm remainderl equality test for zero low part (bug 19677). 2016-03-08 00:27:21 +00:00
test-remainderl-ldbl-128ibm.c Fix ldbl-128ibm remainderl equality test for zero low part (bug 19677). 2016-03-08 00:27:21 +00:00
test-remquol-ldbl-128ibm.c Fix ldbl-128ibm remainderl equality test for zero low part (bug 19677). 2016-03-08 00:27:21 +00:00
test-totalorderl-ldbl-128ibm.c Add totalordermag, totalordermagf, totalordermagl. 2016-10-15 00:36:48 +00:00
tst-strtold-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_expl.c Fix ldbl-128ibm expl overflow in non-default rounding modes (bug 19078). 2015-10-06 17:37:49 +00:00
w_log1pl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
w_scalblnl.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
x2y2m1l.c Merge common usage of mul_split function 2016-08-19 11:29:43 -05:00