+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.
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
@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>
(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