NEWS.stable: log cherry-pick [e446f25]->[c092018] relocatable-shell: Update suggested...
[gnulib.git] / lib / log10l.c
index f108538..271d179 100644 (file)
@@ -1,5 +1,5 @@
 /* Base 10 logarithmic function.
-   Copyright (C) 2012 Free Software Foundation, Inc.
+   Copyright (C) 2012-2014 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -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