glibc/sysdeps/ieee754
Joseph Myers 7d0b257541 Fix ldbl-128 roundl for exponents in [31, 47] (bug 18346).
The implementation of roundl for ldbl-128 involves undefined behavior
for arguments with exponents from 31 to 47 inclusive, from the shift:

      u_int64_t i = -1ULL >> (j0 - 48);

For example, on mips64, this means roundl (0xffffffffffff.8p0L)
wrongly returns its argument, which is not an integer.  A condition
checking for exponents < 31 should actually be checking for exponents
< 48, and this patch makes it do so.  (That condition is for whether
the bit representing 0.5 is in the high 64-bit half of the
floating-point number.  The value 31 might have arisen from an
incorrect conversion of the ldbl-96 version to handle ldbl-128.)

This was originally reported as a GCC libquadmath bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65757>.

Tested for mips64; also tested for x86_64 and x86 to make sure the new
tests pass there.

	[BZ #18346]
	* sysdeps/ieee754/ldbl-128/s_roundl.c (__roundl): Handle all
	exponents less than 48 as cases where high part of mantissa needs
	examining to determine whether argument is integral.
	* math/libm-test.inc (round_test_data): Add more tests.
2015-04-28 17:27:02 +00:00
..
bits Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dbl-64 Use __copysign rather than copysign. 2015-04-22 12:07:56 +00:00
flt-32 Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
ldbl-64-128 Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
ldbl-96 Fix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047). 2015-02-27 17:48:37 +00:00
ldbl-128 Fix ldbl-128 roundl for exponents in [31, 47] (bug 18346). 2015-04-28 17:27:02 +00:00
ldbl-128ibm Set errno for log1p on pole/domain error. 2015-04-13 21:19:27 +02:00
ldbl-opt Use __copysign rather than copysign. 2015-04-22 12:07:56 +00: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 Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +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
support.c Fix leading whitespaces. 2013-06-06 20:36:07 +02:00