changeset 16748:c023d893c23f

log10l: Work around log10l-ieee test failure on IRIX 6.5. * lib/log10l.c: Include <float.h> (log10l): On IRIX, normalize the +Infinity value. * modules/log10l (Depends-on): Add 'float'. * doc/posix-functions/log10l.texi: Mention the IRIX problem with +Infinity.
author Bruno Haible <bruno@clisp.org>
date Sun, 01 Apr 2012 19:29:21 +0200
parents 676471a1cb33
children 2c1499f688aa
files ChangeLog doc/posix-functions/log10l.texi lib/log10l.c modules/log10l
diffstat 4 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-04-01  Bruno Haible  <bruno@clisp.org>
 
+	log10l: Work around log10l-ieee test failure on IRIX 6.5.
+	* lib/log10l.c: Include <float.h>
+	(log10l): On IRIX, normalize the +Infinity value.
+	* modules/log10l (Depends-on): Add 'float'.
+	* doc/posix-functions/log10l.texi: Mention the IRIX problem with
+	+Infinity.
+
 	log10f-ieee: Work around test failure on NetBSD 5.1.
 	* m4/log10f-ieee.m4: New file.
 	* m4/log10f.m4 (gl_FUNC_LOG10F): If gl_FUNC_LOG10F_IEEE is present,
--- a/doc/posix-functions/log10l.texi
+++ b/doc/posix-functions/log10l.texi
@@ -23,6 +23,9 @@
 @item
 This function returns an unnormalized negative infinity for a minus zero argument on some platforms:
 IRIX 6.5.
+@item
+This function returns an unnormalized positive infinity for a positive infinite argument on some platforms:
+IRIX 6.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/lib/log10l.c
+++ b/lib/log10l.c
@@ -29,6 +29,8 @@
 
 #elif HAVE_LOG10L
 
+# include <float.h>
+
 long double
 log10l (long double x)
 # undef log10l
@@ -37,7 +39,15 @@
   if (x == 0.0L)
     /* Return -Infinity.  */
     return -1.0L / 0.0L;
-  return log10l (x);
+  {
+    long double y = log10l (x);
+# ifdef __sgi
+    /* Normalize the +Infinity value.  */
+    if (y > LDBL_MAX)
+      y = 1.0L / 0.0L;
+# endif
+    return y;
+  }
 }
 
 #else
--- a/modules/log10l
+++ b/modules/log10l
@@ -9,6 +9,7 @@
 math
 extensions
 log10           [{ test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+float           [{ test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
 logl            [{ test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
 
 configure.ac: