diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-03-07 08:24:12 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-03-07 08:24:12 +0000 |
commit | 4133f08e15452432e4ec0d384f8a7be1199901bb (patch) | |
tree | 4c85cfcf94198e172c0466a5c251b6a7399cdc56 /math | |
parent | d1e6d2178d0b242c9ad40f77216f2f0cae57b97a (diff) | |
download | glibc-4133f08e15452432e4ec0d384f8a7be1199901bb.tar glibc-4133f08e15452432e4ec0d384f8a7be1199901bb.tar.gz glibc-4133f08e15452432e4ec0d384f8a7be1199901bb.tar.bz2 glibc-4133f08e15452432e4ec0d384f8a7be1199901bb.zip |
2006-03-03 Steven Munroe <sjmunroe@us.ibm.com>
Alan Modra <amodra@bigpond.net.au>
[BZ #2423]
* math/libm-test.inc [TEST_LDOUBLE] (ceil_test, floor_test, rint_test,
round_test, trunc_test): Add new tests.
* sysdeps/powerpc/fpu/fenv_libc.h (__fegetround, __fesetround):
Define inline implementations.
* sysdeps/powerpc/fpu/fegetround.c: Use __fegetround.
* sysdeps/powerpc/fpu/fesetround.c: Use __fesetround.
* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
(EXTRACT_IBM_EXTENDED_MANTISSA, INSERT_IBM_EXTENDED_MANTISSA):
Removed, replaced with.
(ldbl_extract_mantissa, ldbl_insert_mantissa, ldbl_pack, ldbl_unpack,
ldbl_canonicalise, ldbl_nearbyint): Define inline utility
functions for IBM long double format.
* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Replace
EXTRACT_IBM_EXTENDED_MANTISSA and INSERT_IBM_EXTENDED_MANTISSA
with ldbl_extract_mantissa and ldbl_insert_mantissa.
* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l):
Replace EXTRACT_IBM_EXTENDED_MANTISSA with ldbl_extract_mantissa.
(ldbl_extract_mantissa, ldbl_insert_mantissa): Defined.
* sysdeps/ieee754/ldbl-128ibm/s_ceill.c (__ceill): Handle rounding
that spans doubles in IBM long double format.
* sysdeps/ieee754/ldbl-128ibm/s_floorl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_roundl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_truncl.c: Likewise.
* sysdeps/powerpc/fpu/math_ldbl.h: New file.
* sysdeps/powerpc/powerpc64/fpu/s_rintl.S: Removed.
Diffstat (limited to 'math')
-rw-r--r-- | math/libm-test.inc | 288 |
1 files changed, 286 insertions, 2 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 9534596725..e2a1d90bf6 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -1628,8 +1628,12 @@ ceil_test (void) TEST_f_f (ceil, M_PIl, 4.0); TEST_f_f (ceil, -M_PIl, -3.0); + TEST_f_f (ceil, 0.1, 1.0); TEST_f_f (ceil, 0.25, 1.0); + TEST_f_f (ceil, 0.625, 1.0); + TEST_f_f (ceil, -0.1, minus_zero); TEST_f_f (ceil, -0.25, minus_zero); + TEST_f_f (ceil, -0.625, minus_zero); #ifdef TEST_LDOUBLE /* The result can only be represented in long double. */ @@ -1644,6 +1648,13 @@ ceil_test (void) TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L); TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L); TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L); + + TEST_f_f (ceil, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (ceil, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (ceil, 4503599627370496.5000000000001L, 4503599627370497.0L); + TEST_f_f (ceil, -4503599627370494.5000000000001L, -4503599627370494.0L); + TEST_f_f (ceil, -4503599627370495.5000000000001L, -4503599627370495.0L); + TEST_f_f (ceil, -4503599627370496.5000000000001L, -4503599627370496.0L); TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L); TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L); @@ -1657,6 +1668,20 @@ ceil_test (void) TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L); TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L); + TEST_f_f (ceil, 9007199254740991.0000000000001L, 9007199254740992.0L); + TEST_f_f (ceil, 9007199254740992.0000000000001L, 9007199254740993.0L); + TEST_f_f (ceil, 9007199254740993.0000000000001L, 9007199254740994.0L); + TEST_f_f (ceil, 9007199254740991.5000000000001L, 9007199254740992.0L); + TEST_f_f (ceil, 9007199254740992.5000000000001L, 9007199254740993.0L); + TEST_f_f (ceil, 9007199254740993.5000000000001L, 9007199254740994.0L); + + TEST_f_f (ceil, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (ceil, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (ceil, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (ceil, -9007199254740991.5000000000001L, -9007199254740991.0L); + TEST_f_f (ceil, -9007199254740992.5000000000001L, -9007199254740992.0L); + TEST_f_f (ceil, -9007199254740993.5000000000001L, -9007199254740993.0L); + TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L); TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L); TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L); @@ -2628,9 +2653,12 @@ floor_test (void) TEST_f_f (floor, M_PIl, 3.0); TEST_f_f (floor, -M_PIl, -4.0); + TEST_f_f (floor, 0.1, 0.0); TEST_f_f (floor, 0.25, 0.0); + TEST_f_f (floor, 0.625, 0.0); + TEST_f_f (floor, -0.1, -1.0); TEST_f_f (floor, -0.25, -1.0); - + TEST_f_f (floor, -0.625, -1.0); #ifdef TEST_LDOUBLE /* The result can only be represented in long double. */ @@ -2639,12 +2667,18 @@ floor_test (void) TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L); TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L); TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L); + TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L); TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L); TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L); TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L); TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L); TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L); + TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L); TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L); TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L); @@ -2652,12 +2686,26 @@ floor_test (void) TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L); TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L); + TEST_f_f (floor, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (floor, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (floor, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (floor, 9007199254740991.5000000000001L, 9007199254740991.0L); + TEST_f_f (floor, 9007199254740992.5000000000001L, 9007199254740992.0L); + TEST_f_f (floor, 9007199254740993.5000000000001L, 9007199254740993.0L); + TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L); TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L); TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L); TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L); TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L); + TEST_f_f (floor, -9007199254740991.0000000000001L, -9007199254740992.0L); + TEST_f_f (floor, -9007199254740992.0000000000001L, -9007199254740993.0L); + TEST_f_f (floor, -9007199254740993.0000000000001L, -9007199254740994.0L); + TEST_f_f (floor, -9007199254740991.5000000000001L, -9007199254740992.0L); + TEST_f_f (floor, -9007199254740992.5000000000001L, -9007199254740993.0L); + TEST_f_f (floor, -9007199254740993.5000000000001L, -9007199254740994.0L); + TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L); TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L); TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L); @@ -3971,6 +4019,12 @@ rint_test (void) TEST_f_f (rint, -2.5, -2.0); TEST_f_f (rint, -3.5, -4.0); TEST_f_f (rint, -4.5, -4.0); + TEST_f_f (rint, 0.1, 0.0); + TEST_f_f (rint, 0.25, 0.0); + TEST_f_f (rint, 0.625, 1.0); + TEST_f_f (rint, -0.1, -0.0); + TEST_f_f (rint, -0.25, -0.0); + TEST_f_f (rint, -0.625, -1.0); #ifdef TEST_LDOUBLE /* The result can only be represented in long double. */ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L); @@ -3978,12 +4032,34 @@ rint_test (void) TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L); TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L); TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L); + + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L); TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L); TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L); TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L); TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L); TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L); + + TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L); + + TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L); + + TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L); TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L); TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L); @@ -4039,6 +4115,45 @@ rint_test_tonearest (void) TEST_f_f (rint, -1.0, -1.0); TEST_f_f (rint, -1.5, -2.0); TEST_f_f (rint, -2.0, -2.0); + TEST_f_f (rint, 0.1, 0.0); + TEST_f_f (rint, 0.25, 0.0); + TEST_f_f (rint, 0.625, 1.0); + TEST_f_f (rint, -0.1, -0.0); + TEST_f_f (rint, -0.25, -0.0); + TEST_f_f (rint, -0.625, -1.0); +#ifdef TEST_LDOUBLE + /* The result can only be represented in long double. */ + TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L); + TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L); + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L); + TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L); + TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L); + TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L); + + TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L); + + TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L); +#endif } fesetround(save_round_mode); @@ -4066,6 +4181,45 @@ rint_test_towardzero (void) TEST_f_f (rint, -1.0, -1.0); TEST_f_f (rint, -1.5, -1.0); TEST_f_f (rint, -2.0, -2.0); + TEST_f_f (rint, 0.1, 0.0); + TEST_f_f (rint, 0.25, 0.0); + TEST_f_f (rint, 0.625, 0.0); + TEST_f_f (rint, -0.1, -0.0); + TEST_f_f (rint, -0.25, -0.0); + TEST_f_f (rint, -0.625, -0.0); +#ifdef TEST_LDOUBLE + /* The result can only be represented in long double. */ + TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L); + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L); + TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L); + TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L); + + TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L); + TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L); + + TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L); + TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L); +#endif } fesetround(save_round_mode); @@ -4093,6 +4247,45 @@ rint_test_downward (void) TEST_f_f (rint, -1.0, -1.0); TEST_f_f (rint, -1.5, -2.0); TEST_f_f (rint, -2.0, -2.0); + TEST_f_f (rint, 0.1, 0.0); + TEST_f_f (rint, 0.25, 0.0); + TEST_f_f (rint, 0.625, 0.0); + TEST_f_f (rint, -0.1, -1.0); + TEST_f_f (rint, -0.25, -1.0); + TEST_f_f (rint, -0.625, -1.0); +#ifdef TEST_LDOUBLE + /* The result can only be represented in long double. */ + TEST_f_f (rint, 4503599627370495.5L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.75L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370497.5L, 4503599627370497.0L); + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.25L, -4503599627370497.0L); + TEST_f_f (rint, -4503599627370496.5L, -4503599627370497.0L); + TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L); + TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L); + TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370497.0L); + + TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740991.0L); + TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740993.0L); + + TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740994.0L); + TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740994.0L); +#endif } fesetround(save_round_mode); @@ -4120,6 +4313,45 @@ rint_test_upward (void) TEST_f_f (rint, -1.0, -1.0); TEST_f_f (rint, -1.5, -1.0); TEST_f_f (rint, -2.0, -2.0); + TEST_f_f (rint, 0.1, 1.0); + TEST_f_f (rint, 0.25, 1.0); + TEST_f_f (rint, 0.625, 1.0); + TEST_f_f (rint, -0.1, -0.0); + TEST_f_f (rint, -0.25, -0.0); + TEST_f_f (rint, -0.625, -0.0); +#ifdef TEST_LDOUBLE + /* The result can only be represented in long double. */ + TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.25L, 4503599627370497.0L); + TEST_f_f (rint, 4503599627370496.5L, 4503599627370497.0L); + TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L); + TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L); + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L); + TEST_f_f (rint, -4503599627370495.5L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370496.75L, -4503599627370496.0L); + TEST_f_f (rint, -4503599627370497.5L, -4503599627370497.0L); + TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370494.0L); + TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370495.0L); + TEST_f_f (rint, -4503599627370496.5000000000001L, -4503599627370496.0L); + + TEST_f_f (rint, 9007199254740991.0000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740992.0000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740993.0000000000001L, 9007199254740994.0L); + TEST_f_f (rint, 9007199254740991.5000000000001L, 9007199254740992.0L); + TEST_f_f (rint, 9007199254740992.5000000000001L, 9007199254740993.0L); + TEST_f_f (rint, 9007199254740993.5000000000001L, 9007199254740994.0L); + + TEST_f_f (rint, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (rint, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (rint, -9007199254740991.5000000000001L, -9007199254740991.0L); + TEST_f_f (rint, -9007199254740992.5000000000001L, -9007199254740992.0L); + TEST_f_f (rint, -9007199254740993.5000000000001L, -9007199254740993.0L); +#endif } fesetround(save_round_mode); @@ -4142,6 +4374,12 @@ round_test (void) TEST_f_f (round, -0.8L, -1.0); TEST_f_f (round, 1.5, 2.0); TEST_f_f (round, -1.5, -2.0); + TEST_f_f (round, 0.1, 0.0); + TEST_f_f (round, 0.25, 0.0); + TEST_f_f (round, 0.625, 1.0); + TEST_f_f (round, -0.1, -0.0); + TEST_f_f (round, -0.25, -0.0); + TEST_f_f (round, -0.625, -1.0); TEST_f_f (round, 2097152.5, 2097153); TEST_f_f (round, -2097152.5, -2097153); @@ -4151,13 +4389,19 @@ round_test (void) TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L); TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L); TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L); - TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L); + TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L); + TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L); TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L); TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L); TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L); TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L); TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L); + TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L); TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L); TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L); @@ -4171,6 +4415,20 @@ round_test (void) TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L); TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L); + TEST_f_f (round, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (round, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (round, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (round, 9007199254740991.5000000000001L, 9007199254740992.0L); + TEST_f_f (round, 9007199254740992.5000000000001L, 9007199254740993.0L); + TEST_f_f (round, 9007199254740993.5000000000001L, 9007199254740994.0L); + + TEST_f_f (round, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (round, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (round, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (round, -9007199254740991.5000000000001L, -9007199254740992.0L); + TEST_f_f (round, -9007199254740992.5000000000001L, -9007199254740993.0L); + TEST_f_f (round, -9007199254740993.5000000000001L, -9007199254740994.0L); + TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L); TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L); TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L); @@ -4541,7 +4799,11 @@ trunc_test (void) TEST_f_f (trunc, 0, 0); TEST_f_f (trunc, minus_zero, minus_zero); + TEST_f_f (trunc, 0.1, 0); + TEST_f_f (trunc, 0.25, 0); TEST_f_f (trunc, 0.625, 0); + TEST_f_f (trunc, -0.1, minus_zero); + TEST_f_f (trunc, -0.25, minus_zero); TEST_f_f (trunc, -0.625, minus_zero); TEST_f_f (trunc, 1, 1); TEST_f_f (trunc, -1, -1); @@ -4565,11 +4827,19 @@ trunc_test (void) TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L); TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L); + TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L); + TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L); TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L); TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L); TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L); TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L); + + TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L); + TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L); + TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L); TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L); TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L); @@ -4577,12 +4847,26 @@ trunc_test (void) TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L); TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L); + TEST_f_f (trunc, 9007199254740991.0000000000001L, 9007199254740991.0L); + TEST_f_f (trunc, 9007199254740992.0000000000001L, 9007199254740992.0L); + TEST_f_f (trunc, 9007199254740993.0000000000001L, 9007199254740993.0L); + TEST_f_f (trunc, 9007199254740991.5000000000001L, 9007199254740991.0L); + TEST_f_f (trunc, 9007199254740992.5000000000001L, 9007199254740992.0L); + TEST_f_f (trunc, 9007199254740993.5000000000001L, 9007199254740993.0L); + TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L); TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L); TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L); TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L); TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L); + TEST_f_f (trunc, -9007199254740991.0000000000001L, -9007199254740991.0L); + TEST_f_f (trunc, -9007199254740992.0000000000001L, -9007199254740992.0L); + TEST_f_f (trunc, -9007199254740993.0000000000001L, -9007199254740993.0L); + TEST_f_f (trunc, -9007199254740991.5000000000001L, -9007199254740991.0L); + TEST_f_f (trunc, -9007199254740992.5000000000001L, -9007199254740992.0L); + TEST_f_f (trunc, -9007199254740993.5000000000001L, -9007199254740993.0L); + TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L); TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L); TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L); |