summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-04-02 03:06:02 +0200
committerBruno Haible <bruno@clisp.org>2008-04-02 03:06:02 +0200
commit0a56509612c0b43a3f05361ecfb73b8b39f8e66c (patch)
treec1b1d4158281e0cb812c0fb31aeebafbbea0d801 /tests
parent64902eb26d25feae17230a246608d1dfe74801e8 (diff)
downloadgnulib-0a56509612c0b43a3f05361ecfb73b8b39f8e66c.tar.gz
Use macros NaNf, NaNd, NaNl instead of NAN.
Diffstat (limited to 'tests')
-rw-r--r--tests/nan.h50
-rw-r--r--tests/test-ceilf1.c5
-rw-r--r--tests/test-floorf1.c5
-rw-r--r--tests/test-frexp.c3
-rw-r--r--tests/test-isnand.c7
-rw-r--r--tests/test-isnanf.c9
-rw-r--r--tests/test-math.c5
-rw-r--r--tests/test-round1.c3
-rw-r--r--tests/test-roundf1.c3
-rw-r--r--tests/test-snprintf-posix.h45
-rw-r--r--tests/test-sprintf-posix.h45
-rw-r--r--tests/test-trunc1.c3
-rw-r--r--tests/test-truncf1.c5
-rw-r--r--tests/test-vasnprintf-posix.c46
-rw-r--r--tests/test-vasprintf-posix.c46
15 files changed, 159 insertions, 121 deletions
diff --git a/tests/nan.h b/tests/nan.h
new file mode 100644
index 0000000000..3bdf6438c2
--- /dev/null
+++ b/tests/nan.h
@@ -0,0 +1,50 @@
+/* Macros for not-a-number.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+/* NaNf () returns a 'float' not-a-number. */
+
+/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
+#ifdef __DECC
+static float
+NaNf ()
+{
+ static float zero = 0.0f;
+ return zero / zero;
+}
+#else
+# define NaNf() (0.0f / 0.0f)
+#endif
+
+
+/* NaNd () returns a 'double' not-a-number. */
+
+/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
+#ifdef __DECC
+static double
+NaNd ()
+{
+ static double zero = 0.0;
+ return zero / zero;
+}
+#else
+# define NaNd() (0.0 / 0.0)
+#endif
+
+
+/* NaNl () returns a 'long double' not-a-number. */
+
+#define NaNl() (0.0L / 0.0L)
diff --git a/tests/test-ceilf1.c b/tests/test-ceilf1.c
index b323227b74..e2a04a0ecc 100644
--- a/tests/test-ceilf1.c
+++ b/tests/test-ceilf1.c
@@ -1,5 +1,5 @@
/* Test of rounding towards positive infinity.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "isnanf.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -67,7 +68,7 @@ main ()
ASSERT (ceilf (1.0f / 0.0f) == 1.0f / 0.0f);
ASSERT (ceilf (-1.0f / 0.0f) == -1.0f / 0.0f);
/* NaNs. */
- ASSERT (isnanf (ceilf (NAN)));
+ ASSERT (isnanf (ceilf (NaNf ())));
return 0;
}
diff --git a/tests/test-floorf1.c b/tests/test-floorf1.c
index a45bcfc2ac..2a9d103053 100644
--- a/tests/test-floorf1.c
+++ b/tests/test-floorf1.c
@@ -1,5 +1,5 @@
/* Test of rounding towards negative infinity.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "isnanf.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -67,7 +68,7 @@ main ()
ASSERT (floorf (1.0f / 0.0f) == 1.0f / 0.0f);
ASSERT (floorf (-1.0f / 0.0f) == -1.0f / 0.0f);
/* NaNs. */
- ASSERT (isnanf (floorf (NAN)));
+ ASSERT (isnanf (floorf (NaNf ())));
return 0;
}
diff --git a/tests/test-frexp.c b/tests/test-frexp.c
index cb80f56413..9e92667cba 100644
--- a/tests/test-frexp.c
+++ b/tests/test-frexp.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include "isnand.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -61,7 +62,7 @@ main ()
{ /* NaN. */
int exp = -9999;
double mantissa;
- x = NAN;
+ x = NaNd ();
mantissa = frexp (x, &exp);
ASSERT (isnand (mantissa));
}
diff --git a/tests/test-isnand.c b/tests/test-isnand.c
index 1dc923896d..ff7310121b 100644
--- a/tests/test-isnand.c
+++ b/tests/test-isnand.c
@@ -21,10 +21,11 @@
#include "isnand.h"
#include <limits.h>
-#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include "nan.h"
+
#define ASSERT(expr) \
do \
{ \
@@ -52,7 +53,7 @@ main ()
ASSERT (!isnand (1.0 / 0.0));
ASSERT (!isnand (-1.0 / 0.0));
/* Quiet NaN. */
- ASSERT (isnand (NAN));
+ ASSERT (isnand (NaNd ()));
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
/* Signalling NaN. */
{
@@ -60,7 +61,7 @@ main ()
((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { double value; unsigned int word[NWORDS]; } memory_double;
memory_double m;
- m.value = NAN;
+ m.value = NaNd ();
# if DBL_EXPBIT0_BIT > 0
m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
# else
diff --git a/tests/test-isnanf.c b/tests/test-isnanf.c
index 6c084acb2e..c70b619e76 100644
--- a/tests/test-isnanf.c
+++ b/tests/test-isnanf.c
@@ -1,5 +1,5 @@
/* Test of isnanf() substitute.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,10 +21,11 @@
#include "isnanf.h"
#include <limits.h>
-#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include "nan.h"
+
#define ASSERT(expr) \
do \
{ \
@@ -52,7 +53,7 @@ main ()
ASSERT (!isnanf (1.0f / 0.0f));
ASSERT (!isnanf (-1.0f / 0.0f));
/* Quiet NaN. */
- ASSERT (isnanf (NAN));
+ ASSERT (isnanf (NaNf ()));
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
/* Signalling NaN. */
{
@@ -60,7 +61,7 @@ main ()
((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { float value; unsigned int word[NWORDS]; } memory_float;
memory_float m;
- m.value = NAN;
+ m.value = NaNf ();
# if FLT_EXPBIT0_BIT > 0
m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
# else
diff --git a/tests/test-math.c b/tests/test-math.c
index 5c00581d17..56cf058c48 100644
--- a/tests/test-math.c
+++ b/tests/test-math.c
@@ -25,6 +25,11 @@
choke me
#endif
+#if 0
+/* Check that NAN expands into a constant expression. */
+static float n = NAN;
+#endif
+
int
main ()
{
diff --git a/tests/test-round1.c b/tests/test-round1.c
index 704e1da640..2710f911f5 100644
--- a/tests/test-round1.c
+++ b/tests/test-round1.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include "isnand.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -74,7 +75,7 @@ main ()
ASSERT (round (1.0 / 0.0) == 1.0 / 0.0);
ASSERT (round (-1.0 / 0.0) == -1.0 / 0.0);
/* NaNs. */
- ASSERT (isnand (round (NAN)));
+ ASSERT (isnand (round (NaNd ())));
return 0;
}
diff --git a/tests/test-roundf1.c b/tests/test-roundf1.c
index aeee3b1739..8131cb2aaa 100644
--- a/tests/test-roundf1.c
+++ b/tests/test-roundf1.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include "isnanf.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -74,7 +75,7 @@ main ()
ASSERT (roundf (1.0 / 0.0f) == 1.0 / 0.0f);
ASSERT (roundf (-1.0 / 0.0f) == -1.0 / 0.0f);
/* NaNs. */
- ASSERT (isnanf (roundf (NAN)));
+ ASSERT (isnanf (roundf (NaNf ())));
return 0;
}
diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h
index 4d69267a62..570f8b77da 100644
--- a/tests/test-snprintf-posix.h
+++ b/tests/test-snprintf-posix.h
@@ -16,7 +16,7 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-#include <math.h>
+#include "nan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
@@ -197,7 +197,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%a %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%a %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -394,7 +394,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050a %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050a %d", NaNd (), 33, 44, 55);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
ASSERT (strlen (result) == 50 + 3
@@ -461,7 +461,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%La %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -746,7 +746,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050La %d", NaNl (), 33, 44, 55);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
ASSERT (strlen (result) == 50 + 3
@@ -908,7 +908,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%f %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%f %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -989,7 +989,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050f %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050f %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1153,10 +1153,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%Lf %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%Lf %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1322,10 +1321,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050Lf %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050Lf %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1404,7 +1402,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%F %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%F %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1496,10 +1494,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%LF %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%LF %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1698,7 +1695,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%e %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%e %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1789,7 +1786,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050e %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050e %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1954,10 +1951,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%Le %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%Le %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2125,10 +2121,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050Le %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050Le %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2306,7 +2301,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%g %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%g %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2390,7 +2385,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050g %d", NAN, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050g %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2555,10 +2550,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%Lg %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%Lg %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2726,10 +2720,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
- my_snprintf (result, sizeof (result), "%050Lg %d", zero / zero, 33, 44, 55);
+ my_snprintf (result, sizeof (result), "%050Lg %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h
index ac2afcf91b..afe7ea28e5 100644
--- a/tests/test-sprintf-posix.h
+++ b/tests/test-sprintf-posix.h
@@ -16,7 +16,7 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-#include <math.h>
+#include "nan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
@@ -183,7 +183,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%a %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%a %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -380,7 +380,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%050a %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%050a %d", NaNd (), 33, 44, 55);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
ASSERT (strlen (result) == 50 + 3
@@ -447,7 +447,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_sprintf (result, "%La %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -732,7 +732,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%050La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_sprintf (result, "%050La %d", NaNl (), 33, 44, 55);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
ASSERT (strlen (result) == 50 + 3
@@ -894,7 +894,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%f %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%f %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -969,7 +969,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%050f %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%050f %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1133,10 +1133,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%Lf %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%Lf %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1296,10 +1295,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%050Lf %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%050Lf %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1378,7 +1376,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%F %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%F %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1470,10 +1468,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%LF %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%LF %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1672,7 +1669,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%e %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%e %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1763,7 +1760,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%050e %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%050e %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -1928,10 +1925,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%Le %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%Le %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2099,10 +2095,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%050Le %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%050Le %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2280,7 +2275,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%g %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%g %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2364,7 +2359,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
- my_sprintf (result, "%050g %d", NAN, 33, 44, 55);
+ my_sprintf (result, "%050g %d", NaNd (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2529,10 +2524,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%Lg %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%Lg %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
@@ -2700,10 +2694,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
- my_sprintf (result, "%050Lg %d", zero / zero, 33, 44, 55);
+ my_sprintf (result, "%050Lg %d", NaNl (), 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
diff --git a/tests/test-trunc1.c b/tests/test-trunc1.c
index 6b283636e4..7f1bd10379 100644
--- a/tests/test-trunc1.c
+++ b/tests/test-trunc1.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "isnand.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -66,7 +67,7 @@ main ()
ASSERT (trunc (1.0 / 0.0) == 1.0 / 0.0);
ASSERT (trunc (-1.0 / 0.0) == -1.0 / 0.0);
/* NaNs. */
- ASSERT (isnand (trunc (NAN)));
+ ASSERT (isnand (trunc (NaNd ())));
return 0;
}
diff --git a/tests/test-truncf1.c b/tests/test-truncf1.c
index 9d365763fa..482738951a 100644
--- a/tests/test-truncf1.c
+++ b/tests/test-truncf1.c
@@ -1,5 +1,5 @@
/* Test of rounding towards zero.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "isnanf.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
@@ -66,7 +67,7 @@ main ()
ASSERT (truncf (1.0f / 0.0f) == 1.0f / 0.0f);
ASSERT (truncf (-1.0f / 0.0f) == -1.0f / 0.0f);
/* NaNs. */
- ASSERT (isnanf (truncf (NAN)));
+ ASSERT (isnanf (truncf (NaNf ())));
return 0;
}
diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c
index c29546a857..4605cd1d99 100644
--- a/tests/test-vasnprintf-posix.c
+++ b/tests/test-vasnprintf-posix.c
@@ -21,7 +21,6 @@
#include "vasnprintf.h"
#include <float.h>
-#include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -29,6 +28,8 @@
#include <stdlib.h>
#include <string.h>
+#include "nan.h"
+
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
#define ASSERT(expr) \
do \
@@ -246,7 +247,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%a %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%a %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -479,7 +480,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050a %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050a %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
@@ -560,7 +561,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%La %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -895,7 +896,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050La %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
@@ -1075,7 +1076,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%f %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%f %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -1168,7 +1169,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050f %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050f %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -1352,10 +1353,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%Lf %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%Lf %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -1547,10 +1547,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050Lf %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050Lf %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -1647,7 +1646,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%F %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%F %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
@@ -1761,10 +1760,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%LF %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%LF %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
@@ -1986,7 +1984,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%e %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%e %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -2097,7 +2095,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050e %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050e %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -2282,10 +2280,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%Le %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%Le %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -2487,10 +2484,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050Le %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050Le %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -2688,7 +2684,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%g %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%g %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -2792,7 +2788,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050g %d", NAN, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050g %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -2977,10 +2973,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%Lg %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%Lg %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -3182,10 +3177,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
- my_asnprintf (NULL, &length, "%050Lg %d", zero / zero, 33, 44, 55);
+ my_asnprintf (NULL, &length, "%050Lg %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c
index 806ce749f1..2270d6aee8 100644
--- a/tests/test-vasprintf-posix.c
+++ b/tests/test-vasprintf-posix.c
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <float.h>
-#include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -29,6 +28,8 @@
#include <stdlib.h>
#include <string.h>
+#include "nan.h"
+
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
#define ASSERT(expr) \
do \
@@ -227,7 +228,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* NaN. */
char *result;
int retval =
- my_asprintf (&result, "%a %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%a %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -460,7 +461,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
- my_asprintf (&result, "%050a %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%050a %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
@@ -541,7 +542,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* NaN. */
char *result;
int retval =
- my_asprintf (&result, "%La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_asprintf (&result, "%La %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -876,7 +877,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
- my_asprintf (&result, "%050La %d", 0.0L / 0.0L, 33, 44, 55);
+ my_asprintf (&result, "%050La %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
/* "0000000nan 33" is not a valid result; see
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
@@ -1056,7 +1057,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* NaN. */
char *result;
int retval =
- my_asprintf (&result, "%f %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%f %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -1149,7 +1150,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
- my_asprintf (&result, "%050f %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%050f %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -1333,10 +1334,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%Lf %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%Lf %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -1528,10 +1528,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%050Lf %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%050Lf %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -1628,7 +1627,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* NaN. */
char *result;
int retval =
- my_asprintf (&result, "%F %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%F %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
@@ -1742,10 +1741,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%LF %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%LF %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
@@ -1967,7 +1965,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* NaN. */
char *result;
int retval =
- my_asprintf (&result, "%e %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%e %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -2078,7 +2076,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
- my_asprintf (&result, "%050e %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%050e %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -2263,10 +2261,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%Le %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%Le %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -2468,10 +2465,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%050Le %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%050Le %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -2669,7 +2665,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* NaN. */
char *result;
int retval =
- my_asprintf (&result, "%g %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%g %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -2773,7 +2769,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
- my_asprintf (&result, "%050g %d", NAN, 33, 44, 55);
+ my_asprintf (&result, "%050g %d", NaNd (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
@@ -2958,10 +2954,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%Lg %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%Lg %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
@@ -3163,10 +3158,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
- my_asprintf (&result, "%050Lg %d", zero / zero, 33, 44, 55);
+ my_asprintf (&result, "%050Lg %d", NaNl (), 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)