* Policy question -- libm-test: tests with sNaNs as inputs
@ 2013-04-03 15:30 Thomas Schwinge
2013-04-03 15:41 ` Joseph S. Myers
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Schwinge @ 2013-04-03 15:30 UTC (permalink / raw)
To: libc-alpha, libc-ports
[-- Attachment #1: Type: text/plain, Size: 54371 bytes --]
Hi!
I'd like to propose the following patch, which adds several tests with
sNaNs as inputs to the libm-test framework.
The "problem" with it is that it uncovers a handful of issues --
different between different architectures and their several
floating-point datatypes -- where the results don't match what is
expected. In particular, there are several math functions that upon sNaN
input don't return a qNaN whilst raising an INVALID exception, but
instead return the input sNaN unaltered. For example, on x86-64, this
happens for long double for log, log10, log2, fdim; on 32-bit x86
additionally for asinh, atanh, and cbrt; or on 64-bit PowerPC hypot,
ceil, floor, trunc, sqrt, j0, j1, y0, y1 (not all of them for each
floating-point datatype).
Fixing these issues will typically not be difficult, and I have WIP fixes
for some of them already. Typically this will just need to
arithmetically evaluate the input sNaN (adding to itself, for example)
before returning that as the result (this also is a no-op for a qNaN),
but I can't promise to solve all of these issues. Apart from lack of
time and experience with the architectures, I don't even have access to
all the required hardware.
Now for the policy question: How to proceed in this case? Commit the
patch after review, and then have the architecture maintainers solve the
(now uncovered) issues for their respective architecture? Or, bad luck,
don't commit the patch at all until all issues are deemed fixed, so that
there are no testsuite "regressions"?
diff --git manual/arith.texi manual/arith.texi
index ce8844e..2784bce 100644
--- manual/arith.texi
+++ manual/arith.texi
@@ -1575,7 +1575,6 @@ sign (although not all implementations support it) and this is one of
the few operations that can tell the difference.
@code{copysign} never raises an exception.
-@c except signalling NaNs
This function is defined in @w{IEC 559} (and the appendix with
recommended functions in @w{IEEE 754}/@w{IEEE 854}).
diff --git math/gen-libm-test.pl math/gen-libm-test.pl
index aa60d9d..cca4fcd 100755
--- math/gen-libm-test.pl
+++ math/gen-libm-test.pl
@@ -59,6 +59,8 @@ use vars qw ($output_dir $ulps_file);
"minus_infty" => "-inf",
"plus_infty" => "inf",
"qnan_value" => "qNaN",
+ "snan_value" => "sNaN",
+ "minus_snan_value" => "-sNaN",
"M_El" => "e",
"M_E2l" => "e^2",
"M_E3l" => "e^3",
diff --git math/libm-test.inc math/libm-test.inc
index 1d3ba48..0cdb4f8 100644
--- math/libm-test.inc
+++ math/libm-test.inc
@@ -86,8 +86,7 @@
overflow and underflow exceptions are tested. Inexact exceptions
aren't checked at the moment.
- NaN values: There exist signalling and quiet NaNs. This implementation
- only uses quiet NaN as parameter. Where the sign of a NaN is
+ NaN values: Where the sign of a NaN is
significant, this is not tested. The payload of NaNs is not examined.
Inline functions: Inlining functions should give an improvement in
@@ -133,6 +132,8 @@
#include <argp.h>
#include <tininess.h>
+#include <math-tests.h>
+
/* Allow platforms without all rounding modes to test properly,
assuming they provide an __FE_UNDEFINED in <bits/fenv.h> which
causes fesetround() to return failure. */
@@ -226,6 +227,11 @@ static int ignore_max_ulp; /* Should we ignore max_ulp? */
static FLOAT minus_zero, plus_zero;
static FLOAT plus_infty, minus_infty, qnan_value, max_value, min_value;
+/* A sNaN is only guaranteed to be representable in variables with static (or
+ thread-local) storage duration. TODO: also need to declared it volatile to
+ forbid some compiler optimizations. */
+static volatile FLOAT snan_value = FUNC (__builtin_nans) ("");
+static volatile FLOAT minus_snan_value = -FUNC (__builtin_nans) ("");
static FLOAT min_subnorm_value;
static FLOAT max_error, real_max_error, imag_max_error;
@@ -824,6 +830,8 @@ acos_test (void)
START (acos);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (acos, plus_infty, qnan_value, INVALID_EXCEPTION);
TEST_f_f (acos, minus_infty, qnan_value, INVALID_EXCEPTION);
TEST_f_f (acos, qnan_value, qnan_value);
@@ -992,6 +1000,8 @@ acosh_test (void)
TEST_f_f (acosh, plus_infty, plus_infty);
TEST_f_f (acosh, minus_infty, qnan_value, INVALID_EXCEPTION);
TEST_f_f (acosh, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (acosh, snan_value, qnan_value, INVALID_EXCEPTION);
/* x < 1: */
TEST_f_f (acosh, -1.125L, qnan_value, INVALID_EXCEPTION);
@@ -1014,6 +1024,8 @@ asin_test (void)
START (asin);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (asin, plus_infty, qnan_value, INVALID_EXCEPTION);
TEST_f_f (asin, minus_infty, qnan_value, INVALID_EXCEPTION);
TEST_f_f (asin, qnan_value, qnan_value);
@@ -1185,6 +1197,8 @@ asinh_test (void)
TEST_f_f (asinh, minus_infty, minus_infty);
#endif
TEST_f_f (asinh, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (asinh, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
END (asinh);
@@ -1207,6 +1221,8 @@ atan_test (void)
TEST_f_f (atan, plus_infty, M_PI_2l);
TEST_f_f (atan, minus_infty, -M_PI_2l);
TEST_f_f (atan, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (atan, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (atan, max_value, M_PI_2l);
TEST_f_f (atan, -max_value, -M_PI_2l);
@@ -1246,6 +1262,8 @@ atanh_test (void)
TEST_f_f (atanh, 1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_f_f (atanh, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_f_f (atanh, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (atanh, snan_value, qnan_value, INVALID_EXCEPTION);
/* atanh (x) == qNaN plus invalid exception if |x| > 1. */
TEST_f_f (atanh, 1.125L, qnan_value, INVALID_EXCEPTION);
@@ -1269,6 +1287,8 @@ atan2_test (void)
START (atan2);
+ /* TODO: missing sNaN tests. */
+
/* atan2 (0,x) == 0 for x > 0. */
TEST_ff_f (atan2, 0, 1, 0);
@@ -1354,6 +1374,8 @@ cabs_test (void)
START (cabs);
+ /* TODO: missing sNaN tests. */
+
/* cabs (x + iy) is specified as hypot (x,y) */
/* cabs (+inf + i x) == +inf. */
@@ -1362,7 +1384,6 @@ cabs_test (void)
TEST_c_f (cabs, minus_infty, 1.0, plus_infty);
TEST_c_f (cabs, minus_infty, qnan_value, plus_infty);
- TEST_c_f (cabs, minus_infty, qnan_value, plus_infty);
TEST_c_f (cabs, qnan_value, qnan_value, qnan_value);
@@ -1401,6 +1422,7 @@ cacos_test (void)
START (cacos);
+ /* TODO: missing sNaN tests. */
TEST_c_c (cacos, 0, 0, M_PI_2l, minus_zero);
TEST_c_c (cacos, minus_zero, 0, M_PI_2l, minus_zero);
@@ -2095,6 +2117,7 @@ cacosh_test (void)
START (cacosh);
+ /* TODO: missing sNaN tests. */
TEST_c_c (cacosh, 0, 0, 0.0, M_PI_2l);
TEST_c_c (cacosh, minus_zero, 0, 0.0, M_PI_2l);
@@ -2178,6 +2201,8 @@ carg_test (void)
{
START (carg);
+ /* TODO: missing sNaN tests. */
+
/* carg (x + iy) is specified as atan2 (y, x) */
/* carg (x + i 0) == 0 for x > 0. */
@@ -2251,6 +2276,8 @@ casin_test (void)
START (casin);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (casin, 0, 0, 0.0, 0.0);
TEST_c_c (casin, minus_zero, 0, minus_zero, 0.0);
TEST_c_c (casin, 0, minus_zero, 0.0, minus_zero);
@@ -2949,6 +2976,8 @@ casinh_test (void)
START (casinh);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (casinh, 0, 0, 0.0, 0.0);
TEST_c_c (casinh, minus_zero, 0, minus_zero, 0);
TEST_c_c (casinh, 0, minus_zero, 0.0, minus_zero);
@@ -3647,6 +3676,8 @@ catan_test (void)
START (catan);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (catan, 0, 0, 0, 0);
TEST_c_c (catan, minus_zero, 0, minus_zero, 0);
TEST_c_c (catan, 0, minus_zero, 0, minus_zero);
@@ -3714,6 +3745,8 @@ catanh_test (void)
START (catanh);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (catanh, 0, 0, 0.0, 0.0);
TEST_c_c (catanh, minus_zero, 0, minus_zero, 0.0);
TEST_c_c (catanh, 0, minus_zero, 0.0, minus_zero);
@@ -3786,6 +3819,8 @@ cbrt_test (void)
TEST_f_f (cbrt, plus_infty, plus_infty);
TEST_f_f (cbrt, minus_infty, minus_infty);
TEST_f_f (cbrt, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (cbrt, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (cbrt, -0.001L, -0.1L);
TEST_f_f (cbrt, 8, 2);
@@ -3808,6 +3843,8 @@ ccos_test (void)
START (ccos);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (ccos, 0.0, 0.0, 1.0, minus_zero);
TEST_c_c (ccos, minus_zero, 0.0, 1.0, 0.0);
TEST_c_c (ccos, 0.0, minus_zero, 1.0, 0.0);
@@ -3907,6 +3944,8 @@ ccosh_test (void)
START (ccosh);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (ccosh, 0.0, 0.0, 1.0, 0.0);
TEST_c_c (ccosh, minus_zero, 0.0, 1.0, minus_zero);
TEST_c_c (ccosh, 0.0, minus_zero, 1.0, minus_zero);
@@ -4006,6 +4045,8 @@ ceil_test (void)
TEST_f_f (ceil, plus_infty, plus_infty);
TEST_f_f (ceil, minus_infty, minus_infty);
TEST_f_f (ceil, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (ceil, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (ceil, M_PIl, 4.0);
TEST_f_f (ceil, -M_PIl, -3.0);
@@ -4101,6 +4142,8 @@ cexp_test (void)
START (cexp);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
TEST_c_c (cexp, minus_zero, plus_zero, 1, 0.0);
TEST_c_c (cexp, plus_zero, minus_zero, 1, minus_zero);
@@ -4202,6 +4245,9 @@ static void
cimag_test (void)
{
START (cimag);
+
+ /* TODO: missing sNaN tests. */
+
TEST_c_f (cimag, 1.0, 0.0, 0.0);
TEST_c_f (cimag, 1.0, minus_zero, minus_zero);
TEST_c_f (cimag, 1.0, qnan_value, qnan_value);
@@ -4224,6 +4270,8 @@ clog_test (void)
START (clog);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
@@ -4445,6 +4493,8 @@ clog10_test (void)
START (clog10);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
TEST_c_c (clog10, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
@@ -4658,6 +4708,9 @@ static void
conj_test (void)
{
START (conj);
+
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (conj, 0.0, 0.0, 0.0, minus_zero);
TEST_c_c (conj, 0.0, minus_zero, 0.0, 0.0);
TEST_c_c (conj, qnan_value, qnan_value, qnan_value, qnan_value);
@@ -4692,9 +4745,17 @@ copysign_test (void)
/* XXX More correctly we would have to check the sign of the NaN. */
TEST_ff_f (copysign, qnan_value, 0, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (copysign, snan_value, 0, snan_value);
TEST_ff_f (copysign, qnan_value, minus_zero, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (copysign, snan_value, minus_zero, snan_value);
TEST_ff_f (copysign, -qnan_value, 0, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (copysign, minus_snan_value, 0, snan_value);
TEST_ff_f (copysign, -qnan_value, minus_zero, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (copysign, minus_snan_value, minus_zero, snan_value);
END (copysign);
}
@@ -4722,6 +4783,12 @@ cos_test (void)
errno = 0;
TEST_f_f (cos, qnan_value, qnan_value);
check_int ("errno for cos(qNaN) unchanged", errno, 0, 0, 0, 0);
+ if (SNAN_TESTS (FLOAT))
+ {
+ errno = 0;
+ TEST_f_f (cos, snan_value, qnan_value, INVALID_EXCEPTION);
+ check_int ("errno for cos(sNaN) unchanged", errno, 0, 0, 0, 0);
+ }
TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
@@ -4912,6 +4979,8 @@ cosh_test (void)
TEST_f_f (cosh, minus_infty, plus_infty);
#endif
TEST_f_f (cosh, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (cosh, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
@@ -5043,6 +5112,8 @@ cpow_test (void)
START (cpow);
+ /* TODO: missing sNaN tests. */
+
TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
TEST_cc_c (cpow, 2, 0, 10, 0, 1024.0, 0.0);
@@ -5064,6 +5135,9 @@ static void
cproj_test (void)
{
START (cproj);
+
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (cproj, 0.0, 0.0, 0.0, 0.0);
TEST_c_c (cproj, minus_zero, minus_zero, minus_zero, minus_zero);
TEST_c_c (cproj, 0.0, minus_zero, 0.0, minus_zero);
@@ -5087,6 +5161,9 @@ static void
creal_test (void)
{
START (creal);
+
+ /* TODO: missing sNaN tests. */
+
TEST_c_f (creal, 0.0, 1.0, 0.0);
TEST_c_f (creal, minus_zero, 1.0, minus_zero);
TEST_c_f (creal, qnan_value, 1.0, qnan_value);
@@ -5109,6 +5186,8 @@ csin_test (void)
START (csin);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (csin, 0.0, 0.0, 0.0, 0.0);
TEST_c_c (csin, minus_zero, 0.0, minus_zero, 0.0);
TEST_c_c (csin, 0.0, minus_zero, 0, minus_zero);
@@ -5208,6 +5287,8 @@ csinh_test (void)
START (csinh);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (csinh, 0.0, 0.0, 0.0, 0.0);
TEST_c_c (csinh, minus_zero, 0.0, minus_zero, 0.0);
TEST_c_c (csinh, 0.0, minus_zero, 0.0, minus_zero);
@@ -5307,6 +5388,8 @@ csqrt_test (void)
START (csqrt);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
TEST_c_c (csqrt, 0, minus_zero, 0, minus_zero);
TEST_c_c (csqrt, minus_zero, 0, 0.0, 0.0);
@@ -5428,6 +5511,8 @@ ctan_test (void)
START (ctan);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (ctan, 0, 0, 0.0, 0.0);
TEST_c_c (ctan, 0, minus_zero, 0.0, minus_zero);
TEST_c_c (ctan, minus_zero, 0, minus_zero, 0.0);
@@ -5648,6 +5733,8 @@ ctanh_test (void)
START (ctanh);
+ /* TODO: missing sNaN tests. */
+
TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
TEST_c_c (ctanh, 0, minus_zero, 0.0, minus_zero);
TEST_c_c (ctanh, minus_zero, 0, minus_zero, 0.0);
@@ -5874,6 +5961,8 @@ erf_test (void)
TEST_f_f (erf, plus_infty, 1);
TEST_f_f (erf, minus_infty, -1);
TEST_f_f (erf, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (erf, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
@@ -5902,6 +5991,8 @@ erfc_test (void)
TEST_f_f (erfc, 0.0, 1.0);
TEST_f_f (erfc, minus_zero, 1.0);
TEST_f_f (erfc, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (erfc, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
@@ -5936,6 +6027,8 @@ exp_test (void)
START (exp);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (exp, 0, 1);
TEST_f_f (exp, minus_zero, 1);
@@ -6090,12 +6183,15 @@ exp10_test (void)
START (exp10);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (exp10, 0, 1);
TEST_f_f (exp10, minus_zero, 1);
TEST_f_f (exp10, plus_infty, plus_infty);
TEST_f_f (exp10, minus_infty, 0);
TEST_f_f (exp10, qnan_value, qnan_value);
+
TEST_f_f (exp10, 3, 1000);
TEST_f_f (exp10, -1, 0.1L);
TEST_f_f (exp10, 36, 1.0e36L);
@@ -6129,6 +6225,8 @@ exp2_test (void)
START (exp2);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (exp2, 0, 1);
TEST_f_f (exp2, minus_zero, 1);
TEST_f_f (exp2, plus_infty, plus_infty);
@@ -6173,6 +6271,8 @@ expm1_test (void)
START (expm1);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (expm1, 0, 0);
TEST_f_f (expm1, minus_zero, minus_zero);
@@ -6232,12 +6332,19 @@ fabs_test (void)
{
START (fabs);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (fabs, 0, 0);
TEST_f_f (fabs, minus_zero, 0);
TEST_f_f (fabs, plus_infty, plus_infty);
TEST_f_f (fabs, minus_infty, plus_infty);
TEST_f_f (fabs, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (fabs, snan_value, snan_value);
+ TEST_f_f (fabs, -qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (fabs, minus_snan_value, snan_value);
TEST_f_f (fabs, 38.0, 38.0);
TEST_f_f (fabs, -M_El, M_El);
@@ -6267,15 +6374,39 @@ fdim_test (void)
TEST_ff_f (fdim, -9, plus_infty, 0);
TEST_ff_f (fdim, 0, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, 0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, 9, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, 9, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, -9, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, -9, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, qnan_value, 9, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, snan_value, 9, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, qnan_value, -9, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, snan_value, -9, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, plus_infty, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, plus_infty, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, minus_infty, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, minus_infty, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, qnan_value, plus_infty, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, snan_value, plus_infty, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, qnan_value, minus_infty, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, snan_value, minus_infty, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, qnan_value, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fdim, snan_value, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fdim, plus_infty, plus_infty, 0);
@@ -6295,6 +6426,10 @@ finite_test (void)
TEST_f_b (finite, plus_infty, 0);
TEST_f_b (finite, minus_infty, 0);
TEST_f_b (finite, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (finite, snan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (finite, minus_snan_value, 0);
END (finite);
}
@@ -6310,6 +6445,8 @@ floor_test (void)
TEST_f_f (floor, plus_infty, plus_infty);
TEST_f_f (floor, minus_infty, minus_infty);
TEST_f_f (floor, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (floor, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (floor, M_PIl, 3.0);
TEST_f_f (floor, -M_PIl, -4.0);
@@ -6408,12 +6545,26 @@ fma_test (void)
TEST_fff_f (fma, 1.0, 2.0, 3.0, 5.0);
TEST_fff_f (fma, qnan_value, 2.0, 3.0, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, snan_value, 2.0, 3.0, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, 1.0, qnan_value, 3.0, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, 1.0, snan_value, 3.0, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, 1.0, 2.0, qnan_value, qnan_value, INVALID_EXCEPTION_OK);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, 1.0, 2.0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, plus_infty, 0.0, qnan_value, qnan_value, INVALID_EXCEPTION_OK);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, plus_infty, 0.0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, minus_infty, 0.0, qnan_value, qnan_value, INVALID_EXCEPTION_OK);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, minus_infty, 0.0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, 0.0, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION_OK);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, 0.0, plus_infty, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, 0.0, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION_OK);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fff_f (fma, 0.0, minus_infty, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, plus_infty, 0.0, 1.0, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, minus_infty, 0.0, 1.0, qnan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, 0.0, plus_infty, 1.0, qnan_value, INVALID_EXCEPTION);
@@ -7357,6 +7508,8 @@ fmax_test (void)
{
START (fmax);
+ /* TODO: missing sNaN tests. */
+
TEST_ff_f (fmax, 0, 0, 0);
TEST_ff_f (fmax, minus_zero, minus_zero, minus_zero);
TEST_ff_f (fmax, 9, 0, 9);
@@ -7395,6 +7548,8 @@ fmin_test (void)
{
START (fmin);
+ /* TODO: missing sNaN tests. */
+
TEST_ff_f (fmin, 0, 0, 0);
TEST_ff_f (fmin, minus_zero, minus_zero, minus_zero);
TEST_ff_f (fmin, 9, 0, 0);
@@ -7465,6 +7620,12 @@ fmod_test (void)
TEST_ff_f (fmod, 3.0, minus_infty, 3.0);
TEST_ff_f (fmod, qnan_value, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fmod, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fmod, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (fmod, snan_value, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
@@ -7489,6 +7650,10 @@ fpclassify_test (void)
START (fpclassify);
TEST_f_i (fpclassify, qnan_value, FP_NAN);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_i (fpclassify, snan_value, FP_NAN);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_i (fpclassify, minus_snan_value, FP_NAN);
TEST_f_i (fpclassify, plus_infty, FP_INFINITE);
TEST_f_i (fpclassify, minus_infty, FP_INFINITE);
TEST_f_i (fpclassify, plus_zero, FP_ZERO);
@@ -7507,6 +7672,8 @@ frexp_test (void)
START (frexp);
+ /* TODO: missing sNaN tests. */
+
TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
TEST_fI_f1 (frexp, qnan_value, qnan_value, IGNORE);
@@ -7538,6 +7705,8 @@ gamma_test (void)
TEST_f_f (gamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_f_f (gamma, minus_infty, plus_infty);
TEST_f_f (gamma, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (gamma, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f1 (gamma, 1, 0, 1);
TEST_f_f1 (gamma, 3, M_LN2l, 1);
@@ -7564,12 +7733,26 @@ hypot_test (void)
#ifndef TEST_INLINE
TEST_ff_f (hypot, plus_infty, qnan_value, plus_infty);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, plus_infty, snan_value, plus_infty, INVALID_EXCEPTION);
TEST_ff_f (hypot, minus_infty, qnan_value, plus_infty);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, minus_infty, snan_value, plus_infty, INVALID_EXCEPTION);
TEST_ff_f (hypot, qnan_value, plus_infty, plus_infty);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, snan_value, plus_infty, plus_infty, INVALID_EXCEPTION);
TEST_ff_f (hypot, qnan_value, minus_infty, plus_infty);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, snan_value, minus_infty, plus_infty, INVALID_EXCEPTION);
#endif
TEST_ff_f (hypot, qnan_value, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (hypot, snan_value, snan_value, qnan_value, INVALID_EXCEPTION);
/* hypot (x,y) == hypot (+-x, +-y) */
TEST_ff_f (hypot, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
@@ -7628,6 +7811,13 @@ ilogb_test (void)
errno = 0;
TEST_f_i (ilogb, qnan_value, FP_ILOGBNAN, INVALID_EXCEPTION);
check_int ("errno for ilogb(qNaN) unchanged", errno, EDOM, 0, 0, 0);
+ /* ilogb (sNaN) == FP_ILOGBNAN plus invalid exception */
+ if (SNAN_TESTS (FLOAT))
+ {
+ errno = 0;
+ TEST_f_i (ilogb, snan_value, FP_ILOGBNAN, INVALID_EXCEPTION);
+ check_int ("errno for ilogb(sNaN) unchanged", errno, EDOM, 0, 0, 0);
+ }
/* ilogb (inf) == INT_MAX plus invalid exception */
errno = 0;
TEST_f_i (ilogb, plus_infty, INT_MAX, INVALID_EXCEPTION);
@@ -7652,6 +7842,10 @@ isfinite_test (void)
TEST_f_b (isfinite, plus_infty, 0);
TEST_f_b (isfinite, minus_infty, 0);
TEST_f_b (isfinite, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isfinite, snan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isfinite, minus_snan_value, 0);
END (isfinite);
}
@@ -7665,18 +7859,36 @@ isgreater_test (void)
TEST_ff_i (isgreater, minus_zero, plus_zero, 0);
TEST_ff_i (isgreater, minus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreater, minus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, minus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreater, plus_zero, minus_zero, 0);
TEST_ff_i (isgreater, plus_zero, plus_zero, 0);
TEST_ff_i (isgreater, plus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreater, plus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, plus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreater, (FLOAT) 1, minus_zero, 1);
TEST_ff_i (isgreater, (FLOAT) 1, plus_zero, 1);
TEST_ff_i (isgreater, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (isgreater, (FLOAT) 1, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, (FLOAT) 1, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreater, qnan_value, minus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, snan_value, minus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreater, qnan_value, plus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, snan_value, plus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreater, qnan_value, (FLOAT) 1, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, snan_value, (FLOAT) 1, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreater, qnan_value, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, snan_value, qnan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, qnan_value, snan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreater, snan_value, snan_value, 0, INVALID_EXCEPTION);
END (isgreater);
}
@@ -7690,18 +7902,36 @@ isgreaterequal_test (void)
TEST_ff_i (isgreaterequal, minus_zero, plus_zero, 1);
TEST_ff_i (isgreaterequal, minus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreaterequal, minus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, minus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreaterequal, plus_zero, minus_zero, 1);
TEST_ff_i (isgreaterequal, plus_zero, plus_zero, 1);
TEST_ff_i (isgreaterequal, plus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreaterequal, plus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, plus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreaterequal, (FLOAT) 1, minus_zero, 1);
TEST_ff_i (isgreaterequal, (FLOAT) 1, plus_zero, 1);
TEST_ff_i (isgreaterequal, (FLOAT) 1, (FLOAT) 1, 1);
TEST_ff_i (isgreaterequal, (FLOAT) 1, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, (FLOAT) 1, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreaterequal, qnan_value, minus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, snan_value, minus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreaterequal, qnan_value, plus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, snan_value, plus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreaterequal, qnan_value, (FLOAT) 1, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, snan_value, (FLOAT) 1, 0, INVALID_EXCEPTION);
TEST_ff_i (isgreaterequal, qnan_value, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, snan_value, qnan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, qnan_value, snan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isgreaterequal, snan_value, snan_value, 0, INVALID_EXCEPTION);
END (isgreaterequal);
}
@@ -7718,6 +7948,10 @@ isinf_test (void)
TEST_f_b (isinf, plus_infty, 1);
TEST_f_b (isinf, minus_infty, 1);
TEST_f_b (isinf, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isinf, snan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isinf, minus_snan_value, 0);
END (isinf);
}
@@ -7731,18 +7965,36 @@ isless_test (void)
TEST_ff_i (isless, minus_zero, plus_zero, 0);
TEST_ff_i (isless, minus_zero, (FLOAT) 1, 1);
TEST_ff_i (isless, minus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, minus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isless, plus_zero, minus_zero, 0);
TEST_ff_i (isless, plus_zero, plus_zero, 0);
TEST_ff_i (isless, plus_zero, (FLOAT) 1, 1);
TEST_ff_i (isless, plus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, plus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isless, (FLOAT) 1, minus_zero, 0);
TEST_ff_i (isless, (FLOAT) 1, plus_zero, 0);
TEST_ff_i (isless, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (isless, (FLOAT) 1, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, (FLOAT) 1, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (isless, qnan_value, minus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, snan_value, minus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (isless, qnan_value, plus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, snan_value, plus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (isless, qnan_value, (FLOAT) 1, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, snan_value, (FLOAT) 1, 0, INVALID_EXCEPTION);
TEST_ff_i (isless, qnan_value, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, snan_value, qnan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, qnan_value, snan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isless, snan_value, snan_value, 0, INVALID_EXCEPTION);
END (isless);
}
@@ -7756,18 +8008,36 @@ islessequal_test (void)
TEST_ff_i (islessequal, minus_zero, plus_zero, 1);
TEST_ff_i (islessequal, minus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessequal, minus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, minus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (islessequal, plus_zero, minus_zero, 1);
TEST_ff_i (islessequal, plus_zero, plus_zero, 1);
TEST_ff_i (islessequal, plus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessequal, plus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, plus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (islessequal, (FLOAT) 1, minus_zero, 0);
TEST_ff_i (islessequal, (FLOAT) 1, plus_zero, 0);
TEST_ff_i (islessequal, (FLOAT) 1, (FLOAT) 1, 1);
TEST_ff_i (islessequal, (FLOAT) 1, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, (FLOAT) 1, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (islessequal, qnan_value, minus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, snan_value, minus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (islessequal, qnan_value, plus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, snan_value, plus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (islessequal, qnan_value, (FLOAT) 1, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, snan_value, (FLOAT) 1, 0, INVALID_EXCEPTION);
TEST_ff_i (islessequal, qnan_value, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, snan_value, qnan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, qnan_value, snan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessequal, snan_value, snan_value, 0, INVALID_EXCEPTION);
END (islessequal);
}
@@ -7781,18 +8051,36 @@ islessgreater_test (void)
TEST_ff_i (islessgreater, minus_zero, plus_zero, 0);
TEST_ff_i (islessgreater, minus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessgreater, minus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, minus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (islessgreater, plus_zero, minus_zero, 0);
TEST_ff_i (islessgreater, plus_zero, plus_zero, 0);
TEST_ff_i (islessgreater, plus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessgreater, plus_zero, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, plus_zero, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (islessgreater, (FLOAT) 1, minus_zero, 1);
TEST_ff_i (islessgreater, (FLOAT) 1, plus_zero, 1);
TEST_ff_i (islessgreater, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (islessgreater, (FLOAT) 1, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, (FLOAT) 1, snan_value, 0, INVALID_EXCEPTION);
TEST_ff_i (islessgreater, qnan_value, minus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, snan_value, minus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (islessgreater, qnan_value, plus_zero, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, snan_value, plus_zero, 0, INVALID_EXCEPTION);
TEST_ff_i (islessgreater, qnan_value, (FLOAT) 1, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, snan_value, (FLOAT) 1, 0, INVALID_EXCEPTION);
TEST_ff_i (islessgreater, qnan_value, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, snan_value, qnan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, qnan_value, snan_value, 0, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (islessgreater, snan_value, snan_value, 0, INVALID_EXCEPTION);
END (islessgreater);
}
@@ -7809,6 +8097,10 @@ isnan_test (void)
TEST_f_b (isnan, plus_infty, 0);
TEST_f_b (isnan, minus_infty, 0);
TEST_f_b (isnan, qnan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isnan, snan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isnan, minus_snan_value, 1);
END (isnan);
}
@@ -7825,6 +8117,10 @@ isnormal_test (void)
TEST_f_b (isnormal, plus_infty, 0);
TEST_f_b (isnormal, minus_infty, 0);
TEST_f_b (isnormal, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isnormal, snan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (isnormal, minus_snan_value, 0);
END (isnormal);
}
@@ -7841,6 +8137,10 @@ issignaling_test (void)
TEST_f_b (issignaling, plus_infty, 0);
TEST_f_b (issignaling, minus_infty, 0);
TEST_f_b (issignaling, qnan_value, 0);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (issignaling, snan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_b (issignaling, minus_snan_value, 1);
END (issignaling);
}
@@ -7854,18 +8154,36 @@ isunordered_test (void)
TEST_ff_i (isunordered, minus_zero, plus_zero, 0);
TEST_ff_i (isunordered, minus_zero, (FLOAT) 1, 0);
TEST_ff_i (isunordered, minus_zero, qnan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, minus_zero, snan_value, 1, INVALID_EXCEPTION);
TEST_ff_i (isunordered, plus_zero, minus_zero, 0);
TEST_ff_i (isunordered, plus_zero, plus_zero, 0);
TEST_ff_i (isunordered, plus_zero, (FLOAT) 1, 0);
TEST_ff_i (isunordered, plus_zero, qnan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, plus_zero, snan_value, 1, INVALID_EXCEPTION);
TEST_ff_i (isunordered, (FLOAT) 1, minus_zero, 0);
TEST_ff_i (isunordered, (FLOAT) 1, plus_zero, 0);
TEST_ff_i (isunordered, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (isunordered, (FLOAT) 1, qnan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, (FLOAT) 1, snan_value, 1, INVALID_EXCEPTION);
TEST_ff_i (isunordered, qnan_value, minus_zero, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, snan_value, minus_zero, 1, INVALID_EXCEPTION);
TEST_ff_i (isunordered, qnan_value, plus_zero, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, snan_value, plus_zero, 1, INVALID_EXCEPTION);
TEST_ff_i (isunordered, qnan_value, (FLOAT) 1, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, snan_value, (FLOAT) 1, 1, INVALID_EXCEPTION);
TEST_ff_i (isunordered, qnan_value, qnan_value, 1);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, snan_value, qnan_value, 1, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, qnan_value, snan_value, 1, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_i (isunordered, snan_value, snan_value, 1, INVALID_EXCEPTION);
END (isunordered);
}
@@ -7888,6 +8206,8 @@ j0_test (void)
/* j0 is the Bessel function of the first kind of order 0 */
TEST_f_f (j0, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (j0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (j0, plus_infty, 0);
TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
TEST_f_f (j0, 0.0, 1.0);
@@ -7936,6 +8256,8 @@ j1_test (void)
START (j1);
TEST_f_f (j1, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (j1, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (j1, plus_infty, 0);
TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
@@ -7982,6 +8304,8 @@ jn_test (void)
/* jn (0, x) == j0 (x) */
TEST_ff_f (jn, 0, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (jn, 0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (jn, 0, plus_infty, 0);
TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
TEST_ff_f (jn, 0, 0.0, 1.0);
@@ -7997,6 +8321,8 @@ jn_test (void)
/* jn (1, x) == j1 (x) */
TEST_ff_f (jn, 1, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (jn, 1, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (jn, 1, plus_infty, 0);
TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
TEST_ff_f (jn, 1, 0.0, 0.0);
@@ -8010,6 +8336,8 @@ jn_test (void)
/* jn (3, x) */
TEST_ff_f (jn, 3, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (jn, 3, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (jn, 3, plus_infty, 0);
TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
@@ -8022,6 +8350,8 @@ jn_test (void)
/* jn (10, x) */
TEST_ff_f (jn, 10, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (jn, 10, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (jn, 10, plus_infty, 0);
TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
@@ -8054,6 +8384,8 @@ ldexp_test (void)
{
START (ldexp);
+ /* TODO: missing sNaN tests. */
+
TEST_ff_f (ldexp, 0, 0, 0);
TEST_ff_f (ldexp, minus_zero, 0, minus_zero);
@@ -8088,6 +8420,8 @@ lgamma_test (void)
TEST_f_f (lgamma, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
check_int ("signgam for lgamma(-0) == -1", signgam, -1, 0, 0, 0);
TEST_f_f (lgamma, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (lgamma, snan_value, qnan_value, INVALID_EXCEPTION);
/* lgamma (x) == +inf plus divide by zero exception for integer x <= 0. */
errno = 0;
@@ -8116,7 +8450,7 @@ lrint_test (void)
/* XXX this test is incomplete. We need to have a way to specifiy
the rounding method and test the critical cases. So far, only
unproblematic numbers are tested. */
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ /* TODO: missing +/-Inf as well as qNaN and sNaN tests. */
START (lrint);
@@ -8309,7 +8643,7 @@ llrint_test (void)
/* XXX this test is incomplete. We need to have a way to specifiy
the rounding method and test the critical cases. So far, only
unproblematic numbers are tested. */
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ /* TODO: missing +/-Inf as well as qNaN and sNaN tests. */
START (llrint);
@@ -9003,6 +9337,8 @@ log_test (void)
TEST_f_f (log, minus_infty, qnan_value, INVALID_EXCEPTION);
TEST_f_f (log, plus_infty, plus_infty);
TEST_f_f (log, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (log, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (log, M_El, 1);
TEST_f_f (log, 1.0 / M_El, -1);
@@ -9037,6 +9373,8 @@ log10_test (void)
TEST_f_f (log10, plus_infty, plus_infty);
TEST_f_f (log10, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (log10, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (log10, 0.1L, -1);
TEST_f_f (log10, 10.0, 1);
@@ -9060,6 +9398,8 @@ log1p_test (void)
START (log1p);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (log1p, 0, 0);
TEST_f_f (log1p, minus_zero, minus_zero);
@@ -9102,6 +9442,8 @@ log2_test (void)
TEST_f_f (log2, plus_infty, plus_infty);
TEST_f_f (log2, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (log2, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (log2, M_El, M_LOG2El);
TEST_f_f (log2, 2.0, 1);
@@ -9125,6 +9467,8 @@ logb_test (void)
TEST_f_f (logb, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_f_f (logb, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (logb, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (logb, 1, 0);
TEST_f_f (logb, M_El, 1);
@@ -9188,7 +9532,7 @@ logb_test_downward (void)
static void
lround_test (void)
{
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ /* TODO: missing +/-Inf as well as qNaN and sNaN tests. */
START (lround);
@@ -9232,7 +9576,7 @@ lround_test (void)
static void
llround_test (void)
{
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ /* TODO: missing +/-Inf as well as qNaN and sNaN tests. */
START (llround);
@@ -9408,6 +9752,8 @@ modf_test (void)
START (modf);
+ /* TODO: missing sNaN tests. */
+
TEST_fF_f1 (modf, plus_infty, 0, plus_infty);
TEST_fF_f1 (modf, minus_infty, minus_zero, minus_infty);
TEST_fF_f1 (modf, qnan_value, qnan_value, qnan_value);
@@ -9428,6 +9774,8 @@ nearbyint_test (void)
{
START (nearbyint);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (nearbyint, 0.0, 0.0);
TEST_f_f (nearbyint, minus_zero, minus_zero);
TEST_f_f (nearbyint, plus_infty, plus_infty);
@@ -9492,8 +9840,18 @@ nextafter_test (void)
TEST_ff_f (nextafter, minus_infty, minus_infty, minus_infty);
TEST_ff_f (nextafter, qnan_value, 1.1L, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nextafter, snan_value, 1.1L, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (nextafter, 1.1L, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nextafter, 1.1L, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (nextafter, qnan_value, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nextafter, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nextafter, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nextafter, snan_value, snan_value, qnan_value, INVALID_EXCEPTION);
FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
LDBL_MAX, DBL_MAX, FLT_MAX);
@@ -9527,8 +9885,18 @@ nexttoward_test (void)
TEST_ff_f (nexttoward, minus_infty, minus_infty, minus_infty);
TEST_ff_f (nexttoward, qnan_value, 1.1L, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nexttoward, snan_value, 1.1L, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (nexttoward, 1.1L, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nexttoward, 1.1L, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (nexttoward, qnan_value, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nexttoward, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nexttoward, qnan_value, snan_value, qnan_value, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (nexttoward, snan_value, snan_value, qnan_value, INVALID_EXCEPTION);
#ifdef TEST_FLOAT
TEST_ff_f (nexttoward, 1.0, 1.1L, 0x1.000002p0);
@@ -9614,6 +9982,8 @@ pow_test (void)
START (pow);
+ /* TODO: missing sNaN tests. */
+
TEST_ff_f (pow, 0, 0, 1);
TEST_ff_f (pow, 0, minus_zero, 1);
TEST_ff_f (pow, minus_zero, 0, 1);
@@ -9693,7 +10063,6 @@ pow_test (void)
TEST_ff_f (pow, qnan_value, 1, qnan_value);
TEST_ff_f (pow, qnan_value, -1, qnan_value);
- /* pow (x, qNaN) == qNaN. */
TEST_ff_f (pow, 3.0, qnan_value, qnan_value);
TEST_ff_f (pow, minus_zero, qnan_value, qnan_value);
TEST_ff_f (pow, plus_infty, qnan_value, qnan_value);
@@ -10493,6 +10862,8 @@ remainder_test (void)
START (remainder);
+ /* TODO: missing sNaN tests. */
+
errno = 0;
TEST_ff_f (remainder, 1, 0, qnan_value, INVALID_EXCEPTION);
check_int ("errno for remainder(1, 0) = EDOM ", errno, EDOM, 0, 0, 0);
@@ -10544,6 +10915,12 @@ remquo_test (void)
TEST_ffI_f1 (remquo, plus_infty, 1, qnan_value, IGNORE, INVALID_EXCEPTION);
TEST_ffI_f1 (remquo, minus_infty, 1, qnan_value, IGNORE, INVALID_EXCEPTION);
TEST_ffI_f1 (remquo, qnan_value, qnan_value, qnan_value, IGNORE);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ffI_f1 (remquo, snan_value, qnan_value, qnan_value, IGNORE, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ffI_f1 (remquo, qnan_value, snan_value, qnan_value, IGNORE, INVALID_EXCEPTION);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ffI_f1 (remquo, snan_value, snan_value, qnan_value, IGNORE, INVALID_EXCEPTION);
TEST_ffI_f1 (remquo, 1.625, 1.0, -0.375, 2);
TEST_ffI_f1 (remquo, -1.625, 1.0, 0.375, -2);
@@ -10559,7 +10936,7 @@ remquo_test (void)
static void
rint_test (void)
{
- /* TODO: missing qNaN tests. */
+ /* TODO: missing qNaN and sNaN tests. */
START (rint);
@@ -11026,7 +11403,7 @@ rint_test_upward (void)
static void
round_test (void)
{
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ /* TODO: missing +/-Inf as well as qNaN and sNaN tests. */
START (round);
@@ -11130,6 +11507,8 @@ scalb_test (void)
START (scalb);
+ /* TODO: missing sNaN tests. */
+
TEST_ff_f (scalb, 2.0, 0.5, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (scalb, 3.0, -2.5, qnan_value, INVALID_EXCEPTION);
@@ -11196,6 +11575,8 @@ scalbn_test (void)
TEST_fi_f (scalbn, plus_infty, 1, plus_infty);
TEST_fi_f (scalbn, minus_infty, 1, minus_infty);
TEST_fi_f (scalbn, qnan_value, 1, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fi_f (scalbn, snan_value, 1, qnan_value, INVALID_EXCEPTION);
TEST_fi_f (scalbn, 0.8L, 4, 12.8L);
TEST_fi_f (scalbn, -0.854375L, 5, -27.34L);
@@ -11227,6 +11608,8 @@ scalbln_test (void)
TEST_fl_f (scalbln, plus_infty, 1, plus_infty);
TEST_fl_f (scalbln, minus_infty, 1, minus_infty);
TEST_fl_f (scalbln, qnan_value, 1, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_fl_f (scalbln, snan_value, 1, qnan_value, INVALID_EXCEPTION);
TEST_fl_f (scalbln, 0.8L, 4, 12.8L);
TEST_fl_f (scalbln, -0.854375L, 5, -27.34L);
@@ -11269,7 +11652,7 @@ scalbln_test (void)
static void
signbit_test (void)
{
- /* TODO: missing qNaN tests. */
+ /* TODO: missing qNaN and sNaN tests. */
START (signbit);
@@ -11309,6 +11692,12 @@ sin_test (void)
errno = 0;
TEST_f_f (sin, qnan_value, qnan_value);
check_int ("errno for sin(qNaN) unchanged", errno, 0, 0, 0, 0);
+ if (SNAN_TESTS (FLOAT))
+ {
+ errno = 0;
+ TEST_f_f (sin, snan_value, qnan_value, INVALID_EXCEPTION);
+ check_int ("errno for sin(sNaN) unchanged", errno, 0, 0, 0, 0);
+ }
TEST_f_f (sin, M_PI_6l, 0.5);
TEST_f_f (sin, -M_PI_6l, -0.5);
@@ -11503,6 +11892,8 @@ sincos_test (void)
TEST_extra (sincos, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION);
TEST_extra (sincos, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION);
TEST_extra (sincos, qnan_value, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_extra (sincos, snan_value, qnan_value, qnan_value, INVALID_EXCEPTION);
TEST_extra (sincos, M_PI_2l, 1, 0);
TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
@@ -11553,6 +11944,8 @@ sinh_test (void)
TEST_f_f (sinh, minus_infty, minus_infty);
#endif
TEST_f_f (sinh, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (sinh, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
@@ -11682,6 +12075,8 @@ sqrt_test (void)
TEST_f_f (sqrt, 0, 0);
TEST_f_f (sqrt, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (sqrt, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (sqrt, plus_infty, plus_infty);
TEST_f_f (sqrt, minus_zero, minus_zero);
@@ -11725,6 +12120,12 @@ tan_test (void)
errno = 0;
TEST_f_f (tan, qnan_value, qnan_value);
check_int ("errno for tan(qNaN) == 0", errno, 0, 0, 0, 0);
+ if (SNAN_TESTS (FLOAT))
+ {
+ errno = 0;
+ TEST_f_f (tan, snan_value, qnan_value, INVALID_EXCEPTION);
+ check_int ("errno for tan(sNaN) == 0", errno, 0, 0, 0, 0);
+ }
TEST_f_f (tan, M_PI_4l, 1);
TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
@@ -11938,6 +12339,8 @@ tanh_test (void)
TEST_f_f (tanh, minus_infty, -1);
#endif
TEST_f_f (tanh, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (tanh, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
@@ -11962,6 +12365,8 @@ tgamma_test (void)
START (tgamma);
+ /* TODO: missing sNaN tests. */
+
TEST_f_f (tgamma, plus_infty, plus_infty);
TEST_f_f (tgamma, max_value, plus_infty, OVERFLOW_EXCEPTION);
TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
@@ -11993,6 +12398,8 @@ trunc_test (void)
TEST_f_f (trunc, plus_infty, plus_infty);
TEST_f_f (trunc, minus_infty, minus_infty);
TEST_f_f (trunc, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (trunc, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (trunc, 0, 0);
TEST_f_f (trunc, minus_zero, minus_zero);
@@ -12115,6 +12522,8 @@ y0_test (void)
TEST_f_f (y0, -max_value, minus_infty, INVALID_EXCEPTION);
TEST_f_f (y0, 0.0, minus_infty);
TEST_f_f (y0, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (y0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (y0, plus_infty, 0);
TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
@@ -12175,6 +12584,8 @@ y1_test (void)
TEST_f_f (y1, 0.0, minus_infty);
TEST_f_f (y1, plus_infty, 0);
TEST_f_f (y1, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_f_f (y1, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
@@ -12234,6 +12645,8 @@ yn_test (void)
TEST_ff_f (yn, 0, -max_value, minus_infty, INVALID_EXCEPTION);
TEST_ff_f (yn, 0, 0.0, minus_infty);
TEST_ff_f (yn, 0, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (yn, 0, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (yn, 0, plus_infty, 0);
TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
@@ -12249,6 +12662,8 @@ yn_test (void)
TEST_ff_f (yn, 1, 0.0, minus_infty);
TEST_ff_f (yn, 1, plus_infty, 0);
TEST_ff_f (yn, 1, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (yn, 1, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
@@ -12261,6 +12676,8 @@ yn_test (void)
/* yn (3, x) */
TEST_ff_f (yn, 3, plus_infty, 0);
TEST_ff_f (yn, 3, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (yn, 3, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
@@ -12271,6 +12688,8 @@ yn_test (void)
/* yn (10, x) */
TEST_ff_f (yn, 10, plus_infty, 0);
TEST_ff_f (yn, 10, qnan_value, qnan_value);
+ if (SNAN_TESTS (FLOAT))
+ TEST_ff_f (yn, 10, snan_value, qnan_value, INVALID_EXCEPTION);
TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
@@ -12295,7 +12714,7 @@ significand_test (void)
{
/* significand returns the mantissa of the exponential representation. */
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ /* TODO: missing +/-Inf as well as qNaN and sNaN tests. */
START (significand);
@@ -12332,6 +12751,8 @@ initialize (void)
(void) &plus_zero;
(void) &qnan_value;
+ (void) &snan_value;
+ (void) &minus_snan_value;
(void) &minus_zero;
(void) &plus_infty;
(void) &minus_infty;
Grüße,
Thomas
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Policy question -- libm-test: tests with sNaNs as inputs
2013-04-03 15:30 Policy question -- libm-test: tests with sNaNs as inputs Thomas Schwinge
@ 2013-04-03 15:41 ` Joseph S. Myers
0 siblings, 0 replies; 2+ messages in thread
From: Joseph S. Myers @ 2013-04-03 15:41 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: libc-alpha, libc-ports
On Wed, 3 Apr 2013, Thomas Schwinge wrote:
> I'd like to propose the following patch, which adds several tests with
> sNaNs as inputs to the libm-test framework.
The tests for hypot are wrong - there, qNaN is considered to represent
missing data, so hypot (qNaN, Inf) is Inf but hypot (sNaN, Inf) should be
qNaN plus exception. Implementing this for hypot, fmin, fmax or complex
functions would be a new feature rather than a simple bug fix, and I don't
think you should add any tests for those functions, or comments about such
tests being missing, unless you implement that new sNaN feature at the
same time.
> Now for the policy question: How to proceed in this case? Commit the
My practice is to keep the testsuite clean on at least x86 and x86_64, by
conditioning any new tests that fail on those architectures because of
known bugs with a #if condition with a comment referencing the bug number
(there are a few existing such comments in libm-test.inc). Other
architecture maintainers may then fix the bugs for their architecture or
add such conditionals in additional cases, depending on how difficult a
fix is.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-03 15:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03 15:30 Policy question -- libm-test: tests with sNaNs as inputs Thomas Schwinge
2013-04-03 15:41 ` Joseph S. Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).