* lib/math.in.h (FP_ILOGB0, FP_ILOGBNAN): Define fallback.
* tests/test-math.c: Check that FP_ILOGB0, FP_ILOGBNAN are defined.
(main): Check their values.
* doc/posix-headers/math.texi: Mention the FP_ILOGB0, FP_ILOGBNAN
problem.
2012-04-03 Bruno Haible <bruno@clisp.org>
+ math: Provide FP_ILOGB0 and FP_ILOGBNAN.
+ * lib/math.in.h (FP_ILOGB0, FP_ILOGBNAN): Define fallback.
+ * tests/test-math.c: Check that FP_ILOGB0, FP_ILOGBNAN are defined.
+ (main): Check their values.
+ * doc/posix-headers/math.texi: Mention the FP_ILOGB0, FP_ILOGBNAN
+ problem.
+
+2012-04-03 Bruno Haible <bruno@clisp.org>
+
Tests for module 'logbl-ieee'.
* modules/logbl-ieee-tests: New file.
* tests/test-logbl-ieee.c: New file.
The macros @code{HUGE_VALF} and @code{HUGE_VALL} are not defined on some
platforms:
glibc/HPPA, glibc/SPARC, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9.
+
+@item
+The macros @code{FP_ILOGB0} and @code{FP_ILOGBNAN} are not defined on some
+platforms:
+NetBSD 5.1, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9.
@end itemize
Portability problems not fixed by Gnulib:
# endif
#endif
+
+/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */
+#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
+# if defined __NetBSD__ || defined __sgi
+ /* NetBSD, IRIX 6.5: match what ilogb() does */
+# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
+# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# elif defined _AIX
+ /* AIX 5.1: match what ilogb() does in AIX >= 5.2 */
+# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
+# define FP_ILOGBNAN 2147483647 /* INT_MAX */
+# elif defined __sun
+ /* Solaris 9: match what ilogb() does */
+# define FP_ILOGB0 (- 2147483647) /* - INT_MAX */
+# define FP_ILOGBNAN 2147483647 /* INT_MAX */
+# else
+ /* Gnulib defined values. */
+# define FP_ILOGB0 (- 2147483647) /* - INT_MAX */
+# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#endif
+
+
#if @GNULIB_ACOSF@
# if !@HAVE_ACOSF@
# undef acosf
choke me
#endif
+#ifndef FP_ILOGB0
+# error FP_ILOGB0 should be defined
+choke me
+#endif
+
+#ifndef FP_ILOGBNAN
+# error FP_ILOGBNAN should be defined
+choke me
+#endif
+
+#include <limits.h>
+
#include "macros.h"
#if 0
ASSERT (numeric_equall (HUGE_VALL, HUGE_VALL + HUGE_VALL));
+ /* Check the value of FP_ILOGB0. */
+ ASSERT (FP_ILOGB0 == INT_MIN || FP_ILOGB0 == - INT_MAX);
+
+ /* Check the value of FP_ILOGBNAN. */
+ ASSERT (FP_ILOGBNAN == INT_MIN || FP_ILOGBNAN == INT_MAX);
+
return 0;
}