+2008-01-26 Bruno Haible <bruno@clisp.org>
+
+ Rename isnan, applicable to 'double' only, to isnand.
+ * modules/isnand-nolibm: Renamed from modules/isnan-nolibm.
+ (Files): Add lib/isnand.h, lib/isnand.c. Remove lib/isnan.h.
+ (configure.ac): Update.
+ (Include): Replace "isnan.h" with "isnand.h".
+ * m4/isnand.m4: Renamed from m4/isnan.m4.
+ (gl_FUNC_ISNAND_NO_LIBM): Renamed from gl_FUNC_ISNAN_NO_LIBM. Set
+ HAVE_ISNAND_IN_LIBC instead of HAVE_ISNAN_IN_LIBC. Build isnand.c
+ instead of isnan.c.
+ * lib/isnand.h: Renamed from lib/isnan.h. Test HAVE_ISNAND_IN_LIBC
+ instead of HAVE_ISNAN_IN_LIBC.
+ (isnand): Renamed from isnan.
+ * lib/isnand.c: New file.
+ * modules/isnand-nolibm-tests: Renamed from modules/isnan-nolibm-tests.
+ (Files): Add tests/test-isnand.c. Remove tests/test-isnan.c.
+ (Makefile.am): Update.
+ * tests/test-isnand.c: Renamed from tests/test-isnan.c.
+ Include isnand.h instead of isnan.h.
+ (main): Test isnand instead of isnan.
+ * modules/fprintf-posix (Depends-on): Add isnand-nolibm, remove
+ isnan-nolibm.
+ * modules/frexp (Depends-on): Likewise.
+ * modules/frexp-tests (Depends-on): Likewise.
+ * modules/frexp-nolibm (Depends-on): Likewise.
+ * modules/frexp-nolibm-tests (Depends-on): Likewise.
+ * modules/isfinite (Depends-on): Likewise.
+ * modules/round-tests (Depends-on): Likewise.
+ * modules/signbit (Depends-on): Likewise.
+ * modules/signbit-tests (Depends-on): Likewise.
+ * modules/snprintf-posix (Depends-on): Likewise.
+ * modules/sprintf-posix (Depends-on): Likewise.
+ * modules/trunc-tests (Depends-on): Likewise.
+ * modules/unistdio/u8-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u16-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u32-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.
+ * modules/vasnprintf-posix (Depends-on): Likewise.
+ * modules/vasprintf-posix (Depends-on): Likewise.
+ * modules/vfprintf-posix (Depends-on): Likewise.
+ * modules/vsnprintf-posix (Depends-on): Likewise.
+ * modules/vsprintf-posix (Depends-on): Likewise.
+ * lib/frexp.c: Include isnand.h instead of isnan.h.
+ (ISNAN): Set to isnand instead of isnan.
+ * lib/isfinite.c: Include isnand.h instead of isnan.h.
+ (gl_isfinited): Use isnand instead of isnan.
+ * lib/signbitd.c: Include isnand.h instead of isnan.h.
+ (gl_signbitd): Use isnand instead of isnan.
+ * lib/vasnprintf.c: Include isnand.h instead of isnan.h.
+ (is_infinite_or_zero, VASNPRINTF): Use isnand instead of isnan.
+ * tests/test-frexp.c: Include isnand.h instead of isnan.h.
+ (main): Use isnand instead of isnan.
+ * tests/test-round1.c: Include isnand.h.
+ (main): Use isnand instead of isnan.
+ * tests/test-round2.c: Include isnand.h instead of isnan.h.
+ (ISNAN): Set to isnand instead of isnan.
+ * tests/test-trunc1.c: Include isnand.h.
+ (main): Use isnand instead of isnan.
+ * tests/test-trunc2.c: Include isnand.h instead of isnan.h.
+ (equal): Use isnand instead of isnan.
+ * MODULES.html.sh (Mathematics <math.h>): Replace isnan-nolibm with
+ isnand-nolibm.
+ * NEWS: Mention the change.
+
2008-01-25 Paul Eggert <eggert@cs.ucla.edu>
Bruno Haible <bruno@clisp.org>
func_module frexpl
func_module frexpl-nolibm
func_module isfinite
- func_module isnan-nolibm
func_module isnanf-nolibm
+ func_module isnand-nolibm
func_module isnanl
func_module isnanl-nolibm
func_module ldexpl
Date Modules Changes
+2008-01-26 isnan-nolibm The module name is changed from isnan-nolibm to
+ isnand-nolibm. The include file is changed from
+ "isnan.h" to "isnand.h". The function that it
+ defines is changed from isnan() to isnand().
+
2008-01-14 strcasestr This module now replaces worst-case inefficient
implementations; clients that use controlled
needles and thus do not care about worst-case
/* Split a double into fraction and mantissa.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
# include "isnanl-nolibm.h"
# include "fpucw.h"
#else
-# include "isnan.h"
+# include "isnand.h"
#endif
/* This file assumes FLT_RADIX = 2. If FLT_RADIX is a power of 2 greater
#else
# define FUNC frexp
# define DOUBLE double
-# define ISNAN isnan
+# define ISNAN isnand
# define DECL_ROUNDING
# define BEGIN_ROUNDING()
# define END_ROUNDING()
/* Test for finite value (zero, subnormal, or normal, and not infinite or NaN).
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <config.h>
-#include "isnan.h"
#include "isnanf.h"
+#include "isnand.h"
#include "isnanl-nolibm.h"
int gl_isfinitef (float x)
int gl_isfinited (double x)
{
- return !isnan (x) && x - x == 0.;
+ return !isnand (x) && x - x == 0.;
}
int gl_isfinitel (long double x)
+++ /dev/null
-/* Test for NaN that does not need libm.
- Copyright (C) 2007 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/>. */
-
-#if HAVE_ISNAN_IN_LIBC
-/* Get declaration of isnan macro. */
-# include <math.h>
-#else
-/* Test whether X is a NaN. */
-# undef isnan
-# define isnan rpl_isnan
-extern int isnan (double x);
-#endif
--- /dev/null
+/* Test for NaN that does not need libm.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008. */
+
+#include "isnan.c"
--- /dev/null
+/* Test for NaN that does not need libm.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#if HAVE_ISNAND_IN_LIBC
+/* Get declaration of isnan macro. */
+# include <math.h>
+# ifdef isnan
+# undef isnand
+# define isnand(x) isnan ((double)(x))
+# endif
+#else
+/* Test whether X is a NaN. */
+# undef isnand
+# define isnand rpl_isnand
+extern int isnand (double x);
+#endif
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <math.h>
#include <string.h>
-#include "isnan.h"
+#include "isnand.h"
#include "float+.h"
#undef gl_signbitd
#else
/* This does not do the right thing for NaN, but this is irrelevant for
most use cases. */
- if (isnan (arg))
+ if (isnand (arg))
return 0;
if (arg < 0.0)
return 1;
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
-# include "isnan.h"
+# include "isnand.h"
#endif
#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL
#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
-# include "isnan.h"
+# include "isnand.h"
# include "printf-frexp.h"
#endif
static int
is_infinite_or_zero (double x)
{
- return isnan (x) || x + x == x;
+ return isnand (x) || x + x == x;
}
#endif
# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
double arg = a.arg[dp->arg_index].a.a_double;
- if (isnan (arg))
+ if (isnand (arg))
{
if (dp->conversion == 'A')
{
if (dp->conversion == 'f' || dp->conversion == 'F')
{
double arg = a.arg[dp->arg_index].a.a_double;
- if (!(isnan (arg) || arg + arg == arg))
+ if (!(isnand (arg) || arg + arg == arg))
{
/* arg is finite and nonzero. */
int exponent = floorlog10 (arg < 0 ? -arg : arg);
{
double arg = a.arg[dp->arg_index].a.a_double;
- if (isnan (arg))
+ if (isnand (arg))
{
if (dp->conversion >= 'A' && dp->conversion <= 'Z')
{
+++ /dev/null
-# isnan.m4 serial 2
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Check how to get or define isnan() without linking with libm.
-
-AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM],
-[
- AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
- [gl_cv_func_isnan_no_libm],
- [
- AC_TRY_LINK([#include <math.h>
- double x;],
- [return isnan (x);],
- [gl_cv_func_isnan_no_libm=yes],
- [gl_cv_func_isnan_no_libm=no])
- ])
- if test $gl_cv_func_isnan_no_libm = yes; then
- AC_DEFINE([HAVE_ISNAN_IN_LIBC], 1,
- [Define if the isnan(double) function is available in libc.])
- else
- AC_LIBOBJ([isnan])
- gl_DOUBLE_EXPONENT_LOCATION
- fi
-])
-
-AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION],
-[
- AC_CACHE_CHECK([where to find the exponent in a 'double'],
- [gl_cv_cc_double_expbit0],
- [
- AC_TRY_RUN([
-#include <float.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#define NWORDS \
- ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
-typedef union { double value; unsigned int word[NWORDS]; } memory_double;
-static unsigned int ored_words[NWORDS];
-static unsigned int anded_words[NWORDS];
-static void add_to_ored_words (double x)
-{
- memory_double m;
- size_t i;
- /* Clear it first, in case sizeof (double) < sizeof (memory_double). */
- memset (&m, 0, sizeof (memory_double));
- m.value = x;
- for (i = 0; i < NWORDS; i++)
- {
- ored_words[i] |= m.word[i];
- anded_words[i] &= m.word[i];
- }
-}
-int main ()
-{
- size_t j;
- FILE *fp = fopen ("conftest.out", "w");
- if (fp == NULL)
- return 1;
- for (j = 0; j < NWORDS; j++)
- anded_words[j] = ~ (unsigned int) 0;
- add_to_ored_words (0.25);
- add_to_ored_words (0.5);
- add_to_ored_words (1.0);
- add_to_ored_words (2.0);
- add_to_ored_words (4.0);
- /* Remove bits that are common (e.g. if representation of the first mantissa
- bit is explicit). */
- for (j = 0; j < NWORDS; j++)
- ored_words[j] &= ~anded_words[j];
- /* Now find the nonzero word. */
- for (j = 0; j < NWORDS; j++)
- if (ored_words[j] != 0)
- break;
- if (j < NWORDS)
- {
- size_t i;
- for (i = j + 1; i < NWORDS; i++)
- if (ored_words[i] != 0)
- {
- fprintf (fp, "unknown");
- return (fclose (fp) != 0);
- }
- for (i = 0; ; i++)
- if ((ored_words[j] >> i) & 1)
- {
- fprintf (fp, "word %d bit %d", (int) j, (int) i);
- return (fclose (fp) != 0);
- }
- }
- fprintf (fp, "unknown");
- return (fclose (fp) != 0);
-}
- ],
- [gl_cv_cc_double_expbit0=`cat conftest.out`],
- [gl_cv_cc_double_expbit0="unknown"],
- [
- dnl On ARM, there are two 'double' floating-point formats, used by
- dnl different sets of instructions: The older FPA instructions assume
- dnl that they are stored in big-endian word order, while the words
- dnl (like integer types) are stored in little-endian byte order.
- dnl The newer VFP instructions assume little-endian order consistenly.
- AC_EGREP_CPP([mixed_endianness], [
-#if defined arm || defined __arm || defined __arm__
- mixed_endianness
-#endif
- ],
- [gl_cv_cc_double_expbit0="unknown"],
- [
- pushdef([AC_MSG_CHECKING],[:])dnl
- pushdef([AC_MSG_RESULT],[:])dnl
- pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
- AC_C_BIGENDIAN(
- [gl_cv_cc_double_expbit0="word 0 bit 20"],
- [gl_cv_cc_double_expbit0="word 1 bit 20"],
- [gl_cv_cc_double_expbit0="unknown"])
- popdef([AC_MSG_RESULT_UNQUOTED])dnl
- popdef([AC_MSG_RESULT])dnl
- popdef([AC_MSG_CHECKING])dnl
- ])
- ])
- rm -f conftest.out
- ])
- case "$gl_cv_cc_double_expbit0" in
- word*bit*)
- word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
- bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
- AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
- [Define as the word index where to find the exponent of 'double'.])
- AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
- [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.])
- ;;
- esac
-])
--- /dev/null
+# isnand.m4 serial 1
+dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Check how to get or define isnand() without linking with libm.
+
+AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
+[
+ AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
+ [gl_cv_func_isnand_no_libm],
+ [
+ AC_TRY_LINK([#include <math.h>
+ double x;],
+ [return isnan (x);],
+ [gl_cv_func_isnand_no_libm=yes],
+ [gl_cv_func_isnand_no_libm=no])
+ ])
+ if test $gl_cv_func_isnand_no_libm = yes; then
+ AC_DEFINE([HAVE_ISNAND_IN_LIBC], 1,
+ [Define if the isnan(double) function is available in libc.])
+ else
+ AC_LIBOBJ([isnand])
+ gl_DOUBLE_EXPONENT_LOCATION
+ fi
+])
+
+AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION],
+[
+ AC_CACHE_CHECK([where to find the exponent in a 'double'],
+ [gl_cv_cc_double_expbit0],
+ [
+ AC_TRY_RUN([
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { double value; unsigned int word[NWORDS]; } memory_double;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (double x)
+{
+ memory_double m;
+ size_t i;
+ /* Clear it first, in case sizeof (double) < sizeof (memory_double). */
+ memset (&m, 0, sizeof (memory_double));
+ m.value = x;
+ for (i = 0; i < NWORDS; i++)
+ {
+ ored_words[i] |= m.word[i];
+ anded_words[i] &= m.word[i];
+ }
+}
+int main ()
+{
+ size_t j;
+ FILE *fp = fopen ("conftest.out", "w");
+ if (fp == NULL)
+ return 1;
+ for (j = 0; j < NWORDS; j++)
+ anded_words[j] = ~ (unsigned int) 0;
+ add_to_ored_words (0.25);
+ add_to_ored_words (0.5);
+ add_to_ored_words (1.0);
+ add_to_ored_words (2.0);
+ add_to_ored_words (4.0);
+ /* Remove bits that are common (e.g. if representation of the first mantissa
+ bit is explicit). */
+ for (j = 0; j < NWORDS; j++)
+ ored_words[j] &= ~anded_words[j];
+ /* Now find the nonzero word. */
+ for (j = 0; j < NWORDS; j++)
+ if (ored_words[j] != 0)
+ break;
+ if (j < NWORDS)
+ {
+ size_t i;
+ for (i = j + 1; i < NWORDS; i++)
+ if (ored_words[i] != 0)
+ {
+ fprintf (fp, "unknown");
+ return (fclose (fp) != 0);
+ }
+ for (i = 0; ; i++)
+ if ((ored_words[j] >> i) & 1)
+ {
+ fprintf (fp, "word %d bit %d", (int) j, (int) i);
+ return (fclose (fp) != 0);
+ }
+ }
+ fprintf (fp, "unknown");
+ return (fclose (fp) != 0);
+}
+ ],
+ [gl_cv_cc_double_expbit0=`cat conftest.out`],
+ [gl_cv_cc_double_expbit0="unknown"],
+ [
+ dnl On ARM, there are two 'double' floating-point formats, used by
+ dnl different sets of instructions: The older FPA instructions assume
+ dnl that they are stored in big-endian word order, while the words
+ dnl (like integer types) are stored in little-endian byte order.
+ dnl The newer VFP instructions assume little-endian order consistenly.
+ AC_EGREP_CPP([mixed_endianness], [
+#if defined arm || defined __arm || defined __arm__
+ mixed_endianness
+#endif
+ ],
+ [gl_cv_cc_double_expbit0="unknown"],
+ [
+ pushdef([AC_MSG_CHECKING],[:])dnl
+ pushdef([AC_MSG_RESULT],[:])dnl
+ pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
+ AC_C_BIGENDIAN(
+ [gl_cv_cc_double_expbit0="word 0 bit 20"],
+ [gl_cv_cc_double_expbit0="word 1 bit 20"],
+ [gl_cv_cc_double_expbit0="unknown"])
+ popdef([AC_MSG_RESULT_UNQUOTED])dnl
+ popdef([AC_MSG_RESULT])dnl
+ popdef([AC_MSG_CHECKING])dnl
+ ])
+ ])
+ rm -f conftest.out
+ ])
+ case "$gl_cv_cc_double_expbit0" in
+ word*bit*)
+ word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
+ bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
+ AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
+ [Define as the word index where to find the exponent of 'double'.])
+ AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
+ [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.])
+ ;;
+ esac
+])
stdio
fseterr
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
Depends-on:
math
-isnan-nolibm
+isnand-nolibm
configure.ac:
gl_FUNC_FREXP
Depends-on:
math
-isnan-nolibm
+isnand-nolibm
configure.ac:
gl_FUNC_FREXP_NO_LIBM
tests/test-frexp.c
Depends-on:
-isnan-nolibm
+isnand-nolibm
signbit
configure.ac:
tests/test-frexp.c
Depends-on:
-isnan-nolibm
+isnand-nolibm
signbit
configure.ac:
m4/check-math-lib.m4
Depends-on:
-isnan-nolibm
isnanf-nolibm
+isnand-nolibm
isnanl-nolibm
math
extensions
+++ /dev/null
-Description:
-isnan() function: test for NaN, without requiring libm.
-
-Files:
-lib/isnan.h
-lib/isnan.c
-lib/float+.h
-m4/isnan.m4
-
-Depends-on:
-fpieee
-
-configure.ac:
-gl_FUNC_ISNAN_NO_LIBM
-
-Makefile.am:
-
-Include:
-#include "isnan.h"
-
-License:
-LGPL
-
-Maintainer:
-Bruno Haible
-
+++ /dev/null
-Files:
-tests/test-isnan.c
-
-Depends-on:
-
-configure.ac:
-gl_DOUBLE_EXPONENT_LOCATION
-
-Makefile.am:
-TESTS += test-isnan
-check_PROGRAMS += test-isnan
-
--- /dev/null
+Description:
+isnand() function: test for NaN, without requiring libm.
+
+Files:
+lib/isnand.h
+lib/isnand.c
+lib/isnan.c
+lib/float+.h
+m4/isnand.m4
+
+Depends-on:
+fpieee
+
+configure.ac:
+gl_FUNC_ISNAND_NO_LIBM
+
+Makefile.am:
+
+Include:
+#include "isnand.h"
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
+
--- /dev/null
+Files:
+tests/test-isnand.c
+
+Depends-on:
+
+configure.ac:
+gl_DOUBLE_EXPONENT_LOCATION
+
+Makefile.am:
+TESTS += test-isnand
+check_PROGRAMS += test-isnand
+
tests/test-round2.c
Depends-on:
-isnan-nolibm
+isnand-nolibm
stdbool
stdint
fprintf-posix
float
math
isnanf-nolibm
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
fpieee
Files:
tests/test-signbit.c
m4/isnanf.m4
-m4/isnan.m4
+m4/isnand.m4
m4/isnanl.m4
Depends-on:
Depends-on:
snprintf
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
Depends-on:
stdio
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
Depends-on:
float
-isnan-nolibm
+isnand-nolibm
stdbool
stdint
fprintf-posix
unistr/u16-strmblen
unistr/u32-strlen
unistr/u32-strmblen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
unistr/u16-strmblen
unistr/u32-strlen
unistr/u32-strmblen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
unistr/u16-strmblen
unistr/u32-strlen
unistr/u32-strmblen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
unistr/u16-strmblen
unistr/u32-strlen
unistr/u32-strmblen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
unistr/u16-strmblen
unistr/u32-strlen
unistr/u32-strmblen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
unistr/u16-strmblen
unistr/u32-strlen
unistr/u32-strmblen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
unistr/u32-strlen
unistr/u32-strmblen
mbsnlen
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexpl-nolibm
printf-frexp
Depends-on:
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
Depends-on:
vasprintf
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
stdio
fseterr
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
Depends-on:
vsnprintf
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
Depends-on:
stdio
vasnprintf
-isnan-nolibm
+isnand-nolibm
isnanl-nolibm
frexp-nolibm
frexpl-nolibm
/* Test of splitting a double into fraction and mantissa.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stdio.h>
#include <stdlib.h>
-#include "isnan.h"
+#include "isnand.h"
#define ASSERT(expr) \
do \
double mantissa;
x = NaN ();
mantissa = frexp (x, &exp);
- ASSERT (isnan (mantissa));
+ ASSERT (isnand (mantissa));
}
{ /* Positive infinity. */
+++ /dev/null
-/* Test of isnan() substitute.
- Copyright (C) 2007 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/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include "isnan.h"
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- abort (); \
- } \
- } \
- while (0)
-
-/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
-#ifdef __DECC
-static double
-NaN ()
-{
- static double zero = 0.0;
- return zero / zero;
-}
-#else
-# define NaN() (0.0 / 0.0)
-#endif
-
-int
-main ()
-{
- /* Finite values. */
- ASSERT (!isnan (3.141));
- ASSERT (!isnan (3.141e30));
- ASSERT (!isnan (3.141e-30));
- ASSERT (!isnan (-2.718));
- ASSERT (!isnan (-2.718e30));
- ASSERT (!isnan (-2.718e-30));
- ASSERT (!isnan (0.0));
- ASSERT (!isnan (-0.0));
- /* Infinite values. */
- ASSERT (!isnan (1.0 / 0.0));
- ASSERT (!isnan (-1.0 / 0.0));
- /* Quiet NaN. */
- ASSERT (isnan (NaN ()));
-#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
- /* Signalling NaN. */
- {
- #define NWORDS \
- ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
- typedef union { double value; unsigned int word[NWORDS]; } memory_double;
- memory_double m;
- m.value = NaN ();
-# if DBL_EXPBIT0_BIT > 0
- m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
-# else
- m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
-# endif
- m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
- |= (unsigned int) 1 << DBL_EXPBIT0_BIT;
- ASSERT (isnan (m.value));
- }
-#endif
- return 0;
-}
--- /dev/null
+/* Test of isnand() substitute.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ 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/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#include <config.h>
+
+#include "isnand.h"
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
+
+/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
+#ifdef __DECC
+static double
+NaN ()
+{
+ static double zero = 0.0;
+ return zero / zero;
+}
+#else
+# define NaN() (0.0 / 0.0)
+#endif
+
+int
+main ()
+{
+ /* Finite values. */
+ ASSERT (!isnand (3.141));
+ ASSERT (!isnand (3.141e30));
+ ASSERT (!isnand (3.141e-30));
+ ASSERT (!isnand (-2.718));
+ ASSERT (!isnand (-2.718e30));
+ ASSERT (!isnand (-2.718e-30));
+ ASSERT (!isnand (0.0));
+ ASSERT (!isnand (-0.0));
+ /* Infinite values. */
+ ASSERT (!isnand (1.0 / 0.0));
+ ASSERT (!isnand (-1.0 / 0.0));
+ /* Quiet NaN. */
+ ASSERT (isnand (NaN ()));
+#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
+ /* Signalling NaN. */
+ {
+ #define NWORDS \
+ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+ typedef union { double value; unsigned int word[NWORDS]; } memory_double;
+ memory_double m;
+ m.value = NaN ();
+# if DBL_EXPBIT0_BIT > 0
+ m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1);
+# else
+ m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
+ ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
+# endif
+ m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)]
+ |= (unsigned int) 1 << DBL_EXPBIT0_BIT;
+ ASSERT (isnand (m.value));
+ }
+#endif
+ return 0;
+}
/* Test of rounding to nearest, breaking ties away from zero.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stdio.h>
#include <stdlib.h>
+#include "isnand.h"
+
#define ASSERT(expr) \
do \
{ \
ASSERT (round (1.0 / 0.0) == 1.0 / 0.0);
ASSERT (round (-1.0 / 0.0) == -1.0 / 0.0);
/* NaNs. */
- ASSERT (isnan (round (NaN ())));
+ ASSERT (isnand (round (NaN ())));
return 0;
}
/* Test of rounding to nearest, breaking ties away from zero.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifdef USE_LONG_DOUBLE
# error Long double not supported.
#elif ! defined USE_FLOAT
-# include "isnan.h"
-# define ISNAN isnan
+# include "isnand.h"
+# define ISNAN isnand
# define FUNCTION "round"
# define DOUBLE_UINT uint64_t
# define DOUBLE_BITS 64
/* Test of rounding towards zero.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stdio.h>
#include <stdlib.h>
+#include "isnand.h"
+
#define ASSERT(expr) \
do \
{ \
ASSERT (trunc (1.0 / 0.0) == 1.0 / 0.0);
ASSERT (trunc (-1.0 / 0.0) == -1.0 / 0.0);
/* NaNs. */
- ASSERT (isnan (trunc (NaN ())));
+ ASSERT (isnand (trunc (NaN ())));
return 0;
}
/* Test of rounding towards zero.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stdio.h>
#include <stdlib.h>
-#include "isnan.h"
+#include "isnand.h"
#define ASSERT(expr) \
do \
static int
equal (DOUBLE x, DOUBLE y)
{
- return (isnan (x) ? isnan (y) : x == y);
+ return (isnand (x) ? isnand (y) : x == y);
}
/* Test whether the result for a given argument is correct. */