glibc/sysdeps/ieee754/ldbl-opt
Joseph Myers 59a63cca11 Fix nexttoward overflow in non-default rounding modes (bug 19059).
ISO C requires overflowing results from nexttoward to be the
appropriate infinity independent of the rounding mode, but some
implementations use a rounding-mode-dependent result (this is the same
issue as was fixed for nextafter in bug 16677).  This patch fixes the
problem by making the nexttoward implementations discard the result
from the floating-point computation that forced an overflow exception
and then return the infinity previously computed with integer
arithmetic.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #19059]
	* math/s_nexttowardf.c (__nexttowardf): Do not return value from
	overflowing computation.
	* sysdeps/i386/fpu/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/i386/fpu/s_nexttowardf.c (__nexttowardf): Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c (__nldbl_nexttowardf):
	Likewise.
	* math/libm-test.inc (nexttoward_test_data): Add more tests.
2015-10-02 17:11:13 +00:00
..
cabs.c
cabsl.c
carg.c
cargl.c
cimag.c
cimagl.c
configure rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
configure.ac rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
conj.c
conjl.c
creal.c
creall.c
Makefile Fix "conflicting types for built-in function" warnings from nldbl-*.c. 2012-12-04 20:22:08 +00:00
math_ldbl_opt.c
math_ldbl_opt.h Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
nldbl-acos.c
nldbl-acosh.c
nldbl-asin.c
nldbl-asinh.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_HIDDEN): Removed. 2006-01-14 20:33:13 +00:00
nldbl-asprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-asprintf.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-atan2.c
nldbl-atan.c
nldbl-atanh.c
nldbl-cabs.c
nldbl-cacos.c
nldbl-cacosh.c
nldbl-carg.c
nldbl-casin.c
nldbl-casinh.c
nldbl-catan.c
nldbl-catanh.c
nldbl-cbrt.c
nldbl-ccos.c
nldbl-ccosh.c
nldbl-ceil.c
nldbl-cexp.c
nldbl-cimag.c
nldbl-clog10.c
nldbl-clog.c
nldbl-compat.c Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912). 2015-09-08 21:11:03 +00:00
nldbl-compat.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
nldbl-conj.c
nldbl-copysign.c Use __copysign rather than copysign. 2015-04-22 12:07:56 +00:00
nldbl-cos.c
nldbl-cosh.c
nldbl-cpow.c
nldbl-cproj.c
nldbl-creal.c
nldbl-csin.c
nldbl-csinh.c
nldbl-csqrt.c
nldbl-ctan.c
nldbl-ctanh.c
nldbl-dprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-dprintf.c * sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c: Restore 2006-01-18 23:30:58 +00:00
nldbl-drem.c
nldbl-erf.c
nldbl-erfc.c
nldbl-exp2.c
nldbl-exp10.c
nldbl-exp.c
nldbl-expm1.c
nldbl-fabs.c
nldbl-fdim.c
nldbl-finite.c Replace finite with isfinite. 2015-06-03 16:35:44 +01:00
nldbl-floor.c
nldbl-fma.c
nldbl-fmax.c
nldbl-fmin.c
nldbl-fmod.c
nldbl-fprintf_chk.c
nldbl-fprintf.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-frexp.c
nldbl-fscanf.c
nldbl-fwprintf_chk.c
nldbl-fwprintf.c
nldbl-fwscanf.c
nldbl-gamma.c
nldbl-hypot.c
nldbl-ilogb.c
nldbl-iovfscanf.c
nldbl-isinf.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
nldbl-isnan.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
nldbl-isoc99_fscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_fwscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_scanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_sscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_swscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vfscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vfwscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vsscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vswscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_vwscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-isoc99_wscanf.c * include/stdio.h (__isoc99_fscanf, __isoc99_scanf, 2007-09-18 19:04:01 +00:00
nldbl-j0.c
nldbl-j1.c
nldbl-jn.c
nldbl-ldexp.c
nldbl-lgamma_r.c
nldbl-lgamma.c
nldbl-llrint.c
nldbl-llround.c
nldbl-log1p.c
nldbl-log2.c
nldbl-log10.c
nldbl-log.c
nldbl-logb.c
nldbl-lrint.c
nldbl-lround.c
nldbl-modf.c
nldbl-nan.c
nldbl-nearbyint.c
nldbl-nextafter.c
nldbl-nexttoward.c
nldbl-nexttowardf.c
nldbl-obstack_printf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-obstack_printf.c
nldbl-obstack_vprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-obstack_vprintf.c
nldbl-pow10.c
nldbl-pow.c
nldbl-printf_chk.c
nldbl-printf_fp.c
nldbl-printf_size.c
nldbl-printf.c
nldbl-qecvt_r.c
nldbl-qecvt.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-qfcvt_r.c
nldbl-qfcvt.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-qgcvt.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-remainder.c
nldbl-remquo.c
nldbl-rint.c
nldbl-round.c
nldbl-scalb.c
nldbl-scalbln.c
nldbl-scalbn.c
nldbl-scanf.c
nldbl-signbit.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
nldbl-significand.c
nldbl-sin.c
nldbl-sincos.c
nldbl-sinh.c
nldbl-snprintf_chk.c
nldbl-snprintf.c
nldbl-sprintf_chk.c
nldbl-sprintf.c
nldbl-sqrt.c
nldbl-sscanf.c
nldbl-strfmon_l.c
nldbl-strfmon.c
nldbl-strtold_l.c Remove pre-ISO C support 2012-01-07 23:57:22 -05:00
nldbl-strtold.c
nldbl-strtoldint.c
nldbl-swprintf_chk.c
nldbl-swprintf.c
nldbl-swscanf.c
nldbl-syslog_chk.c
nldbl-syslog.c
nldbl-tan.c
nldbl-tanh.c
nldbl-tgamma.c
nldbl-trunc.c
nldbl-vasprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-vasprintf.c
nldbl-vdprintf_chk.c * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
nldbl-vdprintf.c
nldbl-vfprintf_chk.c
nldbl-vfprintf.c
nldbl-vfscanf.c
nldbl-vfwprintf_chk.c
nldbl-vfwprintf.c
nldbl-vfwscanf.c
nldbl-vprintf_chk.c
nldbl-vprintf.c
nldbl-vscanf.c
nldbl-vsnprintf_chk.c
nldbl-vsnprintf.c
nldbl-vsprintf_chk.c
nldbl-vsprintf.c
nldbl-vsscanf.c
nldbl-vswprintf_chk.c
nldbl-vswprintf.c
nldbl-vswscanf.c
nldbl-vsyslog_chk.c
nldbl-vsyslog.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (NLDBL_DECL): Don't try 2006-01-14 22:08:18 +00:00
nldbl-vwprintf_chk.c
nldbl-vwprintf.c
nldbl-vwscanf.c
nldbl-wcstold_l.c
nldbl-wcstold.c
nldbl-wcstoldint.c
nldbl-wprintf_chk.c
nldbl-wprintf.c
nldbl-wscanf.c
nldbl-y0.c
nldbl-y1.c
nldbl-yn.c
s_asinh.c
s_atan.c
s_cacos.c
s_cacosh.c
s_cacoshl.c
s_cacosl.c
s_casin.c
s_casinh.c
s_casinhl.c
s_casinl.c
s_catan.c
s_catanh.c
s_catanhl.c
s_catanl.c
s_cbrt.c
s_ccos.c
s_ccosh.c
s_ccoshl.c
s_ccosl.c
s_ceil.c
s_cexp.c
s_cexpl.c
s_clog10.c
s_clog10l.c
s_clog.c
s_clogl.c
s_copysign.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_cpow.c
s_cpowl.c
s_cproj.c
s_cprojl.c
s_csin.c
s_csinh.c
s_csinhl.c
s_csinl.c
s_csqrt.c
s_csqrtl.c
s_ctan.c
s_ctanh.c
s_ctanhl.c
s_ctanl.c
s_erf.c
s_expm1.c
s_fabs.c
s_fdim.c
s_fdiml.c
s_finite.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_floor.c
s_fma.c Implement accurate fma. 2010-10-13 22:27:03 -04:00
s_fmal.c
s_fmax.c
s_fmaxl.c
s_fmin.c
s_fminl.c
s_frexp.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_isinf.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_isnan.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_ldexp.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_ldexpl.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_llrint.c
s_llround.c
s_log1p.c
s_logb.c
s_lrint.c
s_lround.c
s_modf.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_nan.c
s_nanl.c
s_nearbyint.c
s_nextafter.c
s_nexttowardfd.c Fix nexttoward overflow in non-default rounding modes (bug 19059). 2015-10-02 17:11:13 +00:00
s_remquo.c
s_rint.c
s_round.c
s_scalbln.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_scalbn.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_significand.c
s_significandl.c
s_sin.c Fixed powerpc64 build. 2015-06-19 20:42:34 +03:00
s_sincos.c
s_tan.c
s_tanh.c
s_trunc.c
Versions * include/stdio.h (__asprintf_chk, __dprintf_chk, 2008-03-05 07:05:13 +00:00
w_acos.c
w_acosh.c
w_acoshl.c
w_acosl.c
w_asin.c
w_asinl.c
w_atan2.c
w_atan2l.c
w_atanh.c
w_atanhl.c
w_cosh.c
w_coshl.c
w_drem.c
w_dreml.c
w_exp10.c
w_exp10l.c
w_exp.c
w_fmod.c
w_fmodl.c
w_hypot.c
w_hypotl.c
w_ilogb.c Fix ilogb exception and errno (bug 6794) 2012-04-17 22:12:53 +02:00
w_ilogbl.c Fix ilogb exception and errno (bug 6794) 2012-04-17 22:12:53 +02:00
w_j0.c
w_j0l.c
w_j1.c
w_j1l.c
w_jn.c
w_jnl.c
w_lgamma_r.c
w_lgamma.c
w_lgammal_r.c
w_lgammal.c
w_log2.c
w_log2l.c
w_log10.c
w_log10l.c
w_log.c
w_logl.c
w_pow.c
w_powl.c
w_remainder.c
w_remainderl.c
w_scalb.c
w_scalbl.c
w_sinh.c
w_sinhl.c
w_sqrt.c
w_sqrtl.c
w_tgamma.c
w_tgammal.c