Browse Source

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

Denis Vlasenko 15 years ago
parent
commit
30bd4a6cc3
56 changed files with 554 additions and 911 deletions
  1. 3 0
      docs/defines.txt
  2. 1 0
      include/math.h
  3. 9 10
      libm/Makefile.in
  4. 18 0
      libm/e_acos.c
  5. 18 0
      libm/e_acosh.c
  6. 18 0
      libm/e_asin.c
  7. 18 0
      libm/e_atan2.c
  8. 23 0
      libm/e_atanh.c
  9. 18 0
      libm/e_cosh.c
  10. 25 0
      libm/e_exp.c
  11. 18 0
      libm/e_fmod.c
  12. 0 2
      libm/e_gamma.c
  13. 0 1
      libm/e_gamma_r.c
  14. 18 0
      libm/e_hypot.c
  15. 43 2
      libm/e_j0.c
  16. 42 2
      libm/e_j1.c
  17. 40 0
      libm/e_jn.c
  18. 0 2
      libm/e_lgamma.c
  19. 43 0
      libm/e_lgamma_r.c
  20. 18 0
      libm/e_log.c
  21. 21 0
      libm/e_log10.c
  22. 1 0
      libm/e_log2.c
  23. 37 0
      libm/e_pow.c
  24. 18 0
      libm/e_remainder.c
  25. 31 0
      libm/e_scalb.c
  26. 18 0
      libm/e_sinh.c
  27. 19 1
      libm/e_sqrt.c
  28. 1 1
      libm/s_matherr.c
  29. 3 0
      libm/s_rint.c
  30. 0 1
      libm/s_signgam.c
  31. 0 33
      libm/w_acos.c
  32. 0 33
      libm/w_acosh.c
  33. 0 33
      libm/w_asin.c
  34. 0 33
      libm/w_atan2.c
  35. 0 37
      libm/w_atanh.c
  36. 0 33
      libm/w_cosh.c
  37. 0 40
      libm/w_exp.c
  38. 1 1
      libm/w_exp2.c
  39. 0 33
      libm/w_fmod.c
  40. 10 12
      libm/w_gamma.c
  41. 0 39
      libm/w_gamma_r.c
  42. 0 33
      libm/w_hypot.c
  43. 0 54
      libm/w_j0.c
  44. 0 55
      libm/w_j1.c
  45. 0 77
      libm/w_jn.c
  46. 10 12
      libm/w_lgamma.c
  47. 0 35
      libm/w_lgamma_r.c
  48. 0 33
      libm/w_log.c
  49. 0 36
      libm/w_log10.c
  50. 0 14
      libm/w_log2.c
  51. 0 55
      libm/w_pow.c
  52. 0 33
      libm/w_remainder.c
  53. 0 46
      libm/w_scalb.c
  54. 0 33
      libm/w_sinh.c
  55. 0 33
      libm/w_sqrt.c
  56. 11 13
      libm/w_tgamma.c

+ 3 - 0
docs/defines.txt

@@ -69,3 +69,6 @@ __UCLIBC_HAS_XXX__, __UCLIBC_HAVE_XXX__
     uClibc_config.h and generated from uclibc .config file.
     __UCLIBC_HAVE_XXX__ are booleans from bits/uClibc_arch_features.h
     (there are more __UCLIBC_XXX defines there)
+
+_IEEE_LIBM
+    Always defined at libm build time

+ 1 - 0
include/math.h

@@ -175,6 +175,7 @@ extern long double __REDIRECT_NTH (nexttowardl,
 #if defined __USE_MISC || defined __USE_XOPEN
 /* This variable is used by `gamma' and `lgamma'.  */
 extern int signgam;
+libm_hidden_proto(signgam)
 #endif
 
 

+ 9 - 10
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 \

+ 18 - 0
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)

+ 18 - 0
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)

+ 18 - 0
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)

+ 18 - 0
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)

+ 23 - 0
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)

+ 18 - 0
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)

+ 25 - 0
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)

+ 18 - 0
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)

+ 0 - 2
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);

+ 0 - 1
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);

+ 18 - 0
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)

+ 43 - 2
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;

+ 42 - 2
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;

+ 40 - 0
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

+ 0 - 2
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);

+ 43 - 0
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)

+ 18 - 0
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)

+ 21 - 0
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)

+ 1 - 0
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)

+ 37 - 0
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)

+ 18 - 0
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)

+ 31 - 0
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

+ 18 - 0
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)

+ 19 - 1
libm/e_sqrt.c

@@ -180,6 +180,25 @@ double attribute_hidden __ieee754_sqrt(double x)
 	return z;
 }
 
+/*
+ * 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)
 -------------
@@ -436,4 +455,3 @@ B.  sqrt(x) by Reciproot Iteration
     (4)	Special cases (see (4) of Section A).
 
  */
-

+ 1 - 1
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;

+ 3 - 0
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)

+ 0 - 1
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)

+ 0 - 33
libm/w_acos.c

@@ -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)

+ 0 - 33
libm/w_acosh.c

@@ -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)

+ 0 - 33
libm/w_asin.c

@@ -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)

+ 0 - 33
libm/w_atan2.c

@@ -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)

+ 0 - 37
libm/w_atanh.c

@@ -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)

+ 0 - 33
libm/w_cosh.c

@@ -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)

+ 0 - 40
libm/w_exp.c

@@ -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)

+ 1 - 1
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)

+ 0 - 33
libm/w_fmod.c

@@ -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)

+ 10 - 12
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
 }

+ 0 - 39
libm/w_gamma_r.c

@@ -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)

+ 0 - 33
libm/w_hypot.c

@@ -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)

+ 0 - 54
libm/w_j0.c

@@ -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
-}

+ 0 - 55
libm/w_j1.c

@@ -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
-}

+ 0 - 77
libm/w_jn.c

@@ -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
-}

+ 10 - 12
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)

+ 0 - 35
libm/w_lgamma_r.c

@@ -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
-}

+ 0 - 33
libm/w_log.c

@@ -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)

+ 0 - 36
libm/w_log10.c

@@ -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)

+ 0 - 14
libm/w_log2.c

@@ -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);
-}

+ 0 - 55
libm/w_pow.c

@@ -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)

+ 0 - 33
libm/w_remainder.c

@@ -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)

+ 0 - 46
libm/w_scalb.c

@@ -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
-}

+ 0 - 33
libm/w_sinh.c

@@ -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)

+ 0 - 33
libm/w_sqrt.c

@@ -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)

+ 11 - 13
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)