1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Use Gnulib's isnan' and isinf' modules.

This updates Gnulib to v0.0-4219-g84cdd8b.

* m4/gnulib-cache.m4: Add `isinf' and `isnan'.

* configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and
  `nan.h'.

* libguile/gen-scmconfig.c (main): Remove definitions of
  `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and
  `SCM_HAVE_NAN_H'.

* libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove.
  (isinf)[SCO && !HAVE_ISINF]: Remove.
  (xisinf, xisnan): Remove.  Change callers to use `isinf' and `isnan'.
  (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define
  HAVE_ISNAN' conditions.

* libguile/numbers.h: Remove code conditional on
  `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'.
This commit is contained in:
Ludovic Courtès 2010-09-08 00:34:27 +02:00
parent 18f2d5aa4d
commit 2e65b52f8a
24 changed files with 2350 additions and 129 deletions

View file

@ -1115,8 +1115,6 @@ fi
AC_REPLACE_FUNCS([strerror memmove mkstemp]) AC_REPLACE_FUNCS([strerror memmove mkstemp])
AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
# Reasons for testing: # Reasons for testing:
# asinh, acosh, atanh, trunc - C99 standard, generally not available on # asinh, acosh, atanh, trunc - C99 standard, generally not available on
# older systems # older systems

View file

@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program. # the same distribution terms as the rest of that program.
# #
# Generated by gnulib-tool. # Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@ -488,6 +488,42 @@ EXTRA_libgnu_la_SOURCES += inet_pton.c
## end gnulib module inet_pton ## end gnulib module inet_pton
## begin gnulib module isinf
EXTRA_DIST += isinf.c
EXTRA_libgnu_la_SOURCES += isinf.c
## end gnulib module isinf
## begin gnulib module isnand
EXTRA_DIST += float+.h isnan.c isnand.c
EXTRA_libgnu_la_SOURCES += isnan.c isnand.c
## end gnulib module isnand
## begin gnulib module isnanf
EXTRA_DIST += float+.h isnan.c isnanf.c
EXTRA_libgnu_la_SOURCES += isnan.c isnanf.c
## end gnulib module isnanf
## begin gnulib module isnanl
EXTRA_DIST += float+.h isnan.c isnanl.c
EXTRA_libgnu_la_SOURCES += isnan.c isnanl.c
## end gnulib module isnanl
## begin gnulib module lib-symbol-visibility ## begin gnulib module lib-symbol-visibility
# The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the # The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
@ -639,6 +675,112 @@ EXTRA_DIST += malloca.h malloca.valgrind
## end gnulib module malloca ## end gnulib module malloca
## begin gnulib module math
BUILT_SOURCES += math.h
# We need the following in order to create <math.h> when the system
# doesn't have one that works with the given compiler.
math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
-e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \
-e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
-e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \
-e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \
-e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \
-e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \
-e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \
-e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \
-e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \
-e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \
-e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \
-e 's|@''GNULIB_ISFINITE''@|$(GNULIB_ISFINITE)|g' \
-e 's|@''GNULIB_ISINF''@|$(GNULIB_ISINF)|g' \
-e 's|@''GNULIB_ISNAN''@|$(GNULIB_ISNAN)|g' \
-e 's|@''GNULIB_ISNANF''@|$(GNULIB_ISNANF)|g' \
-e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \
-e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \
-e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \
-e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \
-e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \
-e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \
-e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \
-e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \
-e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \
-e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \
-e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \
-e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \
-e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
-e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
-e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
-e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
-e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
-e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
-e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
-e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
-e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
-e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
-e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \
-e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
-e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
-e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
-e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
-e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
-e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
-e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
-e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
-e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
-e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
-e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
-e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
-e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
-e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
-e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
-e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
-e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
-e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
-e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
-e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
-e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
-e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
-e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \
-e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \
-e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \
-e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \
-e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
-e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
-e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
-e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \
-e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
-e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
-e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
-e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/math.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += math.h math.h-t
EXTRA_DIST += math.in.h
## end gnulib module math
## begin gnulib module mbrlen ## begin gnulib module mbrlen

37
lib/isinf.c Normal file
View file

@ -0,0 +1,37 @@
/* Test for positive or negative infinity.
Copyright (C) 2007-2010 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2, 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Ben Pfaff <blp@gnu.org>, 2008. */
#include <config.h>
#include <float.h>
int gl_isinff (float x)
{
return x < -FLT_MAX || x > FLT_MAX;
}
int gl_isinfd (double x)
{
return x < -DBL_MAX || x > DBL_MAX;
}
int gl_isinfl (long double x)
{
return x < -LDBL_MAX || x > LDBL_MAX;
}

173
lib/isnan.c Normal file
View file

@ -0,0 +1,173 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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>
/* Specification. */
#ifdef USE_LONG_DOUBLE
/* Specification found in math.h or isnanl-nolibm.h. */
extern int rpl_isnanl (long double x);
#elif ! defined USE_FLOAT
/* Specification found in math.h or isnand-nolibm.h. */
extern int rpl_isnand (double x);
#else /* defined USE_FLOAT */
/* Specification found in math.h or isnanf-nolibm.h. */
extern int rpl_isnanf (float x);
#endif
#include <float.h>
#include <string.h>
#include "float+.h"
#ifdef USE_LONG_DOUBLE
# define FUNC rpl_isnanl
# define DOUBLE long double
# define MAX_EXP LDBL_MAX_EXP
# define MIN_EXP LDBL_MIN_EXP
# if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
# define KNOWN_EXPBIT0_LOCATION
# define EXPBIT0_WORD LDBL_EXPBIT0_WORD
# define EXPBIT0_BIT LDBL_EXPBIT0_BIT
# endif
# define SIZE SIZEOF_LDBL
# define L_(literal) literal##L
#elif ! defined USE_FLOAT
# define FUNC rpl_isnand
# define DOUBLE double
# define MAX_EXP DBL_MAX_EXP
# define MIN_EXP DBL_MIN_EXP
# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
# define KNOWN_EXPBIT0_LOCATION
# define EXPBIT0_WORD DBL_EXPBIT0_WORD
# define EXPBIT0_BIT DBL_EXPBIT0_BIT
# endif
# define SIZE SIZEOF_DBL
# define L_(literal) literal
#else /* defined USE_FLOAT */
# define FUNC rpl_isnanf
# define DOUBLE float
# define MAX_EXP FLT_MAX_EXP
# define MIN_EXP FLT_MIN_EXP
# if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
# define KNOWN_EXPBIT0_LOCATION
# define EXPBIT0_WORD FLT_EXPBIT0_WORD
# define EXPBIT0_BIT FLT_EXPBIT0_BIT
# endif
# define SIZE SIZEOF_FLT
# define L_(literal) literal##f
#endif
#define EXP_MASK ((MAX_EXP - MIN_EXP) | 7)
#define NWORDS \
((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double;
int
FUNC (DOUBLE x)
{
#ifdef KNOWN_EXPBIT0_LOCATION
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
/* Special CPU dependent code is needed to treat bit patterns outside the
IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities,
Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs.
These bit patterns are:
- exponent = 0x0001..0x7FFF, mantissa bit 63 = 0,
- exponent = 0x0000, mantissa bit 63 = 1.
The NaN bit pattern is:
- exponent = 0x7FFF, mantissa >= 0x8000000000000001. */
memory_double m;
unsigned int exponent;
m.value = x;
exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK;
# ifdef WORDS_BIGENDIAN
/* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16. */
if (exponent == 0)
return 1 & (m.word[0] >> 15);
else if (exponent == EXP_MASK)
return (((m.word[0] ^ 0x8000U) << 16) | m.word[1] | (m.word[2] >> 16)) != 0;
else
return 1 & ~(m.word[0] >> 15);
# else
/* Little endian: EXPBIT0_WORD = 2, EXPBIT0_BIT = 0. */
if (exponent == 0)
return (m.word[1] >> 31);
else if (exponent == EXP_MASK)
return ((m.word[1] ^ 0x80000000U) | m.word[0]) != 0;
else
return (m.word[1] >> 31) ^ 1;
# endif
# else
/* Be careful to not do any floating-point operation on x, such as x == x,
because x may be a signaling NaN. */
# if defined __SUNPRO_C || defined __DECC || (defined __sgi && !defined __GNUC__)
/* The Sun C 5.0 compilers and the Compaq (ex-DEC) 6.4 compilers don't
recognize the initializers as constant expressions. The latter compiler
also fails when constant-folding 0.0 / 0.0 even when constant-folding is
not required. The SGI MIPSpro C compiler complains about "floating-point
operation result is out of range". */
static DOUBLE zero = L_(0.0);
memory_double nan;
DOUBLE plus_inf = L_(1.0) / L_(0.0);
DOUBLE minus_inf = -L_(1.0) / L_(0.0);
nan.value = zero / zero;
# else
static memory_double nan = { L_(0.0) / L_(0.0) };
static DOUBLE plus_inf = L_(1.0) / L_(0.0);
static DOUBLE minus_inf = -L_(1.0) / L_(0.0);
# endif
{
memory_double m;
/* A NaN can be recognized through its exponent. But exclude +Infinity and
-Infinity, which have the same exponent. */
m.value = x;
if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD])
& (EXP_MASK << EXPBIT0_BIT))
== 0)
return (memcmp (&m.value, &plus_inf, SIZE) != 0
&& memcmp (&m.value, &minus_inf, SIZE) != 0);
else
return 0;
}
# endif
#else
/* The configuration did not find sufficient information. Give up about
the signaling NaNs, handle only the quiet NaNs. */
if (x == x)
{
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
/* Detect any special bit patterns that pass ==; see comment above. */
memory_double m1;
memory_double m2;
memset (&m1.value, 0, SIZE);
memset (&m2.value, 0, SIZE);
m1.value = x;
m2.value = x + (x ? 0.0L : -0.0L);
if (memcmp (&m1.value, &m2.value, SIZE) != 0)
return 1;
# endif
return 0;
}
else
return 1;
#endif
}

19
lib/isnand.c Normal file
View file

@ -0,0 +1,19 @@
/* Test for NaN that does not need libm.
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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"

20
lib/isnanf.c Normal file
View file

@ -0,0 +1,20 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#define USE_FLOAT
#include "isnan.c"

20
lib/isnanl.c Normal file
View file

@ -0,0 +1,20 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#define USE_LONG_DOUBLE
#include "isnan.c"

750
lib/math.in.h Normal file
View file

@ -0,0 +1,750 @@
/* A GNU-like <math.h>.
Copyright (C) 2002-2003, 2007-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_MATH_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
#ifndef _GL_MATH_H
#define _GL_MATH_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Helper macros to define a portability warning for the
classification macro FUNC called with VALUE. POSIX declares the
classification macros with an argument of real-floating (that is,
one of float, double, or long double). */
#define _GL_WARN_REAL_FLOATING_DECL(func) \
static inline int \
rpl_ ## func ## f (float f) \
{ \
return func (f); \
} \
static inline int \
rpl_ ## func ## d (double d) \
{ \
return func (d); \
} \
static inline int \
rpl_ ## func ## l (long double l) \
{ \
return func (l); \
} \
_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \
"use gnulib module " #func " for portability"); \
_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \
"use gnulib module " #func " for portability"); \
_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
"use gnulib module " #func " for portability")
#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
(sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \
: sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \
: rpl_ ## func ## l (value))
/* POSIX allows platforms that don't support NAN. But all major
machines in the past 15 years have supported something close to
IEEE NaN, so we define this unconditionally. We also must define
it on platforms like Solaris 10, where NAN is present but defined
as a function pointer rather than a floating point constant. */
#if !defined NAN || @REPLACE_NAN@
# undef NAN
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
# ifdef __DECC
static float
_NaN ()
{
static float zero = 0.0f;
return zero / zero;
}
# define NAN (_NaN())
# else
# define NAN (0.0f / 0.0f)
# endif
#endif
/* Solaris 10 defines HUGE_VAL, but as a function pointer rather
than a floating point constant. */
#if @REPLACE_HUGE_VAL@
# undef HUGE_VAL
# define HUGE_VAL (1.0 / 0.0)
#endif
/* Write x as
x = mantissa * 2^exp
where
If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
If x is zero: mantissa = x, exp = 0.
If x is infinite or NaN: mantissa = x, exp unspecified.
Store exp in *EXPPTR and return mantissa. */
#if @GNULIB_FREXP@
# if @REPLACE_FREXP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define frexp rpl_frexp
# endif
_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
_GL_CXXALIASWARN (frexp);
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
_GL_WARN_ON_USE (frexp, "frexp is unportable - "
"use gnulib module frexp for portability");
#endif
#if @GNULIB_LOGB@
# if !@HAVE_DECL_LOGB@
_GL_EXTERN_C double logb (double x);
# endif
#elif defined GNULIB_POSIXCHECK
# undef logb
# if HAVE_RAW_DECL_LOGB
_GL_WARN_ON_USE (logb, "logb is unportable - "
"use gnulib module logb for portability");
# endif
#endif
#if @GNULIB_ACOSL@
# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
_GL_FUNCDECL_SYS (acosl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (acosl, long double, (long double x));
_GL_CXXALIASWARN (acosl);
#elif defined GNULIB_POSIXCHECK
# undef acosl
# if HAVE_RAW_DECL_ACOSL
_GL_WARN_ON_USE (acosl, "acosl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_ASINL@
# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
_GL_FUNCDECL_SYS (asinl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (asinl, long double, (long double x));
_GL_CXXALIASWARN (asinl);
#elif defined GNULIB_POSIXCHECK
# undef asinl
# if HAVE_RAW_DECL_ASINL
_GL_WARN_ON_USE (asinl, "asinl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_ATANL@
# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
_GL_FUNCDECL_SYS (atanl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (atanl, long double, (long double x));
_GL_CXXALIASWARN (atanl);
#elif defined GNULIB_POSIXCHECK
# undef atanl
# if HAVE_RAW_DECL_ATANL
_GL_WARN_ON_USE (atanl, "atanl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_CEILF@
# if @REPLACE_CEILF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define ceilf rpl_ceilf
# endif
_GL_FUNCDECL_RPL (ceilf, float, (float x));
_GL_CXXALIAS_RPL (ceilf, float, (float x));
# else
# if !@HAVE_DECL_CEILF@
_GL_FUNCDECL_SYS (ceilf, float, (float x));
# endif
_GL_CXXALIAS_SYS (ceilf, float, (float x));
# endif
_GL_CXXALIASWARN (ceilf);
#elif defined GNULIB_POSIXCHECK
# undef ceilf
# if HAVE_RAW_DECL_CEILF
_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
"use gnulib module ceilf for portability");
# endif
#endif
#if @GNULIB_CEILL@
# if @REPLACE_CEILL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define ceill rpl_ceill
# endif
_GL_FUNCDECL_RPL (ceill, long double, (long double x));
_GL_CXXALIAS_RPL (ceill, long double, (long double x));
# else
# if !@HAVE_DECL_CEILL@
_GL_FUNCDECL_SYS (ceill, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (ceill, long double, (long double x));
# endif
_GL_CXXALIASWARN (ceill);
#elif defined GNULIB_POSIXCHECK
# undef ceill
# if HAVE_RAW_DECL_CEILL
_GL_WARN_ON_USE (ceill, "ceill is unportable - "
"use gnulib module ceill for portability");
# endif
#endif
#if @GNULIB_COSL@
# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
_GL_FUNCDECL_SYS (cosl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (cosl, long double, (long double x));
_GL_CXXALIASWARN (cosl);
#elif defined GNULIB_POSIXCHECK
# undef cosl
# if HAVE_RAW_DECL_COSL
_GL_WARN_ON_USE (cosl, "cosl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_EXPL@
# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
_GL_FUNCDECL_SYS (expl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (expl, long double, (long double x));
_GL_CXXALIASWARN (expl);
#elif defined GNULIB_POSIXCHECK
# undef expl
# if HAVE_RAW_DECL_EXPL
_GL_WARN_ON_USE (expl, "expl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_FLOORF@
# if @REPLACE_FLOORF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define floorf rpl_floorf
# endif
_GL_FUNCDECL_RPL (floorf, float, (float x));
_GL_CXXALIAS_RPL (floorf, float, (float x));
#else
# if !@HAVE_DECL_FLOORF@
_GL_FUNCDECL_SYS (floorf, float, (float x));
# endif
_GL_CXXALIAS_SYS (floorf, float, (float x));
# endif
_GL_CXXALIASWARN (floorf);
#elif defined GNULIB_POSIXCHECK
# undef floorf
# if HAVE_RAW_DECL_FLOORF
_GL_WARN_ON_USE (floorf, "floorf is unportable - "
"use gnulib module floorf for portability");
# endif
#endif
#if @GNULIB_FLOORL@
# if @REPLACE_FLOORL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define floorl rpl_floorl
# endif
_GL_FUNCDECL_RPL (floorl, long double, (long double x));
_GL_CXXALIAS_RPL (floorl, long double, (long double x));
# else
# if !@HAVE_DECL_FLOORL@
_GL_FUNCDECL_SYS (floorl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (floorl, long double, (long double x));
# endif
_GL_CXXALIASWARN (floorl);
#elif defined GNULIB_POSIXCHECK
# undef floorl
# if HAVE_RAW_DECL_FLOORL
_GL_WARN_ON_USE (floorl, "floorl is unportable - "
"use gnulib module floorl for portability");
# endif
#endif
/* Write x as
x = mantissa * 2^exp
where
If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
If x is zero: mantissa = x, exp = 0.
If x is infinite or NaN: mantissa = x, exp unspecified.
Store exp in *EXPPTR and return mantissa. */
#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define frexpl rpl_frexpl
# endif
_GL_FUNCDECL_RPL (frexpl, long double,
(long double x, int *expptr) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
#else
# if !@HAVE_DECL_FREXPL@
_GL_FUNCDECL_SYS (frexpl, long double,
(long double x, int *expptr) _GL_ARG_NONNULL ((2)));
# endif
# if @GNULIB_FREXPL@
_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
# endif
#endif
#if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
_GL_CXXALIASWARN (frexpl);
#endif
#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
# undef frexpl
# if HAVE_RAW_DECL_FREXPL
_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
"use gnulib module frexpl for portability");
# endif
#endif
/* Return x * 2^exp. */
#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define ldexpl rpl_ldexpl
# endif
_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
#else
# if !@HAVE_DECL_LDEXPL@
_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
# endif
# if @GNULIB_LDEXPL@
_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
# endif
#endif
#if @GNULIB_LDEXPL@
_GL_CXXALIASWARN (ldexpl);
#endif
#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
# undef ldexpl
# if HAVE_RAW_DECL_LDEXPL
_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
"use gnulib module ldexpl for portability");
# endif
#endif
#if @GNULIB_LOGL@
# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
_GL_FUNCDECL_SYS (logl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (logl, long double, (long double x));
_GL_CXXALIASWARN (logl);
#elif defined GNULIB_POSIXCHECK
# undef logl
# if HAVE_RAW_DECL_LOGL
_GL_WARN_ON_USE (logl, "logl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_ROUNDF@
# if @REPLACE_ROUNDF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef roundf
# define roundf rpl_roundf
# endif
_GL_FUNCDECL_RPL (roundf, float, (float x));
_GL_CXXALIAS_RPL (roundf, float, (float x));
# else
# if !@HAVE_DECL_ROUNDF@
_GL_FUNCDECL_SYS (roundf, float, (float x));
# endif
_GL_CXXALIAS_SYS (roundf, float, (float x));
# endif
_GL_CXXALIASWARN (roundf);
#elif defined GNULIB_POSIXCHECK
# undef roundf
# if HAVE_RAW_DECL_ROUNDF
_GL_WARN_ON_USE (roundf, "roundf is unportable - "
"use gnulib module roundf for portability");
# endif
#endif
#if @GNULIB_ROUND@
# if @REPLACE_ROUND@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef round
# define round rpl_round
# endif
_GL_FUNCDECL_RPL (round, double, (double x));
_GL_CXXALIAS_RPL (round, double, (double x));
# else
# if !@HAVE_DECL_ROUND@
_GL_FUNCDECL_SYS (round, double, (double x));
# endif
_GL_CXXALIAS_SYS (round, double, (double x));
# endif
_GL_CXXALIASWARN (round);
#elif defined GNULIB_POSIXCHECK
# undef round
# if HAVE_RAW_DECL_ROUND
_GL_WARN_ON_USE (round, "round is unportable - "
"use gnulib module round for portability");
# endif
#endif
#if @GNULIB_ROUNDL@
# if @REPLACE_ROUNDL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef roundl
# define roundl rpl_roundl
# endif
_GL_FUNCDECL_RPL (roundl, long double, (long double x));
_GL_CXXALIAS_RPL (roundl, long double, (long double x));
# else
# if !@HAVE_DECL_ROUNDL@
_GL_FUNCDECL_SYS (roundl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (roundl, long double, (long double x));
# endif
_GL_CXXALIASWARN (roundl);
#elif defined GNULIB_POSIXCHECK
# undef roundl
# if HAVE_RAW_DECL_ROUNDL
_GL_WARN_ON_USE (roundl, "roundl is unportable - "
"use gnulib module roundl for portability");
# endif
#endif
#if @GNULIB_SINL@
# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
_GL_FUNCDECL_SYS (sinl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (sinl, long double, (long double x));
_GL_CXXALIASWARN (sinl);
#elif defined GNULIB_POSIXCHECK
# undef sinl
# if HAVE_RAW_DECL_SINL
_GL_WARN_ON_USE (sinl, "sinl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_SQRTL@
# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
_GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
_GL_CXXALIASWARN (sqrtl);
#elif defined GNULIB_POSIXCHECK
# undef sqrtl
# if HAVE_RAW_DECL_SQRTL
_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_TANL@
# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
_GL_FUNCDECL_SYS (tanl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (tanl, long double, (long double x));
_GL_CXXALIASWARN (tanl);
#elif defined GNULIB_POSIXCHECK
# undef tanl
# if HAVE_RAW_DECL_TANL
_GL_WARN_ON_USE (tanl, "tanl is unportable - "
"use gnulib module mathl for portability");
# endif
#endif
#if @GNULIB_TRUNCF@
# if !@HAVE_DECL_TRUNCF@
_GL_FUNCDECL_SYS (truncf, float, (float x));
# endif
_GL_CXXALIAS_SYS (truncf, float, (float x));
_GL_CXXALIASWARN (truncf);
#elif defined GNULIB_POSIXCHECK
# undef truncf
# if HAVE_RAW_DECL_TRUNCF
_GL_WARN_ON_USE (truncf, "truncf is unportable - "
"use gnulib module truncf for portability");
# endif
#endif
#if @GNULIB_TRUNC@
# if !@HAVE_DECL_TRUNC@
_GL_FUNCDECL_SYS (trunc, double, (double x));
# endif
_GL_CXXALIAS_SYS (trunc, double, (double x));
_GL_CXXALIASWARN (trunc);
#elif defined GNULIB_POSIXCHECK
# undef trunc
# if HAVE_RAW_DECL_TRUNC
_GL_WARN_ON_USE (trunc, "trunc is unportable - "
"use gnulib module trunc for portability");
# endif
#endif
#if @GNULIB_TRUNCL@
# if @REPLACE_TRUNCL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef truncl
# define truncl rpl_truncl
# endif
_GL_FUNCDECL_RPL (truncl, long double, (long double x));
_GL_CXXALIAS_RPL (truncl, long double, (long double x));
# else
# if !@HAVE_DECL_TRUNCL@
_GL_FUNCDECL_SYS (truncl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (truncl, long double, (long double x));
# endif
_GL_CXXALIASWARN (truncl);
#elif defined GNULIB_POSIXCHECK
# undef truncl
# if HAVE_RAW_DECL_TRUNCL
_GL_WARN_ON_USE (truncl, "truncl is unportable - "
"use gnulib module truncl for portability");
# endif
#endif
#if @GNULIB_ISFINITE@
# if @REPLACE_ISFINITE@
_GL_EXTERN_C int gl_isfinitef (float x);
_GL_EXTERN_C int gl_isfinited (double x);
_GL_EXTERN_C int gl_isfinitel (long double x);
# undef isfinite
# define isfinite(x) \
(sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
gl_isfinitef (x))
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isfinite
_GL_WARN_REAL_FLOATING_DECL (isfinite);
# undef isfinite
# define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
# endif
#endif
#if @GNULIB_ISINF@
# if @REPLACE_ISINF@
_GL_EXTERN_C int gl_isinff (float x);
_GL_EXTERN_C int gl_isinfd (double x);
_GL_EXTERN_C int gl_isinfl (long double x);
# undef isinf
# define isinf(x) \
(sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
gl_isinff (x))
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isinf
_GL_WARN_REAL_FLOATING_DECL (isinf);
# undef isinf
# define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
# endif
#endif
#if @GNULIB_ISNANF@
/* Test for NaN for 'float' numbers. */
# if @HAVE_ISNANF@
/* The original <math.h> included above provides a declaration of isnan macro
or (older) isnanf function. */
# if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
# elif defined isnan
# undef isnanf
# define isnanf(x) isnan ((float)(x))
# endif
# else
/* Test whether X is a NaN. */
# undef isnanf
# define isnanf rpl_isnanf
_GL_EXTERN_C int isnanf (float x);
# endif
#endif
#if @GNULIB_ISNAND@
/* Test for NaN for 'double' numbers.
This function is a gnulib extension, unlike isnan() which applied only
to 'double' numbers earlier but now is a type-generic macro. */
# if @HAVE_ISNAND@
/* The original <math.h> included above provides a declaration of isnan macro. */
# if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnand
# define isnand(x) __builtin_isnan ((double)(x))
# else
# undef isnand
# define isnand(x) isnan ((double)(x))
# endif
# else
/* Test whether X is a NaN. */
# undef isnand
# define isnand rpl_isnand
_GL_EXTERN_C int isnand (double x);
# endif
#endif
#if @GNULIB_ISNANL@
/* Test for NaN for 'long double' numbers. */
# if @HAVE_ISNANL@
/* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */
# if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
# elif defined isnan
# undef isnanl
# define isnanl(x) isnan ((long double)(x))
# endif
# else
/* Test whether X is a NaN. */
# undef isnanl
# define isnanl rpl_isnanl
_GL_EXTERN_C int isnanl (long double x);
# endif
#endif
/* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL! */
#if @GNULIB_ISNAN@
# if @REPLACE_ISNAN@
/* We can't just use the isnanf macro (e.g.) as exposed by
isnanf.h (e.g.) here, because those may end up being macros
that recursively expand back to isnan. So use the gnulib
replacements for them directly. */
# if @HAVE_ISNANF@ && __GNUC__ >= 4
# define gl_isnan_f(x) __builtin_isnan ((float)(x))
# else
_GL_EXTERN_C int rpl_isnanf (float x);
# define gl_isnan_f(x) rpl_isnanf (x)
# endif
# if @HAVE_ISNAND@ && __GNUC__ >= 4
# define gl_isnan_d(x) __builtin_isnan ((double)(x))
# else
_GL_EXTERN_C int rpl_isnand (double x);
# define gl_isnan_d(x) rpl_isnand (x)
# endif
# if @HAVE_ISNANL@ && __GNUC__ >= 4
# define gl_isnan_l(x) __builtin_isnan ((long double)(x))
# else
_GL_EXTERN_C int rpl_isnanl (long double x);
# define gl_isnan_l(x) rpl_isnanl (x)
# endif
# undef isnan
# define isnan(x) \
(sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
gl_isnan_f (x))
# endif
#elif defined GNULIB_POSIXCHECK
# if defined isnan
_GL_WARN_REAL_FLOATING_DECL (isnan);
# undef isnan
# define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
# endif
#endif
#if @GNULIB_SIGNBIT@
# if @REPLACE_SIGNBIT_USING_GCC@
# undef signbit
/* GCC 4.0 and newer provides three built-ins for signbit. */
# define signbit(x) \
(sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
__builtin_signbitf (x))
# endif
# if @REPLACE_SIGNBIT@
# undef signbit
_GL_EXTERN_C int gl_signbitf (float arg);
_GL_EXTERN_C int gl_signbitd (double arg);
_GL_EXTERN_C int gl_signbitl (long double arg);
# if __GNUC__ >= 2 && !__STRICT_ANSI__
# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
# define gl_signbitf_OPTIMIZED_MACRO
# define gl_signbitf(arg) \
({ union { float _value; \
unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
} _m; \
_m._value = (arg); \
(_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \
})
# endif
# if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
# define gl_signbitd_OPTIMIZED_MACRO
# define gl_signbitd(arg) \
({ union { double _value; \
unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
} _m; \
_m._value = (arg); \
(_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \
})
# endif
# if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
# define gl_signbitl_OPTIMIZED_MACRO
# define gl_signbitl(arg) \
({ union { long double _value; \
unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
} _m; \
_m._value = (arg); \
(_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
})
# endif
# endif
# define signbit(x) \
(sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
gl_signbitf (x))
# endif
#elif defined GNULIB_POSIXCHECK
# if defined signbit
_GL_WARN_REAL_FLOATING_DECL (signbit);
# undef signbit
# define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
# endif
#endif
#endif /* _GL_MATH_H */
#endif /* _GL_MATH_H */

View file

@ -185,24 +185,6 @@ main (int argc, char *argv[])
pf ("#define SCM_HAVE_SYS_SELECT_H 0 /* 0 or 1 */\n"); pf ("#define SCM_HAVE_SYS_SELECT_H 0 /* 0 or 1 */\n");
#endif #endif
#ifdef HAVE_FLOATINGPOINT_H
pf ("#define SCM_HAVE_FLOATINGPOINT_H 1 /* 0 or 1 */\n");
#else
pf ("#define SCM_HAVE_FLOATINGPOINT_H 0 /* 0 or 1 */\n");
#endif
#ifdef HAVE_IEEEFP_H
pf ("#define SCM_HAVE_IEEEFP_H 1 /* 0 or 1 */\n");
#else
pf ("#define SCM_HAVE_IEEEFP_H 0 /* 0 or 1 */\n");
#endif
#ifdef HAVE_NAN_H
pf ("#define SCM_HAVE_NAN_H 1 /* 0 or 1 */\n");
#else
pf ("#define SCM_HAVE_NAN_H 0 /* 0 or 1 */\n");
#endif
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
pf ("#define SCM_HAVE_WINSOCK2_H 1 /* 0 or 1 */\n"); pf ("#define SCM_HAVE_WINSOCK2_H 1 /* 0 or 1 */\n");
#else #else

View file

@ -105,26 +105,6 @@ static SCM flo0;
*/ */
#define FLOBUFLEN (40+2*(sizeof(double)/sizeof(char)*SCM_CHAR_BIT*3+9)/10) #define FLOBUFLEN (40+2*(sizeof(double)/sizeof(char)*SCM_CHAR_BIT*3+9)/10)
#if defined (SCO)
#if ! defined (HAVE_ISNAN)
#define HAVE_ISNAN
static int
isnan (double x)
{
return (IsNANorINF (x) && NaN (x) && ! IsINF (x)) ? 1 : 0;
}
#endif
#if ! defined (HAVE_ISINF)
#define HAVE_ISINF
static int
isinf (double x)
{
return (IsNANorINF (x) && IsINF (x)) ? 1 : 0;
}
#endif
#endif
#if !defined (HAVE_ASINH) #if !defined (HAVE_ASINH)
static double asinh (double x) { return log (x + sqrt (x * x + 1)); } static double asinh (double x) { return log (x + sqrt (x * x + 1)); }
@ -141,35 +121,11 @@ static double atanh (double x) { return 0.5 * log ((1 + x) / (1 - x)); }
mpz_cmp_d is supposed to do this itself. */ mpz_cmp_d is supposed to do this itself. */
#if 1 #if 1
#define xmpz_cmp_d(z, d) \ #define xmpz_cmp_d(z, d) \
(xisinf (d) ? (d < 0.0 ? 1 : -1) : mpz_cmp_d (z, d)) (isinf (d) ? (d < 0.0 ? 1 : -1) : mpz_cmp_d (z, d))
#else #else
#define xmpz_cmp_d(z, d) mpz_cmp_d (z, d) #define xmpz_cmp_d(z, d) mpz_cmp_d (z, d)
#endif #endif
/* For reference, sparc solaris 7 has infinities (IEEE) but doesn't have
isinf. It does have finite and isnan though, hence the use of those.
fpclass would be a possibility on that system too. */
static int
xisinf (double x)
{
#if defined (HAVE_ISINF)
return isinf (x);
#elif defined (HAVE_FINITE) && defined (HAVE_ISNAN)
return (! (finite (x) || isnan (x)));
#else
return 0;
#endif
}
static int
xisnan (double x)
{
#if defined (HAVE_ISNAN)
return isnan (x);
#else
return 0;
#endif
}
#if defined (GUILE_I) #if defined (GUILE_I)
#if HAVE_COMPLEX_DOUBLE #if HAVE_COMPLEX_DOUBLE
@ -583,10 +539,10 @@ SCM_DEFINE (scm_inf_p, "inf?", 1, 0, 0,
#define FUNC_NAME s_scm_inf_p #define FUNC_NAME s_scm_inf_p
{ {
if (SCM_REALP (x)) if (SCM_REALP (x))
return scm_from_bool (xisinf (SCM_REAL_VALUE (x))); return scm_from_bool (isinf (SCM_REAL_VALUE (x)));
else if (SCM_COMPLEXP (x)) else if (SCM_COMPLEXP (x))
return scm_from_bool (xisinf (SCM_COMPLEX_REAL (x)) return scm_from_bool (isinf (SCM_COMPLEX_REAL (x))
|| xisinf (SCM_COMPLEX_IMAG (x))); || isinf (SCM_COMPLEX_IMAG (x)));
else else
return SCM_BOOL_F; return SCM_BOOL_F;
} }
@ -599,10 +555,10 @@ SCM_DEFINE (scm_nan_p, "nan?", 1, 0, 0,
#define FUNC_NAME s_scm_nan_p #define FUNC_NAME s_scm_nan_p
{ {
if (SCM_REALP (n)) if (SCM_REALP (n))
return scm_from_bool (xisnan (SCM_REAL_VALUE (n))); return scm_from_bool (isnan (SCM_REAL_VALUE (n)));
else if (SCM_COMPLEXP (n)) else if (SCM_COMPLEXP (n))
return scm_from_bool (xisnan (SCM_COMPLEX_REAL (n)) return scm_from_bool (isnan (SCM_COMPLEX_REAL (n))
|| xisnan (SCM_COMPLEX_IMAG (n))); || isnan (SCM_COMPLEX_IMAG (n)));
else else
return SCM_BOOL_F; return SCM_BOOL_F;
} }
@ -617,8 +573,6 @@ static double guile_NaN;
static void static void
guile_ieee_init (void) guile_ieee_init (void)
{ {
#if defined (HAVE_ISINF) || defined (HAVE_FINITE)
/* Some version of gcc on some old version of Linux used to crash when /* Some version of gcc on some old version of Linux used to crash when
trying to make Inf and NaN. */ trying to make Inf and NaN. */
@ -645,10 +599,6 @@ guile_ieee_init (void)
} }
#endif #endif
#endif
#if defined (HAVE_ISNAN)
#ifdef NAN #ifdef NAN
/* C99 NAN, when available */ /* C99 NAN, when available */
guile_NaN = NAN; guile_NaN = NAN;
@ -661,8 +611,6 @@ guile_ieee_init (void)
#else #else
guile_NaN = guile_Inf / guile_Inf; guile_NaN = guile_Inf / guile_Inf;
#endif #endif
#endif
} }
SCM_DEFINE (scm_inf, "inf", 0, 0, 0, SCM_DEFINE (scm_inf, "inf", 0, 0, 0,
@ -2216,7 +2164,7 @@ idbl2str (double f, char *a, int radix)
goto zero; /*{a[0]='0'; a[1]='.'; a[2]='0'; return 3;} */ goto zero; /*{a[0]='0'; a[1]='.'; a[2]='0'; return 3;} */
} }
if (xisinf (f)) if (isinf (f))
{ {
if (f < 0) if (f < 0)
strcpy (a, "-inf.0"); strcpy (a, "-inf.0");
@ -2224,7 +2172,7 @@ idbl2str (double f, char *a, int radix)
strcpy (a, "+inf.0"); strcpy (a, "+inf.0");
return ch+6; return ch+6;
} }
else if (xisnan (f)) else if (isnan (f))
{ {
strcpy (a, "+nan.0"); strcpy (a, "+nan.0");
return ch+6; return ch+6;
@ -2376,7 +2324,7 @@ icmplx2str (double real, double imag, char *str, int radix)
{ {
/* Don't output a '+' for negative numbers or for Inf and /* Don't output a '+' for negative numbers or for Inf and
NaN. They will provide their own sign. */ NaN. They will provide their own sign. */
if (0 <= imag && !xisinf (imag) && !xisnan (imag)) if (0 <= imag && !isinf (imag) && !isnan (imag))
str[i++] = '+'; str[i++] = '+';
i += idbl2str (imag, &str[i], radix); i += idbl2str (imag, &str[i], radix);
str[i++] = 'i'; str[i++] = 'i';
@ -3409,7 +3357,7 @@ scm_num_eq_p (SCM x, SCM y)
else if (SCM_REALP (y)) else if (SCM_REALP (y))
{ {
int cmp; int cmp;
if (xisnan (SCM_REAL_VALUE (y))) if (isnan (SCM_REAL_VALUE (y)))
return SCM_BOOL_F; return SCM_BOOL_F;
cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y)); cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));
scm_remember_upto_here_1 (x); scm_remember_upto_here_1 (x);
@ -3420,7 +3368,7 @@ scm_num_eq_p (SCM x, SCM y)
int cmp; int cmp;
if (0.0 != SCM_COMPLEX_IMAG (y)) if (0.0 != SCM_COMPLEX_IMAG (y))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisnan (SCM_COMPLEX_REAL (y))) if (isnan (SCM_COMPLEX_REAL (y)))
return SCM_BOOL_F; return SCM_BOOL_F;
cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_COMPLEX_REAL (y)); cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_COMPLEX_REAL (y));
scm_remember_upto_here_1 (x); scm_remember_upto_here_1 (x);
@ -3445,7 +3393,7 @@ scm_num_eq_p (SCM x, SCM y)
else if (SCM_BIGP (y)) else if (SCM_BIGP (y))
{ {
int cmp; int cmp;
if (xisnan (SCM_REAL_VALUE (x))) if (isnan (SCM_REAL_VALUE (x)))
return SCM_BOOL_F; return SCM_BOOL_F;
cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x)); cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));
scm_remember_upto_here_1 (y); scm_remember_upto_here_1 (y);
@ -3459,9 +3407,9 @@ scm_num_eq_p (SCM x, SCM y)
else if (SCM_FRACTIONP (y)) else if (SCM_FRACTIONP (y))
{ {
double xx = SCM_REAL_VALUE (x); double xx = SCM_REAL_VALUE (x);
if (xisnan (xx)) if (isnan (xx))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisinf (xx)) if (isinf (xx))
return scm_from_bool (xx < 0.0); return scm_from_bool (xx < 0.0);
x = scm_inexact_to_exact (x); /* with x as frac or int */ x = scm_inexact_to_exact (x); /* with x as frac or int */
goto again; goto again;
@ -3479,7 +3427,7 @@ scm_num_eq_p (SCM x, SCM y)
int cmp; int cmp;
if (0.0 != SCM_COMPLEX_IMAG (x)) if (0.0 != SCM_COMPLEX_IMAG (x))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisnan (SCM_COMPLEX_REAL (x))) if (isnan (SCM_COMPLEX_REAL (x)))
return SCM_BOOL_F; return SCM_BOOL_F;
cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_COMPLEX_REAL (x)); cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_COMPLEX_REAL (x));
scm_remember_upto_here_1 (y); scm_remember_upto_here_1 (y);
@ -3497,9 +3445,9 @@ scm_num_eq_p (SCM x, SCM y)
if (SCM_COMPLEX_IMAG (x) != 0.0) if (SCM_COMPLEX_IMAG (x) != 0.0)
return SCM_BOOL_F; return SCM_BOOL_F;
xx = SCM_COMPLEX_REAL (x); xx = SCM_COMPLEX_REAL (x);
if (xisnan (xx)) if (isnan (xx))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisinf (xx)) if (isinf (xx))
return scm_from_bool (xx < 0.0); return scm_from_bool (xx < 0.0);
x = scm_inexact_to_exact (x); /* with x as frac or int */ x = scm_inexact_to_exact (x); /* with x as frac or int */
goto again; goto again;
@ -3516,9 +3464,9 @@ scm_num_eq_p (SCM x, SCM y)
else if (SCM_REALP (y)) else if (SCM_REALP (y))
{ {
double yy = SCM_REAL_VALUE (y); double yy = SCM_REAL_VALUE (y);
if (xisnan (yy)) if (isnan (yy))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisinf (yy)) if (isinf (yy))
return scm_from_bool (0.0 < yy); return scm_from_bool (0.0 < yy);
y = scm_inexact_to_exact (y); /* with y as frac or int */ y = scm_inexact_to_exact (y); /* with y as frac or int */
goto again; goto again;
@ -3529,9 +3477,9 @@ scm_num_eq_p (SCM x, SCM y)
if (SCM_COMPLEX_IMAG (y) != 0.0) if (SCM_COMPLEX_IMAG (y) != 0.0)
return SCM_BOOL_F; return SCM_BOOL_F;
yy = SCM_COMPLEX_REAL (y); yy = SCM_COMPLEX_REAL (y);
if (xisnan (yy)) if (isnan (yy))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisinf (yy)) if (isinf (yy))
return scm_from_bool (0.0 < yy); return scm_from_bool (0.0 < yy);
y = scm_inexact_to_exact (y); /* with y as frac or int */ y = scm_inexact_to_exact (y); /* with y as frac or int */
goto again; goto again;
@ -3620,7 +3568,7 @@ scm_less_p (SCM x, SCM y)
else if (SCM_REALP (y)) else if (SCM_REALP (y))
{ {
int cmp; int cmp;
if (xisnan (SCM_REAL_VALUE (y))) if (isnan (SCM_REAL_VALUE (y)))
return SCM_BOOL_F; return SCM_BOOL_F;
cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y)); cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));
scm_remember_upto_here_1 (x); scm_remember_upto_here_1 (x);
@ -3638,7 +3586,7 @@ scm_less_p (SCM x, SCM y)
else if (SCM_BIGP (y)) else if (SCM_BIGP (y))
{ {
int cmp; int cmp;
if (xisnan (SCM_REAL_VALUE (x))) if (isnan (SCM_REAL_VALUE (x)))
return SCM_BOOL_F; return SCM_BOOL_F;
cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x)); cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));
scm_remember_upto_here_1 (y); scm_remember_upto_here_1 (y);
@ -3649,9 +3597,9 @@ scm_less_p (SCM x, SCM y)
else if (SCM_FRACTIONP (y)) else if (SCM_FRACTIONP (y))
{ {
double xx = SCM_REAL_VALUE (x); double xx = SCM_REAL_VALUE (x);
if (xisnan (xx)) if (isnan (xx))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisinf (xx)) if (isinf (xx))
return scm_from_bool (xx < 0.0); return scm_from_bool (xx < 0.0);
x = scm_inexact_to_exact (x); /* with x as frac or int */ x = scm_inexact_to_exact (x); /* with x as frac or int */
goto again; goto again;
@ -3671,9 +3619,9 @@ scm_less_p (SCM x, SCM y)
else if (SCM_REALP (y)) else if (SCM_REALP (y))
{ {
double yy = SCM_REAL_VALUE (y); double yy = SCM_REAL_VALUE (y);
if (xisnan (yy)) if (isnan (yy))
return SCM_BOOL_F; return SCM_BOOL_F;
if (xisinf (yy)) if (isinf (yy))
return scm_from_bool (0.0 < yy); return scm_from_bool (0.0 < yy);
y = scm_inexact_to_exact (y); /* with y as frac or int */ y = scm_inexact_to_exact (y); /* with y as frac or int */
goto again; goto again;
@ -3988,7 +3936,7 @@ scm_max (SCM x, SCM y)
calling isnan is unavoidable, since it's the only way to know calling isnan is unavoidable, since it's the only way to know
which of x or y causes any compares to be false */ which of x or y causes any compares to be false */
double xx = SCM_REAL_VALUE (x); double xx = SCM_REAL_VALUE (x);
return (xisnan (xx) || xx > SCM_REAL_VALUE (y)) ? x : y; return (isnan (xx) || xx > SCM_REAL_VALUE (y)) ? x : y;
} }
else if (SCM_FRACTIONP (y)) else if (SCM_FRACTIONP (y))
{ {
@ -4134,7 +4082,7 @@ scm_min (SCM x, SCM y)
calling isnan is unavoidable, since it's the only way to know calling isnan is unavoidable, since it's the only way to know
which of x or y causes any compares to be false */ which of x or y causes any compares to be false */
double xx = SCM_REAL_VALUE (x); double xx = SCM_REAL_VALUE (x);
return (xisnan (xx) || xx < SCM_REAL_VALUE (y)) ? x : y; return (isnan (xx) || xx < SCM_REAL_VALUE (y)) ? x : y;
} }
else if (SCM_FRACTIONP (y)) else if (SCM_FRACTIONP (y))
{ {
@ -5994,7 +5942,7 @@ SCM_DEFINE (scm_inexact_to_exact, "inexact->exact", 1, 0, 0,
return z; return z;
else if (SCM_REALP (z)) else if (SCM_REALP (z))
{ {
if (xisinf (SCM_REAL_VALUE (z)) || xisnan (SCM_REAL_VALUE (z))) if (isinf (SCM_REAL_VALUE (z)) || isnan (SCM_REAL_VALUE (z)))
SCM_OUT_OF_RANGE (1, z); SCM_OUT_OF_RANGE (1, z);
else else
{ {
@ -6362,7 +6310,7 @@ scm_num2float (SCM num, unsigned long int pos, const char *s_caller)
if (SCM_BIGP (num)) if (SCM_BIGP (num))
{ {
float res = mpz_get_d (SCM_I_BIG_MPZ (num)); float res = mpz_get_d (SCM_I_BIG_MPZ (num));
if (!xisinf (res)) if (!isinf (res))
return res; return res;
else else
scm_out_of_range (NULL, num); scm_out_of_range (NULL, num);
@ -6380,7 +6328,7 @@ scm_num2double (SCM num, unsigned long int pos, const char *s_caller)
if (SCM_BIGP (num)) if (SCM_BIGP (num))
{ {
double res = mpz_get_d (SCM_I_BIG_MPZ (num)); double res = mpz_get_d (SCM_I_BIG_MPZ (num));
if (!xisinf (res)) if (!isinf (res))
return res; return res;
else else
scm_out_of_range (NULL, num); scm_out_of_range (NULL, num);

View file

@ -33,24 +33,6 @@ typedef scm_t_int32 scm_t_wchar;
#define SCM_T_WCHAR_DEFINED #define SCM_T_WCHAR_DEFINED
#endif /* SCM_T_WCHAR_DEFINED */ #endif /* SCM_T_WCHAR_DEFINED */
#if SCM_HAVE_FLOATINGPOINT_H
# include <floatingpoint.h>
#endif
#if SCM_HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
#if SCM_HAVE_NAN_H
# if defined (SCO)
# define _IEEE 1
# endif
# include <nan.h>
# if defined (SCO)
# undef _IEEE
# endif
#endif /* SCM_HAVE_NAN_H */
/* Immediate Numbers, also known as fixnums /* Immediate Numbers, also known as fixnums

31
m4/check-math-lib.m4 Normal file
View file

@ -0,0 +1,31 @@
# check-math-lib.m4 serial 3
dnl Copyright (C) 2007, 2009, 2010 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
dnl gl_CHECK_MATH_LIB (VARIABLE, EXPRESSION)
dnl
dnl Sets the shell VARIABLE according to the libraries needed by EXPRESSION
dnl to compile and link: to the empty string if no extra libraries are needed,
dnl to "-lm" if -lm is needed, or to "missing" if it does not compile and
dnl link either way.
dnl
dnl Example: gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);])
AC_DEFUN([gl_CHECK_MATH_LIB], [
save_LIBS=$LIBS
$1=missing
for libm in "" "-lm"; do
LIBS="$save_LIBS $libm"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES 1 /* for glibc */
#endif
#include <math.h>
double x;]],
[$2])],
[$1=$libm
break])
done
LIBS=$save_LIBS
])

115
m4/exponentd.m4 Normal file
View file

@ -0,0 +1,115 @@
# exponentd.m4 serial 2
dnl Copyright (C) 2007-2008, 2010 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.
AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION],
[
AC_CACHE_CHECK([where to find the exponent in a 'double'],
[gl_cv_cc_double_expbit0],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#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
])

92
m4/exponentf.m4 Normal file
View file

@ -0,0 +1,92 @@
# exponentf.m4 serial 2
dnl Copyright (C) 2007-2008, 2010 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.
AC_DEFUN([gl_FLOAT_EXPONENT_LOCATION],
[
AC_CACHE_CHECK([where to find the exponent in a 'float'],
[gl_cv_cc_float_expbit0],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <float.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#define NWORDS \
((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { float value; unsigned int word[NWORDS]; } memory_float;
static unsigned int ored_words[NWORDS];
static unsigned int anded_words[NWORDS];
static void add_to_ored_words (float x)
{
memory_float m;
size_t i;
/* Clear it first, in case
sizeof (float) < sizeof (memory_float). */
memset (&m, 0, sizeof (memory_float));
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.25f);
add_to_ored_words (0.5f);
add_to_ored_words (1.0f);
add_to_ored_words (2.0f);
add_to_ored_words (4.0f);
/* 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_float_expbit0=`cat conftest.out`],
[gl_cv_cc_float_expbit0="unknown"],
[gl_cv_cc_float_expbit0="word 0 bit 23"])
rm -f conftest.out
])
case "$gl_cv_cc_float_expbit0" in
word*bit*)
word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'`
AC_DEFINE_UNQUOTED([FLT_EXPBIT0_WORD], [$word],
[Define as the word index where to find the exponent of 'float'.])
AC_DEFINE_UNQUOTED([FLT_EXPBIT0_BIT], [$bit],
[Define as the bit index in the word where to find bit 0 of the exponent of 'float'.])
;;
esac
])

