mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-28 12:13:37 +08:00
Fix lround() loses precision
This commit is contained in:
parent
5f69cd2f94
commit
7f5517aa52
@ -1,3 +1,9 @@
|
||||
2011-08-18 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||
Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* math/libm-test.inc (lround_test): New testcase.
|
||||
* sysdeps/ieee754/dbl-64/s_lround.c (__lround): Don't lose precision.
|
||||
|
||||
2011-09-08 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* Makefile: Remove support for automatic cvs check-ins.
|
||||
|
@ -4386,6 +4386,7 @@ lround_test (void)
|
||||
TEST_f_l (lround, 1073741824.01, 1073741824);
|
||||
# if LONG_MAX > 281474976710656
|
||||
TEST_f_l (lround, 281474976710656.025, 281474976710656);
|
||||
TEST_f_l (llround, -3.65309740835E17, -365309740835000000);
|
||||
# endif
|
||||
TEST_f_l (lround, 2097152.5, 2097153);
|
||||
TEST_f_l (lround, -2097152.5, -2097153);
|
||||
|
@ -51,7 +51,7 @@ __lround (double x)
|
||||
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
|
||||
{
|
||||
if (j0 >= 52)
|
||||
result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
|
||||
result = ((long int) i0 << (j0 - 20)) | ((long int) i1 << (j0 - 52));
|
||||
else
|
||||
{
|
||||
u_int32_t j = i1 + (0x80000000 >> (j0 - 20));
|
||||
|
Loading…
Reference in New Issue
Block a user