diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-10-05 22:53:50 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-10-05 22:54:50 +0000 |
commit | cec7d28af8ccb40dbf82d99efa13a040b31b9387 (patch) | |
tree | 712f63f528c5cb98381cdc15e063558d72667f35 /NEWS | |
parent | a8133e197ec852cac46132efeeefae14489031f0 (diff) | |
download | glibc-cec7d28af8ccb40dbf82d99efa13a040b31b9387.tar glibc-cec7d28af8ccb40dbf82d99efa13a040b31b9387.tar.gz glibc-cec7d28af8ccb40dbf82d99efa13a040b31b9387.tar.bz2 glibc-cec7d28af8ccb40dbf82d99efa13a040b31b9387.zip |
Fix ldbl-96 lroundl just below powers of 2 (bug 19071).
The ldbl-96 version of lroundl is incorrect for systems with 64-bit
long when the argument's absolute value is just below a power of 2,
2^32 or more, and rounds up to the next integer; in such cases, it
returns 0. The problem is incrementing the high part of the mantissa
loses the high bit of the value (which is not an issue for any other
floating-point format, and is handled specially in lround when the bit
corresponding to 0.5 was in the high part rather than the low part).
This patch fixes this in a similar way to that used in llroundl:
storing the high part in an unsigned long variable before incrementing
it, so problems cannot occur in the case when this code is reachable.
I improved test coverage for both lround and llround by making them
use the same test inputs (appropriately conditioned on the size of
long in the lround case) - complete with the same comments, to make
comparison as easy as possible. (This test coverage improvement was
how I found the lroundl bug.)
Tested for x86_64 and x86.
[BZ #19071]
* sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Use unsigned
long int variable to store possibly incremented high part of
mantissa.
* math/libm-test.inc (lround_test_data): Add tests used for
llround. Use [LONG_MAX > 0x7fffffff] consistently as condition
for tests requiring 64-bit long. Do not condition tests on
[TEST_FLOAT] unnecessarily.
(llround_test_data): Add tests used for lround. Add another
expectation for the "inexact" exception. Do not condition tests
on [TEST_FLOAT] unnecessarily.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -17,7 +17,8 @@ Version 2.23 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18803, 18820, 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18921, 18951, 18952, 18956, 18961, 18966, 18967, 18969, 18970, 18977, - 18980, 18981, 18985, 19003, 19016, 19032, 19046, 19049, 19050, 19059. + 18980, 18981, 18985, 19003, 19016, 19032, 19046, 19049, 19050, 19059, + 19071. * The obsolete header <regexp.h> has been removed. Programs that require this header must be updated to use <regex.h> instead. |