diff options
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r-- | math/libm-test.inc | 334 |
1 files changed, 332 insertions, 2 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 9534596725..b144796f2a 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); |