about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_remainder.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2015-05-15 10:53:55 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2015-05-15 11:04:40 +0000
commit0e9be4db8f655d3dc006c5b101f15a5912a5846f (patch)
treeb03088c533aab59ee41220bd469433d2a2abb527 /sysdeps/ieee754/dbl-64/e_remainder.c
parentfbc68f03b0e56db6a07d789fd403eb79d726fe96 (diff)
downloadglibc-0e9be4db8f655d3dc006c5b101f15a5912a5846f.tar.gz
glibc-0e9be4db8f655d3dc006c5b101f15a5912a5846f.tar.xz
glibc-0e9be4db8f655d3dc006c5b101f15a5912a5846f.zip
Remove various ABS macros and replace uses with fabs (or in one case abs)
which is more efficient on all targets.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_remainder.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_remainder.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c
index ba479b419a..7f3a02b3c2 100644
--- a/sysdeps/ieee754/dbl-64/e_remainder.c
+++ b/sysdeps/ieee754/dbl-64/e_remainder.c
@@ -33,6 +33,7 @@
 #include "mydefs.h"
 #include "urem.h"
 #include "MathLib.h"
+#include <math.h>
 #include <math_private.h>
 
 /**************************************************************************/
@@ -66,7 +67,7 @@ __ieee754_remainder (double x, double y)
 	    return (xx != 0) ? xx : ((x > 0) ? ZERO.x : nZERO.x);
 	  else
 	    {
-	      if (ABS (xx) > 0.5 * t.x)
+	      if (fabs (xx) > 0.5 * t.x)
 		return (z > d) ? xx - t.x : xx + t.x;
 	      else
 		return xx;
@@ -98,10 +99,10 @@ __ieee754_remainder (double x, double y)
 	  z = u.x * r.x;
 	  d = (z + big.x) - big.x;
 	  u.x = (u.x - d * w.x) - d * ww.x;
-	  if (ABS (u.x) < 0.5 * t.x)
+	  if (fabs (u.x) < 0.5 * t.x)
 	    return (u.x != 0) ? u.x : ((x > 0) ? ZERO.x : nZERO.x);
 	  else
-	  if (ABS (u.x) > 0.5 * t.x)
+	  if (fabs (u.x) > 0.5 * t.x)
 	    return (d > z) ? u.x + t.x : u.x - t.x;
 	  else
 	    {
@@ -114,7 +115,7 @@ __ieee754_remainder (double x, double y)
     {
       if (kx < 0x7fe00000 && ky < 0x7ff00000 && (ky > 0 || t.i[LOW_HALF] != 0))
 	{
-	  y = ABS (y) * t128.x;
+	  y = fabs (y) * t128.x;
 	  z = __ieee754_remainder (x, y) * t128.x;
 	  z = __ieee754_remainder (z, y) * tm128.x;
 	  return z;
@@ -124,10 +125,10 @@ __ieee754_remainder (double x, double y)
 	  if ((kx & 0x7ff00000) == 0x7fe00000 && ky < 0x7ff00000 &&
               (ky > 0 || t.i[LOW_HALF] != 0))
 	    {
-	      y = ABS (y);
+	      y = fabs (y);
 	      z = 2.0 * __ieee754_remainder (0.5 * x, y);
-	      d = ABS (z);
-	      if (d <= ABS (d - y))
+	      d = fabs (z);
+	      if (d <= fabs (d - y))
 		return z;
 	      else
 		return (z > 0) ? z - y : z + y;