summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/dla.h
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/dla.h
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/dla.h')
-rw-r--r--sysdeps/ieee754/dbl-64/dla.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/sysdeps/ieee754/dbl-64/dla.h b/sysdeps/ieee754/dbl-64/dla.h
index a4d0b8b0ac..641644eeb1 100644
--- a/sysdeps/ieee754/dbl-64/dla.h
+++ b/sysdeps/ieee754/dbl-64/dla.h
@@ -17,6 +17,8 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <math.h>
+
 /***********************************************************************/
 /*MODULE_NAME: dla.h                                                   */
 /*                                                                     */
@@ -44,7 +46,7 @@
 /* z+zz = x+y exactly.                                                 */
 
 #define  EADD(x,y,z,zz)  \
-	   z=(x)+(y);  zz=(ABS(x)>ABS(y)) ? (((x)-(z))+(y)) : (((y)-(z))+(x));
+	   z=(x)+(y);  zz=(fabs(x)>fabs(y)) ? (((x)-(z))+(y)) : (((y)-(z))+(x));
 
 
 /* Exact subtraction of two single-length floating point numbers, Dekker. */
@@ -52,7 +54,7 @@
 /* z+zz = x-y exactly.                                                    */
 
 #define  ESUB(x,y,z,zz)  \
-	   z=(x)-(y);  zz=(ABS(x)>ABS(y)) ? (((x)-(z))-(y)) : ((x)-((y)+(z)));
+	   z=(x)-(y);  zz=(fabs(x)>fabs(y)) ? (((x)-(z))-(y)) : ((x)-((y)+(z)));
 
 
 /* Exact multiplication of two single-length floating point numbers,   */
@@ -94,7 +96,7 @@
 /* storage variables of type double.                                    */
 
 #define  ADD2(x, xx, y, yy, z, zz, r, s)                   \
-  r = (x) + (y);  s = (ABS (x) > ABS (y)) ?                \
+  r = (x) + (y);  s = (fabs (x) > fabs (y)) ?                \
 		      (((((x) - r) + (y)) + (yy)) + (xx)) : \
 		      (((((y) - r) + (x)) + (xx)) + (yy));  \
   z = r + s;  zz = (r - z) + s;
@@ -107,7 +109,7 @@
 /* storage variables of type double.                                      */
 
 #define  SUB2(x, xx, y, yy, z, zz, r, s)                   \
-  r = (x) - (y);  s = (ABS (x) > ABS (y)) ?                \
+  r = (x) - (y);  s = (fabs (x) > fabs (y)) ?                \
 		      (((((x) - r) - (y)) - (yy)) + (xx)) : \
 		      ((((x) - ((y) + r)) + (xx)) - (yy));  \
   z = r + s;  zz = (r - z) + s;
@@ -144,16 +146,16 @@
 
 #define  ADD2A(x, xx, y, yy, z, zz, r, rr, s, ss, u, uu, w)                 \
   r = (x) + (y);                                                            \
-  if (ABS (x) > ABS (y)) { rr = ((x) - r) + (y);  s = (rr + (yy)) + (xx); } \
+  if (fabs (x) > fabs (y)) { rr = ((x) - r) + (y);  s = (rr + (yy)) + (xx); } \
   else               { rr = ((y) - r) + (x);  s = (rr + (xx)) + (yy); }     \
   if (rr != 0.0) {                                                          \
       z = r + s;  zz = (r - z) + s; }                                       \
   else {                                                                    \
-      ss = (ABS (xx) > ABS (yy)) ? (((xx) - s) + (yy)) : (((yy) - s) + (xx));\
+      ss = (fabs (xx) > fabs (yy)) ? (((xx) - s) + (yy)) : (((yy) - s) + (xx));\
       u = r + s;                                                            \
-      uu = (ABS (r) > ABS (s))   ? ((r - u) + s)   : ((s - u) + r);         \
+      uu = (fabs (r) > fabs (s))   ? ((r - u) + s)   : ((s - u) + r);         \
       w = uu + ss;  z = u + w;                                              \
-      zz = (ABS (u) > ABS (w))   ? ((u - z) + w)   : ((w - z) + u); }
+      zz = (fabs (u) > fabs (w))   ? ((u - z) + w)   : ((w - z) + u); }
 
 
 /* Double-length subtraction, slower but more accurate than SUB2.            */
@@ -165,13 +167,13 @@
 
 #define  SUB2A(x, xx, y, yy, z, zz, r, rr, s, ss, u, uu, w)                   \
   r = (x) - (y);                                                              \
-  if (ABS (x) > ABS (y)) { rr = ((x) - r) - (y);  s = (rr - (yy)) + (xx); }   \
+  if (fabs (x) > fabs (y)) { rr = ((x) - r) - (y);  s = (rr - (yy)) + (xx); }   \
   else               { rr = (x) - ((y) + r);  s = (rr + (xx)) - (yy); }       \
   if (rr != 0.0) {                                                            \
       z = r + s;  zz = (r - z) + s; }                                         \
   else {                                                                      \
-      ss = (ABS (xx) > ABS (yy)) ? (((xx) - s) - (yy)) : ((xx) - ((yy) + s)); \
+      ss = (fabs (xx) > fabs (yy)) ? (((xx) - s) - (yy)) : ((xx) - ((yy) + s)); \
       u = r + s;                                                              \
-      uu = (ABS (r) > ABS (s))   ? ((r - u) + s)   : ((s - u) + r);           \
+      uu = (fabs (r) > fabs (s))   ? ((r - u) + s)   : ((s - u) + r);           \
       w = uu + ss;  z = u + w;                                                \
-      zz = (ABS (u) > ABS (w))   ? ((u - z) + w)   : ((w - z) + u); }
+      zz = (fabs (u) > fabs (w))   ? ((u - z) + w)   : ((w - z) + u); }