log10l: Work around log10l-ieee test failure on IRIX 6.5.
authorBruno Haible <bruno@clisp.org>
Sun, 1 Apr 2012 17:29:21 +0000 (19:29 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 1 Apr 2012 17:29:21 +0000 (19:29 +0200)
* 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.

ChangeLog
doc/posix-functions/log10l.texi
lib/log10l.c
modules/log10l

index 432d422..3d8f7a3 100644 (file)
--- 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,
index eb8eec8..82841c6 100644 (file)
@@ -23,6 +23,9 @@ OSF/1 5.1.
 @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:
index f108538..eb83a11 100644 (file)
@@ -29,6 +29,8 @@ log10l (long double x)
 
 #elif HAVE_LOG10L
 
+# include <float.h>
+
 long double
 log10l (long double x)
 # undef log10l
@@ -37,7 +39,15 @@ log10l (long double x)
   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
index cad6bbe..32aa959 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 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: