aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
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
parentfbc68f03b0e56db6a07d789fd403eb79d726fe96 (diff)
downloadglibc-0e9be4db8f655d3dc006c5b101f15a5912a5846f.zip
glibc-0e9be4db8f655d3dc006c5b101f15a5912a5846f.tar.gz
glibc-0e9be4db8f655d3dc006c5b101f15a5912a5846f.tar.bz2
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')
-rw-r--r--sysdeps/ieee754/dbl-64/branred.c3
-rw-r--r--sysdeps/ieee754/dbl-64/dla.h26
-rw-r--r--sysdeps/ieee754/dbl-64/e_asin.c28
-rw-r--r--sysdeps/ieee754/dbl-64/e_log.c3
-rw-r--r--sysdeps/ieee754/dbl-64/e_pow.c12
-rw-r--r--sysdeps/ieee754/dbl-64/e_remainder.c15
-rw-r--r--sysdeps/ieee754/dbl-64/mpa.h2
-rw-r--r--sysdeps/ieee754/dbl-64/mpatan.c3
-rw-r--r--sysdeps/ieee754/dbl-64/mydefs.h1
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c79
-rw-r--r--sysdeps/ieee754/dbl-64/sincos32.c3
11 files changed, 90 insertions, 85 deletions
diff --git a/sysdeps/ieee754/dbl-64/branred.c b/sysdeps/ieee754/dbl-64/branred.c
index 331cde2..7757a9c 100644
--- a/sysdeps/ieee754/dbl-64/branred.c
+++ b/sysdeps/ieee754/dbl-64/branred.c
@@ -35,6 +35,7 @@
#include "endian.h"
#include "mydefs.h"
#include "branred.h"
+#include <math.h>
#include <math_private.h>
#ifndef SECTION
@@ -123,7 +124,7 @@ __branred(double x, double *a, double *aa)
sum=sum1+sum2;
b=b1+b2;
- bb = (ABS(b1)>ABS(b2))? (b1-b)+b2 : (b2-b)+b1;
+ bb = (fabs(b1)>fabs(b2))? (b1-b)+b2 : (b2-b)+b1;
if (b > 0.5)
{b-=1.0; sum+=1.0;}
else if (b < -0.5)
diff --git a/sysdeps/ieee754/dbl-64/dla.h b/sysdeps/ieee754/dbl-64/dla.h
index a4d0b8b..641644e 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); }
diff --git a/sysdeps/ieee754/dbl-64/e_asin.c b/sysdeps/ieee754/dbl-64/e_asin.c
index b87e557..a7684d1 100644
--- a/sysdeps/ieee754/dbl-64/e_asin.c
+++ b/sysdeps/ieee754/dbl-64/e_asin.c
@@ -104,9 +104,9 @@ __ieee754_asin(double x){
__doasin(x,0,w);
if (w[0]==(w[0]+1.00000001*w[1])) return w[0];
else {
- y=ABS(x);
- res=ABS(w[0]);
- res1=ABS(w[0]+1.1*w[1]);
+ y=fabs(x);
+ res=fabs(w[0]);
+ res1=fabs(w[0]+1.1*w[1]);
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
}
@@ -135,11 +135,11 @@ __ieee754_asin(double x){
res1=res+1.1*cor;
z=0.5*(res1-res);
__dubsin(res,z,w);
- z=(w[0]-ABS(x))+w[1];
+ z=(w[0]-fabs(x))+w[1];
if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
else {
- y=ABS(x);
+ y=fabs(x);
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
}
@@ -168,11 +168,11 @@ __ieee754_asin(double x){
res1=res+1.1*cor;
z=0.5*(res1-res);
__dubsin(res,z,w);
- z=(w[0]-ABS(x))+w[1];
+ z=(w[0]-fabs(x))+w[1];
if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
else {
- y=ABS(x);
+ y=fabs(x);
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
}
@@ -203,11 +203,11 @@ __ieee754_asin(double x){
y=hp0.x-res;
z=((hp0.x-y)-res)+(hp1.x-z);
__dubcos(y,z,w);
- z=(w[0]-ABS(x))+w[1];
+ z=(w[0]-fabs(x))+w[1];
if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
else {
- y=ABS(x);
+ y=fabs(x);
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
}
@@ -241,11 +241,11 @@ __ieee754_asin(double x){
z=y+hp1.x;
y=(y-z)+hp1.x;
__dubcos(z,y,w);
- z=(w[0]-ABS(x))+w[1];
+ z=(w[0]-fabs(x))+w[1];
if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
else {
- y=ABS(x);
+ y=fabs(x);
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
}
@@ -280,11 +280,11 @@ __ieee754_asin(double x){
z=y+hp1.x;
y=(y-z)+hp1.x;
__dubcos(z,y,w);
- z=(w[0]-ABS(x))+w[1];
+ z=(w[0]-fabs(x))+w[1];
if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);
else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);
else {
- y=ABS(x);
+ y=fabs(x);
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
}
@@ -318,7 +318,7 @@ __ieee754_asin(double x){
cor = (res1-res)+cor;
if (res==(res+1.0000001*cor)) return (m>0)?res:-res;
else {
- y=ABS(x);
+ y=fabs(x);
res1=res+1.1*cor;
return (m>0)?__sin32(y,res,res1):-__sin32(y,res,res1);
}
diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c
index 7a498e8..a9117fb 100644
--- a/sysdeps/ieee754/dbl-64/e_log.c
+++ b/sysdeps/ieee754/dbl-64/e_log.c
@@ -38,6 +38,7 @@
#include <dla.h>
#include "mpa.h"
#include "MathLib.h"
+#include <math.h>
#include <math_private.h>
#include <stap-probe.h>
@@ -93,7 +94,7 @@ __ieee754_log (double x)
/* Regular values of x */
w = x - 1;
- if (__glibc_likely (ABS (w) > U03))
+ if (__glibc_likely (fabs (w) > U03))
goto case_03;
/* log (1) is +0 in all rounding modes. */
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index ba932f4..8a1f72f 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -97,7 +97,7 @@ __ieee754_pow (double x, double y)
/* Avoid internal underflow for tiny y. The exact value of y does
not matter if |y| <= 2**-64. */
- if (ABS (y) < 0x1p-64)
+ if (fabs (y) < 0x1p-64)
y = y < 0 ? -0x1p-64 : 0x1p-64;
z = log1 (x, &aa, &error); /* x^y =e^(y log (X)) */
t = y * CN;
@@ -110,7 +110,7 @@ __ieee754_pow (double x, double y)
aa = y2 * a1 + y * a2;
a1 = a + aa;
a2 = (a - a1) + aa;
- error = error * ABS (y);
+ error = error * fabs (y);
t = __exp1 (a1, a2, 1.9e16 * error); /* return -10 or 0 if wasn't computed exactly */
retval = (t > 0) ? t : power1 (x, y);
}
@@ -127,7 +127,7 @@ __ieee754_pow (double x, double y)
if (((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] != 0)
|| (v.i[HIGH_HALF] & 0x7fffffff) > 0x7ff00000) /* NaN */
return y;
- if (ABS (y) > 1.0e20)
+ if (fabs (y) > 1.0e20)
return (y > 0) ? 0 : 1.0 / 0.0;
k = checkint (y);
if (k == -1)
@@ -232,7 +232,7 @@ power1 (double x, double y)
aa = ((y1 * a1 - a) + y1 * a2 + y2 * a1) + y2 * a2 + aa * y;
a1 = a + aa;
a2 = (a - a1) + aa;
- error = error * ABS (y);
+ error = error * fabs (y);
t = __exp1 (a1, a2, 1.9e16 * error);
return (t >= 0) ? t : __slowpow (x, y, z);
}
@@ -292,7 +292,7 @@ log1 (double x, double *delta, double *error)
* (r7 + t * r8)))))
- 0.5 * t2 * (t + t1));
res = e1 + e2;
- *error = 1.0e-21 * ABS (t);
+ *error = 1.0e-21 * fabs (t);
*delta = (e1 - res) + e2;
return res;
} /* |x-1| < 1.5*2**-10 */
@@ -398,7 +398,7 @@ my_log2 (double x, double *delta, double *error)
e2 = ((((t - e1) + z) + zz) + t * t * t
* (ss3 + t * (s4 + t * (s5 + t * (s6 + t * (s7 + t * s8))))));
res = e1 + e2;
- *error = 1.0e-25 * ABS (t);
+ *error = 1.0e-25 * fabs (t);
*delta = (e1 - res) + e2;
return res;
}
diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c
index ba479b4..7f3a02b 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;
diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
index 9e87ea6..47dd6c4 100644
--- a/sysdeps/ieee754/dbl-64/mpa.h
+++ b/sysdeps/ieee754/dbl-64/mpa.h
@@ -81,8 +81,6 @@ extern const mp_no __mptwo;
#define EY y->e
#define EZ z->e
-#define ABS(x) ((x) < 0 ? -(x) : (x))
-
#ifndef RADIXI
# define RADIXI 0x1.0p-24 /* 2^-24 */
#endif
diff --git a/sysdeps/ieee754/dbl-64/mpatan.c b/sysdeps/ieee754/dbl-64/mpatan.c
index 004ed7a..d9ac3d6 100644
--- a/sysdeps/ieee754/dbl-64/mpatan.c
+++ b/sysdeps/ieee754/dbl-64/mpatan.c
@@ -32,6 +32,7 @@
#include "endian.h"
#include "mpa.h"
+#include <math.h>
#ifndef SECTION
# define SECTION
@@ -65,7 +66,7 @@ __mpatan (mp_no *x, mp_no *y, int p)
else
{
__mp_dbl (x, &dx, p);
- dx = ABS (dx);
+ dx = fabs (dx);
for (m = 6; m > 0; m--)
{
if (dx > __atan_xm[m].d)
diff --git a/sysdeps/ieee754/dbl-64/mydefs.h b/sysdeps/ieee754/dbl-64/mydefs.h
index f24a89c..3158514 100644
--- a/sysdeps/ieee754/dbl-64/mydefs.h
+++ b/sysdeps/ieee754/dbl-64/mydefs.h
@@ -30,7 +30,6 @@
typedef int int4;
typedef union { int4 i[2]; double x; } mynumber;
-#define ABS(x) (((x) > 0) ? (x) : -(x))
#define max(x, y) (((y) > (x)) ? (y) : (x))
#define min(x, y) (((y) < (x)) ? (y) : (x))
#endif
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 4c38fa0..ea89ad5 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -52,6 +52,7 @@
#include "mydefs.h"
#include "usncs.h"
#include "MathLib.h"
+#include <math.h>
#include <math_private.h>
#include <fenv.h>
@@ -355,7 +356,7 @@ __sin (double x)
da = xn * mp3;
a = y - da;
da = (y - a) - da;
- eps = ABS (x) * 1.2e-30;
+ eps = fabs (x) * 1.2e-30;
switch (n)
{ /* quarter of unit circle */
@@ -530,7 +531,7 @@ __cos (double x)
else if (k < 0x3feb6000)
{ /* 2^-27 < |x| < 0.855469 */
- y = ABS (x);
+ y = fabs (x);
u.x = big + y;
y = y - (u.x - big);
res = do_cos (u, y, &cor);
@@ -539,7 +540,7 @@ __cos (double x)
else if (k < 0x400368fd)
{ /* 0.855469 <|x|<2.426265 */ ;
- y = hp0 - ABS (x);
+ y = hp0 - fabs (x);
a = y + hp1;
da = (y - a) + hp1;
xx = a * a;
@@ -582,7 +583,7 @@ __cos (double x)
da = xn * mp3;
a = y - da;
da = (y - a) - da;
- eps = ABS (x) * 1.2e-30;
+ eps = fabs (x) * 1.2e-30;
switch (n)
{
@@ -741,7 +742,7 @@ slow (double x)
return res;
else
{
- __dubsin (ABS (x), 0, w);
+ __dubsin (fabs (x), 0, w);
if (w[0] == w[0] + 1.000000001 * w[1])
return (x > 0) ? w[0] : -w[0];
else
@@ -760,7 +761,7 @@ slow1 (double x)
{
mynumber u;
double w[2], y, cor, res;
- y = ABS (x);
+ y = fabs (x);
u.x = big + y;
y = y - (u.x - big);
res = do_sin_slow (u, y, 0, 0, &cor);
@@ -768,7 +769,7 @@ slow1 (double x)
return (x > 0) ? res : -res;
else
{
- __dubsin (ABS (x), 0, w);
+ __dubsin (fabs (x), 0, w);
if (w[0] == w[0] + 1.000000005 * w[1])
return (x > 0) ? w[0] : -w[0];
else
@@ -787,7 +788,7 @@ slow2 (double x)
mynumber u;
double w[2], y, y1, y2, cor, res, del;
- y = ABS (x);
+ y = fabs (x);
y = hp0 - y;
if (y >= 0)
{
@@ -806,7 +807,7 @@ slow2 (double x)
return (x > 0) ? res : -res;
else
{
- y = ABS (x) - hp0;
+ y = fabs (x) - hp0;
y1 = y - hp1;
y2 = (y - y1) - hp1;
__docos (y1, y2, w);
@@ -834,9 +835,9 @@ sloww (double x, double dx, double orig)
int4 n;
res = TAYLOR_SLOW (x, dx, cor);
if (cor > 0)
- cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
+ cor = 1.0005 * cor + fabs (orig) * 3.1e-30;
else
- cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
+ cor = 1.0005 * cor - fabs (orig) * 3.1e-30;
if (res == res + cor)
return res;
@@ -844,9 +845,9 @@ sloww (double x, double dx, double orig)
{
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
if (w[1] > 0)
- cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-30;
+ cor = 1.000000001 * w[1] + fabs (orig) * 1.1e-30;
else
- cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-30;
+ cor = 1.000000001 * w[1] - fabs (orig) * 1.1e-30;
if (w[0] == w[0] + cor)
return (x > 0) ? w[0] : -w[0];
@@ -870,9 +871,9 @@ sloww (double x, double dx, double orig)
}
(a > 0) ? __dubsin (a, da, w) : __dubsin (-a, -da, w);
if (w[1] > 0)
- cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-40;
+ cor = 1.000000001 * w[1] + fabs (orig) * 1.1e-40;
else
- cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-40;
+ cor = 1.000000001 * w[1] - fabs (orig) * 1.1e-40;
if (w[0] == w[0] + cor)
return (a > 0) ? w[0] : -w[0];
@@ -898,7 +899,7 @@ sloww1 (double x, double dx, double orig, int m)
u.x = big + x;
y = x - (u.x - big);
- res = do_sin_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
+ res = do_sin_slow (u, y, dx, 3.1e-30 * fabs (orig), &cor);
if (res == res + cor)
return (m > 0) ? res : -res;
@@ -907,9 +908,9 @@ sloww1 (double x, double dx, double orig, int m)
__dubsin (x, dx, w);
if (w[1] > 0)
- cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] + 1.1e-30 * fabs (orig);
else
- cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] - 1.1e-30 * fabs (orig);
if (w[0] == w[0] + cor)
return (m > 0) ? w[0] : -w[0];
@@ -934,7 +935,7 @@ sloww2 (double x, double dx, double orig, int n)
u.x = big + x;
y = x - (u.x - big);
- res = do_cos_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
+ res = do_cos_slow (u, y, dx, 3.1e-30 * fabs (orig), &cor);
if (res == res + cor)
return (n & 2) ? -res : res;
@@ -943,9 +944,9 @@ sloww2 (double x, double dx, double orig, int n)
__docos (x, dx, w);
if (w[1] > 0)
- cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] + 1.1e-30 * fabs (orig);
else
- cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] - 1.1e-30 * fabs (orig);
if (w[0] == w[0] + cor)
return (n & 2) ? -w[0] : w[0];
@@ -1000,7 +1001,7 @@ bsloww1 (double x, double dx, double orig, int n)
mynumber u;
double w[2], y, cor, res;
- y = ABS (x);
+ y = fabs (x);
u.x = big + y;
y = y - (u.x - big);
dx = (x > 0) ? dx : -dx;
@@ -1009,7 +1010,7 @@ bsloww1 (double x, double dx, double orig, int n)
return (x > 0) ? res : -res;
else
{
- __dubsin (ABS (x), dx, w);
+ __dubsin (fabs (x), dx, w);
if (w[1] > 0)
cor = 1.000000005 * w[1] + 1.1e-24;
@@ -1037,7 +1038,7 @@ bsloww2 (double x, double dx, double orig, int n)
mynumber u;
double w[2], y, cor, res;
- y = ABS (x);
+ y = fabs (x);
u.x = big + y;
y = y - (u.x - big);
dx = (x > 0) ? dx : -dx;
@@ -1046,7 +1047,7 @@ bsloww2 (double x, double dx, double orig, int n)
return (n & 2) ? -res : res;
else
{
- __docos (ABS (x), dx, w);
+ __docos (fabs (x), dx, w);
if (w[1] > 0)
cor = 1.000000005 * w[1] + 1.1e-24;
@@ -1072,7 +1073,7 @@ cslow2 (double x)
mynumber u;
double w[2], y, cor, res;
- y = ABS (x);
+ y = fabs (x);
u.x = big + y;
y = y - (u.x - big);
res = do_cos_slow (u, y, 0, 0, &cor);
@@ -1080,7 +1081,7 @@ cslow2 (double x)
return res;
else
{
- y = ABS (x);
+ y = fabs (x);
__docos (y, 0, w);
if (w[0] == w[0] + 1.000000005 * w[1])
return w[0];
@@ -1109,9 +1110,9 @@ csloww (double x, double dx, double orig)
res = TAYLOR_SLOW (x, dx, cor);
if (cor > 0)
- cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
+ cor = 1.0005 * cor + fabs (orig) * 3.1e-30;
else
- cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
+ cor = 1.0005 * cor - fabs (orig) * 3.1e-30;
if (res == res + cor)
return res;
@@ -1120,9 +1121,9 @@ csloww (double x, double dx, double orig)
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
if (w[1] > 0)
- cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-30;
+ cor = 1.000000001 * w[1] + fabs (orig) * 1.1e-30;
else
- cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-30;
+ cor = 1.000000001 * w[1] - fabs (orig) * 1.1e-30;
if (w[0] == w[0] + cor)
return (x > 0) ? w[0] : -w[0];
@@ -1147,9 +1148,9 @@ csloww (double x, double dx, double orig)
(a > 0) ? __dubsin (a, da, w) : __dubsin (-a, -da, w);
if (w[1] > 0)
- cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-40;
+ cor = 1.000000001 * w[1] + fabs (orig) * 1.1e-40;
else
- cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-40;
+ cor = 1.000000001 * w[1] - fabs (orig) * 1.1e-40;
if (w[0] == w[0] + cor)
return (a > 0) ? w[0] : -w[0];
@@ -1175,7 +1176,7 @@ csloww1 (double x, double dx, double orig, int m)
u.x = big + x;
y = x - (u.x - big);
- res = do_sin_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
+ res = do_sin_slow (u, y, dx, 3.1e-30 * fabs (orig), &cor);
if (res == res + cor)
return (m > 0) ? res : -res;
@@ -1183,9 +1184,9 @@ csloww1 (double x, double dx, double orig, int m)
{
__dubsin (x, dx, w);
if (w[1] > 0)
- cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] + 1.1e-30 * fabs (orig);
else
- cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] - 1.1e-30 * fabs (orig);
if (w[0] == w[0] + cor)
return (m > 0) ? w[0] : -w[0];
else
@@ -1210,7 +1211,7 @@ csloww2 (double x, double dx, double orig, int n)
u.x = big + x;
y = x - (u.x - big);
- res = do_cos_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
+ res = do_cos_slow (u, y, dx, 3.1e-30 * fabs (orig), &cor);
if (res == res + cor)
return (n) ? -res : res;
@@ -1218,9 +1219,9 @@ csloww2 (double x, double dx, double orig, int n)
{
__docos (x, dx, w);
if (w[1] > 0)
- cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] + 1.1e-30 * fabs (orig);
else
- cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
+ cor = 1.000000005 * w[1] - 1.1e-30 * fabs (orig);
if (w[0] == w[0] + cor)
return (n) ? -w[0] : w[0];
else
diff --git a/sysdeps/ieee754/dbl-64/sincos32.c b/sysdeps/ieee754/dbl-64/sincos32.c
index 01cdd30..d942a1f 100644
--- a/sysdeps/ieee754/dbl-64/sincos32.c
+++ b/sysdeps/ieee754/dbl-64/sincos32.c
@@ -42,6 +42,7 @@
#include "endian.h"
#include "mpa.h"
#include "sincos32.h"
+#include <math.h>
#include <math_private.h>
#include <stap-probe.h>
@@ -318,7 +319,7 @@ __mpranred (double x, mp_no *y, int p)
int i, k, n;
mp_no a, b, c;
- if (ABS (x) < 2.8e14)
+ if (fabs (x) < 2.8e14)
{
t = (x * hpinv.d + toint.d);
xn = t - toint.d;