summaryrefslogtreecommitdiff
path: root/libm
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-28 22:15:07 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-28 22:15:07 +0000
commit30bd4a6cc3a093fdb32db26ee8bc30cd7ef47622 (patch)
tree01723c9bffa22959927c97216fa24ff1107bfd46 /libm
parentde87f81d41ef95772db9e0616e6ae31f5894eda7 (diff)
remove many functions which just call __ieee754_<function>,
define them as aliases instead. text data bss dec hex filename - 45402 180 4 45586 b212 lib/libm-0.9.30-svn.so + 45302 180 4 45486 b1ae lib/libm-0.9.30-svn.so
Diffstat (limited to 'libm')
-rw-r--r--libm/Makefile.in19
-rw-r--r--libm/e_acos.c18
-rw-r--r--libm/e_acosh.c18
-rw-r--r--libm/e_asin.c18
-rw-r--r--libm/e_atan2.c18
-rw-r--r--libm/e_atanh.c23
-rw-r--r--libm/e_cosh.c18
-rw-r--r--libm/e_exp.c25
-rw-r--r--libm/e_fmod.c18
-rw-r--r--libm/e_gamma.c2
-rw-r--r--libm/e_gamma_r.c1
-rw-r--r--libm/e_hypot.c18
-rw-r--r--libm/e_j0.c45
-rw-r--r--libm/e_j1.c44
-rw-r--r--libm/e_jn.c40
-rw-r--r--libm/e_lgamma.c2
-rw-r--r--libm/e_lgamma_r.c43
-rw-r--r--libm/e_log.c18
-rw-r--r--libm/e_log10.c21
-rw-r--r--libm/e_log2.c1
-rw-r--r--libm/e_pow.c37
-rw-r--r--libm/e_remainder.c18
-rw-r--r--libm/e_scalb.c31
-rw-r--r--libm/e_sinh.c18
-rw-r--r--libm/e_sqrt.c20
-rw-r--r--libm/s_matherr.c2
-rw-r--r--libm/s_rint.c3
-rw-r--r--libm/s_signgam.c1
-rw-r--r--libm/w_acos.c33
-rw-r--r--libm/w_acosh.c33
-rw-r--r--libm/w_asin.c33
-rw-r--r--libm/w_atan2.c33
-rw-r--r--libm/w_atanh.c37
-rw-r--r--libm/w_cosh.c33
-rw-r--r--libm/w_exp.c40
-rw-r--r--libm/w_exp2.c2
-rw-r--r--libm/w_fmod.c33
-rw-r--r--libm/w_gamma.c22
-rw-r--r--libm/w_gamma_r.c39
-rw-r--r--libm/w_hypot.c33
-rw-r--r--libm/w_j0.c54
-rw-r--r--libm/w_j1.c55
-rw-r--r--libm/w_jn.c77
-rw-r--r--libm/w_lgamma.c22
-rw-r--r--libm/w_lgamma_r.c35
-rw-r--r--libm/w_log.c33
-rw-r--r--libm/w_log10.c36
-rw-r--r--libm/w_log2.c14
-rw-r--r--libm/w_pow.c55
-rw-r--r--libm/w_remainder.c33
-rw-r--r--libm/w_scalb.c46
-rw-r--r--libm/w_sinh.c33
-rw-r--r--libm/w_sqrt.c33
-rw-r--r--libm/w_tgamma.c24
54 files changed, 550 insertions, 911 deletions
diff --git a/libm/Makefile.in b/libm/Makefile.in
index b490ec8bf..f86f3985e 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -66,14 +66,13 @@ libm_CSRC := \
s_ilogb.c s_ldexp.c s_lib_version.c s_lrint.c s_lround.c s_llround.c \
s_log1p.c s_logb.c s_matherr.c s_modf.c s_nextafter.c s_round.c \
s_rint.c s_scalbn.c s_signgam.c s_significand.c s_sin.c s_tan.c \
- s_tanh.c s_trunc.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c \
- w_cabs.c w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c \
- w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c \
- w_log.c w_log2.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c \
- w_sqrt.c nan.c carg.c s_llrint.c \
+ s_tanh.c s_trunc.c \
+ w_cabs.c w_drem.c w_gamma.c \
+ w_lgamma.c \
+ nan.c carg.c s_llrint.c \
s_fpclassify.c s_fpclassifyf.c s_signbit.c s_signbitf.c \
s_isnan.c s_isnanf.c s_isinf.c s_isinff.c s_finitef.c \
- s_fdim.c s_fma.c s_fmax.c s_fmin.c s_nearbyint.c \
+ s_fdim.c s_fma.c s_fmax.c s_fmin.c \
s_remquo.c s_scalbln.c w_exp2.c w_tgamma.c
# REMOVED: w_gamma_r.c
FL_MOBJ := \
@@ -97,10 +96,10 @@ LD_MOBJ := acoshl.o acosl.o asinhl.o asinl.o atan2l.o atanhl.o atanl.o cargl.o c
else
# This list of math functions was taken from POSIX/IEEE 1003.1b-1993
libm_CSRC := \
- w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \
- w_cosh.c w_exp.c s_fabs.c s_floor.c w_fmod.c s_frexp.c \
- s_ldexp.c w_log.c w_log10.c s_modf.c w_pow.c s_sin.c \
- w_sinh.c w_sqrt.c s_tan.c s_tanh.c \
+ s_atan.c s_ceil.c s_cos.c \
+ s_fabs.c s_floor.c s_frexp.c \
+ s_ldexp.c s_modf.c s_sin.c \
+ s_tan.c s_tanh.c \
s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
diff --git a/libm/e_acos.c b/libm/e_acos.c
index 5333b8e22..e64ac6485 100644
--- a/libm/e_acos.c
+++ b/libm/e_acos.c
@@ -95,3 +95,21 @@ double attribute_hidden __ieee754_acos(double x)
return 2.0*(df+w);
}
}
+
+/*
+ * wrap_acos(x)
+ */
+#ifndef _IEEE_LIBM
+double acos(double x)
+{
+ double z = __ieee754_acos(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (fabs(x) > 1.0)
+ return __kernel_standard(x, x, 1); /* acos(|x|>1) */
+ return z;
+}
+#else
+strong_alias(__ieee754_acos, acos)
+#endif
+libm_hidden_def(acos)
diff --git a/libm/e_acosh.c b/libm/e_acosh.c
index 2c70ad7c8..219b3d64e 100644
--- a/libm/e_acosh.c
+++ b/libm/e_acosh.c
@@ -53,3 +53,21 @@ double attribute_hidden __ieee754_acosh(double x)
return log1p(t+sqrt(2.0*t+t*t));
}
}
+
+/*
+ * wrapper acosh(x)
+ */
+#ifndef _IEEE_LIBM
+double acosh(double x)
+{
+ double z = __ieee754_acosh(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x < 1.0)
+ return __kernel_standard(x, x, 29); /* acosh(x<1) */
+ return z;
+}
+#else
+strong_alias(__ieee754_acosh, acosh)
+#endif
+libm_hidden_def(acosh)
diff --git a/libm/e_asin.c b/libm/e_asin.c
index b3ab73ff8..fe5d15563 100644
--- a/libm/e_asin.c
+++ b/libm/e_asin.c
@@ -104,3 +104,21 @@ double attribute_hidden __ieee754_asin(double x)
}
if(hx>0) return t; else return -t;
}
+
+/*
+ * wrapper asin(x)
+ */
+#ifndef _IEEE_LIBM
+double asin(double x)
+{
+ double z = __ieee754_asin(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (fabs(x) > 1.0)
+ return __kernel_standard(x, x, 2); /* asin(|x|>1) */
+ return z;
+}
+#else
+strong_alias(__ieee754_asin, asin)
+#endif
+libm_hidden_def(asin)
diff --git a/libm/e_atan2.c b/libm/e_atan2.c
index 71c916d52..65f29240e 100644
--- a/libm/e_atan2.c
+++ b/libm/e_atan2.c
@@ -114,3 +114,21 @@ double attribute_hidden __ieee754_atan2(double y, double x)
return (z-pi_lo)-pi;/* atan(-,-) */
}
}
+
+/*
+ * wrapper atan2(y,x)
+ */
+#ifndef _IEEE_LIBM
+double atan2(double y, double x)
+{
+ double z = __ieee754_atan2(y,x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x) || isnan(y))
+ return z;
+ if (x == 0.0 && y == 0.0)
+ return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
+ return z;
+}
+#else
+strong_alias(__ieee754_atan2, atan2)
+#endif
+libm_hidden_def(atan2)
diff --git a/libm/e_atanh.c b/libm/e_atanh.c
index 673ef0cd6..5cf4da3b8 100644
--- a/libm/e_atanh.c
+++ b/libm/e_atanh.c
@@ -54,3 +54,26 @@ double attribute_hidden __ieee754_atanh(double x)
t = 0.5*log1p((x+x)/(one-x));
if(hx>=0) return t; else return -t;
}
+
+/*
+ * wrapper atanh(x)
+ */
+#ifndef _IEEE_LIBM
+double atanh(double x)
+{
+ double z, y;
+ z = __ieee754_atanh(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ y = fabs(x);
+ if (y >= 1.0) {
+ if (y > 1.0)
+ return __kernel_standard(x, x, 30); /* atanh(|x|>1) */
+ return __kernel_standard(x, x, 31); /* atanh(|x|==1) */
+ }
+ return z;
+}
+#else
+strong_alias(__ieee754_atanh, atanh)
+#endif
+libm_hidden_def(atanh)
diff --git a/libm/e_cosh.c b/libm/e_cosh.c
index ddfd0254b..1eb5b8303 100644
--- a/libm/e_cosh.c
+++ b/libm/e_cosh.c
@@ -77,3 +77,21 @@ double attribute_hidden __ieee754_cosh(double x)
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
}
+
+/*
+ * wrapper cosh(x)
+ */
+#ifndef _IEEE_LIBM
+double cosh(double x)
+{
+ double z = __ieee754_cosh(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (fabs(x) > 7.10475860073943863426e+02)
+ return __kernel_standard(x, x, 5); /* cosh overflow */
+ return z;
+}
+#else
+strong_alias(__ieee754_cosh, cosh)
+#endif
+libm_hidden_def(cosh)
diff --git a/libm/e_exp.c b/libm/e_exp.c
index ebf2e5af0..abfb17675 100644
--- a/libm/e_exp.c
+++ b/libm/e_exp.c
@@ -155,3 +155,28 @@ double attribute_hidden __ieee754_exp(double x) /* default IEEE double exp */
return y*twom1000;
}
}
+
+/*
+ * wrapper exp(x)
+ */
+#ifndef _IEEE_LIBM
+double exp(double x)
+{
+ static const double o_threshold = 7.09782712893383973096e+02; /* 0x40862E42, 0xFEFA39EF */
+ static const double u_threshold = -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
+
+ double z = __ieee754_exp(x);
+ if (_LIB_VERSION == _IEEE_)
+ return z;
+ if (isfinite(x)) {
+ if (x > o_threshold)
+ return __kernel_standard(x, x, 6); /* exp overflow */
+ if (x < u_threshold)
+ return __kernel_standard(x, x, 7); /* exp underflow */
+ }
+ return z;
+}
+#else
+strong_alias(__ieee754_exp, exp)
+#endif
+libm_hidden_def(exp)
diff --git a/libm/e_fmod.c b/libm/e_fmod.c
index 02cce63b0..503ff9254 100644
--- a/libm/e_fmod.c
+++ b/libm/e_fmod.c
@@ -124,3 +124,21 @@ double attribute_hidden __ieee754_fmod(double x, double y)
}
return x; /* exact output */
}
+
+/*
+ * wrapper fmod(x,y)
+ */
+#ifndef _IEEE_LIBM
+double fmod(double x, double y)
+{
+ double z = __ieee754_fmod(x, y);
+ if (_LIB_VERSION == _IEEE_ || isnan(y) || isnan(x))
+ return z;
+ if (y == 0.0)
+ return __kernel_standard(x, y, 27); /* fmod(x,0) */
+ return z;
+}
+#else
+strong_alias(__ieee754_fmod, fmod)
+#endif
+libm_hidden_def(fmod)
diff --git a/libm/e_gamma.c b/libm/e_gamma.c
index d0809a10a..d7b7c30fe 100644
--- a/libm/e_gamma.c
+++ b/libm/e_gamma.c
@@ -20,8 +20,6 @@
#include <math.h>
#include "math_private.h"
-libm_hidden_proto(signgam)
-/* __private_extern__ */
double attribute_hidden __ieee754_gamma(double x)
{
return __ieee754_gamma_r(x,&signgam);
diff --git a/libm/e_gamma_r.c b/libm/e_gamma_r.c
index 24411c7e1..9fea9279d 100644
--- a/libm/e_gamma_r.c
+++ b/libm/e_gamma_r.c
@@ -19,7 +19,6 @@
#include "math_private.h"
-/* __private_extern__ */
double attribute_hidden __ieee754_gamma_r(double x, int *signgamp)
{
return __ieee754_lgamma_r(x,signgamp);
diff --git a/libm/e_hypot.c b/libm/e_hypot.c
index 3a6b2133e..264982512 100644
--- a/libm/e_hypot.c
+++ b/libm/e_hypot.c
@@ -116,3 +116,21 @@ double attribute_hidden __ieee754_hypot(double x, double y)
return t1*w;
} else return w;
}
+
+/*
+ * wrapper hypot(x,y)
+ */
+#ifndef _IEEE_LIBM
+double hypot(double x, double y)
+{
+ double z = __ieee754_hypot(x, y);
+ if (_LIB_VERSION == _IEEE_)
+ return z;
+ if ((!isfinite(z)) && isfinite(x) && isfinite(y))
+ return __kernel_standard(x, y, 4); /* hypot overflow */
+ return z;
+}
+#else
+strong_alias(__ieee754_hypot, hypot)
+#endif
+libm_hidden_def(hypot)
diff --git a/libm/e_j0.c b/libm/e_j0.c
index 0c34ceb91..ea37460c0 100644
--- a/libm/e_j0.c
+++ b/libm/e_j0.c
@@ -123,6 +123,23 @@ double attribute_hidden __ieee754_j0(double x)
}
}
+/*
+ * wrapper j0(double x)
+ */
+#ifndef _IEEE_LIBM
+double j0(double x)
+{
+ double z = __ieee754_j0(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (fabs(x) > X_TLOSS)
+ return __kernel_standard(x, x, 34); /* j0(|x|>X_TLOSS) */
+ return z;
+}
+#else
+strong_alias(__ieee754_j0, j0)
+#endif
+
static const double
u00 = -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */
u01 = 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */
@@ -188,6 +205,30 @@ double attribute_hidden __ieee754_y0(double x)
return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x)));
}
+/*
+ * wrapper y0(double x)
+ */
+#ifndef _IEEE_LIBM
+double y0(double x)
+{
+ double z = __ieee754_y0(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x <= 0.0) {
+ if (x == 0.0) /* d= -one/(x-x); */
+ return __kernel_standard(x, x, 8);
+ /* d = zero/(x-x); */
+ return __kernel_standard(x, x, 9);
+ }
+ if (x > X_TLOSS)
+ return __kernel_standard(x, x, 35); /* y0(x>X_TLOSS) */
+ return z;
+}
+#else
+strong_alias(__ieee754_y0, y0)
+#endif
+
+
/* The asymptotic expansions of pzero is
* 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x.
* For x >= 2, We approximate pzero by
@@ -261,7 +302,7 @@ static const double pS2[5] = {
1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */
};
- static double pzero(double x)
+static double pzero(double x)
{
const double *p = 0,*q = 0;
double z,r,s;
@@ -356,7 +397,7 @@ static const double qS2[6] = {
-5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */
};
- static double qzero(double x)
+static double qzero(double x)
{
const double *p=0,*q=0;
double s,r,z;
diff --git a/libm/e_j1.c b/libm/e_j1.c
index 92e15ce75..1f674e9cf 100644
--- a/libm/e_j1.c
+++ b/libm/e_j1.c
@@ -118,6 +118,23 @@ double attribute_hidden __ieee754_j1(double x)
return(x*0.5+r/s);
}
+/*
+ * wrapper of j1
+ */
+#ifndef _IEEE_LIBM
+double j1(double x)
+{
+ double z = __ieee754_j1(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (fabs(x) > X_TLOSS)
+ return __kernel_standard(x, x, 36); /* j1(|x|>X_TLOSS) */
+ return z;
+}
+#else
+strong_alias(__ieee754_j1, j1)
+#endif
+
static const double U0[5] = {
-1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */
5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */
@@ -181,6 +198,29 @@ double attribute_hidden __ieee754_y1(double x)
return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
}
+/*
+ * wrapper of y1
+ */
+#ifndef _IEEE_LIBM
+double y1(double x)
+{
+ double z = __ieee754_y1(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x <= 0.0) {
+ if (x == 0.0) /* d = -one/(x-x); */
+ return __kernel_standard(x, x, 10);
+ /* d = zero/(x-x); */
+ return __kernel_standard(x, x, 11);
+ }
+ if (x > X_TLOSS)
+ return __kernel_standard(x, x, 37); /* y1(x>X_TLOSS) */
+ return z;
+}
+#else
+strong_alias(__ieee754_y1, y1)
+#endif
+
/* For x >= 8, the asymptotic expansions of pone is
* 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x.
* We approximate pone by
@@ -255,7 +295,7 @@ static const double ps2[5] = {
8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */
};
- static double pone(double x)
+static double pone(double x)
{
const double *p=0,*q=0;
double z,r,s;
@@ -351,7 +391,7 @@ static const double qs2[6] = {
-4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */
};
- static double qone(double x)
+static double qone(double x)
{
const double *p=0,*q=0;
double s,r,z;
diff --git a/libm/e_jn.c b/libm/e_jn.c
index b12a7f33a..3825bead8 100644
--- a/libm/e_jn.c
+++ b/libm/e_jn.c
@@ -200,6 +200,23 @@ double attribute_hidden __ieee754_jn(int n, double x)
if(sgn==1) return -b; else return b;
}
+/*
+ * wrapper jn(int n, double x)
+ */
+#ifndef _IEEE_LIBM
+double jn(int n, double x)
+{
+ double z = __ieee754_jn(n, x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (fabs(x) > X_TLOSS)
+ return __kernel_standard((double)n, x, 38); /* jn(|x|>X_TLOSS,n) */
+ return z;
+}
+#else
+strong_alias(__ieee754_jn, jn)
+#endif
+
double attribute_hidden __ieee754_yn(int n, double x)
{
int32_t i,hx,ix,lx;
@@ -256,3 +273,26 @@ double attribute_hidden __ieee754_yn(int n, double x)
}
if(sign>0) return b; else return -b;
}
+
+/*
+ * wrapper yn(int n, double x)
+ */
+#ifndef _IEEE_LIBM
+double yn(int n, double x) /* wrapper yn */
+{
+ double z = __ieee754_yn(n, x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x <= 0.0) {
+ if(x == 0.0) /* d= -one/(x-x); */
+ return __kernel_standard((double)n, x, 12);
+ /* d = zero/(x-x); */
+ return __kernel_standard((double)n, x, 13);
+ }
+ if (x > X_TLOSS)
+ return __kernel_standard((double)n, x, 39); /* yn(x>X_TLOSS,n) */
+ return z;
+}
+#else
+strong_alias(__ieee754_yn, yn)
+#endif
diff --git a/libm/e_lgamma.c b/libm/e_lgamma.c
index 9bc9da60b..b9838c48a 100644
--- a/libm/e_lgamma.c
+++ b/libm/e_lgamma.c
@@ -20,8 +20,6 @@
#include <math.h>
#include "math_private.h"
-libm_hidden_proto(signgam)
-/* __private_extern__ */
double attribute_hidden __ieee754_lgamma(double x)
{
return __ieee754_lgamma_r(x,&signgam);
diff --git a/libm/e_lgamma_r.c b/libm/e_lgamma_r.c
index b578a2cea..5aacadcfd 100644
--- a/libm/e_lgamma_r.c
+++ b/libm/e_lgamma_r.c
@@ -291,3 +291,46 @@ double attribute_hidden __ieee754_lgamma_r(double x, int *signgamp)
if(hx<0) r = nadj - r;
return r;
}
+
+/*
+ * wrapper double lgamma_r(double x, int *signgamp)
+ */
+#ifndef _IEEE_LIBM
+double lgamma_r(double x, int *signgamp)
+{
+ double y = __ieee754_lgamma_r(x, signgamp);
+ if (_LIB_VERSION == _IEEE_)
+ return y;
+ if (!isfinite(y) && isfinite(x)) {
+ if (floor(x) == x && x <= 0.0)
+ return __kernel_standard(x, x, 15); /* lgamma pole */
+ return __kernel_standard(x, x, 14); /* lgamma overflow */
+ }
+ return y;
+}
+#else
+strong_alias(__ieee754_lgamma_r, lgamma_r)
+#endif
+
+/*
+ * wrapper double gamma_r(double x, int *signgamp)
+ */
+double gamma_r(double x, int *signgamp);
+libm_hidden_proto(gamma_r)
+#ifndef _IEEE_LIBM
+double gamma_r(double x, int *signgamp)
+{
+ double y = __ieee754_lgamma_r(x, signgamp);
+ if (_LIB_VERSION == _IEEE_)
+ return y;
+ if (!isfinite(y) && isfinite(x)) {
+ if (floor(x) == x && x <= 0.0)
+ return __kernel_standard(x, x, 41); /* gamma pole */
+ return __kernel_standard(x, x, 40); /* gamma overflow */
+ }
+ return y;
+}
+#else
+strong_alias(__ieee754_lgamma_r, gamma_r)
+#endif
+libm_hidden_def(gamma_r)
diff --git a/libm/e_log.c b/libm/e_log.c
index 721746a16..4a82b6e50 100644
--- a/libm/e_log.c
+++ b/libm/e_log.c
@@ -127,3 +127,21 @@ double attribute_hidden __ieee754_log(double x)
return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
}
}
+
+/*
+ * wrapper log(x)
+ */
+#ifndef _IEEE_LIBM
+double log(double x)
+{
+ double z = __ieee754_log(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0)
+ return z;
+ if (x == 0.0)
+ return __kernel_standard(x, x, 16); /* log(0) */
+ return __kernel_standard(x, x, 17); /* log(x<0) */
+}
+#else
+strong_alias(__ieee754_log, log)
+#endif
+libm_hidden_def(log)
diff --git a/libm/e_log10.c b/libm/e_log10.c
index 6cf3ea4ee..ff2241e56 100644
--- a/libm/e_log10.c
+++ b/libm/e_log10.c
@@ -78,3 +78,24 @@ double attribute_hidden __ieee754_log10(double x)
z = y*log10_2lo + ivln10*__ieee754_log(x);
return z+y*log10_2hi;
}
+
+/*
+ * wrapper log10(X)
+ */
+#ifndef _IEEE_LIBM
+double log10(double x)
+{
+ double z = __ieee754_log10(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x <= 0.0) {
+ if(x == 0.0)
+ return __kernel_standard(x, x, 18); /* log10(0) */
+ return __kernel_standard(x, x, 19); /* log10(x<0) */
+ }
+ return z;
+}
+#else
+strong_alias(__ieee754_log10, log10)
+#endif
+libm_hidden_def(log10)
diff --git a/libm/e_log2.c b/libm/e_log2.c
index 6df88491e..70e604b3c 100644
--- a/libm/e_log2.c
+++ b/libm/e_log2.c
@@ -115,3 +115,4 @@ double __ieee754_log2(double x)
return dk-((s*(f-R))-f)/ln2;
}
}
+strong_alias(__ieee754_log2,log2)
diff --git a/libm/e_pow.c b/libm/e_pow.c
index 08670cce3..137f600c3 100644
--- a/libm/e_pow.c
+++ b/libm/e_pow.c
@@ -292,3 +292,40 @@ double attribute_hidden __ieee754_pow(double x, double y)
else SET_HIGH_WORD(z,j);
return s*z;
}
+
+/*
+ * wrapper pow(x,y) return x**y
+ */
+#ifndef _IEEE_LIBM
+double pow(double x, double y)
+{
+ double z = __ieee754_pow(x, y);
+ if (_LIB_VERSION == _IEEE_|| isnan(y))
+ return z;
+ if (isnan(x)) {
+ if (y == 0.0)
+ return __kernel_standard(x, y, 42); /* pow(NaN,0.0) */
+ return z;
+ }
+ if (x == 0.0) {
+ if (y == 0.0)
+ return __kernel_standard(x, y, 20); /* pow(0.0,0.0) */
+ if (isfinite(y) && y < 0.0)
+ return __kernel_standard(x,y,23); /* pow(0.0,negative) */
+ return z;
+ }
+ if (!isfinite(z)) {
+ if (isfinite(x) && isfinite(y)) {
+ if (isnan(z))
+ return __kernel_standard(x, y, 24); /* pow neg**non-int */
+ return __kernel_standard(x, y, 21); /* pow overflow */
+ }
+ }
+ if (z == 0.0 && isfinite(x) && isfinite(y))
+ return __kernel_standard(x, y, 22); /* pow underflow */
+ return z;
+}
+#else
+strong_alias(__ieee754_pow, pow)
+#endif
+libm_hidden_def(pow)
diff --git a/libm/e_remainder.c b/libm/e_remainder.c
index 89c616686..c4972cfdd 100644
--- a/libm/e_remainder.c
+++ b/libm/e_remainder.c
@@ -63,3 +63,21 @@ double attribute_hidden __ieee754_remainder(double x, double p)
SET_HIGH_WORD(x,hx^sx);
return x;
}
+
+/*
+ * wrapper remainder(x,p)
+ */
+#ifndef _IEEE_LIBM
+double remainder(double x, double y)
+{
+ double z = __ieee754_remainder(x, y);
+ if (_LIB_VERSION == _IEEE_ || isnan(y))
+ return z;
+ if (y == 0.0)
+ return __kernel_standard(x, y, 28); /* remainder(x,0) */
+ return z;
+}
+#else
+strong_alias(__ieee754_remainder, remainder)
+#endif
+libm_hidden_def(remainder)
diff --git a/libm/e_scalb.c b/libm/e_scalb.c
index f43fe6dd5..db3639683 100644
--- a/libm/e_scalb.c
+++ b/libm/e_scalb.c
@@ -17,6 +17,7 @@
#include "math.h"
#include "math_private.h"
+#include <errno.h>
#ifdef _SCALB_INT
double attribute_hidden __ieee754_scalb(double x, int fn)
@@ -26,6 +27,7 @@ double attribute_hidden __ieee754_scalb(double x, double fn)
{
#ifdef _SCALB_INT
return scalbn(x,fn);
+//TODO: just alias it to scalbn?
#else
if (isnan(x)||isnan(fn)) return x*fn;
if (!isfinite(fn)) {
@@ -38,3 +40,32 @@ double attribute_hidden __ieee754_scalb(double x, double fn)
return scalbn(x,(int)fn);
#endif
}
+
+/*
+ * wrapper scalb(double x, double fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+#ifndef _IEEE_LIBM
+# ifdef _SCALB_INT
+double scalb(double x, int fn)
+# else
+double scalb(double x, double fn)
+# endif
+{
+ double z = __ieee754_scalb(x, fn);
+ if (_LIB_VERSION == _IEEE_)
+ return z;
+ if (!(isfinite(z) || isnan(z)) && isfinite(x))
+ return __kernel_standard(x, (double)fn, 32); /* scalb overflow */
+ if (z == 0.0 && z != x)
+ return __kernel_standard(x, (double)fn, 33); /* scalb underflow */
+# ifndef _SCALB_INT
+ if (!isfinite(fn))
+ errno = ERANGE;
+# endif
+ return z;
+}
+#else
+strong_alias(__ieee754_scalb, scalb)
+#endif
diff --git a/libm/e_sinh.c b/libm/e_sinh.c
index 7194b21b9..972307e6f 100644
--- a/libm/e_sinh.c
+++ b/libm/e_sinh.c
@@ -70,3 +70,21 @@ double attribute_hidden __ieee754_sinh(double x)
/* |x| > overflowthresold, sinh(x) overflow */
return x*shuge;
}
+
+/*
+ * wrapper sinh(x)
+ */
+#ifndef _IEEE_LIBM
+double sinh(double x)
+{
+ double z = __ieee754_sinh(x);
+ if (_LIB_VERSION == _IEEE_)
+ return z;
+ if (!isfinite(z) && isfinite(x))
+ return __kernel_standard(x, x, 25); /* sinh overflow */
+ return z;
+}
+#else
+strong_alias(__ieee754_sinh, sinh)
+#endif
+libm_hidden_def(sinh)
diff --git a/libm/e_sqrt.c b/libm/e_sqrt.c
index 884214dff..05e255c2f 100644
--- a/libm/e_sqrt.c
+++ b/libm/e_sqrt.c
@@ -181,6 +181,25 @@ double attribute_hidden __ieee754_sqrt(double x)
}
/*
+ * wrapper sqrt(x)
+ */
+#ifndef _IEEE_LIBM
+double sqrt(double x)
+{
+ double z = __ieee754_sqrt(x);
+ if (_LIB_VERSION == _IEEE_ || isnan(x))
+ return z;
+ if (x < 0.0)
+ return __kernel_standard(x, x, 26); /* sqrt(negative) */
+ return z;
+}
+#else
+strong_alias(__ieee754_sqrt, sqrt)
+#endif
+libm_hidden_def(sqrt)
+
+
+/*
Other methods (use floating-point arithmetic)
-------------
(This is a copy of a drafted paper by Prof W. Kahan
@@ -436,4 +455,3 @@ B. sqrt(x) by Reciproot Iteration
(4) Special cases (see (4) of Section A).
*/
-
diff --git a/libm/s_matherr.c b/libm/s_matherr.c
index 3ab059362..9a50459c8 100644
--- a/libm/s_matherr.c
+++ b/libm/s_matherr.c
@@ -14,7 +14,7 @@
#ifndef _IEEE_LIBM
- int matherr(struct exception *x)
+int matherr(struct exception *x)
{
int n=0;
if(x->arg1!=x->arg1) return 0;
diff --git a/libm/s_rint.c b/libm/s_rint.c
index 641e57571..358ce76b4 100644
--- a/libm/s_rint.c
+++ b/libm/s_rint.c
@@ -71,3 +71,6 @@ double rint(double x)
return w-TWO52[sx];
}
libm_hidden_def(rint)
+
+strong_alias(rint, nearbyint)
+libm_hidden_def(nearbyint)
diff --git a/libm/s_signgam.c b/libm/s_signgam.c
index 13d2a1c34..eee5d659e 100644
--- a/libm/s_signgam.c
+++ b/libm/s_signgam.c
@@ -1,5 +1,4 @@
#include "math.h"
#include "math_private.h"
-libm_hidden_proto(signgam)
int signgam = 0;
libm_hidden_def(signgam)
diff --git a/libm/w_acos.c b/libm/w_acos.c
deleted file mode 100644
index 2413d87d9..000000000
--- a/libm/w_acos.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrap_acos(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double acos(double x) /* wrapper acos */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_acos(x);
-#else
- double z;
- z = __ieee754_acos(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(fabs(x)>1.0) {
- return __kernel_standard(x,x,1); /* acos(|x|>1) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(acos)
diff --git a/libm/w_acosh.c b/libm/w_acosh.c
deleted file mode 100644
index 98dc1b3af..000000000
--- a/libm/w_acosh.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper acosh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double acosh(double x) /* wrapper acosh */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_acosh(x);
-#else
- double z;
- z = __ieee754_acosh(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(x<1.0) {
- return __kernel_standard(x,x,29); /* acosh(x<1) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(acosh)
diff --git a/libm/w_asin.c b/libm/w_asin.c
deleted file mode 100644
index b4575654e..000000000
--- a/libm/w_asin.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper asin(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double asin(double x) /* wrapper asin */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_asin(x);
-#else
- double z;
- z = __ieee754_asin(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(fabs(x)>1.0) {
- return __kernel_standard(x,x,2); /* asin(|x|>1) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(asin)
diff --git a/libm/w_atan2.c b/libm/w_atan2.c
deleted file mode 100644
index a85e2047b..000000000
--- a/libm/w_atan2.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper atan2(y,x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double atan2(double y, double x) /* wrapper atan2 */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2(y,x);
-#else
- double z;
- z = __ieee754_atan2(y,x);
- if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z;
- if(x==0.0&&y==0.0) {
- return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(atan2)
diff --git a/libm/w_atanh.c b/libm/w_atanh.c
deleted file mode 100644
index 6dffe6ad6..000000000
--- a/libm/w_atanh.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper atanh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double atanh(double x) /* wrapper atanh */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_atanh(x);
-#else
- double z,y;
- z = __ieee754_atanh(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- y = fabs(x);
- if(y>=1.0) {
- if(y>1.0)
- return __kernel_standard(x,x,30); /* atanh(|x|>1) */
- else
- return __kernel_standard(x,x,31); /* atanh(|x|==1) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(atanh)
diff --git a/libm/w_cosh.c b/libm/w_cosh.c
deleted file mode 100644
index d37952447..000000000
--- a/libm/w_cosh.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper cosh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double cosh(double x) /* wrapper cosh */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_cosh(x);
-#else
- double z;
- z = __ieee754_cosh(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(fabs(x)>7.10475860073943863426e+02) {
- return __kernel_standard(x,x,5); /* cosh overflow */
- } else
- return z;
-#endif
-}
-libm_hidden_def(cosh)
diff --git a/libm/w_exp.c b/libm/w_exp.c
deleted file mode 100644
index bd9af7ae5..000000000
--- a/libm/w_exp.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper exp(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double exp(double x) /* wrapper exp */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_exp(x);
-#else
- static const double
- o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
- u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
-
- double z;
- z = __ieee754_exp(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(isfinite(x)) {
- if(x>o_threshold)
- return __kernel_standard(x,x,6); /* exp overflow */
- else if(x<u_threshold)
- return __kernel_standard(x,x,7); /* exp underflow */
- }
- return z;
-#endif
-}
-libm_hidden_def(exp)
diff --git a/libm/w_exp2.c b/libm/w_exp2.c
index 20fb9c28e..e00277abf 100644
--- a/libm/w_exp2.c
+++ b/libm/w_exp2.c
@@ -14,6 +14,6 @@
double exp2(double x)
{
- return pow(2.0, x);
+ return pow(2.0, x);
}
libm_hidden_def(exp2)
diff --git a/libm/w_fmod.c b/libm/w_fmod.c
deleted file mode 100644
index ba0897d14..000000000
--- a/libm/w_fmod.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper fmod(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double fmod(double x, double y) /* wrapper fmod */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_fmod(x,y);
-#else
- double z;
- z = __ieee754_fmod(x,y);
- if(_LIB_VERSION == _IEEE_ ||isnan(y)||isnan(x)) return z;
- if(y==0.0) {
- return __kernel_standard(x,y,27); /* fmod(x,0) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(fmod)
diff --git a/libm/w_gamma.c b/libm/w_gamma.c
index 4b23392ed..246c8f764 100644
--- a/libm/w_gamma.c
+++ b/libm/w_gamma.c
@@ -18,21 +18,19 @@
#include <math.h>
#include "math_private.h"
-libm_hidden_proto(signgam)
double gamma(double x)
{
#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,&signgam);
+ return __ieee754_lgamma_r(x, &signgam);
#else
- double y;
- y = __ieee754_lgamma_r(x,&signgam);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!isfinite(y)&&isfinite(x)) {
- if(floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,41); /* gamma pole */
- else
- return __kernel_standard(x,x,40); /* gamma overflow */
- } else
- return y;
+ double y = __ieee754_lgamma_r(x, &signgam);
+ if (_LIB_VERSION == _IEEE_)
+ return y;
+ if (!isfinite(y) && isfinite(x)) {
+ if (floor(x) == x && x <= 0.0)
+ return __kernel_standard(x, x, 41); /* gamma pole */
+ return __kernel_standard(x, x, 40); /* gamma overflow */
+ }
+ return y;
#endif
}
diff --git a/libm/w_gamma_r.c b/libm/w_gamma_r.c
deleted file mode 100644
index 04a843ca7..000000000
--- a/libm/w_gamma_r.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper double gamma_r(double x, int *signgamp)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double gamma_r(double x, int *signgamp);
-libm_hidden_proto(gamma_r)
-
-double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,signgamp);
-#else
- double y;
- y = __ieee754_lgamma_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!isfinite(y)&&isfinite(x)) {
- if(floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,41); /* gamma pole */
- else
- return __kernel_standard(x,x,40); /* gamma overflow */
- } else
- return y;
-#endif
-}
-libm_hidden_def(gamma_r)
diff --git a/libm/w_hypot.c b/libm/w_hypot.c
deleted file mode 100644
index 02e8977dc..000000000
--- a/libm/w_hypot.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper hypot(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double hypot(double x, double y)/* wrapper hypot */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_hypot(x,y);
-#else
- double z;
- z = __ieee754_hypot(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!isfinite(z))&&isfinite(x)&&isfinite(y))
- return __kernel_standard(x,y,4); /* hypot overflow */
- else
- return z;
-#endif
-}
-libm_hidden_def(hypot)
diff --git a/libm/w_j0.c b/libm/w_j0.c
deleted file mode 100644
index 2cd03082d..000000000
--- a/libm/w_j0.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper j0(double x), y0(double x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double j0(double x) /* wrapper j0 */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_j0(x);
-#else
- double z = __ieee754_j0(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(fabs(x)>X_TLOSS) {
- return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
- } else
- return z;
-#endif
-}
-
-double y0(double x) /* wrapper y0 */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_y0(x);
-#else
- double z;
- z = __ieee754_y0(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,8);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,9);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
- } else
- return z;
-#endif
-}
diff --git a/libm/w_j1.c b/libm/w_j1.c
deleted file mode 100644
index 18af1126b..000000000
--- a/libm/w_j1.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper of j1,y1
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double j1(double x) /* wrapper j1 */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_j1(x);
-#else
- double z;
- z = __ieee754_j1(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
- if(fabs(x)>X_TLOSS) {
- return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
- } else
- return z;
-#endif
-}
-
-double y1(double x) /* wrapper y1 */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_y1(x);
-#else
- double z;
- z = __ieee754_y1(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,10);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,11);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
- } else
- return z;
-#endif
-}
diff --git a/libm/w_jn.c b/libm/w_jn.c
deleted file mode 100644
index 9ec64c60d..000000000
--- a/libm/w_jn.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper jn(int n, double x), yn(int n, double x)
- * floating point Bessel's function of the 1st and 2nd kind
- * of order n
- *
- * Special cases:
- * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
- * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
- * Note 2. About jn(n,x), yn(n,x)
- * For n=0, j0(x) is called,
- * for n=1, j1(x) is called,
- * for n<x, forward recursion us used starting
- * from values of j0(x) and j1(x).
- * for n>x, a continued fraction approximation to
- * j(n,x)/j(n-1,x) is evaluated and then backward
- * recursion is used starting from a supposed value
- * for j(n,x). The resulting value of j(0,x) is
- * compared with the actual value to correct the
- * supposed value of j(n,x).
- *
- * yn(n,x) is similar in all respects, except
- * that forward recursion is used for all
- * values of n>1.
- *
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double jn(int n, double x) /* wrapper jn */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_jn(n,x);
-#else
- double z;
- z = __ieee754_jn(n,x);
- if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
- if(fabs(x)>X_TLOSS) {
- return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */
- } else
- return z;
-#endif
-}
-
-double yn(int n, double x) /* wrapper yn */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_yn(n,x);
-#else
- double z;
- z = __ieee754_yn(n,x);
- if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard((double)n,x,12);
- else
- /* d = zero/(x-x); */
- return __kernel_standard((double)n,x,13);
- }
- if(x>X_TLOSS) {
- return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */
- } else
- return z;
-#endif
-}
diff --git a/libm/w_lgamma.c b/libm/w_lgamma.c
index 95bd41330..9ef9051f1 100644
--- a/libm/w_lgamma.c
+++ b/libm/w_lgamma.c
@@ -18,22 +18,20 @@
#include <math.h>
#include "math_private.h"
-libm_hidden_proto(signgam)
double lgamma(double x)
{
#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,&signgam);
+ return __ieee754_lgamma_r(x, &signgam);
#else
- double y;
- y = __ieee754_lgamma_r(x,&signgam);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!isfinite(y)&&isfinite(x)) {
- if(floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,15); /* lgamma pole */
- else
- return __kernel_standard(x,x,14); /* lgamma overflow */
- } else
- return y;
+ double y = __ieee754_lgamma_r(x, &signgam);
+ if (_LIB_VERSION == _IEEE_)
+ return y;
+ if (!isfinite(y) && isfinite(x)) {
+ if (floor(x) == x && x <= 0.0)
+ return __kernel_standard(x, x, 15); /* lgamma pole */
+ return __kernel_standard(x, x, 14); /* lgamma overflow */
+ }
+ return y;
#endif
}
libm_hidden_def(lgamma)
diff --git a/libm/w_lgamma_r.c b/libm/w_lgamma_r.c
deleted file mode 100644
index f4ba60553..000000000
--- a/libm/w_lgamma_r.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper double lgamma_r(double x, int *signgamp)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,signgamp);
-#else
- double y;
- y = __ieee754_lgamma_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!isfinite(y)&&isfinite(x)) {
- if(floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,15); /* lgamma pole */
- else
- return __kernel_standard(x,x,14); /* lgamma overflow */
- } else
- return y;
-#endif
-}
diff --git a/libm/w_log.c b/libm/w_log.c
deleted file mode 100644
index 0f7a1eea9..000000000
--- a/libm/w_log.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper log(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double log(double x) /* wrapper log */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_log(x);
-#else
- double z;
- z = __ieee754_log(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0) return z;
- if(x==0.0)
- return __kernel_standard(x,x,16); /* log(0) */
- else
- return __kernel_standard(x,x,17); /* log(x<0) */
-#endif
-}
-libm_hidden_def(log)
diff --git a/libm/w_log10.c b/libm/w_log10.c
deleted file mode 100644
index ee6c1fe46..000000000
--- a/libm/w_log10.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper log10(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double log10(double x) /* wrapper log10 */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_log10(x);
-#else
- double z;
- z = __ieee754_log10(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(x<=0.0) {
- if(x==0.0)
- return __kernel_standard(x,x,18); /* log10(0) */
- else
- return __kernel_standard(x,x,19); /* log10(x<0) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(log10)
diff --git a/libm/w_log2.c b/libm/w_log2.c
deleted file mode 100644
index b5cc65952..000000000
--- a/libm/w_log2.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Copyright (C) 2008 by Bernhard Reutner-Fischer <uclibc@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <math.h>
-#include "math_private.h"
-
-double log2(double d)
-{
- return __ieee754_log2(d);
-}
diff --git a/libm/w_pow.c b/libm/w_pow.c
deleted file mode 100644
index 7062aeae6..000000000
--- a/libm/w_pow.c
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper pow(x,y) return x**y
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double pow(double x, double y) /* wrapper pow */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_pow(x,y);
-#else
- double z;
- z=__ieee754_pow(x,y);
- if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
- if(isnan(x)) {
- if(y==0.0)
- return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
- else
- return z;
- }
- if(x==0.0){
- if(y==0.0)
- return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
- if(isfinite(y)&&y<0.0)
- return __kernel_standard(x,y,23); /* pow(0.0,negative) */
- return z;
- }
- if(!isfinite(z)) {
- if(isfinite(x)&&isfinite(y)) {
- if(isnan(z))
- return __kernel_standard(x,y,24); /* pow neg**non-int */
- else
- return __kernel_standard(x,y,21); /* pow overflow */
- }
- }
- if(z==0.0&&isfinite(x)&&isfinite(y))
- return __kernel_standard(x,y,22); /* pow underflow */
- return z;
-#endif
-}
-libm_hidden_def(pow)
diff --git a/libm/w_remainder.c b/libm/w_remainder.c
deleted file mode 100644
index 5de1ee811..000000000
--- a/libm/w_remainder.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper remainder(x,p)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double remainder(double x, double y) /* wrapper remainder */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_remainder(x,y);
-#else
- double z;
- z = __ieee754_remainder(x,y);
- if(_LIB_VERSION == _IEEE_ || isnan(y)) return z;
- if(y==0.0)
- return __kernel_standard(x,y,28); /* remainder(x,0) */
- else
- return z;
-#endif
-}
-libm_hidden_def(remainder)
diff --git a/libm/w_scalb.c b/libm/w_scalb.c
deleted file mode 100644
index 0e3475131..000000000
--- a/libm/w_scalb.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper scalb(double x, double fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
-
-#include <math.h>
-#include "math_private.h"
-
-#include <errno.h>
-
-#ifdef _SCALB_INT
-double scalb(double x, int fn) /* wrapper scalb */
-#else
-double scalb(double x, double fn) /* wrapper scalb */
-#endif
-{
-#ifdef _IEEE_LIBM
- return __ieee754_scalb(x,fn);
-#else
- double z;
- z = __ieee754_scalb(x,fn);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!(isfinite(z)||isnan(z))&&isfinite(x)) {
- return __kernel_standard(x,(double)fn,32); /* scalb overflow */
- }
- if(z==0.0&&z!=x) {
- return __kernel_standard(x,(double)fn,33); /* scalb underflow */
- }
-#ifndef _SCALB_INT
- if(!isfinite(fn)) errno = ERANGE;
-#endif
- return z;
-#endif
-}
diff --git a/libm/w_sinh.c b/libm/w_sinh.c
deleted file mode 100644
index e7e5ae855..000000000
--- a/libm/w_sinh.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper sinh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double sinh(double x) /* wrapper sinh */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_sinh(x);
-#else
- double z;
- z = __ieee754_sinh(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!isfinite(z)&&isfinite(x)) {
- return __kernel_standard(x,x,25); /* sinh overflow */
- } else
- return z;
-#endif
-}
-libm_hidden_def(sinh)
diff --git a/libm/w_sqrt.c b/libm/w_sqrt.c
deleted file mode 100644
index 6b6f4b767..000000000
--- a/libm/w_sqrt.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper sqrt(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double sqrt(double x) /* wrapper sqrt */
-{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrt(x);
-#else
- double z;
- z = __ieee754_sqrt(x);
- if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(x<0.0) {
- return __kernel_standard(x,x,26); /* sqrt(negative) */
- } else
- return z;
-#endif
-}
-libm_hidden_def(sqrt)
diff --git a/libm/w_tgamma.c b/libm/w_tgamma.c
index 15723c5d6..3ad473b2f 100644
--- a/libm/w_tgamma.c
+++ b/libm/w_tgamma.c
@@ -17,25 +17,23 @@
#include "math.h"
#include "math_private.h"
-libm_hidden_proto(signgam)
double tgamma(double x)
{
double y;
int local_signgam;
- y = __ieee754_gamma_r(x,&local_signgam);
- if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
- return y;
-#else
- if(_LIB_VERSION == _IEEE_) return y;
- if(!isfinite(y)&&isfinite(x)) {
- if(floor(x)==x&&x<=0.0)
- return __kernel_standard(x,x,41); /* tgamma pole */
- else
- return __kernel_standard(x,x,40); /* tgamma overflow */
+ y = __ieee754_gamma_r(x, &local_signgam);
+ if (local_signgam < 0)
+ y = -y;
+#ifndef _IEEE_LIBM
+ if (_LIB_VERSION == _IEEE_)
+ return y;
+ if (!isfinite(y) && isfinite(x)) {
+ if (floor(x) == x && x <= 0.0)
+ return __kernel_standard(x, x, 41); /* tgamma pole */
+ return __kernel_standard(x, x, 40); /* tgamma overflow */
}
- return y;
#endif
+ return y;
}
libm_hidden_def(tgamma)