]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix sample isinf definition.
authorEric Blake <ebb9@byu.net>
Sat, 20 Sep 2008 22:19:40 +0000 (16:19 -0600)
committerEric Blake <ebb9@byu.net>
Sat, 20 Sep 2008 22:21:17 +0000 (16:21 -0600)
* doc/autoconf.texi (Function Portability) <isinf>: Filter out NaN
first.
* THANKS: Update.
Reported by David Cournapeau.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
THANKS
doc/autoconf.texi

index f0feca6615336d90ee2d6ff18671fe0d2d91607a..c277148985a4fd6d70d01299351d79c13e3fce3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-20  Eric Blake  <ebb9@byu.net>
+
+       Fix sample isinf definition.
+       * doc/autoconf.texi (Function Portability) <isinf>: Filter out NaN
+       first.
+       * THANKS: Update.
+       Reported by David Cournapeau.
+
 2008-09-16  Eric Blake  <ebb9@byu.net>
 
        Fix Erlang regression, introduced 2006-11-17.
diff --git a/THANKS b/THANKS
index f39e949740f34c68ba19fc15f4e5a2519d2c0441..366bf62802bac3c716763ae7b9fbf4399e4e4337 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -81,6 +81,7 @@ Dave Erickson               retrorandomaccess@hotmail.com
 Dave Love                   fx@gnu.org
 David Byron                 dbyron@hheld.com
 David Carter                david@carter.net
+David Cournapeau            david@ar.media.kyoto-u.ac.jp
 David Fang                  fang@csl.cornell.edu
 David J. MacKenzie          djm@uunet.uu.net
 David M. Lloyd              dmlloyd@tds.net
index 2b1d165cb887bc3dc28fae33d3aee5fbd6d66b02..fa9b6efc4d4fe5fbd691438754b59a09ed377d0a 100644 (file)
@@ -4318,7 +4318,9 @@ typically assume @code{double} arguments.  On such a system,
 @code{isinf} incorrectly returns true for a finite @code{long double}
 argument that is outside the range of @code{double}.
 
-To work around this porting mess, you can use code like the following.
+The best workaround for these issues is to use gnulib modules
+@code{isinf} and @code{isnan} (@pxref{Gnulib}).  But a lighter weight
+solution involves code like the following.
 
 @smallexample
 #include <math.h>
@@ -4338,17 +4340,20 @@ static inline int isnan_ld (long double x) @{ return x != x; @}
     (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
      : sizeof (x) == sizeof (double) ? isinf_d (x) \
      : isinf_f (x))
-static inline int isinf_f  (float       x) @{ return isnan (x - x); @}
-static inline int isinf_d  (double      x) @{ return isnan (x - x); @}
-static inline int isinf_ld (long double x) @{ return isnan (x - x); @}
+static inline int isinf_f  (float       x)
+@{ return !isnan (x) && isnan (x - x); @}
+static inline int isinf_d  (double      x)
+@{ return !isnan (x) && isnan (x - x); @}
+static inline int isinf_ld (long double x)
+@{ return !isnan (x) && isnan (x - x); @}
 #endif
 @end smallexample
 
 Use @code{AC_C_INLINE} (@pxref{C Compiler}) so that this code works on
 compilers that lack the @code{inline} keyword.  Some optimizing
 compilers mishandle these definitions, but systems with that bug
-typically have missing or broken @code{isnan} functions anyway, so it's
-probably not worth worrying about.
+typically have many other floating point corner-case compliance problems
+anyway, so it's probably not worth worrying about.
 
 @item @code{malloc}
 @c @fuindex malloc