From 5c68d401698a58cf7da150d9cce769fa6679ba5f Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 16 Mar 2006 11:47:24 +0000 Subject: [BZ #2423] 2006-03-07 Jakub Jelinek [BZ #2423] * math/libm-test.inc [TEST_LDOUBLE] (ceil_test, floor_test, rint_test, round_test, trunc_test): Only run some of the new tests if LDBL_MANT_DIG > 100. 2006-03-03 Steven Munroe Alan Modra * 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/powerpc/fpu/math_ldbl.h: New file. [BZ #2423] * math/libm-test.inc [TEST_LDOUBLE] (ceil_test, floor_test, rint_test, round_test, trunc_test): Add new tests. * 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): New functions. * 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): New inline functions. * 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/powerpc64/fpu/s_rintl.S: File removed. --- math/libm-test.inc | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 332 insertions(+), 2 deletions(-) (limited to 'math') diff --git a/math/libm-test.inc b/math/libm-test.inc index 9534596..b144796 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. */ @@ -1645,6 +1649,15 @@ ceil_test (void) TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L); TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L); +# if LDBL_MANT_DIG > 100 + 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); +# endif + TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L); TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L); TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L); @@ -1657,6 +1670,22 @@ ceil_test (void) TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L); TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L); +# if LDBL_MANT_DIG > 100 + 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); +# endif + 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 +2657,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 +2671,22 @@ 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (floor, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (floor, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (floor, 4503599627370496.5000000000001L, 4503599627370496.0L); +# endif 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (floor, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (floor, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (floor, -4503599627370496.5000000000001L, -4503599627370497.0L); +# endif TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L); TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L); @@ -2652,12 +2694,30 @@ floor_test (void) TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L); TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L); +# if LDBL_MANT_DIG > 100 + 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); +# endif + 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); +# if LDBL_MANT_DIG > 100 + 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); +# endif + 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 +4031,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 +4044,38 @@ 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); + +# if LDBL_MANT_DIG > 100 + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L); +# endif 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); + +# if LDBL_MANT_DIG > 100 + 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 TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L); TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L); @@ -4039,6 +4131,49 @@ 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L); +# endif + 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); +# if LDBL_MANT_DIG > 100 + 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 +#endif } fesetround(save_round_mode); @@ -4066,6 +4201,49 @@ 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L); +# endif + 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); +# if LDBL_MANT_DIG > 100 + 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 +#endif } fesetround(save_round_mode); @@ -4093,6 +4271,49 @@ 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370496.0L); +# endif + 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); +# if LDBL_MANT_DIG > 100 + 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 +#endif } fesetround(save_round_mode); @@ -4120,6 +4341,49 @@ 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (rint, 4503599627370496.5000000000001L, 4503599627370497.0L); +# endif + 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); +# if LDBL_MANT_DIG > 100 + 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 +#endif } fesetround(save_round_mode); @@ -4142,6 +4406,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 +4421,23 @@ 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (round, 4503599627370494.5000000000001L, 4503599627370495.0L); + TEST_f_f (round, 4503599627370495.5000000000001L, 4503599627370496.0L); + TEST_f_f (round, 4503599627370496.5000000000001L, 4503599627370497.0L); +# endif 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); +# if LDBL_MANT_DIG > 100 + TEST_f_f (round, -4503599627370494.5000000000001L, -4503599627370495.0L); + TEST_f_f (round, -4503599627370495.5000000000001L, -4503599627370496.0L); + TEST_f_f (round, -4503599627370496.5000000000001L, -4503599627370497.0L); +# endif TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L); TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L); @@ -4171,6 +4451,22 @@ round_test (void) TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L); TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L); +# if LDBL_MANT_DIG > 100 + 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); +# endif + 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 +4837,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 +4865,23 @@ trunc_test (void) TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L); TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L); +# if LDBL_MANT_DIG > 100 + TEST_f_f (trunc, 4503599627370494.5000000000001L, 4503599627370494.0L); + TEST_f_f (trunc, 4503599627370495.5000000000001L, 4503599627370495.0L); + TEST_f_f (trunc, 4503599627370496.5000000000001L, 4503599627370496.0L); +# endif + 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); + +# if LDBL_MANT_DIG > 100 + TEST_f_f (trunc, -4503599627370494.5000000000001L, -4503599627370494.0L); + TEST_f_f (trunc, -4503599627370495.5000000000001L, -4503599627370495.0L); + TEST_f_f (trunc, -4503599627370496.5000000000001L, -4503599627370496.0L); +# endif TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L); TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L); @@ -4577,12 +4889,30 @@ trunc_test (void) TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L); TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L); +# if LDBL_MANT_DIG > 100 + 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); +# endif + 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); +# if LDBL_MANT_DIG > 100 + 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); +# endif + TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L); TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L); TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L); -- cgit v1.1