NEWS.stable: log cherry-pick [e446f25]->[c092018] relocatable-shell: Update suggested...
[gnulib.git] / lib / sqrtl.c
index 8c492f2..4f7c9f1 100644 (file)
@@ -1,7 +1,7 @@
 /* Emulation for sqrtl.
    Contributed by Paolo Bonzini
 
-   Copyright 2002, 2003, 2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright 2002-2003, 2007, 2009-2014 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
 /* Specification.  */
 #include <math.h>
 
-#include <float.h>
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+long double
+sqrtl (long double x)
+{
+  return sqrt (x);
+}
+
+#else
+
+# include <float.h>
 
 /* A simple Newton-Raphson method. */
 long double
-sqrtl(long double x)
+sqrtl (long double x)
 {
   long double delta, y;
   int exponent;
@@ -38,7 +48,7 @@ sqrtl(long double x)
 
   /* Check for negative numbers */
   if (x < 0.0L)
-    return (long double) sqrt(-1);
+    return (long double) sqrt (-1);
 
   /* Check for zero and infinites */
   if (x + x == x)
@@ -57,3 +67,5 @@ sqrtl(long double x)
 
   return y;
 }
+
+#endif