glibc/sysdeps/powerpc/fpu
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
..
e_hypot.c Fix hypot sNaN handling (bug 20940). 2016-12-07 01:16:36 +00:00
e_hypotf.c Fix hypot sNaN handling (bug 20940). 2016-12-07 01:16:36 +00:00
e_rem_pio2f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_sqrt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
e_sqrtf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fclrexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fe_mask.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fe_nomask.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fedisblxcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feenablxcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetexcept.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fegetmode.c Add femode_t functions: powerpc. 2016-09-07 16:46:47 +00:00
fegetround.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feholdexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fenv_const.c Add femode_t functions. 2016-09-07 16:40:09 +00:00
fenv_libc.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fenv_private.h powerpc: Cleanup fenv_private.h 2016-10-21 16:40:03 -02:00
fesetenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fesetexcept.c Add fesetexcept: powerpc. 2016-08-16 16:22:12 +00:00
fesetmode.c Add femode_t functions: powerpc. 2016-09-07 16:46:47 +00:00
fesetround.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
feupdateenv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fgetexcptflg.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fix-fp-int-compare-invalid.h Add iseqsig. 2016-10-06 22:19:38 +00:00
fraiseexcpt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
fsetexcptflg.c Add comment from sysdeps/powerpc/fpu/fraiseexcpt.c to fsetexcptflg.c. 2016-08-12 17:49:07 +00:00
ftestexcept.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_cosf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_rem_pio2f.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
k_sinf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
libm-test-ulps powerpc: Regenerate ULPs 2016-10-05 08:57:47 -03:00
libm-test-ulps-name Do not hardcode platform names in manual/libm-err-tab.pl (bug 14139). 2016-11-04 16:49:06 +00:00
Makefile Link extra-libs consistently with libc and ld.so. 2013-05-31 16:16:33 +00:00
math_ldbl.h PowerPC: unify math_ldbl.h implementations 2013-03-08 11:07:15 -03:00
math_private.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_cosf.c Remove unused variables 2016-01-27 09:30:16 +01:00
s_fabs.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fabsf.S Update. 1999-10-10 00:00:36 +00:00
s_float_bitwise.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fma.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmax.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fmaxf.S Update. 1999-10-10 00:00:36 +00:00
s_fmin.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fminf.S Update. 1999-10-10 00:00:36 +00:00
s_isnan.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_isnanf.S Update. 1999-10-10 00:00:36 +00:00
s_lrintf.S Update. 1999-10-10 00:00:36 +00:00
s_rint.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_rintf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_sinf.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
t_sqrt.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
tst-setcontext-fpscr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00