aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc1571
1 files changed, 1567 insertions, 4 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 60711fabdc..81dd364f77 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1997.
@@ -22,7 +22,7 @@
This file is processed by a perl script. The resulting file has to
be included by a master file that defines:
- Makros:
+ Macros:
FUNC(function): converts general function name (like cos) to
name with correct suffix (e.g. cosl or cosf)
MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
@@ -153,6 +153,7 @@
#define M_PI2_LOG10El M_PI_2l * M_LOG10El
#define M_PI4_LOG10El M_PI_4l * M_LOG10El
#define M_PI_LOG10El M_PIl * M_LOG10El
+#define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
static FILE *ulps_file; /* File to document difference. */
static int output_ulps; /* Should ulps printed? */
@@ -497,7 +498,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
&& computed == 0.0 && expected == 0.0
&& signbit(computed) != signbit (expected))
ok = 0;
- else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
+ else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
ok = 1;
else
{
@@ -1115,7 +1116,7 @@ cacosh_test (void)
TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
- TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
+ TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
END (cacosh, complex);
}
@@ -1627,8 +1628,82 @@ 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. */
+ TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
+ 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);
+ TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
+ 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);
+ TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (ceil);
}
@@ -2212,6 +2287,9 @@ csqrt_test (void)
TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
+ /* Principal square root should be returned (i.e., non-negative real
+ part). */
+ TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
END (csqrt, complex);
}
@@ -2385,7 +2463,9 @@ erfc_test (void)
TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
#ifdef TEST_LDOUBLE
/* The result can only be represented in long double. */
+# if LDBL_MIN_10_EXP < -319
TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
+# endif
#endif
END (erfc);
@@ -2577,8 +2657,85 @@ 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. */
+ TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
+ 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);
+ TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
+ 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);
+ TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (floor);
}
@@ -3116,6 +3273,166 @@ lrint_test (void)
static void
+lrint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (lrint_tonearest);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TONEAREST))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 0);
+ TEST_f_l (lrint, -0.2L, 0);
+ TEST_f_l (lrint, 0.5L, 0);
+ TEST_f_l (lrint, -0.5L, 0);
+ TEST_f_l (lrint, 0.8L, 1);
+ TEST_f_l (lrint, -0.8L, -1);
+
+ TEST_f_l (lrint, 1.4L, 1);
+ TEST_f_l (lrint, -1.4L, -1);
+
+ TEST_f_l (lrint, 8388600.3L, 8388600);
+ TEST_f_l (lrint, -8388600.3L, -8388600);
+
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_tonearest);
+}
+
+
+static void
+lrint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (lrint_towardzero);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 0);
+ TEST_f_l (lrint, -0.2L, 0);
+ TEST_f_l (lrint, 0.5L, 0);
+ TEST_f_l (lrint, -0.5L, 0);
+ TEST_f_l (lrint, 0.8L, 0);
+ TEST_f_l (lrint, -0.8L, 0);
+
+ TEST_f_l (lrint, 1.4L, 1);
+ TEST_f_l (lrint, -1.4L, -1);
+
+ TEST_f_l (lrint, 8388600.3L, 8388600);
+ TEST_f_l (lrint, -8388600.3L, -8388600);
+
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_towardzero);
+}
+
+
+static void
+lrint_test_downward (void)
+{
+ int save_round_mode;
+ START (lrint_downward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_DOWNWARD))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 0);
+ TEST_f_l (lrint, -0.2L, -1);
+ TEST_f_l (lrint, 0.5L, 0);
+ TEST_f_l (lrint, -0.5L, -1);
+ TEST_f_l (lrint, 0.8L, 0);
+ TEST_f_l (lrint, -0.8L, -1);
+
+ TEST_f_l (lrint, 1.4L, 1);
+ TEST_f_l (lrint, -1.4L, -2);
+
+ TEST_f_l (lrint, 8388600.3L, 8388600);
+ TEST_f_l (lrint, -8388600.3L, -8388601);
+
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_downward);
+}
+
+
+static void
+lrint_test_upward (void)
+{
+ int save_round_mode;
+ START (lrint_upward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_UPWARD))
+ {
+ TEST_f_l (lrint, 0.0, 0);
+ TEST_f_l (lrint, minus_zero, 0);
+ TEST_f_l (lrint, 0.2L, 1);
+ TEST_f_l (lrint, -0.2L, 0);
+ TEST_f_l (lrint, 0.5L, 1);
+ TEST_f_l (lrint, -0.5L, 0);
+ TEST_f_l (lrint, 0.8L, 1);
+ TEST_f_l (lrint, -0.8L, 0);
+
+ TEST_f_l (lrint, 1.4L, 2);
+ TEST_f_l (lrint, -1.4L, -1);
+
+ TEST_f_l (lrint, 8388600.3L, 8388601);
+ TEST_f_l (lrint, -8388600.3L, -8388600);
+
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1071930.0008, 1071931);
+ TEST_f_l (lrint, 1073741824.01, 1073741825);
+# if LONG_MAX > 281474976710656 && defined (TEST_LDOUBLE)
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (lrint_upward);
+}
+
+
+static void
llrint_test (void)
{
/* XXX this test is incomplete. We need to have a way to specifiy
@@ -3160,10 +3477,639 @@ llrint_test (void)
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 (llrint);
}
+static void
+llrint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (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);
+#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
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_tonearest);
+}
+
+static void
+llrint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (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);
+#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);
+
+# 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);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_towardzero);
+}
+
+static void
+llrint_test_downward (void)
+{
+ int save_round_mode;
+ START (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);
+#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);
+
+# 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);
+# endif
+#endif
+ }
+
+ fesetround (save_round_mode);
+
+ END (llrint_downward);
+}
+
+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);
+
+ END (llrint_upward);
+}
+
static void
log_test (void)
@@ -3181,7 +4127,9 @@ log_test (void)
TEST_f_f (log, 1, 0);
TEST_f_f (log, -1, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log, plus_infty, plus_infty);
+ TEST_f_f (log, nan_value, nan_value);
TEST_f_f (log, M_El, 1);
TEST_f_f (log, 1.0 / M_El, -1);
@@ -3211,6 +4159,7 @@ log10_test (void)
/* log10 (x) == NaN plus invalid exception if x < 0. */
TEST_f_f (log10, -1, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log10, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log10, plus_infty, plus_infty);
TEST_f_f (log10, nan_value, nan_value);
@@ -3242,6 +4191,7 @@ log1p_test (void)
TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_f_f (log1p, -2, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log1p, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log1p, plus_infty, plus_infty);
TEST_f_f (log1p, nan_value, nan_value);
@@ -3272,6 +4222,7 @@ log2_test (void)
TEST_f_f (log2, 1, 0);
TEST_f_f (log2, -1, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (log2, minus_infty, nan_value, INVALID_EXCEPTION);
TEST_f_f (log2, plus_infty, plus_infty);
TEST_f_f (log2, nan_value, nan_value);
@@ -3394,6 +4345,84 @@ llround_test (void)
TEST_f_L (llround, 8589934591.5, 8589934592LL);
#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);
+
+# 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);
+# 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, 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);
+# 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, 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);
+#endif
+
END (llround);
}
@@ -3590,6 +4619,17 @@ pow_test (void)
/* pow (x, NaN) == NaN. */
TEST_ff_f (pow, 3.0, nan_value, nan_value);
+ TEST_ff_f (pow, minus_zero, nan_value, nan_value);
+ TEST_ff_f (pow, plus_infty, nan_value, nan_value);
+ TEST_ff_f (pow, -3.0, nan_value, nan_value);
+ TEST_ff_f (pow, minus_infty, nan_value, nan_value);
+
+ TEST_ff_f (pow, nan_value, 3.0, nan_value);
+ TEST_ff_f (pow, nan_value, -3.0, nan_value);
+ TEST_ff_f (pow, nan_value, plus_infty, nan_value);
+ TEST_ff_f (pow, nan_value, minus_infty, nan_value);
+ TEST_ff_f (pow, nan_value, 2.5, nan_value);
+ TEST_ff_f (pow, nan_value, -2.5, nan_value);
TEST_ff_f (pow, 1, plus_infty, 1);
TEST_ff_f (pow, -1, plus_infty, 1);
@@ -3790,11 +4830,367 @@ 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);
+ 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
+
+ TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (rint);
}
static void
+rint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (rint_tonearest);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TONEAREST))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 2.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ 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);
+
+ END (rint_tonearest);
+}
+
+static void
+rint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (rint_towardzero);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 1.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ 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);
+
+ END (rint_towardzero);
+}
+
+static void
+rint_test_downward (void)
+{
+ int save_round_mode;
+ START (rint_downward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_DOWNWARD))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 1.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -1.0);
+ 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);
+
+ END (rint_downward);
+}
+
+static void
+rint_test_upward (void)
+{
+ int save_round_mode;
+ START (rint_upward);
+
+ save_round_mode = fegetround ();
+
+ if (!fesetround (FE_UPWARD))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 2.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 1.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ 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);
+
+ END (rint_upward);
+}
+
+static void
round_test (void)
{
START (round);
@@ -3809,9 +5205,86 @@ 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);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ 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, -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);
+ TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
+ 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);
+ TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (round);
}
@@ -4163,7 +5636,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);
@@ -4179,6 +5656,80 @@ trunc_test (void)
TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ 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, -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);
+ 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, -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);
+ TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (trunc);
}
@@ -4557,8 +6108,20 @@ main (int argc, char **argv)
floor_test ();
nearbyint_test ();
rint_test ();
+ rint_test_tonearest ();
+ rint_test_towardzero ();
+ rint_test_downward ();
+ rint_test_upward ();
lrint_test ();
+ lrint_test_tonearest ();
+ lrint_test_towardzero ();
+ lrint_test_downward ();
+ lrint_test_upward ();
llrint_test ();
+ llrint_test_tonearest ();
+ llrint_test_towardzero ();
+ llrint_test_downward ();
+ llrint_test_upward ();
round_test ();
lround_test ();
llround_test ();