* math/libm-test.inc (lround_test): Add new test.
(llround_test): Likewise.
(lrint_test): Likewise.
(llrint_test): Likewise.
* sysdeps/ieee754/dbl-64/s_lround.c (__lround): Fix special case
with result taking up 20 bits.
* sysdeps/ieee754/dbl-64/s_lrint.c (__lrint): Likewise.
* sysdeps/ieee754/dbl-64/s_llrint.c (__llrint): Likewise..
* sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Fix special
case with result taking up 31 bits.
* sysdeps/ieee754/ldbl-96/s_lrintl.c (__lrintl): Likewise.
2004-02-01 Ulrich Drepper <drepper@redhat.com>
+ * math/libm-test.inc (lround_test): Add new test.
+ (llround_test): Likewise.
+ (lrint_test): Likewise.
+ (llrint_test): Likewise.
+ * sysdeps/ieee754/dbl-64/s_lround.c (__lround): Fix special case
+ with result taking up 20 bits.
+ * sysdeps/ieee754/dbl-64/s_lrint.c (__lrint): Likewise.
+ * sysdeps/ieee754/dbl-64/s_llrint.c (__llrint): Likewise..
+ * sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Fix special
+ case with result taking up 31 bits.
+ * sysdeps/ieee754/ldbl-96/s_lrintl.c (__lrintl): Likewise.
+
* po/nl.po: Update from translation team.
2004-01-30 Andreas Schwab <schwab@suse.de>
-/* Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1997.
TEST_f_l (lrint, 8388600.3L, 8388600);
TEST_f_l (lrint, -8388600.3L, -8388600);
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+#endif
+
END (lrint);
}
TEST_f_L (llrint, 8388600.3L, 8388600);
TEST_f_L (llrint, -8388600.3L, -8388600);
+ TEST_f_l (llrint, 1071930.0008, 1071930);
+
/* Test boundary conditions. */
/* 0x1FFFFF */
TEST_f_L (llrint, 2097151.0,2097151LL);
TEST_f_l (lround, -1.5, -2);
TEST_f_l (lround, 22514.5, 22515);
TEST_f_l (lround, -22514.5, -22515);
+ TEST_f_l (lround, 1071930.0008, 1071930);
#ifndef TEST_FLOAT
+ TEST_f_l (lround, 1073741824.01, 1073741824);
TEST_f_l (lround, 2097152.5, 2097153);
TEST_f_l (lround, -2097152.5, -2097153);
#endif
TEST_f_L (llround, -1.5, -2);
TEST_f_L (llround, 22514.5, 22515);
TEST_f_L (llround, -22514.5, -22515);
+ TEST_f_l (llround, 1071930.0008, 1071930);
#ifndef TEST_FLOAT
TEST_f_L (llround, 2097152.5, 2097153);
TEST_f_L (llround, -2097152.5, -2097153);
/* 0x10000000000000 */
TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
/* 0x10000080000000 */
- TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+ TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
/* 0x20000000000000 */
TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
/* 0x80000000000000 */
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
i0 &= 0xfffff;
i0 |= 0x100000;
- result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
+ if (j0 == 20)
+ result = (long long int) i0;
+ else
+ result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
}
}
else
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
i0 &= 0xfffff;
i0 |= 0x100000;
- result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
+ if (j0 == 20)
+ result = (long int) i0;
+ else
+ result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
}
}
else
/* Round double value to long int.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
if (j < i1)
++i0;
- result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
+ if (j0 == 20)
+ result = (long int) i0;
+ else
+ result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
}
}
else
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
GET_LDOUBLE_WORDS (se, i0, i1, t);
j0 = (se & 0x7fff) - 0x3fff;
- result = ((long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
+ if (j0 == 31)
+ result = (long int) i0;
+ else
+ result = ((long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
}
}
else
/* Round long double value to long int.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
if (j < i1)
++i0;
- result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+ if (j0 == 31)
+ result = (long int) i0;
+ else
+ result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
}
}
else