98
m4/exponentl.m4 Normal file
View file

@ -0,0 +1,98 @@
# exponentl.m4 serial 3
dnl Copyright (C) 2007-2010 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.
AC_DEFUN([gl_LONG_DOUBLE_EXPONENT_LOCATION],
[
AC_REQUIRE([gl_BIGENDIAN])
AC_CACHE_CHECK([where to find the exponent in a 'long double'],
[gl_cv_cc_long_double_expbit0],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <float.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#define NWORDS \
((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { long double value; unsigned int word[NWORDS]; }
memory_long_double;
static unsigned int ored_words[NWORDS];
static unsigned int anded_words[NWORDS];
static void add_to_ored_words (long double x)
{
memory_long_double m;
size_t i;
/* Clear it first, in case
sizeof (long double) < sizeof (memory_long_double). */
memset (&m, 0, sizeof (memory_long_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.25L);
add_to_ored_words (0.5L);
add_to_ored_words (1.0L);
add_to_ored_words (2.0L);
add_to_ored_words (4.0L);
/* 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_long_double_expbit0=`cat conftest.out`],
[gl_cv_cc_long_double_expbit0="unknown"],
[
dnl When cross-compiling, we don't know. It depends on the
dnl ABI and compiler version. There are too many cases.
gl_cv_cc_long_double_expbit0="unknown"
])
rm -f conftest.out
])
case "$gl_cv_cc_long_double_expbit0" in
word*bit*)
word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'`
bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'`
AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_WORD], [$word],
[Define as the word index where to find the exponent of 'long double'.])
AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_BIT], [$bit],
[Define as the bit index in the word where to find bit 0 of the exponent of 'long double'.])
;;
esac
])

View file

@ -10,12 +10,12 @@
# #
# This file represents the specification of how gnulib-tool is used. # This file represents the specification of how gnulib-tool is used.
# It acts as a cache: It is written and read by gnulib-tool. # It acts as a cache: It is written and read by gnulib-tool.
# In projects using CVS, this file is meant to be stored in CVS, # In projects that use version control, this file is meant to be put under
# like the configure.ac and various Makefile.am files. # version control, like the configure.ac and various Makefile.am files.
# Specification in the form of a command-line invocation: # Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings # gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations: # Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([]) gl_LOCAL_DIR([])
@ -44,6 +44,8 @@ gl_MODULES([
iconv_open-utf iconv_open-utf
inet_ntop inet_ntop
inet_pton inet_pton
isinf
isnan
lib-symbol-versions lib-symbol-versions
lib-symbol-visibility lib-symbol-visibility
libunistring libunistring

View file

@ -12,7 +12,8 @@
# This file represents the compiled summary of the specification in # This file represents the compiled summary of the specification in
# gnulib-cache.m4. It lists the computed macro invocations that need # gnulib-cache.m4. It lists the computed macro invocations that need
# to be invoked from configure.ac. # to be invoked from configure.ac.
# In projects using CVS, this file can be treated like other built files. # In projects that use version control, this file can be treated like
# other built files.
# This macro should be invoked from ./configure.ac, in the section # This macro should be invoked from ./configure.ac, in the section
@ -71,6 +72,11 @@ AC_DEFUN([gl_EARLY],
# Code from module inet_ntop: # Code from module inet_ntop:
# Code from module inet_pton: # Code from module inet_pton:
# Code from module inline: # Code from module inline:
# Code from module isinf:
# Code from module isnan:
# Code from module isnand:
# Code from module isnanf:
# Code from module isnanl:
# Code from module lib-symbol-versions: # Code from module lib-symbol-versions:
# Code from module lib-symbol-visibility: # Code from module lib-symbol-visibility:
# Code from module libunistring: # Code from module libunistring:
@ -80,6 +86,7 @@ AC_DEFUN([gl_EARLY],
# Code from module maintainer-makefile: # Code from module maintainer-makefile:
# Code from module malloc-posix: # Code from module malloc-posix:
# Code from module malloca: # Code from module malloca:
# Code from module math:
# Code from module mbrlen: # Code from module mbrlen:
# Code from module mbrtowc: # Code from module mbrtowc:
# Code from module mbsinit: # Code from module mbsinit:
@ -241,6 +248,21 @@ AC_DEFUN([gl_INIT],
gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
# Code from module inline: # Code from module inline:
gl_INLINE gl_INLINE
# Code from module isinf:
gl_ISINF
gl_MATH_MODULE_INDICATOR([isinf])
# Code from module isnan:
gl_ISNAN
gl_MATH_MODULE_INDICATOR([isnan])
# Code from module isnand:
gl_FUNC_ISNAND
gl_MATH_MODULE_INDICATOR([isnand])
# Code from module isnanf:
gl_FUNC_ISNANF
gl_MATH_MODULE_INDICATOR([isnanf])
# Code from module isnanl:
gl_FUNC_ISNANL
gl_MATH_MODULE_INDICATOR([isnanl])
# Code from module lib-symbol-versions: # Code from module lib-symbol-versions:
gl_LD_VERSION_SCRIPT gl_LD_VERSION_SCRIPT
# Code from module lib-symbol-visibility: # Code from module lib-symbol-visibility:
@ -264,6 +286,8 @@ AC_DEFUN([gl_INIT],
gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_STDLIB_MODULE_INDICATOR([malloc-posix])
# Code from module malloca: # Code from module malloca:
gl_MALLOCA gl_MALLOCA
# Code from module math:
gl_MATH_H
# Code from module mbrlen: # Code from module mbrlen:
gl_FUNC_MBRLEN gl_FUNC_MBRLEN
gl_WCHAR_MODULE_INDICATOR([mbrlen]) gl_WCHAR_MODULE_INDICATOR([mbrlen])
@ -581,6 +605,11 @@ AC_DEFUN([gl_FILE_LIST], [
lib/iconveh.h lib/iconveh.h
lib/inet_ntop.c lib/inet_ntop.c
lib/inet_pton.c lib/inet_pton.c
lib/isinf.c
lib/isnan.c
lib/isnand.c
lib/isnanf.c
lib/isnanl.c
lib/libunistring.valgrind lib/libunistring.valgrind
lib/localcharset.c lib/localcharset.c
lib/localcharset.h lib/localcharset.h
@ -590,6 +619,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/malloca.c lib/malloca.c
lib/malloca.h lib/malloca.h
lib/malloca.valgrind lib/malloca.valgrind
lib/math.in.h
lib/mbrlen.c lib/mbrlen.c
lib/mbrtowc.c lib/mbrtowc.c
lib/mbsinit.c lib/mbsinit.c
@ -664,6 +694,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/autobuild.m4 m4/autobuild.m4
m4/byteswap.m4 m4/byteswap.m4
m4/canonicalize.m4 m4/canonicalize.m4
m4/check-math-lib.m4
m4/codeset.m4 m4/codeset.m4
m4/dos.m4 m4/dos.m4
m4/double-slash-root.m4 m4/double-slash-root.m4
@ -671,6 +702,9 @@ AC_DEFUN([gl_FILE_LIST], [
m4/eealloc.m4 m4/eealloc.m4
m4/environ.m4 m4/environ.m4
m4/errno_h.m4 m4/errno_h.m4
m4/exponentd.m4
m4/exponentf.m4
m4/exponentl.m4
m4/extensions.m4 m4/extensions.m4
m4/fcntl-o.m4 m4/fcntl-o.m4
m4/float_h.m4 m4/float_h.m4
@ -690,6 +724,11 @@ AC_DEFUN([gl_FILE_LIST], [
m4/inline.m4 m4/inline.m4
m4/intmax_t.m4 m4/intmax_t.m4
m4/inttypes_h.m4 m4/inttypes_h.m4
m4/isinf.m4
m4/isnan.m4
m4/isnand.m4
m4/isnanf.m4
m4/isnanl.m4
m4/ld-version-script.m4 m4/ld-version-script.m4
m4/lib-ld.m4 m4/lib-ld.m4
m4/lib-link.m4 m4/lib-link.m4
@ -705,6 +744,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/lstat.m4 m4/lstat.m4
m4/malloc.m4 m4/malloc.m4
m4/malloca.m4 m4/malloca.m4
m4/math_h.m4
m4/mbrlen.m4 m4/mbrlen.m4
m4/mbrtowc.m4 m4/mbrtowc.m4
m4/mbsinit.m4 m4/mbsinit.m4

48
m4/isinf.m4 Normal file
View file

@ -0,0 +1,48 @@
# isinf.m4 serial 3
dnl Copyright (C) 2007-2010 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.
AC_DEFUN([gl_ISINF],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
dnl Persuade glibc <math.h> to declare isinf.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_CHECK_DECLS([isinf], , , [#include <math.h>])
if test "$ac_cv_have_decl_isinf" = yes; then
gl_CHECK_MATH_LIB([ISINF_LIBM], [x = isinf (x);])
if test "$ISINF_LIBM" != missing; then
dnl Test whether isinf() on 'long double' works.
gl_ISINFL_WORKS
case "$gl_cv_func_isinfl_works" in
*yes) ;;
*) ISINF_LIBM=missing;;
esac
fi
fi
if test "$ac_cv_have_decl_isinf" != yes ||
test "$ISINF_LIBM" = missing; then
REPLACE_ISINF=1
AC_LIBOBJ([isinf])
ISINF_LIBM=
fi
AC_SUBST([ISINF_LIBM])
])
dnl Test whether isinf() correctly returns false for LDBL_MAX.
AC_DEFUN([gl_ISINFL_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([gl_BIGENDIAN])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether isinf(long double) works], [gl_cv_func_isinfl_works],
[
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <float.h>
#include <math.h>]],
[[return !!isinf(LDBL_MAX);]])],
[gl_cv_func_isinfl_works=yes],
[gl_cv_func_isinfl_works=no],
[gl_cv_func_isinfl_works="guessing no"])
])
])

47
m4/isnan.m4 Normal file
View file

@ -0,0 +1,47 @@
# isnan.m4 serial 3
dnl Copyright (C) 2007-2010 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.
AC_DEFUN([gl_ISNAN],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_ISNANF])
AC_REQUIRE([gl_FUNC_ISNAND])
AC_REQUIRE([gl_FUNC_ISNANL])
# If we replaced any of the underlying isnan* functions, replace
# the isnan macro; it undoubtedly suffers from the same flaws.
AC_MSG_CHECKING([whether isnan macro works])
if test $gl_func_isnanf = yes \
&& test $gl_func_isnand = yes \
&& test $gl_func_isnanl = yes; then
AC_MSG_RESULT([yes])
ISNAN_LIBM=
dnl Append $ISNANF_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
case " $ISNAN_LIBM " in
*" $ISNANF_LIBM "*) ;;
*) ISNAN_LIBM="$ISNAN_LIBM $ISNANF_LIBM" ;;
esac
dnl Append $ISNAND_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
case " $ISNAN_LIBM " in
*" $ISNAND_LIBM "*) ;;
*) ISNAN_LIBM="$ISNAN_LIBM $ISNAND_LIBM" ;;
esac
dnl Append $ISNANL_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
case " $ISNAN_LIBM " in
*" $ISNANL_LIBM "*) ;;
*) ISNAN_LIBM="$ISNAN_LIBM $ISNANL_LIBM" ;;
esac
else
AC_MSG_RESULT([no])
REPLACE_ISNAN=1
# Make sure the rpl_isnan[fdl] functions get built.
gl_BUILD_ISNANF
gl_BUILD_ISNAND
gl_BUILD_ISNANL
ISNAN_LIBM=
fi
AC_SUBST([ISNAN_LIBM])
])

99
m4/isnand.m4 Normal file
View file

@ -0,0 +1,99 @@
# isnand.m4 serial 7
dnl Copyright (C) 2007-2010 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().
AC_DEFUN([gl_FUNC_ISNAND],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
ISNAND_LIBM=
gl_HAVE_ISNAND_NO_LIBM
if test $gl_cv_func_isnand_no_libm = no; then
gl_HAVE_ISNAND_IN_LIBM
if test $gl_cv_func_isnand_in_libm = yes; then
ISNAND_LIBM=-lm
fi
fi
dnl The variable gl_func_isnand set here is used by isnan.m4.
if test $gl_cv_func_isnand_no_libm = yes \
|| test $gl_cv_func_isnand_in_libm = yes; then
gl_func_isnand=yes
else
gl_func_isnand=no
HAVE_ISNAND=0
gl_BUILD_ISNAND
fi
AC_SUBST([ISNAND_LIBM])
])
dnl Check how to get or define isnand() without linking with libm.
AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
[
gl_HAVE_ISNAND_NO_LIBM
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
gl_BUILD_ISNAND
fi
])
dnl Pull in replacement isnand definition. It does not need -lm.
AC_DEFUN([gl_BUILD_ISNAND],
[
AC_LIBOBJ([isnand])
gl_DOUBLE_EXPONENT_LOCATION
])
dnl Test whether isnand() can be used with libm.
AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM],
[
AC_CACHE_CHECK([whether isnan(double) can be used with libm],
[gl_cv_func_isnand_in_libm],
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
#if __GNUC__ >= 4
# undef isnand
# define isnand(x) __builtin_isnand ((double)(x))
#elif defined isnan
# undef isnand
# define isnand(x) isnan ((double)(x))
#endif
double x;]],
[[return isnand (x);]])],
[gl_cv_func_isnand_in_libm=yes],
[gl_cv_func_isnand_in_libm=no])
LIBS="$save_LIBS"
])
])
AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM],
[
AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
[gl_cv_func_isnand_no_libm],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
#if __GNUC__ >= 4
# undef isnand
# define isnand(x) __builtin_isnan ((double)(x))
#else
# undef isnand
# define isnand(x) isnan ((double)(x))
#endif
double x;]],
[[return isnand (x);]])],
[gl_cv_func_isnand_no_libm=yes],
[gl_cv_func_isnand_no_libm=no])
])
])

186
m4/isnanf.m4 Normal file
View file

@ -0,0 +1,186 @@
# isnanf.m4 serial 11
dnl Copyright (C) 2007-2010 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 isnanf().
AC_DEFUN([gl_FUNC_ISNANF],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
ISNANF_LIBM=
gl_HAVE_ISNANF_NO_LIBM
if test $gl_cv_func_isnanf_no_libm = no; then
gl_HAVE_ISNANF_IN_LIBM
if test $gl_cv_func_isnanf_in_libm = yes; then
ISNANF_LIBM=-lm
fi
fi
if test $gl_cv_func_isnanf_no_libm = yes \
|| test $gl_cv_func_isnanf_in_libm = yes; then
save_LIBS="$LIBS"
LIBS="$LIBS $ISNANF_LIBM"
gl_ISNANF_WORKS
LIBS="$save_LIBS"
case "$gl_cv_func_isnanf_works" in
*yes) gl_func_isnanf=yes ;;
*) gl_func_isnanf=no; ISNANF_LIBM= ;;
esac
else
gl_func_isnanf=no
fi
if test $gl_func_isnanf != yes; then
HAVE_ISNANF=0
gl_BUILD_ISNANF
fi
AC_SUBST([ISNANF_LIBM])
])
dnl Check how to get or define isnanf() without linking with libm.
AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM],
[
gl_HAVE_ISNANF_NO_LIBM
if test $gl_cv_func_isnanf_no_libm = yes; then
gl_ISNANF_WORKS
fi
if test $gl_cv_func_isnanf_no_libm = yes \
&& { case "$gl_cv_func_isnanf_works" in
*yes) true;;
*) false;;
esac
}; then
AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1],
[Define if the isnan(float) function is available in libc.])
else
gl_BUILD_ISNANF
fi
])
dnl Pull in replacement isnanf definition. It does not need -lm.
AC_DEFUN([gl_BUILD_ISNANF],
[
AC_LIBOBJ([isnanf])
gl_FLOAT_EXPONENT_LOCATION
])
dnl Test whether isnanf() can be used without libm.
AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM],
[
AC_CACHE_CHECK([whether isnan(float) can be used without linking with libm],
[gl_cv_func_isnanf_no_libm],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
#if __GNUC__ >= 4
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
#elif defined isnan
# undef isnanf
# define isnanf(x) isnan ((float)(x))
#endif
float x;]],
[[return isnanf (x);]])],
[gl_cv_func_isnanf_no_libm=yes],
[gl_cv_func_isnanf_no_libm=no])
])
])
dnl Test whether isnanf() can be used with libm.
AC_DEFUN([gl_HAVE_ISNANF_IN_LIBM],
[
AC_CACHE_CHECK([whether isnan(float) can be used with libm],
[gl_cv_func_isnanf_in_libm],
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
#if __GNUC__ >= 4
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
#elif defined isnan
# undef isnanf
# define isnanf(x) isnan ((float)(x))
#endif
float x;]],
[[return isnanf (x);]])],
[gl_cv_func_isnanf_in_libm=yes],
[gl_cv_func_isnanf_in_libm=no])
LIBS="$save_LIBS"
])
])
dnl Test whether isnanf() rejects Infinity (this fails on Solaris 2.5.1),
dnl recognizes a NaN (this fails on IRIX 6.5 with cc), and recognizes a NaN
dnl with in-memory representation 0x7fbfffff (this fails on IRIX 6.5).
AC_DEFUN([gl_ISNANF_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION])
AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <math.h>
#if __GNUC__ >= 4
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
#elif defined isnan
# undef isnanf
# define isnanf(x) isnan ((float)(x))
#endif
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
#ifdef __DECC
static float
NaN ()
{
static float zero = 0.0f;
return zero / zero;
}
#else
# define NaN() (0.0f / 0.0f)
#endif
#define NWORDS \
((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { unsigned int word[NWORDS]; float value; } memory_float;
int main()
{
memory_float m;
if (isnanf (1.0f / 0.0f))
return 1;
if (!isnanf (NaN ()))
return 1;
#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
/* The isnanf function should be immune against changes in the sign bit and
in the mantissa bits. The xor operation twiddles a bit that can only be
a sign bit or a mantissa bit. */
if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0)
{
m.value = NaN ();
/* Set the bits below the exponent to 01111...111. */
m.word[0] &= -1U << FLT_EXPBIT0_BIT;
m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1;
if (!isnanf (m.value))
return 1;
}
#endif
return 0;
}]])],
[gl_cv_func_isnanf_works=yes],
[gl_cv_func_isnanf_works=no],
[case "$host_os" in
irix* | solaris*) gl_cv_func_isnanf_works="guessing no";;
*) gl_cv_func_isnanf_works="guessing yes";;
esac
])
])
])

