[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strtod bugs
From: |
Bruno Haible |
Subject: |
Re: strtod bugs |
Date: |
Wed, 2 Apr 2008 03:05:30 +0200 |
User-agent: |
KMail/1.5.4 |
Eric Blake wrote:
> So I'm patching
> math.in.h to guarantee NAN, borrowing from test-ceilf1.c.
While I like that you collected the many instances of the function which
returns a NaN into a single place, I don't like two things here:
1) POSIX says that <math.h> defines the macro NAN, but also says that it
expands into a constant expression. We cannot guarantee that. Therefore
is it better to define the macro or not?
For comparison, if a platform does not have 64-bit integers, we don't
define int64_t to int32_t; rather we leave it undefined.
2) You make use of this macro also where a 'double' or 'long double' NaN
is expected. We have enough portability problems with 'double' and
'long double' alone; I'm not inclined to also get trapped by possible
bugs in the conversion from float NaN to 'long double' NaN.
I'm going backward on #2, introducing new functions NaNf(), NaNd(), NaNl()
in a private header file. I also keep the parentheses, because without
parentheses one is too tempted to write
static double x = NaNd;
which would be invalid code on the platforms with the DEC compiler.
> Also, for new enough gcc, should we use __builtin_nan("")?
What would this be good for? gcc does a constant-expression folding of
0.0 / 0.0. So what's the point?
Bruno
2008-04-01 Bruno Haible <address@hidden>
* 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.
========================== tests/nan.h ===================================
/* 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)
===============================================================================
*** lib/isnan.c.orig 2008-04-02 02:45:12.000000000 +0200
--- lib/isnan.c 2008-04-02 01:05:39.000000000 +0200
***************
*** 19,25 ****
#include <config.h>
#include <float.h>
- #include <math.h>
#include <string.h>
#include "float+.h"
--- 19,24 ----
***************
*** 112,121 ****
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". */
memory_double nan;
DOUBLE plus_inf = L_(1.0) / L_(0.0);
DOUBLE minus_inf = -L_(1.0) / L_(0.0);
! nan.value = NAN;
# else
static memory_double nan = { L_(0.0) / L_(0.0) };
static DOUBLE plus_inf = L_(1.0) / L_(0.0);
--- 111,121 ----
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 = zero / zero;
# else
static memory_double nan = { L_(0.0) / L_(0.0) };
static DOUBLE plus_inf = L_(1.0) / L_(0.0);
*** modules/ceilf-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/ceilf-tests 2008-04-02 01:49:10.000000000 +0200
***************
*** 1,6 ****
--- 1,7 ----
Files:
tests/test-ceilf1.c
tests/test-ceilf2.c
+ tests/nan.h
Depends-on:
float
*** modules/floorf-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/floorf-tests 2008-04-02 01:49:13.000000000 +0200
***************
*** 1,6 ****
--- 1,7 ----
Files:
tests/test-floorf1.c
tests/test-floorf2.c
+ tests/nan.h
Depends-on:
float
*** modules/frexp-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/frexp-tests 2008-04-02 01:49:16.000000000 +0200
***************
*** 1,5 ****
--- 1,6 ----
Files:
tests/test-frexp.c
+ tests/nan.h
Depends-on:
isnand-nolibm
*** modules/isnand-nolibm.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/isnand-nolibm 2008-04-02 01:06:05.000000000 +0200
***************
*** 10,16 ****
Depends-on:
fpieee
- math
configure.ac:
gl_FUNC_ISNAND_NO_LIBM
--- 10,15 ----
*** modules/isnand-nolibm-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/isnand-nolibm-tests 2008-04-02 01:49:19.000000000 +0200
***************
*** 1,5 ****
--- 1,6 ----
Files:
tests/test-isnand.c
+ tests/nan.h
Depends-on:
*** modules/isnanf-nolibm.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/isnanf-nolibm 2008-04-02 01:06:14.000000000 +0200
***************
*** 10,16 ****
Depends-on:
fpieee
- math
configure.ac:
gl_FUNC_ISNANF_NO_LIBM
--- 10,15 ----
*** modules/isnanf-nolibm-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/isnanf-nolibm-tests 2008-04-02 01:49:22.000000000 +0200
***************
*** 1,5 ****
--- 1,6 ----
Files:
tests/test-isnanf.c
+ tests/nan.h
Depends-on:
*** modules/isnanl.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/isnanl 2008-04-02 01:06:19.000000000 +0200
***************
*** 11,17 ****
Depends-on:
float
fpieee
- math
configure.ac:
gl_FUNC_ISNANL
--- 11,16 ----
*** modules/isnanl-nolibm.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/isnanl-nolibm 2008-04-02 01:06:22.000000000 +0200
***************
*** 11,17 ****
Depends-on:
float
fpieee
- math
configure.ac:
gl_FUNC_ISNANL_NO_LIBM
--- 11,16 ----
*** modules/round-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/round-tests 2008-04-02 01:49:25.000000000 +0200
***************
*** 1,6 ****
--- 1,7 ----
Files:
tests/test-round1.c
tests/test-round2.c
+ tests/nan.h
Depends-on:
isnand-nolibm
*** modules/roundf-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/roundf-tests 2008-04-02 01:49:29.000000000 +0200
***************
*** 2,7 ****
--- 2,8 ----
tests/test-roundf1.c
tests/test-round2.c
tests/test-roundf2.c
+ tests/nan.h
Depends-on:
ceilf
*** modules/snprintf-posix-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/snprintf-posix-tests 2008-04-02 01:49:31.000000000 +0200
***************
*** 2,10 ****
tests/test-snprintf-posix.c
tests/test-snprintf-posix.h
tests/test-snprintf.c
Depends-on:
- math
stdint
configure.ac:
--- 2,10 ----
tests/test-snprintf-posix.c
tests/test-snprintf-posix.h
tests/test-snprintf.c
+ tests/nan.h
Depends-on:
stdint
configure.ac:
*** modules/sprintf-posix-tests.orig 2008-04-02 02:45:12.000000000 +0200
--- modules/sprintf-posix-tests 2008-04-02 01:49:34.000000000 +0200
***************
*** 1,9 ****
Files:
tests/test-sprintf-posix.c
tests/test-sprintf-posix.h
Depends-on:
- math
stdint
configure.ac:
--- 1,9 ----
Files:
tests/test-sprintf-posix.c
tests/test-sprintf-posix.h
+ tests/nan.h
Depends-on:
stdint
configure.ac:
*** modules/trunc-tests.orig 2008-04-02 02:45:13.000000000 +0200
--- modules/trunc-tests 2008-04-02 01:49:37.000000000 +0200
***************
*** 1,6 ****
--- 1,7 ----
Files:
tests/test-trunc1.c
tests/test-trunc2.c
+ tests/nan.h
Depends-on:
float
*** modules/truncf-tests.orig 2008-04-02 02:45:13.000000000 +0200
--- modules/truncf-tests 2008-04-02 01:49:40.000000000 +0200
***************
*** 1,6 ****
--- 1,7 ----
Files:
tests/test-truncf1.c
tests/test-truncf2.c
+ tests/nan.h
Depends-on:
float
*** modules/vasnprintf-posix-tests.orig 2008-04-02 02:45:13.000000000 +0200
--- modules/vasnprintf-posix-tests 2008-04-02 01:49:48.000000000 +0200
***************
*** 2,11 ****
tests/test-vasnprintf-posix.c
tests/test-vasnprintf-posix2.sh
tests/test-vasnprintf-posix2.c
m4/locale-fr.m4
Depends-on:
- math
stdint
configure.ac:
--- 2,11 ----
tests/test-vasnprintf-posix.c
tests/test-vasnprintf-posix2.sh
tests/test-vasnprintf-posix2.c
+ tests/nan.h
m4/locale-fr.m4
Depends-on:
stdint
configure.ac:
*** modules/vasprintf-posix-tests.orig 2008-04-02 02:45:13.000000000 +0200
--- modules/vasprintf-posix-tests 2008-04-02 01:49:51.000000000 +0200
***************
*** 1,8 ****
Files:
tests/test-vasprintf-posix.c
Depends-on:
- math
stdint
configure.ac:
--- 1,8 ----
Files:
tests/test-vasprintf-posix.c
+ tests/nan.h
Depends-on:
stdint
configure.ac:
*** modules/vsnprintf-posix-tests.orig 2008-04-02 02:45:13.000000000 +0200
--- modules/vsnprintf-posix-tests 2008-04-02 01:49:55.000000000 +0200
***************
*** 2,10 ****
tests/test-vsnprintf-posix.c
tests/test-snprintf-posix.h
tests/test-vsnprintf.c
Depends-on:
- math
stdint
configure.ac:
--- 2,10 ----
tests/test-vsnprintf-posix.c
tests/test-snprintf-posix.h
tests/test-vsnprintf.c
+ tests/nan.h
Depends-on:
stdint
configure.ac:
*** modules/vsprintf-posix-tests.orig 2008-04-02 02:45:13.000000000 +0200
--- modules/vsprintf-posix-tests 2008-04-02 01:49:58.000000000 +0200
***************
*** 1,9 ****
Files:
tests/test-vsprintf-posix.c
tests/test-sprintf-posix.h
Depends-on:
- math
stdint
configure.ac:
--- 1,9 ----
Files:
tests/test-vsprintf-posix.c
tests/test-sprintf-posix.h
+ tests/nan.h
Depends-on:
stdint
configure.ac:
*** tests/test-ceilf1.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-ceilf1.c 2008-04-02 01:59:50.000000000 +0200
***************
*** 1,5 ****
/* Test of rounding towards positive infinity.
! 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
--- 1,5 ----
/* Test of rounding towards positive infinity.
! 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,29 ****
--- 24,30 ----
#include <stdlib.h>
#include "isnanf.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 67,73 ****
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)));
return 0;
}
--- 68,74 ----
ASSERT (ceilf (1.0f / 0.0f) == 1.0f / 0.0f);
ASSERT (ceilf (-1.0f / 0.0f) == -1.0f / 0.0f);
/* NaNs. */
! ASSERT (isnanf (ceilf (NaNf ())));
return 0;
}
*** tests/test-floorf1.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-floorf1.c 2008-04-02 01:59:55.000000000 +0200
***************
*** 1,5 ****
/* Test of rounding towards negative infinity.
! 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
--- 1,5 ----
/* Test of rounding towards negative infinity.
! 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,29 ****
--- 24,30 ----
#include <stdlib.h>
#include "isnanf.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 67,73 ****
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)));
return 0;
}
--- 68,74 ----
ASSERT (floorf (1.0f / 0.0f) == 1.0f / 0.0f);
ASSERT (floorf (-1.0f / 0.0f) == -1.0f / 0.0f);
/* NaNs. */
! ASSERT (isnanf (floorf (NaNf ())));
return 0;
}
*** tests/test-frexp.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-frexp.c 2008-04-02 02:00:49.000000000 +0200
***************
*** 25,30 ****
--- 25,31 ----
#include <stdlib.h>
#include "isnand.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 61,67 ****
{ /* NaN. */
int exp = -9999;
double mantissa;
! x = NAN;
mantissa = frexp (x, &exp);
ASSERT (isnand (mantissa));
}
--- 62,68 ----
{ /* NaN. */
int exp = -9999;
double mantissa;
! x = NaNd ();
mantissa = frexp (x, &exp);
ASSERT (isnand (mantissa));
}
*** tests/test-isnand.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-isnand.c 2008-04-02 02:00:54.000000000 +0200
***************
*** 21,30 ****
#include "isnand.h"
#include <limits.h>
- #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define ASSERT(expr) \
do \
{ \
--- 21,31 ----
#include "isnand.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+ #include "nan.h"
+
#define ASSERT(expr) \
do \
{ \
***************
*** 52,58 ****
ASSERT (!isnand (1.0 / 0.0));
ASSERT (!isnand (-1.0 / 0.0));
/* Quiet NaN. */
! ASSERT (isnand (NAN));
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
/* Signalling NaN. */
{
--- 53,59 ----
ASSERT (!isnand (1.0 / 0.0));
ASSERT (!isnand (-1.0 / 0.0));
/* Quiet NaN. */
! ASSERT (isnand (NaNd ()));
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
/* Signalling NaN. */
{
***************
*** 60,66 ****
((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;
# if DBL_EXPBIT0_BIT > 0
m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
# else
--- 61,67 ----
((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { double value; unsigned int word[NWORDS]; } memory_double;
memory_double m;
! m.value = NaNd ();
# if DBL_EXPBIT0_BIT > 0
m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
# else
*** tests/test-isnanf.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-isnanf.c 2008-04-02 02:00:17.000000000 +0200
***************
*** 1,5 ****
/* Test of isnanf() substitute.
! 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
--- 1,5 ----
/* Test of isnanf() substitute.
! 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,30 ****
#include "isnanf.h"
#include <limits.h>
- #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define ASSERT(expr) \
do \
{ \
--- 21,31 ----
#include "isnanf.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+ #include "nan.h"
+
#define ASSERT(expr) \
do \
{ \
***************
*** 52,58 ****
ASSERT (!isnanf (1.0f / 0.0f));
ASSERT (!isnanf (-1.0f / 0.0f));
/* Quiet NaN. */
! ASSERT (isnanf (NAN));
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
/* Signalling NaN. */
{
--- 53,59 ----
ASSERT (!isnanf (1.0f / 0.0f));
ASSERT (!isnanf (-1.0f / 0.0f));
/* Quiet NaN. */
! ASSERT (isnanf (NaNf ()));
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
/* Signalling NaN. */
{
***************
*** 60,66 ****
((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;
# if FLT_EXPBIT0_BIT > 0
m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
# else
--- 61,67 ----
((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { float value; unsigned int word[NWORDS]; } memory_float;
memory_float m;
! m.value = NaNf ();
# if FLT_EXPBIT0_BIT > 0
m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1);
# else
*** tests/test-math.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-math.c 2008-04-02 01:14:20.000000000 +0200
***************
*** 25,30 ****
--- 25,35 ----
choke me
#endif
+ #if 0
+ /* Check that NAN expands into a constant expression. */
+ static float n = NAN;
+ #endif
+
int
main ()
{
*** tests/test-round1.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-round1.c 2008-04-02 02:00:58.000000000 +0200
***************
*** 26,31 ****
--- 26,32 ----
#include <stdlib.h>
#include "isnand.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 74,80 ****
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)));
return 0;
}
--- 75,81 ----
ASSERT (round (1.0 / 0.0) == 1.0 / 0.0);
ASSERT (round (-1.0 / 0.0) == -1.0 / 0.0);
/* NaNs. */
! ASSERT (isnand (round (NaNd ())));
return 0;
}
*** tests/test-roundf1.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-roundf1.c 2008-04-02 02:00:20.000000000 +0200
***************
*** 26,31 ****
--- 26,32 ----
#include <stdlib.h>
#include "isnanf.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 74,80 ****
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)));
return 0;
}
--- 75,81 ----
ASSERT (roundf (1.0 / 0.0f) == 1.0 / 0.0f);
ASSERT (roundf (-1.0 / 0.0f) == -1.0 / 0.0f);
/* NaNs. */
! ASSERT (isnanf (roundf (NaNf ())));
return 0;
}
*** tests/test-snprintf-posix.h.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-snprintf-posix.h 2008-04-02 01:27:14.000000000 +0200
***************
*** 16,22 ****
/* Written by Bruno Haible <address@hidden>, 2007. */
! #include <math.h>
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
--- 16,22 ----
/* Written by Bruno Haible <address@hidden>, 2007. */
! #include "nan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
***************
*** 197,203 ****
{ /* NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%a %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 197,203 ----
{ /* NaN. */
char result[100];
int retval =
! 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,400 ****
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%050a %d", NAN, 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
--- 394,400 ----
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,467 ****
{ /* NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%La %d", 0.0L / 0.0L, 33, 44,
55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 461,467 ----
{ /* NaN. */
char result[100];
int retval =
! 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,752 ****
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%050La %d", 0.0L / 0.0L, 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
--- 746,752 ----
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,914 ****
{ /* NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%f %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 908,914 ----
{ /* NaN. */
char result[100];
int retval =
! 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,995 ****
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%050f %d", NAN, 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 989,995 ----
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,1162 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%Lf %d", zero / zero, 33, 44,
55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1153,1161 ----
}
{ /* NaN. */
char result[100];
int retval =
! 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,1331 ****
}
{ /* 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);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1321,1329 ----
}
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,1410 ****
{ /* NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%F %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1402,1408 ----
{ /* NaN. */
char result[100];
int retval =
! 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,1505 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%LF %d", zero / zero, 33, 44,
55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1494,1502 ----
}
{ /* NaN. */
char result[100];
int retval =
! 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,1704 ****
{ /* NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%e %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1695,1701 ----
{ /* NaN. */
char result[100];
int retval =
! 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,1795 ****
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%050e %d", NAN, 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1786,1792 ----
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,1963 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%Le %d", zero / zero, 33, 44,
55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1951,1959 ----
}
{ /* NaN. */
char result[100];
int retval =
! 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,2134 ****
}
{ /* 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);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2121,2129 ----
}
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,2312 ****
{ /* NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%g %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2301,2307 ----
{ /* NaN. */
char result[100];
int retval =
! 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,2396 ****
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%050g %d", NAN, 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2385,2391 ----
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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,2564 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[100];
int retval =
! my_snprintf (result, sizeof (result), "%Lg %d", zero / zero, 33, 44,
55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2550,2558 ----
}
{ /* NaN. */
char result[100];
int retval =
! 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,2735 ****
}
{ /* 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);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2720,2728 ----
}
{ /* FLAG_ZERO with NaN. */
char result[100];
int retval =
! 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);
*** tests/test-sprintf-posix.h.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-sprintf-posix.h 2008-04-02 01:34:47.000000000 +0200
***************
*** 16,22 ****
/* Written by Bruno Haible <address@hidden>, 2007. */
! #include <math.h>
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
--- 16,22 ----
/* Written by Bruno Haible <address@hidden>, 2007. */
! #include "nan.h"
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
static int
***************
*** 183,189 ****
{ /* NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%a %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 183,189 ----
{ /* NaN. */
char result[1000];
int retval =
! 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,386 ****
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%050a %d", NAN, 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
--- 380,386 ----
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,453 ****
{ /* NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%La %d", 0.0L / 0.0L, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 447,453 ----
{ /* NaN. */
char result[1000];
int retval =
! 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,738 ****
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%050La %d", 0.0L / 0.0L, 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
--- 732,738 ----
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,900 ****
{ /* NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%f %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 894,900 ----
{ /* NaN. */
char result[1000];
int retval =
! 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,975 ****
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%050f %d", NAN, 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 969,975 ----
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,1142 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
! my_sprintf (result, "%Lf %d", zero / zero, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1133,1141 ----
}
{ /* NaN. */
char result[1000];
int retval =
! 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,1305 ****
}
{ /* 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);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1295,1303 ----
}
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,1384 ****
{ /* NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%F %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1376,1382 ----
{ /* NaN. */
char result[1000];
int retval =
! 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,1479 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
! my_sprintf (result, "%LF %d", zero / zero, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1468,1476 ----
}
{ /* NaN. */
char result[1000];
int retval =
! 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,1678 ****
{ /* NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%e %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1669,1675 ----
{ /* NaN. */
char result[1000];
int retval =
! 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,1769 ****
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%050e %d", NAN, 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1760,1766 ----
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,1937 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
! my_sprintf (result, "%Le %d", zero / zero, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 1925,1933 ----
}
{ /* NaN. */
char result[1000];
int retval =
! 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,2108 ****
}
{ /* 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);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2095,2103 ----
}
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,2286 ****
{ /* NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%g %d", NAN, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2275,2281 ----
{ /* NaN. */
char result[1000];
int retval =
! 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,2370 ****
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! my_sprintf (result, "%050g %d", NAN, 33, 44, 55);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2359,2365 ----
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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,2538 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char result[1000];
int retval =
! my_sprintf (result, "%Lg %d", zero / zero, 33, 44, 55);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2524,2532 ----
}
{ /* NaN. */
char result[1000];
int retval =
! 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,2709 ****
}
{ /* 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);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
&& strcmp (result + strlen (result) - 3, " 33") == 0);
--- 2694,2702 ----
}
{ /* FLAG_ZERO with NaN. */
char result[1000];
int retval =
! 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);
*** tests/test-trunc1.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-trunc1.c 2008-04-02 02:01:00.000000000 +0200
***************
*** 24,29 ****
--- 24,30 ----
#include <stdlib.h>
#include "isnand.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 66,72 ****
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)));
return 0;
}
--- 67,73 ----
ASSERT (trunc (1.0 / 0.0) == 1.0 / 0.0);
ASSERT (trunc (-1.0 / 0.0) == -1.0 / 0.0);
/* NaNs. */
! ASSERT (isnand (trunc (NaNd ())));
return 0;
}
*** tests/test-truncf1.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-truncf1.c 2008-04-02 02:00:22.000000000 +0200
***************
*** 1,5 ****
/* Test of rounding towards zero.
! 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
--- 1,5 ----
/* Test of rounding towards zero.
! 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,29 ****
--- 24,30 ----
#include <stdlib.h>
#include "isnanf.h"
+ #include "nan.h"
#define ASSERT(expr) \
do \
***************
*** 66,72 ****
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)));
return 0;
}
--- 67,73 ----
ASSERT (truncf (1.0f / 0.0f) == 1.0f / 0.0f);
ASSERT (truncf (-1.0f / 0.0f) == -1.0f / 0.0f);
/* NaNs. */
! ASSERT (isnanf (truncf (NaNf ())));
return 0;
}
*** tests/test-vasnprintf-posix.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-vasnprintf-posix.c 2008-04-02 01:37:24.000000000 +0200
***************
*** 21,27 ****
#include "vasnprintf.h"
#include <float.h>
- #include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
--- 21,26 ----
***************
*** 29,34 ****
--- 28,35 ----
#include <stdlib.h>
#include <string.h>
+ #include "nan.h"
+
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
#define ASSERT(expr) \
do \
***************
*** 246,252 ****
{ /* NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%a %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 247,253 ----
{ /* NaN. */
size_t length;
char *result =
! 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,485 ****
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%050a %d", NAN, 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> */
--- 480,486 ----
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,566 ****
{ /* NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%La %d", 0.0L / 0.0L, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 561,567 ----
{ /* NaN. */
size_t length;
char *result =
! 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,901 ****
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%050La %d", 0.0L / 0.0L, 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> */
--- 896,902 ----
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,1081 ****
{ /* NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%f %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 1076,1082 ----
{ /* NaN. */
size_t length;
char *result =
! 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,1174 ****
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%050f %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 1169,1175 ----
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,1361 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%Lf %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 1353,1361 ----
}
{ /* NaN. */
size_t length;
char *result =
! 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,1556 ****
}
{ /* 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);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 1547,1555 ----
}
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,1653 ****
{ /* NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%F %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
--- 1646,1652 ----
{ /* NaN. */
size_t length;
char *result =
! 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,1770 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%LF %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
--- 1760,1768 ----
}
{ /* NaN. */
size_t length;
char *result =
! 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,1992 ****
{ /* NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%e %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 1984,1990 ----
{ /* NaN. */
size_t length;
char *result =
! 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,2103 ****
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%050e %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 2095,2101 ----
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,2291 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%Le %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 2280,2288 ----
}
{ /* NaN. */
size_t length;
char *result =
! 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,2496 ****
}
{ /* 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);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 2484,2492 ----
}
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,2694 ****
{ /* NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%g %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 2684,2690 ----
{ /* NaN. */
size_t length;
char *result =
! 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,2798 ****
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%050g %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 2788,2794 ----
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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,2986 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
size_t length;
char *result =
! my_asnprintf (NULL, &length, "%Lg %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 2973,2981 ----
}
{ /* NaN. */
size_t length;
char *result =
! 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,3191 ****
}
{ /* 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);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 3177,3185 ----
}
{ /* FLAG_ZERO with NaN. */
size_t length;
char *result =
! 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)
*** tests/test-vasprintf-posix.c.orig 2008-04-02 02:45:13.000000000 +0200
--- tests/test-vasprintf-posix.c 2008-04-02 01:37:55.000000000 +0200
***************
*** 21,27 ****
#include <stdio.h>
#include <float.h>
- #include <math.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
--- 21,26 ----
***************
*** 29,34 ****
--- 28,35 ----
#include <stdlib.h>
#include <string.h>
+ #include "nan.h"
+
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
#define ASSERT(expr) \
do \
***************
*** 227,233 ****
{ /* NaN. */
char *result;
int retval =
! my_asprintf (&result, "%a %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 228,234 ----
{ /* NaN. */
char *result;
int retval =
! 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,466 ****
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! my_asprintf (&result, "%050a %d", NAN, 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> */
--- 461,467 ----
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,547 ****
{ /* NaN. */
char *result;
int retval =
! my_asprintf (&result, "%La %d", 0.0L / 0.0L, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 542,548 ----
{ /* NaN. */
char *result;
int retval =
! 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,882 ****
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! my_asprintf (&result, "%050La %d", 0.0L / 0.0L, 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> */
--- 877,883 ----
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,1062 ****
{ /* NaN. */
char *result;
int retval =
! my_asprintf (&result, "%f %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 1057,1063 ----
{ /* NaN. */
char *result;
int retval =
! 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,1155 ****
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! my_asprintf (&result, "%050f %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 1150,1156 ----
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,1342 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%Lf %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 1334,1342 ----
}
{ /* NaN. */
char *result;
int retval =
! 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,1537 ****
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%050Lf %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 1528,1536 ----
}
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,1634 ****
{ /* NaN. */
char *result;
int retval =
! my_asprintf (&result, "%F %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
--- 1627,1633 ----
{ /* NaN. */
char *result;
int retval =
! 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,1751 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%LF %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 1)
--- 1741,1749 ----
}
{ /* NaN. */
char *result;
int retval =
! 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,1973 ****
{ /* NaN. */
char *result;
int retval =
! my_asprintf (&result, "%e %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 1965,1971 ----
{ /* NaN. */
char *result;
int retval =
! 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,2084 ****
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! my_asprintf (&result, "%050e %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 2076,2082 ----
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,2272 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%Le %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 2261,2269 ----
}
{ /* NaN. */
char *result;
int retval =
! 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,2477 ****
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%050Le %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 2465,2473 ----
}
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,2675 ****
{ /* NaN. */
char *result;
int retval =
! my_asprintf (&result, "%g %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 2665,2671 ----
{ /* NaN. */
char *result;
int retval =
! 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,2779 ****
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! my_asprintf (&result, "%050g %d", NAN, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 2769,2775 ----
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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,2967 ****
}
{ /* NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%Lg %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) >= 3 + 3
&& strisnan (result, 0, strlen (result) - 3, 0)
--- 2954,2962 ----
}
{ /* NaN. */
char *result;
int retval =
! 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,3172 ****
}
{ /* FLAG_ZERO with NaN. */
- static long double zero = 0.0L;
char *result;
int retval =
! my_asprintf (&result, "%050Lg %d", zero / zero, 33, 44, 55);
ASSERT (result != NULL);
ASSERT (strlen (result) == 50 + 3
&& strisnan (result, strspn (result, " "), strlen (result) - 3, 0)
--- 3158,3166 ----
}
{ /* FLAG_ZERO with NaN. */
char *result;
int retval =
! 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)