diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-05-16 13:16:56 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-05-16 13:16:56 +0000 |
commit | 15c7c18dc6775f6eea09f927fa0b327ab32ef738 (patch) | |
tree | 14a37f8315f820218e44cc2d9124bddc82005e1f /math/libm-test.inc | |
parent | f137ff13835e2ac6f0d85f37b7ff32d134c9de18 (diff) | |
download | glibc-15c7c18dc6775f6eea09f927fa0b327ab32ef738.tar glibc-15c7c18dc6775f6eea09f927fa0b327ab32ef738.tar.gz glibc-15c7c18dc6775f6eea09f927fa0b327ab32ef738.tar.bz2 glibc-15c7c18dc6775f6eea09f927fa0b327ab32ef738.zip |
Convert TEST_f_L tests from code to data.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r-- | math/libm-test.inc | 1549 |
1 files changed, 780 insertions, 769 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 0843482d8d..10378de7aa 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -1009,6 +1009,14 @@ struct test_f_l_data long int max_ulp; int exceptions; }; +struct test_f_L_data +{ + const char *test_name; + FLOAT arg; + long long int expected; + long long int max_ulp; + int exceptions; +}; /* Set the rounding mode, or restore the saved value. */ #define IF_ROUND_INIT_ /* Empty. */ @@ -1281,6 +1289,13 @@ struct test_f_l_data MAX_ULP, EXCEPTIONS) \ check_longlong (TEST_NAME, FUNC (FUNC_NAME) (ARG), EXPECTED, \ MAX_ULP, EXCEPTIONS) +#define RUN_TEST_LOOP_f_L(FUNC_NAME, ARRAY, ROUNDING_MODE) \ + IF_ROUND_INIT_ ## ROUNDING_MODE \ + for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \ + RUN_TEST_f_L ((ARRAY)[i].test_name, FUNC_NAME, (ARRAY)[i].arg, \ + (ARRAY)[i].expected, (ARRAY)[i].max_ulp, \ + (ARRAY)[i].exceptions); \ + ROUND_RESTORE_ ## ROUNDING_MODE #define RUN_TEST_sincos(ARG, TEST_NAME_SIN, SIN_RES_VAR, EXPECTED_SIN, \ MAX_ULP_SIN, TEST_NAME_COS, COS_RES_VAR, \ EXPECTED_COS, MAX_ULP_COS, EXCEPTIONS) \ @@ -10546,682 +10561,674 @@ lrint_test_upward (void) } +static const struct test_f_L_data llrint_test_data[] = + { + START_DATA (llrint), + /* XXX this test is incomplete. We need to have a way to specifiy + the rounding method and test the critical cases. So far, only + unproblematic numbers are tested. */ + /* TODO: missing +/-Inf as well as qNaN tests. */ + TEST_f_L (llrint, 0.0, 0), + TEST_f_L (llrint, minus_zero, 0), + TEST_f_L (llrint, 0.2L, 0), + TEST_f_L (llrint, -0.2L, 0), + + TEST_f_L (llrint, 1.4L, 1), + TEST_f_L (llrint, -1.4L, -1), + + 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), + /* 0x800000 */ + TEST_f_L (llrint, 8388608.0, 8388608LL), + /* 0x1000000 */ + TEST_f_L (llrint, 16777216.0, 16777216LL), + /* 0x20000000000 */ + TEST_f_L (llrint, 2199023255552.0, 2199023255552LL), + /* 0x40000000000 */ + TEST_f_L (llrint, 4398046511104.0, 4398046511104LL), + /* 0x1000000000000 */ + TEST_f_L (llrint, 281474976710656.0, 281474976710656LL), + /* 0x10000000000000 */ + TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL), + /* 0x10000080000000 */ + TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL), + /* 0x20000000000000 */ + TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL), + /* 0x80000000000000 */ + TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL), + /* 0x100000000000000 */ + TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL), +#ifdef TEST_LDOUBLE + /* The input can only be represented in long double. */ + TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL), + + TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL), + +# if LDBL_MANT_DIG > 100 + TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL), + + TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL), +#endif + + TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL), + + TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL), + +# if LDBL_MANT_DIG > 100 + TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL), + + TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL), +#endif + + TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL), + TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL), + + TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL), + TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL), + +# if LDBL_MANT_DIG > 100 + TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L), + TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL), + TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL), +# endif +#endif + END_DATA (llrint) + }; + static void llrint_test (void) { - /* XXX this test is incomplete. We need to have a way to specifiy - the rounding method and test the critical cases. So far, only - unproblematic numbers are tested. */ - /* TODO: missing +/-Inf as well as qNaN tests. */ - START (llrint); + RUN_TEST_LOOP_f_L (llrint, llrint_test_data, ); + END (llrint); +} - TEST_f_L (llrint, 0.0, 0); - TEST_f_L (llrint, minus_zero, 0); - TEST_f_L (llrint, 0.2L, 0); - TEST_f_L (llrint, -0.2L, 0); - - TEST_f_L (llrint, 1.4L, 1); - TEST_f_L (llrint, -1.4L, -1); - - 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); - /* 0x800000 */ - TEST_f_L (llrint, 8388608.0, 8388608LL); - /* 0x1000000 */ - TEST_f_L (llrint, 16777216.0, 16777216LL); - /* 0x20000000000 */ - TEST_f_L (llrint, 2199023255552.0, 2199023255552LL); - /* 0x40000000000 */ - TEST_f_L (llrint, 4398046511104.0, 4398046511104LL); - /* 0x1000000000000 */ - TEST_f_L (llrint, 281474976710656.0, 281474976710656LL); - /* 0x10000000000000 */ - TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL); - /* 0x10000080000000 */ - TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL); - /* 0x20000000000000 */ - TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL); - /* 0x80000000000000 */ - TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL); - /* 0x100000000000000 */ - TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL); +static const struct test_f_L_data llrint_tonearest_test_data[] = + { + START_DATA (llrint_tonearest), + TEST_f_L (llrint, 0.0, 0), + TEST_f_L (llrint, minus_zero, 0), + TEST_f_L (llrint, 0.2L, 0), + TEST_f_L (llrint, -0.2L, 0), + + TEST_f_L (llrint, 1.4L, 1), + TEST_f_L (llrint, -1.4L, -1), + + 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), + /* 0x800000 */ + TEST_f_L (llrint, 8388608.0, 8388608LL), + /* 0x1000000 */ + TEST_f_L (llrint, 16777216.0, 16777216LL), + /* 0x20000000000 */ + TEST_f_L (llrint, 2199023255552.0, 2199023255552LL), + /* 0x40000000000 */ + TEST_f_L (llrint, 4398046511104.0, 4398046511104LL), + /* 0x1000000000000 */ + TEST_f_L (llrint, 281474976710656.0, 281474976710656LL), + /* 0x10000000000000 */ + TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL), + /* 0x10000080000000 */ + TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL), + /* 0x20000000000000 */ + TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL), + /* 0x80000000000000 */ + TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL), + /* 0x100000000000000 */ + TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL), #ifdef TEST_LDOUBLE - /* The input can only be represented in long double. */ - TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL); - - TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL); + /* The input can only be represented in long double. */ + TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL), + + TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL); - - TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL); -#endif - - TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL); - - TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL); + TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL), + + TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL), +#endif + + TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL), + + TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL); - - TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL); -#endif - - TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL); - TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL); - - TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL); - TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL); + TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL), + + TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL), +#endif + + TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL), + TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL), + + TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL), + TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L); - TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL); - TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL); + TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L), + TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL), + TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL), # endif #endif - - END (llrint); -} + END_DATA (llrint_tonearest) + }; static void llrint_test_tonearest (void) { - int save_round_mode; START (llrint_tonearest); + RUN_TEST_LOOP_f_L (llrint, llrint_tonearest_test_data, FE_TONEAREST); + END (llrint_tonearest); +} - save_round_mode = fegetround (); - - if (!fesetround (FE_TONEAREST)) - { - TEST_f_L (llrint, 0.0, 0); - TEST_f_L (llrint, minus_zero, 0); - TEST_f_L (llrint, 0.2L, 0); - TEST_f_L (llrint, -0.2L, 0); - - TEST_f_L (llrint, 1.4L, 1); - TEST_f_L (llrint, -1.4L, -1); - - 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); - /* 0x800000 */ - TEST_f_L (llrint, 8388608.0, 8388608LL); - /* 0x1000000 */ - TEST_f_L (llrint, 16777216.0, 16777216LL); - /* 0x20000000000 */ - TEST_f_L (llrint, 2199023255552.0, 2199023255552LL); - /* 0x40000000000 */ - TEST_f_L (llrint, 4398046511104.0, 4398046511104LL); - /* 0x1000000000000 */ - TEST_f_L (llrint, 281474976710656.0, 281474976710656LL); - /* 0x10000000000000 */ - TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL); - /* 0x10000080000000 */ - TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL); - /* 0x20000000000000 */ - TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL); - /* 0x80000000000000 */ - TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL); - /* 0x100000000000000 */ - TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL); +static const struct test_f_L_data llrint_towardzero_test_data[] = + { + START_DATA (llrint_towardzero), + TEST_f_L (llrint, 0.0, 0), + TEST_f_L (llrint, minus_zero, 0), + TEST_f_L (llrint, 0.2L, 0), + TEST_f_L (llrint, -0.2L, 0), + + TEST_f_L (llrint, 1.4L, 1), + TEST_f_L (llrint, -1.4L, -1), + + 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), + /* 0x800000 */ + TEST_f_L (llrint, 8388608.0, 8388608LL), + /* 0x1000000 */ + TEST_f_L (llrint, 16777216.0, 16777216LL), + /* 0x20000000000 */ + TEST_f_L (llrint, 2199023255552.0, 2199023255552LL), + /* 0x40000000000 */ + TEST_f_L (llrint, 4398046511104.0, 4398046511104LL), + /* 0x1000000000000 */ + TEST_f_L (llrint, 281474976710656.0, 281474976710656LL), + /* 0x10000000000000 */ + TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL), + /* 0x10000080000000 */ + TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL), + /* 0x20000000000000 */ + TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL), + /* 0x80000000000000 */ + TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL), + /* 0x100000000000000 */ + TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL), #ifdef TEST_LDOUBLE - /* The input can only be represented in long double. */ - TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL); - - TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL); + /* The input can only be represented in long double. */ + TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL), + + TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL); - - TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL); -#endif - - TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL); - - TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL); + TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL), + TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL), + + TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL), + TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL), +#endif + + TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL), + + TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL); - - TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL); -#endif - - TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL); - TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL); - - TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL); - TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL); + TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL), + + TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL), +#endif + + TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL), + TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL), + + TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL), + TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L); - TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL); - TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL); + TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL), + TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL), + TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L), + TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL), # endif #endif - } - - fesetround (save_round_mode); - - END (llrint_tonearest); -} + END_DATA (llrint_towardzero) + }; static void llrint_test_towardzero (void) { - int save_round_mode; START (llrint_towardzero); + RUN_TEST_LOOP_f_L (llrint, llrint_towardzero_test_data, FE_TOWARDZERO); + END (llrint_towardzero); +} - save_round_mode = fegetround (); - - if (!fesetround (FE_TOWARDZERO)) - { - TEST_f_L (llrint, 0.0, 0); - TEST_f_L (llrint, minus_zero, 0); - TEST_f_L (llrint, 0.2L, 0); - TEST_f_L (llrint, -0.2L, 0); - - TEST_f_L (llrint, 1.4L, 1); - TEST_f_L (llrint, -1.4L, -1); - - 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); - /* 0x800000 */ - TEST_f_L (llrint, 8388608.0, 8388608LL); - /* 0x1000000 */ - TEST_f_L (llrint, 16777216.0, 16777216LL); - /* 0x20000000000 */ - TEST_f_L (llrint, 2199023255552.0, 2199023255552LL); - /* 0x40000000000 */ - TEST_f_L (llrint, 4398046511104.0, 4398046511104LL); - /* 0x1000000000000 */ - TEST_f_L (llrint, 281474976710656.0, 281474976710656LL); - /* 0x10000000000000 */ - TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL); - /* 0x10000080000000 */ - TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL); - /* 0x20000000000000 */ - TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL); - /* 0x80000000000000 */ - TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL); - /* 0x100000000000000 */ - TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL); +static const struct test_f_L_data llrint_downward_test_data[] = + { + START_DATA (llrint_downward), + TEST_f_L (llrint, 0.0, 0), + TEST_f_L (llrint, minus_zero, 0), + TEST_f_L (llrint, 0.2L, 0), + TEST_f_L (llrint, -0.2L, -1), + + TEST_f_L (llrint, 1.4L, 1), + TEST_f_L (llrint, -1.4L, -2), + + TEST_f_L (llrint, 8388600.3L, 8388600), + TEST_f_L (llrint, -8388600.3L, -8388601), + + TEST_f_L (llrint, 1071930.0008, 1071930), + + /* Test boundary conditions. */ + /* 0x1FFFFF */ + TEST_f_L (llrint, 2097151.0,2097151LL), + /* 0x800000 */ + TEST_f_L (llrint, 8388608.0, 8388608LL), + /* 0x1000000 */ + TEST_f_L (llrint, 16777216.0, 16777216LL), + /* 0x20000000000 */ + TEST_f_L (llrint, 2199023255552.0, 2199023255552LL), + /* 0x40000000000 */ + TEST_f_L (llrint, 4398046511104.0, 4398046511104LL), + /* 0x1000000000000 */ + TEST_f_L (llrint, 281474976710656.0, 281474976710656LL), + /* 0x10000000000000 */ + TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL), + /* 0x10000080000000 */ + TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL), + /* 0x20000000000000 */ + TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL), + /* 0x80000000000000 */ + TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL), + /* 0x100000000000000 */ + TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL), #ifdef TEST_LDOUBLE - /* The input can only be represented in long double. */ - TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL); - - TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL); + /* The input can only be represented in long double. */ + TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL), + + TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL), + TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL), + + TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL), + + TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL), + TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL), + + TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL), + + TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL), + TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL), + + TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL), + + TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL), + TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL), + + TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL), + TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL), + + TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL), + TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL), + TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL), + TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL); - TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL); - - TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL); - TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL); -#endif - - TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL); - - TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL); - -# if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL); - - TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL); -#endif - - TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL); - TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL); - - TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL); - TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL); - -# if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL); - TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL); - TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L); - TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL); + TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL), + TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL), + TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L), + TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL), + TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL), + TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL), # endif #endif - } - - fesetround (save_round_mode); - - END (llrint_towardzero); -} + END_DATA (llrint_downward) + }; static void llrint_test_downward (void) { - int save_round_mode; START (llrint_downward); + RUN_TEST_LOOP_f_L (llrint, llrint_downward_test_data, FE_DOWNWARD); + END (llrint_downward); +} - save_round_mode = fegetround (); - - if (!fesetround (FE_DOWNWARD)) - { - TEST_f_L (llrint, 0.0, 0); - TEST_f_L (llrint, minus_zero, 0); - TEST_f_L (llrint, 0.2L, 0); - TEST_f_L (llrint, -0.2L, -1); - - TEST_f_L (llrint, 1.4L, 1); - TEST_f_L (llrint, -1.4L, -2); - - TEST_f_L (llrint, 8388600.3L, 8388600); - TEST_f_L (llrint, -8388600.3L, -8388601); - - TEST_f_L (llrint, 1071930.0008, 1071930); - - /* Test boundary conditions. */ - /* 0x1FFFFF */ - TEST_f_L (llrint, 2097151.0,2097151LL); - /* 0x800000 */ - TEST_f_L (llrint, 8388608.0, 8388608LL); - /* 0x1000000 */ - TEST_f_L (llrint, 16777216.0, 16777216LL); - /* 0x20000000000 */ - TEST_f_L (llrint, 2199023255552.0, 2199023255552LL); - /* 0x40000000000 */ - TEST_f_L (llrint, 4398046511104.0, 4398046511104LL); - /* 0x1000000000000 */ - TEST_f_L (llrint, 281474976710656.0, 281474976710656LL); - /* 0x10000000000000 */ - TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL); - /* 0x10000080000000 */ - TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL); - /* 0x20000000000000 */ - TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL); - /* 0x80000000000000 */ - TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL); - /* 0x100000000000000 */ - TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL); +static const struct test_f_L_data llrint_upward_test_data[] = + { + START_DATA (llrint_upward), + TEST_f_L (llrint, 0.0, 0), + TEST_f_L (llrint, minus_zero, 0), + TEST_f_L (llrint, 0.2L, 1), + TEST_f_L (llrint, -0.2L, 0), + + TEST_f_L (llrint, 1.4L, 2), + TEST_f_L (llrint, -1.4L, -1), + + TEST_f_L (llrint, 8388600.3L, 8388601), + TEST_f_L (llrint, -8388600.3L, -8388600), +#ifndef TEST_FLOAT + TEST_f_L (llrint, 1071930.0008, 1071931), +#endif + /* Test boundary conditions. */ + /* 0x1FFFFF */ + TEST_f_L (llrint, 2097151.0,2097151LL), + /* 0x800000 */ + TEST_f_L (llrint, 8388608.0, 8388608LL), + /* 0x1000000 */ + TEST_f_L (llrint, 16777216.0, 16777216LL), + /* 0x20000000000 */ + TEST_f_L (llrint, 2199023255552.0, 2199023255552LL), + /* 0x40000000000 */ + TEST_f_L (llrint, 4398046511104.0, 4398046511104LL), + /* 0x1000000000000 */ + TEST_f_L (llrint, 281474976710656.0, 281474976710656LL), + /* 0x10000000000000 */ + TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL), + /* 0x10000080000000 */ + TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL), + /* 0x20000000000000 */ + TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL), + /* 0x80000000000000 */ + TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL), + /* 0x100000000000000 */ + TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL), #ifdef TEST_LDOUBLE - /* The input can only be represented in long double. */ - TEST_f_L (llrint, 4503599627370495.5L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.75L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370497.5L, 4503599627370497LL); - - TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370494LL); - TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370496LL); - - TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.25L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370496.5L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL); - - TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370498LL); - TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370497LL); - - TEST_f_L (llrint, 9007199254740991.5L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.75L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.5L, 9007199254740993LL); - - TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740991LL); - TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740993LL); - - TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.25L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740992.5L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL); - - TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740994LL); - TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740994LL); - - TEST_f_L (llrint, 72057594037927935.5L, 72057594037927935LL); - TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.75L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927937.5L, 72057594037927937LL); - - TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.25L, -72057594037927937LL); - TEST_f_L (llrint, -72057594037927936.5L, -72057594037927937LL); - TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL); - TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL); + /* The input can only be represented in long double. */ + TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL), + + TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL), + TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL), + TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL), + TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL), + TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL), + + TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL), + + TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL), + TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL), + TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL), + TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL), + TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL), + + TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL), + + TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL), + TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL), + TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL), + TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL), + + TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL), + + TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL), + TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL), + TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL), + TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL), + + TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL), + TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL), + TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL), + TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL), + TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL), + + TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL), + TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL), + TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775805LL); - TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775807LL); - TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775806L); - TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775807LL); - TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775807LL); - TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL); + TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL), + TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL), + TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L), + TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL), + TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL), + TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL), # endif #endif - } - - fesetround (save_round_mode); - - END (llrint_downward); -} + END_DATA (llrint_upward) + }; static void llrint_test_upward (void) { - int save_round_mode; START (llrint_upward); - - save_round_mode = fegetround (); - - if (!fesetround (FE_UPWARD)) - { - TEST_f_L (llrint, 0.0, 0); - TEST_f_L (llrint, minus_zero, 0); - TEST_f_L (llrint, 0.2L, 1); - TEST_f_L (llrint, -0.2L, 0); - - TEST_f_L (llrint, 1.4L, 2); - TEST_f_L (llrint, -1.4L, -1); - - TEST_f_L (llrint, 8388600.3L, 8388601); - TEST_f_L (llrint, -8388600.3L, -8388600); -#ifndef TEST_FLOAT - TEST_f_L (llrint, 1071930.0008, 1071931); -#endif - /* Test boundary conditions. */ - /* 0x1FFFFF */ - TEST_f_L (llrint, 2097151.0,2097151LL); - /* 0x800000 */ - TEST_f_L (llrint, 8388608.0, 8388608LL); - /* 0x1000000 */ - TEST_f_L (llrint, 16777216.0, 16777216LL); - /* 0x20000000000 */ - TEST_f_L (llrint, 2199023255552.0, 2199023255552LL); - /* 0x40000000000 */ - TEST_f_L (llrint, 4398046511104.0, 4398046511104LL); - /* 0x1000000000000 */ - TEST_f_L (llrint, 281474976710656.0, 281474976710656LL); - /* 0x10000000000000 */ - TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL); - /* 0x10000080000000 */ - TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL); - /* 0x20000000000000 */ - TEST_f_L (llrint, 9007199254740992.0, 9007199254740992LL); - /* 0x80000000000000 */ - TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL); - /* 0x100000000000000 */ - TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL); -#ifdef TEST_LDOUBLE - /* The input can only be represented in long double. */ - TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.25L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370496.5L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL); - - TEST_f_L (llrint, 4503599627370495.4999999999999L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.4999999999999L, 4503599627370497LL); - TEST_f_L (llrint, 4503599627370497.4999999999999L, 4503599627370498LL); - TEST_f_L (llrint, 4503599627370494.5000000000001L, 4503599627370495LL); - TEST_f_L (llrint, 4503599627370495.5000000000001L, 4503599627370496LL); - TEST_f_L (llrint, 4503599627370496.5000000000001L, 4503599627370497LL); - - TEST_f_L (llrint, -4503599627370495.5L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370496.75L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370497.5L, -4503599627370497LL); - - TEST_f_L (llrint, -4503599627370495.4999999999999L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.4999999999999L, -4503599627370496LL); - TEST_f_L (llrint, -4503599627370497.4999999999999L, -4503599627370497LL); - TEST_f_L (llrint, -4503599627370494.5000000000001L, -4503599627370494LL); - TEST_f_L (llrint, -4503599627370495.5000000000001L, -4503599627370495LL); - TEST_f_L (llrint, -4503599627370496.5000000000001L, -4503599627370496LL); - - TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.25L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740992.5L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL); - - TEST_f_L (llrint, 9007199254740991.4999999999999L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.4999999999999L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.4999999999999L, 9007199254740994LL); - TEST_f_L (llrint, 9007199254740991.5000000000001L, 9007199254740992LL); - TEST_f_L (llrint, 9007199254740992.5000000000001L, 9007199254740993LL); - TEST_f_L (llrint, 9007199254740993.5000000000001L, 9007199254740994LL); - - TEST_f_L (llrint, -9007199254740991.5L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740992.75L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.5L, -9007199254740993LL); - - TEST_f_L (llrint, -9007199254740991.4999999999999L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.4999999999999L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.4999999999999L, -9007199254740993LL); - TEST_f_L (llrint, -9007199254740991.5000000000001L, -9007199254740991LL); - TEST_f_L (llrint, -9007199254740992.5000000000001L, -9007199254740992LL); - TEST_f_L (llrint, -9007199254740993.5000000000001L, -9007199254740993LL); - - TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL); - TEST_f_L (llrint, 72057594037927936.25L, 72057594037927937LL); - TEST_f_L (llrint, 72057594037927936.5L, 72057594037927937LL); - TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL); - TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL); - - TEST_f_L (llrint, -72057594037927935.5L, -72057594037927935LL); - TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927936.75L, -72057594037927936LL); - TEST_f_L (llrint, -72057594037927937.5L, -72057594037927937LL); - -# if LDBL_MANT_DIG > 100 - TEST_f_L (llrint, 9223372036854775805.5L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775805.5L, -9223372036854775805LL); - TEST_f_L (llrint, 9223372036854775806.0L, 9223372036854775806LL); - TEST_f_L (llrint, -9223372036854775806.0L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.25L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775806.25L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.5L, 9223372036854775807L); - TEST_f_L (llrint, -9223372036854775806.5L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775806.75L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775806.75L, -9223372036854775806LL); - TEST_f_L (llrint, 9223372036854775807.0L, 9223372036854775807LL); - TEST_f_L (llrint, -9223372036854775807.0L, -9223372036854775807LL); -# endif -#endif - } - - fesetround (save_round_mode); - + RUN_TEST_LOOP_f_L (llrint, llrint_upward_test_data, FE_UPWARD); END (llrint_upward); } @@ -11498,175 +11505,179 @@ lround_test (void) } -static void -llround_test (void) -{ - /* TODO: missing +/-Inf as well as qNaN tests. */ - - START (llround); +static const struct test_f_L_data llround_test_data[] = + { + START_DATA (llround), + /* TODO: missing +/-Inf as well as qNaN tests. */ + TEST_f_L (llround, 0, 0), + TEST_f_L (llround, minus_zero, 0), + TEST_f_L (llround, 0.2L, 0.0), + TEST_f_L (llround, -0.2L, 0), + TEST_f_L (llround, 0.5, 1), + TEST_f_L (llround, -0.5, -1), + TEST_f_L (llround, 0.8L, 1), + TEST_f_L (llround, -0.8L, -1), + TEST_f_L (llround, 1.5, 2), + 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), + TEST_f_L (llround, 34359738368.5, 34359738369ll), + TEST_f_L (llround, -34359738368.5, -34359738369ll), + TEST_f_L (llround, -3.65309740835E17, -365309740835000000LL), +#endif + + /* Test boundary conditions. */ + /* 0x1FFFFF */ + TEST_f_L (llround, 2097151.0, 2097151LL), + /* 0x800000 */ + TEST_f_L (llround, 8388608.0, 8388608LL), + /* 0x1000000 */ + TEST_f_L (llround, 16777216.0, 16777216LL), + /* 0x20000000000 */ + TEST_f_L (llround, 2199023255552.0, 2199023255552LL), + /* 0x40000000000 */ + TEST_f_L (llround, 4398046511104.0, 4398046511104LL), + /* 0x1000000000000 */ + TEST_f_L (llround, 281474976710656.0, 281474976710656LL), + /* 0x10000000000000 */ + TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL), + /* 0x10000080000000 */ + TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL), + /* 0x20000000000000 */ + TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL), + /* 0x80000000000000 */ + TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL), + /* 0x100000000000000 */ + TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL), + +#ifndef TEST_FLOAT + /* 0x100000000 */ + TEST_f_L (llround, 4294967295.5, 4294967296LL), + /* 0x200000000 */ + TEST_f_L (llround, 8589934591.5, 8589934592LL), - TEST_f_L (llround, 0, 0); - TEST_f_L (llround, minus_zero, 0); - TEST_f_L (llround, 0.2L, 0.0); - TEST_f_L (llround, -0.2L, 0); - TEST_f_L (llround, 0.5, 1); - TEST_f_L (llround, -0.5, -1); - TEST_f_L (llround, 0.8L, 1); - TEST_f_L (llround, -0.8L, -1); - TEST_f_L (llround, 1.5, 2); - 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); - TEST_f_L (llround, 34359738368.5, 34359738369ll); - TEST_f_L (llround, -34359738368.5, -34359738369ll); - TEST_f_L (llround, -3.65309740835E17, -365309740835000000LL); -#endif - - /* Test boundary conditions. */ - /* 0x1FFFFF */ - TEST_f_L (llround, 2097151.0, 2097151LL); - /* 0x800000 */ - TEST_f_L (llround, 8388608.0, 8388608LL); - /* 0x1000000 */ - TEST_f_L (llround, 16777216.0, 16777216LL); - /* 0x20000000000 */ - TEST_f_L (llround, 2199023255552.0, 2199023255552LL); - /* 0x40000000000 */ - TEST_f_L (llround, 4398046511104.0, 4398046511104LL); - /* 0x1000000000000 */ - TEST_f_L (llround, 281474976710656.0, 281474976710656LL); - /* 0x10000000000000 */ - TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL); - /* 0x10000080000000 */ - TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL); - /* 0x20000000000000 */ - TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL); - /* 0x80000000000000 */ - TEST_f_L (llround, 36028797018963968.0, 36028797018963968LL); - /* 0x100000000000000 */ - TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL); - -#ifndef TEST_FLOAT - /* 0x100000000 */ - TEST_f_L (llround, 4294967295.5, 4294967296LL); - /* 0x200000000 */ - TEST_f_L (llround, 8589934591.5, 8589934592LL); - - /* nextafter(0.5,-1) */ - TEST_f_L (llround, 0x1.fffffffffffffp-2, 0); - /* nextafter(-0.5,1) */ - TEST_f_L (llround, -0x1.fffffffffffffp-2, 0); - /* On PowerPC an exponent of '52' is the largest incrementally - * representable sequence of whole-numbers in the 'double' range. We test - * lround to make sure that a guard bit set during the lround operation - * hasn't forced an erroneous shift giving us an incorrect result. The odd - * numbers between +-(2^52+1 and 2^53-1) are affected since they have the - * rightmost bit set. */ - /* +-(2^52+1) */ - TEST_f_L (llround, 0x1.0000000000001p+52,4503599627370497LL); - TEST_f_L (llround, -0x1.0000000000001p+52,-4503599627370497LL); - /* +-(2^53-1): Input is the last (positive and negative) incrementally - * representable whole-number in the 'double' range that might round - * erroneously. */ - TEST_f_L (llround, 0x1.fffffffffffffp+52, 9007199254740991LL); - TEST_f_L (llround, -0x1.fffffffffffffp+52, -9007199254740991LL); + /* nextafter(0.5,-1) */ + TEST_f_L (llround, 0x1.fffffffffffffp-2, 0), + /* nextafter(-0.5,1) */ + TEST_f_L (llround, -0x1.fffffffffffffp-2, 0), + /* On PowerPC an exponent of '52' is the largest incrementally + * representable sequence of whole-numbers in the 'double' range. We test + * lround to make sure that a guard bit set during the lround operation + * hasn't forced an erroneous shift giving us an incorrect result. The odd + * numbers between +-(2^52+1 and 2^53-1) are affected since they have the + * rightmost bit set. */ + /* +-(2^52+1) */ + TEST_f_L (llround, 0x1.0000000000001p+52,4503599627370497LL), + TEST_f_L (llround, -0x1.0000000000001p+52,-4503599627370497LL), + /* +-(2^53-1): Input is the last (positive and negative) incrementally + * representable whole-number in the 'double' range that might round + * erroneously. */ + TEST_f_L (llround, 0x1.fffffffffffffp+52, 9007199254740991LL), + TEST_f_L (llround, -0x1.fffffffffffffp+52, -9007199254740991LL), #else - /* nextafter(0.5,-1) */ - TEST_f_L (llround, 0x1.fffffep-2, 0); - /* nextafter(-0.5,1) */ - TEST_f_L (llround, -0x1.fffffep-2, 0); - /* As above, on PowerPC an exponent of '23' is the largest incrementally - * representable sequence of whole-numbers in the 'float' range. - * Likewise, numbers between +-(2^23+1 and 2^24-1) are affected. */ - TEST_f_L (llround, 0x1.000002p+23,8388609); - TEST_f_L (llround, -0x1.000002p+23,-8388609); - TEST_f_L (llround, 0x1.fffffep+23, 16777215); - TEST_f_L (llround, -0x1.fffffep+23, -16777215); + /* nextafter(0.5,-1) */ + TEST_f_L (llround, 0x1.fffffep-2, 0), + /* nextafter(-0.5,1) */ + TEST_f_L (llround, -0x1.fffffep-2, 0), + /* As above, on PowerPC an exponent of '23' is the largest incrementally + * representable sequence of whole-numbers in the 'float' range. + * Likewise, numbers between +-(2^23+1 and 2^24-1) are affected. */ + TEST_f_L (llround, 0x1.000002p+23,8388609), + TEST_f_L (llround, -0x1.000002p+23,-8388609), + TEST_f_L (llround, 0x1.fffffep+23, 16777215), + TEST_f_L (llround, -0x1.fffffep+23, -16777215), #endif #ifdef TEST_LDOUBLE - /* The input can only be represented in long double. */ - TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL); - TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL); - TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL); - TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL); - TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL); + /* The input can only be represented in long double. */ + TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL), + TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL), + TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL), + TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL), + TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL); - TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL); - TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL); - TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL); - TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL); - TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL); - - TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL); - TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL); - TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL); - TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL); - TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL); - TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL); + TEST_f_L (llround, 4503599627370495.4999999999999L, 4503599627370495LL), + TEST_f_L (llround, 4503599627370496.4999999999999L, 4503599627370496LL), + TEST_f_L (llround, 4503599627370497.4999999999999L, 4503599627370497LL), + TEST_f_L (llround, 4503599627370494.5000000000001L, 4503599627370495LL), + TEST_f_L (llround, 4503599627370495.5000000000001L, 4503599627370496LL), + TEST_f_L (llround, 4503599627370496.5000000000001L, 4503599627370497LL), + + TEST_f_L (llround, -4503599627370495.4999999999999L, -4503599627370495LL), + TEST_f_L (llround, -4503599627370496.4999999999999L, -4503599627370496LL), + TEST_f_L (llround, -4503599627370497.4999999999999L, -4503599627370497LL), + TEST_f_L (llround, -4503599627370494.5000000000001L, -4503599627370495LL), + TEST_f_L (llround, -4503599627370495.5000000000001L, -4503599627370496LL), + TEST_f_L (llround, -4503599627370496.5000000000001L, -4503599627370497LL), # endif - TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL); - TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL); - TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL); - TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL); - TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL); + TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL), + TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL), + TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL), + TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL), + TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL), - TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL); - TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL); - TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL); - TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL); - TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL); + TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL), + TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL), + TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL), + TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL), + TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL), # if LDBL_MANT_DIG > 100 - TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL); - TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL); - TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL); - TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL); - TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL); - TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL); - - TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL); - TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL); - TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL); - TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL); - TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL); - TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL); + TEST_f_L (llround, 9007199254740991.4999999999999L, 9007199254740991LL), + TEST_f_L (llround, 9007199254740992.4999999999999L, 9007199254740992LL), + TEST_f_L (llround, 9007199254740993.4999999999999L, 9007199254740993LL), + TEST_f_L (llround, 9007199254740991.5000000000001L, 9007199254740992LL), + TEST_f_L (llround, 9007199254740992.5000000000001L, 9007199254740993LL), + TEST_f_L (llround, 9007199254740993.5000000000001L, 9007199254740994LL), + + TEST_f_L (llround, -9007199254740991.4999999999999L, -9007199254740991LL), + TEST_f_L (llround, -9007199254740992.4999999999999L, -9007199254740992LL), + TEST_f_L (llround, -9007199254740993.4999999999999L, -9007199254740993LL), + TEST_f_L (llround, -9007199254740991.5000000000001L, -9007199254740992LL), + TEST_f_L (llround, -9007199254740992.5000000000001L, -9007199254740993LL), + TEST_f_L (llround, -9007199254740993.5000000000001L, -9007199254740994LL), # endif - TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL); - TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL); - TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL); - TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL); - TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL); + TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL), + TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL), + TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL), + TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL), + TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL), - TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL); - TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL); - TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL); - TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL); - TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL); + TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL), + TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL), + TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL), + TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL), + TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL), - TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL); - TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL); - TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL); - TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL); - TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL); + TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL), + TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL), + TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL), + TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL), + TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL), - TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL); - TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL); - TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL); - TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL); - TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL); - TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL); + TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL), + TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL), + TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL), + TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL), + TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL), + TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL), #endif + END_DATA (llround) + }; +static void +llround_test (void) +{ + START (llround); + RUN_TEST_LOOP_f_L (llround, llround_test_data, ); END (llround); } |