252
m4/isnanl.m4 Normal file
View file

@ -0,0 +1,252 @@
# isnanl.m4 serial 13
dnl Copyright (C) 2007-2010 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.
AC_DEFUN([gl_FUNC_ISNANL],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
ISNANL_LIBM=
gl_HAVE_ISNANL_NO_LIBM
if test $gl_cv_func_isnanl_no_libm = no; then
gl_HAVE_ISNANL_IN_LIBM
if test $gl_cv_func_isnanl_in_libm = yes; then
ISNANL_LIBM=-lm
fi
fi
if test $gl_cv_func_isnanl_no_libm = yes \
|| test $gl_cv_func_isnanl_in_libm = yes; then
save_LIBS="$LIBS"
LIBS="$LIBS $ISNANL_LIBM"
gl_FUNC_ISNANL_WORKS
LIBS="$save_LIBS"
case "$gl_cv_func_isnanl_works" in
*yes) gl_func_isnanl=yes ;;
*) gl_func_isnanl=no; ISNANL_LIBM= ;;
esac
else
gl_func_isnanl=no
fi
if test $gl_func_isnanl != yes; then
HAVE_ISNANL=0
gl_BUILD_ISNANL
fi
AC_SUBST([ISNANL_LIBM])
])
AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM],
[
gl_HAVE_ISNANL_NO_LIBM
gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm
if test $gl_func_isnanl_no_libm = yes; then
gl_FUNC_ISNANL_WORKS
case "$gl_cv_func_isnanl_works" in
*yes) ;;
*) gl_func_isnanl_no_libm=no ;;
esac
fi
if test $gl_func_isnanl_no_libm = yes; then
AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1],
[Define if the isnan(long double) function is available in libc.])
else
gl_BUILD_ISNANL
fi
])
dnl Pull in replacement isnanl definition. It does not need -lm.
AC_DEFUN([gl_BUILD_ISNANL],
[
AC_LIBOBJ([isnanl])
gl_LONG_DOUBLE_EXPONENT_LOCATION
])
dnl Test whether isnanl() can be used without libm.
AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM],
[
AC_CACHE_CHECK([whether isnan(long double) can be used without linking with libm],
[gl_cv_func_isnanl_no_libm],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
#if __GNUC__ >= 4
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
# undef isnanl
# define isnanl(x) isnan ((long double)(x))
#endif
long double x;]],
[[return isnanl (x);]])],
[gl_cv_func_isnanl_no_libm=yes],
[gl_cv_func_isnanl_no_libm=no])
])
])
dnl Test whether isnanl() can be used with libm.
AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM],
[
AC_CACHE_CHECK([whether isnan(long double) can be used with libm],
[gl_cv_func_isnanl_in_libm],
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
#if __GNUC__ >= 4
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
# undef isnanl
# define isnanl(x) isnan ((long double)(x))
#endif
long double x;]],
[[return isnanl (x);]])],
[gl_cv_func_isnanl_in_libm=yes],
[gl_cv_func_isnanl_in_libm=no])
LIBS="$save_LIBS"
])
])
dnl Test whether isnanl() recognizes all numbers which are neither finite nor
dnl infinite. This test fails e.g. on NetBSD/i386 and on glibc/ia64.
dnl Also, the GCC >= 4.0 built-in __builtin_isnanl does not pass the tests
dnl - for pseudo-denormals on i686 and x86_64,
dnl - for pseudo-zeroes, unnormalized numbers, and pseudo-denormals on ia64.
AC_DEFUN([gl_FUNC_ISNANL_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([gl_BIGENDIAN])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <float.h>
#include <limits.h>
#include <math.h>
#if __GNUC__ >= 4
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
# undef isnanl
# define isnanl(x) isnan ((long double)(x))
#endif
#define NWORDS \
((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { unsigned int word[NWORDS]; long double value; }
memory_long_double;
/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
runtime type conversion. */
#ifdef __sgi
static long double NaNl ()
{
double zero = 0.0;
return zero / zero;
}
#else
# define NaNl() (0.0L / 0.0L)
#endif
int main ()
{
memory_long_double m;
unsigned int i;
if (!isnanl (NaNl ()))
return 1;
/* The isnanl function should be immune against changes in the sign bit and
in the mantissa bits. The xor operation twiddles a bit that can only be
a sign bit or a mantissa bit (since the exponent never extends to
bit 31). */
m.value = NaNl ();
m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
for (i = 0; i < NWORDS; i++)
m.word[i] |= 1;
if (!isnanl (m.value))
return 1;
#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
/* Representation of an 80-bit 'long double' as an initializer for a sequence
of 'unsigned int' words. */
# ifdef WORDS_BIGENDIAN
# define LDBL80_WORDS(exponent,manthi,mantlo) \
{ ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \
(unsigned int) (mantlo) << 16 \
}
# else
# define LDBL80_WORDS(exponent,manthi,mantlo) \
{ mantlo, manthi, exponent }
# endif
{ /* Quiet NaN. */
static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
{
/* Signalling NaN. */
static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
/* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities,
Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in
Intel IA-64 Architecture Software Developer's Manual, Volume 1:
Application Architecture.
Table 5-2 "Floating-Point Register Encodings"
Figure 5-6 "Memory to Floating-Point Register Data Translation"
*/
{ /* Pseudo-NaN. */
static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
{ /* Pseudo-Infinity. */
static memory_long_double x =
{ LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
{ /* Pseudo-Zero. */
static memory_long_double x =
{ LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
{ /* Unnormalized number. */
static memory_long_double x =
{ LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
{ /* Pseudo-Denormal. */
static memory_long_double x =
{ LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
if (!isnanl (x.value))
return 1;
}
#endif
return 0;
}]])],
[gl_cv_func_isnanl_works=yes],
[gl_cv_func_isnanl_works=no],
[case "$host_cpu" in
# Guess no on ia64, x86_64, i386.
ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";;
*)
case "$host_os" in
netbsd*) gl_cv_func_isnanl_works="guessing no";;
*) gl_cv_func_isnanl_works="guessing yes";;
esac
;;
esac
])
])
])

140
m4/math_h.m4 Normal file
View file

@ -0,0 +1,140 @@
# math_h.m4 serial 21
dnl Copyright (C) 2007-2010 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.
AC_DEFUN([gl_MATH_H],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([math.h])
AC_REQUIRE([AC_C_INLINE])
AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
[[/* Solaris 10 has a broken definition of NAN. Other platforms
fail to provide NAN, or provide it only in C99 mode; this
test only needs to fail when NAN is provided but wrong. */
float f = 1.0f;
#ifdef NAN
f = NAN;
#endif
return f == 0;]])],
[gl_cv_header_math_nan_works=yes],
[gl_cv_header_math_nan_works=no])])
if test $gl_cv_header_math_nan_works = no; then
REPLACE_NAN=1
fi
AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
[[/* Solaris 10 has a broken definition of HUGE_VAL. */
double d = HUGE_VAL;
return d == 0;]])],
[gl_cv_header_math_huge_val_works=yes],
[gl_cv_header_math_huge_val_works=no])])
if test $gl_cv_header_math_huge_val_works = no; then
REPLACE_HUGE_VAL=1
fi
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <math.h>
]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
])
AC_DEFUN([gl_MATH_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_MATH_H_DEFAULTS])
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
AC_DEFUN([gl_MATH_H_DEFAULTS],
[
GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL])
GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL])
GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL])
GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF])
GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL])
GNULIB_COSL=0; AC_SUBST([GNULIB_COSL])
GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF])
GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN])
GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF])
GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL])
GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT])
GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL])
HAVE_ASINL=1; AC_SUBST([HAVE_ASINL])
HAVE_ATANL=1; AC_SUBST([HAVE_ATANL])
HAVE_COSL=1; AC_SUBST([HAVE_COSL])
HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
HAVE_LOGL=1; AC_SUBST([HAVE_LOGL])
HAVE_SINL=1; AC_SUBST([HAVE_SINL])
HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
HAVE_TANL=1; AC_SUBST([HAVE_TANL])
HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL])
REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP])
REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL])
REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL])
REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE])
REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF])
REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN])
REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL])
REPLACE_NAN=0; AC_SUBST([REPLACE_NAN])
REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND])
REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF])
REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL])
REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT])
REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL])
])

View file

@ -954,7 +954,7 @@ writable-files:
test "$$fail" && exit 1 || : ; \ test "$$fail" && exit 1 || : ; \
fi fi
v_etc_file = lib/version-etc.c v_etc_file = $(gnulib_dir)/lib/version-etc.c
sample-test = tests/sample-test sample-test = tests/sample-test
texi = doc/$(PACKAGE).texi texi = doc/$(PACKAGE).texi
# Make sure that the copyright date in $(v_etc_file) is up to date. # Make sure that the copyright date in $(v_etc_file) is up to date.