diff options
author | Sergey Cherkashin <4erkashin@list.ru> | 2017-10-03 15:26:34 +0300 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2017-11-03 20:23:10 +0100 |
commit | ea38f4d89c9698895b1cf53a5946429dc1d8bbaa (patch) | |
tree | e05828ca1fedf55f104b837bc9c44215c2978e99 /libm | |
parent | 68de9946e914d8c30dcc6667a059ea59e5b74cac (diff) |
math: add exception handling functionality
According to standards SVID and SYSV.
Modified lgamma calling in case when 'signgam' variable should not be used.
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Diffstat (limited to 'libm')
104 files changed, 4661 insertions, 412 deletions
diff --git a/libm/Makefile.in b/libm/Makefile.in index 9b40a9400..e2f4ff808 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -64,8 +64,37 @@ libm_CSRC := \ 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_remquo.c w_exp2.c \ - cexp.c sincos.c + s_remquo.c \ + cexp.c sincos.c \ + w_acos.c w_acosf.c w_acosl.c \ + w_asin.c w_asinf.c w_asinl.c \ + w_atan2.c w_atan2f.c w_atan2l.c \ + w_hypot.c w_hypotf.c w_hypotl.c \ + w_cosh.c w_coshf.c w_coshl.c \ + w_exp.c w_expf.c w_expl.c \ + w_exp2.c w_exp2f.c w_exp2l.c \ + w_exp10.c w_exp10f.c w_exp10l.c \ + w_j0.c w_j0f.c w_j0l.c \ + w_j1.c w_j1f.c w_j1l.c \ + w_jn.c w_jnf.c w_jnl.c \ + w_lgamma_r.c w_lgammaf_r.c w_lgammal_r.c \ + w_lgamma.c w_lgammaf.c w_lgammal.c \ + w_tgamma.c w_tgammaf.c w_tgammal.c \ + w_log.c w_logf.c w_logl.c \ + w_log2.c w_log2f.c w_log2l.c \ + w_log10.c w_log10f.c w_log10l.c \ + w_pow.c w_powf.c w_powl.c \ + w_sinh.c w_sinhf.c w_sinhl.c \ + w_fmod.c w_fmodf.c w_fmodl.c \ + w_sqrt.c w_sqrtf.c w_sqrtl.c \ + w_remainder.c w_remainderf.c w_remainderl.c \ + w_acosh.c w_acoshf.c w_acoshl.c \ + w_atanh.c w_atanhf.c w_atanhl.c \ + w_scalb.c w_scalbf.c w_scalbl.c + +ifeq ($(UCLIBC_HAS_FENV),y) + libm_CSRC += k_standard.c k_standardf.c k_standardl.c +endif FL_MOBJ := \ acosf.o \ @@ -230,7 +259,9 @@ libm_CSRC := \ 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 \ - s_finite.c e_exp10.c + s_finite.c e_exp10.c \ + matherr_wrapers.c k_standart.c + # We'll add sqrtf to avoid problems with libstdc++ FL_MOBJ := sqrtf.o endif diff --git a/libm/e_acos.c b/libm/e_acos.c index acf10130e..0f3ea2e09 100644 --- a/libm/e_acos.c +++ b/libm/e_acos.c @@ -94,7 +94,4 @@ double __ieee754_acos(double x) w = r*s+c; return 2.0*(df+w); } -} - -strong_alias(__ieee754_acos, acos) -libm_hidden_def(acos) +}
\ No newline at end of file diff --git a/libm/e_acosh.c b/libm/e_acosh.c index 17e29c824..ac4ea088e 100644 --- a/libm/e_acosh.c +++ b/libm/e_acosh.c @@ -50,9 +50,6 @@ double __ieee754_acosh(double x) return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one))); } else { /* 1<x<2 */ t = x-one; - return log1p(t+sqrt(2.0*t+t*t)); + return log1p(t+__ieee754_sqrt(2.0*t+t*t)); } } - -strong_alias(__ieee754_acosh, acosh) -libm_hidden_def(acosh) diff --git a/libm/e_asin.c b/libm/e_asin.c index 1441acb3d..07e0fd0d8 100644 --- a/libm/e_asin.c +++ b/libm/e_asin.c @@ -104,6 +104,3 @@ double __ieee754_asin(double x) } if(hx>0) return t; else return -t; } - -strong_alias(__ieee754_asin, asin) -libm_hidden_def(asin) diff --git a/libm/e_atan2.c b/libm/e_atan2.c index ef379aa7a..06a47e89d 100644 --- a/libm/e_atan2.c +++ b/libm/e_atan2.c @@ -113,7 +113,4 @@ double __ieee754_atan2(double y, double x) default: /* case 3 */ return (z-pi_lo)-pi;/* atan(-,-) */ } -} - -strong_alias(__ieee754_atan2, atan2) -libm_hidden_def(atan2) +}
\ No newline at end of file diff --git a/libm/e_atanh.c b/libm/e_atanh.c index fb36a1af1..9fc8f7de9 100644 --- a/libm/e_atanh.c +++ b/libm/e_atanh.c @@ -54,6 +54,3 @@ double __ieee754_atanh(double x) t = 0.5*log1p((x+x)/(one-x)); if(hx>=0) return t; else return -t; } - -strong_alias(__ieee754_atanh, atanh) -libm_hidden_def(atanh) diff --git a/libm/e_cosh.c b/libm/e_cosh.c index a8e34aa45..27dcbefc0 100644 --- a/libm/e_cosh.c +++ b/libm/e_cosh.c @@ -76,7 +76,4 @@ double __ieee754_cosh(double x) /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; -} - -strong_alias(__ieee754_cosh, cosh) -libm_hidden_def(cosh) +}
\ No newline at end of file diff --git a/libm/e_exp.c b/libm/e_exp.c index ce958d111..ffa556120 100644 --- a/libm/e_exp.c +++ b/libm/e_exp.c @@ -155,6 +155,3 @@ double __ieee754_exp(double x) /* default IEEE double exp */ return y*twom1000; } } - -strong_alias(__ieee754_exp, exp) -libm_hidden_def(exp) diff --git a/libm/e_exp10.c b/libm/e_exp10.c index f0ee87809..1de78f2f2 100644 --- a/libm/e_exp10.c +++ b/libm/e_exp10.c @@ -29,5 +29,3 @@ double __ieee754_exp10 (double arg) replaced sometime (soon?). */ return __ieee754_exp (M_LN10 * arg); } -strong_alias(__ieee754_exp10, exp10) -libm_hidden_def(exp10) diff --git a/libm/e_fmod.c b/libm/e_fmod.c index 7857854f8..061cf262c 100644 --- a/libm/e_fmod.c +++ b/libm/e_fmod.c @@ -124,6 +124,3 @@ double __ieee754_fmod(double x, double y) } return x; /* exact output */ } - -strong_alias(__ieee754_fmod, fmod) -libm_hidden_def(fmod) diff --git a/libm/e_hypot.c b/libm/e_hypot.c index cd63b73ae..43fe71765 100644 --- a/libm/e_hypot.c +++ b/libm/e_hypot.c @@ -115,7 +115,4 @@ double __ieee754_hypot(double x, double y) SET_HIGH_WORD(t1,high+(k<<20)); return t1*w; } else return w; -} - -strong_alias(__ieee754_hypot, hypot) -libm_hidden_def(hypot) +}
\ No newline at end of file diff --git a/libm/e_j0.c b/libm/e_j0.c index f740d1902..335c1d3ef 100644 --- a/libm/e_j0.c +++ b/libm/e_j0.c @@ -123,8 +123,6 @@ double __ieee754_j0(double x) } } -strong_alias(__ieee754_j0, j0) - static const double u00 = -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */ u01 = 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */ @@ -190,8 +188,6 @@ double __ieee754_y0(double x) return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x))); } -strong_alias(__ieee754_y0, y0) - /* 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 diff --git a/libm/e_j1.c b/libm/e_j1.c index 78754b4c1..c8eba64f3 100644 --- a/libm/e_j1.c +++ b/libm/e_j1.c @@ -118,8 +118,6 @@ double __ieee754_j1(double x) return(x*0.5+r/s); } -strong_alias(__ieee754_j1, j1) - static const double U0[5] = { -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */ 5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */ @@ -183,8 +181,6 @@ double __ieee754_y1(double x) return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x)); } -strong_alias(__ieee754_y1, y1) - /* 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 diff --git a/libm/e_jn.c b/libm/e_jn.c index 2133905e4..ec432ae93 100644 --- a/libm/e_jn.c +++ b/libm/e_jn.c @@ -200,8 +200,6 @@ double __ieee754_jn(int n, double x) if(sgn==1) return -b; else return b; } -strong_alias(__ieee754_jn, jn) - double __ieee754_yn(int n, double x) { int32_t i,hx,ix,lx; @@ -258,5 +256,3 @@ double __ieee754_yn(int n, double x) } if(sign>0) return b; else return -b; } - -strong_alias(__ieee754_yn, yn) diff --git a/libm/e_lgamma_r.c b/libm/e_lgamma_r.c index 82005ea17..1f3377df2 100644 --- a/libm/e_lgamma_r.c +++ b/libm/e_lgamma_r.c @@ -295,36 +295,11 @@ double __ieee754_lgamma_r(double x, int *signgamp) return r; } -strong_alias(__ieee754_lgamma_r, lgamma_r) -libm_hidden_def(lgamma_r) - -/* __ieee754_lgamma(x) - * Return the logarithm of the Gamma function of x. - */ -double __ieee754_lgamma(double x) -{ - return __ieee754_lgamma_r(x, &signgam); -} - -strong_alias(__ieee754_lgamma, lgamma); -libm_hidden_def(lgamma) - - -/* NB: gamma function is an old name for lgamma. - * It is deprecated. - * Some C math libraries redefine it as a "true gamma", i.e., - * not a ln(|Gamma(x)|) bu |