Mercurial > hg > octave-kai > gnulib-hg
changeset 9854:baba3b346ab2
Use macros NaNf, NaNd, NaNl instead of NAN.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 02 Apr 2008 03:06:02 +0200 |
parents | 41ff75af4085 |
children | ec1528409521 |
files | ChangeLog lib/isnan.c modules/ceilf-tests modules/floorf-tests modules/frexp-tests modules/isnand-nolibm modules/isnand-nolibm-tests modules/isnanf-nolibm modules/isnanf-nolibm-tests modules/isnanl modules/isnanl-nolibm modules/round-tests modules/roundf-tests modules/snprintf-posix-tests modules/sprintf-posix-tests modules/trunc-tests modules/truncf-tests modules/vasnprintf-posix-tests modules/vasprintf-posix-tests modules/vsnprintf-posix-tests modules/vsprintf-posix-tests tests/nan.h tests/test-ceilf1.c tests/test-floorf1.c tests/test-frexp.c tests/test-isnand.c tests/test-isnanf.c tests/test-math.c tests/test-round1.c tests/test-roundf1.c tests/test-snprintf-posix.h tests/test-sprintf-posix.h tests/test-trunc1.c tests/test-truncf1.c tests/test-vasnprintf-posix.c tests/test-vasprintf-posix.c |
diffstat | 36 files changed, 247 insertions(+), 133 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,74 @@ +2008-04-01 Bruno Haible <bruno@clisp.org> + + * tests/test-vasnprintf-posix.c: Include nan.h instead of <math.h>. + (test_function): Use NaNd, NaNl instead of NAN or 0.0L/0.0L. + * modules/vasnprintf-posix-tests (Files): Add tests/nan.h. + (Depends-on): Remove math. + + * tests/test-vasprintf-posix.c: Include nan.h instead of <math.h>. + (test_function): Use NaNd, NaNl instead of NAN or 0.0L/0.0L. + * modules/vasprintf-posix-tests (Files): Add tests/nan.h. + (Depends-on): Remove math. + + * tests/test-snprintf-posix.h: Include nan.h instead of <math.h>. + (test_function): Use NaNd, NaNl instead of NAN or 0.0L/0.0L. + * modules/snprintf-posix-tests (Files): Add tests/nan.h. + (Depends-on): Remove math. + * modules/vsnprintf-posix-tests (Files): Add tests/nan.h. + (Depends-on): Remove math. + + * tests/test-sprintf-posix.h: Include nan.h instead of <math.h>. + (test_function): Use NaNd, NaNl instead of NAN or 0.0L/0.0L. + * modules/sprintf-posix-tests (Files): Add tests/nan.h. + (Depends-on): Remove math. + * modules/vsprintf-posix-tests (Files): Add tests/nan.h. + (Depends-on): Remove math. + + * tests/test-round1.c: Include nan.h. + (main): Use NaNd instead of NAN. + * modules/round-tests (Files): Add tests/nan.h. + + * tests/test-trunc1.c: Include nan.h. + (main): Use NaNd instead of NAN. + * modules/trunc-tests (Files): Add tests/nan.h. + + * tests/test-roundf1.c: Include nan.h. + (main): Use NaNf instead of NAN. + * modules/roundf-tests (Files): Add tests/nan.h. + + * tests/test-truncf1.c: Include nan.h. + (main): Use NaNf instead of NAN. + * modules/truncf-tests (Files): Add tests/nan.h. + + * tests/test-ceilf1.c: Include nan.h. + (main): Use NaNf instead of NAN. + * modules/ceilf-tests (Files): Add tests/nan.h. + + * tests/test-floorf1.c: Include nan.h. + (main): Use NaNf instead of NAN. + * modules/floorf-tests (Files): Add tests/nan.h. + + * tests/test-isnanf.c: Include nan.h instead of <math.h>. + (main): Use NaNf instead of NAN. + * modules/isnanf-nolibm-tests (Files): Add tests/nan.h. + + * tests/test-isnand.c: Include nan.h instead of <math.h>. + (main): Use NaNd instead of NAN. + * modules/isnand-nolibm-tests (Files): Add tests/nan.h. + + * tests/test-frexp.c: Include nan.h. + (main): Use NaNd instead of NAN. + * modules/frexp-tests (Files): Add tests/nan.h. + + * lib/isnan.c: Don't include <math.h>. + (FUNC): Don't use NAN macro. + * modules/isnand-nolibm (Depends-on): Remove math. + * modules/isnanf-nolibm (Depends-on): Remove math. + * modules/isnanl (Depends-on): Remove math. + * modules/isnanl-nolibm (Depends-on): Remove math. + + * tests/nan.h: New file. + 2008-04-01 Eric Blake <ebb9@byu.net> Fix typos.
--- a/lib/isnan.c +++ b/lib/isnan.c @@ -19,7 +19,6 @@ #include <config.h> #include <float.h> -#include <math.h> #include <string.h> #include "float+.h" @@ -112,10 +111,11 @@ also fails when constant-folding 0.0 / 0.0 even when constant-folding is not required. The SGI MIPSpro C compiler complains about "floating-point operation result is out of range". */ + static DOUBLE zero = L_(0.0); memory_double nan; DOUBLE plus_inf = L_(1.0) / L_(0.0); DOUBLE minus_inf = -L_(1.0) / L_(0.0); - nan.value = NAN; + nan.value = zero / zero; # else static memory_double nan = { L_(0.0) / L_(0.0) }; static DOUBLE plus_inf = L_(1.0) / L_(0.0);
--- a/modules/ceilf-tests +++ b/modules/ceilf-tests @@ -1,6 +1,7 @@ Files: tests/test-ceilf1.c tests/test-ceilf2.c +tests/nan.h Depends-on: float
--- a/modules/floorf-tests +++ b/modules/floorf-tests @@ -1,6 +1,7 @@ Files: tests/test-floorf1.c tests/test-floorf2.c +tests/nan.h Depends-on: float
--- a/modules/frexp-tests +++ b/modules/frexp-tests @@ -1,5 +1,6 @@ Files: tests/test-frexp.c +tests/nan.h Depends-on: isnand-nolibm
--- a/modules/isnand-nolibm +++ b/modules/isnand-nolibm @@ -10,7 +10,6 @@ Depends-on: fpieee -math configure.ac: gl_FUNC_ISNAND_NO_LIBM
--- a/modules/isnand-nolibm-tests +++ b/modules/isnand-nolibm-tests @@ -1,5 +1,6 @@ Files: tests/test-isnand.c +tests/nan.h Depends-on:
--- a/modules/isnanf-nolibm +++ b/modules/isnanf-nolibm @@ -10,7 +10,6 @@ Depends-on: fpieee -math configure.ac: gl_FUNC_ISNANF_NO_LIBM
--- a/modules/isnanf-nolibm-tests +++ b/modules/isnanf-nolibm-tests @@ -1,5 +1,6 @@ Files: tests/test-isnanf.c +tests/nan.h Depends-on:
--- a/modules/isnanl +++ b/modules/isnanl @@ -11,7 +11,6 @@ Depends-on: float fpieee -math configure.ac: gl_FUNC_ISNANL
--- a/modules/isnanl-nolibm +++ b/modules/isnanl-nolibm @@ -11,7 +11,6 @@ Depends-on: float fpieee -math configure.ac: gl_FUNC_ISNANL_NO_LIBM
--- a/modules/round-tests +++ b/modules/round-tests @@ -1,6 +1,7 @@ Files: tests/test-round1.c tests/test-round2.c +tests/nan.h Depends-on: isnand-nolibm
--- a/modules/roundf-tests +++ b/modules/roundf-tests @@ -2,6 +2,7 @@ tests/test-roundf1.c tests/test-round2.c tests/test-roundf2.c +tests/nan.h Depends-on: ceilf
--- a/modules/snprintf-posix-tests +++ b/modules/snprintf-posix-tests @@ -2,9 +2,9 @@ tests/test-snprintf-posix.c tests/test-snprintf-posix.h tests/test-snprintf.c +tests/nan.h Depends-on: -math stdint configure.ac:
--- a/modules/sprintf-posix-tests +++ b/modules/sprintf-posix-tests @@ -1,9 +1,9 @@ Files: tests/test-sprintf-posix.c tests/test-sprintf-posix.h +tests/nan.h Depends-on: -math stdint configure.ac:
--- a/modules/trunc-tests +++ b/modules/trunc-tests @@ -1,6 +1,7 @@ Files: tests/test-trunc1.c tests/test-trunc2.c +tests/nan.h Depends-on: float
--- a/modules/truncf-tests +++ b/modules/truncf-tests @@ -1,6 +1,7 @@ Files: tests/test-truncf1.c tests/test-truncf2.c +tests/nan.h Depends-on: float
--- a/modules/vasnprintf-posix-tests +++ b/modules/vasnprintf-posix-tests @@ -2,10 +2,10 @@ tests/test-vasnprintf-posix.c tests/test-vasnprintf-posix2.sh tests/test-vasnprintf-posix2.c +tests/nan.h m4/locale-fr.m4 Depends-on: -math stdint configure.ac:
--- a/modules/vasprintf-posix-tests +++ b/modules/vasprintf-posix-tests @@ -1,8 +1,8 @@ Files: tests/test-vasprintf-posix.c +tests/nan.h Depends-on: -math stdint configure.ac:
--- a/modules/vsnprintf-posix-tests +++ b/modules/vsnprintf-posix-tests @@ -2,9 +2,9 @@ tests/test-vsnprintf-posix.c tests/test-snprintf-posix.h tests/test-vsnprintf.c +tests/nan.h Depends-on: -math stdint configure.ac:
--- a/modules/vsprintf-posix-tests +++ b/modules/vsprintf-posix-tests @@ -1,9 +1,9 @@ Files: tests/test-vsprintf-posix.c tests/test-sprintf-posix.h +tests/nan.h Depends-on: -math stdint configure.ac:
new file mode 100644 --- /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)
--- 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 @@ 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; }
--- 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 @@ 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; }
--- 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 @@ { /* NaN. */ int exp = -9999; double mantissa; - x = NAN; + x = NaNd (); mantissa = frexp (x, &exp); ASSERT (isnand (mantissa)); }
--- 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 @@ 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 @@ ((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
--- 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 @@ 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 @@ ((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
--- 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 () {
--- 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 @@ 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; }
--- 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 @@ 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; }
--- 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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);
--- 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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);
--- 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 @@ 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; }
--- 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 @@ 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; }
--- 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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)
--- 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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 @@ { /* 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 @@ { /* 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 @@ } { /* 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 @@ } { /* 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)