aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2006-03-16 23:17:32 +0000
committerRoland McGrath <roland@gnu.org>2006-03-16 23:17:32 +0000
commit830fce0415390c4a7326fe91ad678fd987a1c53f (patch)
tree839393ec850233231d49b8cc3cfd02aece5aa675 /math
parent27c0e0d8630de8efbbd633ffb425c85515a5e89d (diff)
downloadglibc-830fce0415390c4a7326fe91ad678fd987a1c53f.tar
glibc-830fce0415390c4a7326fe91ad678fd987a1c53f.tar.gz
glibc-830fce0415390c4a7326fe91ad678fd987a1c53f.tar.bz2
glibc-830fce0415390c4a7326fe91ad678fd987a1c53f.zip
[BZ #2466]
* math/gen-libm-test.pl (parse_args): Take function name for pretty output as an argument. (generate_testfile): Pass it the name given in the START macro. [BZ #2466] * math/libm-test.inc (llrint_test, llround_test): Fix last change to protect large-precision cases with [LDBL_MANT_DIG > 100]. (llrint_test_tonearest, llrint_test_towardzero): Likewise. (llrint_test_downward, llrint_test_upward): Likewise. 2006-03-15 Steven Munroe <sjmunroe@us.ibm.com> Alan Modra <amodra@bigpond.net.au> [BZ #2466] * math/libm-test.inc (llrint_test, llround_test) [TEST_LDOUBLE]: Add new test values. (llrint_test_tonearest, llrint_test_towardzero, llrint_test_downward, llrint_test_upward): New functions. (main): Call them. * sysdeps/ieee754/ldbl-128ibm/s_llrintl.c (__llrintl): Handle rounding that spans doubles in IBM long double format. * sysdeps/ieee754/ldbl-128ibm/s_llroundl.c (__llroundl): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrintl.S: Removed. * sysdeps/powerpc/powerpc64/fpu/s_llroundl.S: Removed. * sysdeps/powerpc/powerpc64/fpu/s_lrintl.S: Removed. * sysdeps/powerpc/powerpc64/fpu/s_lroundl.S: Removed. 2006-03-16 Roland McGrath <roland@redhat.com>
Diffstat (limited to 'math')
-rwxr-xr-xmath/gen-libm-test.pl11
-rw-r--r--math/libm-test.inc1053
2 files changed, 846 insertions, 218 deletions
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 26f819a884..a63f62a1cb 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@@ -234,7 +234,7 @@ sub special_functions {
# Parse the arguments to TEST_x_y
sub parse_args {
- my ($file, $descr, $args) = @_;
+ my ($file, $descr, $fct, $args) = @_;
my (@args, $str, $descr_args, $descr_res, @descr);
my ($current_arg, $cline, $i);
my ($pre, $post, @special);
@@ -248,7 +248,7 @@ sub parse_args {
@args = split /,\s*/, $args;
- $call = "$args[0] (";
+ $call = "$fct (";
# Generate first the string that's shown to the user
$current_arg = 1;
@@ -423,7 +423,7 @@ sub parse_args {
sub generate_testfile {
my ($input, $output) = @_;
my ($lasttext);
- my (@args, $i, $str);
+ my (@args, $i, $str, $thisfct);
open INPUT, $input or die ("Can't open $input: $!");
open OUTPUT, ">$output" or die ("Can't open $output: $!");
@@ -436,11 +436,12 @@ sub generate_testfile {
my ($descr, $args);
chop;
($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
- &parse_args (\*OUTPUT, $descr, $args);
+ &parse_args (\*OUTPUT, $descr, $thisfct, $args);
next;
}
# START (function)
if (/START/) {
+ ($thisfct) = ($_ =~ /START\s*\((.*)\)/);
print OUTPUT " init_max_error ();\n";
next;
}
diff --git a/math/libm-test.inc b/math/libm-test.inc
index b144796f2a..b99255fd6d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -3331,6 +3331,22 @@ llrint_test (void)
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);
@@ -3343,6 +3359,22 @@ llrint_test (void)
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);
@@ -3354,11 +3386,570 @@ llrint_test (void)
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)
@@ -3597,6 +4188,22 @@ llround_test (void)
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);
@@ -3609,6 +4216,22 @@ llround_test (void)
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);
@@ -4044,7 +4667,7 @@ rint_test (void)
TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
-
+
# if LDBL_MANT_DIG > 100
TEST_f_f (rint, 4503599627370494.5000000000001L, 4503599627370495.0L);
TEST_f_f (rint, 4503599627370495.5000000000001L, 4503599627370496.0L);
@@ -4056,7 +4679,7 @@ rint_test (void)
TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
-
+
# if LDBL_MANT_DIG > 100
TEST_f_f (rint, -4503599627370494.5000000000001L, -4503599627370495.0L);
TEST_f_f (rint, -4503599627370495.5000000000001L, -4503599627370496.0L);
@@ -4117,66 +4740,66 @@ rint_test_tonearest (void)
int save_round_mode;
START (rint_tonearest);
- save_round_mode = fegetround();
+ 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);
+ {
+ 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);
+ /* 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);
+ 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);
+ 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);
+ 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);
+ fesetround (save_round_mode);
END (rint_tonearest);
}
@@ -4187,66 +4810,66 @@ rint_test_towardzero (void)
int save_round_mode;
START (rint_towardzero);
- save_round_mode = fegetround();
+ 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);
+ {
+ 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);
+ /* 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);
+ 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);
+ 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);
+ 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);
+ fesetround (save_round_mode);
END (rint_towardzero);
}
@@ -4257,66 +4880,66 @@ rint_test_downward (void)
int save_round_mode;
START (rint_downward);
- save_round_mode = fegetround();
+ 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);
+ {
+ 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);
+ /* 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);
+ 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);
+ 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);
+ 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);
+ fesetround (save_round_mode);
END (rint_downward);
}
@@ -4327,66 +4950,66 @@ rint_test_upward (void)
int save_round_mode;
START (rint_upward);
- save_round_mode = fegetround();
+ 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);
+ {
+ 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);
+ /* 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);
+ 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);
+ 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);
+ 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);
+ fesetround (save_round_mode);
END (rint_upward);
}
@@ -4419,7 +5042,7 @@ round_test (void)
/* 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.5L, 4503599627370497.0L);
TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
# if LDBL_MANT_DIG > 100
@@ -4428,10 +5051,10 @@ round_test (void)
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, -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, -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);
@@ -4870,13 +5493,13 @@ trunc_test (void)
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);
@@ -4929,7 +5552,7 @@ trunc_test (void)
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);
+ TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
#endif
END (trunc);
@@ -5315,6 +5938,10 @@ main (int argc, char **argv)
rint_test_upward ();
lrint_test ();
llrint_test ();
+ llrint_test_tonearest ();
+ llrint_test_towardzero ();
+ llrint_test_downward ();
+ llrint_test_upward ();
round_test ();
lround_test ();
llround_test ();