about summary refs log tree commit diff
path: root/sysdeps/powerpc/fpu/e_hypotf.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-03-15 15:16:31 +0100
committerAndreas Schwab <schwab@linux-m68k.org>2012-03-15 18:13:52 +0100
commit11e0098ef008db301a82b753dda466dc61cdd0bc (patch)
treed5c7991f6295c4f87005d1e9deb5d220ecc3d4a5 /sysdeps/powerpc/fpu/e_hypotf.c
parente85b09d0642e546d3049a33bf1662404b374d376 (diff)
downloadglibc-11e0098ef008db301a82b753dda466dc61cdd0bc.tar.gz
glibc-11e0098ef008db301a82b753dda466dc61cdd0bc.tar.xz
glibc-11e0098ef008db301a82b753dda466dc61cdd0bc.zip
Use double precision instead of scaling for powerpc __ieee754_hypotf
Diffstat (limited to 'sysdeps/powerpc/fpu/e_hypotf.c')
-rw-r--r--sysdeps/powerpc/fpu/e_hypotf.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/sysdeps/powerpc/fpu/e_hypotf.c b/sysdeps/powerpc/fpu/e_hypotf.c
index 3838f53d85..92e824dafc 100644
--- a/sysdeps/powerpc/fpu/e_hypotf.c
+++ b/sysdeps/powerpc/fpu/e_hypotf.c
@@ -1,5 +1,5 @@
 /* Pythagorean addition using floats
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
 
@@ -22,21 +22,13 @@
 
 
 static const float two30  = 1.0737418e09;
-static const float two50  = 1.1259000e15;
-static const float two60  = 1.1529221e18;
-static const float two126 = 8.5070592e+37;
-static const float twoM50 = 8.8817842e-16;
-static const float twoM60 = 6.7762644e-21;
-static const float pdnum  = 1.1754939e-38;
-
 
 /* __ieee754_hypotf(x,y)
- *
- * This a FP only version without any FP->INT conversion.
- * It is similar to default C version, making appropriates
- * overflow and underflows checks as well scaling when it
- * is needed.
- */
+
+   This a FP only version without any FP->INT conversion.
+   It is similar to default C version, making appropriates
+   overflow and underflows checks as using double precision
+   instead of scaling.  */
 
 #ifdef _ARCH_PWR7
 /* POWER7 isinf and isnan optimizations are fast. */
@@ -92,27 +84,7 @@ __ieee754_hypotf (float x, float y)
     {
       return x + y;
     }
-  if (x > two50)
-    {
-      x *= twoM60;
-      y *= twoM60;
-      return __ieee754_sqrtf (x * x + y * y) / twoM60;
-    }
-  if (y < twoM50)
-    {
-      if (y <= pdnum)
-	{
-	  x *= two126;
-	  y *= two126;
-	  return __ieee754_sqrtf (x * x + y * y) / two126;
-	}
-      else
-	{
-	  x *= two60;
-	  y *= two60;
-	  return __ieee754_sqrtf (x * x + y * y) / two60;
-	}
-    }
-  return __ieee754_sqrtf (x * x + y * y);
+
+  return __ieee754_sqrt ((double) x * x + (double) y * y);
 }
 strong_alias (__ieee754_hypotf, __hypotf_finite)