aboutsummaryrefslogtreecommitdiff
path: root/math/basic-test.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-02-28 17:12:25 +0100
committerThomas Schwinge <thomas@codesourcery.com>2013-03-15 19:06:02 +0100
commit67e971f18ffc9b3ea57cbccba54d5203d1e6a988 (patch)
treef62ff6123ac01815295b6d6f6f9dba73c1c65862 /math/basic-test.c
parent64487e126468f91ecdfe7ab7a0f3a82762874d5a (diff)
downloadglibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.zip
glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.gz
glibc-67e971f18ffc9b3ea57cbccba54d5203d1e6a988.tar.bz2
Better distinguish between NaN/qNaN/sNaN.
Diffstat (limited to 'math/basic-test.c')
-rw-r--r--math/basic-test.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/math/basic-test.c b/math/basic-test.c
index f9b9752..218c969 100644
--- a/math/basic-test.c
+++ b/math/basic-test.c
@@ -32,40 +32,40 @@ check (const char *testname, int result)
}
}
-#define TEST_FUNC(NAME, FLOAT, NANFUNC, EPSILON, HUGEVAL) \
+#define TEST_FUNC(NAME, FLOAT, NANFUNC, EPSILON, HUGEVAL) \
static void \
NAME (void) \
{ \
/* Variables are declared volatile to forbid some compiler \
optimizations. */ \
- volatile FLOAT Inf_var, NaN_var, zero_var, one_var; \
+ volatile FLOAT Inf_var, qNaN_var, zero_var, one_var; \
FLOAT x1, x2; \
\
zero_var = 0.0; \
one_var = 1.0; \
- NaN_var = zero_var / zero_var; \
+ qNaN_var = zero_var / zero_var; \
Inf_var = one_var / zero_var; \
\
(void) &zero_var; \
(void) &one_var; \
- (void) &NaN_var; \
+ (void) &qNaN_var; \
(void) &Inf_var; \
\
\
check (#FLOAT " isinf (inf) == 1", isinf (Inf_var) == 1); \
check (#FLOAT " isinf (-inf) == -1", isinf (-Inf_var) == -1); \
check (#FLOAT " !isinf (1)", !(isinf (one_var))); \
- check (#FLOAT " !isinf (NaN)", !(isinf (NaN_var))); \
+ check (#FLOAT " !isinf (qNaN)", !(isinf (qNaN_var))); \
\
- check (#FLOAT " isnan (NaN)", isnan (NaN_var)); \
- check (#FLOAT " isnan (-NaN)", isnan (-NaN_var)); \
+ check (#FLOAT " isnan (qNaN)", isnan (qNaN_var)); \
+ check (#FLOAT " isnan (-qNaN)", isnan (-qNaN_var)); \
check (#FLOAT " !isnan (1)", !(isnan (one_var))); \
check (#FLOAT " !isnan (inf)", !(isnan (Inf_var))); \
\
check (#FLOAT " inf == inf", Inf_var == Inf_var); \
check (#FLOAT " -inf == -inf", -Inf_var == -Inf_var); \
check (#FLOAT " inf != -inf", Inf_var != -Inf_var); \
- check (#FLOAT " NaN != NaN", NaN_var != NaN_var); \
+ check (#FLOAT " qNaN != qNaN", qNaN_var != qNaN_var); \
\
/* \
the same tests but this time with NAN from <bits/nan.h> \
@@ -80,11 +80,11 @@ NAME (void) \
/* \
And again with the value returned by the `nan' function. \
*/ \
- check (#FLOAT " isnan (NAN)", isnan (NANFUNC (""))); \
- check (#FLOAT " isnan (-NAN)", isnan (-NANFUNC (""))); \
- check (#FLOAT " !isinf (NAN)", !(isinf (NANFUNC ("")))); \
- check (#FLOAT " !isinf (-NAN)", !(isinf (-NANFUNC ("")))); \
- check (#FLOAT " NAN != NAN", NANFUNC ("") != NANFUNC ("")); \
+ check (#FLOAT " isnan (nan (\"\"))", isnan (NANFUNC (""))); \
+ check (#FLOAT " isnan (-nan (\"\"))", isnan (-NANFUNC (""))); \
+ check (#FLOAT " !isinf (nan (\"\"))", !(isinf (NANFUNC ("")))); \
+ check (#FLOAT " !isinf (-nan (\"\"))", !(isinf (-NANFUNC ("")))); \
+ check (#FLOAT " nan (\"\") != nan (\"\")", NANFUNC ("") != NANFUNC ("")); \
\
/* test if EPSILON is ok */ \
x1 = 1.0; \
@@ -106,19 +106,19 @@ NAME (void) \
void \
NAME (void) \
{ \
- volatile DOUBLE Inf_var, NaN_var, zero_var, one_var; \
+ volatile DOUBLE Inf_var, qNaN_var, zero_var, one_var; \
FLOAT x1, x2; \
\
zero_var = 0.0; \
one_var = 1.0; \
- NaN_var = zero_var / zero_var; \
+ qNaN_var = zero_var / zero_var; \
Inf_var = one_var / zero_var; \
\
- (void) &NaN_var; \
+ (void) &qNaN_var; \
(void) &Inf_var; \
\
- x1 = (FLOAT) NaN_var; \
- check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") NaN", isnan (x1) != 0); \
+ x1 = (FLOAT) qNaN_var; \
+ check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") qNaN", isnan (x1) != 0); \
x2 = (FLOAT) Inf_var; \
check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") Inf", isinf (x2) != 0); \
}