mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
Support for MSVC compiler: Avoid division by a literal 0.
* lib/math.in.h (NAN): Define through a function call also on MSVC. * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Divide by 'zero' instead of 0.0. * m4/printf.m4 (gl_PRINTF_INFINITE, gl_PRINTF_DIRECTIVE_A, gl_PRINTF_DIRECTIVE_F, gl_PRINTF_FLAG_ZERO): Likewise. (gl_PRINTF_INFINITE_LONG_DOUBLE): Divide by 'zeroL' instead of 0.0L. * tests/infinity.h: New file. * tests/nan.h (NaNf, NaNd, NaNl): Define through a function call also on MSVC. * tests/test-ceilf1.c: Include infinity.h. (main): Use Infinityf. * tests/test-ceil1.c: Include infinity.h. (main): Use Infinityd. * tests/test-ceill.c: Include infinity.h. (main): Use Infinityl. * tests/test-dprintf-posix.c: Include infinity.h. (test_function): Use Infinityd. * tests/test-floorf1.c: Include infinity.h. (main): Use Infinityf. * tests/test-floor1.c: Include infinity.h. (main): Use Infinityd. * tests/test-floorl.c: Include infinity.h. (main): Use Infinityl. * tests/test-fprintf-posix.c: Include infinity.h. (test_function): Use Infinityd. * tests/test-frexp.c: Include infinity.h. (main): Use Infinityd. * tests/test-frexpl.c: Include infinity.h. (main): Use Infinityl. * tests/test-isfinite.c: Include infinity.h. (test_isfinitef): Use Infinityf. (test_isfinited): Use Infinityd. (test_isfinitel): Use Infinityl. * tests/test-isinf.c: Include infinity.h. (test_isinff): Use Infinityf. (test_isinfd): Use Infinityd. (test_isinfl): Use Infinityl. * tests/test-isnan.c: Include infinity.h. (test_float): Use Infinityf. (test_double): Use Infinityd. (test_long_double): Use Infinityl. * tests/test-isnanf.h: Include infinity.h. (main): Use Infinityf. * tests/test-isnand.h: Include infinity.h. (main): Use Infinityd. * tests/test-isnanl.h: Include infinity.h. (main): Use Infinityl. * tests/test-ldexpl.c: Include infinity.h. (main): Use Infinityl. * tests/test-printf-posix.h: Include infinity.h. (test_function): Use Infinityd. * tests/test-roundf1.c: Include infinity.h. (main): Use Infinityf. * tests/test-round1.c: Include infinity.h. (main): Use Infinityd. * tests/test-roundl.c: Include infinity.h. (main): Use Infinityl. * tests/test-signbit.c: Include infinity.h. (test_signbitf): Use Infinityf. (test_signbitd): Use Infinityd. (test_signbitl): Use Infinityl. * tests/test-snprintf-posix.h: Include infinity.h. (test_function): Use Infinityd, Infinityl. * tests/test-sprintf-posix.h: Include infinity.h. (test_function): Use Infinityd, Infinityl. * tests/test-truncf1.c: Include infinity.h. (main): Use Infinityf. * tests/test-trunc1.c: Include infinity.h. (main): Use Infinityd. * tests/test-truncl.c: Include infinity.h. (main): Use Infinityl. * tests/test-vasnprintf-posix.c: Include infinity.h. (test_function): Use Infinityd, Infinityl. * tests/test-vasprintf-posix.c: Include infinity.h. (test_function): Use Infinityd, Infinityl. * modules/ceilf-tests (Files): Add tests/infinity.h. * modules/ceil-tests (Files): Likewise. * modules/ceill-tests (Files): Likewise. * modules/dprintf-posix-tests (Files): Likewise. * modules/floorf-tests (Files): Likewise. * modules/floor-tests (Files): Likewise. * modules/floorl-tests (Files): Likewise. * modules/fprintf-posix-tests (Files): Likewise. * modules/frexp-tests (Files): Likewise. * modules/frexp-nolibm-tests (Files): Likewise. * modules/frexpl-tests (Files): Likewise. * modules/frexpl-nolibm-tests (Files): Likewise. * modules/isfinite-tests (Files): Likewise. * modules/isinf-tests (Files): Likewise. * modules/isnan-tests (Files): Likewise. * modules/isnanf-tests (Files): Likewise. * modules/isnanf-nolibm-tests (Files): Likewise. * modules/isnand-tests (Files): Likewise. * modules/isnand-nolibm-tests (Files): Likewise. * modules/isnanl-tests (Files): Likewise. * modules/isnanl-nolibm-tests (Files): Likewise. * modules/ldexpl-tests (Files): Likewise. * modules/printf-posix-tests (Files): Likewise. * modules/roundf-tests (Files): Likewise. * modules/round-tests (Files): Likewise. * modules/roundl-tests (Files): Likewise. * modules/signbit-tests (Files): Likewise. * modules/snprintf-posix-tests (Files): Likewise. * modules/sprintf-posix-tests (Files): Likewise. * modules/truncf-tests (Files): Likewise. * modules/trunc-tests (Files): Likewise. * modules/truncl-tests (Files): Likewise. * modules/vasnprintf-posix-tests (Files): Likewise. * modules/vasprintf-posix-tests (Files): Likewise. * modules/vdprintf-posix-tests (Files): Likewise. * modules/vfprintf-posix-tests (Files): Likewise. * modules/vprintf-posix-tests (Files): Likewise. * modules/vsnprintf-posix-tests (Files): Likewise. * modules/vsprintf-posix-tests (Files): Likewise. * modules/xprintf-posix-tests (Files): Likewise.
This commit is contained in:
118
ChangeLog
118
ChangeLog
@@ -1,3 +1,121 @@
|
|||||||
|
2011-09-11 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
|
Support for MSVC compiler: Avoid division by a literal 0.
|
||||||
|
* lib/math.in.h (NAN): Define through a function call also on MSVC.
|
||||||
|
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Divide by 'zero' instead of 0.0.
|
||||||
|
* m4/printf.m4 (gl_PRINTF_INFINITE, gl_PRINTF_DIRECTIVE_A,
|
||||||
|
gl_PRINTF_DIRECTIVE_F, gl_PRINTF_FLAG_ZERO): Likewise.
|
||||||
|
(gl_PRINTF_INFINITE_LONG_DOUBLE): Divide by 'zeroL' instead of 0.0L.
|
||||||
|
* tests/infinity.h: New file.
|
||||||
|
* tests/nan.h (NaNf, NaNd, NaNl): Define through a function call also
|
||||||
|
on MSVC.
|
||||||
|
* tests/test-ceilf1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityf.
|
||||||
|
* tests/test-ceil1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityd.
|
||||||
|
* tests/test-ceill.c: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-dprintf-posix.c: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd.
|
||||||
|
* tests/test-floorf1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityf.
|
||||||
|
* tests/test-floor1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityd.
|
||||||
|
* tests/test-floorl.c: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-fprintf-posix.c: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd.
|
||||||
|
* tests/test-frexp.c: Include infinity.h.
|
||||||
|
(main): Use Infinityd.
|
||||||
|
* tests/test-frexpl.c: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-isfinite.c: Include infinity.h.
|
||||||
|
(test_isfinitef): Use Infinityf.
|
||||||
|
(test_isfinited): Use Infinityd.
|
||||||
|
(test_isfinitel): Use Infinityl.
|
||||||
|
* tests/test-isinf.c: Include infinity.h.
|
||||||
|
(test_isinff): Use Infinityf.
|
||||||
|
(test_isinfd): Use Infinityd.
|
||||||
|
(test_isinfl): Use Infinityl.
|
||||||
|
* tests/test-isnan.c: Include infinity.h.
|
||||||
|
(test_float): Use Infinityf.
|
||||||
|
(test_double): Use Infinityd.
|
||||||
|
(test_long_double): Use Infinityl.
|
||||||
|
* tests/test-isnanf.h: Include infinity.h.
|
||||||
|
(main): Use Infinityf.
|
||||||
|
* tests/test-isnand.h: Include infinity.h.
|
||||||
|
(main): Use Infinityd.
|
||||||
|
* tests/test-isnanl.h: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-ldexpl.c: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-printf-posix.h: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd.
|
||||||
|
* tests/test-roundf1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityf.
|
||||||
|
* tests/test-round1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityd.
|
||||||
|
* tests/test-roundl.c: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-signbit.c: Include infinity.h.
|
||||||
|
(test_signbitf): Use Infinityf.
|
||||||
|
(test_signbitd): Use Infinityd.
|
||||||
|
(test_signbitl): Use Infinityl.
|
||||||
|
* tests/test-snprintf-posix.h: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd, Infinityl.
|
||||||
|
* tests/test-sprintf-posix.h: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd, Infinityl.
|
||||||
|
* tests/test-truncf1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityf.
|
||||||
|
* tests/test-trunc1.c: Include infinity.h.
|
||||||
|
(main): Use Infinityd.
|
||||||
|
* tests/test-truncl.c: Include infinity.h.
|
||||||
|
(main): Use Infinityl.
|
||||||
|
* tests/test-vasnprintf-posix.c: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd, Infinityl.
|
||||||
|
* tests/test-vasprintf-posix.c: Include infinity.h.
|
||||||
|
(test_function): Use Infinityd, Infinityl.
|
||||||
|
* modules/ceilf-tests (Files): Add tests/infinity.h.
|
||||||
|
* modules/ceil-tests (Files): Likewise.
|
||||||
|
* modules/ceill-tests (Files): Likewise.
|
||||||
|
* modules/dprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/floorf-tests (Files): Likewise.
|
||||||
|
* modules/floor-tests (Files): Likewise.
|
||||||
|
* modules/floorl-tests (Files): Likewise.
|
||||||
|
* modules/fprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/frexp-tests (Files): Likewise.
|
||||||
|
* modules/frexp-nolibm-tests (Files): Likewise.
|
||||||
|
* modules/frexpl-tests (Files): Likewise.
|
||||||
|
* modules/frexpl-nolibm-tests (Files): Likewise.
|
||||||
|
* modules/isfinite-tests (Files): Likewise.
|
||||||
|
* modules/isinf-tests (Files): Likewise.
|
||||||
|
* modules/isnan-tests (Files): Likewise.
|
||||||
|
* modules/isnanf-tests (Files): Likewise.
|
||||||
|
* modules/isnanf-nolibm-tests (Files): Likewise.
|
||||||
|
* modules/isnand-tests (Files): Likewise.
|
||||||
|
* modules/isnand-nolibm-tests (Files): Likewise.
|
||||||
|
* modules/isnanl-tests (Files): Likewise.
|
||||||
|
* modules/isnanl-nolibm-tests (Files): Likewise.
|
||||||
|
* modules/ldexpl-tests (Files): Likewise.
|
||||||
|
* modules/printf-posix-tests (Files): Likewise.
|
||||||
|
* modules/roundf-tests (Files): Likewise.
|
||||||
|
* modules/round-tests (Files): Likewise.
|
||||||
|
* modules/roundl-tests (Files): Likewise.
|
||||||
|
* modules/signbit-tests (Files): Likewise.
|
||||||
|
* modules/snprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/sprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/truncf-tests (Files): Likewise.
|
||||||
|
* modules/trunc-tests (Files): Likewise.
|
||||||
|
* modules/truncl-tests (Files): Likewise.
|
||||||
|
* modules/vasnprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/vasprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/vdprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/vfprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/vprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/vsnprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/vsprintf-posix-tests (Files): Likewise.
|
||||||
|
* modules/xprintf-posix-tests (Files): Likewise.
|
||||||
|
|
||||||
2011-09-11 Bruno Haible <bruno@clisp.org>
|
2011-09-11 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
Ensure pid_t gets defined.
|
Ensure pid_t gets defined.
|
||||||
|
@@ -75,8 +75,9 @@ _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
|
|||||||
#if !defined NAN || @REPLACE_NAN@
|
#if !defined NAN || @REPLACE_NAN@
|
||||||
# if !GNULIB_defined_NAN
|
# if !GNULIB_defined_NAN
|
||||||
# undef NAN
|
# undef NAN
|
||||||
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
|
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
|
||||||
# ifdef __DECC
|
choke on the expression 0.0 / 0.0. */
|
||||||
|
# if defined __DECC || defined _MSC_VER
|
||||||
static float
|
static float
|
||||||
_NaN ()
|
_NaN ()
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# frexp.m4 serial 11
|
# frexp.m4 serial 12
|
||||||
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
dnl gives unlimited permission to copy and/or distribute it,
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
@@ -133,7 +133,7 @@ int main()
|
|||||||
result |= 1;
|
result |= 1;
|
||||||
}
|
}
|
||||||
/* Test on infinite numbers. */
|
/* Test on infinite numbers. */
|
||||||
x = 1.0 / 0.0;
|
x = 1.0 / zero;
|
||||||
{
|
{
|
||||||
int exp;
|
int exp;
|
||||||
double y = frexp (x, &exp);
|
double y = frexp (x, &exp);
|
||||||
|
35
m4/printf.m4
35
m4/printf.m4
@@ -1,4 +1,4 @@
|
|||||||
# printf.m4 serial 44
|
# printf.m4 serial 45
|
||||||
dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
|
dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
dnl gives unlimited permission to copy and/or distribute it,
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
@@ -178,28 +178,28 @@ static double zero = 0.0;
|
|||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (sprintf (buf, "%f", 1.0 / 0.0) < 0
|
if (sprintf (buf, "%f", 1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%f", -1.0 / 0.0) < 0
|
if (sprintf (buf, "%f", -1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%f", zero / zero) < 0
|
if (sprintf (buf, "%f", zero / zero) < 0
|
||||||
|| !strisnan (buf, 0, strlen (buf)))
|
|| !strisnan (buf, 0, strlen (buf)))
|
||||||
result |= 2;
|
result |= 2;
|
||||||
if (sprintf (buf, "%e", 1.0 / 0.0) < 0
|
if (sprintf (buf, "%e", 1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
||||||
result |= 4;
|
result |= 4;
|
||||||
if (sprintf (buf, "%e", -1.0 / 0.0) < 0
|
if (sprintf (buf, "%e", -1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
||||||
result |= 4;
|
result |= 4;
|
||||||
if (sprintf (buf, "%e", zero / zero) < 0
|
if (sprintf (buf, "%e", zero / zero) < 0
|
||||||
|| !strisnan (buf, 0, strlen (buf)))
|
|| !strisnan (buf, 0, strlen (buf)))
|
||||||
result |= 8;
|
result |= 8;
|
||||||
if (sprintf (buf, "%g", 1.0 / 0.0) < 0
|
if (sprintf (buf, "%g", 1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
||||||
result |= 16;
|
result |= 16;
|
||||||
if (sprintf (buf, "%g", -1.0 / 0.0) < 0
|
if (sprintf (buf, "%g", -1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
||||||
result |= 16;
|
result |= 16;
|
||||||
if (sprintf (buf, "%g", zero / zero) < 0
|
if (sprintf (buf, "%g", zero / zero) < 0
|
||||||
@@ -294,28 +294,28 @@ int main ()
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
nocrash_init();
|
nocrash_init();
|
||||||
if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0
|
if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0
|
||||||
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0
|
if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0
|
||||||
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
|
if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
|
||||||
|| !strisnan (buf, 0, strlen (buf)))
|
|| !strisnan (buf, 0, strlen (buf)))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0
|
if (sprintf (buf, "%Le", 1.0L / zeroL) < 0
|
||||||
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0
|
if (sprintf (buf, "%Le", -1.0L / zeroL) < 0
|
||||||
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Le", zeroL / zeroL) < 0
|
if (sprintf (buf, "%Le", zeroL / zeroL) < 0
|
||||||
|| !strisnan (buf, 0, strlen (buf)))
|
|| !strisnan (buf, 0, strlen (buf)))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0
|
if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0
|
||||||
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
|| (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0
|
if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0
|
||||||
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
|| (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
|
if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
|
||||||
@@ -478,6 +478,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
static char buf[100];
|
static char buf[100];
|
||||||
|
static double zero = 0.0;
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -502,7 +503,7 @@ int main ()
|
|||||||
result |= 4;
|
result |= 4;
|
||||||
/* This catches a FreeBSD 6.1 bug. See
|
/* This catches a FreeBSD 6.1 bug. See
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0
|
if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
|
||||||
|| buf[0] == '0')
|
|| buf[0] == '0')
|
||||||
result |= 8;
|
result |= 8;
|
||||||
/* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */
|
/* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */
|
||||||
@@ -562,13 +563,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
static char buf[100];
|
static char buf[100];
|
||||||
|
static double zero = 0.0;
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
|
if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
|
||||||
|| strcmp (buf, "1234567.000000 33") != 0)
|
|| strcmp (buf, "1234567.000000 33") != 0)
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%F", 1.0 / 0.0) < 0
|
if (sprintf (buf, "%F", 1.0 / zero) < 0
|
||||||
|| (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
|
|| (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
|
||||||
result |= 2;
|
result |= 2;
|
||||||
/* This catches a Cygwin 1.5.x bug. */
|
/* This catches a Cygwin 1.5.x bug. */
|
||||||
@@ -878,9 +880,10 @@ AC_DEFUN([gl_PRINTF_FLAG_ZERO],
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
static char buf[100];
|
static char buf[100];
|
||||||
|
static double zero = 0.0;
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0
|
if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
|
||||||
|| (strcmp (buf, " inf") != 0
|
|| (strcmp (buf, " inf") != 0
|
||||||
&& strcmp (buf, " infinity") != 0))
|
&& strcmp (buf, " infinity") != 0))
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-ceil1.c
|
tests/test-ceil1.c
|
||||||
tests/test-ceil2.c
|
tests/test-ceil2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-ceilf1.c
|
tests/test-ceilf1.c
|
||||||
tests/test-ceilf2.c
|
tests/test-ceilf2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-ceill.c
|
tests/test-ceill.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -4,6 +4,7 @@ tests/test-dprintf-posix.c
|
|||||||
tests/test-printf-posix.output
|
tests/test-printf-posix.output
|
||||||
tests/test-dprintf-posix2.sh
|
tests/test-dprintf-posix2.sh
|
||||||
tests/test-dprintf-posix2.c
|
tests/test-dprintf-posix2.c
|
||||||
|
tests/infinity.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-floor1.c
|
tests/test-floor1.c
|
||||||
tests/test-floor2.c
|
tests/test-floor2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-floorf1.c
|
tests/test-floorf1.c
|
||||||
tests/test-floorf2.c
|
tests/test-floorf2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-floorl.c
|
tests/test-floorl.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -7,6 +7,7 @@ tests/test-fprintf-posix2.sh
|
|||||||
tests/test-fprintf-posix2.c
|
tests/test-fprintf-posix2.c
|
||||||
tests/test-fprintf-posix3.sh
|
tests/test-fprintf-posix3.sh
|
||||||
tests/test-fprintf-posix3.c
|
tests/test-fprintf-posix3.c
|
||||||
|
tests/infinity.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-frexp.c
|
tests/test-frexp.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-frexp.c
|
tests/test-frexp.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-frexpl.c
|
tests/test-frexpl.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-frexpl.c
|
tests/test-frexpl.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-isfinite.c
|
tests/test-isfinite.c
|
||||||
|
tests/infinity.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
Depends-on:
|
Depends-on:
|
||||||
|
@@ -3,6 +3,7 @@ m4/exponentf.m4
|
|||||||
m4/exponentd.m4
|
m4/exponentd.m4
|
||||||
m4/exponentl.m4
|
m4/exponentl.m4
|
||||||
tests/test-isinf.c
|
tests/test-isinf.c
|
||||||
|
tests/infinity.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
Depends-on:
|
Depends-on:
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-isnan.c
|
tests/test-isnan.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-isnand-nolibm.c
|
tests/test-isnand-nolibm.c
|
||||||
tests/test-isnand.h
|
tests/test-isnand.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-isnand.c
|
tests/test-isnand.c
|
||||||
tests/test-isnand.h
|
tests/test-isnand.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-isnanf-nolibm.c
|
tests/test-isnanf-nolibm.c
|
||||||
tests/test-isnanf.h
|
tests/test-isnanf.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-isnanf.c
|
tests/test-isnanf.c
|
||||||
tests/test-isnanf.h
|
tests/test-isnanf.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-isnanl-nolibm.c
|
tests/test-isnanl-nolibm.c
|
||||||
tests/test-isnanl.h
|
tests/test-isnanl.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-isnanl.c
|
tests/test-isnanl.c
|
||||||
tests/test-isnanl.h
|
tests/test-isnanl.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-ldexpl.c
|
tests/test-ldexpl.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -5,6 +5,7 @@ tests/test-printf-posix.h
|
|||||||
tests/test-printf-posix.output
|
tests/test-printf-posix.output
|
||||||
tests/test-printf-posix2.sh
|
tests/test-printf-posix2.sh
|
||||||
tests/test-printf-posix2.c
|
tests/test-printf-posix2.c
|
||||||
|
tests/infinity.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-round1.c
|
tests/test-round1.c
|
||||||
tests/test-round2.c
|
tests/test-round2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -3,6 +3,7 @@ tests/test-roundf1.c
|
|||||||
tests/test-round2.c
|
tests/test-round2.c
|
||||||
tests/test-roundf2.c
|
tests/test-roundf2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-roundl.c
|
tests/test-roundl.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-signbit.c
|
tests/test-signbit.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
m4/exponentf.m4
|
m4/exponentf.m4
|
||||||
m4/exponentd.m4
|
m4/exponentd.m4
|
||||||
|
@@ -3,6 +3,7 @@ tests/test-snprintf-posix.c
|
|||||||
tests/test-snprintf-posix.h
|
tests/test-snprintf-posix.h
|
||||||
tests/test-snprintf.c
|
tests/test-snprintf.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-sprintf-posix.c
|
tests/test-sprintf-posix.c
|
||||||
tests/test-sprintf-posix.h
|
tests/test-sprintf-posix.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-trunc1.c
|
tests/test-trunc1.c
|
||||||
tests/test-trunc2.c
|
tests/test-trunc2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-truncf1.c
|
tests/test-truncf1.c
|
||||||
tests/test-truncf2.c
|
tests/test-truncf2.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-truncl.c
|
tests/test-truncl.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -4,6 +4,7 @@ tests/test-vasnprintf-posix2.sh
|
|||||||
tests/test-vasnprintf-posix2.c
|
tests/test-vasnprintf-posix2.c
|
||||||
tests/test-vasnprintf-posix3.c
|
tests/test-vasnprintf-posix3.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
m4/locale-fr.m4
|
m4/locale-fr.m4
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
Files:
|
Files:
|
||||||
tests/test-vasprintf-posix.c
|
tests/test-vasprintf-posix.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ tests/test-vdprintf-posix.sh
|
|||||||
tests/test-vdprintf-posix.c
|
tests/test-vdprintf-posix.c
|
||||||
tests/test-fprintf-posix.h
|
tests/test-fprintf-posix.h
|
||||||
tests/test-printf-posix.output
|
tests/test-printf-posix.output
|
||||||
|
tests/infinity.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ tests/test-vfprintf-posix.sh
|
|||||||
tests/test-vfprintf-posix.c
|
tests/test-vfprintf-posix.c
|
||||||
tests/test-fprintf-posix.h
|
tests/test-fprintf-posix.h
|
||||||
tests/test-printf-posix.output
|
tests/test-printf-posix.output
|
||||||
|
tests/infinity.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ tests/test-vprintf-posix.sh
|
|||||||
tests/test-vprintf-posix.c
|
tests/test-vprintf-posix.c
|
||||||
tests/test-printf-posix.h
|
tests/test-printf-posix.h
|
||||||
tests/test-printf-posix.output
|
tests/test-printf-posix.output
|
||||||
|
tests/infinity.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ tests/test-vsnprintf-posix.c
|
|||||||
tests/test-snprintf-posix.h
|
tests/test-snprintf-posix.h
|
||||||
tests/test-vsnprintf.c
|
tests/test-vsnprintf.c
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -2,6 +2,7 @@ Files:
|
|||||||
tests/test-vsprintf-posix.c
|
tests/test-vsprintf-posix.c
|
||||||
tests/test-sprintf-posix.h
|
tests/test-sprintf-posix.h
|
||||||
tests/minus-zero.h
|
tests/minus-zero.h
|
||||||
|
tests/infinity.h
|
||||||
tests/nan.h
|
tests/nan.h
|
||||||
tests/signature.h
|
tests/signature.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
@@ -5,6 +5,7 @@ tests/test-xprintf-posix.c
|
|||||||
tests/test-fprintf-posix.h
|
tests/test-fprintf-posix.h
|
||||||
tests/test-printf-posix.h
|
tests/test-printf-posix.h
|
||||||
tests/test-printf-posix.output
|
tests/test-printf-posix.output
|
||||||
|
tests/infinity.h
|
||||||
tests/macros.h
|
tests/macros.h
|
||||||
|
|
||||||
Depends-on:
|
Depends-on:
|
||||||
|
60
tests/infinity.h
Normal file
60
tests/infinity.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/* Macros for infinity.
|
||||||
|
Copyright (C) 2011 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/>. */
|
||||||
|
|
||||||
|
|
||||||
|
/* Infinityf () returns a 'float' +Infinity. */
|
||||||
|
|
||||||
|
/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. */
|
||||||
|
#if defined _MSC_VER
|
||||||
|
static float
|
||||||
|
Infinityf ()
|
||||||
|
{
|
||||||
|
static float zero = 0.0f;
|
||||||
|
return 1.0f / zero;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define Infinityf() (1.0f / 0.0f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Infinityd () returns a 'double' +Infinity. */
|
||||||
|
|
||||||
|
/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. */
|
||||||
|
#if defined _MSC_VER
|
||||||
|
static double
|
||||||
|
Infinityd ()
|
||||||
|
{
|
||||||
|
static double zero = 0.0;
|
||||||
|
return 1.0 / zero;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define Infinityd() (1.0 / 0.0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Infinityl () returns a 'long double' +Infinity. */
|
||||||
|
|
||||||
|
/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. */
|
||||||
|
#if defined _MSC_VER
|
||||||
|
static double
|
||||||
|
Infinityl ()
|
||||||
|
{
|
||||||
|
static long double zero = 0.0L;
|
||||||
|
return 1.0L / zero;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define Infinityl() (1.0L / 0.0L)
|
||||||
|
#endif
|
20
tests/nan.h
20
tests/nan.h
@@ -17,8 +17,9 @@
|
|||||||
|
|
||||||
/* NaNf () returns a 'float' not-a-number. */
|
/* NaNf () returns a 'float' not-a-number. */
|
||||||
|
|
||||||
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
|
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
|
||||||
#ifdef __DECC
|
on the expression 0.0 / 0.0. */
|
||||||
|
#if defined __DECC || defined _MSC_VER
|
||||||
static float
|
static float
|
||||||
NaNf ()
|
NaNf ()
|
||||||
{
|
{
|
||||||
@@ -32,8 +33,9 @@ NaNf ()
|
|||||||
|
|
||||||
/* NaNd () returns a 'double' not-a-number. */
|
/* NaNd () returns a 'double' not-a-number. */
|
||||||
|
|
||||||
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
|
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
|
||||||
#ifdef __DECC
|
on the expression 0.0 / 0.0. */
|
||||||
|
#if defined __DECC || defined _MSC_VER
|
||||||
static double
|
static double
|
||||||
NaNd ()
|
NaNd ()
|
||||||
{
|
{
|
||||||
@@ -48,13 +50,21 @@ NaNd ()
|
|||||||
/* NaNl () returns a 'long double' not-a-number. */
|
/* NaNl () returns a 'long double' not-a-number. */
|
||||||
|
|
||||||
/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
|
/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
|
||||||
runtime type conversion. */
|
runtime type conversion.
|
||||||
|
The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L. */
|
||||||
#ifdef __sgi
|
#ifdef __sgi
|
||||||
static long double NaNl ()
|
static long double NaNl ()
|
||||||
{
|
{
|
||||||
double zero = 0.0;
|
double zero = 0.0;
|
||||||
return zero / zero;
|
return zero / zero;
|
||||||
}
|
}
|
||||||
|
#elif defined _MSC_VER
|
||||||
|
static long double
|
||||||
|
NaNl ()
|
||||||
|
{
|
||||||
|
static long double zero = 0.0L;
|
||||||
|
return zero / zero;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
# define NaNl() (0.0L / 0.0L)
|
# define NaNl() (0.0L / 0.0L)
|
||||||
#endif
|
#endif
|
||||||
|
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (ceil, double, (double));
|
|||||||
|
|
||||||
#include "isnand-nolibm.h"
|
#include "isnand-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -58,8 +59,8 @@ main ()
|
|||||||
ASSERT (ceil (-65536.0) == -65536.0);
|
ASSERT (ceil (-65536.0) == -65536.0);
|
||||||
ASSERT (ceil (-2.341e31) == -2.341e31);
|
ASSERT (ceil (-2.341e31) == -2.341e31);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (ceil (1.0 / 0.0) == 1.0 / 0.0);
|
ASSERT (ceil (Infinityd ()) == Infinityd ());
|
||||||
ASSERT (ceil (-1.0 / 0.0) == -1.0 / 0.0);
|
ASSERT (ceil (- Infinityd ()) == - Infinityd ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnand (ceil (NaNd ())));
|
ASSERT (isnand (ceil (NaNd ())));
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ SIGNATURE_CHECK (ceilf, float, (float));
|
|||||||
|
|
||||||
#include "isnanf-nolibm.h"
|
#include "isnanf-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -69,8 +70,8 @@ main (int argc, char **argv _GL_UNUSED)
|
|||||||
ASSERT (my_ceilf (-65536.0f) == -65536.0f);
|
ASSERT (my_ceilf (-65536.0f) == -65536.0f);
|
||||||
ASSERT (my_ceilf (-2.341e31f) == -2.341e31f);
|
ASSERT (my_ceilf (-2.341e31f) == -2.341e31f);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (my_ceilf (1.0f / 0.0f) == 1.0f / 0.0f);
|
ASSERT (my_ceilf (Infinityf ()) == Infinityf ());
|
||||||
ASSERT (my_ceilf (-1.0f / 0.0f) == -1.0f / 0.0f);
|
ASSERT (my_ceilf (- Infinityf ()) == - Infinityf ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanf (my_ceilf (NaNf ())));
|
ASSERT (isnanf (my_ceilf (NaNf ())));
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ SIGNATURE_CHECK (ceill, long double, (long double));
|
|||||||
#include "fpucw.h"
|
#include "fpucw.h"
|
||||||
#include "isnanl-nolibm.h"
|
#include "isnanl-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -63,8 +64,8 @@ main ()
|
|||||||
ASSERT (ceill (-65536.0L) == -65536.0L);
|
ASSERT (ceill (-65536.0L) == -65536.0L);
|
||||||
ASSERT (ceill (-2.341e31L) == -2.341e31L);
|
ASSERT (ceill (-2.341e31L) == -2.341e31L);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (ceill (1.0L / 0.0L) == 1.0L / 0.0L);
|
ASSERT (ceill (Infinityl ()) == Infinityl ());
|
||||||
ASSERT (ceill (-1.0L / 0.0L) == -1.0L / 0.0L);
|
ASSERT (ceill (- Infinityl ()) == - Infinityl ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanl (ceill (NaNl ())));
|
ASSERT (isnanl (ceill (NaNl ())));
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (dprintf, int, (int, const char *, ...));
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "infinity.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -50,13 +51,13 @@ test_function (int (*my_dprintf) (int, const char *, ...))
|
|||||||
my_dprintf (fileno (stdout), "%a %d\n", 0.0, 33, 44, 55);
|
my_dprintf (fileno (stdout), "%a %d\n", 0.0, 33, 44, 55);
|
||||||
|
|
||||||
/* Positive infinity. */
|
/* Positive infinity. */
|
||||||
my_dprintf (fileno (stdout), "%a %d\n", 1.0 / 0.0, 33, 44, 55);
|
my_dprintf (fileno (stdout), "%a %d\n", Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* Negative infinity. */
|
/* Negative infinity. */
|
||||||
my_dprintf (fileno (stdout), "%a %d\n", -1.0 / 0.0, 33, 44, 55);
|
my_dprintf (fileno (stdout), "%a %d\n", - Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* FLAG_ZERO with infinite number. */
|
/* FLAG_ZERO with infinite number. */
|
||||||
my_dprintf (fileno (stdout), "%010a %d\n", 1.0 / 0.0, 33, 44, 55);
|
my_dprintf (fileno (stdout), "%010a %d\n", Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* Test the support of the %f format directive. */
|
/* Test the support of the %f format directive. */
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ SIGNATURE_CHECK (floor, double, (double));
|
|||||||
|
|
||||||
#include "isnand-nolibm.h"
|
#include "isnand-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -56,8 +57,8 @@ main (int argc, char **argv _GL_UNUSED)
|
|||||||
ASSERT (floor (-65536.0) == -65536.0);
|
ASSERT (floor (-65536.0) == -65536.0);
|
||||||
ASSERT (floor (-2.341e31) == -2.341e31);
|
ASSERT (floor (-2.341e31) == -2.341e31);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (floor (1.0 / 0.0) == 1.0 / 0.0);
|
ASSERT (floor (Infinityd ()) == Infinityd ());
|
||||||
ASSERT (floor (-1.0 / 0.0) == -1.0 / 0.0);
|
ASSERT (floor (- Infinityd ()) == - Infinityd ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnand (floor (NaNd ())));
|
ASSERT (isnand (floor (NaNd ())));
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ SIGNATURE_CHECK (floorf, float, (float));
|
|||||||
|
|
||||||
#include "isnanf-nolibm.h"
|
#include "isnanf-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -69,8 +70,8 @@ main (int argc, char **argv _GL_UNUSED)
|
|||||||
ASSERT (my_floorf (-65536.0f) == -65536.0f);
|
ASSERT (my_floorf (-65536.0f) == -65536.0f);
|
||||||
ASSERT (my_floorf (-2.341e31f) == -2.341e31f);
|
ASSERT (my_floorf (-2.341e31f) == -2.341e31f);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (my_floorf (1.0f / 0.0f) == 1.0f / 0.0f);
|
ASSERT (my_floorf (Infinityf ()) == Infinityf ());
|
||||||
ASSERT (my_floorf (-1.0f / 0.0f) == -1.0f / 0.0f);
|
ASSERT (my_floorf (- Infinityf ()) == - Infinityf ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanf (my_floorf (NaNf ())));
|
ASSERT (isnanf (my_floorf (NaNf ())));
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ SIGNATURE_CHECK (floorl, long double, (long double));
|
|||||||
#include "fpucw.h"
|
#include "fpucw.h"
|
||||||
#include "isnanl-nolibm.h"
|
#include "isnanl-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -63,8 +64,8 @@ main ()
|
|||||||
ASSERT (floorl (-65536.0L) == -65536.0L);
|
ASSERT (floorl (-65536.0L) == -65536.0L);
|
||||||
ASSERT (floorl (-2.341e31L) == -2.341e31L);
|
ASSERT (floorl (-2.341e31L) == -2.341e31L);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (floorl (1.0L / 0.0L) == 1.0L / 0.0L);
|
ASSERT (floorl (Infinityl ()) == Infinityl ());
|
||||||
ASSERT (floorl (-1.0L / 0.0L) == -1.0L / 0.0L);
|
ASSERT (floorl (- Infinityl ()) == - Infinityl ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanl (floorl (NaNl ())));
|
ASSERT (isnanl (floorl (NaNl ())));
|
||||||
|
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
||||||
|
|
||||||
|
#include "infinity.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_function (int (*my_fprintf) (FILE *, const char *, ...))
|
test_function (int (*my_fprintf) (FILE *, const char *, ...))
|
||||||
{
|
{
|
||||||
@@ -37,13 +39,13 @@ test_function (int (*my_fprintf) (FILE *, const char *, ...))
|
|||||||
my_fprintf (stdout, "%a %d\n", 0.0, 33, 44, 55);
|
my_fprintf (stdout, "%a %d\n", 0.0, 33, 44, 55);
|
||||||
|
|
||||||
/* Positive infinity. */
|
/* Positive infinity. */
|
||||||
my_fprintf (stdout, "%a %d\n", 1.0 / 0.0, 33, 44, 55);
|
my_fprintf (stdout, "%a %d\n", Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* Negative infinity. */
|
/* Negative infinity. */
|
||||||
my_fprintf (stdout, "%a %d\n", -1.0 / 0.0, 33, 44, 55);
|
my_fprintf (stdout, "%a %d\n", - Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* FLAG_ZERO with infinite number. */
|
/* FLAG_ZERO with infinite number. */
|
||||||
my_fprintf (stdout, "%010a %d\n", 1.0 / 0.0, 33, 44, 55);
|
my_fprintf (stdout, "%010a %d\n", Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* Test the support of the %f format directive. */
|
/* Test the support of the %f format directive. */
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (frexp, double, (double, int *));
|
|||||||
|
|
||||||
#include "isnand-nolibm.h"
|
#include "isnand-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ main ()
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
int exp = -9999;
|
int exp = -9999;
|
||||||
double mantissa;
|
double mantissa;
|
||||||
x = 1.0 / 0.0;
|
x = Infinityd ();
|
||||||
mantissa = frexp (x, &exp);
|
mantissa = frexp (x, &exp);
|
||||||
ASSERT (mantissa == x);
|
ASSERT (mantissa == x);
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ main ()
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
int exp = -9999;
|
int exp = -9999;
|
||||||
double mantissa;
|
double mantissa;
|
||||||
x = -1.0 / 0.0;
|
x = - Infinityd ();
|
||||||
mantissa = frexp (x, &exp);
|
mantissa = frexp (x, &exp);
|
||||||
ASSERT (mantissa == x);
|
ASSERT (mantissa == x);
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ SIGNATURE_CHECK (frexpl, long double, (long double, int *));
|
|||||||
#include "fpucw.h"
|
#include "fpucw.h"
|
||||||
#include "isnanl-nolibm.h"
|
#include "isnanl-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ main ()
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
int exp = -9999;
|
int exp = -9999;
|
||||||
long double mantissa;
|
long double mantissa;
|
||||||
x = 1.0L / 0.0L;
|
x = Infinityl ();
|
||||||
mantissa = frexpl (x, &exp);
|
mantissa = frexpl (x, &exp);
|
||||||
ASSERT (mantissa == x);
|
ASSERT (mantissa == x);
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,7 @@ main ()
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
int exp = -9999;
|
int exp = -9999;
|
||||||
long double mantissa;
|
long double mantissa;
|
||||||
x = -1.0L / 0.0L;
|
x = - Infinityl ();
|
||||||
mantissa = frexpl (x, &exp);
|
mantissa = frexpl (x, &exp);
|
||||||
ASSERT (mantissa == x);
|
ASSERT (mantissa == x);
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "infinity.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
float zerof = 0.0f;
|
float zerof = 0.0f;
|
||||||
@@ -51,8 +52,8 @@ test_isfinitef ()
|
|||||||
ASSERT (isfinite (-2.718e30f));
|
ASSERT (isfinite (-2.718e30f));
|
||||||
ASSERT (isfinite (-2.718e-30f));
|
ASSERT (isfinite (-2.718e-30f));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isfinite (1.0f / 0.0f));
|
ASSERT (!isfinite (Infinityf ()));
|
||||||
ASSERT (!isfinite (-1.0f / 0.0f));
|
ASSERT (!isfinite (- Infinityf ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (!isfinite (zerof / zerof));
|
ASSERT (!isfinite (zerof / zerof));
|
||||||
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
||||||
@@ -95,8 +96,8 @@ test_isfinited ()
|
|||||||
ASSERT (isfinite (-2.718e30));
|
ASSERT (isfinite (-2.718e30));
|
||||||
ASSERT (isfinite (-2.718e-30));
|
ASSERT (isfinite (-2.718e-30));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isfinite (1.0 / 0.0));
|
ASSERT (!isfinite (Infinityd ()));
|
||||||
ASSERT (!isfinite (-1.0 / 0.0));
|
ASSERT (!isfinite (- Infinityd ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (!isfinite (zerod / zerod));
|
ASSERT (!isfinite (zerod / zerod));
|
||||||
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
||||||
@@ -142,8 +143,8 @@ test_isfinitel ()
|
|||||||
ASSERT (isfinite (-2.718e30L));
|
ASSERT (isfinite (-2.718e30L));
|
||||||
ASSERT (isfinite (-2.718e-30L));
|
ASSERT (isfinite (-2.718e-30L));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isfinite (1.0L / 0.0L));
|
ASSERT (!isfinite (Infinityl ()));
|
||||||
ASSERT (!isfinite (-1.0L / 0.0L));
|
ASSERT (!isfinite (- Infinityl ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (!isfinite (zerol / zerol));
|
ASSERT (!isfinite (zerol / zerol));
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "infinity.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
float zerof = 0.0f;
|
float zerof = 0.0f;
|
||||||
@@ -53,8 +54,8 @@ test_isinff ()
|
|||||||
ASSERT (!isinf (FLT_MAX));
|
ASSERT (!isinf (FLT_MAX));
|
||||||
ASSERT (!isinf (-FLT_MAX));
|
ASSERT (!isinf (-FLT_MAX));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (isinf (1.0f / 0.0f));
|
ASSERT (isinf (Infinityf ()));
|
||||||
ASSERT (isinf (-1.0f / 0.0f));
|
ASSERT (isinf (- Infinityf ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (!isinf (zerof / zerof));
|
ASSERT (!isinf (zerof / zerof));
|
||||||
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
||||||
@@ -99,8 +100,8 @@ test_isinfd ()
|
|||||||
ASSERT (!isinf (DBL_MAX));
|
ASSERT (!isinf (DBL_MAX));
|
||||||
ASSERT (!isinf (-DBL_MAX));
|
ASSERT (!isinf (-DBL_MAX));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (isinf (1.0 / 0.0));
|
ASSERT (isinf (Infinityd ()));
|
||||||
ASSERT (isinf (-1.0 / 0.0));
|
ASSERT (isinf (- Infinityd ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (!isinf (zerod / zerod));
|
ASSERT (!isinf (zerod / zerod));
|
||||||
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
||||||
@@ -148,8 +149,8 @@ test_isinfl ()
|
|||||||
ASSERT (!isinf (LDBL_MAX));
|
ASSERT (!isinf (LDBL_MAX));
|
||||||
ASSERT (!isinf (-LDBL_MAX));
|
ASSERT (!isinf (-LDBL_MAX));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (isinf (1.0L / 0.0L));
|
ASSERT (isinf (Infinityl ()));
|
||||||
ASSERT (isinf (-1.0L / 0.0L));
|
ASSERT (isinf (- Infinityl ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (!isinf (zerol / zerol));
|
ASSERT (!isinf (zerol / zerol));
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -46,8 +47,8 @@ test_float (void)
|
|||||||
ASSERT (!isnan (0.0f));
|
ASSERT (!isnan (0.0f));
|
||||||
ASSERT (!isnan (minus_zerof));
|
ASSERT (!isnan (minus_zerof));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isnan (1.0f / 0.0f));
|
ASSERT (!isnan (Infinityf ()));
|
||||||
ASSERT (!isnan (-1.0f / 0.0f));
|
ASSERT (!isnan (- Infinityf ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (isnan (NaNf ()));
|
ASSERT (isnan (NaNf ()));
|
||||||
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
||||||
@@ -86,8 +87,8 @@ test_double (void)
|
|||||||
ASSERT (!isnan (0.0));
|
ASSERT (!isnan (0.0));
|
||||||
ASSERT (!isnan (minus_zerod));
|
ASSERT (!isnan (minus_zerod));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isnan (1.0 / 0.0));
|
ASSERT (!isnan (Infinityd ()));
|
||||||
ASSERT (!isnan (-1.0 / 0.0));
|
ASSERT (!isnan (- Infinityd ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (isnan (NaNd ()));
|
ASSERT (isnan (NaNd ()));
|
||||||
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
||||||
@@ -129,8 +130,8 @@ test_long_double (void)
|
|||||||
ASSERT (!isnan (0.0L));
|
ASSERT (!isnan (0.0L));
|
||||||
ASSERT (!isnan (minus_zerol));
|
ASSERT (!isnan (minus_zerol));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isnan (1.0L / 0.0L));
|
ASSERT (!isnan (Infinityl ()));
|
||||||
ASSERT (!isnan (-1.0L / 0.0L));
|
ASSERT (!isnan (- Infinityl ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (isnan (NaNl ()));
|
ASSERT (isnan (NaNl ()));
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -35,8 +36,8 @@ main ()
|
|||||||
ASSERT (!isnand (0.0));
|
ASSERT (!isnand (0.0));
|
||||||
ASSERT (!isnand (minus_zerod));
|
ASSERT (!isnand (minus_zerod));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isnand (1.0 / 0.0));
|
ASSERT (!isnand (Infinityd ()));
|
||||||
ASSERT (!isnand (-1.0 / 0.0));
|
ASSERT (!isnand (- Infinityd ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (isnand (NaNd ()));
|
ASSERT (isnand (NaNd ()));
|
||||||
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -35,8 +36,8 @@ main ()
|
|||||||
ASSERT (!isnanf (0.0f));
|
ASSERT (!isnanf (0.0f));
|
||||||
ASSERT (!isnanf (minus_zerof));
|
ASSERT (!isnanf (minus_zerof));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isnanf (1.0f / 0.0f));
|
ASSERT (!isnanf (Infinityf ()));
|
||||||
ASSERT (!isnanf (-1.0f / 0.0f));
|
ASSERT (!isnanf (- Infinityf ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (isnanf (NaNf ()));
|
ASSERT (isnanf (NaNf ()));
|
||||||
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -41,8 +42,8 @@ main ()
|
|||||||
ASSERT (!isnanl (0.0L));
|
ASSERT (!isnanl (0.0L));
|
||||||
ASSERT (!isnanl (minus_zerol));
|
ASSERT (!isnanl (minus_zerol));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!isnanl (1.0L / 0.0L));
|
ASSERT (!isnanl (Infinityl ()));
|
||||||
ASSERT (!isnanl (-1.0L / 0.0L));
|
ASSERT (!isnanl (- Infinityl ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
ASSERT (isnanl (NaNl ()));
|
ASSERT (isnanl (NaNl ()));
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ SIGNATURE_CHECK (ldexpl, long double, (long double, int));
|
|||||||
#include "fpucw.h"
|
#include "fpucw.h"
|
||||||
#include "isnanl-nolibm.h"
|
#include "isnanl-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -49,14 +50,14 @@ main ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
x = 1.0L / 0.0L;
|
x = Infinityl ();
|
||||||
y = ldexpl (x, 0); ASSERT (y == x);
|
y = ldexpl (x, 0); ASSERT (y == x);
|
||||||
y = ldexpl (x, 5); ASSERT (y == x);
|
y = ldexpl (x, 5); ASSERT (y == x);
|
||||||
y = ldexpl (x, -5); ASSERT (y == x);
|
y = ldexpl (x, -5); ASSERT (y == x);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
x = -1.0L / 0.0L;
|
x = - Infinityl ();
|
||||||
y = ldexpl (x, 0); ASSERT (y == x);
|
y = ldexpl (x, 0); ASSERT (y == x);
|
||||||
y = ldexpl (x, 5); ASSERT (y == x);
|
y = ldexpl (x, 5); ASSERT (y == x);
|
||||||
y = ldexpl (x, -5); ASSERT (y == x);
|
y = ldexpl (x, -5); ASSERT (y == x);
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
||||||
|
|
||||||
|
#include "infinity.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_function (int (*my_printf) (const char *, ...))
|
test_function (int (*my_printf) (const char *, ...))
|
||||||
{
|
{
|
||||||
@@ -37,15 +39,15 @@ test_function (int (*my_printf) (const char *, ...))
|
|||||||
my_printf ("%a %d\n", 0.0, 33, 44, 55);
|
my_printf ("%a %d\n", 0.0, 33, 44, 55);
|
||||||
|
|
||||||
/* Positive infinity. */
|
/* Positive infinity. */
|
||||||
my_printf ("%a %d\n", 1.0 / 0.0, 33, 44, 55);
|
my_printf ("%a %d\n", Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* Negative infinity. */
|
/* Negative infinity. */
|
||||||
my_printf ("%a %d\n", -1.0 / 0.0, 33, 44, 55);
|
my_printf ("%a %d\n", - Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* FLAG_ZERO with infinite number. */
|
/* FLAG_ZERO with infinite number. */
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
my_printf ("%010a %d\n", 1.0 / 0.0, 33, 44, 55);
|
my_printf ("%010a %d\n", Infinityd (), 33, 44, 55);
|
||||||
|
|
||||||
/* Test the support of the %f format directive. */
|
/* Test the support of the %f format directive. */
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (round, double, (double));
|
|||||||
|
|
||||||
#include "isnand-nolibm.h"
|
#include "isnand-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -63,8 +64,8 @@ main ()
|
|||||||
ASSERT (round (-65536.001) == -65536.0);
|
ASSERT (round (-65536.001) == -65536.0);
|
||||||
ASSERT (round (-2.341e31) == -2.341e31);
|
ASSERT (round (-2.341e31) == -2.341e31);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (round (1.0 / 0.0) == 1.0 / 0.0);
|
ASSERT (round (Infinityd ()) == Infinityd ());
|
||||||
ASSERT (round (-1.0 / 0.0) == -1.0 / 0.0);
|
ASSERT (round (- Infinityd ()) == - Infinityd ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnand (round (NaNd ())));
|
ASSERT (isnand (round (NaNd ())));
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (roundf, float, (float));
|
|||||||
|
|
||||||
#include "isnanf-nolibm.h"
|
#include "isnanf-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -63,8 +64,8 @@ main ()
|
|||||||
ASSERT (roundf (-65536.01f) == -65536.0f);
|
ASSERT (roundf (-65536.01f) == -65536.0f);
|
||||||
ASSERT (roundf (-2.341e31f) == -2.341e31f);
|
ASSERT (roundf (-2.341e31f) == -2.341e31f);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (roundf (1.0 / 0.0f) == 1.0 / 0.0f);
|
ASSERT (roundf (Infinityf ()) == Infinityf ());
|
||||||
ASSERT (roundf (-1.0 / 0.0f) == -1.0 / 0.0f);
|
ASSERT (roundf (- Infinityf ()) == - Infinityf ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanf (roundf (NaNf ())));
|
ASSERT (isnanf (roundf (NaNf ())));
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (roundl, long double, (long double));
|
|||||||
#include "fpucw.h"
|
#include "fpucw.h"
|
||||||
#include "isnanl-nolibm.h"
|
#include "isnanl-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -70,8 +71,8 @@ main ()
|
|||||||
ASSERT (roundl (-65536.001L) == -65536.0L);
|
ASSERT (roundl (-65536.001L) == -65536.0L);
|
||||||
ASSERT (roundl (-2.341e31L) == -2.341e31L);
|
ASSERT (roundl (-2.341e31L) == -2.341e31L);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (roundl (1.0 / 0.0L) == 1.0 / 0.0L);
|
ASSERT (roundl (Infinityl ()) == Infinityl ());
|
||||||
ASSERT (roundl (-1.0 / 0.0L) == -1.0 / 0.0L);
|
ASSERT (roundl (- Infinityl ()) == - Infinityl ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanl (roundl (NaNl ())));
|
ASSERT (isnanl (roundl (NaNl ())));
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
float zerof = 0.0f;
|
float zerof = 0.0f;
|
||||||
@@ -52,8 +53,8 @@ test_signbitf ()
|
|||||||
else
|
else
|
||||||
ASSERT (!signbit (minus_zerof));
|
ASSERT (!signbit (minus_zerof));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!signbit (1.0f / 0.0f));
|
ASSERT (!signbit (Infinityf ()));
|
||||||
ASSERT (signbit (-1.0f / 0.0f));
|
ASSERT (signbit (- Infinityf ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
(void) signbit (zerof / zerof);
|
(void) signbit (zerof / zerof);
|
||||||
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
|
||||||
@@ -97,8 +98,8 @@ test_signbitd ()
|
|||||||
else
|
else
|
||||||
ASSERT (!signbit (minus_zerod));
|
ASSERT (!signbit (minus_zerod));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!signbit (1.0 / 0.0));
|
ASSERT (!signbit (Infinityd ()));
|
||||||
ASSERT (signbit (-1.0 / 0.0));
|
ASSERT (signbit (- Infinityd ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
(void) signbit (zerod / zerod);
|
(void) signbit (zerod / zerod);
|
||||||
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
|
||||||
@@ -140,8 +141,8 @@ test_signbitl ()
|
|||||||
else
|
else
|
||||||
ASSERT (!signbit (minus_zerol));
|
ASSERT (!signbit (minus_zerol));
|
||||||
/* Infinite values. */
|
/* Infinite values. */
|
||||||
ASSERT (!signbit (1.0L / 0.0L));
|
ASSERT (!signbit (Infinityl ()));
|
||||||
ASSERT (signbit (-1.0L / 0.0L));
|
ASSERT (signbit (- Infinityl ()));
|
||||||
/* Quiet NaN. */
|
/* Quiet NaN. */
|
||||||
(void) signbit (zerol / zerol);
|
(void) signbit (zerol / zerol);
|
||||||
#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
|
#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
|
|
||||||
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
||||||
@@ -182,7 +183,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%a %d", 1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%a %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -190,7 +191,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%a %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%a %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -385,7 +386,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%010a %d", 1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%010a %d", Infinityd (), 33, 44, 55);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
ASSERT (strcmp (result, " inf 33") == 0);
|
ASSERT (strcmp (result, " inf 33") == 0);
|
||||||
@@ -446,7 +447,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%La %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -454,7 +455,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%La %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%La %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -737,7 +738,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%010La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%010La %d", Infinityl (), 33, 44, 55);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
ASSERT (strcmp (result, " inf 33") == 0);
|
ASSERT (strcmp (result, " inf 33") == 0);
|
||||||
@@ -891,7 +892,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%f %d", 1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%f %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -900,7 +901,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%f %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -975,7 +976,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015f %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1148,7 +1149,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%Lf %d", 1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%Lf %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1157,7 +1158,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1319,7 +1320,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1405,7 +1406,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%F %d", 1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%F %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1414,7 +1415,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%F %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1441,7 +1442,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015F %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1515,7 +1516,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%LF %d", 1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%LF %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1524,7 +1525,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1551,7 +1552,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1729,7 +1730,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%e %d", 1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%e %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1738,7 +1739,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%e %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1829,7 +1830,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015e %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2018,7 +2019,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%Le %d", 1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%Le %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2027,7 +2028,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2205,7 +2206,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2393,7 +2394,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%g %d", 1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%g %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2402,7 +2403,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%g %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2486,7 +2487,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015g %d", -1.0 / 0.0, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2670,7 +2671,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%Lg %d", 1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%Lg %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2679,7 +2680,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2850,7 +2851,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[100];
|
char result[100];
|
||||||
int retval =
|
int retval =
|
||||||
my_snprintf (result, sizeof (result), "%015Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_snprintf (result, sizeof (result), "%015Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
|
||||||
|
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
|
|
||||||
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
||||||
@@ -168,7 +169,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%a %d", 1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%a %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -176,7 +177,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%a %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%a %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -371,7 +372,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%010a %d", 1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%010a %d", Infinityd (), 33, 44, 55);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
ASSERT (strcmp (result, " inf 33") == 0);
|
ASSERT (strcmp (result, " inf 33") == 0);
|
||||||
@@ -432,7 +433,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%La %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -440,7 +441,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%La %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%La %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
}
|
}
|
||||||
@@ -723,7 +724,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%010La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%010La %d", Infinityl (), 33, 44, 55);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
ASSERT (strcmp (result, " inf 33") == 0);
|
ASSERT (strcmp (result, " inf 33") == 0);
|
||||||
@@ -877,7 +878,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%f %d", 1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%f %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -886,7 +887,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%f %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -961,7 +962,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015f %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%015f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1134,7 +1135,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%Lf %d", 1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%Lf %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1143,7 +1144,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1305,7 +1306,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%015Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1391,7 +1392,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%F %d", 1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%F %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1400,7 +1401,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%F %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1427,7 +1428,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015F %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%015F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1501,7 +1502,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%LF %d", 1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%LF %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1510,7 +1511,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1537,7 +1538,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%015LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1715,7 +1716,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%e %d", 1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%e %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1724,7 +1725,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%e %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -1815,7 +1816,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015e %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%015e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2004,7 +2005,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%Le %d", 1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%Le %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2013,7 +2014,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2191,7 +2192,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%015Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2379,7 +2380,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%g %d", 1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%g %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2388,7 +2389,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%g %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2472,7 +2473,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015g %d", -1.0 / 0.0, 33, 44, 55);
|
my_sprintf (result, "%015g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2656,7 +2657,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%Lg %d", 1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%Lg %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2665,7 +2666,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -2836,7 +2837,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char result[1000];
|
char result[1000];
|
||||||
int retval =
|
int retval =
|
||||||
my_sprintf (result, "%015Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_sprintf (result, "%015Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
|
@@ -25,6 +25,7 @@ SIGNATURE_CHECK (trunc, double, (double));
|
|||||||
|
|
||||||
#include "isnand-nolibm.h"
|
#include "isnand-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -55,8 +56,8 @@ main ()
|
|||||||
ASSERT (trunc (-65536.0) == -65536.0);
|
ASSERT (trunc (-65536.0) == -65536.0);
|
||||||
ASSERT (trunc (-2.341e31) == -2.341e31);
|
ASSERT (trunc (-2.341e31) == -2.341e31);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (trunc (1.0 / 0.0) == 1.0 / 0.0);
|
ASSERT (trunc (Infinityd ()) == Infinityd ());
|
||||||
ASSERT (trunc (-1.0 / 0.0) == -1.0 / 0.0);
|
ASSERT (trunc (- Infinityd ()) == - Infinityd ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnand (trunc (NaNd ())));
|
ASSERT (isnand (trunc (NaNd ())));
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ SIGNATURE_CHECK (truncf, float, (float));
|
|||||||
|
|
||||||
#include "isnanf-nolibm.h"
|
#include "isnanf-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -55,8 +56,8 @@ main ()
|
|||||||
ASSERT (truncf (-65536.0f) == -65536.0f);
|
ASSERT (truncf (-65536.0f) == -65536.0f);
|
||||||
ASSERT (truncf (-2.341e31f) == -2.341e31f);
|
ASSERT (truncf (-2.341e31f) == -2.341e31f);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (truncf (1.0f / 0.0f) == 1.0f / 0.0f);
|
ASSERT (truncf (Infinityf ()) == Infinityf ());
|
||||||
ASSERT (truncf (-1.0f / 0.0f) == -1.0f / 0.0f);
|
ASSERT (truncf (- Infinityf ()) == - Infinityf ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanf (truncf (NaNf ())));
|
ASSERT (isnanf (truncf (NaNf ())));
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ SIGNATURE_CHECK (truncl, long double, (long double));
|
|||||||
#include "fpucw.h"
|
#include "fpucw.h"
|
||||||
#include "isnanl-nolibm.h"
|
#include "isnanl-nolibm.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
@@ -62,8 +63,8 @@ main ()
|
|||||||
ASSERT (truncl (-65536.0L) == -65536.0L);
|
ASSERT (truncl (-65536.0L) == -65536.0L);
|
||||||
ASSERT (truncl (-2.341e31L) == -2.341e31L);
|
ASSERT (truncl (-2.341e31L) == -2.341e31L);
|
||||||
/* Infinite numbers. */
|
/* Infinite numbers. */
|
||||||
ASSERT (truncl (1.0L / 0.0L) == 1.0L / 0.0L);
|
ASSERT (truncl (Infinityl ()) == Infinityl ());
|
||||||
ASSERT (truncl (-1.0L / 0.0L) == -1.0L / 0.0L);
|
ASSERT (truncl (- Infinityl ()) == - Infinityl ());
|
||||||
/* NaNs. */
|
/* NaNs. */
|
||||||
ASSERT (isnanl (truncl (NaNl ())));
|
ASSERT (isnanl (truncl (NaNl ())));
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
|
|
||||||
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
||||||
@@ -217,7 +218,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%a %d", 1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%a %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (length == strlen (result));
|
ASSERT (length == strlen (result));
|
||||||
@@ -227,7 +228,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%a %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%a %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (length == strlen (result));
|
ASSERT (length == strlen (result));
|
||||||
@@ -458,7 +459,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%010a %d", 1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%010a %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
@@ -531,7 +532,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%La %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (length == strlen (result));
|
ASSERT (length == strlen (result));
|
||||||
@@ -541,7 +542,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%La %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%La %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (length == strlen (result));
|
ASSERT (length == strlen (result));
|
||||||
@@ -874,7 +875,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%010La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%010La %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
@@ -1044,7 +1045,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%f %d", 1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%f %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -1055,7 +1056,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%f %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -1148,7 +1149,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015f %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -1343,7 +1344,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%Lf %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%Lf %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -1354,7 +1355,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -1548,7 +1549,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -1654,7 +1655,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%F %d", 1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%F %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
@@ -1665,7 +1666,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%F %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
@@ -1698,7 +1699,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015F %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
@@ -1790,7 +1791,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%LF %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%LF %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
@@ -1801,7 +1802,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
@@ -1834,7 +1835,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
@@ -2032,7 +2033,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%e %d", 1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%e %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -2043,7 +2044,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%e %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -2154,7 +2155,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015e %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -2365,7 +2366,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%Le %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%Le %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -2376,7 +2377,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -2588,7 +2589,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -2798,7 +2799,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%g %d", 1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%g %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -2809,7 +2810,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%g %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -2913,7 +2914,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015g %d", -1.0 / 0.0, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -3119,7 +3120,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%Lg %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%Lg %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -3130,7 +3131,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -3335,7 +3336,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result =
|
char *result =
|
||||||
my_asnprintf (NULL, &length, "%015Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asnprintf (NULL, &length, "%015Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "minus-zero.h"
|
#include "minus-zero.h"
|
||||||
|
#include "infinity.h"
|
||||||
#include "nan.h"
|
#include "nan.h"
|
||||||
|
|
||||||
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */
|
||||||
@@ -197,7 +198,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%a %d", 1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%a %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -207,7 +208,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%a %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%a %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -438,7 +439,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%010a %d", 1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%010a %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
@@ -511,7 +512,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%La %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0);
|
ASSERT (strcmp (result, "inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -521,7 +522,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%La %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%La %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0);
|
ASSERT (strcmp (result, "-inf 33") == 0);
|
||||||
ASSERT (retval == strlen (result));
|
ASSERT (retval == strlen (result));
|
||||||
@@ -854,7 +855,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%010La %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%010La %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
/* "0000000inf 33" is not a valid result; see
|
/* "0000000inf 33" is not a valid result; see
|
||||||
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
|
||||||
@@ -1024,7 +1025,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%f %d", 1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%f %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -1035,7 +1036,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%f %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -1128,7 +1129,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015f %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%015f %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -1323,7 +1324,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%Lf %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%Lf %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -1334,7 +1335,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -1528,7 +1529,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015Lf %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%015Lf %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -1634,7 +1635,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%F %d", 1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%F %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
@@ -1645,7 +1646,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%F %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
@@ -1678,7 +1679,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015F %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%015F %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
@@ -1770,7 +1771,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%LF %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%LF %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "INF 33") == 0
|
ASSERT (strcmp (result, "INF 33") == 0
|
||||||
|| strcmp (result, "INFINITY 33") == 0);
|
|| strcmp (result, "INFINITY 33") == 0);
|
||||||
@@ -1781,7 +1782,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-INF 33") == 0
|
ASSERT (strcmp (result, "-INF 33") == 0
|
||||||
|| strcmp (result, "-INFINITY 33") == 0);
|
|| strcmp (result, "-INFINITY 33") == 0);
|
||||||
@@ -1814,7 +1815,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015LF %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%015LF %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -INF 33") == 0
|
ASSERT (strcmp (result, " -INF 33") == 0
|
||||||
|| strcmp (result, " -INFINITY 33") == 0);
|
|| strcmp (result, " -INFINITY 33") == 0);
|
||||||
@@ -2012,7 +2013,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%e %d", 1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%e %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -2023,7 +2024,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%e %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -2134,7 +2135,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015e %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%015e %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -2345,7 +2346,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%Le %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%Le %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -2356,7 +2357,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -2568,7 +2569,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015Le %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%015Le %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -2778,7 +2779,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%g %d", 1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%g %d", Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -2789,7 +2790,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%g %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -2893,7 +2894,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015g %d", -1.0 / 0.0, 33, 44, 55);
|
my_asprintf (&result, "%015g %d", - Infinityd (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
@@ -3099,7 +3100,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Positive infinity. */
|
{ /* Positive infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%Lg %d", 1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%Lg %d", Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "inf 33") == 0
|
ASSERT (strcmp (result, "inf 33") == 0
|
||||||
|| strcmp (result, "infinity 33") == 0);
|
|| strcmp (result, "infinity 33") == 0);
|
||||||
@@ -3110,7 +3111,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* Negative infinity. */
|
{ /* Negative infinity. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, "-inf 33") == 0
|
ASSERT (strcmp (result, "-inf 33") == 0
|
||||||
|| strcmp (result, "-infinity 33") == 0);
|
|| strcmp (result, "-infinity 33") == 0);
|
||||||
@@ -3315,7 +3316,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
|
|||||||
{ /* FLAG_ZERO with infinite number. */
|
{ /* FLAG_ZERO with infinite number. */
|
||||||
char *result;
|
char *result;
|
||||||
int retval =
|
int retval =
|
||||||
my_asprintf (&result, "%015Lg %d", -1.0L / 0.0L, 33, 44, 55);
|
my_asprintf (&result, "%015Lg %d", - Infinityl (), 33, 44, 55);
|
||||||
ASSERT (result != NULL);
|
ASSERT (result != NULL);
|
||||||
ASSERT (strcmp (result, " -inf 33") == 0
|
ASSERT (strcmp (result, " -inf 33") == 0
|
||||||
|| strcmp (result, " -infinity 33") == 0);
|
|| strcmp (result, " -infinity 33") == 0);
|
||||||
|
Reference in New Issue
Block a user