aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
commit0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch)
treef9d26c8abc0de39d18d4c13e70f6022cdc6b461f
parenta843a204a3e8a0dd53584dad3668771abaec84ac (diff)
downloadglibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.zip
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.gz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.bz2
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized.
-rw-r--r--ChangeLog286
-rw-r--r--NEWS5
-rw-r--r--Versions.def1
-rw-r--r--math/Makefile6
-rw-r--r--math/Versions29
-rw-r--r--math/bits/math-finite.h315
-rw-r--r--math/e_acoshl.c1
-rw-r--r--math/e_acosl.c1
-rw-r--r--math/e_asinl.c1
-rw-r--r--math/e_atan2l.c1
-rw-r--r--math/e_atanhl.c1
-rw-r--r--math/e_coshl.c1
-rw-r--r--math/e_exp10.c3
-rw-r--r--math/e_exp10f.c3
-rw-r--r--math/e_exp10l.c3
-rw-r--r--math/e_exp2l.c1
-rw-r--r--math/e_fmodl.c1
-rw-r--r--math/e_gammal_r.c1
-rw-r--r--math/e_hypotl.c1
-rw-r--r--math/e_j0l.c2
-rw-r--r--math/e_j1l.c2
-rw-r--r--math/e_jnl.c2
-rw-r--r--math/e_lgammal_r.c1
-rw-r--r--math/e_log10l.c1
-rw-r--r--math/e_log2l.c1
-rw-r--r--math/e_logl.c1
-rw-r--r--math/e_powl.c1
-rw-r--r--math/e_scalb.c112
-rw-r--r--math/e_scalbf.c109
-rw-r--r--math/e_scalbl.c114
-rw-r--r--math/e_sinhl.c1
-rw-r--r--math/e_sqrtl.c1
-rw-r--r--math/math.h23
-rw-r--r--math/math_private.h1
-rw-r--r--math/w_acos.c62
-rw-r--r--math/w_acosf.c64
-rw-r--r--math/w_acosh.c59
-rw-r--r--math/w_acoshf.c62
-rw-r--r--math/w_acoshl.c61
-rw-r--r--math/w_acosl.c64
-rw-r--r--math/w_asin.c61
-rw-r--r--math/w_asinf.c65
-rw-r--r--math/w_asinl.c65
-rw-r--r--math/w_atan2.c53
-rw-r--r--math/w_atan2f.c54
-rw-r--r--math/w_atan2l.c55
-rw-r--r--math/w_atanh.c64
-rw-r--r--math/w_atanhf.c67
-rw-r--r--math/w_atanhl.c66
-rw-r--r--math/w_cosh.c31
-rw-r--r--math/w_coshf.c35
-rw-r--r--math/w_coshl.c30
-rw-r--r--math/w_exp10.c58
-rw-r--r--math/w_exp10f.c61
-rw-r--r--math/w_exp10l.c59
-rw-r--r--math/w_exp2.c26
-rw-r--r--math/w_exp2f.c26
-rw-r--r--math/w_exp2l.c20
-rw-r--r--math/w_fmod.c61
-rw-r--r--math/w_fmodf.c62
-rw-r--r--math/w_fmodl.c63
-rw-r--r--math/w_hypot.c29
-rw-r--r--math/w_hypotf.c31
-rw-r--r--math/w_hypotl.c26
-rw-r--r--math/w_j0.c104
-rw-r--r--math/w_j0f.c110
-rw-r--r--math/w_j0l.c108
-rw-r--r--math/w_j1.c105
-rw-r--r--math/w_j1f.c110
-rw-r--r--math/w_j1l.c108
-rw-r--r--math/w_jn.c127
-rw-r--r--math/w_jnf.c109
-rw-r--r--math/w_lgamma.c43
-rw-r--r--math/w_lgamma_r.c35
-rw-r--r--math/w_lgammaf.c45
-rw-r--r--math/w_lgammaf_r.c43
-rw-r--r--math/w_lgammal.c43
-rw-r--r--math/w_lgammal_r.c36
-rw-r--r--math/w_log.c69
-rw-r--r--math/w_log10.c72
-rw-r--r--math/w_log10f.c75
-rw-r--r--math/w_log10l.c74
-rw-r--r--math/w_log2.c49
-rw-r--r--math/w_log2f.c53
-rw-r--r--math/w_log2l.c51
-rw-r--r--math/w_logf.c72
-rw-r--r--math/w_logl.c71
-rw-r--r--math/w_pow.c111
-rw-r--r--math/w_powf.c122
-rw-r--r--math/w_powl.c115
-rw-r--r--math/w_remainder.c60
-rw-r--r--math/w_remainderf.c62
-rw-r--r--math/w_remainderl.c63
-rw-r--r--math/w_scalb.c94
-rw-r--r--math/w_scalbf.c97
-rw-r--r--math/w_scalbl.c96
-rw-r--r--math/w_sinh.c29
-rw-r--r--math/w_sinhf.c34
-rw-r--r--math/w_sinhl.c29
-rw-r--r--math/w_sqrt.c58
-rw-r--r--math/w_sqrtf.c60
-rw-r--r--math/w_sqrtl.c60
-rw-r--r--math/w_tgamma.c26
-rw-r--r--math/w_tgammaf.c34
-rw-r--r--math/w_tgammal.c28
-rw-r--r--sysdeps/i386/fpu/e_acos.S1
-rw-r--r--sysdeps/i386/fpu/e_acosf.S1
-rw-r--r--sysdeps/i386/fpu/e_acosh.S7
-rw-r--r--sysdeps/i386/fpu/e_acoshf.S7
-rw-r--r--sysdeps/i386/fpu/e_acoshl.S7
-rw-r--r--sysdeps/i386/fpu/e_acosl.c1
-rw-r--r--sysdeps/i386/fpu/e_asin.S1
-rw-r--r--sysdeps/i386/fpu/e_asinf.S1
-rw-r--r--sysdeps/i386/fpu/e_atan2.S1
-rw-r--r--sysdeps/i386/fpu/e_atan2f.S1
-rw-r--r--sysdeps/i386/fpu/e_atan2l.c1
-rw-r--r--sysdeps/i386/fpu/e_atanh.S3
-rw-r--r--sysdeps/i386/fpu/e_atanhf.S3
-rw-r--r--sysdeps/i386/fpu/e_atanhl.S3
-rw-r--r--sysdeps/i386/fpu/e_exp10.S1
-rw-r--r--sysdeps/i386/fpu/e_exp10f.S3
-rw-r--r--sysdeps/i386/fpu/e_exp10l.S3
-rw-r--r--sysdeps/i386/fpu/e_exp2.S1
-rw-r--r--sysdeps/i386/fpu/e_exp2f.S1
-rw-r--r--sysdeps/i386/fpu/e_exp2l.S1
-rw-r--r--sysdeps/i386/fpu/e_fmod.S3
-rw-r--r--sysdeps/i386/fpu/e_fmodf.S3
-rw-r--r--sysdeps/i386/fpu/e_fmodl.c1
-rw-r--r--sysdeps/i386/fpu/e_hypot.S5
-rw-r--r--sysdeps/i386/fpu/e_hypotf.S5
-rw-r--r--sysdeps/i386/fpu/e_log.S11
-rw-r--r--sysdeps/i386/fpu/e_log10.S11
-rw-r--r--sysdeps/i386/fpu/e_log10f.S11
-rw-r--r--sysdeps/i386/fpu/e_log10l.S11
-rw-r--r--sysdeps/i386/fpu/e_log2.S9
-rw-r--r--sysdeps/i386/fpu/e_log2f.S9
-rw-r--r--sysdeps/i386/fpu/e_log2l.S9
-rw-r--r--sysdeps/i386/fpu/e_logf.S11
-rw-r--r--sysdeps/i386/fpu/e_logl.S11
-rw-r--r--sysdeps/i386/fpu/e_pow.S39
-rw-r--r--sysdeps/i386/fpu/e_powf.S39
-rw-r--r--sysdeps/i386/fpu/e_powl.S39
-rw-r--r--sysdeps/i386/fpu/e_remainder.S3
-rw-r--r--sysdeps/i386/fpu/e_remainderf.S3
-rw-r--r--sysdeps/i386/fpu/e_remainderl.S3
-rw-r--r--sysdeps/i386/fpu/e_scalb.S12
-rw-r--r--sysdeps/i386/fpu/e_scalbf.S12
-rw-r--r--sysdeps/i386/fpu/e_scalbl.S12
-rw-r--r--sysdeps/i386/fpu/e_sqrt.S3
-rw-r--r--sysdeps/i386/fpu/e_sqrtf.S3
-rw-r--r--sysdeps/i386/fpu/e_sqrtl.c2
-rw-r--r--sysdeps/ia64/fpu/bits/math-finite.h25
-rw-r--r--sysdeps/ieee754/dbl-64/e_acosh.c29
-rw-r--r--sysdeps/ieee754/dbl-64/e_asin.c30
-rw-r--r--sysdeps/ieee754/dbl-64/e_atan2.c374
-rw-r--r--sysdeps/ieee754/dbl-64/e_atanh.c122
-rw-r--r--sysdeps/ieee754/dbl-64/e_cosh.c60
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c4
-rw-r--r--sysdeps/ieee754/dbl-64/e_fmod.c43
-rw-r--r--sysdeps/ieee754/dbl-64/e_gamma_r.c10
-rw-r--r--sysdeps/ieee754/dbl-64/e_hypot.c25
-rw-r--r--sysdeps/ieee754/dbl-64/e_j0.c212
-rw-r--r--sysdeps/ieee754/dbl-64/e_j1.c255
-rw-r--r--sysdeps/ieee754/dbl-64/e_jn.c82
-rw-r--r--sysdeps/ieee754/dbl-64/e_lgamma_r.c85
-rw-r--r--sysdeps/ieee754/dbl-64/e_log.c20
-rw-r--r--sysdeps/ieee754/dbl-64/e_log10.c42
-rw-r--r--sysdeps/ieee754/dbl-64/e_log2.c34
-rw-r--r--sysdeps/ieee754/dbl-64/e_pow.c9
-rw-r--r--sysdeps/ieee754/dbl-64/e_remainder.c11
-rw-r--r--sysdeps/ieee754/dbl-64/e_sinh.c36
-rw-r--r--sysdeps/ieee754/dbl-64/e_sqrt.c3
-rw-r--r--sysdeps/ieee754/dbl-64/halfulp.c18
-rw-r--r--sysdeps/ieee754/dbl-64/s_asinh.c40
-rw-r--r--sysdeps/ieee754/flt-32/e_acosf.c21
-rw-r--r--sysdeps/ieee754/flt-32/e_acoshf.c13
-rw-r--r--sysdeps/ieee754/flt-32/e_asinf.c9
-rw-r--r--sysdeps/ieee754/flt-32/e_atan2f.c27
-rw-r--r--sysdeps/ieee754/flt-32/e_atanhf.c112
-rw-r--r--sysdeps/ieee754/flt-32/e_coshf.c43
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c4
-rw-r--r--sysdeps/ieee754/flt-32/e_fmodf.c33
-rw-r--r--sysdeps/ieee754/flt-32/e_gammaf_r.c10
-rw-r--r--sysdeps/ieee754/flt-32/e_hypotf.c21
-rw-r--r--sysdeps/ieee754/flt-32/e_j0f.c200
-rw-r--r--sysdeps/ieee754/flt-32/e_j1f.c239
-rw-r--r--sysdeps/ieee754/flt-32/e_jnf.c53
-rw-r--r--sysdeps/ieee754/flt-32/e_lgammaf_r.c70
-rw-r--r--sysdeps/ieee754/flt-32/e_log10f.c42
-rw-r--r--sysdeps/ieee754/flt-32/e_log2f.c26
-rw-r--r--sysdeps/ieee754/flt-32/e_logf.c32
-rw-r--r--sysdeps/ieee754/flt-32/e_powf.c46
-rw-r--r--sysdeps/ieee754/flt-32/e_remainderf.c21
-rw-r--r--sysdeps/ieee754/flt-32/e_sinhf.c25
-rw-r--r--sysdeps/ieee754/flt-32/e_sqrtf.c39
-rw-r--r--sysdeps/ieee754/flt-32/s_asinhf.c40
-rw-r--r--sysdeps/ieee754/k_standard.c331
-rw-r--r--sysdeps/ieee754/ldbl-128/e_acoshl.c15
-rw-r--r--sysdeps/ieee754/ldbl-128/e_acosl.c21
-rw-r--r--sysdeps/ieee754/ldbl-128/e_asinl.c7
-rw-r--r--sysdeps/ieee754/ldbl-128/e_atan2l.c25
-rw-r--r--sysdeps/ieee754/ldbl-128/e_atanhl.c23
-rw-r--r--sysdeps/ieee754/ldbl-128/e_coshl.c16
-rw-r--r--sysdeps/ieee754/ldbl-128/e_fmodl.c41
-rw-r--r--sysdeps/ieee754/ldbl-128/e_gammal_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-128/e_hypotl.c21
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j0l.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j1l.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/e_jnl.c24
-rw-r--r--sysdeps/ieee754/ldbl-128/e_lgammal_r.c12
-rw-r--r--sysdeps/ieee754/ldbl-128/e_log10l.c6
-rw-r--r--sysdeps/ieee754/ldbl-128/e_log2l.c3
-rw-r--r--sysdeps/ieee754/ldbl-128/e_logl.c5
-rw-r--r--sysdeps/ieee754/ldbl-128/e_powl.c11
-rw-r--r--sysdeps/ieee754/ldbl-128/e_remainderl.c25
-rw-r--r--sysdeps/ieee754/ldbl-128/e_sinhl.c16
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acoshl.c19
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acosl.c7
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_asinl.c7
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atan2l.c23
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atanhl.c25
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_coshl.c27
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_fmodl.c31
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_hypotl.c21
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log10l.c4
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log2l.c1
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_logl.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_powl.c11
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_remainderl.c19
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sinhl.c23
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-96/e_acoshl.c19
-rw-r--r--sysdeps/ieee754/ldbl-96/e_asinl.c7
-rw-r--r--sysdeps/ieee754/ldbl-96/e_atan2l.c29
-rw-r--r--sysdeps/ieee754/ldbl-96/e_atanhl.c23
-rw-r--r--sysdeps/ieee754/ldbl-96/e_coshl.c46
-rw-r--r--sysdeps/ieee754/ldbl-96/e_gammal_r.c13
-rw-r--r--sysdeps/ieee754/ldbl-96/e_hypotl.c17
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j0l.c138
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j1l.c156
-rw-r--r--sysdeps/ieee754/ldbl-96/e_jnl.c41
-rw-r--r--sysdeps/ieee754/ldbl-96/e_lgammal_r.c30
-rw-r--r--sysdeps/ieee754/ldbl-96/e_remainderl.c23
-rw-r--r--sysdeps/ieee754/ldbl-96/e_sinhl.c21
-rw-r--r--sysdeps/ieee754/ldbl-96/s_asinhl.c22
-rw-r--r--sysdeps/powerpc/fpu/e_hypot.c1
-rw-r--r--sysdeps/powerpc/fpu/e_hypotf.c1
-rw-r--r--sysdeps/powerpc/fpu/e_sqrt.c21
-rw-r--r--sysdeps/powerpc/fpu/e_sqrtf.c19
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/e_sqrt.c3
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c3
-rw-r--r--sysdeps/s390/fpu/e_sqrt.c5
-rw-r--r--sysdeps/s390/fpu/e_sqrtf.c5
-rw-r--r--sysdeps/s390/fpu/e_sqrtl.c5
-rw-r--r--sysdeps/sparc/sparc32/e_sqrt.c3
-rw-r--r--sysdeps/sparc/sparc64/fpu/e_sqrtl.c3
-rw-r--r--sysdeps/x86_64/fpu/bits/fenv.h35
-rw-r--r--sysdeps/x86_64/fpu/bits/mathinline.h3
-rw-r--r--sysdeps/x86_64/fpu/e_exp2l.S1
-rw-r--r--sysdeps/x86_64/fpu/e_fmodl.S1
-rw-r--r--sysdeps/x86_64/fpu/e_log10l.S27
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S25
-rw-r--r--sysdeps/x86_64/fpu/e_logl.S27
-rw-r--r--sysdeps/x86_64/fpu/e_powl.S34
-rw-r--r--sysdeps/x86_64/fpu/e_remainderl.S1
-rw-r--r--sysdeps/x86_64/fpu/e_scalbl.S8
-rw-r--r--sysdeps/x86_64/fpu/e_sqrt.c6
-rw-r--r--sysdeps/x86_64/fpu/e_sqrtf.c6
-rw-r--r--sysdeps/x86_64/fpu/math_private.h25
270 files changed, 4552 insertions, 5629 deletions
diff --git a/ChangeLog b/ChangeLog
index a5cbdee..5dd550c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,289 @@
+2011-10-12 Ulrich Drepper <drepper@gmail.com>
+
+ Add integration with gcc's -ffinite-math-only and optimize wrapper
+ functions in libm.
+ * Versions.def: Define GLIBC_2.15 version for libm.
+ * math/Makefile (headers): Add bits/math-finite.h.
+ * math/bits/math-finite.h: New file.
+ * sysdeps/ia64/fpu/bits/math-finite.h: New file.
+ * math/Versions [libm] (GLIBC_2.15): Export __*_finite symbols.
+ * math/e_acoshl.c: Add __*_finite alias.
+ * math/e_acosl.c: Likewise.
+ * math/e_asinl.c: Likewise.
+ * math/e_atan2l.c: Likewise.
+ * math/e_atanhl.c: Likewise.
+ * math/e_coshl.c: Likewise.
+ * math/e_exp10.c: Likewise.
+ * math/e_exp10f.c: Likewise.
+ * math/e_exp10l.c: Likewise.
+ * math/e_exp2l.c: Likewise.
+ * math/e_fmodl.c: Likewise.
+ * math/e_gammal_r.c: Likewise.
+ * math/e_hypotl.c: Likewise.
+ * math/e_j0l.c: Likewise.
+ * math/e_j1l.c: Likewise.
+ * math/e_jnl.c: Likewise.
+ * math/e_lgammal_r.c: Likewise.
+ * math/e_log10l.c: Likewise.
+ * math/e_log2l.c: Likewise.
+ * math/e_logl.c: Likewise.
+ * math/e_powl.c: Likewise.
+ * math/e_sinhl.c: Likewise.
+ * math/e_sqrtl.c: Likewise.
+ * math/e_scalb.c: Completely rewritten and optimized.
+ * math/e_scalbf.c: Likewise.
+ * math/e_scalbl.c: Likewise.
+ * math/w_acos.c: Likewise.
+ * math/w_acosf.c: Likewise.
+ * math/w_acosl.c: Likewise.
+ * math/w_acosh.c: Likewise.
+ * math/w_acoshf.c: Likewise.
+ * math/w_acoshl.c: Likewise.
+ * math/w_asin.c: Likewise.
+ * math/w_asinf.c: Likewise.
+ * math/w_asinl.c: Likewise.
+ * math/w_atan2.c: Likewise.
+ * math/w_atan2f.c: Likewise.
+ * math/w_atan2l.c: Likewise.
+ * math/w_atanh.c: Likewise.
+ * math/w_atanhf.c: Likewise.
+ * math/w_atanhl.c: Likewise.
+ * math/w_exp10.c: Likewise.
+ * math/w_exp10f.c: Likewise.
+ * math/w_exp10l.c: Likewise.
+ * math/w_fmod.c: Likewise.
+ * math/w_fmodf.c: Likewise.
+ * math/w_fmodl.c: Likewise.
+ * math/w_j0.c: Likewise.
+ * math/w_j0f.c: Likewise.
+ * math/w_j0l.c: Likewise.
+ * math/w_j1.c: Likewise.
+ * math/w_j1f.c: Likewise.
+ * math/w_j1l.c: Likewise.
+ * math/w_jn.c: Likewise.
+ * math/w_jnf.c: Likewise.
+ * math/w_log.c: Likewise.
+ * math/w_logf.c: Likewise.
+ * math/w_logl.c: Likewise.
+ * math/w_log10.c: Likewise.
+ * math/w_log10f.c: Likewise.
+ * math/w_log10l.c: Likewise.
+ * math/w_log2.c: Likewise.
+ * math/w_log2f.c: Likewise.
+ * math/w_log2l.c: Likewise.
+ * math/w_pow.c: Likewise.
+ * math/w_powf.c: Likewise.
+ * math/w_powl.c: Likewise.
+ * math/w_remainder.c: Likewise.
+ * math/w_remainderf.c: Likewise.
+ * math/w_remainderl.c: Likewise.
+ * math/w_scalb.c: Likewise.
+ * math/w_scalbf.c: Likewise.
+ * math/w_scalbl.c: Likewise.
+ * math/w_sqrt.c: Likewise.
+ * math/w_sqrtf.c: Likewise.
+ * math/w_sqrtl.c: Likewise.
+ * math/math.h: Define __MATH_DECLARE_LDOUBLE if long double functions
+ are declared. Include <bits/math-finite.h> if -ffinite-math-only is
+ used.
+ * math/math_private.h: Declare __kernel_standard_f.
+ * math/w_cosh.c: Remove cruft and optimize a bit.
+ * math/w_coshf.c: Likewise.
+ * math/w_coshl.c: Likewise.
+ * math/w_exp2.c: Likewise.
+ * math/w_exp2f.c: Likewise.
+ * math/w_exp2l.c: Likewise.
+ * math/w_hypot.c: Likewise.
+ * math/w_hypotf.c: Likewise.
+ * math/w_hypotl.c: Likewise.
+ * math/w_lgamma.c: Likewise.
+ * math/w_lgamma_r.c: Likewise.
+ * math/w_lgammaf.c: Likewise.
+ * math/w_lgammaf_r.c: Likewise.
+ * math/w_lgammal.c: Likewise.
+ * math/w_lgammal_r.c: Likewise.
+ * math/w_sinh.c: Likewise.
+ * math/w_sinhf.c: Likewise.
+ * math/w_sinhl.c: Likewise.
+ * math/w_tgamma.c: Likewise.
+ * math/w_tgammaf.c: Likewise.
+ * math/w_tgammal.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_atanh.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_atanhf.c: Likewise.
+ * sysdeps/i386/fpu/e_acos.S: Add __*_finite alias.
+ Minor optimizations. Pretty printing. Remove cruft.
+ * sysdeps/i386/fpu/e_acosf.S: Likewise.
+ * sysdeps/i386/fpu/e_acosh.S: Likewise.
+ * sysdeps/i386/fpu/e_acoshf.S: Likewise.
+ * sysdeps/i386/fpu/e_acoshl.S: Likewise.
+ * sysdeps/i386/fpu/e_acosl.c: Likewise.
+ * sysdeps/i386/fpu/e_asin.S: Likewise.
+ * sysdeps/i386/fpu/e_asinf.S: Likewise.
+ * sysdeps/i386/fpu/e_atan2.S: Likewise.
+ * sysdeps/i386/fpu/e_atan2f.S: Likewise.
+ * sysdeps/i386/fpu/e_atan2l.c: Likewise.
+ * sysdeps/i386/fpu/e_atanh.S: Likewise.
+ * sysdeps/i386/fpu/e_atanhf.S: Likewise.
+ * sysdeps/i386/fpu/e_atanhl.S: Likewise.
+ * sysdeps/i386/fpu/e_exp10.S: Likewise.
+ * sysdeps/i386/fpu/e_exp10f.S: Likewise.
+ * sysdeps/i386/fpu/e_exp10l.S: Likewise.
+ * sysdeps/i386/fpu/e_exp2.S: Likewise.
+ * sysdeps/i386/fpu/e_exp2f.S: Likewise.
+ * sysdeps/i386/fpu/e_exp2l.S: Likewise.
+ * sysdeps/i386/fpu/e_fmod.S: Likewise.
+ * sysdeps/i386/fpu/e_fmodf.S: Likewise.
+ * sysdeps/i386/fpu/e_fmodl.c: Likewise.
+ * sysdeps/i386/fpu/e_hypot.S: Likewise.
+ * sysdeps/i386/fpu/e_hypotf.S: Likewise.
+ * sysdeps/i386/fpu/e_log.S: Likewise.
+ * sysdeps/i386/fpu/e_log10.S: Likewise.
+ * sysdeps/i386/fpu/e_log10f.S: Likewise.
+ * sysdeps/i386/fpu/e_log10l.S: Likewise.
+ * sysdeps/i386/fpu/e_log2.S: Likewise.
+ * sysdeps/i386/fpu/e_log2f.S: Likewise.
+ * sysdeps/i386/fpu/e_log2l.S: Likewise.
+ * sysdeps/i386/fpu/e_logf.S: Likewise.
+ * sysdeps/i386/fpu/e_logl.S: Likewise.
+ * sysdeps/i386/fpu/e_pow.S: Likewise.
+ * sysdeps/i386/fpu/e_powf.S: Likewise.
+ * sysdeps/i386/fpu/e_powl.S: Likewise.
+ * sysdeps/i386/fpu/e_remainder.S: Likewise.
+ * sysdeps/i386/fpu/e_remainderf.S: Likewise.
+ * sysdeps/i386/fpu/e_remainderl.S: Likewise.
+ * sysdeps/i386/fpu/e_scalb.S: Likewise.
+ * sysdeps/i386/fpu/e_scalbf.S: Likewise.
+ * sysdeps/i386/fpu/e_scalbl.S: Likewise.
+ * sysdeps/i386/fpu/e_sqrt.S: Likewise.
+ * sysdeps/i386/fpu/e_sqrtf.S: Likewise.
+ * sysdeps/i386/fpu/e_sqrtl.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_acosh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_asin.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_cosh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_fmod.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_hypot.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_j0.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_lgamma_r.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_log.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_log10.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_log2.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
+ * sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
+ * sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_asinh.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_acosf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_acoshf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_asinf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_atan2f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_coshf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_exp2f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_fmodf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_hypotf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_j0f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_lgammaf_r.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_log10f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_log2f.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_logf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_powf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_remainderf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_sinhf.c: Likewise.
+ * sysdeps/ieee754/flt-32/e_sqrtf.c: Likewise.
+ * sysdeps/ieee754/flt-32/s_asinhf.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_acoshl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_acosl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_asinl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_atan2l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_atanhl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_coshl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_fmodl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_hypotl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_j0l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_log10l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_log2l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_logl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_powl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_remainderl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/e_sinhl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_acosl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_atan2l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_coshl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_log10l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_log2l.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_logl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_powl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_remainderl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_acoshl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_asinl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_atan2l.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_atanhl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_coshl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_hypotl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_j0l.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_j1l.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_lgammal_r.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_remainderl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/e_sinhl.c: Likewise.
+ * sysdeps/ieee754/ldbl-96/s_asinhl.c: Likewise.
+ * sysdeps/powerpc/fpu/e_hypot.c: Likewise.
+ * sysdeps/powerpc/fpu/e_hypotf.c: Likewise.
+ * sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
+ * sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/s390/fpu/e_sqrt.c: Likewise.
+ * sysdeps/s390/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/s390/fpu/e_sqrtl.c: Likewise.
+ * sysdeps/sparc/sparc32/e_sqrt.c: Likewise.
+ * sysdeps/sparc/sparc64/fpu/e_sqrtl.c: Likewise.
+ * sysdeps/x86_64/fpu/e_exp2l.S: Likewise.
+ * sysdeps/x86_64/fpu/e_fmodl.S: Likewise.
+ * sysdeps/x86_64/fpu/e_log10l.S: Likewise.
+ * sysdeps/x86_64/fpu/e_log2l.S: Likewise.
+ * sysdeps/x86_64/fpu/e_logl.S: Likewise.
+ * sysdeps/x86_64/fpu/e_powl.S: Likewise.
+ * sysdeps/x86_64/fpu/e_remainderl.S: Likewise.
+ * sysdeps/x86_64/fpu/e_scalbl.S: Likewise.
+ * sysdeps/x86_64/fpu/e_sqrt.c: Likewise. Fix parameter order
+ * sysdeps/x86_64/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/x86_64/fpu/math_private.h (__isnan): Cast d parameter.
+ (__isnanf): Likewise.
+ (__isinf_ns): Likewise.
+ (__isinf_nsf): Likewise.
+ (__finite): Likewise.
+ (__finitef): Likewise.
+ (__ieee754_sqrt): Define as macro.
+ (__ieee754_sqrtf): Define as macro.
+ (__ieee754_sqrtl): Define as macro.
+ * sysdeps/x86_64/fpu/bits/fenv.h (feraiseexcept): Add partially
+ inlined copy.
+ * sysdeps/x86_64/fpu/bits/mathinline.h: Make use of
+ __FINITE_MATH_ONLY__ consistent.
+ * sysdeps/ieee754/k_standard.c (__kernel_standard_f): New function.
+
2011-10-10 Andreas Schwab <schwab@linux-m68k.org>
* inet/getnetgrent_r.c (nscd_getnetgrent): Use __rawmemchr instead
diff --git a/NEWS b/NEWS
index 6bdacf0..9940957 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2011-10-8
+GNU C Library NEWS -- history of user-visible changes. 2011-10-12
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -44,6 +44,9 @@ Version 2.15
* nscd now also caches the netgroup database.
Implemented by Ulrich Drepper.
+
+* Integrate libm with gcc's -ffinite-math-only option.
+ Implemented by Ulrich Drepper.
Version 2.14
diff --git a/Versions.def b/Versions.def
index 4aa379f..6b05e5b 100644
--- a/Versions.def
+++ b/Versions.def
@@ -54,6 +54,7 @@ libm {
GLIBC_2.2.3
GLIBC_2.3.4
GLIBC_2.4
+ GLIBC_2.15
}
libnsl {
GLIBC_2.0
diff --git a/math/Makefile b/math/Makefile
index 25cb5f6..431eb5a 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1996-2001,2002,2003,2004,2005,2006,2011
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2006,2011 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +24,8 @@ subdir := math
headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
fpu_control.h complex.h bits/cmathcalls.h fenv.h \
- bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h
+ bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
+ bits/math-finite.h
# Internal header files.
distribute := math_ldbl.h math_private.h machine/asm.h
diff --git a/math/Versions b/math/Versions
index 39c4762..66bf460 100644
--- a/math/Versions
+++ b/math/Versions
@@ -168,4 +168,33 @@ libm {
# puts exp2l in GLIBC_2.1, which will override this entry.
exp2l;
}
+ GLIBC_2.15 {
+ # Optimized -ffinite-math-only entry points
+ __acos_finite; __acosf_finite; __acosl_finite;
+ __acosh_finite; __acoshf_finite; __acoshl_finite;
+ __asin_finite; __asinf_finite; __asinl_finite;
+ __atan2_finite; __atan2f_finite; __atan2l_finite;
+ __atanh_finite; __atanhf_finite; __atanhl_finite;
+ __cosh_finite; __coshf_finite; __coshl_finite;
+ __exp10_finite; __exp10f_finite; __exp10l_finite;
+ __exp2_finite; __exp2f_finite; __exp2l_finite;
+ __fmod_finite; __fmodf_finite; __fmodl_finite;
+ __hypot_finite; __hypotf_finite; __hypotl_finite;
+ __j0_finite; __j0f_finite; __j0l_finite;
+ __y0_finite; __y0f_finite; __y0l_finite;
+ __j1_finite; __j1f_finite; __j1l_finite;
+ __y1_finite; __y1f_finite; __y1l_finite;
+ __jn_finite; __jnf_finite; __jnl_finite;
+ __yn_finite; __ynf_finite; __ynl_finite;
+ __lgamma_r_finite; __lgammaf_r_finite; __lgammal_r_finite;
+ __log_finite; __logf_finite; __logl_finite;
+ __log10_finite; __log10f_finite; __log10l_finite;
+ __log2_finite; __log2f_finite; __log2l_finite;
+ __pow_finite; __powf_finite; __powl_finite;
+ __remainder_finite; __remainderf_finite; __remainderl_finite;
+ __scalb_finite; __scalbf_finite; __scalbl_finite;
+ __sinh_finite; __sinhf_finite; __sinhl_finite;
+ __sqrt_finite; __sqrtf_finite; __sqrtl_finite;
+ __gamma_r_finite; __gammaf_r_finite; __gammal_r_finite;
+ }
}
diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h
new file mode 100644
index 0000000..c6b9527
--- /dev/null
+++ b/math/bits/math-finite.h
@@ -0,0 +1,315 @@
+/* Entry points to finite-math-only compiler runs.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/math-finite.h> directly; include <math.h> instead."
+#endif
+
+/* acos. */
+extern double acos (double) __asm__ ("__acos_finite");
+extern float acosf (float) __asm__ ("__acosf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double acosl (long double) __asm__ ("__acosl_finite");
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* acosh. */
+extern double acosh (double) __asm__ ("__acosh_finite");
+extern float acoshf (float) __asm__ ("__acoshf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double acoshl (long double) __asm__ ("__acoshl_finite");
+# endif
+#endif
+
+/* asin. */
+extern double asin (double) __asm__ ("__asin_finite");
+extern float asinf (float) __asm__ ("__asinf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double asinl (long double) __asm__ ("__asinl_finite");
+#endif
+
+/* atan2. */
+extern double atan2 (double, double) __asm__ ("__atan2_finite");
+extern float atan2f (float, float) __asm__ ("__atan2f_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double atan2l (long double, long double) __asm__ ("__atan2l_finite");
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* atanh. */
+extern double atanh (double) __asm__ ("__atanh_finite");
+extern float atanhf (float) __asm__ ("__atanhf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double atanhl (long double) __asm__ ("__atanhl_finite");
+# endif
+#endif
+
+/* cosh. */
+extern double cosh (double) __asm__ ("__cosh_finite");
+extern float coshf (float) __asm__ ("__coshf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double coshl (long double) __asm__ ("__coshl_finite");
+#endif
+
+#ifdef __USE_GNU
+/* exp10. */
+extern double exp10 (double) __asm__ ("__exp10_finite");
+extern float exp10f (float) __asm__ ("__exp10f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double exp10l (long double) __asm__ ("__exp10l_finite");
+# endif
+
+/* pow10. */
+extern double pow10 (double) __asm__ ("__exp10_finite");
+extern float pow10f (float) __asm__ ("__exp10f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double pow10l (long double) __asm__ ("__exp10l_finite");
+# endif
+#endif
+
+#ifdef __USE_ISOC99
+/* exp2. */
+extern double exp2 (double) __asm__ ("__exp2_finite");
+extern float exp2f (float) __asm__ ("__exp2f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double exp2l (long double) __asm__ ("__exp2l_finite");
+# endif
+#endif
+
+/* fmod. */
+extern double fmod (double, double) __asm__ ("__fmod_finite");
+extern float fmodf (float, float) __asm__ ("__fmodf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double fmodl (long double, long double) __asm__ ("__fmodl_finite");
+#endif
+
+#ifdef __USE_ISOC99
+/* hypot. */
+extern double hypot (double, double) __asm__ ("__hypot_finite");
+extern float hypotf (float, float) __asm__ ("__hypotf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double hypotl (long double, long double) __asm__ ("__hypotl_finite");
+# endif
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN
+/* j0. */
+extern double j0 (double) __asm__ ("__j0_finite");
+extern float j0f (float) __asm__ ("__j0f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double j0l (long double) __asm__ ("__j0l_finite");
+# endif
+
+/* y0. */
+extern double y0 (double) __asm__ ("__y0_finite");
+extern float y0f (float) __asm__ ("__y0f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double y0l (long double) __asm__ ("__y0l_finite");
+# endif
+
+/* j1. */
+extern double j1 (double) __asm__ ("__j1_finite");
+extern float j1f (float) __asm__ ("__j1f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double j1l (long double) __asm__ ("__j1l_finite");
+# endif
+
+/* y1. */
+extern double y1 (double) __asm__ ("__y1_finite");
+extern float y1f (float) __asm__ ("__y1f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double y1l (long double) __asm__ ("__y1l_finite");
+# endif
+
+/* jn. */
+extern double jn (int, double) __asm__ ("__jn_finite");
+extern float jnf (int, float) __asm__ ("__jnf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double jnl (int, long double) __asm__ ("__jnl_finite");
+# endif
+
+/* yn. */
+extern double yn (int, double) __asm__ ("__yn_finite");
+extern float ynf (int, float) __asm__ ("__ynf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double ynl (int, long double) __asm__ ("__ynl_finite");
+# endif
+#endif
+
+#ifdef __USE_MISC
+/* lgamma_r. */
+extern double lgamma_r (double, int *) __asm__ ("__lgamma_r_finite");
+extern float lgammaf_r (float, int *) __asm__ ("__lgammaf_r_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double lgammal_r (long double, int *) __asm__ ("__lgammal_r_finite");
+# endif
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
+/* lgamma. */
+__extern_always_inline double lgamma (double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgamma_r (__d, &__local_signgam);
+# else
+ return lgamma_r (__d, &signgam);
+# endif
+}
+__extern_always_inline float lgammaf (float __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammaf_r (__d, &__local_signgam);
+# else
+ return lgammaf_r (__d, &signgam);
+# endif
+}
+# ifdef __MATH_DECLARE_LDOUBLE
+__extern_always_inline long double lgammal (long double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammal_r (__d, &__local_signgam);
+# else
+ return lgammal_r (__d, &signgam);
+# endif
+}
+# endif
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN
+/* gamma. */
+__extern_always_inline double gamma (double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgamma_r (__d, &__local_signgam);
+# else
+ return lgamma_r (__d, &signgam);
+# endif
+}
+__extern_always_inline float gammaf (float __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammaf_r (__d, &__local_signgam);
+# else
+ return lgammaf_r (__d, &signgam);
+# endif
+}
+# ifdef __MATH_DECLARE_LDOUBLE
+__extern_always_inline long double gammal (long double __d)
+{
+# ifdef __USE_ISOC99
+ int __local_signgam = 0;
+ return lgammal_r (__d, &__local_signgam);
+# else
+ return lgammal_r (__d, &signgam);
+# endif
+}
+# endif
+#endif
+
+/* log. */
+extern double log (double) __asm__ ("__log_finite");
+extern float logf (float) __asm__ ("__logf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double logl (long double) __asm__ ("__logl_finite");
+#endif
+
+/* log10. */
+extern double log10 (double) __asm__ ("__log10_finite");
+extern float log10f (float) __asm__ ("__log10f_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double log10l (long double) __asm__ ("__log10l_finite");
+#endif
+
+#ifdef __USE_ISOC99
+/* log2. */
+extern double log2 (double) __asm__ ("__log2_finite");
+extern float log2f (float) __asm__ ("__log2f_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double log2l (long double) __asm__ ("__log2l_finite");
+# endif
+#endif
+
+/* pow. */
+extern double pow (double, double) __asm__ ("__pow_finite");
+extern float powf (float, float) __asm__ ("__powf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double powl (long double, long double) __asm__ ("__powl_finite");
+#endif
+
+/* remainder. */
+extern double remainder (double, double) __asm__ ("__remainder_finite");
+extern float remainderf (float, float) __asm__ ("__remainderf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double remainderl (long double, long double) __asm__ ("__remainderl_finite");
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* scalb. */
+extern double scalb (double, double) __asm__ ("__scalb_finite");
+extern float scalbf (float, float) __asm__ ("__scalbf_finite");
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double scalbl (long double, long double) __asm__ ("__scalbl_finite");
+# endif
+#endif
+
+/* sinh. */
+extern double sinh (double) __asm__ ("__sinh_finite");
+extern float sinhf (float) __asm__ ("__sinhf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double sinhl (long double) __asm__ ("__sinhl_finite");
+#endif
+
+/* sqrt. */
+extern double sqrt (double) __asm__ ("__sqrt_finite");
+extern float sqrtf (float) __asm__ ("__sqrtf_finite");
+#ifdef __MATH_DECLARE_LDOUBLE
+extern long double sqrtl (long double) __asm__ ("__sqrtl_finite");
+#endif
+
+#ifdef __USE_ISOC99
+/* tgamma. */
+extern double __gamma_r_finite (double, int *);
+__extern_always_inline double tgamma (double __d)
+{
+ int __local_signgam = 0;
+ double __res = __gamma_r_finite (__d, &__local_signgam);
+ return __local_signgam < 0 ? -__res : __res;
+}
+extern float __gammaf_r_finite (float, int *);
+__extern_always_inline float tgammaf (float __d)
+{
+ int __local_signgam = 0;
+ float __res = __gammaf_r_finite (__d, &__local_signgam);
+ return __local_signgam < 0 ? -__res : __res;
+}
+# ifdef __MATH_DECLARE_LDOUBLE
+extern long double __gammal_r_finite (long double, int *);
+__extern_always_inline long double tgammal (long double __d)
+{
+ int __local_signgam = 0;
+ long double __res = __gammal_r_finite (__d, &__local_signgam);
+ return __local_signgam < 0 ? -__res : __res;
+}
+# endif
+#endif
diff --git a/math/e_acoshl.c b/math/e_acoshl.c
index 2c2fbe8..490fd10 100644
--- a/math/e_acoshl.c
+++ b/math/e_acoshl.c
@@ -9,6 +9,7 @@ __ieee754_acoshl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_acoshl, __acoshl_finite)
stub_warning (acoshl)
#include <stub-tag.h>
diff --git a/math/e_acosl.c b/math/e_acosl.c
index d844d88..55d9ab0 100644
--- a/math/e_acosl.c
+++ b/math/e_acosl.c
@@ -9,6 +9,7 @@ __ieee754_acosl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_acosl, __acosl_finite)
stub_warning (acosl)
#include <stub-tag.h>
diff --git a/math/e_asinl.c b/math/e_asinl.c
index 3b26f03..8e6c47e 100644
--- a/math/e_asinl.c
+++ b/math/e_asinl.c
@@ -9,6 +9,7 @@ __ieee754_asinl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_asinl, __asinl_finite)
stub_warning (asinl)
#include <stub-tag.h>
diff --git a/math/e_atan2l.c b/math/e_atan2l.c
index 0caed8a..8ca3762 100644
--- a/math/e_atan2l.c
+++ b/math/e_atan2l.c
@@ -9,6 +9,7 @@ __ieee754_atan2l (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
stub_warning (atan2l)
#include <stub-tag.h>
diff --git a/math/e_atanhl.c b/math/e_atanhl.c
index 625d42d..26c52e7 100644
--- a/math/e_atanhl.c
+++ b/math/e_atanhl.c
@@ -9,6 +9,7 @@ __ieee754_atanhl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_atanhl, __atanhl_finite)
stub_warning (__ieee754_atanhl)
#include <stub-tag.h>
diff --git a/math/e_coshl.c b/math/e_coshl.c
index 0da319b..92bfd7a 100644
--- a/math/e_coshl.c
+++ b/math/e_coshl.c
@@ -9,6 +9,7 @@ __ieee754_coshl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_coshl, __coshl_finite)
stub_warning (__ieee754_coshl)
#include <stub-tag.h>
diff --git a/math/e_exp10.c b/math/e_exp10.c
index 231ceb2..ce14ea5 100644
--- a/math/e_exp10.c
+++ b/math/e_exp10.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,3 +28,4 @@ __ieee754_exp10 (double arg)
replaced sometime (soon?). */
return __ieee754_exp (M_LN10 * arg);
}
+strong_alias (__ieee754_exp10, __exp10_finite)
diff --git a/math/e_exp10f.c b/math/e_exp10f.c
index 642ed83..68e9723 100644
--- a/math/e_exp10f.c
+++ b/math/e_exp10f.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,3 +28,4 @@ __ieee754_exp10f (float arg)
replaced sometime (soon?). */
return __ieee754_expf (M_LN10 * arg);
}
+strong_alias (__ieee754_exp10f, __exp10f_finite)
diff --git a/math/e_exp10l.c b/math/e_exp10l.c
index cbc1897e..6bd859f 100644
--- a/math/e_exp10l.c
+++ b/math/e_exp10l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,3 +28,4 @@ __ieee754_exp10l (long double arg)
replaced sometime (soon?). */
return __ieee754_expl (M_LN10l * arg);
}
+strong_alias (__ieee754_exp10l, __exp10l_finite)
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
index d6d0155..e7e4939 100644
--- a/math/e_exp2l.c
+++ b/math/e_exp2l.c
@@ -8,3 +8,4 @@ __ieee754_exp2l (long double x)
replaced sometime (soon?). */
return __ieee754_expl (M_LN2l * x);
}
+strong_alias (__ieee754_exp2l, __exp2l_finite)
diff --git a/math/e_fmodl.c b/math/e_fmodl.c
index 380da24..dbd361e 100644
--- a/math/e_fmodl.c
+++ b/math/e_fmodl.c
@@ -9,6 +9,7 @@ __ieee754_fmodl (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_fmodl, __fmodl_finite)
stub_warning (fmodl)
#include <stub-tag.h>
diff --git a/math/e_gammal_r.c b/math/e_gammal_r.c
index 1c45c84..c0ae704 100644
--- a/math/e_gammal_r.c
+++ b/math/e_gammal_r.c
@@ -10,6 +10,7 @@ __ieee754_gammal_r (long double x, int *signgamp)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_gammal_r, __gammal_r_finite)
stub_warning (__ieee754_gammal_r)
#include <stub-tag.h>
diff --git a/math/e_hypotl.c b/math/e_hypotl.c
index 07df22e..73bad62 100644
--- a/math/e_hypotl.c
+++ b/math/e_hypotl.c
@@ -9,6 +9,7 @@ __ieee754_hypotl (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_hypotl, __hypotl_finite)
stub_warning (__ieee754_hypotl)
#include <stub-tag.h>
diff --git a/math/e_j0l.c b/math/e_j0l.c
index 7a167c2..eb01ba6 100644
--- a/math/e_j0l.c
+++ b/math/e_j0l.c
@@ -10,6 +10,7 @@ __ieee754_j0l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_j0l, __j0l_finite)
stub_warning (j0l)
@@ -20,6 +21,7 @@ __ieee754_y0l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_y0l, __y0l_finite)
stub_warning (y0l)
#include <stub-tag.h>
diff --git a/math/e_j1l.c b/math/e_j1l.c
index 625e886..7701f49 100644
--- a/math/e_j1l.c
+++ b/math/e_j1l.c
@@ -10,6 +10,7 @@ __ieee754_j1l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_j1l, __j1l_finite)
stub_warning (j1l)
@@ -20,6 +21,7 @@ __ieee754_y1l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_y1l, __y1l_finite)
stub_warning (y1l)
#include <stub-tag.h>
diff --git a/math/e_jnl.c b/math/e_jnl.c
index a04c9fe..059b1db 100644
--- a/math/e_jnl.c
+++ b/math/e_jnl.c
@@ -10,6 +10,7 @@ __ieee754_jnl (int n, long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_jnl, __jnl_finite)
stub_warning (jnl)
@@ -20,6 +21,7 @@ __ieee754_ynl (int n, long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_ynl, __ynl_finite)
stub_warning (ynl)
#include <stub-tag.h>
diff --git a/math/e_lgammal_r.c b/math/e_lgammal_r.c
index f46f707..92e7700 100644
--- a/math/e_lgammal_r.c
+++ b/math/e_lgammal_r.c
@@ -11,6 +11,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_lgammal_r, __lgammal_r_finite)
stub_warning (lgammal)
stub_warning (lgammal_r)
diff --git a/math/e_log10l.c b/math/e_log10l.c
index 5bc264b..2c7ff72 100644
--- a/math/e_log10l.c
+++ b/math/e_log10l.c
@@ -9,6 +9,7 @@ __ieee754_log10l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_log10l, __log10l_finite)
stub_warning (log10l)
#include <stub-tag.h>
diff --git a/math/e_log2l.c b/math/e_log2l.c
index 681904b..95929c3 100644
--- a/math/e_log2l.c
+++ b/math/e_log2l.c
@@ -9,6 +9,7 @@ __ieee754_log2l (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_log2l, __log2l_finite)
stub_warning (log2l)
#include <stub-tag.h>
diff --git a/math/e_logl.c b/math/e_logl.c
index 9ba9cfc..95608ab 100644
--- a/math/e_logl.c
+++ b/math/e_logl.c
@@ -9,6 +9,7 @@ __ieee754_logl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_logl, __logl_finite)
stub_warning (logl)
#include <stub-tag.h>
diff --git a/math/e_powl.c b/math/e_powl.c
index afc2248..ab79b1a 100644
--- a/math/e_powl.c
+++ b/math/e_powl.c
@@ -9,6 +9,7 @@ __ieee754_powl (long double x, long double y)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_powl, __powl_finite)
stub_warning (powl)
#include <stub-tag.h>
diff --git a/math/e_scalb.c b/math/e_scalb.c
index f2c207a..3b81dd5 100644
--- a/math/e_scalb.c
+++ b/math/e_scalb.c
@@ -1,71 +1,59 @@
-/* @(#)e_scalb.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-/*
- * __ieee754_scalb(x, fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef _SCALB_INT
-#ifdef __STDC__
- double __ieee754_scalb(double x, int fn)
-#else
- double __ieee754_scalb(x,fn)
- double x; int fn;
-#endif
-#else
-#ifdef __STDC__
- double __ieee754_scalb(double x, double fn)
-#else
- double __ieee754_scalb(x,fn)
- double x, fn;
-#endif
-#endif
+
+static double
+__attribute__ ((noinline))
+invalid_fn (double x, double fn)
{
-#ifdef _SCALB_INT
- return __scalbn(x,fn);
-#else
- if (__isnan(x)||__isnan(fn)) return x*fn;
- if (!__finite(fn)) {
- if(fn>0.0) return x*fn;
- else if (x == 0)
- return x;
- else if (!__finite (x))
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nan ("");
- }
- else return x/(-fn);
- }
- if (__rint(fn)!=fn)
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nan ("");
- }
- if ( fn > 65000.0) return __scalbn(x, 65000);
- if (-fn > 65000.0) return __scalbn(x,-65000);
- return __scalbn(x,(int)fn);
-#endif
+ if (__rint (fn) != fn)
+ {
+ feraiseexcept (FE_INVALID);
+ return __nan ("");
+ }
+ else if (fn > 65000.0)
+ return __scalbn (x, 65000);
+ else
+ return __scalbn (x,-65000);
+}
+
+
+double
+__ieee754_scalb (double x, double fn)
+{
+ if (__builtin_expect (__isnan (x), 0))
+ return x * fn;
+ if (__builtin_expect (!__finite (fn), 0))
+ {
+ if (__isnan (fn) || fn > 0.0)
+ return x * fn;
+ if (x == 0.0)
+ return x;
+ return x / -fn;
+ }
+ if (__builtin_expect ((double) (int) fn != fn, 0))
+ return invalid_fn (x, fn);
+
+ return __scalbn (x, (int) fn);
}
+strong_alias (__ieee754_scalb, __scalb_finite)
diff --git a/math/e_scalbf.c b/math/e_scalbf.c
index 3caa535..61847d9 100644
--- a/math/e_scalbf.c
+++ b/math/e_scalbf.c
@@ -1,68 +1,59 @@
-/* e_scalbf.c -- float version of e_scalb.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_scalbf.c,v 1.3 1995/05/10 20:46:12 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef _SCALB_INT
-#ifdef __STDC__
- float __ieee754_scalbf(float x, int fn)
-#else
- float __ieee754_scalbf(x,fn)
- float x; int fn;
-#endif
-#else
-#ifdef __STDC__
- float __ieee754_scalbf(float x, float fn)
-#else
- float __ieee754_scalbf(x,fn)
- float x, fn;
-#endif
-#endif
+
+static float
+__attribute__ ((noinline))
+invalid_fn (float x, float fn)
{
-#ifdef _SCALB_INT
- return __scalbnf(x,fn);
-#else
- if (__isnanf(x)||__isnanf(fn)) return x*fn;
- if (!__finitef(fn)) {
- if(fn>(float)0.0) return x*fn;
- else if (x == 0)
- return x;
- else if (!__finitef (x))
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanf ("");
- }
- else return x/(-fn);
- }
- if (__rintf(fn)!=fn)
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanf ("");
- }
- if ( fn > (float)65000.0) return __scalbnf(x, 65000);
- if (-fn > (float)65000.0) return __scalbnf(x,-65000);
- return __scalbnf(x,(int)fn);
-#endif
+ if (__rintf (fn) != fn)
+ {
+ feraiseexcept (FE_INVALID);
+ return __nan ("");
+ }
+ else if (fn > 65000.0f)
+ return __scalbnf (x, 65000);
+ else
+ return __scalbnf (x,-65000);
+}
+
+
+float
+__ieee754_scalbf (float x, float fn)
+{
+ if (__builtin_expect (__isnanf (x), 0))
+ return x * fn;
+ if (__builtin_expect (!__finitef (fn), 0))
+ {
+ if (__isnanf (fn) || fn > 0.0f)
+ return x * fn;
+ if (x == 0.0f)
+ return x;
+ return x / -fn;
+ }
+ if (__builtin_expect ((float) (int) fn != fn, 0))
+ return invalid_fn (x, fn);
+
+ return __scalbnf (x, (int) fn);
}
+strong_alias (__ieee754_scalbf, __scalbf_finite)
diff --git a/math/e_scalbl.c b/math/e_scalbl.c
index ad3595c..6b36b71 100644
--- a/math/e_scalbl.c
+++ b/math/e_scalbl.c
@@ -1,75 +1,59 @@
-/* e_scalbl.c -- long double version of s_scalb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * __ieee754_scalbl(x, fn) is provide for
- * passing various standard test suite. One
- * should use scalbnl() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef _SCALB_INT
-#ifdef __STDC__
- long double __ieee754_scalbl(long double x, int fn)
-#else
- long double __ieee754_scalbl(x,fn)
- long double x; int fn;
-#endif
-#else
-#ifdef __STDC__
- long double __ieee754_scalbl(long double x, long double fn)
-#else
- long double __ieee754_scalbl(x,fn)
- long double x, fn;
-#endif
-#endif
+
+static long double
+__attribute__ ((noinline))
+invalid_fn (long double x, long double fn)
+{
+ if (__rintl (fn) != fn)
+ {
+ feraiseexcept (FE_INVALID);
+ return __nan ("");
+ }
+ else if (fn > 65000.0L)
+ return __scalbnl (x, 65000);
+ else
+ return __scalbnl (x,-65000);
+}
+
+
+long double
+__ieee754_scalbl (long double x, long double fn)
{
-#ifdef _SCALB_INT
- return __scalbnl(x,fn);
-#else
- if (__isnanl(x)||__isnanl(fn)) return x*fn;
- if (!__finitel(fn)) {
- if(fn>0.0) return x*fn;
- else if (x == 0)
- return x;
- else if (!__finitel (x))
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanl ("");
- }
- else return x/(-fn);
- }
- if (__rintl(fn)!=fn)
- {
-# ifdef FE_INVALID
- feraiseexcept (FE_INVALID);
-# endif
- return __nanl ("");
- }
- if ( fn > 65000.0) return __scalbnl(x, 65000);
- if (-fn > 65000.0) return __scalbnl(x,-65000);
- return __scalbnl(x,(int)fn);
-#endif
+ if (__builtin_expect (__isnanl (x), 0))
+ return x * fn;
+ if (__builtin_expect (!__finitel (fn), 0))
+ {
+ if (__isnanl (fn) || fn > 0.0L)
+ return x * fn;
+ if (x == 0.0L)
+ return x;
+ return x / -fn;
+ }
+ if (__builtin_expect ((long double) (int) fn != fn, 0))
+ return invalid_fn (x, fn);
+
+ return __scalbnl (x, (int) fn);
}
+strong_alias (__ieee754_scalbl, __scalbl_finite)
diff --git a/math/e_sinhl.c b/math/e_sinhl.c
index 4cec79c..fc756c9 100644
--- a/math/e_sinhl.c
+++ b/math/e_sinhl.c
@@ -9,6 +9,7 @@ __ieee754_sinhl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_sinhl, __sinhl_finite)
stub_warning (__ieee754_sinhl)
#include <stub-tag.h>
diff --git a/math/e_sqrtl.c b/math/e_sqrtl.c
index 7680bdb..af9c2b5 100644
--- a/math/e_sqrtl.c
+++ b/math/e_sqrtl.c
@@ -9,6 +9,7 @@ __ieee754_sqrtl (long double x)
__set_errno (ENOSYS);
return 0.0;
}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
stub_warning (sqrtl)
#include <stub-tag.h>
diff --git a/math/math.h b/math/math.h
index aeb54d9..8b98ff3 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,5 @@
/* Declarations for math functions.
- Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009
+ Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -64,10 +64,10 @@ __BEGIN_DECLS
#define __MATHDECL_1(type, function,suffix, args) \
extern type __MATH_PRECNAME(function,suffix) args __THROW
-#define _Mdouble_ double
+#define _Mdouble_ double
#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
-# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
-# define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
+#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
+#define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
#include <bits/mathcalls.h>
#undef _Mdouble_
#undef _Mdouble_BEGIN_NAMESPACE
@@ -83,7 +83,7 @@ __BEGIN_DECLS
# ifndef _Mfloat_
# define _Mfloat_ float
# endif
-# define _Mdouble_ _Mfloat_
+# define _Mdouble_ _Mfloat_
# ifdef __STDC__
# define __MATH_PRECNAME(name,r) name##f##r
# else
@@ -130,7 +130,7 @@ extern long double __REDIRECT_NTH (nexttowardl,
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
-# define _Mdouble_ _Mlong_double_
+# define _Mdouble_ _Mlong_double_
# ifdef __STDC__
# define __MATH_PRECNAME(name,r) name##l##r
# else
@@ -138,10 +138,11 @@ extern long double __REDIRECT_NTH (nexttowardl,
# endif
# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
+# define __MATH_DECLARE_LDOUBLE 1
# include <bits/mathcalls.h>
# undef _Mdouble_
-# undef _Mdouble_BEGIN_NAMESPACE
-# undef _Mdouble_END_NAMESPACE
+# undef _Mdouble_BEGIN_NAMESPACE
+# undef _Mdouble_END_NAMESPACE
# undef __MATH_PRECNAME
# endif /* __STDC__ || __GNUC__ */
@@ -416,6 +417,12 @@ extern int matherr (struct exception *__exc);
# include <bits/mathinline.h>
#endif
+/* Define special entry points to use when the compiler got told to
+ only expect finite results. */
+#if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0
+# include <bits/math-finite.h>
+#endif
+
#ifdef __USE_ISOC99
/* If we've still got undefined comparison macros, provide defaults. */
diff --git a/math/math_private.h b/math/math_private.h
index e5ca61f..c5fbf15 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -202,6 +202,7 @@ extern double __ieee754_scalb (double,double);
/* fdlibm kernel function */
extern double __kernel_standard (double,double,int);
+extern float __kernel_standard_f (float,float,int);
extern double __kernel_sin (double,double,int);
extern double __kernel_cos (double,double);
extern double __kernel_tan (double,double,int);
diff --git a/math/w_acos.c b/math/w_acos.c
index 0bf5a80..617cfda 100644
--- a/math/w_acos.c
+++ b/math/w_acos.c
@@ -1,45 +1,39 @@
-/* @(#)w_acos.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acos.c,v 1.6 1995/05/10 20:48:26 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrap_acos(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __acos(double x) /* wrapper acos */
-#else
- double __acos(x) /* wrapper acos */
- double x;
-#endif
+/* wrapper acos */
+double
+__acos (double x)
{
-#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
+ if (__builtin_expect (fabs (x) > 1.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 1);
+ }
+
+ return __ieee754_acos (x);
}
weak_alias (__acos, acos)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_acosf.c b/math/w_acosf.c
index 37d22af..bb3aae0 100644
--- a/math/w_acosf.c
+++ b/math/w_acosf.c
@@ -1,48 +1,38 @@
-/* w_acosf.c -- float version of w_acos.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acosf.c,v 1.3 1995/05/10 20:48:29 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrap_acosf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __acosf(float x) /* wrapper acosf */
-#else
- float __acosf(x) /* wrapper acosf */
- float x;
-#endif
+/* wrapper acosf */
+float
+__acosf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosf(x);
-#else
- float z;
- z = __ieee754_acosf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(fabsf(x)>(float)1.0) {
- /* acosf(|x|>1) */
- return (float)__kernel_standard((double)x,(double)x,101);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 101);
+ }
+
+ return __ieee754_acosf (x);
}
weak_alias (__acosf, acosf)
diff --git a/math/w_acosh.c b/math/w_acosh.c
index 18ea8cc..50201b4 100644
--- a/math/w_acosh.c
+++ b/math/w_acosh.c
@@ -1,44 +1,35 @@
-/* @(#)w_acosh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper acosh(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __acosh(double x) /* wrapper acosh */
-#else
- double __acosh(x) /* wrapper acosh */
- double x;
-#endif
+
+/* wrapper acosh */
+double
+__acosh (double x)
{
-#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
+ if (__builtin_expect (x < 1.0, 0) && _LIB_VERSION != _IEEE_)
+ /* acosh(x<1) */
+ return __kernel_standard (x, x, 29);
+
+ return __ieee754_acosh (x);
}
weak_alias (__acosh, acosh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_acoshf.c b/math/w_acoshf.c
index d7d6d4e..2b07824 100644
--- a/math/w_acoshf.c
+++ b/math/w_acoshf.c
@@ -1,48 +1,34 @@
-/* w_acoshf.c -- float version of w_acosh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- *
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acoshf.c,v 1.3 1995/05/10 20:48:33 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper acoshf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __acoshf(float x) /* wrapper acoshf */
-#else
- float __acoshf(x) /* wrapper acoshf */
- float x;
-#endif
+
+/* wrapper acoshf */
+float
+__acoshf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acoshf(x);
-#else
- float z;
- z = __ieee754_acoshf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(x<(float)1.0) {
- /* acosh(x<1) */
- return (float)__kernel_standard((double)x,(double)x,129);
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ /* acosh(x<1) */
+ return __kernel_standard_f (x, x, 129);
+
+ return __ieee754_acoshf (x);
}
weak_alias (__acoshf, acoshf)
diff --git a/math/w_acoshl.c b/math/w_acoshl.c
index 3c77321..0f7068a 100644
--- a/math/w_acoshl.c
+++ b/math/w_acoshl.c
@@ -1,47 +1,34 @@
-/* w_acoshl.c -- long double version of w_acosh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper acoshl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __acoshl(long double x) /* wrapper acosh */
-#else
- long double __acoshl(x) /* wrapper acosh */
- long double x;
-#endif
+
+/* wrapper acosl */
+long double
+__acoshl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acoshl(x);
-#else
- long double z;
- z = __ieee754_acoshl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(x<1.0) {
- return __kernel_standard(x,x,229); /* acoshl(x<1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ /* acosh(x<1) */
+ return __kernel_standard (x, x, 229);
+
+ return __ieee754_acoshl (x);
}
weak_alias (__acoshl, acoshl)
diff --git a/math/w_acosl.c b/math/w_acosl.c
index a16c55b..dd1039e 100644
--- a/math/w_acosl.c
+++ b/math/w_acosl.c
@@ -1,48 +1,38 @@
-/* w_acosl.c -- long double version of w_acos.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrap_acosl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __acosl(long double x) /* wrapper acos */
-#else
- long double __acosl(x) /* wrapper acos */
- long double x;
-#endif
+/* wrapper acosl */
+long double
+__acosl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_acosl(x);
-#else
- long double z;
- z = __ieee754_acosl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(fabsl(x)>1.0) {
- return __kernel_standard(x,x,201); /* acosl(|x|>1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 201);
+ }
+
+ return __ieee754_acosl (x);
}
weak_alias (__acosl, acosl)
diff --git a/math/w_asin.c b/math/w_asin.c
index b7fccde..feb5c6a 100644
--- a/math/w_asin.c
+++ b/math/w_asin.c
@@ -1,46 +1,39 @@
-/* @(#)w_asin.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-/*
- * wrapper asin(x)
- */
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __asin(double x) /* wrapper asin */
-#else
- double __asin(x) /* wrapper asin */
- double x;
-#endif
+/* wrapper asin */
+double
+__asin (double x)
{
-#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
+ if (__builtin_expect (fabs (x) > 1.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 2);
+ }
+
+ return __ieee754_asin (x);
}
weak_alias (__asin, asin)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_asinf.c b/math/w_asinf.c
index f2c0b22..1a21dc3 100644
--- a/math/w_asinf.c
+++ b/math/w_asinf.c
@@ -1,49 +1,38 @@
-/* w_asinf.c -- float version of w_asin.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_asinf.c,v 1.3 1995/05/10 20:48:37 jtc Exp $";
-#endif
-
-/*
- * wrapper asinf(x)
- */
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __asinf(float x) /* wrapper asinf */
-#else
- float __asinf(x) /* wrapper asinf */
- float x;
-#endif
+/* wrapper asinf */
+float
+__asinf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_asinf(x);
-#else
- float z;
- z = __ieee754_asinf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(fabsf(x)>(float)1.0) {
- /* asinf(|x|>1) */
- return (float)__kernel_standard((double)x,(double)x,102);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 102);
+ }
+
+ return __ieee754_asinf (x);
}
weak_alias (__asinf, asinf)
diff --git a/math/w_asinl.c b/math/w_asinl.c
index 9a316b7..a9f14fb 100644
--- a/math/w_asinl.c
+++ b/math/w_asinl.c
@@ -1,49 +1,38 @@
-/* w_asinl.c -- long double version of w_asin.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper asinl(x)
- */
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __asinl(long double x) /* wrapper asinl */
-#else
- long double __asinl(x) /* wrapper asinl */
- long double x;
-#endif
+/* wrapper asinl */
+long double
+__asinl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_asinl(x);
-#else
- long double z;
- z = __ieee754_asinl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(fabsl(x)>1.0) {
- return __kernel_standard(x,x,202); /* asinl(|x|>1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 202);
+ }
+
+ return __ieee754_asinl (x);
}
weak_alias (__asinl, asinl)
diff --git a/math/w_atan2.c b/math/w_atan2.c
index 4fcaba9..7d61c72 100644
--- a/math/w_atan2.c
+++ b/math/w_atan2.c
@@ -1,18 +1,21 @@
-/* @(#)w_atan2.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/*
* wrapper atan2(y,x)
@@ -22,23 +25,13 @@ static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- double __atan2(double y, double x) /* wrapper atan2 */
-#else
- double __atan2(y,x) /* wrapper atan2 */
- double y,x;
-#endif
+double
+__atan2 (double y, double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2(y,x);
-#else
- double z;
- z = __ieee754_atan2(y,x);
- if(_LIB_VERSION != _SVID_||__isnan(x)||__isnan(y)) return z;
- if(x==0.0&&y==0.0)
- return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
- return z;
-#endif
+ if (__builtin_expect (x == 0.0 && y == 0.0, 0) && _LIB_VERSION == _SVID_)
+ return __kernel_standard (y, x, 3); /* atan2(+-0,+-0) */
+
+ return __ieee754_atan2 (y, x);
}
weak_alias (__atan2, atan2)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_atan2f.c b/math/w_atan2f.c
index 2a1ca9c..b3c65bf 100644
--- a/math/w_atan2f.c
+++ b/math/w_atan2f.c
@@ -1,21 +1,21 @@
-/* w_atan2f.c -- float version of w_atan2.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/*
* wrapper atan2f(y,x)
@@ -25,22 +25,12 @@ static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- float __atan2f(float y, float x) /* wrapper atan2f */
-#else
- float __atan2f(y,x) /* wrapper atan2 */
- float y,x;
-#endif
+float
+__atan2f (float y, float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2f(y,x);
-#else
- float z;
- z = __ieee754_atan2f(y,x);
- if(_LIB_VERSION != _SVID_||__isnanf(x)||__isnanf(y)) return z;
- if(x==0.0&&y==0.0)
- return __kernel_standard(y,x,103); /* atan2(+-0,+-0) */
- return z;
-#endif
+ if (__builtin_expect (x == 0.0f && y == 0.0f, 0) && _LIB_VERSION == _SVID_)
+ return __kernel_standard_f (y, x, 103); /* atan2(+-0,+-0) */
+
+ return __ieee754_atan2f (y, x);
}
weak_alias (__atan2f, atan2f)
diff --git a/math/w_atan2l.c b/math/w_atan2l.c
index 85d6f5d..c485499 100644
--- a/math/w_atan2l.c
+++ b/math/w_atan2l.c
@@ -1,22 +1,21 @@
-/* w_atan2l.c -- long double version of w_atan2.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/*
* wrapper atan2l(y,x)
@@ -26,22 +25,12 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
-#ifdef __STDC__
- long double __atan2l(long double y, long double x) /* wrapper atan2l */
-#else
- long double __atan2l(y,x) /* wrapper atan2l */
- long double y,x;
-#endif
+long double
+__atan2l (long double y, long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atan2l(y,x);
-#else
- long double z;
- z = __ieee754_atan2l(y,x);
- if(_LIB_VERSION != _SVID_||__isnanl(x)||__isnanl(y)) return z;
- if(x==0.0&&y==0.0)
- return __kernel_standard(y,x,203); /* atan2(+-0,+-0) */
- return z;
-#endif
+ if (__builtin_expect (x == 0.0L && y == 0.0L, 0) && _LIB_VERSION == _SVID_)
+ return __kernel_standard (y, x, 203); /* atan2(+-0,+-0) */
+
+ return __ieee754_atan2l (y, x);
}
weak_alias (__atan2l, atan2l)
diff --git a/math/w_atanh.c b/math/w_atanh.c
index a2dab67..61ea0d8 100644
--- a/math/w_atanh.c
+++ b/math/w_atanh.c
@@ -1,49 +1,37 @@
-/* @(#)w_atanh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper atanh(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __atanh(double x) /* wrapper atanh */
-#else
- double __atanh(x) /* wrapper atanh */
- double x;
-#endif
+/* wrapper atanh */
+double
+__atanh (double x)
{
-#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
+ if (__builtin_expect (fabs (x) >= 1.0, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x,
+ fabs (x) > 1.0
+ ? 30 /* atanh(|x|>1) */
+ : 31); /* atanh(|x|==1) */
+
+ return __ieee754_atanh (x);
}
weak_alias (__atanh, atanh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_atanhf.c b/math/w_atanhf.c
index 41dd2ac..fd1dbae 100644
--- a/math/w_atanhf.c
+++ b/math/w_atanhf.c
@@ -1,53 +1,36 @@
-/* w_atanhf.c -- float version of w_atanh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atanhf.c,v 1.3 1995/05/10 20:48:45 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper atanhf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __atanhf(float x) /* wrapper atanhf */
-#else
- float __atanhf(x) /* wrapper atanhf */
- float x;
-#endif
+/* wrapper atanhf */
+float
+__atanhf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanhf(x);
-#else
- float z,y;
- z = __ieee754_atanhf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- y = fabsf(x);
- if(y>=(float)1.0) {
- if(y>(float)1.0)
- /* atanhf(|x|>1) */
- return (float)__kernel_standard((double)x,(double)x,130);
- else
- /* atanhf(|x|==1) */
- return (float)__kernel_standard((double)x,(double)x,131);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) >= 1.0f, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x,
+ fabsf (x) > 1.0f
+ ? 130 /* atanh(|x|>1) */
+ : 131); /* atanh(|x|==1) */
+
+ return __ieee754_atanhf (x);
}
weak_alias (__atanhf, atanhf)
diff --git a/math/w_atanhl.c b/math/w_atanhl.c
index c61229c..7c958f1 100644
--- a/math/w_atanhl.c
+++ b/math/w_atanhl.c
@@ -1,52 +1,36 @@
-/* w_atanhl.c -- long double version of w_atanh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper atanhl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __atanhl(long double x) /* wrapper atanhl */
-#else
- long double __atanhl(x) /* wrapper atanhl */
- long double x;
-#endif
+/* wrapper atanhl */
+long double
+__atanhl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_atanhl(x);
-#else
- long double z,y;
- z = __ieee754_atanhl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- y = fabsl(x);
- if(y>=1.0) {
- if(y>1.0)
- return __kernel_standard(x,x,230); /* atanhl(|x|>1) */
- else
- return __kernel_standard(x,x,231); /* atanhl(|x|==1) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) >= 1.0L, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x,
+ fabsl (x) > 1.0L
+ ? 230 /* atanh(|x|>1) */
+ : 231); /* atanh(|x|==1) */
+
+ return __ieee754_atanhl (x);
}
weak_alias (__atanhl, atanhl)
diff --git a/math/w_cosh.c b/math/w_cosh.c
index 0e27a2d..5701078 100644
--- a/math/w_cosh.c
+++ b/math/w_cosh.c
@@ -1,4 +1,4 @@
-/* @(#)w_cosh.c 5.1 93/09/24 */
+/* Optimizations bu Ulrich Drepper <drepper@gmail.com>, 2011 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
-#endif
-
/*
* wrapper cosh(x)
*/
@@ -21,24 +17,15 @@ static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __cosh(double x) /* wrapper cosh */
-#else
- double __cosh(x) /* wrapper cosh */
- double x;
-#endif
+double
+__cosh (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_cosh(x);
-#else
- double z;
- z = __ieee754_cosh(x);
- if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
- if(!__finite(z) && __finite(x)) {
- return __kernel_standard(x,x,5); /* cosh overflow */
- } else
- return z;
-#endif
+ double z = __ieee754_cosh (x);
+ if (__builtin_expect (!__finite (z), 0) && __finite (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 5); /* cosh overflow */
+
+ return z;
}
weak_alias (__cosh, cosh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_coshf.c b/math/w_coshf.c
index 5e3477f..df1f681 100644
--- a/math/w_coshf.c
+++ b/math/w_coshf.c
@@ -1,5 +1,6 @@
/* w_coshf.c -- float version of w_cosh.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ * Optimizations by Ulrich Drepper <drepper@gmail.com>, 2011.
*/
/*
@@ -8,40 +9,26 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_coshf.c,v 1.3 1995/05/10 20:48:49 jtc Exp $";
-#endif
-
-/*
+/*
* wrapper coshf(x)
*/
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __coshf(float x) /* wrapper coshf */
-#else
- float __coshf(x) /* wrapper coshf */
- float x;
-#endif
+float
+__coshf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_coshf(x);
-#else
- float z;
- z = __ieee754_coshf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(!__finite(z) && __finite(x)) {
- /* cosh overflow */
- return (float)__kernel_standard((double)x,(double)x,105);
- } else
- return z;
-#endif
+ float z = __ieee754_coshf (x);
+ if (__builtin_expect (!__finitef (z), 0) && __finitef (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 105); /* cosh overflow */
+
+ return z;
}
weak_alias (__coshf, coshf)
diff --git a/math/w_coshl.c b/math/w_coshl.c
index ecba921..abca8b0 100644
--- a/math/w_coshl.c
+++ b/math/w_coshl.c
@@ -1,6 +1,7 @@
/* w_acoshl.c -- long double version of w_acosh.c.
* Conversion to long double by Ulrich Drepper,
* Cygnus Support, drepper@cygnus.com.
+ * Optimizations bu Ulrich Drepper <drepper@gmail.com>, 2011.
*/
/*
@@ -14,10 +15,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper coshl(x)
*/
@@ -25,23 +22,14 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __coshl(long double x) /* wrapper coshl */
-#else
- long double __coshl(x) /* wrapper coshl */
- long double x;
-#endif
+long double
+__coshl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_coshl(x);
-#else
- long double z;
- z = __ieee754_coshl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(!__finitel(z) && __finitel(x)) {
- return __kernel_standard(x,x,205); /* cosh overflow */
- } else
- return z;
-#endif
+ long double z = __ieee754_coshl (x);
+ if (__builtin_expect (!__finitel (z), 0) && __finitel (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 205); /* cosh overflow */
+
+ return z;
}
weak_alias (__coshl, coshl)
diff --git a/math/w_exp10.c b/math/w_exp10.c
index 1512cc0..830b08d 100644
--- a/math/w_exp10.c
+++ b/math/w_exp10.c
@@ -1,17 +1,22 @@
-/* @(#)w_exp10.c
- * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-/*
- * ====================================================
- * 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 exp10(x)
@@ -20,25 +25,16 @@
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __exp10(double x) /* wrapper exp10 */
-#else
- double __exp10(x) /* wrapper exp10 */
- double x;
-#endif
+double
+__exp10 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp10(x);
-#else
- double z;
- z = __ieee754_exp10(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finite(z) && __finite(x)) {
- /* exp10 overflow (46) if x > 0, underflow (47) if x < 0. */
- return __kernel_standard(x,x,46+!!__signbit(x));
- }
- return z;
-#endif
+ double z = __ieee754_exp10 (x);
+ if (__builtin_expect (!__finite (z), 0)
+ && __finite (x) && _LIB_VERSION != _IEEE_)
+ /* exp10 overflow (46) if x > 0, underflow (47) if x < 0. */
+ return __kernel_standard (x, x, 46 + !!__signbit (x));
+
+ return z;
}
weak_alias (__exp10, exp10)
strong_alias (__exp10, __pow10)
diff --git a/math/w_exp10f.c b/math/w_exp10f.c
index dcc8dc7..6fd52f9 100644
--- a/math/w_exp10f.c
+++ b/math/w_exp10f.c
@@ -1,45 +1,40 @@
-/* w_exp10f.c -- float version of w_exp10.c.
- * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-/*
- * ====================================================
- * 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 expf10(x)
+ * wrapper exp10f(x)
*/
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __exp10f(float x) /* wrapper exp10f */
-#else
- float __exp10f(x) /* wrapper exp10f */
- float x;
-#endif
+float
+__exp10f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp10f(x);
-#else
- float z;
- z = __ieee754_exp10f(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitef(z) && __finitef(x)) {
- /* exp10f overflow (146) if x > 0, underflow (147) if x < 0. */
- return (float)__kernel_standard((double) x, (double) x,
- 146+!!__signbitf(x));
- }
- return z;
-#endif
+ float z = __ieee754_exp10f (x);
+ if (__builtin_expect (!__finitef (z), 0)
+ && __finitef (x) && _LIB_VERSION != _IEEE_)
+ /* exp10f overflow (146) if x > 0, underflow (147) if x < 0. */
+ return __kernel_standard_f (x, x, 146 + !!__signbitf (x));
+
+ return z;
}
weak_alias (__exp10f, exp10f)
strong_alias (__exp10f, __pow10f)
diff --git a/math/w_exp10l.c b/math/w_exp10l.c
index 80e720a..0cda27c 100644
--- a/math/w_exp10l.c
+++ b/math/w_exp10l.c
@@ -1,18 +1,22 @@
-/* w_exp10l.c -- long double version of w_exp10.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-/*
- * ====================================================
- * 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 exp10l(x)
@@ -21,25 +25,16 @@
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __exp10l(long double x) /* wrapper exp10 */
-#else
- long double __exp10l(x) /* wrapper exp10 */
- long double x;
-#endif
+long double
+__exp10l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_exp10l(x);
-#else
- long double z;
- z = __ieee754_exp10l(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitel(z) && __finitel(x)) {
- /* exp10 overflow (246) if x > 0, underflow (247) if x < 0. */
- return __kernel_standard(x,x,246+__signbitl(x));
- }
- return z;
-#endif
+ long double z = __ieee754_exp10l (x);
+ if (__builtin_expect (!__finitel (z), 0)
+ && __finitel (x) && _LIB_VERSION != _IEEE_)
+ /* exp10l overflow (246) if x > 0, underflow (247) if x < 0. */
+ return __kernel_standard (x, x, 246 + !!__signbitl (x));
+
+ return z;
}
weak_alias (__exp10l, exp10l)
strong_alias (__exp10l, __pow10l)
diff --git a/math/w_exp2.c b/math/w_exp2.c
index c92fb52..bf22326 100644
--- a/math/w_exp2.c
+++ b/math/w_exp2.c
@@ -6,28 +6,18 @@
#include <math.h>
#include <math_private.h>
-static const double o_threshold= (double) DBL_MAX_EXP;
-static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
+static const double o_threshold = (double) DBL_MAX_EXP;
+static const double u_threshold = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
double
-__exp2 (double x) /* wrapper exp2 */
+__exp2 (double x)
{
-#ifdef _IEEE_LIBM
+ if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+ && _LIB_VERSION != _IEEE_ && __finite (x))
+ /* exp2 overflow: 44, exp2 underflow: 45 */
+ return __kernel_standard (x, x, 44 + (x <= o_threshold));
+
return __ieee754_exp2 (x);
-#else
- double z;
- z = __ieee754_exp2 (x);
- if (_LIB_VERSION != _IEEE_ && __finite (x))
- {
- if (x > o_threshold)
- /* exp2 overflow */
- return __kernel_standard (x, x, 44);
- else if (x <= u_threshold)
- /* exp2 underflow */
- return __kernel_standard (x, x, 45);
- }
- return z;
-#endif
}
weak_alias (__exp2, exp2)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_exp2f.c b/math/w_exp2f.c
index 94c82e2..7215fca 100644
--- a/math/w_exp2f.c
+++ b/math/w_exp2f.c
@@ -6,27 +6,17 @@
#include <math.h>
#include <math_private.h>
-static const float o_threshold= (float) FLT_MAX_EXP;
-static const float u_threshold= (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
+static const float o_threshold = (float) FLT_MAX_EXP;
+static const float u_threshold = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
float
-__exp2f (float x) /* wrapper exp2f */
+__exp2f (float x)
{
-#ifdef _IEEE_LIBM
+ if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+ && _LIB_VERSION != _IEEE_ && __finitef (x))
+ /* exp2 overflow: 144, exp2 underflow: 145 */
+ return __kernel_standard_f (x, x, 144 + (x <= o_threshold));
+
return __ieee754_exp2f (x);
-#else
- float z;
- z = __ieee754_exp2f (x);
- if (_LIB_VERSION != _IEEE_ && __finitef (x))
- {
- if (x > o_threshold)
- /* exp2 overflow */
- return (float) __kernel_standard ((double) x, (double) x, 144);
- else if (x <= u_threshold)
- /* exp2 underflow */
- return (float) __kernel_standard ((double) x, (double) x, 145);
- }
- return z;
-#endif
}
weak_alias (__exp2f, exp2f)
diff --git a/math/w_exp2l.c b/math/w_exp2l.c
index f54e394..ac8d231 100644
--- a/math/w_exp2l.c
+++ b/math/w_exp2l.c
@@ -11,21 +11,13 @@ static const long double u_threshold
= (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1);
long double
-__exp2l (long double x) /* wrapper exp2l */
+__exp2l (long double x)
{
-#ifdef _IEEE_LIBM
+ if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+ && _LIB_VERSION != _IEEE_ && __finitel (x))
+ /* exp2 overflow: 244, exp2 underflow: 245 */
+ return __kernel_standard (x, x, 244 + (x <= o_threshold));
+
return __ieee754_exp2l (x);
-#else
- long double z;
- z = __ieee754_exp2l (x);
- if (_LIB_VERSION != _IEEE_ && __finitel (x))
- {
- if (x > o_threshold)
- return __kernel_standard (x, x, 244); /* exp2l overflow */
- else if (x <= u_threshold)
- return __kernel_standard (x, x, 245); /* exp2l underflow */
- }
- return z;
-#endif
}
weak_alias (__exp2l, exp2l)
diff --git a/math/w_fmod.c b/math/w_fmod.c
index b93ff89..d38ae8c 100644
--- a/math/w_fmod.c
+++ b/math/w_fmod.c
@@ -1,46 +1,35 @@
-/* @(#)w_fmod.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper fmod(x,y)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-
-#ifdef __STDC__
- double __fmod(double x, double y) /* wrapper fmod */
-#else
- double __fmod(x,y) /* wrapper fmod */
- double x,y;
-#endif
+/* wrapper fmod */
+double
+__fmod (double x, double y)
{
-#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(__isinf_ns(x)||y==0.0) {
- /* fmod(+-Inf,y) or fmod(x,0) */
- return __kernel_standard(x,y,27);
- } else
- return z;
-#endif
+ if (__builtin_expect (__isinf_ns (x) || y == 0.0, 0)
+ && _LIB_VERSION != _IEEE_ && !__isnan (y) && !__isnan (x))
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ return __kernel_standard (x, y, 27);
+
+ return __ieee754_fmod (x, y);
}
weak_alias (__fmod, fmod)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_fmodf.c b/math/w_fmodf.c
index 12e2fb3..c0370cf 100644
--- a/math/w_fmodf.c
+++ b/math/w_fmodf.c
@@ -1,48 +1,34 @@
-/* w_fmodf.c -- float version of w_fmod.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper fmodf(x,y)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-
-#ifdef __STDC__
- float __fmodf(float x, float y) /* wrapper fmodf */
-#else
- float __fmodf(x,y) /* wrapper fmodf */
- float x,y;
-#endif
+/* wrapper fmodf */
+float
+__fmodf (float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmodf(x,y);
-#else
- float z;
- z = __ieee754_fmodf(x,y);
- if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
- if(__isinf_nsf(x)||y==(float)0.0) {
- /* fmodf(+-Inf,y) or fmodf(x,0) */
- return (float)__kernel_standard((double)x,(double)y,127);
- } else
- return z;
-#endif
+ if (__builtin_expect (__isinf_nsf (x) || y == 0.0f, 0)
+ && _LIB_VERSION != _IEEE_ && !__isnanf (y) && !__isnanf (x))
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ return __kernel_standard_f (x, y, 127);
+
+ return __ieee754_fmodf (x, y);
}
weak_alias (__fmodf, fmodf)
diff --git a/math/w_fmodl.c b/math/w_fmodl.c
index ffc77ad..d236fb9 100644
--- a/math/w_fmodl.c
+++ b/math/w_fmodl.c
@@ -1,49 +1,34 @@
-/* w_fmodl.c -- long double version of w_fmod.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper fmodl(x,y)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-
-#ifdef __STDC__
- long double __fmodl(long double x, long double y)/* wrapper fmodl */
-#else
- long double __fmodl(x,y) /* wrapper fmodl */
- long double x,y;
-#endif
+/* wrapper fmodl */
+long double
+__fmodl (long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_fmodl(x,y);
-#else
- long double z;
- z = __ieee754_fmodl(x,y);
- if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
- if(__isinf_nsl(x)||y==0.0) {
- /* fmodl(+-Inf,y) or fmodl(x,0) */
- return __kernel_standard(x,y,227);
- } else
- return z;
-#endif
+ if (__builtin_expect (__isinf_nsl (x) || y == 0.0L, 0)
+ && _LIB_VERSION != _IEEE_ && !__isnanl (y) && !__isnanl (x))
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ return __kernel_standard (x, y, 227);
+
+ return __ieee754_fmodl (x, y);
}
weak_alias (__fmodl, fmodl)
diff --git a/math/w_hypot.c b/math/w_hypot.c
index df69ed3..2c6de28 100644
--- a/math/w_hypot.c
+++ b/math/w_hypot.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
-#endif
-
/*
* wrapper hypot(x,y)
*/
@@ -22,24 +18,15 @@ static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- double __hypot(double x, double y)/* wrapper hypot */
-#else
- double __hypot(x,y) /* wrapper hypot */
- double x,y;
-#endif
+double
+__hypot (double x, double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypot(x,y);
-#else
- double z;
- z = __ieee754_hypot(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!__finite(z))&&__finite(x)&&__finite(y))
- return __kernel_standard(x,y,4); /* hypot overflow */
- else
- return z;
-#endif
+ double z = __ieee754_hypot(x,y);
+ if(__builtin_expect(!__finite(z), 0)
+ && __finite(x) && __finite(y) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, y, 4); /* hypot overflow */
+
+ return z;
}
weak_alias (__hypot, hypot)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_hypotf.c b/math/w_hypotf.c
index e1f074f..6042b88 100644
--- a/math/w_hypotf.c
+++ b/math/w_hypotf.c
@@ -8,15 +8,11 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $";
-#endif
-
/*
* wrapper hypotf(x,y)
*/
@@ -25,24 +21,15 @@ static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $";
#include <math_private.h>
-#ifdef __STDC__
- float __hypotf(float x, float y) /* wrapper hypotf */
-#else
- float __hypotf(x,y) /* wrapper hypotf */
- float x,y;
-#endif
+float
+__hypotf(float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypotf(x,y);
-#else
- float z;
- z = __ieee754_hypotf(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!__finitef(z))&&__finitef(x)&&__finitef(y))
+ float z = __ieee754_hypotf(x,y);
+ if(__builtin_expect(!__finitef(z), 0)
+ && __finitef(x) && __finitef(y) && _LIB_VERSION != _IEEE_)
/* hypot overflow */
- return (float)__kernel_standard((double)x,(double)y,104);
- else
- return z;
-#endif
+ return __kernel_standard_f(x, y, 104);
+
+ return z;
}
weak_alias (__hypotf, hypotf)
diff --git a/math/w_hypotl.c b/math/w_hypotl.c
index 6b6414d..522eb63 100644
--- a/math/w_hypotl.c
+++ b/math/w_hypotl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper hypotl(x,y)
*/
@@ -26,23 +22,15 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
-#ifdef __STDC__
- long double __hypotl(long double x, long double y)/* wrapper hypotl */
-#else
- long double __hypotl(x,y) /* wrapper hypotl */
- long double x,y;
-#endif
+long double
+__hypotl(long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_hypotl(x,y);
-#else
long double z;
z = __ieee754_hypotl(x,y);
- if(_LIB_VERSION == _IEEE_) return z;
- if((!__finitel(z))&&__finitel(x)&&__finitel(y))
- return __kernel_standard(x,y,204); /* hypot overflow */
- else
- return z;
-#endif
+ if(__builtin_expect(!__finitel(z), 0)
+ && __finitel(x) && __finitel(y) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, y, 204); /* hypot overflow */
+
+ return z;
}
weak_alias (__hypotl, hypotl)
diff --git a/math/w_j0.c b/math/w_j0.c
index 59b6b66..3613520 100644
--- a/math/w_j0.c
+++ b/math/w_j0.c
@@ -1,75 +1,63 @@
-/* @(#)w_j0.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper j0(double x), y0(double x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double j0(double x) /* wrapper j0 */
-#else
- double j0(x) /* wrapper j0 */
- double x;
-#endif
+
+/* wrapper j0 */
+double
+j0 (double x)
{
-#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
+ if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j0(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 34);
+
+ return __ieee754_j0 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (j0, j0l)
#endif
-#ifdef __STDC__
- double y0(double x) /* wrapper y0 */
-#else
- double y0(x) /* wrapper y0 */
- double x;
-#endif
+/* wrapper y0 */
+double
+y0 (double x)
{
-#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
+ if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 9);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 8);
+ else
+ /* y0(x>X_TLOSS) */
+ return __kernel_standard (x, x, 35);
+ }
+
+ return __ieee754_y0 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (y0, y0l)
diff --git a/math/w_j0f.c b/math/w_j0f.c
index dd436ff..ff1ac3c 100644
--- a/math/w_j0f.c
+++ b/math/w_j0f.c
@@ -1,74 +1,60 @@
-/* w_j0f.c -- float version of w_j0.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper j0f(float x), y0f(float x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float j0f(float x) /* wrapper j0f */
-#else
- float j0f(x) /* wrapper j0f */
- float x;
-#endif
+
+/* wrapper j0f */
+float
+j0f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0f(x);
-#else
- float z = __ieee754_j0f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(fabsf(x)>(float)X_TLOSS) {
- /* j0f(|x|>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,134);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ /* j0(|x|>X_TLOSS) */
+ return __kernel_standard_f (x, x, 134);
+
+ return __ieee754_j0f (x);
}
-#ifdef __STDC__
- float y0f(float x) /* wrapper y0f */
-#else
- float y0f(x) /* wrapper y0f */
- float x;
-#endif
+
+/* wrapper y0f */
+float
+y0f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0f(x);
-#else
- float z;
- z = __ieee754_y0f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(x <= (float)0.0){
- if(x==(float)0.0)
- /* d= -one/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,108);
- else
- /* d = zero/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,109);
- }
- if(x>(float)X_TLOSS) {
- /* y0(x>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,135);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0f)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 109);
+ }
+ else if (x == 0.0f)
+ /* d = -one/(x-x) */
+ return __kernel_standard_f (x, x, 108);
+ else
+ /* y0(x>X_TLOSS) */
+ return __kernel_standard_f (x, x, 135);
+ }
+
+ return __ieee754_y0f (x);
}
diff --git a/math/w_j0l.c b/math/w_j0l.c
index a91457d..a16363d 100644
--- a/math/w_j0l.c
+++ b/math/w_j0l.c
@@ -1,76 +1,60 @@
-/* w_j0l.c -- long double version of w_j0.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper j0l(long double x), y0l(long double x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __j0l(long double x) /* wrapper j0l */
-#else
- long double __j0l(x) /* wrapper j0 */
- long double x;
-#endif
+
+/* wrapper j0l */
+long double
+__j0l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j0l(x);
-#else
- long double z = __ieee754_j0l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(fabsl(x)>X_TLOSS) {
- return __kernel_standard(x,x,234); /* j0(|x|>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j0(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 234);
+
+ return __ieee754_j0l (x);
}
weak_alias (__j0l, j0l)
-#ifdef __STDC__
- long double __y0l(long double x) /* wrapper y0l */
-#else
- long double __y0l(x) /* wrapper y0 */
- long double x;
-#endif
+
+/* wrapper y0l */
+long double
+__y0l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y0l(x);
-#else
- long double z;
- z = __ieee754_y0l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,208);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,209);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,235); /* y0(x>X_TLOSS) */
- } else
- return z;
-#endif
-}
+ if (__builtin_expect (x <= 0.0L || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0L)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 209);
+ }
+ else if (x == 0.0L)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 208);
+ else
+ /* y0(x>X_TLOSS) */
+ return __kernel_standard (x, x, 235);
+ }
+ return __ieee754_y0l (x);
+}
weak_alias (__y0l, y0l)
diff --git a/math/w_j1.c b/math/w_j1.c
index 7bb3208..09cacb8 100644
--- a/math/w_j1.c
+++ b/math/w_j1.c
@@ -1,76 +1,63 @@
-/* @(#)w_j1.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper of j1,y1
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double j1(double x) /* wrapper j1 */
-#else
- double j1(x) /* wrapper j1 */
- double x;
-#endif
+
+/* wrapper j1 */
+double
+j1 (double x)
{
-#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
+ if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j1(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 36);
+
+ return __ieee754_j1 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (j1, j1l)
#endif
-#ifdef __STDC__
- double y1(double x) /* wrapper y1 */
-#else
- double y1(x) /* wrapper y1 */
- double x;
-#endif
+/* wrapper y1 */
+double
+y1 (double x)
{
-#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
+ if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 11);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 10);
+ else
+ /* y1(x>X_TLOSS) */
+ return __kernel_standard (x, x, 37);
+ }
+
+ return __ieee754_y1 (x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (y1, y1l)
diff --git a/math/w_j1f.c b/math/w_j1f.c
index 43dfc61..40a2cf3 100644
--- a/math/w_j1f.c
+++ b/math/w_j1f.c
@@ -1,75 +1,59 @@
-/* w_j1f.c -- float version of w_j1.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper of j1f,y1f
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float j1f(float x) /* wrapper j1f */
-#else
- float j1f(x) /* wrapper j1f */
- float x;
-#endif
+
+/* wrapper j1f */
+float
+j1f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1f(x);
-#else
- float z;
- z = __ieee754_j1f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(fabsf(x)>(float)X_TLOSS) {
- /* j1(|x|>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,136);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j1(|x|>X_TLOSS) */
+ return __kernel_standard_f (x, x, 136);
+
+ return __ieee754_j1f (x);
}
-#ifdef __STDC__
- float y1f(float x) /* wrapper y1f */
-#else
- float y1f(x) /* wrapper y1f */
- float x;
-#endif
+
+/* wrapper y1f */
+float
+y1f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1f(x);
-#else
- float z;
- z = __ieee754_y1f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(x <= (float)0.0){
- if(x==(float)0.0)
- /* d= -one/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,110);
- else
- /* d = zero/(x-x); */
- return (float)__kernel_standard((double)x,(double)x,111);
- }
- if(x>(float)X_TLOSS) {
- /* y1(x>X_TLOSS) */
- return (float)__kernel_standard((double)x,(double)x,137);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0f)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 111);
+ }
+ else if (x == 0.0f)
+ /* d = -one/(x-x) */
+ return __kernel_standard_f (x, x, 110);
+ else
+ /* y1(x>X_TLOSS) */
+ return __kernel_standard_f (x, x, 137);
+ }
+
+ return __ieee754_y1f (x);
}
diff --git a/math/w_j1l.c b/math/w_j1l.c
index d052295..91b56e3 100644
--- a/math/w_j1l.c
+++ b/math/w_j1l.c
@@ -1,76 +1,60 @@
-/* w_j1l.c -- long double version of w_j1.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper of j1l,y1l
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __j1l(long double x) /* wrapper j1l */
-#else
- long double __j1l(x) /* wrapper j1l */
- long double x;
-#endif
+
+/* wrapper j1l */
+long double
+__j1l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_j1l(x);
-#else
- long double z;
- z = __ieee754_j1l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
- if(fabsl(x)>X_TLOSS) {
- return __kernel_standard(x,x,236); /* j1(|x|>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsl (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* j1(|x|>X_TLOSS) */
+ return __kernel_standard (x, x, 236);
+
+ return __ieee754_j1l (x);
}
weak_alias (__j1l, j1l)
-#ifdef __STDC__
- long double __y1l(long double x) /* wrapper y1l */
-#else
- long double __y1l(x) /* wrapper y1l */
- long double x;
-#endif
+
+/* wrapper y1l */
+long double
+__y1l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_y1l(x);
-#else
- long double z;
- z = __ieee754_y1l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
- if(x <= 0.0){
- if(x==0.0)
- /* d= -one/(x-x); */
- return __kernel_standard(x,x,210);
- else
- /* d = zero/(x-x); */
- return __kernel_standard(x,x,211);
- }
- if(x>X_TLOSS) {
- return __kernel_standard(x,x,237); /* y1(x>X_TLOSS) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0L || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0L)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 211);
+ }
+ else if (x == 0.0L)
+ /* d = -one/(x-x) */
+ return __kernel_standard (x, x, 210);
+ else
+ /* y1(x>X_TLOSS) */
+ return __kernel_standard (x, x, 237);
+ }
+
+ return __ieee754_y1l (x);
}
weak_alias (__y1l, y1l)
diff --git a/math/w_jn.c b/math/w_jn.c
index 41ec8b3..36fb448 100644
--- a/math/w_jn.c
+++ b/math/w_jn.c
@@ -1,98 +1,63 @@
-/* @(#)w_jn.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * 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.
- *
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double jn(int n, double x) /* wrapper jn */
-#else
- double jn(n,x) /* wrapper jn */
- double x; int n;
-#endif
+
+/* wrapper jn */
+double
+jn (int n, double x)
{
-#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
+ if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ /* jn(n,|x|>X_TLOSS) */
+ return __kernel_standard (n, x, 38);
+
+ return __ieee754_jn (n, x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (jn, jnl)
#endif
-#ifdef __STDC__
- double yn(int n, double x) /* wrapper yn */
-#else
- double yn(n,x) /* wrapper yn */
- double x; int n;
-#endif
+/* wrapper yn */
+double
+yn (int n, double x)
{
-#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
+ if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (n, x, 13);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard (n, x, 12);
+ else
+ /* yn(n,x>X_TLOSS) */
+ return __kernel_standard (n, x, 39);
+ }
+
+ return __ieee754_yn (n, x);
}
#ifdef NO_LONG_DOUBLE
strong_alias (yn, ynl)
diff --git a/math/w_jnf.c b/math/w_jnf.c
index 0b9a2aa..7b35955 100644
--- a/math/w_jnf.c
+++ b/math/w_jnf.c
@@ -1,71 +1,60 @@
-/* w_jnf.c -- float version of w_jn.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float jnf(int n, float x) /* wrapper jnf */
-#else
- float jnf(n,x) /* wrapper jnf */
- float x; int n;
-#endif
+
+/* wrapper jnf */
+float
+jnf (int n, float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_jnf(n,x);
-#else
- float z;
- z = __ieee754_jnf(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(fabsf(x)>(float)X_TLOSS) {
- /* jn(|x|>X_TLOSS,n) */
- return (float)__kernel_standard((double)n,(double)x,138);
- } else
- return z;
-#endif
+ if (__builtin_expect (fabsf (x) > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ /* jn(n,|x|>X_TLOSS) */
+ return __kernel_standard_f (n, x, 138);
+
+ return __ieee754_jnf (n, x);
}
-#ifdef __STDC__
- float ynf(int n, float x) /* wrapper ynf */
-#else
- float ynf(n,x) /* wrapper ynf */
- float x; int n;
-#endif
+
+/* wrapper ynf */
+float
+ynf (int n, float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_ynf(n,x);
-#else
- float z;
- z = __ieee754_ynf(n,x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
- if(x <= (float)0.0){
- if(x==(float)0.0)
- /* d= -one/(x-x); */
- return (float)__kernel_standard((double)n,(double)x,112);
- else
- /* d = zero/(x-x); */
- return (float)__kernel_standard((double)n,(double)x,113);
- }
- if(x>(float)X_TLOSS) {
- /* yn(x>X_TLOSS,n) */
- return (float)__kernel_standard((double)n,(double)x,139);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x < 0.0f)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (n, x, 113);
+ }
+ else if (x == 0.0)
+ /* d = -one/(x-x) */
+ return __kernel_standard_f (n, x, 112);
+ else
+ /* yn(n,x>X_TLOSS) */
+ return __kernel_standard_f (n, x, 139);
+ }
+
+ return __ieee754_ynf (n, x);
}
diff --git a/math/w_lgamma.c b/math/w_lgamma.c
index f76b552..17c5460 100644
--- a/math/w_lgamma.c
+++ b/math/w_lgamma.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
-#endif
-
/* double lgamma(double x)
* Return the logarithm of the Gamma function of x.
*
@@ -23,31 +19,24 @@ static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __lgamma(double x)
-#else
- double __lgamma(x)
- double x;
-#endif
+double
+__lgamma(double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgamma_r(x,&signgam);
-#else
- double y;
int local_signgam = 0;
- y = __ieee754_lgamma_r(x,&local_signgam);
- if (_LIB_VERSION != _ISOC_)
- /* ISO C99 does not define the global variable. */
- signgam = local_signgam;
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finite(y)&&__finite(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
+ double y = __ieee754_lgamma_r(x,
+ _LIB_VERSION != _ISOC_
+ /* ISO C99 does not define the
+ global variable. */
+ ? &signgam
+ : &local_signgam);
+ if(__builtin_expect(!__finite(y), 0)
+ && __finite(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floor(x)==x&&x<=0.0
+ ? 15 /* lgamma pole */
+ : 14); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgamma, lgamma)
strong_alias (__lgamma, __gamma)
diff --git a/math/w_lgamma_r.c b/math/w_lgamma_r.c
index bec2c6e..9d00f58 100644
--- a/math/w_lgamma_r.c
+++ b/math/w_lgamma_r.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $";
-#endif
-
/*
* wrapper double lgamma_r(double x, int *signgamp)
*/
@@ -22,27 +18,18 @@ static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $
#include <math_private.h>
-#ifdef __STDC__
- double __lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-#else
- double __lgamma_r(x,signgamp) /* wrapper lgamma_r */
- double x; int *signgamp;
-#endif
+double
+__lgamma_r(double x, int *signgamp)
{
-#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(!__finite(y)&&__finite(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
+ double y = __ieee754_lgamma_r(x,signgamp);
+ if(__builtin_expect(!__finite(y), 0)
+ && __finite(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floor(x)==x&&x<=0.0
+ ? 15 /* lgamma pole */
+ : 14); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgamma_r, lgamma_r)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_lgammaf.c b/math/w_lgammaf.c
index 9747e92..f3166df 100644
--- a/math/w_lgammaf.c
+++ b/math/w_lgammaf.c
@@ -13,40 +13,27 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $";
-#endif
-
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __lgammaf(float x)
-#else
- float __lgammaf(x)
- float x;
-#endif
+float
+__lgammaf(float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammaf_r(x,&signgam);
-#else
- float y;
int local_signgam = 0;
- y = __ieee754_lgammaf_r(x,&local_signgam);
- if (_LIB_VERSION != _ISOC_)
- /* ISO C99 does not define the global variable. */
- signgam = local_signgam;
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitef(y)&&__finitef(x)) {
- if(__floorf(x)==x&&x<=(float)0.0)
- /* lgamma pole */
- return (float)__kernel_standard((double)x,(double)x,115);
- else
- /* lgamma overflow */
- return (float)__kernel_standard((double)x,(double)x,114);
- } else
- return y;
-#endif
+ float y = __ieee754_lgammaf_r(x,
+ _LIB_VERSION != _ISOC_
+ /* ISO C99 does not define the
+ global variable. */
+ ? &signgam
+ : &local_signgam);
+ if(__builtin_expect(!__finitef(y), 0)
+ && __finitef(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f(x, x,
+ __floorf(x)==x&&x<=0.0f
+ ? 115 /* lgamma pole */
+ : 114); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgammaf, lgammaf)
strong_alias (__lgammaf, __gammaf)
diff --git a/math/w_lgammaf_r.c b/math/w_lgammaf_r.c
index 3758fa0..683fe72 100644
--- a/math/w_lgammaf_r.c
+++ b/math/w_lgammaf_r.c
@@ -8,16 +8,12 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp $";
-#endif
-
-/*
+/*
* wrapper float lgammaf_r(float x, int *signgamp)
*/
@@ -25,28 +21,17 @@ static char rcsid[] = "$NetBSD: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp
#include <math_private.h>
-#ifdef __STDC__
- float __lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
-#else
- float __lgammaf_r(x,signgamp) /* wrapper lgammaf_r */
- float x; int *signgamp;
-#endif
+float
+__lgammaf_r(float x, int *signgamp)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammaf_r(x,signgamp);
-#else
- float y;
- y = __ieee754_lgammaf_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitef(y)&&__finitef(x)) {
- if(__floorf(x)==x&&x<=(float)0.0)
- /* lgamma pole */
- return (float)__kernel_standard((double)x,(double)x,115);
- else
- /* lgamma overflow */
- return (float)__kernel_standard((double)x,(double)x,114);
- } else
- return y;
-#endif
-}
+ float y = __ieee754_lgammaf_r(x,signgamp);
+ if(__builtin_expect(!__finitef(y), 0)
+ && __finitef(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f(x, x,
+ __floorf(x)==x&&x<=0.0f
+ ? 115 /* lgamma pole */
+ : 114); /* lgamma overflow */
+
+ return y;
+}
weak_alias (__lgammaf_r, lgammaf_r)
diff --git a/math/w_lgammal.c b/math/w_lgammal.c
index 0176243..7df38e7 100644
--- a/math/w_lgammal.c
+++ b/math/w_lgammal.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* long double lgammal(long double x)
* Return the logarithm of the Gamma function of x.
*
@@ -27,31 +23,24 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __lgammal(long double x)
-#else
- long double __lgammal(x)
- long double x;
-#endif
+long double
+__lgammal(long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammal_r(x,&signgam);
-#else
- long double y;
int local_signgam = 0;
- y = __ieee754_lgammal_r(x,&local_signgam);
- if (_LIB_VERSION != _ISOC_)
- /* ISO C99 does not define the global variable. */
- signgam = local_signgam;
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitel(y)&&__finitel(x)) {
- if(__floorl(x)==x&&x<=0.0)
- return __kernel_standard(x,x,215); /* lgamma pole */
- else
- return __kernel_standard(x,x,214); /* lgamma overflow */
- } else
- return y;
-#endif
+ long double y = __ieee754_lgammal_r(x,
+ _LIB_VERSION != _ISOC_
+ /* ISO C99 does not define the
+ global variable. */
+ ? &signgam
+ : &local_signgam);
+ if(__builtin_expect(!__finitel(y), 0)
+ && __finitel(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floorl(x)==x&&x<=0.0L
+ ? 215 /* lgamma pole */
+ : 214); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgammal, lgammal)
strong_alias (__lgammal, __gammal)
diff --git a/math/w_lgammal_r.c b/math/w_lgammal_r.c
index baa4f95..ec34284 100644
--- a/math/w_lgammal_r.c
+++ b/math/w_lgammal_r.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper long double lgammal_r(long double x, int *signgamp)
*/
@@ -26,27 +22,17 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
-#ifdef __STDC__
- long double __lgammal_r(long double x, int *signgamp)
- /* wrapper lgamma_r */
-#else
- long double __lgammal_r(x,signgamp) /* wrapper lgamma_r */
- long double x; int *signgamp;
-#endif
+long double
+__lgammal_r(long double x, int *signgamp)
{
-#ifdef _IEEE_LIBM
- return __ieee754_lgammal_r(x,signgamp);
-#else
- long double y;
- y = __ieee754_lgammal_r(x,signgamp);
- if(_LIB_VERSION == _IEEE_) return y;
- if(!__finitel(y)&&__finitel(x)) {
- if(__floorl(x)==x&&x<=0.0)
- return __kernel_standard(x,x,215); /* lgamma pole */
- else
- return __kernel_standard(x,x,214); /* lgamma overflow */
- } else
- return y;
-#endif
+ long double y = __ieee754_lgammal_r(x,signgamp);
+ if(__builtin_expect(!__finitel(y), 0)
+ && __finitel(x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard(x, x,
+ __floorl(x)==x&&x<=0.0
+ ? 215 /* lgamma pole */
+ : 214); /* lgamma overflow */
+
+ return y;
}
weak_alias (__lgammal_r, lgammal_r)
diff --git a/math/w_log.c b/math/w_log.c
index 7e9afdf..b43af79 100644
--- a/math/w_log.c
+++ b/math/w_log.c
@@ -1,45 +1,46 @@
-/* @(#)w_log.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log.c,v 1.6 1995/05/10 20:49:33 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper log(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __log(double x) /* wrapper log */
-#else
- double __log(x) /* wrapper log */
- double x;
-#endif
+/* wrapper log(x) */
+double
+__log (double x)
{
-#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
+ if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 16); /* log(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 17); /* log(x<0) */
+ }
+ }
+
+ return __ieee754_log (x);
}
weak_alias (__log, log)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_log10.c b/math/w_log10.c
index 08a65ad..75ae580 100644
--- a/math/w_log10.c
+++ b/math/w_log10.c
@@ -1,48 +1,46 @@
-/* @(#)w_log10.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper log10(X)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __log10(double x) /* wrapper log10 */
-#else
- double __log10(x) /* wrapper log10 */
- double x;
-#endif
+/* wrapper log10(x) */
+double
+__log10 (double x)
{
-#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
+ if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 18); /* log10(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 19); /* log10(x<0) */
+ }
+ }
+
+ return __ieee754_log10 (x);
}
weak_alias (__log10, log10)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_log10f.c b/math/w_log10f.c
index f2ac540..3426e2d 100644
--- a/math/w_log10f.c
+++ b/math/w_log10f.c
@@ -1,52 +1,45 @@
-/* w_log10f.c -- float version of w_log10.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log10f.c,v 1.3 1995/05/10 20:49:37 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper log10f(X)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __log10f(float x) /* wrapper log10f */
-#else
- float __log10f(x) /* wrapper log10f */
- float x;
-#endif
+/* wrapper log10f(x) */
+float
+__log10f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10f(x);
-#else
- float z;
- z = __ieee754_log10f(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(x<=(float)0.0) {
- if(x==(float)0.0)
- /* log10(0) */
- return (float)__kernel_standard((double)x,(double)x,118);
- else
- /* log10(x<0) */
- return (float)__kernel_standard((double)x,(double)x,119);
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0f)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard_f (x, x, 118); /* log10(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 119); /* log10(x<0) */
+ }
+ }
+
+ return __ieee754_log10f (x);
}
weak_alias (__log10f, log10f)
diff --git a/math/w_log10l.c b/math/w_log10l.c
index a9a8ed2..6f81f39 100644
--- a/math/w_log10l.c
+++ b/math/w_log10l.c
@@ -1,51 +1,45 @@
-/* w_log10l.c -- long double version of w_log10.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper log10l(X)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __log10l(long double x) /* wrapper log10l */
-#else
- long double __log10l(x) /* wrapper log10l */
- long double x;
-#endif
+/* wrapper log10l(x) */
+long double
+__log10l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log10l(x);
-#else
- long double z;
- z = __ieee754_log10l(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(x<=0.0) {
- if(x==0.0)
- return __kernel_standard(x,x,218); /* log10(0) */
- else
- return __kernel_standard(x,x,219); /* log10(x<0) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0L)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 218); /* log10(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 219); /* log10(x<0) */
+ }
+ }
+
+ return __ieee754_log10l (x);
}
weak_alias (__log10l, log10l)
diff --git a/math/w_log2.c b/math/w_log2.c
index 90d2dff..6d42043 100644
--- a/math/w_log2.c
+++ b/math/w_log2.c
@@ -1,29 +1,46 @@
-/*
- * wrapper log2(X)
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
+
+/* wrapper log2(x) */
double
-__log2 (double x) /* wrapper log2 */
+__log2 (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log2 (x);
-#else
- double z;
- z = __ieee754_log2 (x);
- if (_LIB_VERSION == _IEEE_ || __isnan (x)) return z;
- if (x <= 0.0)
+ if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
{
if (x == 0.0)
- return __kernel_standard (x, x, 48); /* log2 (0) */
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 48); /* log2(0) */
+ }
else
- return __kernel_standard (x, x, 49); /* log2 (x < 0) */
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 49); /* log2(x<0) */
+ }
}
- else
- return z;
-#endif
+
+ return __ieee754_log2 (x);
}
weak_alias (__log2, log2)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_log2f.c b/math/w_log2f.c
index 10d73ff..7c64ad8 100644
--- a/math/w_log2f.c
+++ b/math/w_log2f.c
@@ -1,30 +1,45 @@
-/*
- * wrapper log2(X)
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
+
+/* wrapper log2f(x) */
float
-__log2f (float x) /* wrapper log2f */
+__log2f (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log2f (x);
-#else
- float z;
- z = __ieee754_log2f (x);
- if (_LIB_VERSION == _IEEE_ || __isnanf (x)) return z;
- if (x <= 0.0f)
+ if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
{
- if (x == 0.0f)
- /* log2f (0) */
- return __kernel_standard ((double) x, (double) x, 148);
+ if (x == 0.0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard_f (x, x, 148); /* log2(0) */
+ }
else
- /* log2f (x < 0) */
- return __kernel_standard ((double) x, (double) x, 149);
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 149); /* log2(x<0) */
+ }
}
- else
- return z;
-#endif
+
+ return __ieee754_log2f (x);
}
weak_alias (__log2f, log2f)
diff --git a/math/w_log2l.c b/math/w_log2l.c
index ff7ba26..f589768 100644
--- a/math/w_log2l.c
+++ b/math/w_log2l.c
@@ -1,28 +1,45 @@
-/*
- * wrapper log2l(X)
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
+
+/* wrapper log2l(x) */
long double
-__log2l (long double x) /* wrapper log2l */
+__log2l (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_log2l (x);
-#else
- long double z;
- z = __ieee754_log2l (x);
- if (_LIB_VERSION == _IEEE_ || __isnanl (x)) return z;
- if (x <= 0.0)
+ if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
{
- if (x == 0.0)
- return __kernel_standard (x, x, 248); /* log2l (0) */
+ if (x == 0.0L)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 248); /* log2(0) */
+ }
else
- return __kernel_standard (x, x, 249); /* log2l (x < 0) */
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 249); /* log2(x<0) */
+ }
}
- else
- return z;
-#endif
+
+ return __ieee754_log2l (x);
}
weak_alias (__log2l, log2l)
diff --git a/math/w_logf.c b/math/w_logf.c
index 200a8b7..52b9bef 100644
--- a/math/w_logf.c
+++ b/math/w_logf.c
@@ -1,49 +1,45 @@
-/* w_logf.c -- float version of w_log.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_logf.c,v 1.3 1995/05/10 20:49:40 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper logf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __logf(float x) /* wrapper logf */
-#else
- float __logf(x) /* wrapper logf */
- float x;
-#endif
+/* wrapper logf(x) */
+float
+__logf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_logf(x);
-#else
- float z;
- z = __ieee754_logf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x) || x > (float)0.0) return z;
- if(x==(float)0.0)
- /* logf(0) */
- return (float)__kernel_standard((double)x,(double)x,116);
- else
- /* logf(x<0) */
- return (float)__kernel_standard((double)x,(double)x,117);
-#endif
+ if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0f)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard_f (x, x, 116); /* log(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard_f (x, x, 117); /* log(x<0) */
+ }
+ }
+
+ return __ieee754_logf (x);
}
weak_alias (__logf, logf)
diff --git a/math/w_logl.c b/math/w_logl.c
index e869bce..9f2bdf0 100644
--- a/math/w_logl.c
+++ b/math/w_logl.c
@@ -1,48 +1,45 @@
-/* w_logl.c -- long double version of w_log.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper logl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <fenv.h>
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __logl(long double x) /* wrapper logl */
-#else
- long double __logl(x) /* wrapper logl */
- long double x;
-#endif
+/* wrapper logl(x) */
+long double
+__logl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_logl(x);
-#else
- long double z;
- z = __ieee754_logl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x) || x > 0.0) return z;
- if(x==0.0)
- return __kernel_standard(x,x,216); /* log(0) */
- else
- return __kernel_standard(x,x,217); /* log(x<0) */
-#endif
+ if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0L)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ return __kernel_standard (x, x, 216); /* log(0) */
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ return __kernel_standard (x, x, 217); /* log(x<0) */
+ }
+ }
+
+ return __ieee754_logl (x);
}
weak_alias (__logl, logl)
diff --git a/math/w_pow.c b/math/w_pow.c
index e0d2a92..4993c23 100644
--- a/math/w_pow.c
+++ b/math/w_pow.c
@@ -1,67 +1,76 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-/* @(#)w_pow.c 5.2 93/10/01 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper pow(x,y) return x**y
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __pow(double x, double y) /* wrapper pow */
-#else
- double __pow(x,y) /* wrapper pow */
- double x,y;
-#endif
+/* wrapper pow */
+double
+__pow (double x, double y)
{
-#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(__finite(y)&&y<0.0) {
- if (signbit (x) && signbit (z))
- return __kernel_standard(x,y,23); /* pow(-0.0,negative) */
+ double z = __ieee754_pow (x, y);
+ if (__builtin_expect (!__finite (z), 0))
+ {
+ if (_LIB_VERSION != _IEEE_)
+ {
+ if (__isnan (x))
+ {
+ if (y == 0.0)
+ /* pow(NaN,0.0) */
+ return __kernel_standard (x, y, 42);
+ }
+ else if (__finite (x) && __finite (y))
+ {
+ if (__isnan (z))
+ /* pow neg**non-int */
+ return __kernel_standard (x, y, 24);
+ else if (x == 0.0 && y < 0.0)
+ {
+ if (signbit (x) && signbit (z))
+ /* pow(-0.0,negative) */
+ return __kernel_standard (x, y, 23);
+ else
+ /* pow(+0.0,negative) */
+ return __kernel_standard (x, y, 43);
+ }
else
- return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
+ /* pow overflow */
+ return __kernel_standard (x, y, 21);
}
- return z;
}
- if(!__finite(z)) {
- if(__finite(x)&&__finite(y)) {
- if(__isnan(z))
- return __kernel_standard(x,y,24); /* pow neg**non-int */
- else
- return __kernel_standard(x,y,21); /* pow overflow */
- }
+ }
+ else if (__builtin_expect (z == 0.0, 0) && __finite (x) && __finite (y)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0)
+ {
+ if (y == 0.0)
+ /* pow(0.0,0.0) */
+ return __kernel_standard (x, y, 20);
}
- if(z==0.0&&__finite(x)&&__finite(y))
- return __kernel_standard(x,y,22); /* pow underflow */
- return z;
-#endif
+ else
+ /* pow underflow */
+ return __kernel_standard (x, y, 22);
+ }
+
+ return z;
}
weak_alias (__pow, pow)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_powf.c b/math/w_powf.c
index 761e4d1..c0406f4 100644
--- a/math/w_powf.c
+++ b/math/w_powf.c
@@ -1,77 +1,75 @@
-/* w_powf.c -- float version of w_pow.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper powf(x,y) return x**y
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __powf(float x, float y) /* wrapper powf */
-#else
- float __powf(x,y) /* wrapper powf */
- float x,y;
-#endif
+/* wrapper powf */
+float
+__powf (float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_powf(x,y);
-#else
- float z;
- z=__ieee754_powf(x,y);
- if(_LIB_VERSION == _IEEE_|| __isnanf(y)) return z;
- if(__isnanf(x)) {
- if(y==(float)0.0)
- /* powf(NaN,0.0) */
- return (float)__kernel_standard((double)x,(double)y,142);
- else
- return z;
- }
- if(x==(float)0.0) {
- if(y==(float)0.0)
- /* powf(0.0,0.0) */
- return (float)__kernel_standard((double)x,(double)y,120);
- if(__finitef(y)&&y<(float)0.0) {
- if (signbit (x) && signbit (z))
- /* powf(0.0,negative) */
- return (float)__kernel_standard((double)x,(double)y,123);
+ float z = __ieee754_powf (x, y);
+ if (__builtin_expect (!__finitef (z), 0))
+ {
+ if (_LIB_VERSION != _IEEE_)
+ {
+ if (__isnanf (x))
+ {
+ if (y == 0.0f)
+ /* pow(NaN,0.0) */
+ return __kernel_standard_f (x, y, 142);
+ }
+ else if (__finitef (x) && __finitef (y))
+ {
+ if (__isnanf (z))
+ /* pow neg**non-int */
+ return __kernel_standard_f (x, y, 124);
+ else if (x == 0.0f && y < 0.0f)
+ {
+ if (signbit (x) && signbit (z))
+ /* pow(-0.0,negative) */
+ return __kernel_standard_f (x, y, 123);
+ else
+ /* pow(+0.0,negative) */
+ return __kernel_standard_f (x, y, 143);
+ }
else
- return (float)__kernel_standard((double)x,(double)y,143);
+ /* pow overflow */
+ return __kernel_standard_f (x, y, 121);
}
- return z;
}
- if(!__finitef(z)) {
- if(__finitef(x)&&__finitef(y)) {
- if(__isnanf(z))
- /* powf neg**non-int */
- return (float)__kernel_standard((double)x,(double)y,124);
- else
- /* powf overflow */
- return (float)__kernel_standard((double)x,(double)y,121);
- }
+ }
+ else if (__builtin_expect (z == 0.0f, 0) && __finitef (x) && __finitef (y)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0f)
+ {
+ if (y == 0.0f)
+ /* pow(0.0,0.0) */
+ return __kernel_standard_f (x, y, 120);
}
- if(z==(float)0.0&&__finitef(x)&&__finitef(y))
- /* powf underflow */
- return (float)__kernel_standard((double)x,(double)y,122);
- return z;
-#endif
+ else
+ /* pow underflow */
+ return __kernel_standard_f (x, y, 122);
+ }
+
+ return z;
}
weak_alias (__powf, powf)
diff --git a/math/w_powl.c b/math/w_powl.c
index 0bb0951..1ad581a 100644
--- a/math/w_powl.c
+++ b/math/w_powl.c
@@ -1,68 +1,75 @@
-/* w_powl.c -- long double version of w_pow.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-/*
- * wrapper powl(x,y) return x**y
- */
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __powl(long double x, long double y)/* wrapper powl */
-#else
- long double __powl(x,y) /* wrapper powl */
- long double x,y;
-#endif
+/* wrapper powl */
+long double
+__powl (long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_powl(x,y);
-#else
- long double z;
- z=__ieee754_powl(x,y);
- if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z;
- if(__isnanl(x)) {
- if(y==0.0)
- return __kernel_standard(x,y,242); /* pow(NaN,0.0) */
- else
- return z;
- }
- if(x==0.0) {
- if(y==0.0)
- return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
- if(__finitel(y)&&y<0.0) {
- if (signbit (x) && signbit (z))
- return __kernel_standard(x,y,223); /* pow(-0.0,negative) */
+ long double z = __ieee754_powl (x, y);
+ if (__builtin_expect (!__finitel (z), 0))
+ {
+ if (_LIB_VERSION != _IEEE_)
+ {
+ if (__isnanl (x))
+ {
+ if (y == 0.0L)
+ /* pow(NaN,0.0) */
+ return __kernel_standard (x, y, 242);
+ }
+ else if (__finitel (x) && __finitel (y))
+ {
+ if (__isnanl (z))
+ /* pow neg**non-int */
+ return __kernel_standard (x, y, 224);
+ else if (x == 0.0L && y < 0.0L)
+ {
+ if (signbit (x) && signbit (z))
+ /* pow(-0.0,negative) */
+ return __kernel_standard (x, y, 223);
+ else
+ /* pow(+0.0,negative) */
+ return __kernel_standard (x, y, 243);
+ }
else
- return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
+ /* pow overflow */
+ return __kernel_standard (x, y, 221);
}
- return z;
}
- if(!__finitel(z)) {
- if(__finitel(x)&&__finitel(y)) {
- if(__isnanl(z))
- return __kernel_standard(x,y,224); /* pow neg**non-int */
- else
- return __kernel_standard(x,y,221); /* pow overflow */
- }
+ }
+ else if (__builtin_expect (z == 0.0L, 0) && __finitel (x) && __finitel (y)
+ && _LIB_VERSION != _IEEE_)
+ {
+ if (x == 0.0L)
+ {
+ if (y == 0.0L)
+ /* pow(0.0,0.0) */
+ return __kernel_standard (x, y, 220);
}
- if(z==0.0&&__finitel(x)&&__finitel(y))
- return __kernel_standard(x,y,222); /* pow underflow */
- return z;
-#endif
+ else
+ /* pow underflow */
+ return __kernel_standard (x, y, 222);
+ }
+
+ return z;
}
weak_alias (__powl, powl)
diff --git a/math/w_remainder.c b/math/w_remainder.c
index cf35ee2..524cbf5 100644
--- a/math/w_remainder.c
+++ b/math/w_remainder.c
@@ -1,44 +1,36 @@
-/* @(#)w_remainder.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper remainder(x,p)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __remainder(double x, double y) /* wrapper remainder */
-#else
- double __remainder(x,y) /* wrapper remainder */
- double x,y;
-#endif
+
+/* wrapper remainder */
+double
+__remainder (double x, double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainder(x,y);
-#else
- double z;
- z = __ieee754_remainder(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnan(y) || __isnan(x)) return z;
- if(y==0.0 || __isinf_ns(x))
- return __kernel_standard(x,y,28); /* remainder(x,0) */
- else
- return z;
-#endif
+ if (((__builtin_expect (y == 0.0, 0) && ! __isnan (x))
+ || (__builtin_expect (__isinf_ns (x), 0) && ! __isnan (y)))
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, y, 28); /* remainder domain */
+
+ return __ieee754_remainder (x, y);
}
weak_alias (__remainder, remainder)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_remainderf.c b/math/w_remainderf.c
index 39d01b3..9bddf6f 100644
--- a/math/w_remainderf.c
+++ b/math/w_remainderf.c
@@ -1,47 +1,35 @@
-/* w_remainderf.c -- float version of w_remainder.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper remainderf(x,p)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __remainderf(float x, float y) /* wrapper remainder */
-#else
- float __remainderf(x,y) /* wrapper remainder */
- float x,y;
-#endif
+
+/* wrapper remainderf */
+float
+__remainderf (float x, float y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainderf(x,y);
-#else
- float z;
- z = __ieee754_remainderf(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnanf(y) || __isnanf(x)) return z;
- if(y==(float)0.0 || __isinf_nsf(x))
- /* remainder(x,0) */
- return (float)__kernel_standard((double)x,(double)y,128);
- else
- return z;
-#endif
+ if (((__builtin_expect (y == 0.0f, 0) && ! __isnanf (x))
+ || (__builtin_expect (__isinf_nsf (x), 0) && ! __isnanf (y)))
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, y, 128); /* remainder domain */
+
+ return __ieee754_remainderf (x, y);
}
weak_alias (__remainderf, remainderf)
diff --git a/math/w_remainderl.c b/math/w_remainderl.c
index dec70e5..66a1413 100644
--- a/math/w_remainderl.c
+++ b/math/w_remainderl.c
@@ -1,48 +1,35 @@
-/* w_remainderl.c -- long double version of w_remainder.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper remainderl(x,p)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __remainderl(long double x, long double y)
- /* wrapper remainderl */
-#else
- long double __remainderl(x,y) /* wrapper remainder */
- long double x,y;
-#endif
+
+/* wrapper remainderl */
+long double
+__remainderl (long double x, long double y)
{
-#ifdef _IEEE_LIBM
- return __ieee754_remainderl(x,y);
-#else
- long double z;
- z = __ieee754_remainderl(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnanl(y) || __isnanl(x)) return z;
- if(y==0.0 || __isinf_nsl(x))
- return __kernel_standard(x,y,228); /* remainder(x,0) */
- else
- return z;
-#endif
+ if (((__builtin_expect (y == 0.0L, 0) && ! __isnanl (x))
+ || (__builtin_expect (__isinf_nsl (x), 0) && ! __isnanl (y)))
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, y, 228); /* remainder domain */
+
+ return __ieee754_remainderl (x, y);
}
weak_alias (__remainderl, remainderl)
diff --git a/math/w_scalb.c b/math/w_scalb.c
index 830f387..91f3658 100644
--- a/math/w_scalb.c
+++ b/math/w_scalb.c
@@ -1,62 +1,54 @@
-/* @(#)w_scalb.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper scalb(double x, double fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <errno.h>
#include <math.h>
#include <math_private.h>
-#include <errno.h>
-#ifdef __STDC__
-#ifdef _SCALB_INT
- double __scalb(double x, int fn) /* wrapper scalb */
-#else
- double __scalb(double x, double fn) /* wrapper scalb */
-#endif
-#else
- double __scalb(x,fn) /* wrapper scalb */
-#ifdef _SCALB_INT
- double x; int fn;
-#else
- double x,fn;
-#endif
-#endif
+static double
+__attribute__ ((noinline))
+sysv_scalb (double x, double fn)
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalb(x,fn);
-#else
- double z;
- z = __ieee754_scalb(x,fn);
- if(_LIB_VERSION != _SVID_) return z;
- if(!(__finite(z)||__isnan(z))&&__finite(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(!__finite(fn)) __set_errno (ERANGE);
-#endif
- return z;
-#endif
+ double z = __ieee754_scalb (x, fn);
+
+ if (__builtin_expect (__isinf (z), 0))
+ {
+ if (__finite (x))
+ return __kernel_standard (x, fn, 32); /* scalb overflow */
+ else
+ __set_errno (ERANGE);
+ }
+ else if (__builtin_expect (z == 0.0, 0) && z != x)
+ return __kernel_standard (x, fn, 33); /* scalb underflow */
+
+ return z;
+}
+
+
+/* Wrapper scalb */
+double
+__scalb (double x, double fn)
+{
+ return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
+ ? sysv_scalb (x, fn)
+ : __ieee754_scalb (x, fn));
}
weak_alias (__scalb, scalb)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_scalbf.c b/math/w_scalbf.c
index bd92cc1..b8ee3f1 100644
--- a/math/w_scalbf.c
+++ b/math/w_scalbf.c
@@ -1,66 +1,53 @@
-/* w_scalbf.c -- float version of w_scalb.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper scalbf(float x, float fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <errno.h>
#include <math.h>
#include <math_private.h>
-#include <errno.h>
-#ifdef __STDC__
-#ifdef _SCALB_INT
- float __scalbf(float x, int fn) /* wrapper scalbf */
-#else
- float __scalbf(float x, float fn) /* wrapper scalbf */
-#endif
-#else
- float __scalbf(x,fn) /* wrapper scalbf */
-#ifdef _SCALB_INT
- float x; int fn;
-#else
- float x,fn;
-#endif
-#endif
+static float
+__attribute__ ((noinline))
+sysv_scalbf (float x, float fn)
+{
+ float z = __ieee754_scalbf (x, fn);
+
+ if (__builtin_expect (__isinff (z), 0))
+ {
+ if (__finitef (x))
+ return __kernel_standard_f (x, fn, 132); /* scalb overflow */
+ else
+ __set_errno (ERANGE);
+ }
+ else if (__builtin_expect (z == 0.0f, 0) && z != x)
+ return __kernel_standard_f (x, fn, 133); /* scalb underflow */
+
+ return z;
+}
+
+
+/* Wrapper scalbf */
+float
+__scalbf (float x, float fn)
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalbf(x,fn);
-#else
- float z;
- z = __ieee754_scalbf(x,fn);
- if(_LIB_VERSION != _SVID_) return z;
- if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) {
- /* scalbf overflow */
- return (float)__kernel_standard((double)x,(double)fn,132);
- }
- if(z==(float)0.0&&z!=x) {
- /* scalbf underflow */
- return (float)__kernel_standard((double)x,(double)fn,133);
- }
-#ifndef _SCALB_INT
- if(!__finitef(fn)) __set_errno (ERANGE);
-#endif
- return z;
-#endif
+ return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
+ ? sysv_scalbf (x, fn)
+ : __ieee754_scalbf (x, fn));
}
weak_alias (__scalbf, scalbf)
diff --git a/math/w_scalbl.c b/math/w_scalbl.c
index eb118b1..33fc725 100644
--- a/math/w_scalbl.c
+++ b/math/w_scalbl.c
@@ -1,65 +1,53 @@
-/* w_scalbl.c -- long double version of w_scalb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper scalbl(long double x, long double fn) is provide for
- * passing various standard test suite. One
- * should use scalbnl() instead.
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+#include <errno.h>
#include <math.h>
#include <math_private.h>
-#include <errno.h>
-#ifdef __STDC__
-#ifdef _SCALB_INT
- long double __scalbl(long double x, int fn) /* wrapper scalbl */
-#else
- long double __scalbl(long double x, long double fn)/* wrapper scalbl */
-#endif
-#else
- long double __scalbl(x,fn) /* wrapper scalbl */
-#ifdef _SCALB_INT
- long double x; int fn;
-#else
- long double x,fn;
-#endif
-#endif
+static long double
+__attribute__ ((noinline))
+sysv_scalbl (long double x, long double fn)
+{
+ long double z = __ieee754_scalbl (x, fn);
+
+ if (__builtin_expect (__isinfl (z), 0))
+ {
+ if (__finitel (x))
+ return __kernel_standard (x, fn, 232); /* scalb overflow */
+ else
+ __set_errno (ERANGE);
+ }
+ else if (__builtin_expect (z == 0.0L, 0) && z != x)
+ return __kernel_standard (x, fn, 233); /* scalb underflow */
+
+ return z;
+}
+
+
+/* Wrapper scalbl */
+long double
+__scalbl (long double x, long double fn)
{
-#ifdef _IEEE_LIBM
- return __ieee754_scalbl(x,fn);
-#else
- long double z;
- z = __ieee754_scalbl(x,fn);
- if(_LIB_VERSION != _SVID_) return z;
- if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
- return __kernel_standard(x,(double)fn,232); /* scalb overflow */
- }
- if(z==0.0&&z!=x) {
- return __kernel_standard(x,(double)fn,233); /* scalb underflow */
- }
-#ifndef _SCALB_INT
- if(!__finitel(fn)) __set_errno (ERANGE);
-#endif
- return z;
-#endif
+ return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
+ ? sysv_scalbl (x, fn)
+ : __ieee754_scalbl (x, fn));
}
weak_alias (__scalbl, scalbl)
diff --git a/math/w_sinh.c b/math/w_sinh.c
index c95e154..34ad2d8 100644
--- a/math/w_sinh.c
+++ b/math/w_sinh.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $";
-#endif
-
/*
* wrapper sinh(x)
*/
@@ -21,24 +17,15 @@ static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __sinh(double x) /* wrapper sinh */
-#else
- double __sinh(x) /* wrapper sinh */
- double x;
-#endif
+double
+__sinh (double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinh(x);
-#else
- double z;
- z = __ieee754_sinh(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finite(z)&&__finite(x)) {
- return __kernel_standard(x,x,25); /* sinh overflow */
- } else
- return z;
-#endif
+ double z = __ieee754_sinh (x);
+ if (__builtin_expect (!__finite (z), 0) && __finite (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 25); /* sinh overflow */
+
+ return z;
}
weak_alias (__sinh, sinh)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_sinhf.c b/math/w_sinhf.c
index c355599..1347e91 100644
--- a/math/w_sinhf.c
+++ b/math/w_sinhf.c
@@ -8,40 +8,26 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sinhf.c,v 1.3 1995/05/10 20:49:54 jtc Exp $";
-#endif
-
-/*
+/*
* wrapper sinhf(x)
*/
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __sinhf(float x) /* wrapper sinhf */
-#else
- float __sinhf(x) /* wrapper sinhf */
- float x;
-#endif
+float
+__sinhf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinhf(x);
-#else
- float z;
- z = __ieee754_sinhf(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitef(z)&&__finitef(x)) {
- /* sinhf overflow */
- return (float)__kernel_standard((double)x,(double)x,125);
- } else
- return z;
-#endif
+ float z = __ieee754_sinhf (x);
+ if (__builtin_expect (!__finitef (z), 0) && __finitef (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 125); /* sinhf overflow */
+
+ return z;
}
weak_alias (__sinhf, sinhf)
diff --git a/math/w_sinhl.c b/math/w_sinhl.c
index da7de81..5e65cf9 100644
--- a/math/w_sinhl.c
+++ b/math/w_sinhl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/*
* wrapper sinhl(x)
*/
@@ -25,23 +21,14 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __sinhl(long double x) /* wrapper sinhl */
-#else
- long double __sinhl(x) /* wrapper sinhl */
- long double x;
-#endif
+long double
+__sinhl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sinhl(x);
-#else
- long double z;
- z = __ieee754_sinhl(x);
- if(_LIB_VERSION == _IEEE_) return z;
- if(!__finitel(z)&&__finitel(x)) {
- return __kernel_standard(x,x,225); /* sinh overflow */
- } else
- return z;
-#endif
+ long double z = __ieee754_sinhl (x);
+ if (__builtin_expect (!__finitel (z), 0) && __finitel (x)
+ && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 225); /* sinh overflow */
+
+ return z;
}
weak_alias (__sinhl, sinhl)
diff --git a/math/w_sqrt.c b/math/w_sqrt.c
index c281bf4..8a435ef 100644
--- a/math/w_sqrt.c
+++ b/math/w_sqrt.c
@@ -1,44 +1,34 @@
-/* @(#)w_sqrt.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $";
-#endif
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper sqrt(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __sqrt(double x) /* wrapper sqrt */
-#else
- double __sqrt(x) /* wrapper sqrt */
- double x;
-#endif
+
+/* wrapper sqrt */
+double
+__sqrt (double x)
{
-#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
+ if (__builtin_expect (x < 0.0, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 26); /* sqrt(negative) */
+
+ return __ieee754_sqrt (x);
}
weak_alias (__sqrt, sqrt)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_sqrtf.c b/math/w_sqrtf.c
index 854d1cd..fc088b6 100644
--- a/math/w_sqrtf.c
+++ b/math/w_sqrtf.c
@@ -1,47 +1,33 @@
-/* w_sqrtf.c -- float version of w_sqrt.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sqrtf.c,v 1.3 1995/05/10 20:49:59 jtc Exp $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper sqrtf(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __sqrtf(float x) /* wrapper sqrtf */
-#else
- float sqrt(x) /* wrapper sqrtf */
- float x;
-#endif
+
+/* wrapper sqrtf */
+float
+__sqrtf (float x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrtf(x);
-#else
- float z;
- z = __ieee754_sqrtf(x);
- if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
- if(x<(float)0.0) {
- /* sqrtf(negative) */
- return (float)__kernel_standard((double)x,(double)x,126);
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 0.0f, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 126); /* sqrt(negative) */
+
+ return __ieee754_sqrtf (x);
}
weak_alias (__sqrtf, sqrtf)
diff --git a/math/w_sqrtl.c b/math/w_sqrtl.c
index 43770ee..0c44629 100644
--- a/math/w_sqrtl.c
+++ b/math/w_sqrtl.c
@@ -1,47 +1,33 @@
-/* w_sqrtl.c -- long double version of w_sqrt.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-/*
- * wrapper sqrtl(x)
- */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __sqrtl(long double x) /* wrapper sqrtl */
-#else
- long double __sqrtl(x) /* wrapper sqrtl */
- long double x;
-#endif
+
+/* wrapper sqrtl */
+long double
+__sqrtl (long double x)
{
-#ifdef _IEEE_LIBM
- return __ieee754_sqrtl(x);
-#else
- long double z;
- z = __ieee754_sqrtl(x);
- if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
- if(x<0.0) {
- return __kernel_standard(x,x,226); /* sqrt(negative) */
- } else
- return z;
-#endif
+ if (__builtin_expect (x < 0.0L, 0) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 226); /* sqrt(negative) */
+
+ return __ieee754_sqrtl (x);
}
weak_alias (__sqrtl, sqrtl)
diff --git a/math/w_tgamma.c b/math/w_tgamma.c
index 14d6855..976b5fb 100644
--- a/math/w_tgamma.c
+++ b/math/w_tgamma.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
-#endif
-
/* double gamma(double x)
* Return the logarithm of the Gamma function of x or the Gamma function of x,
* depending on the library mode.
@@ -22,23 +18,14 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- double __tgamma(double x)
-#else
- double __tgamma(x)
- double x;
-#endif
+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;
+ double y = __ieee754_gamma_r(x,&local_signgam);
- if(!__finite(y)&&__finite(x)) {
+ if(__builtin_expect(!__finite(y), 0)&&__finite(x)
+ && _LIB_VERSION != _IEEE_) {
if (x == 0.0)
return __kernel_standard(x,x,50); /* tgamma pole */
else if(__floor(x)==x&&x<0.0)
@@ -46,8 +33,7 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
else
return __kernel_standard(x,x,40); /* tgamma overflow */
}
- return y;
-#endif
+ return local_signgam < 0 ? -y : y;
}
weak_alias (__tgamma, tgamma)
#ifdef NO_LONG_DOUBLE
diff --git a/math/w_tgammaf.c b/math/w_tgammaf.c
index b1e72c6..4814135 100644
--- a/math/w_tgammaf.c
+++ b/math/w_tgammaf.c
@@ -13,41 +13,27 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
-#endif
-
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- float __tgammaf(float x)
-#else
- float __tgammaf(x)
- float x;
-#endif
+float
+__tgammaf(float x)
{
- float y;
int local_signgam;
- y = __ieee754_gammaf_r(x,&local_signgam);
- if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
- return y;
-#else
- if(_LIB_VERSION == _IEEE_) return y;
+ float y = __ieee754_gammaf_r(x,&local_signgam);
- if(!__finitef(y)&&__finitef(x)) {
+ if(__builtin_expect(!__finitef(y), 0) && __finitef(x)
+ && _LIB_VERSION != _IEEE_) {
if (x == (float)0.0)
/* tgammaf pole */
- return (float)__kernel_standard((double)x,(double)x,150);
- else if(__floorf(x)==x&&x<(float)0.0)
+ return __kernel_standard_f(x, x, 150);
+ else if(__floorf(x)==x&&x<0.0f)
/* tgammaf domain */
- return (float)__kernel_standard((double)x,(double)x,141);
+ return __kernel_standard_f(x, x, 141);
else
/* tgammaf overflow */
- return (float)__kernel_standard((double)x,(double)x,140);
+ return __kernel_standard_f(x, x, 140);
}
- return y;
-#endif
+ return local_signgam < 0 ? - y : y;
}
weak_alias (__tgammaf, tgammaf)
diff --git a/math/w_tgammal.c b/math/w_tgammal.c
index 63379a8..6910f92 100644
--- a/math/w_tgammal.c
+++ b/math/w_tgammal.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* long double gammal(double x)
* Return the Gamma function of x.
*/
@@ -25,31 +21,21 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-#ifdef __STDC__
- long double __tgammal(long double x)
-#else
- long double __tgammal(x)
- long double x;
-#endif
+long double
+__tgammal(long double x)
{
- long double y;
int local_signgam;
- y = __ieee754_gammal_r(x,&local_signgam);
- if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
- return y;
-#else
- if(_LIB_VERSION == _IEEE_) return y;
+ long double y = __ieee754_gammal_r(x,&local_signgam);
- if(!__finitel(y)&&__finitel(x)) {
+ if(__builtin_expect(!__finitel(y), 0) && __finitel(x)
+ && _LIB_VERSION != _IEEE_) {
if(x==0.0)
return __kernel_standard(x,x,250); /* tgamma pole */
- else if(__floorl(x)==x&&x<0.0)
+ else if(__floorl(x)==x&&x<0.0L)
return __kernel_standard(x,x,241); /* tgamma domain */
else
return __kernel_standard(x,x,240); /* tgamma overflow */
}
- return y;
-#endif
+ return local_signgam < 0 ? - y : y;
}
weak_alias (__tgammal, tgammal)
diff --git a/sysdeps/i386/fpu/e_acos.S b/sysdeps/i386/fpu/e_acos.S
index b9d07b1..d3505ba 100644
--- a/sysdeps/i386/fpu/e_acos.S
+++ b/sysdeps/i386/fpu/e_acos.S
@@ -19,3 +19,4 @@ ENTRY(__ieee754_acos)
fpatan /* atan (sqrt(1 - x^2) / x) */
ret
END (__ieee754_acos)
+strong_alias (__ieee754_acos, __acos_finite)
diff --git a/sysdeps/i386/fpu/e_acosf.S b/sysdeps/i386/fpu/e_acosf.S
index 50b13fd..6a843a5 100644
--- a/sysdeps/i386/fpu/e_acosf.S
+++ b/sysdeps/i386/fpu/e_acosf.S
@@ -20,3 +20,4 @@ ENTRY(__ieee754_acosf)
fpatan
ret
END (__ieee754_acosf)
+strong_alias (__ieee754_acosf, __acosf_finite)
diff --git a/sysdeps/i386/fpu/e_acosh.S b/sysdeps/i386/fpu/e_acosh.S
index 62a2324..fc65c29 100644
--- a/sysdeps/i386/fpu/e_acosh.S
+++ b/sysdeps/i386/fpu/e_acosh.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -21,12 +21,12 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -101,3 +101,4 @@ ENTRY(__ieee754_acosh)
fdiv %st, %st(0)
ret
END(__ieee754_acosh)
+strong_alias (__ieee754_acosh, __acosh_finite)
diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S
index 1906c60..b55004b 100644
--- a/sysdeps/i386/fpu/e_acoshf.S
+++ b/sysdeps/i386/fpu/e_acoshf.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -21,12 +21,12 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -101,3 +101,4 @@ ENTRY(__ieee754_acoshf)
fdiv %st, %st(0)
ret
END(__ieee754_acoshf)
+strong_alias (__ieee754_acoshf, __acoshf_finite)
diff --git a/sysdeps/i386/fpu/e_acoshl.S b/sysdeps/i386/fpu/e_acoshl.S
index c7b548d..76bc0d7 100644
--- a/sysdeps/i386/fpu/e_acoshl.S
+++ b/sysdeps/i386/fpu/e_acoshl.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -21,12 +21,12 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
/* Please note that we use double value for 1.0. This number
has an exact representation and so we don't get accuracy
problems. The advantage is that the code is simpler. */
@@ -108,3 +108,4 @@ ENTRY(__ieee754_acoshl)
fdiv %st, %st(0)
ret
END(__ieee754_acoshl)
+strong_alias (__ieee754_acoshl, __acoshl_finite)
diff --git a/sysdeps/i386/fpu/e_acosl.c b/sysdeps/i386/fpu/e_acosl.c
index 0c3e039..ec516ff 100644
--- a/sysdeps/i386/fpu/e_acosl.c
+++ b/sysdeps/i386/fpu/e_acosl.c
@@ -23,3 +23,4 @@ __ieee754_acosl (long double x)
: "=t" (res) : "0" (x) : "st(1)");
return res;
}
+strong_alias (__ieee754_acosl, __acosl_finite)
diff --git a/sysdeps/i386/fpu/e_asin.S b/sysdeps/i386/fpu/e_asin.S
index 945e308..a17e922 100644
--- a/sysdeps/i386/fpu/e_asin.S
+++ b/sysdeps/i386/fpu/e_asin.S
@@ -18,3 +18,4 @@ ENTRY(__ieee754_asin)
fpatan
ret
END (__ieee754_asin)
+strong_alias (__ieee754_asin, __asin_finite)
diff --git a/sysdeps/i386/fpu/e_asinf.S b/sysdeps/i386/fpu/e_asinf.S
index d450e9a..5c1065d 100644
--- a/sysdeps/i386/fpu/e_asinf.S
+++ b/sysdeps/i386/fpu/e_asinf.S
@@ -19,3 +19,4 @@ ENTRY(__ieee754_asinf)
fpatan
ret
END (__ieee754_asinf)
+strong_alias (__ieee754_asinf, __asinf_finite)
diff --git a/sysdeps/i386/fpu/e_atan2.S b/sysdeps/i386/fpu/e_atan2.S
index 8df04e4..e76f8e2 100644
--- a/sysdeps/i386/fpu/e_atan2.S
+++ b/sysdeps/i386/fpu/e_atan2.S
@@ -13,3 +13,4 @@ ENTRY(__ieee754_atan2)
fpatan
ret
END (__ieee754_atan2)
+strong_alias (__ieee754_atan2, __atan2_finite)
diff --git a/sysdeps/i386/fpu/e_atan2f.S b/sysdeps/i386/fpu/e_atan2f.S
index fc6621f..9ffa637 100644
--- a/sysdeps/i386/fpu/e_atan2f.S
+++ b/sysdeps/i386/fpu/e_atan2f.S
@@ -13,3 +13,4 @@ ENTRY(__ieee754_atan2f)
fpatan
ret
END (__ieee754_atan2f)
+strong_alias (__ieee754_atan2f, __atan2f_finite)
diff --git a/sysdeps/i386/fpu/e_atan2l.c b/sysdeps/i386/fpu/e_atan2l.c
index 19a2a60..9f88bfc 100644
--- a/sysdeps/i386/fpu/e_atan2l.c
+++ b/sysdeps/i386/fpu/e_atan2l.c
@@ -16,3 +16,4 @@ __ieee754_atan2l (long double y, long double x)
return res;
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
diff --git a/sysdeps/i386/fpu/e_atanh.S b/sysdeps/i386/fpu/e_atanh.S
index 3566ec6..d7e53a2 100644
--- a/sysdeps/i386/fpu/e_atanh.S
+++ b/sysdeps/i386/fpu/e_atanh.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arctanh function.
- Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -114,3 +114,4 @@ ENTRY(__ieee754_atanh)
6: fldl 4(%esp)
ret
END(__ieee754_atanh)
+strong_alias (__ieee754_atanh, __atanh_finite)
diff --git a/sysdeps/i386/fpu/e_atanhf.S b/sysdeps/i386/fpu/e_atanhf.S
index 10ce6ae..00ad914 100644
--- a/sysdeps/i386/fpu/e_atanhf.S
+++ b/sysdeps/i386/fpu/e_atanhf.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arctanh function.
- Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -107,3 +107,4 @@ ENTRY(__ieee754_atanhf)
5: flds 4(%esp)
ret
END(__ieee754_atanhf)
+strong_alias (__ieee754_atanhf, __atanhf_finite)
diff --git a/sysdeps/i386/fpu/e_atanhl.S b/sysdeps/i386/fpu/e_atanhl.S
index 8618c3f..cc70e73 100644
--- a/sysdeps/i386/fpu/e_atanhl.S
+++ b/sysdeps/i386/fpu/e_atanhl.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arctanh function.
- Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -118,3 +118,4 @@ ENTRY(__ieee754_atanhl)
6: fldt 4(%esp)
ret
END(__ieee754_atanhl)
+strong_alias (__ieee754_atanhl, __atanhl_finite)
diff --git a/sysdeps/i386/fpu/e_exp10.S b/sysdeps/i386/fpu/e_exp10.S
index 6bfcdbb..1e32b07 100644
--- a/sysdeps/i386/fpu/e_exp10.S
+++ b/sysdeps/i386/fpu/e_exp10.S
@@ -36,3 +36,4 @@ ENTRY(__ieee754_exp10)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp10)
+strong_alias (__ieee754_exp10, __exp10_finite)
diff --git a/sysdeps/i386/fpu/e_exp10f.S b/sysdeps/i386/fpu/e_exp10f.S
index 4791b99..6144964 100644
--- a/sysdeps/i386/fpu/e_exp10f.S
+++ b/sysdeps/i386/fpu/e_exp10f.S
@@ -4,7 +4,7 @@
#include <machine/asm.h>
-/* e^x = 2^(x * log2(10)) */
+/* 10^x = 2^(x * log2(10)) */
ENTRY(__ieee754_exp10f)
flds 4(%esp)
/* I added the following ugly construct because exp(+-Inf) resulted
@@ -36,3 +36,4 @@ ENTRY(__ieee754_exp10f)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp10f)
+strong_alias (__ieee754_exp10f, __exp10f_finite)
diff --git a/sysdeps/i386/fpu/e_exp10l.S b/sysdeps/i386/fpu/e_exp10l.S
index 71f0da7..04ec800 100644
--- a/sysdeps/i386/fpu/e_exp10l.S
+++ b/sysdeps/i386/fpu/e_exp10l.S
@@ -4,7 +4,7 @@
#include <machine/asm.h>
-/* e^x = 2^(x * log2l(10)) */
+/* 10^x = 2^(x * log2l(10)) */
ENTRY(__ieee754_exp10l)
fldt 4(%esp)
/* I added the following ugly construct because expl(+-Inf) resulted
@@ -36,3 +36,4 @@ ENTRY(__ieee754_exp10l)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp10l)
+strong_alias (__ieee754_exp10l, __exp10l_finite)
diff --git a/sysdeps/i386/fpu/e_exp2.S b/sysdeps/i386/fpu/e_exp2.S
index 778c0c0..f802cf8 100644
--- a/sysdeps/i386/fpu/e_exp2.S
+++ b/sysdeps/i386/fpu/e_exp2.S
@@ -35,3 +35,4 @@ ENTRY(__ieee754_exp2)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp2)
+strong_alias (__ieee754_exp2, __exp2_finite)
diff --git a/sysdeps/i386/fpu/e_exp2f.S b/sysdeps/i386/fpu/e_exp2f.S
index c2d1af1..f867d0d 100644
--- a/sysdeps/i386/fpu/e_exp2f.S
+++ b/sysdeps/i386/fpu/e_exp2f.S
@@ -35,3 +35,4 @@ ENTRY(__ieee754_exp2f)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp2f)
+strong_alias (__ieee754_exp2f, __exp2f_finite)
diff --git a/sysdeps/i386/fpu/e_exp2l.S b/sysdeps/i386/fpu/e_exp2l.S
index fa1fdc9..203dd00 100644
--- a/sysdeps/i386/fpu/e_exp2l.S
+++ b/sysdeps/i386/fpu/e_exp2l.S
@@ -35,3 +35,4 @@ ENTRY(__ieee754_exp2l)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp2l)
+strong_alias (__ieee754_exp2l, __exp2l_finite)
diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S
index 4cf6e92..26b3acc 100644
--- a/sysdeps/i386/fpu/e_fmod.S
+++ b/sysdeps/i386/fpu/e_fmod.S
@@ -5,8 +5,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_fmod.S,v 1.4 1995/05/08 23:47:56 jtc Exp $")
-
ENTRY(__ieee754_fmod)
fldl 12(%esp)
fldl 4(%esp)
@@ -17,3 +15,4 @@ ENTRY(__ieee754_fmod)
fstp %st(1)
ret
END (__ieee754_fmod)
+strong_alias (__ieee754_fmod, __fmod_finite)
diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S
index bbce409..ece4d98 100644
--- a/sysdeps/i386/fpu/e_fmodf.S
+++ b/sysdeps/i386/fpu/e_fmodf.S
@@ -6,8 +6,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
ENTRY(__ieee754_fmodf)
flds 8(%esp)
flds 4(%esp)
@@ -18,3 +16,4 @@ ENTRY(__ieee754_fmodf)
fstp %st(1)
ret
END(__ieee754_fmodf)
+strong_alias (__ieee754_fmodf, __fmodf_finite)
diff --git a/sysdeps/i386/fpu/e_fmodl.c b/sysdeps/i386/fpu/e_fmodl.c
index c7c9a60..49700ae 100644
--- a/sysdeps/i386/fpu/e_fmodl.c
+++ b/sysdeps/i386/fpu/e_fmodl.c
@@ -20,3 +20,4 @@ __ieee754_fmodl (long double x, long double y)
: "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
return res;
}
+strong_alias (__ieee754_fmodl, __fmodl_finite)
diff --git a/sysdeps/i386/fpu/e_hypot.S b/sysdeps/i386/fpu/e_hypot.S
index 0435857..0baa011 100644
--- a/sysdeps/i386/fpu/e_hypot.S
+++ b/sysdeps/i386/fpu/e_hypot.S
@@ -1,5 +1,5 @@
/* Compute the hypothenuse of X and Y.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -58,5 +58,6 @@ ENTRY(__ieee754_hypot)
fxch
5: fstp %st(1)
jmp 2b
-
+
END(__ieee754_hypot)
+strong_alias (__ieee754_hypot, __hypot_finite)
diff --git a/sysdeps/i386/fpu/e_hypotf.S b/sysdeps/i386/fpu/e_hypotf.S
index 5967dae..eb95d6e 100644
--- a/sysdeps/i386/fpu/e_hypotf.S
+++ b/sysdeps/i386/fpu/e_hypotf.S
@@ -1,5 +1,5 @@
/* Compute the hypothenuse of X and Y.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -58,5 +58,6 @@ ENTRY(__ieee754_hypotf)
fxch
5: fstp %st(1)
jmp 2b
-
+
END(__ieee754_hypotf)
+strong_alias (__ieee754_hypotf, __hypotf_finite)
diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S
index ce55b72..8110a84 100644
--- a/sysdeps/i386/fpu/e_log.S
+++ b/sysdeps/i386/fpu/e_log.S
@@ -7,14 +7,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -27,9 +25,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -64,3 +62,4 @@ ENTRY(__ieee754_log)
fstp %st(1)
ret
END (__ieee754_log)
+strong_alias (__ieee754_log, __log_finite)
diff --git a/sysdeps/i386/fpu/e_log10.S b/sysdeps/i386/fpu/e_log10.S
index 525f08c..9d24d74 100644
--- a/sysdeps/i386/fpu/e_log10.S
+++ b/sysdeps/i386/fpu/e_log10.S
@@ -7,14 +7,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -27,9 +25,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -64,3 +62,4 @@ ENTRY(__ieee754_log10)
fstp %st(1)
ret
END (__ieee754_log10)
+strong_alias (__ieee754_log10, __log10_finite)
diff --git a/sysdeps/i386/fpu/e_log10f.S b/sysdeps/i386/fpu/e_log10f.S
index da5069d..38a4833 100644
--- a/sysdeps/i386/fpu/e_log10f.S
+++ b/sysdeps/i386/fpu/e_log10f.S
@@ -8,14 +8,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -28,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -65,3 +63,4 @@ ENTRY(__ieee754_log10f)
fstp %st(1)
ret
END (__ieee754_log10f)
+strong_alias (__ieee754_log10f, __log10f_finite)
diff --git a/sysdeps/i386/fpu/e_log10l.S b/sysdeps/i386/fpu/e_log10l.S
index 3811516..88b309d 100644
--- a/sysdeps/i386/fpu/e_log10l.S
+++ b/sysdeps/i386/fpu/e_log10l.S
@@ -9,14 +9,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -29,9 +27,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -66,3 +64,4 @@ ENTRY(__ieee754_log10l)
fstp %st(1)
ret
END(__ieee754_log10l)
+strong_alias (__ieee754_log10l, __log10l_finite)
diff --git a/sysdeps/i386/fpu/e_log2.S b/sysdeps/i386/fpu/e_log2.S
index d80bf80..88aee7f 100644
--- a/sysdeps/i386/fpu/e_log2.S
+++ b/sysdeps/i386/fpu/e_log2.S
@@ -9,11 +9,11 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -26,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -63,3 +63,4 @@ ENTRY(__ieee754_log2)
fstp %st(1)
ret
END (__ieee754_log2)
+strong_alias (__ieee754_log2, __log2_finite)
diff --git a/sysdeps/i386/fpu/e_log2f.S b/sysdeps/i386/fpu/e_log2f.S
index 9eb7b2a..2014487 100644
--- a/sysdeps/i386/fpu/e_log2f.S
+++ b/sysdeps/i386/fpu/e_log2f.S
@@ -9,11 +9,11 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -26,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -63,3 +63,4 @@ ENTRY(__ieee754_log2f)
fstp %st(1)
ret
END (__ieee754_log2f)
+strong_alias (__ieee754_log2f, __log2f_finite)
diff --git a/sysdeps/i386/fpu/e_log2l.S b/sysdeps/i386/fpu/e_log2l.S
index 9de08f5..bc79dea 100644
--- a/sysdeps/i386/fpu/e_log2l.S
+++ b/sysdeps/i386/fpu/e_log2l.S
@@ -9,11 +9,11 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -26,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -63,3 +63,4 @@ ENTRY(__ieee754_log2l)
fstp %st(1)
ret
END (__ieee754_log2l)
+strong_alias (__ieee754_log2l, __log2l_finite)
diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S
index cd4538b..b683e13 100644
--- a/sysdeps/i386/fpu/e_logf.S
+++ b/sysdeps/i386/fpu/e_logf.S
@@ -8,14 +8,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -28,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -65,3 +63,4 @@ ENTRY(__ieee754_logf)
fstp %st(1)
ret
END (__ieee754_logf)
+strong_alias (__ieee754_logf, __logf_finite)
diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S
index 551dcf1..ee1fb16 100644
--- a/sysdeps/i386/fpu/e_logl.S
+++ b/sysdeps/i386/fpu/e_logl.S
@@ -7,15 +7,13 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -28,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -65,3 +63,4 @@ ENTRY(__ieee754_logl)
fstp %st(1)
ret
END (__ieee754_logl)
+strong_alias (__ieee754_logl, __logl_finite)
diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S
index 792f926..dccc677 100644
--- a/sysdeps/i386/fpu/e_pow.S
+++ b/sysdeps/i386/fpu/e_pow.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -22,12 +22,27 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
+ .p2align 3
+ ASM_TYPE_DIRECTIVE(one,@object)
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ ASM_TYPE_DIRECTIVE(limit,@object)
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ ASM_TYPE_DIRECTIVE(p63,@object)
+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
+ ASM_SIZE_DIRECTIVE(p63)
- .align ALIGNARG(4)
+#ifdef __ELF__
+ .section .rodata.cst16,"aM",@progbits,16
+#else
+ .text
+#endif
+ .p2align 3
ASM_TYPE_DIRECTIVE(infinity,@object)
inf_zero:
infinity:
@@ -43,22 +58,13 @@ minfinity:
mzero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
ASM_SIZE_DIRECTIVE(minf_mzero)
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
- ASM_TYPE_DIRECTIVE(limit,@object)
-limit: .double 0.29
- ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(p63,@object)
-p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
- ASM_SIZE_DIRECTIVE(p63)
#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+# define MO(op) op##@GOTOFF(%ecx)
+# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
+# define MO(op) op
+# define MOX(op,x,f) op(,x,f)
#endif
.text
@@ -360,3 +366,4 @@ ENTRY(__ieee754_pow)
ret
END(__ieee754_pow)
+strong_alias (__ieee754_pow, __pow_finite)
diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S
index c915454..99c95bb 100644
--- a/sysdeps/i386/fpu/e_powf.S
+++ b/sysdeps/i386/fpu/e_powf.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007
+ Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -22,12 +22,27 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
+ .p2align 3
+ ASM_TYPE_DIRECTIVE(one,@object)
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ ASM_TYPE_DIRECTIVE(limit,@object)
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ ASM_TYPE_DIRECTIVE(p31,@object)
+p31: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x41
+ ASM_SIZE_DIRECTIVE(p31)
- .align ALIGNARG(4)
+#ifdef __ELF__
+ .section .rodata.cst16,"aM",@progbits,16
+#else
+ .text
+#endif
+ .p2align 3
ASM_TYPE_DIRECTIVE(infinity,@object)
inf_zero:
infinity:
@@ -43,22 +58,13 @@ minfinity:
mzero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
ASM_SIZE_DIRECTIVE(minf_mzero)
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
- ASM_TYPE_DIRECTIVE(limit,@object)
-limit: .double 0.29
- ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(p31,@object)
-p31: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x41
- ASM_SIZE_DIRECTIVE(p31)
#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+# define MO(op) op##@GOTOFF(%ecx)
+# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
+# define MO(op) op
+# define MOX(op,x,f) op(,x,f)
#endif
.text
@@ -348,3 +354,4 @@ ENTRY(__ieee754_powf)
ret
END(__ieee754_powf)
+strong_alias (__ieee754_powf, __powf_finite)
diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S
index 6215496..34ace35 100644
--- a/sysdeps/i386/fpu/e_powl.S
+++ b/sysdeps/i386/fpu/e_powl.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -22,12 +22,27 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
+ .p2align 3
+ ASM_TYPE_DIRECTIVE(one,@object)
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ ASM_TYPE_DIRECTIVE(limit,@object)
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ ASM_TYPE_DIRECTIVE(p63,@object)
+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
+ ASM_SIZE_DIRECTIVE(p63)
- .align ALIGNARG(4)
+#ifdef __ELF__
+ .section .rodata.cst16,"aM",@progbits,16
+#else
+ .text
+#endif
+ .p2align 3
ASM_TYPE_DIRECTIVE(infinity,@object)
inf_zero:
infinity:
@@ -43,22 +58,13 @@ minfinity:
mzero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
ASM_SIZE_DIRECTIVE(minf_mzero)
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
- ASM_TYPE_DIRECTIVE(limit,@object)
-limit: .double 0.29
- ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(p63,@object)
-p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
- ASM_SIZE_DIRECTIVE(p63)
#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+# define MO(op) op##@GOTOFF(%ecx)
+# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
+# define MO(op) op
+# define MOX(op,x,f) op(,x,f)
#endif
.text
@@ -360,3 +366,4 @@ ENTRY(__ieee754_powl)
ret
END(__ieee754_powl)
+strong_alias (__ieee754_powl, __powl_finite)
diff --git a/sysdeps/i386/fpu/e_remainder.S b/sysdeps/i386/fpu/e_remainder.S
index 2f43cb8..f7867aa 100644
--- a/sysdeps/i386/fpu/e_remainder.S
+++ b/sysdeps/i386/fpu/e_remainder.S
@@ -5,8 +5,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_remainder.S,v 1.4 1995/05/08 23:49:37 jtc Exp $")
-
ENTRY(__ieee754_remainder)
fldl 12(%esp)
fldl 4(%esp)
@@ -17,3 +15,4 @@ ENTRY(__ieee754_remainder)
fstp %st(1)
ret
END (__ieee754_remainder)
+strong_alias (__ieee754_remainder, __remainder_finite)
diff --git a/sysdeps/i386/fpu/e_remainderf.S b/sysdeps/i386/fpu/e_remainderf.S
index 79f8219..cfd390b 100644
--- a/sysdeps/i386/fpu/e_remainderf.S
+++ b/sysdeps/i386/fpu/e_remainderf.S
@@ -5,8 +5,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $")
-
ENTRY(__ieee754_remainderf)
flds 8(%esp)
flds 4(%esp)
@@ -17,3 +15,4 @@ ENTRY(__ieee754_remainderf)
fstp %st(1)
ret
END (__ieee754_remainderf)
+strong_alias (__ieee754_remainderf, __remainderf_finite)
diff --git a/sysdeps/i386/fpu/e_remainderl.S b/sysdeps/i386/fpu/e_remainderl.S
index 5f50b62..5ec23a3 100644
--- a/sysdeps/i386/fpu/e_remainderl.S
+++ b/sysdeps/i386/fpu/e_remainderl.S
@@ -7,8 +7,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
ENTRY(__ieee754_remainderl)
fldt 16(%esp)
fldt 4(%esp)
@@ -19,3 +17,4 @@ ENTRY(__ieee754_remainderl)
fstp %st(1)
ret
END (__ieee754_remainderl)
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/sysdeps/i386/fpu/e_scalb.S b/sysdeps/i386/fpu/e_scalb.S
index 7e334a3..0f3ec96 100644
--- a/sysdeps/i386/fpu/e_scalb.S
+++ b/sysdeps/i386/fpu/e_scalb.S
@@ -7,8 +7,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $")
-
#ifdef __ELF__
.section .rodata
#else
@@ -20,18 +18,17 @@ RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $")
zero_nan:
.double 0.0
nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
-minus_zero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
ASM_SIZE_DIRECTIVE(zero_nan)
#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+# define MO(op) op##@GOTOFF(%ecx)
+# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
+# define MO(op) op
+# define MOX(op,x,f) op(,x,f)
#endif
.text
@@ -100,3 +97,4 @@ ENTRY(__ieee754_scalb)
fdiv %st
ret
END(__ieee754_scalb)
+strong_alias (__ieee754_scalb, __scalb_finite)
diff --git a/sysdeps/i386/fpu/e_scalbf.S b/sysdeps/i386/fpu/e_scalbf.S
index e99ee92..d11ca66 100644
--- a/sysdeps/i386/fpu/e_scalbf.S
+++ b/sysdeps/i386/fpu/e_scalbf.S
@@ -8,8 +8,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
.section .rodata
#else
@@ -21,18 +19,17 @@ RCSID("$NetBSD: $")
zero_nan:
.double 0.0
nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
-minus_zero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
ASM_SIZE_DIRECTIVE(zero_nan)
#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+# define MO(op) op##@GOTOFF(%ecx)
+# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
+# define MO(op) op
+# define MOX(op,x,f) op(,x,f)
#endif
@@ -102,3 +99,4 @@ ENTRY(__ieee754_scalbf)
fdiv %st
ret
END(__ieee754_scalbf)
+strong_alias (__ieee754_scalbf, __scalbf_finite)
diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S
index 3f67d0b..d8b2169 100644
--- a/sysdeps/i386/fpu/e_scalbl.S
+++ b/sysdeps/i386/fpu/e_scalbl.S
@@ -9,8 +9,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
.section .rodata
#else
@@ -22,18 +20,17 @@ RCSID("$NetBSD: $")
zero_nan:
.double 0.0
nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
-minus_zero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
ASM_SIZE_DIRECTIVE(zero_nan)
#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
+# define MO(op) op##@GOTOFF(%ecx)
+# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
+# define MO(op) op
+# define MOX(op,x,f) op(,x,f)
#endif
.text
@@ -102,3 +99,4 @@ ENTRY(__ieee754_scalbl)
fdiv %st
ret
END(__ieee754_scalbl)
+strong_alias (__ieee754_scalbl, __scalbl_finite)
diff --git a/sysdeps/i386/fpu/e_sqrt.S b/sysdeps/i386/fpu/e_sqrt.S
index 6f253d5..1054ba4 100644
--- a/sysdeps/i386/fpu/e_sqrt.S
+++ b/sysdeps/i386/fpu/e_sqrt.S
@@ -5,10 +5,9 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_sqrt.S,v 1.4 1995/05/08 23:49:57 jtc Exp $")
-
ENTRY(__ieee754_sqrt)
fldl 4(%esp)
fsqrt
ret
END (__ieee754_sqrt)
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/i386/fpu/e_sqrtf.S b/sysdeps/i386/fpu/e_sqrtf.S
index 5ce1ad0..6f7e4b0 100644
--- a/sysdeps/i386/fpu/e_sqrtf.S
+++ b/sysdeps/i386/fpu/e_sqrtf.S
@@ -5,10 +5,9 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_sqrtf.S,v 1.2 1995/05/08 23:50:14 jtc Exp $")
-
ENTRY(__ieee754_sqrtf)
flds 4(%esp)
fsqrt
ret
END (__ieee754_sqrtf)
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/i386/fpu/e_sqrtl.c b/sysdeps/i386/fpu/e_sqrtl.c
index 85f61bb..41bcd7e 100644
--- a/sysdeps/i386/fpu/e_sqrtl.c
+++ b/sysdeps/i386/fpu/e_sqrtl.c
@@ -7,6 +7,7 @@
#include <math_private.h>
+#undef __ieee754_sqrtl
long double
__ieee754_sqrtl (long double x)
{
@@ -16,3 +17,4 @@ __ieee754_sqrtl (long double x)
return res;
}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
diff --git a/sysdeps/ia64/fpu/bits/math-finite.h b/sysdeps/ia64/fpu/bits/math-finite.h
new file mode 100644
index 0000000..8901b2d
--- /dev/null
+++ b/sysdeps/ia64/fpu/bits/math-finite.h
@@ -0,0 +1,25 @@
+/* Entry points to finite-math-only compiler runs.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/math-finite.h> directly; include <math.h> instead."
+#endif
+
+/* Nothing can be done for IA-64 since the math functions differ in their
+ structure. */
diff --git a/sysdeps/ieee754/dbl-64/e_acosh.c b/sysdeps/ieee754/dbl-64/e_acosh.c
index 27c29cd..f474e9a 100644
--- a/sysdeps/ieee754/dbl-64/e_acosh.c
+++ b/sysdeps/ieee754/dbl-64/e_acosh.c
@@ -5,18 +5,14 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
-#endif
-
/* __ieee754_acosh(x)
* Method :
- * Based on
+ * Based on
* acosh(x) = log [ x + sqrt(x*x-1) ]
* we have
* acosh(x) := log(x)+ln2, if x is large; else
@@ -31,21 +27,13 @@ static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
+static const double
one = 1.0,
ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
-#ifdef __STDC__
- double __ieee754_acosh(double x)
-#else
- double __ieee754_acosh(x)
- double x;
-#endif
-{
+double
+__ieee754_acosh(double x)
+{
double t;
int32_t hx;
u_int32_t lx;
@@ -54,8 +42,8 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
return (x-x)/(x-x);
} else if(hx >=0x41b00000) { /* x > 2**28 */
if(hx >=0x7ff00000) { /* x is inf of NaN */
- return x+x;
- } else
+ return x+x;
+ } else
return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
} else if(((hx-0x3ff00000)|lx)==0) {
return 0.0; /* acosh(1) = 0 */
@@ -67,3 +55,4 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
return __log1p(t+__sqrt(2.0*t+t*t));
}
}
+strong_alias (__ieee754_acosh, __acosh_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_asin.c b/sysdeps/ieee754/dbl-64/e_asin.c
index ce5d227..02efb7a 100644
--- a/sysdeps/ieee754/dbl-64/e_asin.c
+++ b/sysdeps/ieee754/dbl-64/e_asin.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -209,9 +209,9 @@ double __ieee754_asin(double x){
else xx = -x - asncs.x[n];
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+
- xx*asncs.x[n+9])))))))+asncs.x[n+10];
+ xx*asncs.x[n+9])))))))+asncs.x[n+10];
t+=p;
res =asncs.x[n+11] +t;
cor = (asncs.x[n+11]-res)+t;
@@ -248,9 +248,9 @@ double __ieee754_asin(double x){
else xx = -x - asncs.x[n];
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+
- xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11];
+ xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11];
t+=p;
res =asncs.x[n+12] +t;
cor = (asncs.x[n+12]-res)+t;
@@ -324,6 +324,7 @@ double __ieee754_asin(double x){
return u.x/v.x; /* NaN */
}
}
+strong_alias (__ieee754_asin, __asin_finite)
/*******************************************************************/
/* */
@@ -397,7 +398,7 @@ double __ieee754_acos(double x)
else xx = -x - asncs.x[n];
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*asncs.x[n+6]))))+asncs.x[n+7];
+ xx*(asncs.x[n+5]+xx*asncs.x[n+6]))))+asncs.x[n+7];
t+=p;
y = (m>0)?(hp0.x-asncs.x[n+8]):(hp0.x+asncs.x[n+8]);
t = (m>0)?(hp1.x-t):(hp1.x+t);
@@ -433,8 +434,8 @@ double __ieee754_acos(double x)
else {xx = -x - asncs.x[n]; eps=1.02; }
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+
- xx*asncs.x[n+7])))))+asncs.x[n+8];
+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+
+ xx*asncs.x[n+7])))))+asncs.x[n+8];
t+=p;
y = (m>0)?(hp0.x-asncs.x[n+9]):(hp0.x+asncs.x[n+9]);
t = (m>0)?(hp1.x-t):(hp1.x+t);
@@ -468,8 +469,8 @@ double __ieee754_acos(double x)
else {xx = -x - asncs.x[n]; eps = 1.01; }
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+
- xx*asncs.x[n+8]))))))+asncs.x[n+9];
+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+
+ xx*asncs.x[n+8]))))))+asncs.x[n+9];
t+=p;
y = (m>0)?(hp0.x-asncs.x[n+10]):(hp0.x+asncs.x[n+10]);
t = (m>0)?(hp1.x-t):(hp1.x+t);
@@ -503,9 +504,9 @@ double __ieee754_acos(double x)
else {xx = -x - asncs.x[n]; eps =1.005; }
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+
- xx*asncs.x[n+9])))))))+asncs.x[n+10];
+ xx*asncs.x[n+9])))))))+asncs.x[n+10];
t+=p;
y = (m>0)?(hp0.x-asncs.x[n+11]):(hp0.x+asncs.x[n+11]);
t = (m>0)?(hp1.x-t):(hp1.x+t);
@@ -539,9 +540,9 @@ double __ieee754_acos(double x)
else {xx = -x - asncs.x[n]; eps=1.005;}
t = asncs.x[n+1]*xx;
p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+
- xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]
+xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+xx*(asncs.x[n+9]+
- xx*asncs.x[n+10]))))))))+asncs.x[n+11];
+ xx*asncs.x[n+10]))))))))+asncs.x[n+11];
t+=p;
y = (m>0)?(hp0.x-asncs.x[n+12]):(hp0.x+asncs.x[n+12]);
t = (m>0)?(hp1.x-t):(hp1.x+t);
@@ -635,3 +636,4 @@ double __ieee754_acos(double x)
return u.x/v.x;
}
}
+strong_alias (__ieee754_acos, __acos_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c
index 9e1a794..784fc5a 100644
--- a/sysdeps/ieee754/dbl-64/e_atan2.c
+++ b/sysdeps/ieee754/dbl-64/e_atan2.c
@@ -63,7 +63,7 @@ double __ieee754_atan2(double y,double x) {
#endif
static const int pr[MM]={6,8,10,20,32};
double ax,ay,u,du,u9,ua,v,vv,dv,t1,t2,t3,t4,t5,t6,t7,t8,
- z,zz,cor,s1,ss1,s2,ss2;
+ z,zz,cor,s1,ss1,s2,ss2;
#if 0
double z1,z2;
#endif
@@ -73,7 +73,7 @@ double __ieee754_atan2(double y,double x) {
#endif
static const int ep= 59768832, /* 57*16**5 */
- em=-59768832; /* -57*16**5 */
+ em=-59768832; /* -57*16**5 */
/* x=NaN or y=NaN */
num.d = x; ux = num.i[HIGH_HALF]; dx = num.i[LOW_HALF];
@@ -102,23 +102,23 @@ double __ieee754_atan2(double y,double x) {
if (ux==0x7ff00000) {
if (dx==0x00000000) {
if (uy==0x7ff00000) {
- if (dy==0x00000000) return qpi.d; }
+ if (dy==0x00000000) return qpi.d; }
else if (uy==0xfff00000) {
- if (dy==0x00000000) return mqpi.d; }
+ if (dy==0x00000000) return mqpi.d; }
else {
- if ((uy&0x80000000)==0x00000000) return ZERO;
- else return MZERO; }
+ if ((uy&0x80000000)==0x00000000) return ZERO;
+ else return MZERO; }
}
}
else if (ux==0xfff00000) {
if (dx==0x00000000) {
if (uy==0x7ff00000) {
- if (dy==0x00000000) return tqpi.d; }
+ if (dy==0x00000000) return tqpi.d; }
else if (uy==0xfff00000) {
- if (dy==0x00000000) return mtqpi.d; }
+ if (dy==0x00000000) return mtqpi.d; }
else {
- if ((uy&0x80000000)==0x00000000) return opi.d;
- else return mopi.d; }
+ if ((uy&0x80000000)==0x00000000) return opi.d;
+ else return mopi.d; }
}
}
@@ -156,108 +156,108 @@ double __ieee754_atan2(double y,double x) {
/* (i) x>0, abs(y)< abs(x): atan(ay/ax) */
if (ay<ax) {
if (u<inv16.d) {
- v=u*u; zz=du+u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
- if ((z=u+(zz-u1.d*u)) == u+(zz+u1.d*u)) return signArctan2(y,z);
+ v=u*u; zz=du+u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
+ if ((z=u+(zz-u1.d*u)) == u+(zz+u1.d*u)) return signArctan2(y,z);
- MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
- s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
- ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
- if ((z=s1+(ss1-u5.d*s1)) == s1+(ss1+u5.d*s1)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
+ s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
+ ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
+ if ((z=s1+(ss1-u5.d*s1)) == s1+(ss1+u5.d*s1)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
else {
- i=(TWO52+TWO8*u)-TWO52; i-=16;
- t3=u-cij[i][0].d;
- EADD(t3,du,v,dv)
- t1=cij[i][1].d; t2=cij[i][2].d;
- zz=v*t2+(dv*t2+v*v*(cij[i][3].d+v*(cij[i][4].d+
- v*(cij[i][5].d+v* cij[i][6].d))));
- if (i<112) {
- if (i<48) u9=u91.d; /* u < 1/4 */
- else u9=u92.d; } /* 1/4 <= u < 1/2 */
- else {
- if (i<176) u9=u93.d; /* 1/2 <= u < 3/4 */
- else u9=u94.d; } /* 3/4 <= u <= 1 */
- if ((z=t1+(zz-u9*t1)) == t1+(zz+u9*t1)) return signArctan2(y,z);
+ i=(TWO52+TWO8*u)-TWO52; i-=16;
+ t3=u-cij[i][0].d;
+ EADD(t3,du,v,dv)
+ t1=cij[i][1].d; t2=cij[i][2].d;
+ zz=v*t2+(dv*t2+v*v*(cij[i][3].d+v*(cij[i][4].d+
+ v*(cij[i][5].d+v* cij[i][6].d))));
+ if (i<112) {
+ if (i<48) u9=u91.d; /* u < 1/4 */
+ else u9=u92.d; } /* 1/4 <= u < 1/2 */
+ else {
+ if (i<176) u9=u93.d; /* 1/2 <= u < 3/4 */
+ else u9=u94.d; } /* 3/4 <= u <= 1 */
+ if ((z=t1+(zz-u9*t1)) == t1+(zz+u9*t1)) return signArctan2(y,z);
- t1=u-hij[i][0].d;
- EADD(t1,du,v,vv)
- s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
- v*(hij[i][14].d+v* hij[i][15].d))));
- ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
- if ((z=s2+(ss2-ub.d*s2)) == s2+(ss2+ub.d*s2)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ t1=u-hij[i][0].d;
+ EADD(t1,du,v,vv)
+ s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
+ v*(hij[i][14].d+v* hij[i][15].d))));
+ ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
+ if ((z=s2+(ss2-ub.d*s2)) == s2+(ss2+ub.d*s2)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
}
/* (ii) x>0, abs(x)<=abs(y): pi/2-atan(ax/ay) */
else {
if (u<inv16.d) {
- v=u*u;
- zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
- ESUB(hpi.d,u,t2,cor)
- t3=((hpi1.d+cor)-du)-zz;
- if ((z=t2+(t3-u2.d)) == t2+(t3+u2.d)) return signArctan2(y,z);
+ v=u*u;
+ zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
+ ESUB(hpi.d,u,t2,cor)
+ t3=((hpi1.d+cor)-du)-zz;
+ if ((z=t2+(t3-u2.d)) == t2+(t3+u2.d)) return signArctan2(y,z);
- MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
- s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
- ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
- SUB2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2)
- if ((z=s2+(ss2-u6.d)) == s2+(ss2+u6.d)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
+ s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
+ ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
+ SUB2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2)
+ if ((z=s2+(ss2-u6.d)) == s2+(ss2+u6.d)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
else {
- i=(TWO52+TWO8*u)-TWO52; i-=16;
- v=(u-cij[i][0].d)+du;
- zz=hpi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+
- v*(cij[i][5].d+v* cij[i][6].d))));
- t1=hpi.d-cij[i][1].d;
- if (i<112) ua=ua1.d; /* w < 1/2 */
- else ua=ua2.d; /* w >= 1/2 */
- if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z);
+ i=(TWO52+TWO8*u)-TWO52; i-=16;
+ v=(u-cij[i][0].d)+du;
+ zz=hpi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+
+ v*(cij[i][5].d+v* cij[i][6].d))));
+ t1=hpi.d-cij[i][1].d;
+ if (i<112) ua=ua1.d; /* w < 1/2 */
+ else ua=ua2.d; /* w >= 1/2 */
+ if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z);
- t1=u-hij[i][0].d;
- EADD(t1,du,v,vv)
- s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
- v*(hij[i][14].d+v* hij[i][15].d))));
- ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
- SUB2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2)
- if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ t1=u-hij[i][0].d;
+ EADD(t1,du,v,vv)
+ s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
+ v*(hij[i][14].d+v* hij[i][15].d))));
+ ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
+ SUB2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2)
+ if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
}
}
@@ -266,112 +266,114 @@ double __ieee754_atan2(double y,double x) {
/* (iii) x<0, abs(x)< abs(y): pi/2+atan(ax/ay) */
if (ax<ay) {
if (u<inv16.d) {
- v=u*u;
- zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
- EADD(hpi.d,u,t2,cor)
- t3=((hpi1.d+cor)+du)+zz;
- if ((z=t2+(t3-u3.d)) == t2+(t3+u3.d)) return signArctan2(y,z);
+ v=u*u;
+ zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
+ EADD(hpi.d,u,t2,cor)
+ t3=((hpi1.d+cor)+du)+zz;
+ if ((z=t2+(t3-u3.d)) == t2+(t3+u3.d)) return signArctan2(y,z);
- MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
- s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
- ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
- ADD2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2)
- if ((z=s2+(ss2-u7.d)) == s2+(ss2+u7.d)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
+ s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
+ ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
+ ADD2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2)
+ if ((z=s2+(ss2-u7.d)) == s2+(ss2+u7.d)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
else {
- i=(TWO52+TWO8*u)-TWO52; i-=16;
- v=(u-cij[i][0].d)+du;
- zz=hpi1.d+v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+
- v*(cij[i][5].d+v* cij[i][6].d))));
- t1=hpi.d+cij[i][1].d;
- if (i<112) ua=ua1.d; /* w < 1/2 */
- else ua=ua2.d; /* w >= 1/2 */
- if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z);
+ i=(TWO52+TWO8*u)-TWO52; i-=16;
+ v=(u-cij[i][0].d)+du;
+ zz=hpi1.d+v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+
+ v*(cij[i][5].d+v* cij[i][6].d))));
+ t1=hpi.d+cij[i][1].d;
+ if (i<112) ua=ua1.d; /* w < 1/2 */
+ else ua=ua2.d; /* w >= 1/2 */
+ if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z);
- t1=u-hij[i][0].d;
- EADD(t1,du,v,vv)
- s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
- v*(hij[i][14].d+v* hij[i][15].d))));
- ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
- ADD2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2)
- if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ t1=u-hij[i][0].d;
+ EADD(t1,du,v,vv)
+ s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
+ v*(hij[i][14].d+v* hij[i][15].d))));
+ ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
+ ADD2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2)
+ if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
}
/* (iv) x<0, abs(y)<=abs(x): pi-atan(ax/ay) */
else {
if (u<inv16.d) {
- v=u*u;
- zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
- ESUB(opi.d,u,t2,cor)
- t3=((opi1.d+cor)-du)-zz;
- if ((z=t2+(t3-u4.d)) == t2+(t3+u4.d)) return signArctan2(y,z);
+ v=u*u;
+ zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d)))));
+ ESUB(opi.d,u,t2,cor)
+ t3=((opi1.d+cor)-du)-zz;
+ if ((z=t2+(t3-u4.d)) == t2+(t3+u4.d)) return signArctan2(y,z);
- MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
- s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
- ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
- SUB2(opi.d,opi1.d,s1,ss1,s2,ss2,t1,t2)
- if ((z=s2+(ss2-u8.d)) == s2+(ss2+u8.d)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8)
+ s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d))));
+ ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(u,du,s2,ss2,s1,ss1,t1,t2)
+ SUB2(opi.d,opi1.d,s1,ss1,s2,ss2,t1,t2)
+ if ((z=s2+(ss2-u8.d)) == s2+(ss2+u8.d)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
else {
- i=(TWO52+TWO8*u)-TWO52; i-=16;
- v=(u-cij[i][0].d)+du;
- zz=opi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+
- v*(cij[i][5].d+v* cij[i][6].d))));
- t1=opi.d-cij[i][1].d;
- if (i<112) ua=ua1.d; /* w < 1/2 */
- else ua=ua2.d; /* w >= 1/2 */
- if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z);
+ i=(TWO52+TWO8*u)-TWO52; i-=16;
+ v=(u-cij[i][0].d)+du;
+ zz=opi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+
+ v*(cij[i][5].d+v* cij[i][6].d))));
+ t1=opi.d-cij[i][1].d;
+ if (i<112) ua=ua1.d; /* w < 1/2 */
+ else ua=ua2.d; /* w >= 1/2 */
+ if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z);
- t1=u-hij[i][0].d;
- EADD(t1,du,v,vv)
- s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
- v*(hij[i][14].d+v* hij[i][15].d))));
- ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
- MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
- ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
- SUB2(opi.d,opi1.d,s2,ss2,s1,ss1,t1,t2)
- if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z);
- return atan2Mp(x,y,pr);
+ t1=u-hij[i][0].d;
+ EADD(t1,du,v,vv)
+ s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+
+ v*(hij[i][14].d+v* hij[i][15].d))));
+ ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2)
+ MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8)
+ ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2)
+ SUB2(opi.d,opi1.d,s2,ss2,s1,ss1,t1,t2)
+ if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z);
+ return atan2Mp(x,y,pr);
}
}
}
}
+strong_alias (__ieee754_atan2, __atan2_finite)
+
/* Treat the Denormalized case */
static double normalized(double ax,double ay,double y, double z)
{ int p;
diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c
index fa4fe67..de3bc8f 100644
--- a/sysdeps/ieee754/dbl-64/e_atanh.c
+++ b/sysdeps/ieee754/dbl-64/e_atanh.c
@@ -1,74 +1,70 @@
-/* @(#)e_atanh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
-#endif
/* __ieee754_atanh(x)
- * Method :
- * 1.Reduced x to positive by atanh(-x) = -atanh(x)
- * 2.For x>=0.5
- * 1 2x x
- * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
- * 2 1 - x 1 - x
- *
- * For x<0.5
- * atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
- *
- * Special cases:
- * atanh(x) is NaN if |x| > 1 with signal;
- * atanh(NaN) is that NaN with no signal;
- * atanh(+-1) is +-INF with signal.
- *
+ Method :
+ 1.Reduced x to positive by atanh(-x) = -atanh(x)
+ 2.For x>=0.5
+ 1 2x x
+ atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
+ 2 1 - x 1 - x
+
+ For x<0.5
+ atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
+
+ Special cases:
+ atanh(x) is NaN if |x| > 1 with signal;
+ atanh(NaN) is that NaN with no signal;
+ atanh(+-1) is +-INF with signal.
+
*/
+#include <inttypes.h>
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
-static const double one = 1.0, huge = 1e300;
-#else
-static double one = 1.0, huge = 1e300;
-#endif
-
-#ifdef __STDC__
-static const double zero = 0.0;
-#else
-static double zero = 0.0;
-#endif
+static const double huge = 1e300;
-#ifdef __STDC__
- double __ieee754_atanh(double x)
-#else
- double __ieee754_atanh(x)
- double x;
-#endif
+double
+__ieee754_atanh (double x)
{
- double t;
- int32_t hx,ix;
- u_int32_t lx;
- EXTRACT_WORDS(hx,lx,x);
- ix = hx&0x7fffffff;
- if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */
- return (x-x)/(x-x);
- if(ix==0x3ff00000)
- return x/zero;
- if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */
- SET_HIGH_WORD(x,ix);
- if(ix<0x3fe00000) { /* x < 0.5 */
- t = x+x;
- t = 0.5*__log1p(t+t*x/(one-x));
- } else
- t = 0.5*__log1p((x+x)/(one-x));
- if(hx>=0) return t; else return -t;
+ double xa = fabs (x);
+ double t;
+ if (xa < 0.5)
+ {
+ if (__builtin_expect (xa < 0x1.0p-28, 0) && (huge + x) > 0.0)
+ return x;
+
+ t = xa + xa;
+ t = 0.5 * __log1p (t + t * xa / (1.0 - xa));
+ }
+ else if (__builtin_expect (xa < 1.0, 1))
+ t = 0.5 * __log1p ((xa + xa) / (1.0 - xa));
+ else
+ {
+ if (xa > 1.0)
+ return (x - x) / (x - x);
+
+ return x / 0.0;
+ }
+
+ return __copysign (t, x);
}
+strong_alias (__ieee754_atanh, __atanh_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_cosh.c b/sysdeps/ieee754/dbl-64/e_cosh.c
index 65106b9..180ca42 100644
--- a/sysdeps/ieee754/dbl-64/e_cosh.c
+++ b/sysdeps/ieee754/dbl-64/e_cosh.c
@@ -1,11 +1,11 @@
-/* @(#)e_cosh.c 5.1 93/09/24 */
+/* Optimized by Ulrich Drepper <drepper@gmail.com>, 2011 */
/*
* ====================================================
* 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
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -15,18 +15,18 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
#endif
/* __ieee754_cosh(x)
- * Method :
+ * Method :
* mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2
- * 1. Replace x by |x| (cosh(x) = cosh(-x)).
- * 2.
- * [ exp(x) - 1 ]^2
+ * 1. Replace x by |x| (cosh(x) = cosh(-x)).
+ * 2.
+ * [ exp(x) - 1 ]^2
* 0 <= x <= ln2/2 : cosh(x) := 1 + -------------------
- * 2*exp(x)
+ * 2*exp(x)
*
- * exp(x) + 1/exp(x)
+ * exp(x) + 1/exp(x)
* ln2/2 <= x <= 22 : cosh(x) := -------------------
- * 2
- * 22 <= x <= lnovft : cosh(x) := exp(x)/2
+ * 2
+ * 22 <= x <= lnovft : cosh(x) := exp(x)/2
* lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2)
* ln2ovft < x : cosh(x) := huge*huge (overflow)
*
@@ -38,19 +38,11 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double one = 1.0, half=0.5, huge = 1.0e300;
-#else
-static double one = 1.0, half=0.5, huge = 1.0e300;
-#endif
-#ifdef __STDC__
- double __ieee754_cosh(double x)
-#else
- double __ieee754_cosh(x)
- double x;
-#endif
-{
+double
+__ieee754_cosh (double x)
+{
double t,w;
int32_t ix;
u_int32_t lx;
@@ -59,19 +51,17 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff;
- /* x is INF or NaN */
- if(ix>=0x7ff00000) return x*x;
-
- /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
- if(ix<0x3fd62e43) {
- t = __expm1(fabs(x));
- w = one+t;
- if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */
- return one+(t*t)/(w+w);
- }
-
- /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+ /* |x| in [0,22] */
if (ix < 0x40360000) {
+ /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
+ if(ix<0x3fd62e43) {
+ t = __expm1(fabs(x));
+ w = one+t;
+ if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */
+ return one+(t*t)/(w+w);
+ }
+
+ /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
t = __ieee754_exp(fabs(x));
return half*t+half/t;
}
@@ -87,6 +77,10 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
return t*w;
}
+ /* x is INF or NaN */
+ if(ix>=0x7ff00000) return x*x;
+
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
}
+strong_alias (__ieee754_cosh, __cosh_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index ce6368b..674cdb0 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -1,5 +1,6 @@
/* Double-precision floating point 2^x.
- Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2001,2005,2006,2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@@ -133,3 +134,4 @@ __ieee754_exp2 (double x)
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
return TWO1023*x;
}
+strong_alias (__ieee754_exp2, __exp2_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c
index 2ce6135..a575f61 100644
--- a/sysdeps/ieee754/dbl-64/e_fmod.c
+++ b/sysdeps/ieee754/dbl-64/e_fmod.c
@@ -5,16 +5,12 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_fmod.c,v 1.8 1995/05/10 20:45:07 jtc Exp $";
-#endif
-
-/*
+/*
* __ieee754_fmod(x,y)
* Return x mod y in exact arithmetic
* Method: shift and subtract
@@ -23,18 +19,10 @@ static char rcsid[] = "$NetBSD: e_fmod.c,v 1.8 1995/05/10 20:45:07 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double one = 1.0, Zero[] = {0.0, -0.0,};
-#else
-static double one = 1.0, Zero[] = {0.0, -0.0,};
-#endif
-#ifdef __STDC__
- double __ieee754_fmod(double x, double y)
-#else
- double __ieee754_fmod(x,y)
- double x,y ;
-#endif
+double
+__ieee754_fmod (double x, double y)
{
int32_t n,hx,hy,hz,ix,iy,sx,i;
u_int32_t lx,ly,lz;
@@ -51,7 +39,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
return (x*y)/(x*y);
if(hx<=hy) {
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
- if(lx==ly)
+ if(lx==ly)
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
}
@@ -74,25 +62,25 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
} else iy = (hy>>20)-1023;
/* set up {hx,lx}, {hy,ly} and align y to x */
- if(ix >= -1022)
+ if(ix >= -1022)
hx = 0x00100000|(0x000fffff&hx);
else { /* subnormal x, shift x to normal */
n = -1022-ix;
if(n<=31) {
- hx = (hx<<n)|(lx>>(32-n));
- lx <<= n;
+ hx = (hx<<n)|(lx>>(32-n));
+ lx <<= n;
} else {
hx = lx<<(n-32);
lx = 0;
}
}
- if(iy >= -1022)
+ if(iy >= -1022)
hy = 0x00100000|(0x000fffff&hy);
else { /* subnormal y, shift y to normal */
n = -1022-iy;
if(n<=31) {
- hy = (hy<<n)|(ly>>(32-n));
- ly <<= n;
+ hy = (hy<<n)|(ly>>(32-n));
+ ly <<= n;
} else {
hy = ly<<(n-32);
ly = 0;
@@ -105,17 +93,17 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
else {
- if((hz|lz)==0) /* return sign(x)*0 */
+ if((hz|lz)==0) /* return sign(x)*0 */
return Zero[(u_int32_t)sx>>31];
- hx = hz+hz+(lz>>31); lx = lz+lz;
+ hx = hz+hz+(lz>>31); lx = lz+lz;
}
}
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz>=0) {hx=hz;lx=lz;}
/* convert back to floating value and restore the sign */
- if((hx|lx)==0) /* return sign(x)*0 */
- return Zero[(u_int32_t)sx>>31];
+ if((hx|lx)==0) /* return sign(x)*0 */
+ return Zero[(u_int32_t)sx>>31];
while(hx<0x00100000) { /* normalize x */
hx = hx+hx+(lx>>31); lx = lx+lx;
iy -= 1;
@@ -138,3 +126,4 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
}
return x; /* exact output */
}
+strong_alias (__ieee754_fmod, __fmod_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c
index f323093..c4b7470 100644
--- a/sysdeps/ieee754/dbl-64/e_gamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2001, 2004, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -33,19 +33,20 @@ __ieee754_gamma_r (double x, int *signgamp)
EXTRACT_WORDS (hx, lx, x);
- if (((hx & 0x7fffffff) | lx) == 0)
+ if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
return 1.0 / x;
}
- if (hx < 0 && (u_int32_t) hx < 0xfff00000 && __rint (x) == x)
+ if (__builtin_expect (hx < 0, 0)
+ && (u_int32_t) hx < 0xfff00000 && __rint (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
return (x - x) / (x - x);
}
- if ((unsigned int) hx == 0xfff00000 && lx==0)
+ if (__builtin_expect ((unsigned int) hx == 0xfff00000 && lx==0, 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
@@ -55,3 +56,4 @@ __ieee754_gamma_r (double x, int *signgamp)
/* XXX FIXME. */
return __ieee754_exp (__ieee754_lgamma_r (x, signgamp));
}
+strong_alias (__ieee754_gamma_r, __gamma_r_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c
index 76a77ec..a89ccaa 100644
--- a/sysdeps/ieee754/dbl-64/e_hypot.c
+++ b/sysdeps/ieee754/dbl-64/e_hypot.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
-#endif
-
/* __ieee754_hypot(x,y)
*
* Method :
@@ -42,19 +38,15 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
* hypot(x,y) is NAN if x or y is NAN.
*
* Accuracy:
- * hypot(x,y) returns sqrt(x^2+y^2) with error less
- * than 1 ulps (units in the last place)
+ * hypot(x,y) returns sqrt(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
- double __ieee754_hypot(double x, double y)
-#else
- double __ieee754_hypot(x,y)
- double x, y;
-#endif
+double
+__ieee754_hypot(double x, double y)
{
double a,b,t1,t2,y1,y2,w;
int32_t j,k,ha,hb;
@@ -68,7 +60,7 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
SET_HIGH_WORD(b,hb); /* b <- |b| */
if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */
k=0;
- if(ha > 0x5f300000) { /* a>2**500 */
+ if(__builtin_expect(ha > 0x5f300000, 0)) { /* a>2**500 */
if(ha >= 0x7ff00000) { /* Inf or NaN */
u_int32_t low;
w = a+b; /* for sNaN */
@@ -83,9 +75,9 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
SET_HIGH_WORD(a,ha);
SET_HIGH_WORD(b,hb);
}
- if(hb < 0x20b00000) { /* b < 2**-500 */
+ if(__builtin_expect(hb < 0x20b00000, 0)) { /* b < 2**-500 */
if(hb <= 0x000fffff) { /* subnormal b or 0 */
- u_int32_t low;
+ u_int32_t low;
GET_LOW_WORD(low,b);
if((hb|low)==0) return a;
t1=0;
@@ -94,7 +86,7 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
a *= t1;
k -= 1022;
} else { /* scale a and b by 2^600 */
- ha += 0x25800000; /* a *= 2^600 */
+ ha += 0x25800000; /* a *= 2^600 */
hb += 0x25800000; /* b *= 2^600 */
k -= 600;
SET_HIGH_WORD(a,ha);
@@ -126,3 +118,4 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
return t1*w;
} else return w;
}
+strong_alias (__ieee754_hypot, __hypot_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_j0.c b/sysdeps/ieee754/dbl-64/e_j0.c
index 302df49..5ebf205 100644
--- a/sysdeps/ieee754/dbl-64/e_j0.c
+++ b/sysdeps/ieee754/dbl-64/e_j0.c
@@ -13,10 +13,6 @@
for performance improvement on pipelined processors.
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $";
-#endif
-
/* __ieee754_j0(x), __ieee754_y0(x)
* Bessel function of the first and second kinds of order zero.
* Method -- j0(x):
@@ -26,16 +22,16 @@ static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $";
* j0(x) = 1-z/4+ z^2*R0/S0, where z = x*x;
* (precision: |j0-1+z/4-z^2R0/S0 |<2**-63.67 )
* for x in (2,inf)
- * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
- * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
+ * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
+ * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
* as follow:
* cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
* = 1/sqrt(2) * (cos(x) + sin(x))
* sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4)
* = 1/sqrt(2) * (sin(x) - cos(x))
- * (To avoid cancellation, use
+ * (To avoid cancellation, use
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.)
+ * to compute the worse one.)
*
* 3 Special cases
* j0(nan)= nan
@@ -56,8 +52,8 @@ static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $";
* Note: For tiny x, U/V = u0 and j0(x)~1, hence
* y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27)
* 2. For x>=2.
- * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))
- * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
+ * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))
+ * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
* by the method mentioned above.
* 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0.
*/
@@ -65,22 +61,14 @@ static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static double pzero(double), qzero(double);
-#else
-static double pzero(), qzero();
-#endif
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
-huge = 1e300,
+huge = 1e300,
one = 1.0,
invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
- /* R0/S0 on [0, 2.00] */
+ /* R0/S0 on [0, 2.00] */
R[] = {0.0, 0.0, 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */
-1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */
1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */
@@ -90,18 +78,10 @@ S[] = {0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */
5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */
1.16614003333790000205e-09}; /* 0x3E1408BC, 0xF4745D8F */
-#ifdef __STDC__
static const double zero = 0.0;
-#else
-static double zero = 0.0;
-#endif
-#ifdef __STDC__
- double __ieee754_j0(double x)
-#else
- double __ieee754_j0(x)
- double x;
-#endif
+double
+__ieee754_j0(double x)
{
double z, s,c,ss,cc,r,u,v,r1,r2,s1,s2,z2,z4;
int32_t hx,ix;
@@ -117,7 +97,7 @@ static double zero = 0.0;
if(ix<0x7fe00000) { /* make sure x+x not overflow */
z = -__cos(x+x);
if ((s*c)<zero) cc = z/ss;
- else ss = z/cc;
+ else ss = z/cc;
}
/*
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
@@ -132,8 +112,8 @@ static double zero = 0.0;
}
if(ix<0x3f200000) { /* |x| < 2**-13 */
if(huge+x>one) { /* raise inexact if x != 0 */
- if(ix<0x3e400000) return one; /* |x|<2**-27 */
- else return one - 0.25*x*x;
+ if(ix<0x3e400000) return one; /* |x|<2**-27 */
+ else return one - 0.25*x*x;
}
}
z = x*x;
@@ -155,12 +135,9 @@ static double zero = 0.0;
return((one+u)*(one-u)+z*(r/s));
}
}
+strong_alias (__ieee754_j0, __j0_finite)
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
U[] = {-7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */
1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */
-1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */
@@ -173,52 +150,48 @@ V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
4.41110311332675467403e-10}; /* 0x3DFE5018, 0x3BD6D9EF */
-#ifdef __STDC__
- double __ieee754_y0(double x)
-#else
- double __ieee754_y0(x)
- double x;
-#endif
+double
+__ieee754_y0(double x)
{
double z, s,c,ss,cc,u,v,z2,z4,z6,u1,u2,u3,v1,v2;
int32_t hx,ix,lx;
EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
+ ix = 0x7fffffff&hx;
/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */
if(ix>=0x7ff00000) return one/(x+x*x);
- if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */
- if(hx<0) return zero/(zero*x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
- /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
- * where x0 = x-pi/4
- * Better formula:
- * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
- * = 1/sqrt(2) * (sin(x) + cos(x))
- * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- * = 1/sqrt(2) * (sin(x) - cos(x))
- * To avoid cancellation, use
- * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.
- */
+ if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */
+ if(hx<0) return zero/(zero*x);
+ if(ix >= 0x40000000) { /* |x| >= 2.0 */
+ /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
+ * where x0 = x-pi/4
+ * Better formula:
+ * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
+ * = 1/sqrt(2) * (sin(x) + cos(x))
+ * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ * = 1/sqrt(2) * (sin(x) - cos(x))
+ * To avoid cancellation, use
+ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * to compute the worse one.
+ */
__sincos (x, &s, &c);
- ss = s-c;
- cc = s+c;
+ ss = s-c;
+ cc = s+c;
/*
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
- if(ix<0x7fe00000) { /* make sure x+x not overflow */
- z = -__cos(x+x);
- if ((s*c)<zero) cc = z/ss;
- else ss = z/cc;
- }
- if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
- else {
- u = pzero(x); v = qzero(x);
- z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x);
- }
- return z;
+ if(ix<0x7fe00000) { /* make sure x+x not overflow */
+ z = -__cos(x+x);
+ if ((s*c)<zero) cc = z/ss;
+ else ss = z/cc;
+ }
+ if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
+ else {
+ u = pzero(x); v = qzero(x);
+ z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x);
+ }
+ return z;
}
if(ix<=0x3e400000) { /* x < 2**-27 */
return(U[0] + tpi*__ieee754_log(x));
@@ -238,21 +211,18 @@ V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
#endif
return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x)));
}
+strong_alias (__ieee754_y0, __y0_finite)
/* 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
- * pzero(x) = 1 + (R/S)
+ * pzero(x) = 1 + (R/S)
* where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10
- * S = 1 + pS0*s^2 + ... + pS4*s^10
+ * S = 1 + pS0*s^2 + ... + pS4*s^10
* and
* | pzero(x)-1-R/S | <= 2 ** ( -60.26)
*/
-#ifdef __STDC__
static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
-7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */
-8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */
@@ -260,11 +230,7 @@ static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */
-5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */
};
-#ifdef __STDC__
static const double pS8[5] = {
-#else
-static double pS8[5] = {
-#endif
1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */
3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */
4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */
@@ -272,11 +238,7 @@ static double pS8[5] = {
4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */
};
-#ifdef __STDC__
static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
-1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */
-7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */
-4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */
@@ -284,11 +246,7 @@ static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */
-3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */
};
-#ifdef __STDC__
static const double pS5[5] = {
-#else
-static double pS5[5] = {
-#endif
6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */
1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */
5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */
@@ -296,11 +254,7 @@ static double pS5[5] = {
2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */
};
-#ifdef __STDC__
static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#else
-static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
-2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */
-7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */
-2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */
@@ -308,11 +262,7 @@ static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */
-3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */
};
-#ifdef __STDC__
static const double pS3[5] = {
-#else
-static double pS3[5] = {
-#endif
3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */
3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */
1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */
@@ -320,11 +270,7 @@ static double pS3[5] = {
1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */
};
-#ifdef __STDC__
static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
-8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */
-7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */
-1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */
@@ -332,11 +278,7 @@ static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */
-3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */
};
-#ifdef __STDC__
static const double pS2[5] = {
-#else
-static double pS2[5] = {
-#endif
2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */
1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */
2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */
@@ -344,18 +286,10 @@ static double pS2[5] = {
1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */
};
-#ifdef __STDC__
- static double pzero(double x)
-#else
- static double pzero(x)
- double x;
-#endif
+static double
+pzero(double x)
{
-#ifdef __STDC__
const double *p,*q;
-#else
- double *p,*q;
-#endif
double z,r,s,z2,z4,r1,r2,r3,s1,s2,s3;
int32_t ix;
GET_HIGH_WORD(ix,x);
@@ -385,17 +319,13 @@ static double pS2[5] = {
/* For x >= 8, the asymptotic expansions of qzero is
* -1/8 s + 75/1024 s^3 - ..., where s = 1/x.
* We approximate pzero by
- * qzero(x) = s*(-1.25 + (R/S))
+ * qzero(x) = s*(-1.25 + (R/S))
* where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10
- * S = 1 + qS0*s^2 + ... + qS5*s^12
+ * S = 1 + qS0*s^2 + ... + qS5*s^12
* and
* | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22)
*/
-#ifdef __STDC__
static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */
1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */
@@ -403,11 +333,7 @@ static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */
3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */
};
-#ifdef __STDC__
static const double qS8[6] = {
-#else
-static double qS8[6] = {
-#endif
1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */
8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */
1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */
@@ -416,11 +342,7 @@ static double qS8[6] = {
-3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */
};
-#ifdef __STDC__
static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */
7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */
5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */
@@ -428,11 +350,7 @@ static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */
1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */
};
-#ifdef __STDC__
static const double qS5[6] = {
-#else
-static double qS5[6] = {
-#endif
8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */
2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */
1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */
@@ -441,11 +359,7 @@ static double qS5[6] = {
-5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */
};
-#ifdef __STDC__
static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#else
-static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */
7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */
3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */
@@ -453,11 +367,7 @@ static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */
1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */
};
-#ifdef __STDC__
static const double qS3[6] = {
-#else
-static double qS3[6] = {
-#endif
4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */
7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */
3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */
@@ -466,11 +376,7 @@ static double qS3[6] = {
-1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */
};
-#ifdef __STDC__
static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */
7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */
1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */
@@ -478,11 +384,7 @@ static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */
1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */
};
-#ifdef __STDC__
static const double qS2[6] = {
-#else
-static double qS2[6] = {
-#endif
3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */
2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */
8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */
@@ -491,18 +393,10 @@ static double qS2[6] = {
-5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */
};
-#ifdef __STDC__
- static double qzero(double x)
-#else
- static double qzero(x)
- double x;
-#endif
+static double
+qzero(double x)
{
-#ifdef __STDC__
const double *p,*q;
-#else
- double *p,*q;
-#endif
double s,r,z,z2,z4,z6,r1,r2,r3,s1,s2,s3;
int32_t ix;
GET_HIGH_WORD(ix,x);
diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c
index 8a3b2ff..fdc6b5b 100644
--- a/sysdeps/ieee754/dbl-64/e_j1.c
+++ b/sysdeps/ieee754/dbl-64/e_j1.c
@@ -13,10 +13,6 @@
for performance improvement on pipelined processors.
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $";
-#endif
-
/* __ieee754_j1(x), __ieee754_y1(x)
* Bessel function of the first and second kinds of order zero.
* Method -- j1(x):
@@ -26,17 +22,17 @@ static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $";
* j1(x) = x/2 + x*z*R0/S0, where z = x*x;
* (precision: |j1/x - 1/2 - R0/S0 |<2**-61.51 )
* for x in (2,inf)
- * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
- * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
+ * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
* as follow:
* cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
* = 1/sqrt(2) * (sin(x) - cos(x))
* sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
* = -1/sqrt(2) * (sin(x) + cos(x))
- * (To avoid cancellation, use
+ * (To avoid cancellation, use
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.)
+ * to compute the worse one.)
*
* 3 Special cases
* j1(nan)= nan
@@ -57,25 +53,17 @@ static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $";
* Note: For tiny x, 1/x dominate y1 and hence
* y1(tiny) = -2/pi/tiny, (choose tiny<2**-54)
* 3. For x>=2.
- * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
* by method mentioned above.
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static double pone(double), qone(double);
-#else
-static double pone(), qone();
-#endif
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
huge = 1e300,
one = 1.0,
invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
@@ -91,25 +79,17 @@ S[] = {0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */
5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */
1.23542274426137913908e-11}; /* 0x3DAB2ACF, 0xCFB97ED8 */
-#ifdef __STDC__
static const double zero = 0.0;
-#else
-static double zero = 0.0;
-#endif
-#ifdef __STDC__
- double __ieee754_j1(double x)
-#else
- double __ieee754_j1(x)
- double x;
-#endif
+double
+__ieee754_j1(double x)
{
double z, s,c,ss,cc,r,u,v,y,r1,r2,s1,s2,s3,z2,z4;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) return one/x;
+ if(__builtin_expect(ix>=0x7ff00000, 0)) return one/x;
y = fabs(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
__sincos (y, &s, &c);
@@ -118,7 +98,7 @@ static double zero = 0.0;
if(ix<0x7fe00000) { /* make sure y+y not overflow */
z = __cos(y+y);
if ((s*c)>zero) cc = z/ss;
- else ss = z/cc;
+ else ss = z/cc;
}
/*
* j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
@@ -130,9 +110,9 @@ static double zero = 0.0;
z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrt(y);
}
if(hx<0) return -z;
- else return z;
+ else return z;
}
- if(ix<0x3e400000) { /* |x|<2**-27 */
+ if(__builtin_expect(ix<0x3e400000, 0)) { /* |x|<2**-27 */
if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
}
z = x*x;
@@ -144,7 +124,7 @@ static double zero = 0.0;
r1 = z*R[0]; z2=z*z;
r2 = R[1]+z*R[2]; z4=z2*z2;
r = r1 + z2*r2 + z4*R[3];
- r *= x;
+ r *= x;
s1 = one+z*S[1];
s2 = S[2]+z*S[3];
s3 = S[4]+z*S[5];
@@ -152,23 +132,16 @@ static double zero = 0.0;
#endif
return(x*0.5+r/s);
}
+strong_alias (__ieee754_j1, __j1_finite)
-#ifdef __STDC__
static const double U0[5] = {
-#else
-static double U0[5] = {
-#endif
-1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */
5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */
-1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */
2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */
-9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */
};
-#ifdef __STDC__
static const double V0[5] = {
-#else
-static double V0[5] = {
-#endif
1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */
2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */
1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */
@@ -176,56 +149,53 @@ static double V0[5] = {
1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */
};
-#ifdef __STDC__
- double __ieee754_y1(double x)
-#else
- double __ieee754_y1(x)
- double x;
-#endif
+double
+__ieee754_y1(double x)
{
double z, s,c,ss,cc,u,v,u1,u2,v1,v2,v3,z2,z4;
int32_t hx,ix,lx;
EXTRACT_WORDS(hx,lx,x);
- ix = 0x7fffffff&hx;
+ ix = 0x7fffffff&hx;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if(ix>=0x7ff00000) return one/(x+x*x);
- if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */;
- if(hx<0) return zero/(zero*x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
+ if(__builtin_expect(ix>=0x7ff00000, 0)) return one/(x+x*x);
+ if(__builtin_expect((ix|lx)==0, 0))
+ return -HUGE_VAL+x; /* -inf and overflow exception. */;
+ if(__builtin_expect(hx<0, 0)) return zero/(zero*x);
+ if(ix >= 0x40000000) { /* |x| >= 2.0 */
__sincos (x, &s, &c);
- ss = -s-c;
- cc = s-c;
- if(ix<0x7fe00000) { /* make sure x+x not overflow */
- z = __cos(x+x);
- if ((s*c)>zero) cc = z/ss;
- else ss = z/cc;
- }
- /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
- * where x0 = x-3pi/4
- * Better formula:
- * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
- * = 1/sqrt(2) * (sin(x) - cos(x))
- * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- * = -1/sqrt(2) * (cos(x) + sin(x))
- * To avoid cancellation, use
- * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.
- */
- if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
- else {
- u = pone(x); v = qone(x);
- z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x);
- }
- return z;
- }
- if(ix<=0x3c900000) { /* x < 2**-54 */
- return(-tpi/x);
- }
- z = x*x;
+ ss = -s-c;
+ cc = s-c;
+ if(ix<0x7fe00000) { /* make sure x+x not overflow */
+ z = __cos(x+x);
+ if ((s*c)>zero) cc = z/ss;
+ else ss = z/cc;
+ }
+ /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
+ * where x0 = x-3pi/4
+ * Better formula:
+ * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
+ * = 1/sqrt(2) * (sin(x) - cos(x))
+ * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ * = -1/sqrt(2) * (cos(x) + sin(x))
+ * To avoid cancellation, use
+ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * to compute the worse one.
+ */
+ if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
+ else {
+ u = pone(x); v = qone(x);
+ z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x);
+ }
+ return z;
+ }
+ if(__builtin_expect(ix<=0x3c900000, 0)) { /* x < 2**-54 */
+ return(-tpi/x);
+ }
+ z = x*x;
#ifdef DO_NOT_USE_THIS
- u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
- v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
+ u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
+ v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
#else
u1 = U0[0]+z*U0[1];z2=z*z;
u2 = U0[2]+z*U0[3];z4=z2*z2;
@@ -235,24 +205,21 @@ static double V0[5] = {
v3 = V0[3]+z*V0[4];
v = v1 + z2*v2 + z4*v3;
#endif
- return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
+ return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
}
+strong_alias (__ieee754_y1, __y1_finite)
/* 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
- * pone(x) = 1 + (R/S)
+ * pone(x) = 1 + (R/S)
* where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10
- * S = 1 + ps0*s^2 + ... + ps4*s^10
+ * S = 1 + ps0*s^2 + ... + ps4*s^10
* and
* | pone(x)-1-R/S | <= 2 ** ( -60.06)
*/
-#ifdef __STDC__
static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */
1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */
@@ -260,11 +227,7 @@ static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */
7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */
};
-#ifdef __STDC__
static const double ps8[5] = {
-#else
-static double ps8[5] = {
-#endif
1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */
3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */
3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */
@@ -272,11 +235,7 @@ static double ps8[5] = {
3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */
};
-#ifdef __STDC__
static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */
1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */
6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */
@@ -284,11 +243,7 @@ static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */
5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */
};
-#ifdef __STDC__
static const double ps5[5] = {
-#else
-static double ps5[5] = {
-#endif
5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */
9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */
5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */
@@ -296,11 +251,7 @@ static double ps5[5] = {
1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */
};
-#ifdef __STDC__
static const double pr3[6] = {
-#else
-static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */
1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */
3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */
@@ -308,11 +259,7 @@ static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */
4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */
};
-#ifdef __STDC__
static const double ps3[5] = {
-#else
-static double ps3[5] = {
-#endif
3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */
3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */
1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */
@@ -320,11 +267,7 @@ static double ps3[5] = {
1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */
};
-#ifdef __STDC__
static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */
1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */
2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */
@@ -332,11 +275,7 @@ static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */
5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */
};
-#ifdef __STDC__
static const double ps2[5] = {
-#else
-static double ps2[5] = {
-#endif
2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */
1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */
2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */
@@ -344,30 +283,22 @@ static double ps2[5] = {
8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */
};
-#ifdef __STDC__
- static double pone(double x)
-#else
- static double pone(x)
- double x;
-#endif
+static double
+pone(double x)
{
-#ifdef __STDC__
const double *p,*q;
-#else
- double *p,*q;
-#endif
double z,r,s,r1,r2,r3,s1,s2,s3,z2,z4;
- int32_t ix;
+ int32_t ix;
GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff;
- if(ix>=0x40200000) {p = pr8; q= ps8;}
- else if(ix>=0x40122E8B){p = pr5; q= ps5;}
- else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
- else if(ix>=0x40000000){p = pr2; q= ps2;}
- z = one/(x*x);
+ if(ix>=0x40200000) {p = pr8; q= ps8;}
+ else if(ix>=0x40122E8B){p = pr5; q= ps5;}
+ else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
+ else if(ix>=0x40000000){p = pr2; q= ps2;}
+ z = one/(x*x);
#ifdef DO_NOT_USE_THIS
- r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
- s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
+ r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
+ s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
#else
r1 = p[0]+z*p[1]; z2=z*z;
r2 = p[2]+z*p[3]; z4=z2*z2;
@@ -378,25 +309,21 @@ static double ps2[5] = {
s3 = q[3]+z*q[4];
s = s1 + z2*s2 + z4*s3;
#endif
- return one+ r/s;
+ return one+ r/s;
}
/* For x >= 8, the asymptotic expansions of qone is
* 3/8 s - 105/1024 s^3 - ..., where s = 1/x.
* We approximate pone by
- * qone(x) = s*(0.375 + (R/S))
+ * qone(x) = s*(0.375 + (R/S))
* where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10
- * S = 1 + qs1*s^2 + ... + qs6*s^12
+ * S = 1 + qs1*s^2 + ... + qs6*s^12
* and
* | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13)
*/
-#ifdef __STDC__
static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
-1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */
-1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */
@@ -404,11 +331,7 @@ static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */
-4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */
};
-#ifdef __STDC__
static const double qs8[6] = {
-#else
-static double qs8[6] = {
-#endif
1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */
7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */
1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */
@@ -417,11 +340,7 @@ static double qs8[6] = {
-2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */
};
-#ifdef __STDC__
static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
-2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */
-1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */
-8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */
@@ -429,11 +348,7 @@ static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */
-2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */
};
-#ifdef __STDC__
static const double qs5[6] = {
-#else
-static double qs5[6] = {
-#endif
8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */
1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */
1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */
@@ -442,11 +357,7 @@ static double qs5[6] = {
-4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */
};
-#ifdef __STDC__
static const double qr3[6] = {
-#else
-static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
-5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */
-1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */
-4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */
@@ -454,11 +365,7 @@ static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */
-2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */
};
-#ifdef __STDC__
static const double qs3[6] = {
-#else
-static double qs3[6] = {
-#endif
4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */
6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */
3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */
@@ -467,11 +374,7 @@ static double qs3[6] = {
-1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */
};
-#ifdef __STDC__
static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
-1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */
-1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */
-2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */
@@ -479,11 +382,7 @@ static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */
-2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */
};
-#ifdef __STDC__
static const double qs2[6] = {
-#else
-static double qs2[6] = {
-#endif
2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */
2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */
7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */
@@ -492,18 +391,10 @@ static double qs2[6] = {
-4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */
};
-#ifdef __STDC__
- static double qone(double x)
-#else
- static double qone(x)
- double x;
-#endif
+static double
+qone(double x)
{
-#ifdef __STDC__
const double *p,*q;
-#else
- double *p,*q;
-#endif
double s,r,z,r1,r2,r3,s1,s2,s3,z2,z4,z6;
int32_t ix;
GET_HIGH_WORD(ix,x);
diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
index d9d6f91..f8b8e2e 100644
--- a/sysdeps/ieee754/dbl-64/e_jn.c
+++ b/sysdeps/ieee754/dbl-64/e_jn.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_jn.c,v 1.9 1995/05/10 20:45:34 jtc Exp $";
-#endif
-
/*
* __ieee754_jn(n, x), __ieee754_yn(n, x)
* floating point Bessel's function of the 1st and 2nd kind
@@ -43,27 +39,15 @@ static char rcsid[] = "$NetBSD: e_jn.c,v 1.9 1995/05/10 20:45:34 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
-#ifdef __STDC__
static const double zero = 0.00000000000000000000e+00;
-#else
-static double zero = 0.00000000000000000000e+00;
-#endif
-#ifdef __STDC__
- double __ieee754_jn(int n, double x)
-#else
- double __ieee754_jn(n,x)
- int n; double x;
-#endif
+double
+__ieee754_jn(int n, double x)
{
int32_t i,hx,ix,lx, sgn;
double a, b, temp, di;
@@ -75,7 +59,8 @@ static double zero = 0.00000000000000000000e+00;
EXTRACT_WORDS(hx,lx,x);
ix = 0x7fffffff&hx;
/* if J(n,NaN) is NaN */
- if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
+ if(__builtin_expect((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000, 0))
+ return x+x;
if(n<0){
n = -n;
x = -x;
@@ -85,8 +70,9 @@ static double zero = 0.00000000000000000000e+00;
if(n==1) return(__ieee754_j1(x));
sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
x = fabs(x);
- if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */
- b = zero;
+ if(__builtin_expect((ix|lx)==0||ix>=0x7ff00000,0))
+ /* if x is 0 or inf */
+ b = zero;
else if((double)n<=x) {
/* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
if(ix>=0x52D00000) { /* x > 2**302 */
@@ -99,7 +85,7 @@ static double zero = 0.00000000000000000000e+00;
* n sin(xn)*sqt2 cos(xn)*sqt2
* ----------------------------------
* 0 s-c c+s
- * 1 -s-c -c+s
+ * 1 -s-c -c+s
* 2 -s+c -c-s
* 3 s+c c-s
*/
@@ -114,13 +100,13 @@ static double zero = 0.00000000000000000000e+00;
}
b = invsqrtpi*temp/__ieee754_sqrt(x);
} else {
- a = __ieee754_j0(x);
- b = __ieee754_j1(x);
- for(i=1;i<n;i++){
+ a = __ieee754_j0(x);
+ b = __ieee754_j1(x);
+ for(i=1;i<n;i++){
temp = b;
b = b*((double)(i+i)/x) - a; /* avoid underflow */
a = temp;
- }
+ }
}
} else {
if(ix<0x3e100000) { /* x < 2**-29 */
@@ -139,11 +125,11 @@ static double zero = 0.00000000000000000000e+00;
}
} else {
/* use backward recurrence */
- /* x x^2 x^2
+ /* x x^2 x^2
* J(n,x)/J(n-1,x) = ---- ------ ------ .....
* 2n - 2(n+1) - 2(n+2)
*
- * 1 1 1
+ * 1 1 1
* (for large x) = ---- ------ ------ .....
* 2n 2(n+1) 2(n+2)
* -- - ------ - ------ -
@@ -156,7 +142,7 @@ static double zero = 0.00000000000000000000e+00;
* 1
* w - -----------------
* 1
- * w+h - ---------
+ * w+h - ---------
* w+2h - ...
*
* To determine how many terms needed, let
@@ -193,19 +179,19 @@ static double zero = 0.00000000000000000000e+00;
v = two/x;
tmp = tmp*__ieee754_log(fabs(v*tmp));
if(tmp<7.09782712893383973096e+02) {
- for(i=n-1,di=(double)(i+i);i>0;i--){
- temp = b;
+ for(i=n-1,di=(double)(i+i);i>0;i--){
+ temp = b;
b *= di;
b = b/x - a;
- a = temp;
+ a = temp;
di -= two;
- }
+ }
} else {
- for(i=n-1,di=(double)(i+i);i>0;i--){
- temp = b;
+ for(i=n-1,di=(double)(i+i);i>0;i--){
+ temp = b;
b *= di;
b = b/x - a;
- a = temp;
+ a = temp;
di -= two;
/* scale b to avoid spurious overflow */
if(b>1e100) {
@@ -213,7 +199,7 @@ static double zero = 0.00000000000000000000e+00;
t /= b;
b = one;
}
- }
+ }
}
/* j0() and j1() suffer enormous loss of precision at and
* near zero; however, we know that their zero points never
@@ -229,13 +215,10 @@ static double zero = 0.00000000000000000000e+00;
}
if(sgn==1) return -b; else return b;
}
+strong_alias (__ieee754_jn, __jn_finite)
-#ifdef __STDC__
- double __ieee754_yn(int n, double x)
-#else
- double __ieee754_yn(n,x)
- int n; double x;
-#endif
+double
+__ieee754_yn(int n, double x)
{
int32_t i,hx,ix,lx;
int32_t sign;
@@ -244,9 +227,11 @@ static double zero = 0.00000000000000000000e+00;
EXTRACT_WORDS(hx,lx,x);
ix = 0x7fffffff&hx;
/* if Y(n,NaN) is NaN */
- if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
- if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */;
- if(hx<0) return zero/(zero*x);
+ if(__builtin_expect((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000,0))
+ return x+x;
+ if(__builtin_expect((ix|lx)==0, 0))
+ return -HUGE_VAL+x; /* -inf and overflow exception. */;
+ if(__builtin_expect(hx<0, 0)) return zero/(zero*x);
sign = 1;
if(n<0){
n = -n;
@@ -254,7 +239,7 @@ static double zero = 0.00000000000000000000e+00;
}
if(n==0) return(__ieee754_y0(x));
if(n==1) return(sign*__ieee754_y1(x));
- if(ix==0x7ff00000) return zero;
+ if(__builtin_expect(ix==0x7ff00000, 0)) return zero;
if(ix>=0x52D00000) { /* x > 2**302 */
/* (x >> n**2)
* Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
@@ -265,7 +250,7 @@ static double zero = 0.00000000000000000000e+00;
* n sin(xn)*sqt2 cos(xn)*sqt2
* ----------------------------------
* 0 s-c c+s
- * 1 -s-c -c+s
+ * 1 -s-c -c+s
* 2 -s+c -c-s
* 3 s+c c-s
*/
@@ -294,3 +279,4 @@ static double zero = 0.00000000000000000000e+00;
}
if(sign>0) return b; else return -b;
}
+strong_alias (__ieee754_yn, __yn_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index a298a5a..e26ce8a 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -10,19 +10,15 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_lgamma_r.c,v 1.7 1995/05/10 20:45:42 jtc Exp $";
-#endif
-
/* __ieee754_lgamma_r(x, signgamp)
* Reentrant version of the logarithm of the Gamma function
* with user provide pointer for the sign of Gamma(x).
*
* Method:
* 1. Argument Reduction for 0 < x <= 8
- * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
- * reduce x to a number in [1.5,2.5] by
- * lgamma(1+s) = log(s) + lgamma(s)
+ * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
+ * reduce x to a number in [1.5,2.5] by
+ * lgamma(1+s) = log(s) + lgamma(s)
* for example,
* lgamma(7.3) = log(6.3) + lgamma(6.3)
* = log(6.3*5.3) + lgamma(5.3)
@@ -56,15 +52,15 @@ static char rcsid[] = "$NetBSD: e_lgamma_r.c,v 1.7 1995/05/10 20:45:42 jtc Exp $
* Let z = 1/x, then we approximation
* f(z) = lgamma(x) - (x-0.5)(log(x)-1)
* by
- * 3 5 11
+ * 3 5 11
* w = w0 + w1*z + w2*z + w3*z + ... + w6*z
* where
* |w - f(z)| < 2**-58.74
*
* 4. For negative x, since (G is gamma function)
* -x*G(-x)*G(x) = pi/sin(pi*x),
- * we have
- * G(x) = pi/(sin(pi*x)*(-x)*G(-x))
+ * we have
+ * G(x) = pi/(sin(pi*x)*(-x)*G(-x))
* since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0
* Hence, for x<0, signgam = sign(sin(pi*x)) and
* lgamma(x) = log(|Gamma(x)|)
@@ -77,18 +73,14 @@ static char rcsid[] = "$NetBSD: e_lgamma_r.c,v 1.7 1995/05/10 20:45:42 jtc Exp $
* lgamma(1)=lgamma(2)=0
* lgamma(x) ~ -log(x) for tiny x
* lgamma(0) = lgamma(inf) = inf
- * lgamma(-integer) = +-inf
+ * lgamma(-integer) = +-inf
*
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
@@ -156,18 +148,10 @@ w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */
w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */
w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */
-#ifdef __STDC__
static const double zero= 0.00000000000000000000e+00;
-#else
-static double zero= 0.00000000000000000000e+00;
-#endif
-#ifdef __STDC__
- static double sin_pi(double x)
-#else
- static double sin_pi(x)
- double x;
-#endif
+static double
+sin_pi(double x)
{
double y,z;
int n,ix;
@@ -188,16 +172,16 @@ static double zero= 0.00000000000000000000e+00;
y = 2.0*(y - __floor(y)); /* y = |x| mod 2.0 */
n = (int) (y*4.0);
} else {
- if(ix>=0x43400000) {
- y = zero; n = 0; /* y must be even */
- } else {
- if(ix<0x43300000) z = y+two52; /* exact */
+ if(ix>=0x43400000) {
+ y = zero; n = 0; /* y must be even */
+ } else {
+ if(ix<0x43300000) z = y+two52; /* exact */
GET_LOW_WORD(n,z);
n &= 1;
- y = n;
- n<<= 2;
- }
- }
+ y = n;
+ n<<= 2;
+ }
+ }
switch (n) {
case 0: y = __sin(pi*y); break;
case 1:
@@ -212,12 +196,8 @@ static double zero= 0.00000000000000000000e+00;
}
-#ifdef __STDC__
- double __ieee754_lgamma_r(double x, int *signgamp)
-#else
- double __ieee754_lgamma_r(x,signgamp)
- double x; int *signgamp;
-#endif
+double
+__ieee754_lgamma_r(double x, int *signgamp)
{
double t,y,z,nadj,p,p1,p2,p3,q,r,w;
int i,hx,lx,ix;
@@ -227,21 +207,23 @@ static double zero= 0.00000000000000000000e+00;
/* purge off +-inf, NaN, +-0, and negative arguments */
*signgamp = 1;
ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) return x*x;
- if((ix|lx)==0)
+ if(__builtin_expect(ix>=0x7ff00000, 0)) return x*x;
+ if(__builtin_expect((ix|lx)==0, 0))
{
if (hx < 0)
*signgamp = -1;
return one/fabs(x);
}
- if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
+ if(__builtin_expect(ix<0x3b900000, 0)) {
+ /* |x|<2**-70, return -log(|x|) */
if(hx<0) {
- *signgamp = -1;
- return -__ieee754_log(-x);
+ *signgamp = -1;
+ return -__ieee754_log(-x);
} else return -__ieee754_log(x);
}
if(hx<0) {
- if(ix>=0x43300000) /* |x|>=2**52, must be -integer */
+ if(__builtin_expect(ix>=0x43300000, 0))
+ /* |x|>=2**52, must be -integer */
return x/zero;
t = sin_pi(x);
if(t==zero) return one/fabsf(t); /* -integer */
@@ -254,15 +236,15 @@ static double zero= 0.00000000000000000000e+00;
if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0;
/* for x < 2.0 */
else if(ix<0x40000000) {
- if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */
+ if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */
r = -__ieee754_log(x);
if(ix>=0x3FE76944) {y = one-x; i= 0;}
else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;}
- else {y = x; i=2;}
+ else {y = x; i=2;}
} else {
- r = zero;
- if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */
- else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */
+ r = zero;
+ if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */
+ else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */
else {y=x-one;i=2;}
}
switch(i) {
@@ -286,7 +268,7 @@ static double zero= 0.00000000000000000000e+00;
r += (-0.5*y + p1/p2);
}
}
- else if(ix<0x40200000) { /* x < 8.0 */
+ else if(ix<0x40200000) { /* x < 8.0 */
i = (int)x;
t = zero;
y = x-(double)i;
@@ -315,3 +297,4 @@ static double zero= 0.00000000000000000000e+00;
if(hx<0) r = nadj - r;
return r;
}
+strong_alias (__ieee754_lgamma_r, __lgamma_r_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c
index 1a9967b..5d320db 100644
--- a/sysdeps/ieee754/dbl-64/e_log.c
+++ b/sysdeps/ieee754/dbl-64/e_log.c
@@ -55,9 +55,9 @@ double __ieee754_log(double x) {
int k;
#endif
double dbl_n,u,p0,q,r0,w,nln2a,luai,lubi,lvaj,lvbj,
- sij,ssij,ttij,A,B,B0,y,y1,y2,polI,polII,sa,sb,
- t1,t2,t3,t4,t5,t6,t7,t8,t,ra,rb,ww,
- a0,aa0,s1,s2,ss2,s3,ss3,a1,aa1,a,aa,b,bb,c;
+ sij,ssij,ttij,A,B,B0,y,y1,y2,polI,polII,sa,sb,
+ t1,t2,t3,t4,t5,t6,t7,t8,t,ra,rb,ww,
+ a0,aa0,s1,s2,ss2,s3,ss3,a1,aa1,a,aa,b,bb,c;
number num;
mp_no mpx,mpy,mpy1,mpy2,mperr;
@@ -69,12 +69,15 @@ double __ieee754_log(double x) {
num.d = x; ux = num.i[HIGH_HALF]; dx = num.i[LOW_HALF];
n=0;
if (ux < 0x00100000) {
- if (((ux & 0x7fffffff) | dx) == 0) return MHALF/ZERO; /* return -INF */
- if (ux < 0) return (x-x)/ZERO; /* return NaN */
+ if (__builtin_expect(((ux & 0x7fffffff) | dx) == 0, 0))
+ return MHALF/ZERO; /* return -INF */
+ if (__builtin_expect(ux < 0, 0))
+ return (x-x)/ZERO; /* return NaN */
n -= 54; x *= two54.d; /* scale x */
num.d = x;
}
- if (ux >= 0x7ff00000) return x+x; /* INF or NaN */
+ if (__builtin_expect(ux >= 0x7ff00000, 0))
+ return x+x; /* INF or NaN */
/* Regular values of x */
@@ -90,7 +93,7 @@ double __ieee754_log(double x) {
/* Evaluate polynomial II */
polII = (b0.d+w*(b1.d+w*(b2.d+w*(b3.d+w*(b4.d+
- w*(b5.d+w*(b6.d+w*(b7.d+w*b8.d))))))))*w*w*w;
+ w*(b5.d+w*(b6.d+w*(b7.d+w*b8.d))))))))*w*w*w;
c = (aa+bb)+polII;
/* End stage I, case abs(x-1) < 0.03 */
@@ -99,7 +102,7 @@ double __ieee754_log(double x) {
/*--- Stage II, the case abs(x-1) < 0.03 */
a = d11.d+w*(d12.d+w*(d13.d+w*(d14.d+w*(d15.d+w*(d16.d+
- w*(d17.d+w*(d18.d+w*(d19.d+w*d20.d))))))));
+ w*(d17.d+w*(d18.d+w*(d19.d+w*d20.d))))))));
EMULV(w,a,s2,ss2,t1,t2,t3,t4,t5)
ADD2(d10.d,dd10.d,s2,ss2,s3,ss3,t1,t2)
MUL2(w,ZERO,s3,ss3,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8)
@@ -201,3 +204,4 @@ double __ieee754_log(double x) {
}
return y1;
}
+strong_alias (__ieee754_log, __log_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c
index e8a3278..6a630bc 100644
--- a/sysdeps/ieee754/dbl-64/e_log10.c
+++ b/sysdeps/ieee754/dbl-64/e_log10.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $";
-#endif
-
/* __ieee754_log10(x)
* Return the base 10 logarithm of x
*
@@ -50,28 +46,16 @@ static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */
log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
-#ifdef __STDC__
static const double zero = 0.0;
-#else
-static double zero = 0.0;
-#endif
-#ifdef __STDC__
- double __ieee754_log10(double x)
-#else
- double __ieee754_log10(x)
- double x;
-#endif
+double
+__ieee754_log10(double x)
{
double y,z;
int32_t i,k,hx;
@@ -79,20 +63,22 @@ static double zero = 0.0;
EXTRACT_WORDS(hx,lx,x);
- k=0;
- if (hx < 0x00100000) { /* x < 2**-1022 */
- if (((hx&0x7fffffff)|lx)==0)
- return -two54/(x-x); /* log(+-0)=-inf */
- if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */
- k -= 54; x *= two54; /* subnormal number, scale up x */
+ k=0;
+ if (hx < 0x00100000) { /* x < 2**-1022 */
+ if (__builtin_expect(((hx&0x7fffffff)|lx)==0, 0))
+ return -two54/(x-x); /* log(+-0)=-inf */
+ if (__builtin_expect(hx<0, 0))
+ return (x-x)/(x-x); /* log(-#) = NaN */
+ k -= 54; x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD(hx,x);
- }
- if (hx >= 0x7ff00000) return x+x;
+ }
+ if (__builtin_expect(hx >= 0x7ff00000, 0)) return x+x;
k += (hx>>20)-1023;
i = ((u_int32_t)k&0x80000000)>>31;
- hx = (hx&0x000fffff)|((0x3ff-i)<<20);
- y = (double)(k+i);
+ hx = (hx&0x000fffff)|((0x3ff-i)<<20);
+ y = (double)(k+i);
SET_HIGH_WORD(x,hx);
z = y*log10_2lo + ivln10*__ieee754_log(x);
return z+y*log10_2hi;
}
+strong_alias (__ieee754_log10, __log10_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_log2.c b/sysdeps/ieee754/dbl-64/e_log2.c
index f05d0ce..be41cb4 100644
--- a/sysdeps/ieee754/dbl-64/e_log2.c
+++ b/sysdeps/ieee754/dbl-64/e_log2.c
@@ -21,14 +21,14 @@
* 2. Approximation of log(1+f).
* Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
* = 2s + 2/3 s**3 + 2/5 s**5 + .....,
- * = 2s + s*R
+ * = 2s + s*R
* We use a special Reme algorithm on [0,0.1716] to generate
- * a polynomial of degree 14 to approximate R The maximum error
+ * a polynomial of degree 14 to approximate R The maximum error
* of this polynomial approximation is bounded by 2**-58.45. In
* other words,
- * 2 4 6 8 10 12 14
+ * 2 4 6 8 10 12 14
* R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s
- * (the values of Lg1 to Lg7 are listed in the program)
+ * (the values of Lg1 to Lg7 are listed in the program)
* and
* | 2 14 | -58.45
* | Lg1*s +...+Lg7*s - R(z) | <= 2
@@ -57,11 +57,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
ln2 = 0.69314718055994530942,
two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
@@ -72,18 +68,10 @@ Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
-#ifdef __STDC__
static const double zero = 0.0;
-#else
-static double zero = 0.0;
-#endif
-#ifdef __STDC__
- double __ieee754_log2(double x)
-#else
- double __ieee754_log2(x)
- double x;
-#endif
+double
+__ieee754_log2(double x)
{
double hfsq,f,s,z,R,w,t1,t2,dk;
int32_t k,hx,i,j;
@@ -93,13 +81,14 @@ static double zero = 0.0;
k=0;
if (hx < 0x00100000) { /* x < 2**-1022 */
- if (((hx&0x7fffffff)|lx)==0)
+ if (__builtin_expect(((hx&0x7fffffff)|lx)==0, 0))
return -two54/(x-x); /* log(+-0)=-inf */
- if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */
+ if (__builtin_expect(hx<0, 0))
+ return (x-x)/(x-x); /* log(-#) = NaN */
k -= 54; x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD(hx,x);
}
- if (hx >= 0x7ff00000) return x+x;
+ if (__builtin_expect(hx >= 0x7ff00000, 0)) return x+x;
k += (hx>>20)-1023;
hx &= 0x000fffff;
i = (hx+0x95f64)&0x100000;
@@ -112,7 +101,7 @@ static double zero = 0.0;
R = f*f*(0.5-0.33333333333333333*f);
return dk-(R-f)/ln2;
}
- s = f/(2.0+f);
+ s = f/(2.0+f);
z = s*s;
i = hx-0x6147a;
w = z*z;
@@ -128,3 +117,4 @@ static double zero = 0.0;
return dk-((s*(f-R))-f)/ln2;
}
}
+strong_alias (__ieee754_log2, __log2_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 1e159f2..83a5eff 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001, 2002, 2004 Free Software Foundation
+ * Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -22,12 +22,12 @@
/* */
/* FUNCTIONS: upow */
/* power1 */
-/* my_log2 */
+/* my_log2 */
/* log1 */
/* checkint */
/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h */
/* halfulp.c mpexp.c mplog.c slowexp.c slowpow.c mpa.c */
-/* uexp.c upow.c */
+/* uexp.c upow.c */
/* root.tbl uexp.tbl upow.tbl */
/* An ultimate power routine. Given two IEEE double machine numbers y,x */
/* it computes the correctly rounded (to nearest) value of x^y. */
@@ -77,7 +77,7 @@ double __ieee754_pow(double x, double y) {
/* else */
if(((u.i[HIGH_HALF]>0 && u.i[HIGH_HALF]<0x7ff00000)|| /* x>0 and not x->0 */
(u.i[HIGH_HALF]==0 && u.i[LOW_HALF]!=0)) &&
- /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */
+ /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */
(v.i[HIGH_HALF]&0x7fffffff) < 0x4ff00000) { /* if y<-1 or y>1 */
z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */
t = y*134217729.0;
@@ -153,6 +153,7 @@ double __ieee754_pow(double x, double y) {
if (y<0) return (x<1.0)?INF.x:0;
return 0; /* unreachable, to make the compiler happy */
}
+strong_alias (__ieee754_pow, __pow_finite)
/**************************************************************************/
/* Computing x^y using more accurate but more slow log routine */
diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c
index cc06e18..d1782a1 100644
--- a/sysdeps/ieee754/dbl-64/e_remainder.c
+++ b/sysdeps/ieee754/dbl-64/e_remainder.c
@@ -1,8 +1,8 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
- *
+ * Copyright (C) 2001, 2011 Free Software Foundation
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
@@ -96,9 +96,9 @@ double __ieee754_remainder(double x, double y)
u.x=(u.x-d*w.x)-d*ww.x;
if (ABS(u.x)<0.5*t.x) return (u.x!=0)?u.x:((x>0)?ZERO.x:nZERO.x);
else
- if (ABS(u.x)>0.5*t.x) return (d>z)?u.x+t.x:u.x-t.x;
- else
- {z=u.x/t.x; d=(z+big.x)-big.x; return ((u.x-d*w.x)-d*ww.x);}
+ if (ABS(u.x)>0.5*t.x) return (d>z)?u.x+t.x:u.x-t.x;
+ else
+ {z=u.x/t.x; d=(z+big.x)-big.x; return ((u.x-d*w.x)-d*ww.x);}
}
} /* (kx<0x7fe00000&&ky<0x7ff00000&&ky>=0x03500000) */
@@ -128,3 +128,4 @@ double __ieee754_remainder(double x, double y)
}
}
}
+strong_alias (__ieee754_remainder, __remainder_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c
index 1701b9b..50463c3 100644
--- a/sysdeps/ieee754/dbl-64/e_sinh.c
+++ b/sysdeps/ieee754/dbl-64/e_sinh.c
@@ -5,7 +5,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -15,15 +15,15 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
#endif
/* __ieee754_sinh(x)
- * Method :
+ * Method :
* mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
- * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
- * 2.
- * E + E/(E+1)
+ * 1. Replace x by |x| (sinh(-x) = -sinh(x)).
+ * 2.
+ * E + E/(E+1)
* 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
- * 2
+ * 2
*
- * 22 <= x <= lnovft : sinh(x) := exp(x)/2
+ * 22 <= x <= lnovft : sinh(x) := exp(x)/2
* lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
* ln2ovft < x : sinh(x) := x*shuge (overflow)
*
@@ -35,19 +35,11 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double one = 1.0, shuge = 1.0e307;
-#else
-static double one = 1.0, shuge = 1.0e307;
-#endif
-#ifdef __STDC__
- double __ieee754_sinh(double x)
-#else
- double __ieee754_sinh(x)
- double x;
-#endif
-{
+double
+__ieee754_sinh(double x)
+{
double t,w,h;
int32_t ix,jx;
u_int32_t lx;
@@ -57,14 +49,15 @@ static double one = 1.0, shuge = 1.0e307;
ix = jx&0x7fffffff;
/* x is INF or NaN */
- if(ix>=0x7ff00000) return x+x;
+ if(__builtin_expect(ix>=0x7ff00000, 0)) return x+x;
h = 0.5;
if (jx<0) h = -h;
/* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x40360000) { /* |x|<22 */
- if (ix<0x3e300000) /* |x|<2**-28 */
- if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
+ if (__builtin_expect(ix<0x3e300000, 0)) /* |x|<2**-28 */
+ if(shuge+x>one)
+ return x;/* sinh(tiny) = tiny with inexact */
t = __expm1(fabs(x));
if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one));
return h*(t+t/(t+one));
@@ -84,3 +77,4 @@ static double one = 1.0, shuge = 1.0e307;
/* |x| > overflowthresold, sinh(x) overflow */
return x*shuge;
}
+strong_alias (__ieee754_sinh, __sinh_finite)
diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c
index f7e8055..05d1e71 100644
--- a/sysdeps/ieee754/dbl-64/e_sqrt.c
+++ b/sysdeps/ieee754/dbl-64/e_sqrt.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -86,3 +86,4 @@ double __ieee754_sqrt(double x) {
return tm256.x*__ieee754_sqrt(x*t512.x);
}
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/ieee754/dbl-64/halfulp.c b/sysdeps/ieee754/dbl-64/halfulp.c
index 478a4ba..42b21fb 100644
--- a/sysdeps/ieee754/dbl-64/halfulp.c
+++ b/sysdeps/ieee754/dbl-64/halfulp.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001, 2005 Free Software Foundation
+ * Copyright (C) 2001, 2005, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -40,13 +40,11 @@
#include "dla.h"
#include "math_private.h"
-double __ieee754_sqrt(double x);
-
static const int4 tab54[32] = {
262143, 11585, 1782, 511, 210, 107, 63, 42,
30, 22, 17, 14, 12, 10, 9, 7,
- 7, 6, 5, 5, 5, 4, 4, 4,
- 3, 3, 3, 3, 3, 3, 3, 3 };
+ 7, 6, 5, 5, 5, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3 };
double __halfulp(double x, double y)
@@ -64,12 +62,12 @@ double __halfulp(double x, double y)
z = (double) k;
return (z*y == -1075.0)?0: -10.0;
}
- /* if y > 0 */
+ /* if y > 0 */
v.x = y;
if (v.i[LOW_HALF] != 0) return -10.0;
v.x=x;
- /* case where x = 2**n for some integer n */
+ /* case where x = 2**n for some integer n */
if (((v.i[HIGH_HALF]&0x000fffff)|v.i[LOW_HALF]) == 0) {
k=(v.i[HIGH_HALF]>>20)-1023;
return (((double) k)*y == -1075.0)?0:-10.0;
@@ -90,7 +88,7 @@ double __halfulp(double x, double y)
k = -k;
if (k>5) return -10.0;
- /* now treat x */
+ /* now treat x */
while (k>0) {
z = __ieee754_sqrt(x);
EMULV(z,z,u,uu,j1,j2,j3,j4,j5);
@@ -111,11 +109,11 @@ double __halfulp(double x, double y)
m = (k&0x000fffff)|0x00100000;
m = m>>(20-l); /* m is the odd integer of x */
- /* now check whether the length of m**n is at most 54 bits */
+ /* now check whether the length of m**n is at most 54 bits */
if (m > tab54[n-3]) return -10.0;
- /* yes, it is - now compute x**n by simple multiplications */
+ /* yes, it is - now compute x**n by simple multiplications */
u = x;
for (k=1;k<n;k++) u = u*x;
diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c
index 985cfe3..93789fb 100644
--- a/sysdeps/ieee754/dbl-64/s_asinh.c
+++ b/sysdeps/ieee754/dbl-64/s_asinh.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $";
-#endif
-
/* asinh(x)
* Method :
* Based on
@@ -28,40 +24,34 @@ static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
huge= 1.00000000000000000000e+300;
-#ifdef __STDC__
- double __asinh(double x)
-#else
- double __asinh(x)
- double x;
-#endif
+double
+__asinh(double x)
{
- double t,w;
+ double w;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
- if(ix< 0x3e300000) { /* |x|<2**-28 */
+ if(__builtin_expect(ix< 0x3e300000, 0)) { /* |x|<2**-28 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
- if(ix>0x41b00000) { /* |x| > 2**28 */
+ if(__builtin_expect(ix>0x41b00000, 0)) { /* |x| > 2**28 */
+ if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
w = __ieee754_log(fabs(x))+ln2;
- } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
- t = fabs(x);
- w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t));
- } else { /* 2.0 > |x| > 2**-28 */
- t = x*x;
- w =__log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t)));
+ } else {
+ double xa = fabs(x);
+ if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
+ w = __ieee754_log(2.0*xa+one/(__ieee754_sqrt(xa*xa+one)+xa));
+ } else { /* 2.0 > |x| > 2**-28 */
+ double t = xa*xa;
+ w =__log1p(xa+t/(one+__ieee754_sqrt(one+t)));
+ }
}
- if(hx>0) return w; else return -w;
+ return __copysign(w, x);
}
weak_alias (__asinh, asinh)
#ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/ieee754/flt-32/e_acosf.c b/sysdeps/ieee754/flt-32/e_acosf.c
index 0d85c42..a258e2f 100644
--- a/sysdeps/ieee754/flt-32/e_acosf.c
+++ b/sysdeps/ieee754/flt-32/e_acosf.c
@@ -8,23 +8,15 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_acosf.c,v 1.5 1995/05/12 04:57:16 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
-static const float
-#else
-static float
-#endif
+static const float
one = 1.0000000000e+00, /* 0x3F800000 */
pi = 3.1415925026e+00, /* 0x40490fda */
pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */
@@ -40,12 +32,8 @@ qS2 = 2.0209457874e+00, /* 0x4001572d */
qS3 = -6.8828397989e-01, /* 0xbf303361 */
qS4 = 7.7038154006e-02; /* 0x3d9dc62e */
-#ifdef __STDC__
- float __ieee754_acosf(float x)
-#else
- float __ieee754_acosf(x)
- float x;
-#endif
+float
+__ieee754_acosf(float x)
{
float z,p,q,r,w,s,c,df;
int32_t hx,ix;
@@ -87,3 +75,4 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */
return (float)2.0*(df+w);
}
}
+strong_alias (__ieee754_acosf, __acosf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_acoshf.c b/sysdeps/ieee754/flt-32/e_acoshf.c
index c607f72..db8f6ec 100644
--- a/sysdeps/ieee754/flt-32/e_acoshf.c
+++ b/sysdeps/ieee754/flt-32/e_acoshf.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -21,9 +21,9 @@ static char rcsid[] = "$NetBSD: e_acoshf.c,v 1.5 1995/05/12 04:57:20 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
one = 1.0,
ln2 = 6.9314718246e-01; /* 0x3f317218 */
@@ -34,7 +34,7 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */
float __ieee754_acoshf(x)
float x;
#endif
-{
+{
float t;
int32_t hx;
GET_FLOAT_WORD(hx,x);
@@ -42,8 +42,8 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */
return (x-x)/(x-x);
} else if(hx >=0x4d800000) { /* x > 2**28 */
if(hx >=0x7f800000) { /* x is inf of NaN */
- return x+x;
- } else
+ return x+x;
+ } else
return __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */
} else if (hx==0x3f800000) {
return 0.0; /* acosh(1) = 0 */
@@ -55,3 +55,4 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */
return __log1pf(t+__sqrtf((float)2.0*t+t*t));
}
}
+strong_alias (__ieee754_acoshf, __acoshf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_asinf.c b/sysdeps/ieee754/flt-32/e_asinf.c
index b0c835c..7296ba3 100644
--- a/sysdeps/ieee754/flt-32/e_asinf.c
+++ b/sysdeps/ieee754/flt-32/e_asinf.c
@@ -14,11 +14,11 @@
*/
/*
- Modifications for single precision expansion are
+ Modifications for single precision expansion are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -93,7 +93,7 @@ p4 = 4.216630880e-2f;
t = w*0.5f;
p = t * (p0 + t * (p1 + t * (p2 + t * (p3 + t * p4))));
s = __ieee754_sqrtf(t);
- if(ix>=0x3F79999A) { /* if |x| > 0.975 */
+ if(ix>=0x3F79999A) { /* if |x| > 0.975 */
t = pio2_hi-(2.0f*(s+s*p)-pio2_lo);
} else {
int32_t iw;
@@ -108,3 +108,4 @@ p4 = 4.216630880e-2f;
}
if(hx>0) return t; else return -t;
}
+strong_alias (__ieee754_asinf, __asinf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c
index c0cafb1..abbde88 100644
--- a/sysdeps/ieee754/flt-32/e_atan2f.c
+++ b/sysdeps/ieee754/flt-32/e_atan2f.c
@@ -13,18 +13,10 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_atan2f.c,v 1.4 1995/05/10 20:44:53 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
tiny = 1.0e-30,
zero = 0.0,
pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */
@@ -32,12 +24,8 @@ pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */
pi = 3.1415927410e+00, /* 0x40490fdb */
pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
-#ifdef __STDC__
- float __ieee754_atan2f(float y, float x)
-#else
- float __ieee754_atan2f(y,x)
- float y,x;
-#endif
+float
+__ieee754_atan2f (float y, float x)
{
float z;
int32_t k,m,hx,hy,ix,iy;
@@ -56,7 +44,7 @@ pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
if(iy==0) {
switch(m) {
case 0:
- case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
@@ -87,19 +75,20 @@ pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
/* compute y/x */
k = (iy-ix)>>23;
- if(k > 60) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**60 */
- else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */
+ if(k > 60) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**60 */
+ else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */
else z=__atanf(fabsf(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: {
- u_int32_t zh;
+ u_int32_t zh;
GET_FLOAT_WORD(zh,z);
SET_FLOAT_WORD(z,zh ^ 0x80000000);
}
return z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
- return (z-pi_lo)-pi;/* atan(-,-) */
+ return (z-pi_lo)-pi;/* atan(-,-) */
}
}
+strong_alias (__ieee754_atan2f, __atan2f_finite)
diff --git a/sysdeps/ieee754/flt-32/e_atanhf.c b/sysdeps/ieee754/flt-32/e_atanhf.c
index f26a15b..ddd18ab 100644
--- a/sysdeps/ieee754/flt-32/e_atanhf.c
+++ b/sysdeps/ieee754/flt-32/e_atanhf.c
@@ -1,58 +1,70 @@
-/* e_atanhf.c -- float version of e_atanh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
-/*
- * ====================================================
- * 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.
- * ====================================================
- */
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* __ieee754_atanh(x)
+ Method :
+ 1.Reduced x to positive by atanh(-x) = -atanh(x)
+ 2.For x>=0.5
+ 1 2x x
+ atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
+ 2 1 - x 1 - x
+
+ For x<0.5
+ atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_atanhf.c,v 1.4 1995/05/10 20:44:56 jtc Exp $";
-#endif
+ Special cases:
+ atanh(x) is NaN if |x| > 1 with signal;
+ atanh(NaN) is that NaN with no signal;
+ atanh(+-1) is +-INF with signal.
+ */
+
+#include <inttypes.h>
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
-static const float one = 1.0, huge = 1e30;
-#else
-static float one = 1.0, huge = 1e30;
-#endif
-
-#ifdef __STDC__
-static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-
-#ifdef __STDC__
- float __ieee754_atanhf(float x)
-#else
- float __ieee754_atanhf(x)
- float x;
-#endif
+static const float huge = 1e30;
+
+float
+__ieee754_atanhf (float x)
{
- float t;
- int32_t hx,ix;
- GET_FLOAT_WORD(hx,x);
- ix = hx&0x7fffffff;
- if (ix>0x3f800000) /* |x|>1 */
- return (x-x)/(x-x);
- if(ix==0x3f800000)
- return x/zero;
- if(ix<0x31800000&&(huge+x)>zero) return x; /* x<2**-28 */
- SET_FLOAT_WORD(x,ix);
- if(ix<0x3f000000) { /* x < 0.5 */
- t = x+x;
- t = (float)0.5*__log1pf(t+t*x/(one-x));
- } else
- t = (float)0.5*__log1pf((x+x)/(one-x));
- if(hx>=0) return t; else return -t;
+ float xa = fabsf (x);
+ float t;
+ if (xa < 0.5f)
+ {
+ if (__builtin_expect (xa < 0x1.0p-28f, 0) && (huge + x) > 0.0f)
+ return x;
+
+ t = xa + xa;
+ t = 0.5f * __log1pf (t + t * xa / (1.0f - xa));
+ }
+ else if (__builtin_expect (xa < 1.0f, 1))
+ t = 0.5f * __log1pf ((xa + xa) / (1.0f - xa));
+ else
+ {
+ if (xa > 1.0f)
+ return (x - x) / (x - x);
+
+ return x / 0.0f;
+ }
+
+ return __copysignf (t, x);
}
+strong_alias (__ieee754_atanhf, __atanhf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_coshf.c b/sysdeps/ieee754/flt-32/e_coshf.c
index 223fbee..1887639 100644
--- a/sysdeps/ieee754/flt-32/e_coshf.c
+++ b/sysdeps/ieee754/flt-32/e_coshf.c
@@ -1,5 +1,6 @@
/* e_coshf.c -- float version of e_cosh.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ * Optimizations by Ulrich Drepper <drepper@gmail.com>, 2011
*/
/*
@@ -13,26 +14,14 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_coshf.c,v 1.6 1996/04/08 15:43:41 phil Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float huge = 1.0e30;
static const float one = 1.0, half=0.5;
-#else
-static float one = 1.0, half=0.5, huge = 1.0e30;
-#endif
-#ifdef __STDC__
- float __ieee754_coshf(float x)
-#else
- float __ieee754_coshf(x)
- float x;
-#endif
+float
+__ieee754_coshf (float x)
{
float t,w;
int32_t ix;
@@ -40,19 +29,17 @@ static float one = 1.0, half=0.5, huge = 1.0e30;
GET_FLOAT_WORD(ix,x);
ix &= 0x7fffffff;
- /* x is INF or NaN */
- if(ix>=0x7f800000) return x*x;
-
- /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
- if(ix<0x3eb17218) {
- t = __expm1f(fabsf(x));
- w = one+t;
- if (ix<0x24000000) return w; /* cosh(tiny) = 1 */
- return one+(t*t)/(w+w);
- }
-
- /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+ /* |x| in [0,22] */
if (ix < 0x41b00000) {
+ /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
+ if(ix<0x3eb17218) {
+ t = __expm1f(fabsf(x));
+ w = one+t;
+ if (ix<0x24000000) return w; /* cosh(tiny) = 1 */
+ return one+(t*t)/(w+w);
+ }
+
+ /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
t = __ieee754_expf(fabsf(x));
return half*t+half/t;
}
@@ -67,6 +54,10 @@ static float one = 1.0, half=0.5, huge = 1.0e30;
return t*w;
}
+ /* x is INF or NaN */
+ if(ix>=0x7f800000) return x*x;
+
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
}
+strong_alias (__ieee754_coshf, __coshf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index 194222a..0703cea 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -1,5 +1,6 @@
/* Single-precision floating point 2^x.
- Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2001,2005,2006,2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@@ -126,3 +127,4 @@ __ieee754_exp2f (float x)
/* Return x, if x is a NaN or Inf; or overflow, otherwise. */
return TWO127*x;
}
+strong_alias (__ieee754_exp2f, __exp2f_finite)
diff --git a/sysdeps/ieee754/flt-32/e_fmodf.c b/sysdeps/ieee754/flt-32/e_fmodf.c
index 47b3123..e82a9ce 100644
--- a/sysdeps/ieee754/flt-32/e_fmodf.c
+++ b/sysdeps/ieee754/flt-32/e_fmodf.c
@@ -8,16 +8,12 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_fmodf.c,v 1.4 1995/05/10 20:45:10 jtc Exp $";
-#endif
-
-/*
+/*
* __ieee754_fmodf(x,y)
* Return x mod y in exact arithmetic
* Method: shift and subtract
@@ -26,18 +22,10 @@ static char rcsid[] = "$NetBSD: e_fmodf.c,v 1.4 1995/05/10 20:45:10 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float one = 1.0, Zero[] = {0.0, -0.0,};
-#else
-static float one = 1.0, Zero[] = {0.0, -0.0,};
-#endif
-#ifdef __STDC__
- float __ieee754_fmodf(float x, float y)
-#else
- float __ieee754_fmodf(x,y)
- float x,y ;
-#endif
+float
+__ieee754_fmodf (float x, float y)
{
int32_t n,hx,hy,hz,ix,iy,sx,i;
@@ -66,13 +54,13 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
} else iy = (hy>>23)-127;
/* set up {hx,lx}, {hy,ly} and align y to x */
- if(ix >= -126)
+ if(ix >= -126)
hx = 0x00800000|(0x007fffff&hx);
else { /* subnormal x, shift x to normal */
n = -126-ix;
hx = hx<<n;
}
- if(iy >= -126)
+ if(iy >= -126)
hy = 0x00800000|(0x007fffff&hy);
else { /* subnormal y, shift y to normal */
n = -126-iy;
@@ -85,17 +73,17 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
hz=hx-hy;
if(hz<0){hx = hx+hx;}
else {
- if(hz==0) /* return sign(x)*0 */
+ if(hz==0) /* return sign(x)*0 */
return Zero[(u_int32_t)sx>>31];
- hx = hz+hz;
+ hx = hz+hz;
}
}
hz=hx-hy;
if(hz>=0) {hx=hz;}
/* convert back to floating value and restore the sign */
- if(hx==0) /* return sign(x)*0 */
- return Zero[(u_int32_t)sx>>31];
+ if(hx==0) /* return sign(x)*0 */
+ return Zero[(u_int32_t)sx>>31];
while(hx<0x00800000) { /* normalize x */
hx = hx+hx;
iy -= 1;
@@ -111,3 +99,4 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
}
return x; /* exact output */
}
+strong_alias (__ieee754_fmodf, __fmodf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c
index 926c84f..aeeddf1 100644
--- a/sysdeps/ieee754/flt-32/e_gammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2001, 2004, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -32,19 +32,20 @@ __ieee754_gammaf_r (float x, int *signgamp)
GET_FLOAT_WORD (hx, x);
- if ((hx & 0x7fffffff) == 0)
+ if (__builtin_expect ((hx & 0x7fffffff) == 0, 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
return 1.0 / x;
}
- if (hx < 0 && (u_int32_t) hx < 0xff800000 && __rintf (x) == x)
+ if (__builtin_expect (hx < 0, 0)
+ && (u_int32_t) hx < 0xff800000 && __rintf (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
return (x - x) / (x - x);
}
- if (hx == 0xff800000)
+ if (__builtin_expect (hx == 0xff800000, 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
@@ -54,3 +55,4 @@ __ieee754_gammaf_r (float x, int *signgamp)
/* XXX FIXME. */
return __ieee754_expf (__ieee754_lgammaf_r (x, signgamp));
}
+strong_alias (__ieee754_gammaf_r, __gammaf_r_finite)
diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c
index a8e1a52..7ec8ae6 100644
--- a/sysdeps/ieee754/flt-32/e_hypotf.c
+++ b/sysdeps/ieee754/flt-32/e_hypotf.c
@@ -13,19 +13,11 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
- float __ieee754_hypotf(float x, float y)
-#else
- float __ieee754_hypotf(x,y)
- float x, y;
-#endif
+float
+__ieee754_hypotf(float x, float y)
{
float a,b,t1,t2,y1,y2,w;
int32_t j,k,ha,hb;
@@ -39,7 +31,7 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
SET_FLOAT_WORD(b,hb); /* b <- |b| */
if((ha-hb)>0xf000000) {return a+b;} /* x/y > 2**30 */
k=0;
- if(ha > 0x58800000) { /* a>2**50 */
+ if(__builtin_expect(ha > 0x58800000, 0)) { /* a>2**50 */
if(ha >= 0x7f800000) { /* Inf or NaN */
w = a+b; /* for sNaN */
if(ha == 0x7f800000) w = a;
@@ -51,15 +43,15 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
SET_FLOAT_WORD(a,ha);
SET_FLOAT_WORD(b,hb);
}
- if(hb < 0x26800000) { /* b < 2**-50 */
+ if(__builtin_expect(hb < 0x26800000, 0)) { /* b < 2**-50 */
if(hb <= 0x007fffff) { /* subnormal b or 0 */
- if(hb==0) return a;
+ if(hb==0) return a;
SET_FLOAT_WORD(t1,0x7e800000); /* t1=2^126 */
b *= t1;
a *= t1;
k -= 126;
} else { /* scale a and b by 2^60 */
- ha += 0x1e000000; /* a *= 2^60 */
+ ha += 0x1e000000; /* a *= 2^60 */
hb += 0x1e000000; /* b *= 2^60 */
k -= 60;
SET_FLOAT_WORD(a,ha);
@@ -85,3 +77,4 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
return t1*w;
} else return w;
}
+strong_alias (__ieee754_hypotf, __hypotf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c
index 8c499e6..d2da43f 100644
--- a/sysdeps/ieee754/flt-32/e_j0f.c
+++ b/sysdeps/ieee754/flt-32/e_j0f.c
@@ -13,29 +13,17 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_j0f.c,v 1.4 1995/05/10 20:45:25 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static float pzerof(float), qzerof(float);
-#else
-static float pzerof(), qzerof();
-#endif
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
-huge = 1e30,
+huge = 1e30,
one = 1.0,
invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */
tpi = 6.3661974669e-01, /* 0x3f22f983 */
- /* R0/S0 on [0, 2.00] */
+ /* R0/S0 on [0, 2.00] */
R02 = 1.5625000000e-02, /* 0x3c800000 */
R03 = -1.8997929874e-04, /* 0xb947352e */
R04 = 1.8295404516e-06, /* 0x35f58e88 */
@@ -45,18 +33,10 @@ S02 = 1.1692678527e-04, /* 0x38f53697 */
S03 = 5.1354652442e-07, /* 0x3509daa6 */
S04 = 1.1661400734e-09; /* 0x30a045e8 */
-#ifdef __STDC__
static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-#ifdef __STDC__
- float __ieee754_j0f(float x)
-#else
- float __ieee754_j0f(x)
- float x;
-#endif
+float
+__ieee754_j0f(float x)
{
float z, s,c,ss,cc,r,u,v;
int32_t hx,ix;
@@ -72,7 +52,7 @@ static float zero = 0.0;
if(ix<0x7f000000) { /* make sure x+x not overflow */
z = -__cosf(x+x);
if ((s*c)<zero) cc = z/ss;
- else ss = z/cc;
+ else ss = z/cc;
}
/*
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
@@ -87,8 +67,8 @@ static float zero = 0.0;
}
if(ix<0x39000000) { /* |x| < 2**-13 */
if(huge+x>one) { /* raise inexact if x != 0 */
- if(ix<0x32000000) return one; /* |x|<2**-27 */
- else return one - (float)0.25*x*x;
+ if(ix<0x32000000) return one; /* |x|<2**-27 */
+ else return one - (float)0.25*x*x;
}
}
z = x*x;
@@ -101,12 +81,9 @@ static float zero = 0.0;
return((one+u)*(one-u)+z*(r/s));
}
}
+strong_alias (__ieee754_j0f, __j0f_finite)
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
u00 = -7.3804296553e-02, /* 0xbd9726b5 */
u01 = 1.7666645348e-01, /* 0x3e34e80d */
u02 = -1.3818567619e-02, /* 0xbc626746 */
@@ -119,52 +96,48 @@ v02 = 7.6006865129e-05, /* 0x389f65e0 */
v03 = 2.5915085189e-07, /* 0x348b216c */
v04 = 4.4111031494e-10; /* 0x2ff280c2 */
-#ifdef __STDC__
- float __ieee754_y0f(float x)
-#else
- float __ieee754_y0f(x)
- float x;
-#endif
+float
+__ieee754_y0f(float x)
{
float z, s,c,ss,cc,u,v;
int32_t hx,ix;
GET_FLOAT_WORD(hx,x);
- ix = 0x7fffffff&hx;
+ ix = 0x7fffffff&hx;
/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */
if(ix>=0x7f800000) return one/(x+x*x);
- if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */
- if(hx<0) return zero/(zero*x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
- /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
- * where x0 = x-pi/4
- * Better formula:
- * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
- * = 1/sqrt(2) * (sin(x) + cos(x))
- * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- * = 1/sqrt(2) * (sin(x) - cos(x))
- * To avoid cancellation, use
- * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.
- */
+ if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */
+ if(hx<0) return zero/(zero*x);
+ if(ix >= 0x40000000) { /* |x| >= 2.0 */
+ /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
+ * where x0 = x-pi/4
+ * Better formula:
+ * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
+ * = 1/sqrt(2) * (sin(x) + cos(x))
+ * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ * = 1/sqrt(2) * (sin(x) - cos(x))
+ * To avoid cancellation, use
+ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * to compute the worse one.
+ */
__sincosf (x, &s, &c);
- ss = s-c;
- cc = s+c;
+ ss = s-c;
+ cc = s+c;
/*
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
- if(ix<0x7f000000) { /* make sure x+x not overflow */
- z = -__cosf(x+x);
- if ((s*c)<zero) cc = z/ss;
- else ss = z/cc;
- }
- if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x);
- else {
- u = pzerof(x); v = qzerof(x);
- z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x);
- }
- return z;
+ if(ix<0x7f000000) { /* make sure x+x not overflow */
+ z = -__cosf(x+x);
+ if ((s*c)<zero) cc = z/ss;
+ else ss = z/cc;
+ }
+ if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x);
+ else {
+ u = pzerof(x); v = qzerof(x);
+ z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x);
+ }
+ return z;
}
if(ix<=0x32000000) { /* x < 2**-27 */
return(u00 + tpi*__ieee754_logf(x));
@@ -174,21 +147,18 @@ v04 = 4.4111031494e-10; /* 0x2ff280c2 */
v = one+z*(v01+z*(v02+z*(v03+z*v04)));
return(u/v + tpi*(__ieee754_j0f(x)*__ieee754_logf(x)));
}
+strong_alias (__ieee754_y0f, __y0f_finite)
/* 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
- * pzero(x) = 1 + (R/S)
+ * pzero(x) = 1 + (R/S)
* where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10
- * S = 1 + pS0*s^2 + ... + pS4*s^10
+ * S = 1 + pS0*s^2 + ... + pS4*s^10
* and
* | pzero(x)-1-R/S | <= 2 ** ( -60.26)
*/
-#ifdef __STDC__
static const float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.0000000000e+00, /* 0x00000000 */
-7.0312500000e-02, /* 0xbd900000 */
-8.0816707611e+00, /* 0xc1014e86 */
@@ -196,22 +166,14 @@ static float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-2.4852163086e+03, /* 0xc51b5376 */
-5.2530439453e+03, /* 0xc5a4285a */
};
-#ifdef __STDC__
static const float pS8[5] = {
-#else
-static float pS8[5] = {
-#endif
1.1653436279e+02, /* 0x42e91198 */
3.8337448730e+03, /* 0x456f9beb */
4.0597855469e+04, /* 0x471e95db */
1.1675296875e+05, /* 0x47e4087c */
4.7627726562e+04, /* 0x473a0bba */
};
-#ifdef __STDC__
static const float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
-1.1412546255e-11, /* 0xad48c58a */
-7.0312492549e-02, /* 0xbd8fffff */
-4.1596107483e+00, /* 0xc0851b88 */
@@ -219,11 +181,7 @@ static float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-3.3123129272e+02, /* 0xc3a59d9b */
-3.4643338013e+02, /* 0xc3ad3779 */
};
-#ifdef __STDC__
static const float pS5[5] = {
-#else
-static float pS5[5] = {
-#endif
6.0753936768e+01, /* 0x42730408 */
1.0512523193e+03, /* 0x44836813 */
5.9789707031e+03, /* 0x45bad7c4 */
@@ -231,11 +189,7 @@ static float pS5[5] = {
2.4060581055e+03, /* 0x451660ee */
};
-#ifdef __STDC__
static const float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#else
-static float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
-2.5470459075e-09, /* 0xb12f081b */
-7.0311963558e-02, /* 0xbd8fffb8 */
-2.4090321064e+00, /* 0xc01a2d95 */
@@ -243,11 +197,7 @@ static float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-5.8079170227e+01, /* 0xc2685112 */
-3.1447946548e+01, /* 0xc1fb9565 */
};
-#ifdef __STDC__
static const float pS3[5] = {
-#else
-static float pS3[5] = {
-#endif
3.5856033325e+01, /* 0x420f6c94 */
3.6151397705e+02, /* 0x43b4c1ca */
1.1936077881e+03, /* 0x44953373 */
@@ -255,11 +205,7 @@ static float pS3[5] = {
1.7358093262e+02, /* 0x432d94b8 */
};
-#ifdef __STDC__
static const float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
-8.8753431271e-08, /* 0xb3be98b7 */
-7.0303097367e-02, /* 0xbd8ffb12 */
-1.4507384300e+00, /* 0xbfb9b1cc */
@@ -267,11 +213,7 @@ static float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-1.1193166733e+01, /* 0xc1331736 */
-3.2336456776e+00, /* 0xc04ef40d */
};
-#ifdef __STDC__
static const float pS2[5] = {
-#else
-static float pS2[5] = {
-#endif
2.2220300674e+01, /* 0x41b1c32d */
1.3620678711e+02, /* 0x430834f0 */
2.7047027588e+02, /* 0x43873c32 */
@@ -279,18 +221,10 @@ static float pS2[5] = {
1.4657617569e+01, /* 0x416a859a */
};
-#ifdef __STDC__
- static float pzerof(float x)
-#else
- static float pzerof(x)
- float x;
-#endif
+static float
+pzerof(float x)
{
-#ifdef __STDC__
const float *p,*q;
-#else
- float *p,*q;
-#endif
float z,r,s;
int32_t ix;
GET_FLOAT_WORD(ix,x);
@@ -309,17 +243,13 @@ static float pS2[5] = {
/* For x >= 8, the asymptotic expansions of qzero is
* -1/8 s + 75/1024 s^3 - ..., where s = 1/x.
* We approximate pzero by
- * qzero(x) = s*(-1.25 + (R/S))
+ * qzero(x) = s*(-1.25 + (R/S))
* where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10
- * S = 1 + qS0*s^2 + ... + qS5*s^12
+ * S = 1 + qS0*s^2 + ... + qS5*s^12
* and
* | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22)
*/
-#ifdef __STDC__
static const float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.0000000000e+00, /* 0x00000000 */
7.3242187500e-02, /* 0x3d960000 */
1.1768206596e+01, /* 0x413c4a93 */
@@ -327,11 +257,7 @@ static float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
8.8591972656e+03, /* 0x460a6cca */
3.7014625000e+04, /* 0x471096a0 */
};
-#ifdef __STDC__
static const float qS8[6] = {
-#else
-static float qS8[6] = {
-#endif
1.6377603149e+02, /* 0x4323c6aa */
8.0983447266e+03, /* 0x45fd12c2 */
1.4253829688e+05, /* 0x480b3293 */
@@ -340,11 +266,7 @@ static float qS8[6] = {
-3.4389928125e+05, /* 0xc8a7eb69 */
};
-#ifdef __STDC__
static const float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
1.8408595828e-11, /* 0x2da1ec79 */
7.3242180049e-02, /* 0x3d95ffff */
5.8356351852e+00, /* 0x40babd86 */
@@ -352,11 +274,7 @@ static float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
1.0272437744e+03, /* 0x448067cd */
1.9899779053e+03, /* 0x44f8bf4b */
};
-#ifdef __STDC__
static const float qS5[6] = {
-#else
-static float qS5[6] = {
-#endif
8.2776611328e+01, /* 0x42a58da0 */
2.0778142090e+03, /* 0x4501dd07 */
1.8847289062e+04, /* 0x46933e94 */
@@ -365,11 +283,7 @@ static float qS5[6] = {
-5.3543427734e+03, /* 0xc5a752be */
};
-#ifdef __STDC__
static const float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#else
-static float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
4.3774099900e-09, /* 0x3196681b */
7.3241114616e-02, /* 0x3d95ff70 */
3.3442313671e+00, /* 0x405607e3 */
@@ -377,11 +291,7 @@ static float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
1.7080809021e+02, /* 0x432acedf */
1.6673394775e+02, /* 0x4326bbe4 */
};
-#ifdef __STDC__
static const float qS3[6] = {
-#else
-static float qS3[6] = {
-#endif
4.8758872986e+01, /* 0x42430916 */
7.0968920898e+02, /* 0x44316c1c */
3.7041481934e+03, /* 0x4567825f */
@@ -390,11 +300,7 @@ static float qS3[6] = {
-1.4924745178e+02, /* 0xc3153f59 */
};
-#ifdef __STDC__
static const float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
1.5044444979e-07, /* 0x342189db */
7.3223426938e-02, /* 0x3d95f62a */
1.9981917143e+00, /* 0x3fffc4bf */
@@ -402,11 +308,7 @@ static float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
3.1666231155e+01, /* 0x41fd5471 */
1.6252708435e+01, /* 0x4182058c */
};
-#ifdef __STDC__
static const float qS2[6] = {
-#else
-static float qS2[6] = {
-#endif
3.0365585327e+01, /* 0x41f2ecb8 */
2.6934811401e+02, /* 0x4386ac8f */
8.4478375244e+02, /* 0x44533229 */
@@ -415,18 +317,10 @@ static float qS2[6] = {
-5.3109550476e+00, /* 0xc0a9f358 */
};
-#ifdef __STDC__
- static float qzerof(float x)
-#else
- static float qzerof(x)
- float x;
-#endif
+static float
+qzerof(float x)
{
-#ifdef __STDC__
const float *p,*q;
-#else
- float *p,*q;
-#endif
float s,r,z;
int32_t ix;
GET_FLOAT_WORD(ix,x);
diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c
index 71bb251..bb335a7 100644
--- a/sysdeps/ieee754/flt-32/e_j1f.c
+++ b/sysdeps/ieee754/flt-32/e_j1f.c
@@ -13,24 +13,12 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_j1f.c,v 1.4 1995/05/10 20:45:31 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static float ponef(float), qonef(float);
-#else
-static float ponef(), qonef();
-#endif
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
huge = 1e30,
one = 1.0,
invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */
@@ -46,25 +34,17 @@ s03 = 1.1771846857e-06, /* 0x359dffc2 */
s04 = 5.0463624390e-09, /* 0x31ad6446 */
s05 = 1.2354227016e-11; /* 0x2d59567e */
-#ifdef __STDC__
static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-#ifdef __STDC__
- float __ieee754_j1f(float x)
-#else
- float __ieee754_j1f(x)
- float x;
-#endif
+float
+__ieee754_j1f(float x)
{
float z, s,c,ss,cc,r,u,v,y;
int32_t hx,ix;
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
- if(ix>=0x7f800000) return one/x;
+ if(__builtin_expect(ix>=0x7f800000, 0)) return one/x;
y = fabsf(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
__sincosf (y, &s, &c);
@@ -73,7 +53,7 @@ static float zero = 0.0;
if(ix<0x7f000000) { /* make sure y+y not overflow */
z = __cosf(y+y);
if ((s*c)>zero) cc = z/ss;
- else ss = z/cc;
+ else ss = z/cc;
}
/*
* j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
@@ -85,9 +65,9 @@ static float zero = 0.0;
z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrtf(y);
}
if(hx<0) return -z;
- else return z;
+ else return z;
}
- if(ix<0x32000000) { /* |x|<2**-27 */
+ if(__builtin_expect(ix<0x32000000, 0)) { /* |x|<2**-27 */
if(huge+x>one) return (float)0.5*x;/* inexact if x!=0 necessary */
}
z = x*x;
@@ -96,23 +76,16 @@ static float zero = 0.0;
r *= x;
return(x*(float)0.5+r/s);
}
+strong_alias (__ieee754_j1f, __j1f_finite)
-#ifdef __STDC__
static const float U0[5] = {
-#else
-static float U0[5] = {
-#endif
-1.9605709612e-01, /* 0xbe48c331 */
5.0443872809e-02, /* 0x3d4e9e3c */
-1.9125689287e-03, /* 0xbafaaf2a */
2.3525259166e-05, /* 0x37c5581c */
-9.1909917899e-08, /* 0xb3c56003 */
};
-#ifdef __STDC__
static const float V0[5] = {
-#else
-static float V0[5] = {
-#endif
1.9916731864e-02, /* 0x3ca3286a */
2.0255257550e-04, /* 0x3954644b */
1.3560879779e-06, /* 0x35b602d4 */
@@ -120,73 +93,67 @@ static float V0[5] = {
1.6655924903e-11, /* 0x2d9281cf */
};
-#ifdef __STDC__
- float __ieee754_y1f(float x)
-#else
- float __ieee754_y1f(x)
- float x;
-#endif
+float
+__ieee754_y1f(float x)
{
float z, s,c,ss,cc,u,v;
int32_t hx,ix;
GET_FLOAT_WORD(hx,x);
- ix = 0x7fffffff&hx;
+ ix = 0x7fffffff&hx;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if(ix>=0x7f800000) return one/(x+x*x);
- if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */
- if(hx<0) return zero/(zero*x);
- if(ix >= 0x40000000) { /* |x| >= 2.0 */
+ if(__builtin_expect(ix>=0x7f800000, 0)) return one/(x+x*x);
+ if(__builtin_expect(ix==0, 0))
+ return -HUGE_VALF+x; /* -inf and overflow exception. */
+ if(__builtin_expect(hx<0, 0)) return zero/(zero*x);
+ if(ix >= 0x40000000) { /* |x| >= 2.0 */
__sincosf (x, &s, &c);
- ss = -s-c;
- cc = s-c;
- if(ix<0x7f000000) { /* make sure x+x not overflow */
- z = __cosf(x+x);
- if ((s*c)>zero) cc = z/ss;
- else ss = z/cc;
- }
- /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
- * where x0 = x-3pi/4
- * Better formula:
- * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
- * = 1/sqrt(2) * (sin(x) - cos(x))
- * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- * = -1/sqrt(2) * (cos(x) + sin(x))
- * To avoid cancellation, use
- * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.
- */
- if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x);
- else {
- u = ponef(x); v = qonef(x);
- z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x);
- }
- return z;
- }
- if(ix<=0x24800000) { /* x < 2**-54 */
- return(-tpi/x);
- }
- z = x*x;
- u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
- v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
- return(x*(u/v) + tpi*(__ieee754_j1f(x)*__ieee754_logf(x)-one/x));
+ ss = -s-c;
+ cc = s-c;
+ if(ix<0x7f000000) { /* make sure x+x not overflow */
+ z = __cosf(x+x);
+ if ((s*c)>zero) cc = z/ss;
+ else ss = z/cc;
+ }
+ /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
+ * where x0 = x-3pi/4
+ * Better formula:
+ * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
+ * = 1/sqrt(2) * (sin(x) - cos(x))
+ * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
+ * = -1/sqrt(2) * (cos(x) + sin(x))
+ * To avoid cancellation, use
+ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ * to compute the worse one.
+ */
+ if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x);
+ else {
+ u = ponef(x); v = qonef(x);
+ z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x);
+ }
+ return z;
+ }
+ if(__builtin_expect(ix<=0x24800000, 0)) { /* x < 2**-54 */
+ return(-tpi/x);
+ }
+ z = x*x;
+ u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
+ v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
+ return(x*(u/v) + tpi*(__ieee754_j1f(x)*__ieee754_logf(x)-one/x));
}
+strong_alias (__ieee754_y1f, __y1f_finite)
/* 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
- * pone(x) = 1 + (R/S)
+ * pone(x) = 1 + (R/S)
* where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10
- * S = 1 + ps0*s^2 + ... + ps4*s^10
+ * S = 1 + ps0*s^2 + ... + ps4*s^10
* and
* | pone(x)-1-R/S | <= 2 ** ( -60.06)
*/
-#ifdef __STDC__
static const float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.0000000000e+00, /* 0x00000000 */
1.1718750000e-01, /* 0x3df00000 */
1.3239480972e+01, /* 0x4153d4ea */
@@ -194,11 +161,7 @@ static float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
3.8747453613e+03, /* 0x45722bed */
7.9144794922e+03, /* 0x45f753d6 */
};
-#ifdef __STDC__
static const float ps8[5] = {
-#else
-static float ps8[5] = {
-#endif
1.1420736694e+02, /* 0x42e46a2c */
3.6509309082e+03, /* 0x45642ee5 */
3.6956207031e+04, /* 0x47105c35 */
@@ -206,11 +169,7 @@ static float ps8[5] = {
3.0804271484e+04, /* 0x46f0a88b */
};
-#ifdef __STDC__
static const float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
1.3199052094e-11, /* 0x2d68333f */
1.1718749255e-01, /* 0x3defffff */
6.8027510643e+00, /* 0x40d9b023 */
@@ -218,11 +177,7 @@ static float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
5.1763616943e+02, /* 0x440168b7 */
5.2871520996e+02, /* 0x44042dc6 */
};
-#ifdef __STDC__
static const float ps5[5] = {
-#else
-static float ps5[5] = {
-#endif
5.9280597687e+01, /* 0x426d1f55 */
9.9140142822e+02, /* 0x4477d9b1 */
5.3532670898e+03, /* 0x45a74a23 */
@@ -230,11 +185,7 @@ static float ps5[5] = {
1.5040468750e+03, /* 0x44bc0180 */
};
-#ifdef __STDC__
static const float pr3[6] = {
-#else
-static float pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
3.0250391081e-09, /* 0x314fe10d */
1.1718686670e-01, /* 0x3defffab */
3.9329774380e+00, /* 0x407bb5e7 */
@@ -242,11 +193,7 @@ static float pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
9.1055007935e+01, /* 0x42b61c2a */
4.8559066772e+01, /* 0x42423c7c */
};
-#ifdef __STDC__
static const float ps3[5] = {
-#else
-static float ps3[5] = {
-#endif
3.4791309357e+01, /* 0x420b2a4d */
3.3676245117e+02, /* 0x43a86198 */
1.0468714600e+03, /* 0x4482dbe3 */
@@ -254,11 +201,7 @@ static float ps3[5] = {
1.0378793335e+02, /* 0x42cf936c */
};
-#ifdef __STDC__
static const float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
1.0771083225e-07, /* 0x33e74ea8 */
1.1717621982e-01, /* 0x3deffa16 */
2.3685150146e+00, /* 0x401795c0 */
@@ -266,11 +209,7 @@ static float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
1.7693971634e+01, /* 0x418d8d41 */
5.0735230446e+00, /* 0x40a25a4d */
};
-#ifdef __STDC__
static const float ps2[5] = {
-#else
-static float ps2[5] = {
-#endif
2.1436485291e+01, /* 0x41ab7dec */
1.2529022980e+02, /* 0x42fa9499 */
2.3227647400e+02, /* 0x436846c7 */
@@ -278,48 +217,36 @@ static float ps2[5] = {
8.3646392822e+00, /* 0x4105d590 */
};
-#ifdef __STDC__
- static float ponef(float x)
-#else
- static float ponef(x)
- float x;
-#endif
+static float
+ponef(float x)
{
-#ifdef __STDC__
const float *p,*q;
-#else
- float *p,*q;
-#endif
float z,r,s;
- int32_t ix;
+ int32_t ix;
GET_FLOAT_WORD(ix,x);
ix &= 0x7fffffff;
- if(ix>=0x41000000) {p = pr8; q= ps8;}
- else if(ix>=0x40f71c58){p = pr5; q= ps5;}
- else if(ix>=0x4036db68){p = pr3; q= ps3;}
- else if(ix>=0x40000000){p = pr2; q= ps2;}
- z = one/(x*x);
- r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
- s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
- return one+ r/s;
+ if(ix>=0x41000000) {p = pr8; q= ps8;}
+ else if(ix>=0x40f71c58){p = pr5; q= ps5;}
+ else if(ix>=0x4036db68){p = pr3; q= ps3;}
+ else if(ix>=0x40000000){p = pr2; q= ps2;}
+ z = one/(x*x);
+ r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
+ s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
+ return one+ r/s;
}
/* For x >= 8, the asymptotic expansions of qone is
* 3/8 s - 105/1024 s^3 - ..., where s = 1/x.
* We approximate pone by
- * qone(x) = s*(0.375 + (R/S))
+ * qone(x) = s*(0.375 + (R/S))
* where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10
- * S = 1 + qs1*s^2 + ... + qs6*s^12
+ * S = 1 + qs1*s^2 + ... + qs6*s^12
* and
* | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13)
*/
-#ifdef __STDC__
static const float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
0.0000000000e+00, /* 0x00000000 */
-1.0253906250e-01, /* 0xbdd20000 */
-1.6271753311e+01, /* 0xc1822c8d */
@@ -327,11 +254,7 @@ static float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-1.1849806641e+04, /* 0xc639273a */
-4.8438511719e+04, /* 0xc73d3683 */
};
-#ifdef __STDC__
static const float qs8[6] = {
-#else
-static float qs8[6] = {
-#endif
1.6139537048e+02, /* 0x43216537 */
7.8253862305e+03, /* 0x45f48b17 */
1.3387534375e+05, /* 0x4802bcd6 */
@@ -340,11 +263,7 @@ static float qs8[6] = {
-2.9449025000e+05, /* 0xc88fcb48 */
};
-#ifdef __STDC__
static const float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
-2.0897993405e-11, /* 0xadb7d219 */
-1.0253904760e-01, /* 0xbdd1fffe */
-8.0564479828e+00, /* 0xc100e736 */
@@ -352,11 +271,7 @@ static float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-1.3731937256e+03, /* 0xc4aba633 */
-2.6124443359e+03, /* 0xc523471c */
};
-#ifdef __STDC__
static const float qs5[6] = {
-#else
-static float qs5[6] = {
-#endif
8.1276550293e+01, /* 0x42a28d98 */
1.9917987061e+03, /* 0x44f8f98f */
1.7468484375e+04, /* 0x468878f8 */
@@ -365,11 +280,7 @@ static float qs5[6] = {
-4.7191835938e+03, /* 0xc5937978 */
};
-#ifdef __STDC__
static const float qr3[6] = {
-#else
-static float qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
-5.0783124372e-09, /* 0xb1ae7d4f */
-1.0253783315e-01, /* 0xbdd1ff5b */
-4.6101160049e+00, /* 0xc0938612 */
@@ -377,11 +288,7 @@ static float qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-2.2824453735e+02, /* 0xc3643e9a */
-2.1921012878e+02, /* 0xc35b35cb */
};
-#ifdef __STDC__
static const float qs3[6] = {
-#else
-static float qs3[6] = {
-#endif
4.7665153503e+01, /* 0x423ea91e */
6.7386511230e+02, /* 0x4428775e */
3.3801528320e+03, /* 0x45534272 */
@@ -390,11 +297,7 @@ static float qs3[6] = {
-1.3520118713e+02, /* 0xc3073381 */
};
-#ifdef __STDC__
static const float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
-1.7838172539e-07, /* 0xb43f8932 */
-1.0251704603e-01, /* 0xbdd1f475 */
-2.7522056103e+00, /* 0xc0302423 */
@@ -402,11 +305,7 @@ static float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-4.2325313568e+01, /* 0xc2294d1f */
-2.1371921539e+01, /* 0xc1aaf9b2 */
};
-#ifdef __STDC__
static const float qs2[6] = {
-#else
-static float qs2[6] = {
-#endif
2.9533363342e+01, /* 0x41ec4454 */
2.5298155212e+02, /* 0x437cfb47 */
7.5750280762e+02, /* 0x443d602e */
@@ -415,18 +314,10 @@ static float qs2[6] = {
-4.9594988823e+00, /* 0xc09eb437 */
};
-#ifdef __STDC__
- static float qonef(float x)
-#else
- static float qonef(x)
- float x;
-#endif
+static float
+qonef(float x)
{
-#ifdef __STDC__
const float *p,*q;
-#else
- float *p,*q;
-#endif
float s,r,z;
int32_t ix;
GET_FLOAT_WORD(ix,x);
diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c
index dd3d551..1e55485 100644
--- a/sysdeps/ieee754/flt-32/e_jnf.c
+++ b/sysdeps/ieee754/flt-32/e_jnf.c
@@ -13,33 +13,17 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_jnf.c,v 1.5 1995/05/10 20:45:37 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
two = 2.0000000000e+00, /* 0x40000000 */
one = 1.0000000000e+00; /* 0x3F800000 */
-#ifdef __STDC__
static const float zero = 0.0000000000e+00;
-#else
-static float zero = 0.0000000000e+00;
-#endif
-#ifdef __STDC__
- float __ieee754_jnf(int n, float x)
-#else
- float __ieee754_jnf(n,x)
- int n; float x;
-#endif
+float
+__ieee754_jnf(int n, float x)
{
int32_t i,hx,ix, sgn;
float a, b, temp, di;
@@ -51,7 +35,7 @@ static float zero = 0.0000000000e+00;
GET_FLOAT_WORD(hx,x);
ix = 0x7fffffff&hx;
/* if J(n,NaN) is NaN */
- if(ix>0x7f800000) return x+x;
+ if(__builtin_expect(ix>0x7f800000, 0)) return x+x;
if(n<0){
n = -n;
x = -x;
@@ -61,7 +45,7 @@ static float zero = 0.0000000000e+00;
if(n==1) return(__ieee754_j1f(x));
sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
x = fabsf(x);
- if(ix==0||ix>=0x7f800000) /* if x is 0 or inf */
+ if(__builtin_expect(ix==0||ix>=0x7f800000, 0)) /* if x is 0 or inf */
b = zero;
else if((float)n<=x) {
/* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
@@ -106,7 +90,7 @@ static float zero = 0.0000000000e+00;
* 1
* w - -----------------
* 1
- * w+h - ---------
+ * w+h - ---------
* w+2h - ...
*
* To determine how many terms needed, let
@@ -144,18 +128,18 @@ static float zero = 0.0000000000e+00;
tmp = tmp*__ieee754_logf(fabsf(v*tmp));
if(tmp<(float)8.8721679688e+01) {
for(i=n-1,di=(float)(i+i);i>0;i--){
- temp = b;
+ temp = b;
b *= di;
b = b/x - a;
- a = temp;
+ a = temp;
di -= two;
}
} else {
for(i=n-1,di=(float)(i+i);i>0;i--){
- temp = b;
+ temp = b;
b *= di;
b = b/x - a;
- a = temp;
+ a = temp;
di -= two;
/* scale b to avoid spurious overflow */
if(b>(float)1e10) {
@@ -179,13 +163,10 @@ static float zero = 0.0000000000e+00;
}
if(sgn==1) return -b; else return b;
}
+strong_alias (__ieee754_jnf, __jnf_finite)
-#ifdef __STDC__
- float __ieee754_ynf(int n, float x)
-#else
- float __ieee754_ynf(n,x)
- int n; float x;
-#endif
+float
+__ieee754_ynf(int n, float x)
{
int32_t i,hx,ix;
u_int32_t ib;
@@ -195,9 +176,10 @@ static float zero = 0.0000000000e+00;
GET_FLOAT_WORD(hx,x);
ix = 0x7fffffff&hx;
/* if Y(n,NaN) is NaN */
- if(ix>0x7f800000) return x+x;
- if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */
- if(hx<0) return zero/(zero*x);
+ if(__builtin_expect(ix>0x7f800000, 0)) return x+x;
+ if(__builtin_expect(ix==0, 0))
+ return -HUGE_VALF+x; /* -inf and overflow exception. */
+ if(__builtin_expect(hx<0, 0)) return zero/(zero*x);
sign = 1;
if(n<0){
n = -n;
@@ -205,7 +187,7 @@ static float zero = 0.0000000000e+00;
}
if(n==0) return(__ieee754_y0f(x));
if(n==1) return(sign*__ieee754_y1f(x));
- if(ix==0x7f800000) return zero;
+ if(__builtin_expect(ix==0x7f800000, 0)) return zero;
a = __ieee754_y0f(x);
b = __ieee754_y1f(x);
@@ -219,3 +201,4 @@ static float zero = 0.0000000000e+00;
}
if(sign>0) return b; else return -b;
}
+strong_alias (__ieee754_ynf, __ynf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index 0ed2610..cbee9db 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -13,18 +13,10 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_lgammaf_r.c,v 1.3 1995/05/10 20:45:47 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
two23= 8.3886080000e+06, /* 0x4b000000 */
half= 5.0000000000e-01, /* 0x3f000000 */
one = 1.0000000000e+00, /* 0x3f800000 */
@@ -92,18 +84,10 @@ w4 = -5.9518753551e-04, /* 0xba1c065c */
w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */
w6 = -1.6309292987e-03; /* 0xbad5c4e8 */
-#ifdef __STDC__
static const float zero= 0.0000000000e+00;
-#else
-static float zero= 0.0000000000e+00;
-#endif
-#ifdef __STDC__
- static float sin_pif(float x)
-#else
- static float sin_pif(x)
- float x;
-#endif
+static float
+sin_pif(float x)
{
float y,z;
int n,ix;
@@ -124,16 +108,16 @@ static float zero= 0.0000000000e+00;
y = (float)2.0*(y - __floorf(y)); /* y = |x| mod 2.0 */
n = (int) (y*(float)4.0);
} else {
- if(ix>=0x4b800000) {
- y = zero; n = 0; /* y must be even */
- } else {
- if(ix<0x4b000000) z = y+two23; /* exact */
+ if(ix>=0x4b800000) {
+ y = zero; n = 0; /* y must be even */
+ } else {
+ if(ix<0x4b000000) z = y+two23; /* exact */
GET_FLOAT_WORD(n,z);
n &= 1;
- y = n;
- n<<= 2;
- }
- }
+ y = n;
+ n<<= 2;
+ }
+ }
switch (n) {
case 0: y = __kernel_sinf(pi*y,zero,0); break;
case 1:
@@ -148,12 +132,8 @@ static float zero= 0.0000000000e+00;
}
-#ifdef __STDC__
- float __ieee754_lgammaf_r(float x, int *signgamp)
-#else
- float __ieee754_lgammaf_r(x,signgamp)
- float x; int *signgamp;
-#endif
+float
+__ieee754_lgammaf_r(float x, int *signgamp)
{
float t,y,z,nadj,p,p1,p2,p3,q,r,w;
int i,hx,ix;
@@ -163,21 +143,22 @@ static float zero= 0.0000000000e+00;
/* purge off +-inf, NaN, +-0, and negative arguments */
*signgamp = 1;
ix = hx&0x7fffffff;
- if(ix>=0x7f800000) return x*x;
- if(ix==0)
+ if(__builtin_expect(ix>=0x7f800000, 0)) return x*x;
+ if(__builtin_expect(ix==0, 0))
{
if (hx < 0)
*signgamp = -1;
return one/fabsf(x);
}
- if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */
+ if(__builtin_expect(ix<0x1c800000, 0)) {
+ /* |x|<2**-70, return -log(|x|) */
if(hx<0) {
- *signgamp = -1;
- return -__ieee754_logf(-x);
+ *signgamp = -1;
+ return -__ieee754_logf(-x);
} else return -__ieee754_logf(x);
}
if(hx<0) {
- if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */
+ if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */
return x/zero;
t = sin_pif(x);
if(t==zero) return one/fabsf(t); /* -integer */
@@ -190,15 +171,15 @@ static float zero= 0.0000000000e+00;
if (ix==0x3f800000||ix==0x40000000) r = 0;
/* for x < 2.0 */
else if(ix<0x40000000) {
- if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */
+ if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */
r = -__ieee754_logf(x);
if(ix>=0x3f3b4a20) {y = one-x; i= 0;}
else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;}
- else {y = x; i=2;}
+ else {y = x; i=2;}
} else {
- r = zero;
- if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */
- else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */
+ r = zero;
+ if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */
+ else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */
else {y=x-one;i=2;}
}
switch(i) {
@@ -222,7 +203,7 @@ static float zero= 0.0000000000e+00;
r += (-(float)0.5*y + p1/p2);
}
}
- else if(ix<0x41000000) { /* x < 8.0 */
+ else if(ix<0x41000000) { /* x < 8.0 */
i = (int)x;
t = zero;
y = x-(float)i;
@@ -251,3 +232,4 @@ static float zero= 0.0000000000e+00;
if(hx<0) r = nadj - r;
return r;
}
+strong_alias (__ieee754_lgammaf_r, __lgammaf_r_finite)
diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
index cea3d91..72dcea6 100644
--- a/sysdeps/ieee754/flt-32/e_log10f.c
+++ b/sysdeps/ieee754/flt-32/e_log10f.c
@@ -13,55 +13,41 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_log10f.c,v 1.5 1995/05/10 20:45:53 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
two25 = 3.3554432000e+07, /* 0x4c000000 */
ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */
log10_2lo = 7.9034151668e-07; /* 0x355427db */
-#ifdef __STDC__
static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-#ifdef __STDC__
- float __ieee754_log10f(float x)
-#else
- float __ieee754_log10f(x)
- float x;
-#endif
+float
+__ieee754_log10f(float x)
{
float y,z;
int32_t i,k,hx;
GET_FLOAT_WORD(hx,x);
- k=0;
- if (hx < 0x00800000) { /* x < 2**-126 */
- if ((hx&0x7fffffff)==0)
- return -two25/(x-x); /* log(+-0)=-inf */
- if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */
- k -= 25; x *= two25; /* subnormal number, scale up x */
+ k=0;
+ if (hx < 0x00800000) { /* x < 2**-126 */
+ if (__builtin_expect((hx&0x7fffffff)==0, 0))
+ return -two25/(x-x); /* log(+-0)=-inf */
+ if (__builtin_expect(hx<0, 0))
+ return (x-x)/(x-x); /* log(-#) = NaN */
+ k -= 25; x *= two25; /* subnormal number, scale up x */
GET_FLOAT_WORD(hx,x);
- }
- if (hx >= 0x7f800000) return x+x;
+ }
+ if (__builtin_expect(hx >= 0x7f800000, 0)) return x+x;
k += (hx>>23)-127;
i = ((u_int32_t)k&0x80000000)>>31;
- hx = (hx&0x007fffff)|((0x7f-i)<<23);
- y = (float)(k+i);
+ hx = (hx&0x007fffff)|((0x7f-i)<<23);
+ y = (float)(k+i);
SET_FLOAT_WORD(x,hx);
z = y*log10_2lo + ivln10*__ieee754_logf(x);
return z+y*log10_2hi;
}
+strong_alias (__ieee754_log10f, __log10f_finite)
diff --git a/sysdeps/ieee754/flt-32/e_log2f.c b/sysdeps/ieee754/flt-32/e_log2f.c
index af3c6ea..7453214 100644
--- a/sysdeps/ieee754/flt-32/e_log2f.c
+++ b/sysdeps/ieee754/flt-32/e_log2f.c
@@ -18,11 +18,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
ln2 = 0.69314718055994530942,
two25 = 3.355443200e+07, /* 0x4c000000 */
Lg1 = 6.6666668653e-01, /* 3F2AAAAB */
@@ -33,18 +29,10 @@ Lg5 = 1.8183572590e-01, /* 3E3A3325 */
Lg6 = 1.5313838422e-01, /* 3E1CD04F */
Lg7 = 1.4798198640e-01; /* 3E178897 */
-#ifdef __STDC__
static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-#ifdef __STDC__
- float __ieee754_log2f(float x)
-#else
- float __ieee754_log2f(x)
- float x;
-#endif
+float
+__ieee754_log2f(float x)
{
float hfsq,f,s,z,R,w,t1,t2,dk;
int32_t k,ix,i,j;
@@ -53,13 +41,14 @@ static float zero = 0.0;
k=0;
if (ix < 0x00800000) { /* x < 2**-126 */
- if ((ix&0x7fffffff)==0)
+ if (__builtin_expect((ix&0x7fffffff)==0, 0))
return -two25/(x-x); /* log(+-0)=-inf */
- if (ix<0) return (x-x)/(x-x); /* log(-#) = NaN */
+ if (__builtin_expect(ix<0, 0))
+ return (x-x)/(x-x); /* log(-#) = NaN */
k -= 25; x *= two25; /* subnormal number, scale up x */
GET_FLOAT_WORD(ix,x);
}
- if (ix >= 0x7f800000) return x+x;
+ if (__builtin_expect(ix >= 0x7f800000, 0)) return x+x;
k += (ix>>23)-127;
ix &= 0x007fffff;
i = (ix+(0x95f64<<3))&0x800000;
@@ -72,7 +61,7 @@ static float zero = 0.0;
R = f*f*((float)0.5-(float)0.33333333333333333*f);
return dk-(R-f)/ln2;
}
- s = f/((float)2.0+f);
+ s = f/((float)2.0+f);
z = s*s;
i = ix-(0x6147a<<3);
w = z*z;
@@ -88,3 +77,4 @@ static float zero = 0.0;
return dk-((s*(f-R))-f)/ln2;
}
}
+strong_alias (__ieee754_log2f, __log2f_finite)
diff --git a/sysdeps/ieee754/flt-32/e_logf.c b/sysdeps/ieee754/flt-32/e_logf.c
index de8f869..b870b31 100644
--- a/sysdeps/ieee754/flt-32/e_logf.c
+++ b/sysdeps/ieee754/flt-32/e_logf.c
@@ -13,18 +13,10 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_logf.c,v 1.4 1995/05/10 20:45:54 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
two25 = 3.355443200e+07, /* 0x4c000000 */
@@ -36,18 +28,10 @@ Lg5 = 1.8183572590e-01, /* 3E3A3325 */
Lg6 = 1.5313838422e-01, /* 3E1CD04F */
Lg7 = 1.4798198640e-01; /* 3E178897 */
-#ifdef __STDC__
static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-#ifdef __STDC__
- float __ieee754_logf(float x)
-#else
- float __ieee754_logf(x)
- float x;
-#endif
+float
+__ieee754_logf(float x)
{
float hfsq,f,s,z,R,w,t1,t2,dk;
int32_t k,ix,i,j;
@@ -56,13 +40,14 @@ static float zero = 0.0;
k=0;
if (ix < 0x00800000) { /* x < 2**-126 */
- if ((ix&0x7fffffff)==0)
+ if (__builtin_expect((ix&0x7fffffff)==0, 0))
return -two25/(x-x); /* log(+-0)=-inf */
- if (ix<0) return (x-x)/(x-x); /* log(-#) = NaN */
+ if (__builtin_expect(ix<0, 0))
+ return (x-x)/(x-x); /* log(-#) = NaN */
k -= 25; x *= two25; /* subnormal number, scale up x */
GET_FLOAT_WORD(ix,x);
}
- if (ix >= 0x7f800000) return x+x;
+ if (__builtin_expect(ix >= 0x7f800000, 0)) return x+x;
k += (ix>>23)-127;
ix &= 0x007fffff;
i = (ix+(0x95f64<<3))&0x800000;
@@ -76,9 +61,9 @@ static float zero = 0.0;
}
R = f*f*((float)0.5-(float)0.33333333333333333*f);
if(k==0) return f-R; else {dk=(float)k;
- return dk*ln2_hi-((R-dk*ln2_lo)-f);}
+ return dk*ln2_hi-((R-dk*ln2_lo)-f);}
}
- s = f/((float)2.0+f);
+ s = f/((float)2.0+f);
dk = (float)k;
z = s*s;
i = ix-(0x6147a<<3);
@@ -97,3 +82,4 @@ static float zero = 0.0;
return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
}
}
+strong_alias (__ieee754_logf, __logf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_powf.c b/sysdeps/ieee754/flt-32/e_powf.c
index 9f52080..4600552 100644
--- a/sysdeps/ieee754/flt-32/e_powf.c
+++ b/sysdeps/ieee754/flt-32/e_powf.c
@@ -13,20 +13,12 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_powf.c,v 1.7 1996/04/08 15:43:44 phil Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
static const float huge = 1.0e+30, tiny = 1.0e-30;
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
bp[] = {1.0, 1.5,},
dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */
@@ -57,12 +49,8 @@ ivln2 = 1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */
ivln2_h = 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/
ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
-#ifdef __STDC__
- float __ieee754_powf(float x, float y)
-#else
- float __ieee754_powf(x,y)
- float x, y;
-#endif
+float
+__ieee754_powf(float x, float y)
{
float z,ax,z_h,z_l,p_h,p_l;
float y1,t1,t2,r,s,t,u,v,w;
@@ -81,8 +69,8 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
if(x == -1.0 && isinf(y)) return one;
/* +-NaN return x+y */
- if(ix > 0x7f800000 ||
- iy > 0x7f800000)
+ if(__builtin_expect(ix > 0x7f800000 ||
+ iy > 0x7f800000, 0))
return x+y;
/* determine if y is an odd int when x < 0
@@ -101,26 +89,26 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
}
/* special value of y */
- if (iy==0x7f800000) { /* y is +-inf */
+ if (__builtin_expect(iy==0x7f800000, 0)) { /* y is +-inf */
if (ix==0x3f800000)
- return y - y; /* inf**+-1 is NaN */
+ return y - y; /* inf**+-1 is NaN */
else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */
- return (hy>=0)? y: zero;
+ return (hy>=0)? y: zero;
else /* (|x|<1)**-,+inf = inf,0 */
- return (hy<0)?-y: zero;
+ return (hy<0)?-y: zero;
}
if(iy==0x3f800000) { /* y is +-1 */
if(hy<0) return one/x; else return x;
}
if(hy==0x40000000) return x*x; /* y is 2 */
if(hy==0x3f000000) { /* y is 0.5 */
- if(hx>=0) /* x >= +0 */
+ if(__builtin_expect(hx>=0, 1)) /* x >= +0 */
return __ieee754_sqrtf(x);
}
ax = fabsf(x);
/* special value of x */
- if(ix==0x7f800000||ix==0||ix==0x3f800000){
+ if(__builtin_expect(ix==0x7f800000||ix==0||ix==0x3f800000, 0)){
z = ax; /*x is +-0,+-inf,+-1*/
if(hy<0) z = one/z; /* z = (1/|x|) */
if(hx<0) {
@@ -133,10 +121,11 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
}
/* (x<0)**(non-int) is NaN */
- if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
+ if(__builtin_expect(((((u_int32_t)hx>>31)-1)|yisint)==0, 0))
+ return (x-x)/(x-x);
/* |y| is huge */
- if(iy>0x4d000000) { /* if |y| > 2**27 */
+ if(__builtin_expect(iy>0x4d000000, 0)) { /* if |y| > 2**27 */
/* over/underflow if x is not close to one */
if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny;
if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny;
@@ -214,14 +203,14 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
p_h = y1*t1;
z = p_l+p_h;
GET_FLOAT_WORD(j,z);
- if (j>0x43000000) /* if z > 128 */
+ if (__builtin_expect(j>0x43000000, 0)) /* if z > 128 */
return s*huge*huge; /* overflow */
- else if (j==0x43000000) { /* if z == 128 */
+ else if (__builtin_expect(j==0x43000000, 0)) { /* if z == 128 */
if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */
}
- else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */
+ else if (__builtin_expect((j&0x7fffffff)>0x43160000, 0))/* z <= -150 */
return s*tiny*tiny; /* underflow */
- else if ((u_int32_t) j==0xc3160000){ /* z == -150 */
+ else if (__builtin_expect((u_int32_t) j==0xc3160000, 0)){/* z == -150*/
if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */
}
/*
@@ -255,3 +244,4 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
else SET_FLOAT_WORD(z,j);
return s*z;
}
+strong_alias (__ieee754_powf, __powf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_remainderf.c b/sysdeps/ieee754/flt-32/e_remainderf.c
index 90d0d36..aaf15df 100644
--- a/sysdeps/ieee754/flt-32/e_remainderf.c
+++ b/sysdeps/ieee754/flt-32/e_remainderf.c
@@ -8,31 +8,19 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_remainderf.c,v 1.4 1995/05/10 20:46:08 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float zero = 0.0;
-#else
-static float zero = 0.0;
-#endif
-#ifdef __STDC__
- float __ieee754_remainderf(float x, float p)
-#else
- float __ieee754_remainderf(x,p)
- float x,p;
-#endif
+float
+__ieee754_remainderf(float x, float p)
{
int32_t hx,hp;
u_int32_t sx;
@@ -45,7 +33,7 @@ static float zero = 0.0;
hx &= 0x7fffffff;
/* purge off exception values */
- if(hp==0) return (x*p)/(x*p); /* p = 0 */
+ if(hp==0) return (x*p)/(x*p); /* p = 0 */
if((hx>=0x7f800000)|| /* x not finite */
((hp>0x7f800000))) /* p is NaN */
return (x*p)/(x*p);
@@ -71,3 +59,4 @@ static float zero = 0.0;
SET_FLOAT_WORD(x,hx^sx);
return x;
}
+strong_alias (__ieee754_remainderf, __remainderf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_sinhf.c b/sysdeps/ieee754/flt-32/e_sinhf.c
index 045f6f1..5813963 100644
--- a/sysdeps/ieee754/flt-32/e_sinhf.c
+++ b/sysdeps/ieee754/flt-32/e_sinhf.c
@@ -8,31 +8,19 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_sinhf.c,v 1.4 1995/05/10 20:46:15 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float one = 1.0, shuge = 1.0e37;
-#else
-static float one = 1.0, shuge = 1.0e37;
-#endif
-#ifdef __STDC__
- float __ieee754_sinhf(float x)
-#else
- float __ieee754_sinhf(x)
- float x;
-#endif
-{
+float
+__ieee754_sinhf(float x)
+{
float t,w,h;
int32_t ix,jx;
@@ -40,13 +28,13 @@ static float one = 1.0, shuge = 1.0e37;
ix = jx&0x7fffffff;
/* x is INF or NaN */
- if(ix>=0x7f800000) return x+x;
+ if(__builtin_expect(ix>=0x7f800000, 0)) return x+x;
h = 0.5;
if (jx<0) h = -h;
/* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x41b00000) { /* |x|<22 */
- if (ix<0x31800000) /* |x|<2**-28 */
+ if (__builtin_expect(ix<0x31800000, 0)) /* |x|<2**-28 */
if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
t = __expm1f(fabsf(x));
if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one));
@@ -66,3 +54,4 @@ static float one = 1.0, shuge = 1.0e37;
/* |x| > overflowthresold, sinh(x) overflow */
return x*shuge;
}
+strong_alias (__ieee754_sinhf, __sinhf_finite)
diff --git a/sysdeps/ieee754/flt-32/e_sqrtf.c b/sysdeps/ieee754/flt-32/e_sqrtf.c
index 7648ef4..6d6688c 100644
--- a/sysdeps/ieee754/flt-32/e_sqrtf.c
+++ b/sysdeps/ieee754/flt-32/e_sqrtf.c
@@ -8,43 +8,31 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_sqrtf.c,v 1.4 1995/05/10 20:46:19 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float one = 1.0, tiny=1.0e-30;
-#else
-static float one = 1.0, tiny=1.0e-30;
-#endif
-#ifdef __STDC__
- float __ieee754_sqrtf(float x)
-#else
- float __ieee754_sqrtf(x)
- float x;
-#endif
+float
+__ieee754_sqrtf(float x)
{
float z;
- int32_t sign = (int)0x80000000;
+ int32_t sign = (int)0x80000000;
int32_t ix,s,q,m,t,i;
u_int32_t r;
GET_FLOAT_WORD(ix,x);
/* take care of Inf and NaN */
- if((ix&0x7f800000)==0x7f800000) {
+ if((ix&0x7f800000)==0x7f800000) {
return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
sqrt(-inf)=sNaN */
- }
+ }
/* take care of zero */
if(ix<=0) {
if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */
@@ -69,12 +57,12 @@ static float one = 1.0, tiny=1.0e-30;
r = 0x01000000; /* r = moving bit from right to left */
while(r!=0) {
- t = s+r;
- if(t<=ix) {
- s = t+r;
- ix -= t;
- q += r;
- }
+ t = s+r;
+ if(t<=ix) {
+ s = t+r;
+ ix -= t;
+ q += r;
+ }
ix += ix;
r>>=1;
}
@@ -83,7 +71,7 @@ static float one = 1.0, tiny=1.0e-30;
if(ix!=0) {
z = one-tiny; /* trigger inexact flag */
if (z>=one) {
- z = one+tiny;
+ z = one+tiny;
if (z>one)
q += 2;
else
@@ -95,3 +83,4 @@ static float one = 1.0, tiny=1.0e-30;
SET_FLOAT_WORD(z,ix);
return z;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/ieee754/flt-32/s_asinhf.c b/sysdeps/ieee754/flt-32/s_asinhf.c
index fac256d..aa46f90 100644
--- a/sysdeps/ieee754/flt-32/s_asinhf.c
+++ b/sysdeps/ieee754/flt-32/s_asinhf.c
@@ -13,46 +13,36 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_asinhf.c,v 1.5 1995/05/12 04:57:39 jtc Exp $";
-#endif
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
one = 1.0000000000e+00, /* 0x3F800000 */
ln2 = 6.9314718246e-01, /* 0x3f317218 */
huge= 1.0000000000e+30;
-#ifdef __STDC__
- float __asinhf(float x)
-#else
- float __asinhf(x)
- float x;
-#endif
+float
+__asinhf(float x)
{
- float t,w;
+ float w;
int32_t hx,ix;
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
- if(ix>=0x7f800000) return x+x; /* x is inf or NaN */
- if(ix< 0x38000000) { /* |x|<2**-14 */
+ if(__builtin_expect(ix< 0x38000000, 0)) { /* |x|<2**-14 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
- if(ix>0x47000000) { /* |x| > 2**14 */
+ if(__builtin_expect(ix>0x47000000, 0)) { /* |x| > 2**14 */
+ if(ix>=0x7f800000) return x+x; /* x is inf or NaN */
w = __ieee754_logf(fabsf(x))+ln2;
- } else if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */
- t = fabsf(x);
- w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t));
- } else { /* 2.0 > |x| > 2**-14 */
- t = x*x;
- w =__log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t)));
+ } else {
+ float xa = fabsf(x);
+ if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */
+ w = __ieee754_logf(2.0f*xa+one/(__ieee754_sqrtf(xa*xa+one)+xa));
+ } else { /* 2.0 > |x| > 2**-14 */
+ float t = xa*xa;
+ w =__log1pf(xa+t/(one+__ieee754_sqrtf(one+t)));
+ }
}
- if(hx>0) return w; else return -w;
+ return __copysignf(w, x);
}
weak_alias (__asinhf, asinhf)
diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index ede5157..229c498 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -94,12 +94,8 @@ static double zero = 0.0; /* used as const */
*/
-#ifdef __STDC__
- double __kernel_standard(double x, double y, int type)
-#else
- double __kernel_standard(x,y,type)
- double x,y; int type;
-#endif
+double
+__kernel_standard(double x, double y, int type)
{
struct exception exc;
#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
@@ -150,7 +146,7 @@ static double zero = 0.0; /* used as const */
__set_errno (EDOM);
else if (!matherr(&exc)) {
if(_LIB_VERSION == _SVID_) {
- (void) WRITE2("asin: DOMAIN error\n", 19);
+ (void) WRITE2("asin: DOMAIN error\n", 19);
}
__set_errno (EDOM);
}
@@ -361,14 +357,14 @@ static double zero = 0.0; /* used as const */
exc.type = OVERFLOW;
exc.name = type < 100 ? "lgamma" : (type < 200
? "lgammaf" : "lgammal");
- if (_LIB_VERSION == _SVID_)
- exc.retval = HUGE;
- else
- exc.retval = HUGE_VAL;
- if (_LIB_VERSION == _POSIX_)
+ if (_LIB_VERSION == _SVID_)
+ exc.retval = HUGE;
+ else
+ exc.retval = HUGE_VAL;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
__set_errno (ERANGE);
- else if (!matherr(&exc)) {
- __set_errno (ERANGE);
}
break;
case 15:
@@ -378,10 +374,10 @@ static double zero = 0.0; /* used as const */
exc.type = SING;
exc.name = type < 100 ? "lgamma" : (type < 200
? "lgammaf" : "lgammal");
- if (_LIB_VERSION == _SVID_)
- exc.retval = HUGE;
- else
- exc.retval = HUGE_VAL;
+ if (_LIB_VERSION == _SVID_)
+ exc.retval = HUGE;
+ else
+ exc.retval = HUGE_VAL;
if (_LIB_VERSION == _POSIX_)
__set_errno (ERANGE);
else if (!matherr(&exc)) {
@@ -611,95 +607,95 @@ static double zero = 0.0; /* used as const */
__set_errno (EDOM);
}
break;
- case 27:
+ case 27:
case 127:
case 227:
- /* fmod(x,0) */
- exc.type = DOMAIN;
- exc.name = type < 100 ? "fmod" : (type < 200
+ /* fmod(x,0) */
+ exc.type = DOMAIN;
+ exc.name = type < 100 ? "fmod" : (type < 200
? "fmodf" : "fmodl");
- if (_LIB_VERSION == _SVID_)
- exc.retval = x;
+ if (_LIB_VERSION == _SVID_)
+ exc.retval = x;
else
exc.retval = zero/zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (EDOM);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2("fmod: DOMAIN error\n", 20);
- }
- __set_errno (EDOM);
- }
- break;
- case 28:
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (EDOM);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2("fmod: DOMAIN error\n", 20);
+ }
+ __set_errno (EDOM);
+ }
+ break;
+ case 28:
case 128:
case 228:
- /* remainder(x,0) */
- exc.type = DOMAIN;
- exc.name = type < 100 ? "remainder" : (type < 200
+ /* remainder(x,0) */
+ exc.type = DOMAIN;
+ exc.name = type < 100 ? "remainder" : (type < 200
? "remainderf"
: "remainderl");
- exc.retval = zero/zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (EDOM);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2("remainder: DOMAIN error\n", 24);
- }
- __set_errno (EDOM);
- }
- break;
- case 29:
+ exc.retval = zero/zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (EDOM);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2("remainder: DOMAIN error\n", 24);
+ }
+ __set_errno (EDOM);
+ }
+ break;
+ case 29:
case 129:
case 229:
- /* acosh(x<1) */
- exc.type = DOMAIN;
- exc.name = type < 100 ? "acosh" : (type < 200
+ /* acosh(x<1) */
+ exc.type = DOMAIN;
+ exc.name = type < 100 ? "acosh" : (type < 200
? "acoshf" : "acoshl");
- exc.retval = zero/zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (EDOM);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2("acosh: DOMAIN error\n", 20);
- }
- __set_errno (EDOM);
- }
- break;
- case 30:
+ exc.retval = zero/zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (EDOM);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2("acosh: DOMAIN error\n", 20);
+ }
+ __set_errno (EDOM);
+ }
+ break;
+ case 30:
case 130:
case 230:
- /* atanh(|x|>1) */
- exc.type = DOMAIN;
- exc.name = type < 100 ? "atanh" : (type < 200
+ /* atanh(|x|>1) */
+ exc.type = DOMAIN;
+ exc.name = type < 100 ? "atanh" : (type < 200
? "atanhf" : "atanhl");
- exc.retval = zero/zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (EDOM);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2("atanh: DOMAIN error\n", 20);
- }
- __set_errno (EDOM);
- }
- break;
- case 31:
+ exc.retval = zero/zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (EDOM);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2("atanh: DOMAIN error\n", 20);
+ }
+ __set_errno (EDOM);
+ }
+ break;
+ case 31:
case 131:
case 231:
- /* atanh(|x|=1) */
- exc.type = SING;
- exc.name = type < 100 ? "atanh" : (type < 200
+ /* atanh(|x|=1) */
+ exc.type = SING;
+ exc.name = type < 100 ? "atanh" : (type < 200
? "atanhf" : "atanhl");
exc.retval = x/zero; /* sign(x)*inf */
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2("atanh: SING error\n", 18);
- }
- __set_errno (EDOM);
- }
- break;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2("atanh: SING error\n", 18);
+ }
+ __set_errno (EDOM);
+ }
+ break;
case 32:
case 132:
case 232:
@@ -732,103 +728,103 @@ static double zero = 0.0; /* used as const */
case 134:
case 234:
/* j0(|x|>X_TLOSS) */
- exc.type = TLOSS;
- exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l");
- exc.retval = zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2(exc.name, 2);
- (void) WRITE2(": TLOSS error\n", 14);
- }
- __set_errno (ERANGE);
- }
+ exc.type = TLOSS;
+ exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2(exc.name, 2);
+ (void) WRITE2(": TLOSS error\n", 14);
+ }
+ __set_errno (ERANGE);
+ }
break;
case 35:
case 135:
case 235:
/* y0(x>X_TLOSS) */
- exc.type = TLOSS;
- exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l");
- exc.retval = zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2(exc.name, 2);
- (void) WRITE2(": TLOSS error\n", 14);
- }
- __set_errno (ERANGE);
- }
+ exc.type = TLOSS;
+ exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2(exc.name, 2);
+ (void) WRITE2(": TLOSS error\n", 14);
+ }
+ __set_errno (ERANGE);
+ }
break;
case 36:
case 136:
case 236:
/* j1(|x|>X_TLOSS) */
- exc.type = TLOSS;
- exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l");
- exc.retval = zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2(exc.name, 2);
- (void) WRITE2(": TLOSS error\n", 14);
- }
- __set_errno (ERANGE);
- }
+ exc.type = TLOSS;
+ exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2(exc.name, 2);
+ (void) WRITE2(": TLOSS error\n", 14);
+ }
+ __set_errno (ERANGE);
+ }
break;
case 37:
case 137:
case 237:
/* y1(x>X_TLOSS) */
- exc.type = TLOSS;
- exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l");
- exc.retval = zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2(exc.name, 2);
- (void) WRITE2(": TLOSS error\n", 14);
- }
- __set_errno (ERANGE);
- }
+ exc.type = TLOSS;
+ exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2(exc.name, 2);
+ (void) WRITE2(": TLOSS error\n", 14);
+ }
+ __set_errno (ERANGE);
+ }
break;
case 38:
case 138:
case 238:
/* jn(|x|>X_TLOSS) */
- exc.type = TLOSS;
- exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl");
- exc.retval = zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2(exc.name, 2);
- (void) WRITE2(": TLOSS error\n", 14);
- }
- __set_errno (ERANGE);
- }
+ exc.type = TLOSS;
+ exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2(exc.name, 2);
+ (void) WRITE2(": TLOSS error\n", 14);
+ }
+ __set_errno (ERANGE);
+ }
break;
case 39:
case 139:
case 239:
/* yn(x>X_TLOSS) */
- exc.type = TLOSS;
- exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl");
- exc.retval = zero;
- if (_LIB_VERSION == _POSIX_)
- __set_errno (ERANGE);
- else if (!matherr(&exc)) {
- if (_LIB_VERSION == _SVID_) {
- (void) WRITE2(exc.name, 2);
- (void) WRITE2(": TLOSS error\n", 14);
- }
- __set_errno (ERANGE);
- }
+ exc.type = TLOSS;
+ exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_) {
+ (void) WRITE2(exc.name, 2);
+ (void) WRITE2(": TLOSS error\n", 14);
+ }
+ __set_errno (ERANGE);
+ }
break;
case 40:
case 140:
@@ -838,11 +834,11 @@ static double zero = 0.0; /* used as const */
exc.name = type < 100 ? "tgamma" : (type < 200
? "tgammaf" : "tgammal");
exc.retval = HUGE_VAL;
- if (_LIB_VERSION == _POSIX_)
+ if (_LIB_VERSION == _POSIX_)
__set_errno (ERANGE);
- else if (!matherr(&exc)) {
- __set_errno (ERANGE);
- }
+ else if (!matherr(&exc)) {
+ __set_errno (ERANGE);
+ }
break;
case 41:
case 141:
@@ -995,3 +991,10 @@ static double zero = 0.0; /* used as const */
}
return exc.retval;
}
+
+
+float
+__kernel_standard_f(float x, float y, int type)
+{
+ return __kernel_standard(x, y, type);
+}
diff --git a/sysdeps/ieee754/ldbl-128/e_acoshl.c b/sysdeps/ieee754/ldbl-128/e_acoshl.c
index 62170d4..2a74e9c 100644
--- a/sysdeps/ieee754/ldbl-128/e_acoshl.c
+++ b/sysdeps/ieee754/ldbl-128/e_acoshl.c
@@ -30,20 +30,12 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
one = 1.0,
ln2 = 0.6931471805599453094172321214581766L;
-#ifdef __STDC__
- long double __ieee754_acoshl(long double x)
-#else
- long double __ieee754_acoshl(x)
- long double x;
-#endif
+long double
+__ieee754_acoshl(long double x)
{
long double t;
u_int64_t lx;
@@ -53,7 +45,7 @@ ln2 = 0.6931471805599453094172321214581766L;
return (x-x)/(x-x);
} else if(hx >=0x4035000000000000LL) { /* x > 2**54 */
if(hx >=0x7fff000000000000LL) { /* x is inf of NaN */
- return x+x;
+ return x+x;
} else
return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */
} else if(((hx-0x3fff000000000000LL)|lx)==0) {
@@ -66,3 +58,4 @@ ln2 = 0.6931471805599453094172321214581766L;
return __log1pl(t+__sqrtl(2.0L*t+t*t));
}
}
+strong_alias (__ieee754_acoshl, __acoshl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_acosl.c b/sysdeps/ieee754/ldbl-128/e_acosl.c
index 284e86a..a750369 100644
--- a/sysdeps/ieee754/ldbl-128/e_acosl.c
+++ b/sysdeps/ieee754/ldbl-128/e_acosl.c
@@ -12,9 +12,9 @@
/*
Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -57,11 +57,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
one = 1.0L,
pio2_hi = 1.5707963267948966192313216916397514420986L,
pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
@@ -152,14 +148,8 @@ static long double
qS8 = -4.175375777334867025769346564600396877176E1L;
/* 1.000000000000000000000000000000000000000E0 */
-#ifdef __STDC__
long double
__ieee754_acosl (long double x)
-#else
-long double
-__ieee754_acosl (x)
- long double x;
-#endif
{
long double z, r, w, p, q, s, t, f2;
int32_t ix, sign;
@@ -283,11 +273,11 @@ __ieee754_acosl (x)
s = __ieee754_sqrtl (z);
/* Compute an extended precision square root from
the Newton iteration s -> 0.5 * (s + z / s).
- The change w from s to the improved value is
+ The change w from s to the improved value is
w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s.
- Express s = f1 + f2 where f1 * f1 is exactly representable.
+ Express s = f1 + f2 where f1 * f1 is exactly representable.
w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
- s + w has extended precision. */
+ s + w has extended precision. */
u.value = s;
u.parts32.w2 = 0;
u.parts32.w3 = 0;
@@ -326,3 +316,4 @@ __ieee754_acosl (x)
return 2.0 * w;
}
}
+strong_alias (__ieee754_acosl, __acosl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_asinl.c b/sysdeps/ieee754/ldbl-128/e_asinl.c
index 89f5d79..e82b03f 100644
--- a/sysdeps/ieee754/ldbl-128/e_asinl.c
+++ b/sysdeps/ieee754/ldbl-128/e_asinl.c
@@ -12,9 +12,9 @@
/*
Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
- reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under the
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under the
following terms:
This library is free software; you can redistribute it and/or
@@ -263,3 +263,4 @@ __ieee754_asinl (x)
else
return -t;
}
+strong_alias (__ieee754_asinl, __asinl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_atan2l.c b/sysdeps/ieee754/ldbl-128/e_atan2l.c
index 2bbb3b8..bba3c9b 100644
--- a/sysdeps/ieee754/ldbl-128/e_atan2l.c
+++ b/sysdeps/ieee754/ldbl-128/e_atan2l.c
@@ -17,7 +17,7 @@
* Method :
* 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x).
* 2. Reduce x to positive by (if x and y are unexceptional):
- * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
*
* Special cases:
@@ -43,11 +43,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
tiny = 1.0e-4900L,
zero = 0.0,
pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */
@@ -55,12 +51,8 @@ pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898
pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */
pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */
-#ifdef __STDC__
- long double __ieee754_atan2l(long double y, long double x)
-#else
- long double __ieee754_atan2l(y,x)
- long double y,x;
-#endif
+long double
+__ieee754_atan2l(long double y, long double x)
{
long double z;
int64_t k,m,hx,hy,ix,iy;
@@ -80,7 +72,7 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74
if((iy|ly)==0) {
switch(m) {
case 0:
- case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
@@ -111,19 +103,20 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74
/* compute y/x */
k = (iy-ix)>>48;
- if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
- else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
+ if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
+ else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
else z=__atanl(fabsl(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: {
- u_int64_t zh;
+ u_int64_t zh;
GET_LDOUBLE_MSW64(zh,z);
SET_LDOUBLE_MSW64(z,zh ^ 0x8000000000000000ULL);
}
return z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
- return (z-pi_lo)-pi;/* atan(-,-) */
+ return (z-pi_lo)-pi;/* atan(-,-) */
}
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_atanhl.c b/sysdeps/ieee754/ldbl-128/e_atanhl.c
index dd681c8..334c4bd 100644
--- a/sysdeps/ieee754/ldbl-128/e_atanhl.c
+++ b/sysdeps/ieee754/ldbl-128/e_atanhl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_atanhl(x)
* Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
@@ -26,7 +22,7 @@ static char rcsid[] = "$NetBSD: $";
* atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
* 2 1 - x 1 - x
*
- * For x<0.5
+ * For x<0.5
* atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x))
*
* Special cases:
@@ -39,24 +35,12 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0L, huge = 1e4900L;
-#else
-static long double one = 1.0L, huge = 1e4900L;
-#endif
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static double long zero = 0.0L;
-#endif
-#ifdef __STDC__
- long double __ieee754_atanhl(long double x)
-#else
- long double __ieee754_atanhl(x)
- long double x;
-#endif
+long double
+__ieee754_atanhl(long double x)
{
long double t;
u_int32_t jx, ix;
@@ -82,3 +66,4 @@ static double long zero = 0.0L;
t = 0.5*__log1pl((u.value+u.value)/(one-u.value));
if(jx & 0x80000000) return -t; else return t;
}
+strong_alias (__ieee754_atanhl, __atanhl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_coshl.c b/sysdeps/ieee754/ldbl-128/e_coshl.c
index 3913e34..dfe8d47 100644
--- a/sysdeps/ieee754/ldbl-128/e_coshl.c
+++ b/sysdeps/ieee754/ldbl-128/e_coshl.c
@@ -11,9 +11,9 @@
/* Changes for 128-bit long double are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -54,22 +54,11 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, half = 0.5, huge = 1.0e4900L,
ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
-#else
-static long double one = 1.0, half = 0.5, huge = 1.0e4900L,
-ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
-#endif
-#ifdef __STDC__
long double
__ieee754_coshl (long double x)
-#else
-long double
-__ieee754_coshl (x)
- long double x;
-#endif
{
long double t, w;
int32_t ex;
@@ -118,3 +107,4 @@ __ieee754_coshl (x)
/* |x| > overflowthresold, cosh(x) overflow */
return huge * huge;
}
+strong_alias (__ieee754_coshl, __coshl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_fmodl.c b/sysdeps/ieee754/ldbl-128/e_fmodl.c
index 1043f69..05665a9 100644
--- a/sysdeps/ieee754/ldbl-128/e_fmodl.c
+++ b/sysdeps/ieee754/ldbl-128/e_fmodl.c
@@ -3,16 +3,16 @@
*/
/*
* ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright (C) 1993, 2011 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
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
-/*
+/*
* __ieee754_fmodl(x,y)
* Return x mod y in exact arithmetic
* Method: shift and subtract
@@ -21,18 +21,10 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, Zero[] = {0.0, -0.0,};
-#else
-static long double one = 1.0, Zero[] = {0.0, -0.0,};
-#endif
-#ifdef __STDC__
- long double __ieee754_fmodl(long double x, long double y)
-#else
- long double __ieee754_fmodl(x,y)
- long double x,y;
-#endif
+long double
+__ieee754_fmodl (long double x, long double y)
{
int64_t n,hx,hy,hz,ix,iy,sx,i;
u_int64_t lx,ly,lz;
@@ -49,7 +41,7 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
return (x*y)/(x*y);
if(hx<=hy) {
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
- if(lx==ly)
+ if(lx==ly)
return Zero[(u_int64_t)sx>>63]; /* |x|=|y| return x*0*/
}
@@ -72,25 +64,25 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
} else iy = (hy>>48)-0x3fff;
/* set up {hx,lx}, {hy,ly} and align y to x */
- if(ix >= -16382)
+ if(ix >= -16382)
hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
else { /* subnormal x, shift x to normal */
n = -16382-ix;
if(n<=63) {
- hx = (hx<<n)|(lx>>(64-n));
- lx <<= n;
+ hx = (hx<<n)|(lx>>(64-n));
+ lx <<= n;
} else {
hx = lx<<(n-64);
lx = 0;
}
}
- if(iy >= -16382)
+ if(iy >= -16382)
hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy);
else { /* subnormal y, shift y to normal */
n = -16382-iy;
if(n<=63) {
- hy = (hy<<n)|(ly>>(64-n));
- ly <<= n;
+ hy = (hy<<n)|(ly>>(64-n));
+ ly <<= n;
} else {
hy = ly<<(n-64);
ly = 0;
@@ -103,17 +95,17 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
else {
- if((hz|lz)==0) /* return sign(x)*0 */
+ if((hz|lz)==0) /* return sign(x)*0 */
return Zero[(u_int64_t)sx>>63];
- hx = hz+hz+(lz>>63); lx = lz+lz;
+ hx = hz+hz+(lz>>63); lx = lz+lz;
}
}
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz>=0) {hx=hz;lx=lz;}
/* convert back to floating value and restore the sign */
- if((hx|lx)==0) /* return sign(x)*0 */
- return Zero[(u_int64_t)sx>>63];
+ if((hx|lx)==0) /* return sign(x)*0 */
+ return Zero[(u_int64_t)sx>>63];
while(hx<0x0001000000000000LL) { /* normalize x */
hx = hx+hx+(lx>>63); lx = lx+lx;
iy -= 1;
@@ -136,3 +128,4 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
}
return x; /* exact output */
}
+strong_alias (__ieee754_fmodl, __fmodl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_gammal_r.c b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
index 36f5d45..2dbe6ac 100644
--- a/sysdeps/ieee754/ldbl-128/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
@@ -1,8 +1,8 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002, 2004, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
- Jakub Jelinek <jj@ultra.linux.cz, 1999.
+ Jakub Jelinek <jj@ultra.linux.cz, 1999.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -56,3 +56,4 @@ __ieee754_gammal_r (long double x, int *signgamp)
/* XXX FIXME. */
return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
}
+strong_alias (__ieee754_gammal_r, __gammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_hypotl.c b/sysdeps/ieee754/ldbl-128/e_hypotl.c
index 6834eac..dad78fe 100644
--- a/sysdeps/ieee754/ldbl-128/e_hypotl.c
+++ b/sysdeps/ieee754/ldbl-128/e_hypotl.c
@@ -13,10 +13,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
-#endif
-
/* __ieee754_hypotl(x,y)
*
* Method :
@@ -45,19 +41,15 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
* hypotl(x,y) is NAN if x or y is NAN.
*
* Accuracy:
- * hypotl(x,y) returns sqrtl(x^2+y^2) with error less
- * than 1 ulps (units in the last place)
+ * hypotl(x,y) returns sqrtl(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
- long double __ieee754_hypotl(long double x, long double y)
-#else
- long double __ieee754_hypotl(x,y)
- long double x, y;
-#endif
+long double
+__ieee754_hypotl(long double x, long double y)
{
long double a,b,t1,t2,y1,y2,w;
int64_t j,k,ha,hb;
@@ -89,7 +81,7 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
}
if(hb < 0x20bf000000000000LL) { /* b < 2**-8000 */
if(hb <= 0x0000ffffffffffffLL) { /* subnormal b or 0 */
- u_int64_t low;
+ u_int64_t low;
GET_LDOUBLE_LSW64(low,b);
if((hb|low)==0) return a;
t1=0;
@@ -98,7 +90,7 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
a *= t1;
k -= 16382;
} else { /* scale a and b by 2^9600 */
- ha += 0x2580000000000000LL; /* a *= 2^9600 */
+ ha += 0x2580000000000000LL; /* a *= 2^9600 */
hb += 0x2580000000000000LL; /* b *= 2^9600 */
k -= 9600;
SET_LDOUBLE_MSW64(a,ha);
@@ -130,3 +122,4 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
return t1*w;
} else return w;
}
+strong_alias (__ieee754_hypotl, __hypotl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index bcd57e2..ef718b9 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -779,6 +779,7 @@ __ieee754_j0l (long double x)
z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx);
return z;
}
+strong_alias (__ieee754_j0l, __j0l_finite)
/* Y0(x) = 2/pi * log(x) * J0(x) + R(x^2)
@@ -918,3 +919,4 @@ long double
z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (x);
return z;
}
+strong_alias (__ieee754_y0l, __y0l_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c
index 7b73e2e..8d92b4f 100644
--- a/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -786,6 +786,7 @@ __ieee754_j1l (long double x)
z = -z;
return z;
}
+strong_alias (__ieee754_j1l, __j1l_finite)
/* Y1(x) = 2/pi * (log(x) * J1(x) - 1/x) + x R(x^2)
@@ -925,3 +926,4 @@ __ieee754_y1l (long double x)
z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (xx);
return z;
}
+strong_alias (__ieee754_y1l, __y1l_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c
index a7f6772..8159163 100644
--- a/sysdeps/ieee754/ldbl-128/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-128/e_jnl.c
@@ -11,9 +11,9 @@
/* Modifications for 128-bit long double are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -59,26 +59,15 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
invsqrtpi = 5.6418958354775628694807945156077258584405E-1L,
two = 2.0e0L,
one = 1.0e0L,
zero = 0.0L;
-#ifdef __STDC__
long double
__ieee754_jnl (int n, long double x)
-#else
-long double
-__ieee754_jnl (n, x)
- int n;
- long double x;
-#endif
{
u_int32_t se;
int32_t i, ix, sgn;
@@ -302,16 +291,10 @@ __ieee754_jnl (n, x)
else
return b;
}
+strong_alias (__ieee754_jnl, __jnl_finite)
-#ifdef __STDC__
long double
__ieee754_ynl (int n, long double x)
-#else
-long double
-__ieee754_ynl (n, x)
- int n;
- long double x;
-#endif
{
u_int32_t se;
int32_t i, ix;
@@ -407,3 +390,4 @@ __ieee754_ynl (n, x)
else
return -b;
}
+strong_alias (__ieee754_ynl, __ynl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
index d080448..2482296 100644
--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
@@ -754,15 +754,8 @@ deval (long double x, const long double *p, int n)
}
-#ifdef __STDC__
long double
__ieee754_lgammal_r (long double x, int *signgamp)
-#else
-long double
-__ieee754_lgammal_r (x, signgamp)
- long double x;
- int *signgamp;
-#endif
{
long double p, q, w, z, nx;
int i, nn;
@@ -775,7 +768,7 @@ __ieee754_lgammal_r (x, signgamp)
if (x == 0.0L)
{
if (__signbitl (x))
- *signgamp = -1;
+ *signgamp = -1;
}
if (x < 0.0L)
@@ -863,7 +856,7 @@ __ieee754_lgammal_r (x, signgamp)
{
z = x - 0.75L;
p = z * neval (z, RN1r75, NRN1r75)
- / deval (z, RD1r75, NRD1r75);
+ / deval (z, RD1r75, NRD1r75);
p += lgam1r75b;
p += lgam1r75a;
}
@@ -1040,3 +1033,4 @@ __ieee754_lgammal_r (x, signgamp)
q += neval (p, RASY, NRASY) / x;
return (q);
}
+strong_alias (__ieee754_lgammal_r, __lgammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_log10l.c b/sysdeps/ieee754/ldbl-128/e_log10l.c
index 1213177..6e69bbd 100644
--- a/sysdeps/ieee754/ldbl-128/e_log10l.c
+++ b/sysdeps/ieee754/ldbl-128/e_log10l.c
@@ -58,7 +58,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -179,8 +179,7 @@ deval (long double x, const long double *p, int n)
long double
-__ieee754_log10l (x)
- long double x;
+__ieee754_log10l (long double x)
{
long double z;
long double y;
@@ -256,3 +255,4 @@ done:
z += e * L102A;
return (z);
}
+strong_alias (__ieee754_log10l, __log10l_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_log2l.c b/sysdeps/ieee754/ldbl-128/e_log2l.c
index 8663d78..9a02394 100644
--- a/sysdeps/ieee754/ldbl-128/e_log2l.c
+++ b/sysdeps/ieee754/ldbl-128/e_log2l.c
@@ -57,7 +57,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "math.h"
@@ -248,3 +248,4 @@ done:
z += e;
return (z);
}
+strong_alias (__ieee754_log2l, __log2l_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_logl.c b/sysdeps/ieee754/ldbl-128/e_logl.c
index b9e17f8..6d53287 100644
--- a/sysdeps/ieee754/ldbl-128/e_logl.c
+++ b/sysdeps/ieee754/ldbl-128/e_logl.c
@@ -42,7 +42,7 @@
*
*/
-/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -251,7 +251,7 @@ __ieee754_logl(long double x)
/* log(u) = log( t u/t ) = log(t) + log(u/t)
log(t) is tabulated in the lookup table.
Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t.
- cf. Cody & Waite. */
+ cf. Cody & Waite. */
z = (u.value - t.value) / t.value;
}
/* Series expansion of log(1+z). */
@@ -277,3 +277,4 @@ __ieee754_logl(long double x)
y += e * ln2a;
return y;
}
+strong_alias (__ieee754_logl, __logl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c
index ba7e27b..d8e1af0 100644
--- a/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -11,9 +11,9 @@
/* Expansions and modifications for 128-bit long double are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -144,14 +144,8 @@ static const long double
cp_h = 9.6179669392597555432899980587535537779331E-1L,
cp_l = 5.0577616648125906047157785230014751039424E-17L;
-#ifdef __STDC__
long double
__ieee754_powl (long double x, long double y)
-#else
-long double
-__ieee754_powl (x, y)
- long double x, y;
-#endif
{
long double z, ax, z_h, z_l, p_h, p_l;
long double y1, t1, t2, r, s, t, u, v, w;
@@ -445,3 +439,4 @@ __ieee754_powl (x, y)
}
return s * z;
}
+strong_alias (__ieee754_powl, __powl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_remainderl.c b/sysdeps/ieee754/ldbl-128/e_remainderl.c
index 81af247..8423380 100644
--- a/sysdeps/ieee754/ldbl-128/e_remainderl.c
+++ b/sysdeps/ieee754/ldbl-128/e_remainderl.c
@@ -7,36 +7,28 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* __ieee754_remainderl(x,p)
- * Return :
- * returns x REM p = x - [x/p]*p as if in infinite
- * precise arithmetic, where [x/p] is the (infinite bit)
+ * Return :
+ * returns x REM p = x - [x/p]*p as if in infinite
+ * precise arithmetic, where [x/p] is the (infinite bit)
* integer nearest x/p (in half way case choose the even one).
- * Method :
+ * Method :
* Based on fmodl() return x-[x/p]chopped*p exactlp.
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
- long double __ieee754_remainderl(long double x, long double p)
-#else
- long double __ieee754_remainderl(x,p)
- long double x,p;
-#endif
+long double
+__ieee754_remainderl(long double x, long double p)
{
int64_t hx,hp;
u_int64_t sx,lx,lp;
@@ -49,7 +41,7 @@ static long double zero = 0.0L;
hx &= 0x7fffffffffffffffLL;
/* purge off exception values */
- if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */
+ if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */
if((hx>=0x7fff000000000000LL)|| /* x not finite */
((hp>=0x7fff000000000000LL)&& /* p is NaN */
(((hp-0x7fff000000000000LL)|lp)!=0)))
@@ -76,3 +68,4 @@ static long double zero = 0.0L;
SET_LDOUBLE_MSW64(x,hx^sx);
return x;
}
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/sysdeps/ieee754/ldbl-128/e_sinhl.c b/sysdeps/ieee754/ldbl-128/e_sinhl.c
index 93f4179..ac36cac 100644
--- a/sysdeps/ieee754/ldbl-128/e_sinhl.c
+++ b/sysdeps/ieee754/ldbl-128/e_sinhl.c
@@ -16,9 +16,9 @@
/* Changes for 128-bit long double are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -56,22 +56,11 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, shuge = 1.0e4931L,
ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
-#else
-static long double one = 1.0, shuge = 1.0e4931L,
-ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
-#endif
-#ifdef __STDC__
long double
__ieee754_sinhl (long double x)
-#else
-long double
-__ieee754_sinhl (x)
- long double x;
-#endif
{
long double t, w, h;
u_int32_t jx, ix;
@@ -121,3 +110,4 @@ __ieee754_sinhl (x)
/* |x| > overflowthreshold, sinhl(x) overflow */
return x * shuge;
}
+strong_alias (__ieee754_sinhl, __sinhl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
index 00576c7..20d94ea 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
-#endif
-
/* __ieee754_acosh(x)
* Method :
* Based on
@@ -31,20 +27,12 @@ static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
one = 1.0L,
ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */
-#ifdef __STDC__
- long double __ieee754_acoshl(long double x)
-#else
- long double __ieee754_acoshl(x)
- long double x;
-#endif
+long double
+__ieee754_acoshl(long double x)
{
long double t;
int64_t hx;
@@ -54,7 +42,7 @@ ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */
return (x-x)/(x-x);
} else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */
if(hx >=0x7ff0000000000000LL) { /* x is inf of NaN */
- return x+x;
+ return x+x;
} else
return __ieee754_logl(x)+ln2; /* acosh(huge)=log(2x) */
} else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) {
@@ -67,3 +55,4 @@ ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */
return __log1p(t+__sqrtl(2.0*t+t*t));
}
}
+strong_alias (__ieee754_acoshl, __acoshl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
index 8823fd6..1b37c92 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
@@ -283,11 +283,11 @@ __ieee754_acosl (x)
s = __ieee754_sqrtl (z);
/* Compute an extended precision square root from
the Newton iteration s -> 0.5 * (s + z / s).
- The change w from s to the improved value is
+ The change w from s to the improved value is
w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s.
- Express s = f1 + f2 where f1 * f1 is exactly representable.
+ Express s = f1 + f2 where f1 * f1 is exactly representable.
w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
- s + w has extended precision. */
+ s + w has extended precision. */
u.value = s;
u.parts32.w2 = 0;
u.parts32.w3 = 0;
@@ -326,3 +326,4 @@ __ieee754_acosl (x)
return 2.0 * w;
}
}
+strong_alias (__ieee754_acosl, __acosl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
index 3696694..6c61232 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
@@ -12,9 +12,9 @@
/*
Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
- reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under the
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under the
following terms:
This library is free software; you can redistribute it and/or
@@ -263,3 +263,4 @@ __ieee754_asinl (x)
else
return -t;
}
+strong_alias (__ieee754_asinl, __asinl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
index a4bb53d..a5b6621 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
@@ -17,7 +17,7 @@
* Method :
* 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x).
* 2. Reduce x to positive by (if x and y are unexceptional):
- * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
*
* Special cases:
@@ -43,11 +43,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
tiny = 1.0e-300L,
zero = 0.0,
pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */
@@ -55,12 +51,8 @@ pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898
pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */
pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */
-#ifdef __STDC__
- long double __ieee754_atan2l(long double y, long double x)
-#else
- long double __ieee754_atan2l(y,x)
- long double y,x;
-#endif
+long double
+__ieee754_atan2l(long double y, long double x)
{
long double z;
int64_t k,m,hx,hy,ix,iy;
@@ -80,7 +72,7 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74
if((iy|(ly&0x7fffffffffffffffLL))==0) {
switch(m) {
case 0:
- case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
@@ -111,14 +103,15 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74
/* compute y/x */
k = (iy-ix)>>52;
- if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
- else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
+ if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
+ else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
else z=__atanl(fabsl(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: return -z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
- return (z-pi_lo)-pi;/* atan(-,-) */
+ return (z-pi_lo)-pi;/* atan(-,-) */
}
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
index a801bd6..c879e45 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
-#endif
-
/* __ieee754_atanh(x)
* Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
@@ -22,7 +18,7 @@ static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
* atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
* 2 1 - x 1 - x
*
- * For x<0.5
+ * For x<0.5
* atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
*
* Special cases:
@@ -35,24 +31,12 @@ static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0L, huge = 1e300L;
-#else
-static long double one = 1.0L, huge = 1e300L;
-#endif
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
- long double __ieee754_atanhl(long double x)
-#else
- long double __ieee754_atanhl(x)
- long double x;
-#endif
+long double
+__ieee754_atanhl(long double x)
{
long double t;
int64_t hx,ix;
@@ -61,7 +45,7 @@ static long double zero = 0.0L;
ix = hx&0x7fffffffffffffffLL;
if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
if (ix > 0x3ff0000000000000LL)
- return (x-x)/(x-x);
+ return (x-x)/(x-x);
t = fabsl (x);
if (t > one)
return (x-x)/(x-x);
@@ -77,3 +61,4 @@ static long double zero = 0.0L;
t = 0.5*__log1pl((x+x)/(one-x));
if(hx>=0) return t; else return -t;
}
+strong_alias (__ieee754_atanhl, __atanhl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
index 73cb478..ebc9436 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
@@ -10,22 +10,18 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
-#endif
-
/* __ieee754_cosh(x)
* Method :
* mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2
* 1. Replace x by |x| (cosh(x) = cosh(-x)).
* 2.
- * [ exp(x) - 1 ]^2
+ * [ exp(x) - 1 ]^2
* 0 <= x <= ln2/2 : cosh(x) := 1 + -------------------
- * 2*exp(x)
+ * 2*exp(x)
*
- * exp(x) + 1/exp(x)
+ * exp(x) + 1/exp(x)
* ln2/2 <= x <= 22 : cosh(x) := -------------------
- * 2
+ * 2
* 22 <= x <= lnovft : cosh(x) := exp(x)/2
* lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2)
* ln2ovft < x : cosh(x) := huge*huge (overflow)
@@ -38,18 +34,10 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0L, half=0.5L, huge = 1.0e300L;
-#else
-static long double one = 1.0L, half=0.5L, huge = 1.0e300L;
-#endif
-#ifdef __STDC__
- long double __ieee754_coshl(long double x)
-#else
- long double __ieee754_coshl(x)
- long double x;
-#endif
+long double
+__ieee754_coshl (long double x)
{
long double t,w;
int64_t ix;
@@ -79,7 +67,7 @@ static long double one = 1.0L, half=0.5L, huge = 1.0e300L;
if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x));
/* |x| in [log(maxdouble), overflowthresold] */
- if (ix < 0x408633ce8fb9f87dLL) {
+ if (ix < 0x408633ce8fb9f87dLL) {
w = __ieee754_expl(half*fabsl(x));
t = half*w;
return t*w;
@@ -88,3 +76,4 @@ static long double one = 1.0L, half=0.5L, huge = 1.0e300L;
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
}
+strong_alias (__ieee754_coshl, __coshl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
index e99b0ba..4ad59a0 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -22,18 +22,10 @@
#include "math_private.h"
#include <ieee754.h>
-#ifdef __STDC__
static const long double one = 1.0, Zero[] = {0.0, -0.0,};
-#else
-static long double one = 1.0, Zero[] = {0.0, -0.0,};
-#endif
-#ifdef __STDC__
- long double __ieee754_fmodl(long double x, long double y)
-#else
- long double __ieee754_fmodl(x,y)
- long double x,y;
-#endif
+long double
+__ieee754_fmodl (long double x, long double y)
{
int64_t n,hx,hy,hz,ix,iy,sx,i;
u_int64_t lx,ly,lz;
@@ -76,8 +68,8 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
/* Make the IBM extended format 105 bit mantissa look like the ieee854 112
bit mantissa so the following operatations will give the correct
result. */
- ldbl_extract_mantissa(&hx, &lx, &temp, x);
- ldbl_extract_mantissa(&hy, &ly, &temp, y);
+ ldbl_extract_mantissa(&hx, &lx, &temp, x);
+ ldbl_extract_mantissa(&hy, &ly, &temp, y);
/* set up {hx,lx}, {hy,ly} and align y to x */
if(ix >= -1022)
@@ -85,8 +77,8 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
else { /* subnormal x, shift x to normal */
n = -1022-ix;
if(n<=63) {
- hx = (hx<<n)|(lx>>(64-n));
- lx <<= n;
+ hx = (hx<<n)|(lx>>(64-n));
+ lx <<= n;
} else {
hx = lx<<(n-64);
lx = 0;
@@ -97,8 +89,8 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
else { /* subnormal y, shift y to normal */
n = -1022-iy;
if(n<=63) {
- hy = (hy<<n)|(ly>>(64-n));
- ly <<= n;
+ hy = (hy<<n)|(ly>>(64-n));
+ ly <<= n;
} else {
hy = ly<<(n-64);
ly = 0;
@@ -111,16 +103,16 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
else {
- if((hz|(lz&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ if((hz|(lz&0x7fffffffffffffff))==0) /* return sign(x)*0 */
return Zero[(u_int64_t)sx>>63];
- hx = hz+hz+(lz>>63); lx = lz+lz;
+ hx = hz+hz+(lz>>63); lx = lz+lz;
}
}
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz>=0) {hx=hz;lx=lz;}
/* convert back to floating value and restore the sign */
- if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */
return Zero[(u_int64_t)sx>>63];
while(hx<0x0001000000000000LL) { /* normalize x */
hx = hx+hx+(lx>>63); lx = lx+lx;
@@ -143,3 +135,4 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,};
}
return x; /* exact output */
}
+strong_alias (__ieee754_fmodl, __fmodl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
index 03bcb21..f20ea9e 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
@@ -1,8 +1,8 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2002,2004,2006,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
- Jakub Jelinek <jj@ultra.linux.cz, 1999.
+ Jakub Jelinek <jj@ultra.linux.cz, 1999.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -56,3 +56,4 @@ __ieee754_gammal_r (long double x, int *signgamp)
/* XXX FIXME. */
return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
}
+strong_alias (__ieee754_gammal_r, __gammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
index 4330f28..4ef0767 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -10,10 +10,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
-#endif
-
/* __ieee754_hypotl(x,y)
*
* Method :
@@ -42,8 +38,8 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
* hypotl(x,y) is NAN if x or y is NAN.
*
* Accuracy:
- * hypotl(x,y) returns sqrtl(x^2+y^2) with error less
- * than 1 ulps (units in the last place)
+ * hypotl(x,y) returns sqrtl(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
*/
#include "math.h"
@@ -52,12 +48,8 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
static const long double two600 = 0x1.0p+600L;
static const long double two1022 = 0x1.0p+1022L;
-#ifdef __STDC__
- long double __ieee754_hypotl(long double x, long double y)
-#else
- long double __ieee754_hypotl(x,y)
- long double x, y;
-#endif
+long double
+__ieee754_hypotl(long double x, long double y)
{
long double a,b,t1,t2,y1,y2,w,kld;
int64_t j,k,ha,hb;
@@ -93,7 +85,7 @@ static const long double two1022 = 0x1.0p+1022L;
}
if(hb < 0x20b0000000000000LL) { /* b < 2**-500 */
if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */
- u_int64_t low;
+ u_int64_t low;
GET_LDOUBLE_LSW64(low,b);
if((hb|(low&0x7fffffffffffffffLL))==0) return a;
t1=two1022; /* t1=2^1022 */
@@ -102,7 +94,7 @@ static const long double two1022 = 0x1.0p+1022L;
k -= 1022;
kld = kld / two1022;
} else { /* scale a and b by 2^600 */
- ha += 0x2580000000000000LL; /* a *= 2^600 */
+ ha += 0x2580000000000000LL; /* a *= 2^600 */
hb += 0x2580000000000000LL; /* b *= 2^600 */
k -= 600;
a *= two600;
@@ -129,3 +121,4 @@ static const long double two1022 = 0x1.0p+1022L;
else
return w;
}
+strong_alias (__ieee754_hypotl, __hypotl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
index 27e2c71..de57be3 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
@@ -179,8 +179,7 @@ deval (long double x, const long double *p, int n)
long double
-__ieee754_log10l (x)
- long double x;
+__ieee754_log10l (long double x)
{
long double z;
long double y;
@@ -256,3 +255,4 @@ done:
z += e * L102A;
return (z);
}
+strong_alias (__ieee754_log10l, __log10l_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
index fe8a8e1..9737e13 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
@@ -248,3 +248,4 @@ done:
z += e;
return (z);
}
+strong_alias (__ieee754_log2l, __log2l_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
index aa5fc37..6832608 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_logl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
@@ -253,7 +253,7 @@ __ieee754_logl(long double x)
/* log(u) = log( t u/t ) = log(t) + log(u/t)
log(t) is tabulated in the lookup table.
Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t.
- cf. Cody & Waite. */
+ cf. Cody & Waite. */
z = (u.value - t.value) / t.value;
}
/* Series expansion of log(1+z). */
@@ -279,3 +279,4 @@ __ieee754_logl(long double x)
y += e * ln2a;
return y;
}
+strong_alias (__ieee754_logl, __logl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
index feeaa8c..9b1f2be 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
@@ -144,14 +144,8 @@ static const long double
cp_h = 9.6179669392597555432899980587535537779331E-1L,
cp_l = 5.0577616648125906047157785230014751039424E-17L;
-#ifdef __STDC__
long double
__ieee754_powl (long double x, long double y)
-#else
-long double
-__ieee754_powl (x, y)
- long double x, y;
-#endif
{
long double z, ax, z_h, z_l, p_h, p_l;
long double y1, t1, t2, r, s, t, u, v, w;
@@ -390,7 +384,7 @@ __ieee754_powl (x, y)
{
/* if z > 16384 */
if (((j - 0x40d00000) | o.parts32.w1
- | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
return s * huge * huge; /* overflow */
else
{
@@ -402,7 +396,7 @@ __ieee754_powl (x, y)
{
/* z < -16495 */
if (((j - 0xc0d01bc0) | o.parts32.w1
- | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
return s * tiny * tiny; /* underflow */
else
{
@@ -439,3 +433,4 @@ __ieee754_powl (x, y)
z = __scalbnl (z, n);
return s * z;
}
+strong_alias (__ieee754_powl, __powl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
index b7fa68f..d4a847d 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
@@ -14,8 +14,8 @@
/* __ieee754_remainderl(x,p)
* Return :
- * returns x REM p = x - [x/p]*p as if in infinite
- * precise arithmetic, where [x/p] is the (infinite bit)
+ * returns x REM p = x - [x/p]*p as if in infinite
+ * precise arithmetic, where [x/p] is the (infinite bit)
* integer nearest x/p (in half way case choose the even one).
* Method :
* Based on fmodl() return x-[x/p]chopped*p exactlp.
@@ -24,19 +24,11 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
- long double __ieee754_remainderl(long double x, long double p)
-#else
- long double __ieee754_remainderl(x,p)
- long double x,p;
-#endif
+long double
+__ieee754_remainderl(long double x, long double p)
{
int64_t hx,hp;
u_int64_t sx,lx,lp;
@@ -49,7 +41,7 @@ static long double zero = 0.0L;
hx &= 0x7fffffffffffffffLL;
/* purge off exception values */
- if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */
+ if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */
if((hx>=0x7ff0000000000000LL)|| /* x not finite */
((hp>=0x7ff0000000000000LL)&& /* p is NaN */
(((hp-0x7ff0000000000000LL)|lp)!=0)))
@@ -76,3 +68,4 @@ static long double zero = 0.0L;
SET_LDOUBLE_MSW64(x,hx^sx);
return x;
}
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
index 38ae71d..b8e86b1 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
@@ -10,18 +10,14 @@
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
-#endif
-
/* __ieee754_sinh(x)
* Method :
* mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
* 1. Replace x by |x| (sinh(-x) = -sinh(x)).
* 2.
- * E + E/(E+1)
+ * E + E/(E+1)
* 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
- * 2
+ * 2
*
* 22 <= x <= lnovft : sinh(x) := exp(x)/2
* lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
@@ -35,18 +31,10 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, shuge = 1.0e307;
-#else
-static long double one = 1.0, shuge = 1.0e307;
-#endif
-#ifdef __STDC__
- long double __ieee754_sinhl(long double x)
-#else
- long double __ieee754_sinhl(x)
- long double x;
-#endif
+long double
+__ieee754_sinhl(long double x)
{
long double t,w,h;
int64_t ix,jx;
@@ -62,7 +50,7 @@ static long double one = 1.0, shuge = 1.0e307;
if (jx<0) h = -h;
/* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x4036000000000000LL) { /* |x|<22 */
- if (ix<0x3e20000000000000LL) /* |x|<2**-29 */
+ if (ix<0x3e20000000000000LL) /* |x|<2**-29 */
if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */
t = __expm1l(fabsl(x));
if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one));
@@ -82,3 +70,4 @@ static long double one = 1.0, shuge = 1.0e307;
/* |x| > overflowthresold, sinh(x) overflow */
return x*shuge;
}
+strong_alias (__ieee754_sinhl, __sinhl_finite)
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
index fe6bb55..68aa18f 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001, 2004, 2006 Free Software Foundation
+ * Copyright (C) 2001, 2004, 2006, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -50,7 +50,7 @@ twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
/* it computes the correctly rounded (to nearest) value of square */
/* root of x. */
/*********************************************************************/
-long double __ieee754_sqrtl(long double x)
+long double __ieee754_sqrtl(long double x)
{
static const long double big = 134217728.0, big1 = 134217729.0;
long double t,s,i;
@@ -107,3 +107,4 @@ long double __ieee754_sqrtl(long double x)
return tm256.x*__ieee754_sqrtl(x*t512.x);
}
}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_acoshl.c b/sysdeps/ieee754/ldbl-96/e_acoshl.c
index 5d4fa1d..6f709b7 100644
--- a/sysdeps/ieee754/ldbl-96/e_acoshl.c
+++ b/sysdeps/ieee754/ldbl-96/e_acoshl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_acoshl(x)
* Method :
* Based on
@@ -35,20 +31,12 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
one = 1.0,
ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
-#ifdef __STDC__
- long double __ieee754_acoshl(long double x)
-#else
- long double __ieee754_acoshl(x)
- long double x;
-#endif
+long double
+__ieee754_acoshl(long double x)
{
long double t;
u_int32_t se,i0,i1;
@@ -57,7 +45,7 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
return (x-x)/(x-x);
} else if(se >=0x401d) { /* x > 2**30 */
if(se >=0x7fff) { /* x is inf of NaN */
- return x+x;
+ return x+x;
} else
return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */
} else if(((se-0x3fff)|i0|i1)==0) {
@@ -70,3 +58,4 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
return __log1pl(t+__sqrtl(2.0*t+t*t));
}
}
+strong_alias (__ieee754_acoshl, __acoshl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_asinl.c b/sysdeps/ieee754/ldbl-96/e_asinl.c
index 1cad623..d813039 100644
--- a/sysdeps/ieee754/ldbl-96/e_asinl.c
+++ b/sysdeps/ieee754/ldbl-96/e_asinl.c
@@ -12,9 +12,9 @@
/*
Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -45,7 +45,7 @@
* = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
* For x<=0.98, let pio4_hi = pio2_hi/2, then
* f = hi part of s;
- * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
+ * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
* and
* asin(x) = pi/2 - 2*(s+s*z*R(z))
* = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
@@ -159,3 +159,4 @@ __ieee754_asinl (x)
else
return -t;
}
+strong_alias (__ieee754_asinl, __asinl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_atan2l.c b/sysdeps/ieee754/ldbl-96/e_atan2l.c
index 0759458..535d0d6 100644
--- a/sysdeps/ieee754/ldbl-96/e_atan2l.c
+++ b/sysdeps/ieee754/ldbl-96/e_atan2l.c
@@ -14,15 +14,11 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_atan2l(y,x)
* Method :
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
* 2. Reduce x to positive by (if x and y are unexceptional):
- * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
*
* Special cases:
@@ -48,11 +44,7 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
tiny = 1.0e-4900L,
zero = 0.0,
pi_o_4 = 7.85398163397448309628202E-01L, /* 0x3FFE, 0xC90FDAA2, 0x2168C235 */
@@ -60,12 +52,8 @@ pi_o_2 = 1.5707963267948966192564E+00L, /* 0x3FFF, 0xC90FDAA2, 0x2168C235 */
pi = 3.14159265358979323851281E+00L, /* 0x4000, 0xC90FDAA2, 0x2168C235 */
pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
-#ifdef __STDC__
- long double __ieee754_atan2l(long double y, long double x)
-#else
- long double __ieee754_atan2l(y,x)
- long double y,x;
-#endif
+long double
+__ieee754_atan2l (long double y, long double x)
{
long double z;
int32_t k,m,hx,hy,ix,iy;
@@ -87,7 +75,7 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
if((iy|ly)==0) {
switch(m) {
case 0:
- case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
@@ -118,19 +106,20 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
/* compute y/x */
k = sy-sx;
- if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */
- else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */
+ if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */
+ else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */
else z=__atanl(fabsl(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: {
- u_int32_t sz;
+ u_int32_t sz;
GET_LDOUBLE_EXP(sz,z);
SET_LDOUBLE_EXP(z,sz ^ 0x8000);
}
return z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
- return (z-pi_lo)-pi;/* atan(-,-) */
+ return (z-pi_lo)-pi;/* atan(-,-) */
}
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_atanhl.c b/sysdeps/ieee754/ldbl-96/e_atanhl.c
index fdcd1e9..5a2aebe 100644
--- a/sysdeps/ieee754/ldbl-96/e_atanhl.c
+++ b/sysdeps/ieee754/ldbl-96/e_atanhl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_atanhl(x)
* Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
@@ -26,7 +22,7 @@ static char rcsid[] = "$NetBSD: $";
* atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
* 2 1 - x 1 - x
*
- * For x<0.5
+ * For x<0.5
* atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x))
*
* Special cases:
@@ -39,24 +35,12 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, huge = 1e4900L;
-#else
-static long double one = 1.0, huge = 1e4900L;
-#endif
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static double long zero = 0.0;
-#endif
-#ifdef __STDC__
- long double __ieee754_atanhl(long double x)
-#else
- long double __ieee754_atanhl(x)
- long double x;
-#endif
+long double
+__ieee754_atanhl(long double x)
{
long double t;
int32_t ix;
@@ -77,3 +61,4 @@ static double long zero = 0.0;
t = 0.5*__log1pl((x+x)/(one-x));
if(se<=0x7fff) return t; else return -t;
}
+strong_alias (__ieee754_atanhl, __atanhl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_coshl.c b/sysdeps/ieee754/ldbl-96/e_coshl.c
index 8c38fa4..6113f07 100644
--- a/sysdeps/ieee754/ldbl-96/e_coshl.c
+++ b/sysdeps/ieee754/ldbl-96/e_coshl.c
@@ -18,13 +18,13 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
* mathematically coshl(x) if defined to be (exp(x)+exp(-x))/2
* 1. Replace x by |x| (coshl(x) = coshl(-x)).
* 2.
- * [ exp(x) - 1 ]^2
+ * [ exp(x) - 1 ]^2
* 0 <= x <= ln2/2 : coshl(x) := 1 + -------------------
- * 2*exp(x)
+ * 2*exp(x)
*
- * exp(x) + 1/exp(x)
+ * exp(x) + 1/exp(x)
* ln2/2 <= x <= 22 : coshl(x) := -------------------
- * 2
+ * 2
* 22 <= x <= lnovft : coshl(x) := expl(x)/2
* lnovft <= x <= ln2ovft: coshl(x) := expl(x/2)/2 * expl(x/2)
* ln2ovft < x : coshl(x) := huge*huge (overflow)
@@ -37,18 +37,10 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, half=0.5, huge = 1.0e4900L;
-#else
-static long double one = 1.0, half=0.5, huge = 1.0e4900L;
-#endif
-#ifdef __STDC__
- long double __ieee754_coshl(long double x)
-#else
- long double __ieee754_coshl(x)
- long double x;
-#endif
+long double
+__ieee754_coshl (long double x)
{
long double t,w;
int32_t ex;
@@ -58,19 +50,17 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L;
GET_LDOUBLE_WORDS(ex,mx,lx,x);
ex &= 0x7fff;
- /* x is INF or NaN */
- if(ex==0x7fff) return x*x;
-
- /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */
- if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) {
- t = __expm1l(fabsl(x));
- w = one+t;
- if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */
- return one+(t*t)/(w+w);
- }
-
- /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+ /* |x| in [0,22] */
if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) {
+ /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */
+ if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) {
+ t = __expm1l(fabsl(x));
+ w = one+t;
+ if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */
+ return one+(t*t)/(w+w);
+ }
+
+ /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
t = __ieee754_expl(fabsl(x));
return half*t+half/t;
}
@@ -88,6 +78,10 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L;
return t*w;
}
+ /* x is INF or NaN */
+ if(ex==0x7fff) return x*x;
+
/* |x| >= log(2*maxdouble), cosh(x) overflow */
return huge*huge;
}
+strong_alias (__ieee754_coshl, __coshl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
index dd956fe..40c18ea 100644
--- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2001,2003,2004,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -32,25 +32,27 @@ __ieee754_gammal_r (long double x, int *signgamp)
GET_LDOUBLE_WORDS (es, hx, lx, x);
- if (((es & 0x7fff) | hx | lx) == 0)
+ if (__builtin_expect (((es & 0x7fff) | hx | lx) == 0, 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
return 1.0 / x;
}
- if (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0)
+ if (__builtin_expect (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0, 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
return x - x;
}
- if ((es & 0x7fff) == 0x7fff && ((hx & 0x7fffffff) | lx) != 0)
+ if (__builtin_expect ((es & 0x7fff) == 0x7fff, 0)
+ && ((hx & 0x7fffffff) | lx) != 0)
{
/* NaN, return it. */
*signgamp = 0;
return x;
}
- if ((es & 0x8000) != 0 && x < 0xffffffff && __rintl (x) == x)
+ if (__builtin_expect ((es & 0x8000) != 0, 0)
+ && x < 0xffffffff && __rintl (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
@@ -60,3 +62,4 @@ __ieee754_gammal_r (long double x, int *signgamp)
/* XXX FIXME. */
return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
}
+strong_alias (__ieee754_gammal_r, __gammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_hypotl.c b/sysdeps/ieee754/ldbl-96/e_hypotl.c
index 1a40c55..a59320b 100644
--- a/sysdeps/ieee754/ldbl-96/e_hypotl.c
+++ b/sysdeps/ieee754/ldbl-96/e_hypotl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_hypotl(x,y)
*
* Method :
@@ -46,8 +42,8 @@ static char rcsid[] = "$NetBSD: $";
* hypot(x,y) is NAN if x or y is NAN.
*
* Accuracy:
- * hypot(x,y) returns sqrt(x^2+y^2) with error less
- * than 1 ulps (units in the last place)
+ * hypot(x,y) returns sqrt(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
*/
#include "math.h"
@@ -72,7 +68,7 @@ static char rcsid[] = "$NetBSD: $";
SET_LDOUBLE_EXP(b,eb); /* b <- |b| */
if((ea-eb)>0x46) {return a+b;} /* x/y > 2**70 */
k=0;
- if(ea > 0x5f3f) { /* a>2**8000 */
+ if(__builtin_expect(ea > 0x5f3f,0)) { /* a>2**8000 */
if(ea == 0x7fff) { /* Inf or NaN */
u_int32_t exp,high,low;
w = a+b; /* for sNaN */
@@ -87,9 +83,9 @@ static char rcsid[] = "$NetBSD: $";
SET_LDOUBLE_EXP(a,ea);
SET_LDOUBLE_EXP(b,eb);
}
- if(eb < 0x20bf) { /* b < 2**-8000 */
+ if(__builtin_expect(eb < 0x20bf, 0)) { /* b < 2**-8000 */
if(eb == 0) { /* subnormal b or 0 */
- u_int32_t exp,high,low;
+ u_int32_t exp,high,low;
GET_LDOUBLE_WORDS(exp,high,low,b);
if((high|low)==0) return a;
SET_LDOUBLE_WORDS(t1, 0x7ffd, 0, 0); /* t1=2^16382 */
@@ -97,7 +93,7 @@ static char rcsid[] = "$NetBSD: $";
a *= t1;
k -= 16382;
} else { /* scale a and b by 2^9600 */
- ea += 0x2580; /* a *= 2^9600 */
+ ea += 0x2580; /* a *= 2^9600 */
eb += 0x2580; /* b *= 2^9600 */
k -= 9600;
SET_LDOUBLE_EXP(a,ea);
@@ -131,3 +127,4 @@ static char rcsid[] = "$NetBSD: $";
return t1*w;
} else return w;
}
+strong_alias (__ieee754_hypotl, __hypotl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c
index 12c906b..ce1f0f7 100644
--- a/sysdeps/ieee754/ldbl-96/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j0l.c
@@ -11,9 +11,9 @@
/* Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -74,17 +74,9 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static long double pzero (long double), qzero (long double);
-#else
-static long double pzero (), qzero ();
-#endif
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
huge = 1e4930L,
one = 1.0L,
invsqrtpi = 5.6418958354775628694807945156077258584405e-1L,
@@ -109,20 +101,10 @@ static long double
/* 1.000000000000000000000000000000000000000E0L,*/
};
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static long double zero = 0.0;
-#endif
-#ifdef __STDC__
long double
__ieee754_j0l (long double x)
-#else
-long double
-__ieee754_j0l (x)
- long double x;
-#endif
{
long double z, s, c, ss, cc, r, u, v;
int32_t ix;
@@ -130,7 +112,7 @@ __ieee754_j0l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / (x * x);
x = fabsl (x);
if (ix >= 0x4000) /* |x| >= 2.0 */
@@ -150,7 +132,7 @@ __ieee754_j0l (x)
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
- if (ix > 0x4080) /* 2^129 */
+ if (__builtin_expect (ix > 0x4080, 0)) /* 2^129 */
z = (invsqrtpi * cc) / __ieee754_sqrtl (x);
else
{
@@ -160,7 +142,7 @@ __ieee754_j0l (x)
}
return z;
}
- if (ix < 0x3fef) /* |x| < 2**-16 */
+ if (__builtin_expect (ix < 0x3fef, 0)) /* |x| < 2**-16 */
{
if (huge + x > one)
{ /* raise inexact if x != 0 */
@@ -183,16 +165,13 @@ __ieee754_j0l (x)
return ((one + u) * (one - u) + z * (r / s));
}
}
+strong_alias (__ieee754_j0l, __j0l_finite)
/* y0(x) = 2/pi ln(x) J0(x) + U(x^2)/V(x^2)
0 < x <= 2
peak relative error 1.7e-21 */
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
U[6] = {
-1.054912306975785573710813351985351350861E10L,
2.520192609749295139432773849576523636127E10L,
@@ -201,11 +180,7 @@ U[6] = {
-3.440684087134286610316661166492641011539E5L,
1.005524356159130626192144663414848383774E3L,
};
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
V[5] = {
1.429337283720789610137291929228082613676E11L,
2.492593075325119157558811370165695013002E9L,
@@ -215,14 +190,8 @@ V[5] = {
/* 1.000000000000000000000000000000000000000E0L */
};
-#ifdef __STDC__
long double
__ieee754_y0l (long double x)
-#else
-long double
-__ieee754_y0l (x)
- long double x;
-#endif
{
long double z, s, c, ss, cc, u, v;
int32_t ix;
@@ -231,11 +200,11 @@ __ieee754_y0l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */
- if (se & 0x8000)
+ if (__builtin_expect (se & 0x8000, 0))
return zero / (zero * x);
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / (x + x * x);
- if ((i0 | i1) == 0)
+ if (__builtin_expect ((i0 | i1) == 0, 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
if (ix >= 0x4000)
{ /* |x| >= 2.0 */
@@ -266,7 +235,7 @@ __ieee754_y0l (x)
else
ss = z / cc;
}
- if (ix > 0x4080) /* 1e39 */
+ if (__builtin_expect (ix > 0x4080, 0)) /* 1e39 */
z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
else
{
@@ -276,7 +245,7 @@ __ieee754_y0l (x)
}
return z;
}
- if (ix <= 0x3fde) /* x < 2^-33 */
+ if (__builtin_expect (ix <= 0x3fde, 0)) /* x < 2^-33 */
{
z = -7.380429510868722527629822444004602747322E-2L
+ tpi * __ieee754_logl (x);
@@ -287,17 +256,14 @@ __ieee754_y0l (x)
v = V[0] + z * (V[1] + z * (V[2] + z * (V[3] + z * (V[4] + z))));
return (u / v + tpi * (__ieee754_j0l (x) * __ieee754_logl (x)));
}
+strong_alias (__ieee754_y0l, __y0l_finite)
/* 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
* pzero(x) = 1 + s^2 R(s^2) / S(s^2)
*/
-#ifdef __STDC__
static const long double pR8[7] = {
-#else
-static long double pR8[7] = {
-#endif
/* 8 <= x <= inf
Peak relative error 4.62 */
-4.094398895124198016684337960227780260127E-9L,
@@ -308,11 +274,7 @@ static long double pR8[7] = {
-5.827178869301452892963280214772398135283E-2L,
-2.087563267939546435460286895807046616992E-2L,
};
-#ifdef __STDC__
static const long double pS8[6] = {
-#else
-static long double pS8[6] = {
-#endif
5.823145095287749230197031108839653988393E-8L,
1.279281986035060320477759999428992730280E-5L,
9.132668954726626677174825517150228961304E-4L,
@@ -322,11 +284,7 @@ static long double pS8[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double pR5[7] = {
-#else
-static long double pR5[7] = {
-#endif
/* 4.54541015625 <= x <= 8
Peak relative error 6.51E-22 */
-2.041226787870240954326915847282179737987E-7L,
@@ -337,11 +295,7 @@ static long double pR5[7] = {
-8.641175552716402616180994954177818461588E-2L,
-1.354654710097134007437166939230619726157E-2L,
};
-#ifdef __STDC__
static const long double pS5[6] = {
-#else
-static long double pS5[6] = {
-#endif
2.903078099681108697057258628212823545290E-6L,
3.253948449946735405975737677123673867321E-4L,
1.181269751723085006534147920481582279979E-2L,
@@ -351,11 +305,7 @@ static long double pS5[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double pR3[7] = {
-#else
-static long double pR3[7] = {
-#endif
/* 2.85711669921875 <= x <= 4.54541015625
peak relative error 5.25e-21 */
-5.755732156848468345557663552240816066802E-6L,
@@ -366,11 +316,7 @@ static long double pR3[7] = {
-1.193350853469302941921647487062620011042E-1L,
-8.567802507331578894302991505331963782905E-3L,
};
-#ifdef __STDC__
static const long double pS3[6] = {
-#else
-static long double pS3[6] = {
-#endif
8.185931139070086158103309281525036712419E-5L,
5.398016943778891093520574483111255476787E-3L,
1.130589193590489566669164765853409621081E-1L,
@@ -380,11 +326,7 @@ static long double pS3[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double pR2[7] = {
-#else
-static long double pR2[7] = {
-#endif
/* 2 <= x <= 2.85711669921875
peak relative error 2.64e-21 */
-1.219525235804532014243621104365384992623E-4L,
@@ -395,11 +337,7 @@ static long double pR2[7] = {
-1.556241316844728872406672349347137975495E-1L,
-5.355423239526452209595316733635519506958E-3L,
};
-#ifdef __STDC__
static const long double pS2[6] = {
-#else
-static long double pS2[6] = {
-#endif
1.734442793664291412489066256138894953823E-3L,
7.158111826468626405416300895617986926008E-2L,
9.153839713992138340197264669867993552641E-1L,
@@ -409,20 +347,10 @@ static long double pS2[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static long double
pzero (long double x)
-#else
-static long double
-pzero (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
long double z, r, s;
int32_t ix;
u_int32_t se, i0, i1;
@@ -468,11 +396,7 @@ pzero (x)
* We approximate qzero by
* qzero(x) = s*(-.125 + R(s^2) / S(s^2))
*/
-#ifdef __STDC__
static const long double qR8[7] = {
-#else
-static long double qR8[7] = {
-#endif
/* 8 <= x <= inf
peak relative error 2.23e-21 */
3.001267180483191397885272640777189348008E-10L,
@@ -483,11 +407,7 @@ static long double qR8[7] = {
3.881970028476167836382607922840452192636E-2L,
6.132191514516237371140841765561219149638E-2L,
};
-#ifdef __STDC__
static const long double qS8[7] = {
-#else
-static long double qS8[7] = {
-#endif
4.097730123753051126914971174076227600212E-9L,
1.199615869122646109596153392152131139306E-6L,
1.196337580514532207793107149088168946451E-4L,
@@ -498,11 +418,7 @@ static long double qS8[7] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double qR5[7] = {
-#else
-static long double qR5[7] = {
-#endif
/* 4.54541015625 <= x <= 8
peak relative error 1.03e-21 */
3.406256556438974327309660241748106352137E-8L,
@@ -513,11 +429,7 @@ static long double qR5[7] = {
1.071578819056574524416060138514508609805E-1L,
7.458950172851611673015774675225656063757E-2L,
};
-#ifdef __STDC__
static const long double qS5[7] = {
-#else
-static long double qS5[7] = {
-#endif
4.650675622764245276538207123618745150785E-7L,
6.773573292521412265840260065635377164455E-5L,
3.340711249876192721980146877577806687714E-3L,
@@ -528,11 +440,7 @@ static long double qS5[7] = {
/* 1.000000000000000000000000000000000000000E0L,*/
};
-#ifdef __STDC__
static const long double qR3[7] = {
-#else
-static long double qR3[7] = {
-#endif
/* 2.85711669921875 <= x <= 4.54541015625
peak relative error 5.24e-21 */
1.749459596550816915639829017724249805242E-6L,
@@ -543,11 +451,7 @@ static long double qR3[7] = {
2.538595333972857367655146949093055405072E-1L,
8.560591367256769038905328596020118877936E-2L,
};
-#ifdef __STDC__
static const long double qS3[7] = {
-#else
-static long double qS3[7] = {
-#endif
2.388596091707517488372313710647510488042E-5L,
2.048679968058758616370095132104333998147E-3L,
5.824663198201417760864458765259945181513E-2L,
@@ -558,11 +462,7 @@ static long double qS3[7] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double qR2[7] = {
-#else
-static long double qR2[7] = {
-#endif
/* 2 <= x <= 2.85711669921875
peak relative error 1.58e-21 */
6.306524405520048545426928892276696949540E-5L,
@@ -573,11 +473,7 @@ static long double qR2[7] = {
5.431871999743531634887107835372232030655E-1L,
9.447736151202905471899259026430157211949E-2L,
};
-#ifdef __STDC__
static const long double qS2[7] = {
-#else
-static long double qS2[7] = {
-#endif
8.610579901936193494609755345106129102676E-4L,
4.649054352710496997203474853066665869047E-2L,
8.104282924459837407218042945106320388339E-1L,
@@ -588,20 +484,10 @@ static long double qS2[7] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static long double
qzero (long double x)
-#else
-static long double
-qzero (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
long double s, r, z;
int32_t ix;
u_int32_t se, i0, i1;
diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c
index 62a8ce0c..369fd83 100644
--- a/sysdeps/ieee754/ldbl-96/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j1l.c
@@ -11,9 +11,9 @@
/* Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -38,17 +38,17 @@
* for x in (0,2)
* j1(x) = x/2 + x*z*R0/S0, where z = x*x;
* for x in (2,inf)
- * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
- * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
+ * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
* as follow:
* cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
* = 1/sqrt(2) * (sin(x) - cos(x))
* sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
* = -1/sqrt(2) * (sin(x) + cos(x))
- * (To avoid cancellation, use
+ * (To avoid cancellation, use
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.)
+ * to compute the worse one.)
*
* 3 Special cases
* j1(nan)= nan
@@ -66,25 +66,17 @@
* Note: For tiny x, 1/x dominate y1 and hence
* y1(tiny) = -2/pi/tiny
* 3. For x>=2.
- * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
* by method mentioned above.
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static long double pone (long double), qone (long double);
-#else
-static long double pone (), qone ();
-#endif
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
huge = 1e4930L,
one = 1.0L,
invsqrtpi = 5.6418958354775628694807945156077258584405e-1L,
@@ -110,21 +102,11 @@ R[5] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static long double zero = 0.0;
-#endif
-#ifdef __STDC__
long double
__ieee754_j1l (long double x)
-#else
-long double
-__ieee754_j1l (x)
- long double x;
-#endif
{
long double z, c, r, s, ss, cc, u, v, y;
int32_t ix;
@@ -132,7 +114,7 @@ __ieee754_j1l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / x;
y = fabsl (x);
if (ix >= 0x4000)
@@ -152,7 +134,7 @@ __ieee754_j1l (x)
* j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
* y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
*/
- if (ix > 0x4080)
+ if (__builtin_expect (ix > 0x4080, 0))
z = (invsqrtpi * cc) / __ieee754_sqrtl (y);
else
{
@@ -165,7 +147,7 @@ __ieee754_j1l (x)
else
return z;
}
- if (ix < 0x3fde) /* |x| < 2^-33 */
+ if (__builtin_expect (ix < 0x3fde, 0)) /* |x| < 2^-33 */
{
if (huge + x > one)
return 0.5 * x; /* inexact if x!=0 necessary */
@@ -176,16 +158,13 @@ __ieee754_j1l (x)
r *= x;
return (x * 0.5 + r / s);
}
+strong_alias (__ieee754_j1l, __j1l_finite)
/* Y1(x) = 2/pi * (log(x) * j1(x) - 1/x) + x R(x^2)
0 <= x <= 2
Peak relative error 2.3e-23 */
-#ifdef __STDC__
static const long double U0[6] = {
-#else
-static long double U0[6] = {
-#endif
-5.908077186259914699178903164682444848615E10L,
1.546219327181478013495975514375773435962E10L,
-6.438303331169223128870035584107053228235E8L,
@@ -193,11 +172,7 @@ static long double U0[6] = {
-6.138043997084355564619377183564196265471E4L,
1.418503228220927321096904291501161800215E2L,
};
-#ifdef __STDC__
static const long double V0[5] = {
-#else
-static long double V0[5] = {
-#endif
3.013447341682896694781964795373783679861E11L,
4.669546565705981649470005402243136124523E9L,
3.595056091631351184676890179233695857260E7L,
@@ -207,14 +182,8 @@ static long double V0[5] = {
};
-#ifdef __STDC__
long double
__ieee754_y1l (long double x)
-#else
-long double
-__ieee754_y1l (x)
- long double x;
-#endif
{
long double z, s, c, ss, cc, u, v;
int32_t ix;
@@ -223,11 +192,11 @@ __ieee754_y1l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if (se & 0x8000)
+ if (__builtin_expect (se & 0x8000, 0))
return zero / (zero * x);
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / (x + x * x);
- if ((i0 | i1) == 0)
+ if (__builtin_expect ((i0 | i1) == 0, 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
if (ix >= 0x4000)
{ /* |x| >= 2.0 */
@@ -253,7 +222,7 @@ __ieee754_y1l (x)
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
* to compute the worse one.
*/
- if (ix > 0x4080)
+ if (__builtin_expect (ix > 0x4080, 0))
z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
else
{
@@ -263,7 +232,7 @@ __ieee754_y1l (x)
}
return z;
}
- if (ix <= 0x3fbe)
+ if (__builtin_expect (ix <= 0x3fbe, 0))
{ /* x < 2**-65 */
return (-tpi / x);
}
@@ -273,12 +242,13 @@ __ieee754_y1l (x)
return (x * (u / v) +
tpi * (__ieee754_j1l (x) * __ieee754_logl (x) - one / x));
}
+strong_alias (__ieee754_y1l, __y1l_finite)
/* 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
- * pone(x) = 1 + (R/S)
+ * pone(x) = 1 + (R/S)
*/
/* J1(x) cosX + Y1(x) sinX = sqrt( 2/(pi x)) P1(x)
@@ -286,11 +256,7 @@ __ieee754_y1l (x)
8 <= x <= inf (0 <= z <= 0.125)
Peak relative error 5.2e-22 */
-#ifdef __STDC__
static const long double pr8[7] = {
-#else
-static long double pr8[7] = {
-#endif
8.402048819032978959298664869941375143163E-9L,
1.813743245316438056192649247507255996036E-6L,
1.260704554112906152344932388588243836276E-4L,
@@ -299,11 +265,7 @@ static long double pr8[7] = {
1.131111483254318243139953003461511308672E-1L,
4.480715825681029711521286449131671880953E-2L,
};
-#ifdef __STDC__
static const long double ps8[6] = {
-#else
-static long double ps8[6] = {
-#endif
7.169748325574809484893888315707824924354E-8L,
1.556549720596672576431813934184403614817E-5L,
1.094540125521337139209062035774174565882E-3L,
@@ -317,11 +279,7 @@ static long double ps8[6] = {
P1(x) = 1 + z^2 R(z^2), z=1/x
4.54541015625 <= x <= 8
Peak relative error 7.7e-22 */
-#ifdef __STDC__
static const long double pr5[7] = {
-#else
-static long double pr5[7] = {
-#endif
4.318486887948814529950980396300969247900E-7L,
4.715341880798817230333360497524173929315E-5L,
1.642719430496086618401091544113220340094E-3L,
@@ -330,11 +288,7 @@ static long double pr5[7] = {
1.755576530055079253910829652698703791957E-1L,
3.218803858282095929559165965353784980613E-2L,
};
-#ifdef __STDC__
static const long double ps5[6] = {
-#else
-static long double ps5[6] = {
-#endif
3.685108812227721334719884358034713967557E-6L,
4.069102509511177498808856515005792027639E-4L,
1.449728676496155025507893322405597039816E-2L,
@@ -348,11 +302,7 @@ static long double ps5[6] = {
P1(x) = 1 + z^2 R(z^2), z=1/x
2.85711669921875 <= x <= 4.54541015625
Peak relative error 6.5e-21 */
-#ifdef __STDC__
static const long double pr3[7] = {
-#else
-static long double pr3[7] = {
-#endif
1.265251153957366716825382654273326407972E-5L,
8.031057269201324914127680782288352574567E-4L,
1.581648121115028333661412169396282881035E-2L,
@@ -361,11 +311,7 @@ static long double pr3[7] = {
2.559223765418386621748404398017602935764E-1L,
2.277136933287817911091370397134882441046E-2L,
};
-#ifdef __STDC__
static const long double ps3[6] = {
-#else
-static long double ps3[6] = {
-#endif
1.079681071833391818661952793568345057548E-4L,
6.986017817100477138417481463810841529026E-3L,
1.429403701146942509913198539100230540503E-1L,
@@ -379,11 +325,7 @@ static long double ps3[6] = {
P1(x) = 1 + z^2 R(z^2), z=1/x
2 <= x <= 2.85711669921875
Peak relative error 3.5e-21 */
-#ifdef __STDC__
static const long double pr2[7] = {
-#else
-static long double pr2[7] = {
-#endif
2.795623248568412225239401141338714516445E-4L,
1.092578168441856711925254839815430061135E-2L,
1.278024620468953761154963591853679640560E-1L,
@@ -392,11 +334,7 @@ static long double pr2[7] = {
3.544176317308370086415403567097130611468E-1L,
1.604142674802373041247957048801599740644E-2L,
};
-#ifdef __STDC__
static const long double ps2[6] = {
-#else
-static long double ps2[6] = {
-#endif
2.385605161555183386205027000675875235980E-3L,
9.616778294482695283928617708206967248579E-2L,
1.195215570959693572089824415393951258510E0L,
@@ -407,20 +345,10 @@ static long double ps2[6] = {
};
-#ifdef __STDC__
static long double
pone (long double x)
-#else
-static long double
-pone (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
long double z, r, s;
int32_t ix;
u_int32_t se, i0, i1;
@@ -462,7 +390,7 @@ pone (x)
/* For x >= 8, the asymptotic expansions of qone is
* 3/8 s - 105/1024 s^3 - ..., where s = 1/x.
* We approximate pone by
- * qone(x) = s*(0.375 + (R/S))
+ * qone(x) = s*(0.375 + (R/S))
*/
/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x),
@@ -470,11 +398,7 @@ pone (x)
8 <= x <= inf
Peak relative error 8.3e-22 */
-#ifdef __STDC__
static const long double qr8[7] = {
-#else
-static long double qr8[7] = {
-#endif
-5.691925079044209246015366919809404457380E-10L,
-1.632587664706999307871963065396218379137E-7L,
-1.577424682764651970003637263552027114600E-5L,
@@ -483,11 +407,7 @@ static long double qr8[7] = {
-6.854943629378084419631926076882330494217E-2L,
-1.055448290469180032312893377152490183203E-1L,
};
-#ifdef __STDC__
static const long double qs8[7] = {
-#else
-static long double qs8[7] = {
-#endif
5.550982172325019811119223916998393907513E-9L,
1.607188366646736068460131091130644192244E-6L,
1.580792530091386496626494138334505893599E-4L,
@@ -502,11 +422,7 @@ static long double qs8[7] = {
Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
4.54541015625 <= x <= 8
Peak relative error 4.1e-22 */
-#ifdef __STDC__
static const long double qr5[7] = {
-#else
-static long double qr5[7] = {
-#endif
-6.719134139179190546324213696633564965983E-8L,
-9.467871458774950479909851595678622044140E-6L,
-4.429341875348286176950914275723051452838E-4L,
@@ -515,11 +431,7 @@ static long double qr5[7] = {
-1.964432669771684034858848142418228214855E-1L,
-1.333896496989238600119596538299938520726E-1L,
};
-#ifdef __STDC__
static const long double qs5[7] = {
-#else
-static long double qs5[7] = {
-#endif
6.552755584474634766937589285426911075101E-7L,
9.410814032118155978663509073200494000589E-5L,
4.561677087286518359461609153655021253238E-3L,
@@ -534,11 +446,7 @@ static long double qs5[7] = {
Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
2.85711669921875 <= x <= 4.54541015625
Peak relative error 2.2e-21 */
-#ifdef __STDC__
static const long double qr3[7] = {
-#else
-static long double qr3[7] = {
-#endif
-3.618746299358445926506719188614570588404E-6L,
-2.951146018465419674063882650970344502798E-4L,
-7.728518171262562194043409753656506795258E-3L,
@@ -547,11 +455,7 @@ static long double qr3[7] = {
-4.858192581793118040782557808823460276452E-1L,
-1.592399251246473643510898335746432479373E-1L,
};
-#ifdef __STDC__
static const long double qs3[7] = {
-#else
-static long double qs3[7] = {
-#endif
3.529139957987837084554591421329876744262E-5L,
2.973602667215766676998703687065066180115E-3L,
8.273534546240864308494062287908662592100E-2L,
@@ -566,11 +470,7 @@ static long double qs3[7] = {
Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
2 <= x <= 2.85711669921875
Peak relative error 6.9e-22 */
-#ifdef __STDC__
static const long double qr2[7] = {
-#else
-static long double qr2[7] = {
-#endif
-1.372751603025230017220666013816502528318E-4L,
-6.879190253347766576229143006767218972834E-3L,
-1.061253572090925414598304855316280077828E-1L,
@@ -579,11 +479,7 @@ static long double qr2[7] = {
-1.087955310491078933531734062917489870754E0L,
-1.826821119773182847861406108689273719137E-1L,
};
-#ifdef __STDC__
static const long double qs2[7] = {
-#else
-static long double qs2[7] = {
-#endif
1.338768933634451601814048220627185324007E-3L,
7.071099998918497559736318523932241901810E-2L,
1.200511429784048632105295629933382142221E0L,
@@ -595,20 +491,10 @@ static long double qs2[7] = {
};
-#ifdef __STDC__
static long double
qone (long double x)
-#else
-static long double
-qone (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
static long double s, r, z;
int32_t ix;
u_int32_t se, i0, i1;
diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
index bedff7d..3a70e10 100644
--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
@@ -11,9 +11,9 @@
/* Modifications for long double are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -59,28 +59,13 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
invsqrtpi = 5.64189583547756286948079e-1L, two = 2.0e0L, one = 1.0e0L;
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
long double
__ieee754_jnl (int n, long double x)
-#else
-long double
-__ieee754_jnl (n, x)
- int n;
- long double x;
-#endif
{
u_int32_t se, i0, i1;
int32_t i, ix, sgn;
@@ -95,7 +80,7 @@ __ieee754_jnl (n, x)
ix = se & 0x7fff;
/* if J(n,NaN) is NaN */
- if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
+ if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
return x + x;
if (n < 0)
{
@@ -109,7 +94,8 @@ __ieee754_jnl (n, x)
return (__ieee754_j1l (x));
sgn = (n & 1) & (se >> 15); /* even n -- 0, odd n -- sign(x) */
x = fabsl (x);
- if ((ix | i0 | i1) == 0 || ix >= 0x7fff) /* if x is 0 or inf */
+ if (__builtin_expect ((ix | i0 | i1) == 0 || ix >= 0x7fff, 0))
+ /* if x is 0 or inf */
b = zero;
else if ((long double) n <= x)
{
@@ -298,16 +284,10 @@ __ieee754_jnl (n, x)
else
return b;
}
+strong_alias (__ieee754_jnl, __jnl_finite)
-#ifdef __STDC__
long double
__ieee754_ynl (int n, long double x)
-#else
-long double
-__ieee754_ynl (n, x)
- int n;
- long double x;
-#endif
{
u_int32_t se, i0, i1;
int32_t i, ix;
@@ -318,11 +298,11 @@ __ieee754_ynl (n, x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* if Y(n,NaN) is NaN */
- if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
+ if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
return x + x;
- if ((ix | i0 | i1) == 0)
+ if (__builtin_expect ((ix | i0 | i1) == 0, 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
- if (se & 0x8000)
+ if (__builtin_expect (se & 0x8000, 0))
return zero / (zero * x);
sign = 1;
if (n < 0)
@@ -334,7 +314,7 @@ __ieee754_ynl (n, x)
return (__ieee754_y0l (x));
if (n == 1)
return (sign * __ieee754_y1l (x));
- if (ix == 0x7fff)
+ if (__builtin_expect (ix == 0x7fff, 0))
return zero;
if (ix >= 0x412D)
{ /* x > 2**302 */
@@ -393,3 +373,4 @@ __ieee754_ynl (n, x)
else
return -b;
}
+strong_alias (__ieee754_ynl, __ynl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index 36e3365..8a20e5e 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -94,11 +94,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
half = 0.5L,
one = 1.0L,
pi = 3.14159265358979323846264L,
@@ -204,20 +200,10 @@ static long double
w6 = -1.880801938119376907179E-3L,
w7 = 4.885026142432270781165E-3L;
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
static long double
sin_pi (long double x)
-#else
-static long double
-sin_pi (x)
- long double x;
-#endif
{
long double y, z;
int n, ix;
@@ -283,15 +269,8 @@ sin_pi (x)
}
-#ifdef __STDC__
long double
__ieee754_lgammal_r (long double x, int *signgamp)
-#else
-long double
-__ieee754_lgammal_r (x, signgamp)
- long double x;
- int *signgamp;
-#endif
{
long double t, y, z, nadj, p, p1, p2, q, r, w;
int i, ix;
@@ -301,7 +280,7 @@ __ieee754_lgammal_r (x, signgamp)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
- if ((ix | i0 | i1) == 0)
+ if (__builtin_expect((ix | i0 | i1) == 0, 0))
{
if (se & 0x8000)
*signgamp = -1;
@@ -311,10 +290,10 @@ __ieee754_lgammal_r (x, signgamp)
ix = (ix << 16) | (i0 >> 16);
/* purge off +-inf, NaN, +-0, and negative arguments */
- if (ix >= 0x7fff0000)
+ if (__builtin_expect(ix >= 0x7fff0000, 0))
return x * x;
- if (ix < 0x3fc08000) /* 2^-63 */
+ if (__builtin_expect(ix < 0x3fc08000, 0)) /* 2^-63 */
{ /* |x|<2**-63, return -log(|x|) */
if (se & 0x8000)
{
@@ -438,7 +417,7 @@ __ieee754_lgammal_r (x, signgamp)
z = one / x;
y = z * z;
w = w0 + z * (w1
- + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7))))));
+ + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7))))));
r = (x - half) * (t - one) + w;
}
else
@@ -448,3 +427,4 @@ __ieee754_lgammal_r (x, signgamp)
r = nadj - r;
return r;
}
+strong_alias (__ieee754_lgammal_r, __lgammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_remainderl.c b/sysdeps/ieee754/ldbl-96/e_remainderl.c
index e721a6e..41c4c7b 100644
--- a/sysdeps/ieee754/ldbl-96/e_remainderl.c
+++ b/sysdeps/ieee754/ldbl-96/e_remainderl.c
@@ -14,14 +14,10 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_remainderl(x,p)
* Return :
- * returns x REM p = x - [x/p]*p as if in infinite
- * precise arithmetic, where [x/p] is the (infinite bit)
+ * returns x REM p = x - [x/p]*p as if in infinite
+ * precise arithmetic, where [x/p] is the (infinite bit)
* integer nearest x/p (in half way case choose the even one).
* Method :
* Based on fmod() return x-[x/p]chopped*p exactlp.
@@ -30,19 +26,11 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static long double zero = 0.0;
-#endif
-#ifdef __STDC__
- long double __ieee754_remainderl(long double x, long double p)
-#else
- long double __ieee754_remainderl(x,p)
- long double x,p;
-#endif
+long double
+__ieee754_remainderl(long double x, long double p)
{
u_int32_t sx,sex,sep,x0,x1,p0,p1;
long double p_half;
@@ -54,7 +42,7 @@ static long double zero = 0.0;
sex &= 0x7fff;
/* purge off exception values */
- if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */
+ if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */
if((sex==0x7fff)|| /* x not finite */
((sep==0x7fff)&& /* p is NaN */
((p0|p1)!=0)))
@@ -81,3 +69,4 @@ static long double zero = 0.0;
SET_LDOUBLE_EXP(x,sex^sx);
return x;
}
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_sinhl.c b/sysdeps/ieee754/ldbl-96/e_sinhl.c
index 646d4fd..8593272 100644
--- a/sysdeps/ieee754/ldbl-96/e_sinhl.c
+++ b/sysdeps/ieee754/ldbl-96/e_sinhl.c
@@ -23,9 +23,9 @@ static char rcsid[] = "$NetBSD: $";
* mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
* 1. Replace x by |x| (sinhl(-x) = -sinhl(x)).
* 2.
- * E + E/(E+1)
+ * E + E/(E+1)
* 0 <= x <= 25 : sinhl(x) := --------------, E=expm1l(x)
- * 2
+ * 2
*
* 25 <= x <= lnovft : sinhl(x) := expl(x)/2
* lnovft <= x <= ln2ovft: sinhl(x) := expl(x/2)/2 * expl(x/2)
@@ -39,18 +39,10 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, shuge = 1.0e4931L;
-#else
-static long double one = 1.0, shuge = 1.0e4931L;
-#endif
-#ifdef __STDC__
- long double __ieee754_sinhl(long double x)
-#else
- long double __ieee754_sinhl(x)
- long double x;
-#endif
+long double
+__ieee754_sinhl(long double x)
{
long double t,w,h;
u_int32_t jx,ix,i0,i1;
@@ -60,13 +52,13 @@ static long double one = 1.0, shuge = 1.0e4931L;
ix = jx&0x7fff;
/* x is INF or NaN */
- if(ix==0x7fff) return x+x;
+ if(__builtin_expect(ix==0x7fff, 0)) return x+x;
h = 0.5;
if (jx & 0x8000) h = -h;
/* |x| in [0,25], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x4003 || (ix == 0x4003 && i0 <= 0xc8000000)) { /* |x|<25 */
- if (ix<0x3fdf) /* |x|<2**-32 */
+ if (ix<0x3fdf) /* |x|<2**-32 */
if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
t = __expm1l(fabsl(x));
if(ix<0x3fff) return h*(2.0*t-t*t/(t+one));
@@ -89,3 +81,4 @@ static long double one = 1.0, shuge = 1.0e4931L;
/* |x| > overflowthreshold, sinhl(x) overflow */
return x*shuge;
}
+strong_alias (__ieee754_sinhl, __sinhl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/s_asinhl.c b/sysdeps/ieee754/ldbl-96/s_asinhl.c
index 6eb434c..9f37d48 100644
--- a/sysdeps/ieee754/ldbl-96/s_asinhl.c
+++ b/sysdeps/ieee754/ldbl-96/s_asinhl.c
@@ -52,19 +52,21 @@ huge= 1.000000000000000000e+4900L;
int32_t hx,ix;
GET_LDOUBLE_EXP(hx,x);
ix = hx&0x7fff;
- if(ix==0x7fff) return x+x; /* x is inf or NaN */
- if(ix< 0x3fde) { /* |x|<2**-34 */
+ if(__builtin_expect(ix< 0x3fde, 0)) { /* |x|<2**-34 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
- if(ix>0x4020) { /* |x| > 2**34 */
+ if(__builtin_expect(ix>0x4020,0)) { /* |x| > 2**34 */
+ if(ix==0x7fff) return x+x; /* x is inf or NaN */
w = __ieee754_logl(fabsl(x))+ln2;
- } else if (ix>0x4000) { /* 2**34 > |x| > 2.0 */
- t = fabsl(x);
- w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t));
- } else { /* 2.0 > |x| > 2**-28 */
- t = x*x;
- w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
+ } else {
+ long double xa = fabsl(x);
+ if (ix>0x4000) { /* 2**34 > |x| > 2.0 */
+ w = __ieee754_logl(2.0*xa+one/(__ieee754_sqrtl(xa*xa+one)+xa));
+ } else { /* 2.0 > |x| > 2**-28 */
+ t = xa*xa;
+ w =__log1pl(xa+t/(one+__ieee754_sqrtl(one+t)));
+ }
}
- if(hx&0x8000) return -w; else return w;
+ return __copysignl(w, x);
}
weak_alias (__asinhl, asinhl)
diff --git a/sysdeps/powerpc/fpu/e_hypot.c b/sysdeps/powerpc/fpu/e_hypot.c
index afbcc18..a8d67d8 100644
--- a/sysdeps/powerpc/fpu/e_hypot.c
+++ b/sysdeps/powerpc/fpu/e_hypot.c
@@ -115,3 +115,4 @@ __ieee754_hypot (double x, double y)
}
return __ieee754_sqrt (x * x + y * y);
}
+strong_alias (__ieee754_hypot, __hypot_finite)
diff --git a/sysdeps/powerpc/fpu/e_hypotf.c b/sysdeps/powerpc/fpu/e_hypotf.c
index 02ad773..915738c 100644
--- a/sysdeps/powerpc/fpu/e_hypotf.c
+++ b/sysdeps/powerpc/fpu/e_hypotf.c
@@ -116,3 +116,4 @@ __ieee754_hypotf (float x, float y)
}
return __ieee754_sqrtf (x * x + y * y);
}
+strong_alias (__ieee754_hypotf, __hypotf_finite)
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index e95b786..f9ded25 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
/* Double-precision floating point square root.
- Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2002-2004, 2008, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,21 +46,15 @@ extern const float __t_sqrt[1024];
generated guesses (which mostly runs on the integer unit, while the
Newton-Raphson is running on the FPU). */
-#ifdef __STDC__
double
__slow_ieee754_sqrt (double x)
-#else
-double
-__slow_ieee754_sqrt (x)
- double x;
-#endif
{
const float inf = a_inf.value;
if (x > 0)
{
/* schedule the EXTRACT_WORDS to get separation between the store
- and the load. */
+ and the load. */
ieee_double_shape_type ew_u;
ieee_double_shape_type iw_u;
ew_u.value = (x);
@@ -147,7 +141,7 @@ __slow_ieee754_sqrt (x)
else if (x < 0)
{
/* For some reason, some PowerPC32 processors don't implement
- FE_INVALID_SQRT. */
+ FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
feraiseexcept (FE_INVALID_SQRT);
@@ -160,14 +154,8 @@ __slow_ieee754_sqrt (x)
return f_wash (x);
}
-#ifdef __STDC__
double
__ieee754_sqrt (double x)
-#else
-double
-__ieee754_sqrt (x)
- double x;
-#endif
{
double z;
@@ -175,7 +163,7 @@ __ieee754_sqrt (x)
if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
- fsqrt instruction above the branch. */
+ fsqrt instruction above the branch. */
__asm __volatile (" fsqrt %0,%1\n"
:"=f" (z):"f" (x));
}
@@ -184,3 +172,4 @@ __ieee754_sqrt (x)
return z;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index ca44fac..965faee 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
/* Single-precision floating point square root.
- Copyright (C) 1997, 2003, 2004, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003, 2004, 2008, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,14 +46,8 @@ extern const float __t_sqrt[1024];
generated guesses (which mostly runs on the integer unit, while the
Newton-Raphson is running on the FPU). */
-#ifdef __STDC__
float
__slow_ieee754_sqrtf (float x)
-#else
-float
-__slow_ieee754_sqrtf (x)
- float x;
-#endif
{
const float inf = a_inf.value;
@@ -123,7 +117,7 @@ __slow_ieee754_sqrtf (x)
else if (x < 0)
{
/* For some reason, some PowerPC32 processors don't implement
- FE_INVALID_SQRT. */
+ FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
feraiseexcept (FE_INVALID_SQRT);
@@ -137,14 +131,8 @@ __slow_ieee754_sqrtf (x)
}
-#ifdef __STDC__
float
__ieee754_sqrtf (float x)
-#else
-float
-__ieee754_sqrtf (x)
- float x;
-#endif
{
double z;
@@ -152,7 +140,7 @@ __ieee754_sqrtf (x)
if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
- fsqrt instruction above the branch. */
+ fsqrt instruction above the branch. */
__asm __volatile (" fsqrts %0,%1\n"
:"=f" (z):"f" (x));
}
@@ -161,3 +149,4 @@ __ieee754_sqrtf (x)
return z;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
index 0a229cb..314abba 100644
--- a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
/* Double-precision floating point square root.
- Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2002-2004, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,4 @@ __ieee754_sqrt (double x)
__asm __volatile ("fsqrt %0,%1" : "=f" (z) : "f" (x));
return z;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
index 0f17a64..7157214 100644
--- a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
/* Single-precision floating point square root.
- Copyright (C) 1997, 2003, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003, 2004, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,4 @@ __ieee754_sqrtf (float x)
__asm ("fsqrts %0,%1" : "=f" (z) : "f" (x));
return z;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/s390/fpu/e_sqrt.c b/sysdeps/s390/fpu/e_sqrt.c
index e4b183e..affd3a1 100644
--- a/sysdeps/s390/fpu/e_sqrt.c
+++ b/sysdeps/s390/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+/* Copyright (C) 2004, 2011 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,4 @@ __ieee754_sqrt (double x)
asm ( "sqdbr %0,%1" : "=f" (res) : "f" (x) );
return res;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/s390/fpu/e_sqrtf.c b/sysdeps/s390/fpu/e_sqrtf.c
index 5b5e06e..4272f05 100644
--- a/sysdeps/s390/fpu/e_sqrtf.c
+++ b/sysdeps/s390/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+/* Copyright (C) 2004, 2011 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,4 @@ __ieee754_sqrtf (float x)
asm ( "sqebr %0,%1" : "=f" (res) : "f" (x) );
return res;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/s390/fpu/e_sqrtl.c b/sysdeps/s390/fpu/e_sqrtl.c
index e1daac1..45d0a0e 100644
--- a/sysdeps/s390/fpu/e_sqrtl.c
+++ b/sysdeps/s390/fpu/e_sqrtl.c
@@ -1,6 +1,6 @@
/* Square root. S/390 FPU version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ Copyright (C) 2004, 2006, 2011 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,3 +28,4 @@ __ieee754_sqrtl (long double x)
asm ( "sqxbr %0,%1" : "=f" (res) : "f" (x) );
return res;
}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
diff --git a/sysdeps/sparc/sparc32/e_sqrt.c b/sysdeps/sparc/sparc32/e_sqrt.c
index 0be4b6c..5969105 100644
--- a/sysdeps/sparc/sparc32/e_sqrt.c
+++ b/sysdeps/sparc/sparc32/e_sqrt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1997, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,3 +32,4 @@ __ieee754_sqrt (x)
asm ("fsqrtd %1, %0" : "=f" (result) : "f" (x));
return result;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/sparc/sparc64/fpu/e_sqrtl.c b/sysdeps/sparc/sparc64/fpu/e_sqrtl.c
index 4c3d19a..e1479c2 100644
--- a/sysdeps/sparc/sparc64/fpu/e_sqrtl.c
+++ b/sysdeps/sparc/sparc64/fpu/e_sqrtl.c
@@ -1,5 +1,5 @@
/* Long double square root, sparc64 version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
@@ -29,3 +29,4 @@ __ieee754_sqrtl (long double x)
_Qp_sqrt (&ret, &x);
return ret;
}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
index 11859f0..be2518d 100644
--- a/sysdeps/x86_64/fpu/bits/fenv.h
+++ b/sysdeps/x86_64/fpu/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2001,2004,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -95,3 +95,36 @@ fenv_t;
/* Floating-point environment where none of the exception is masked. */
# define FE_NOMASK_ENV ((__const fenv_t *) -2)
#endif
+
+
+#ifdef __OPTIMIZE__
+/* Optimized versions. */
+extern int __feraiseexcept_renamed (int) __asm__ ("feraiseexcept");
+__extern_inline int feraiseexcept (int __excepts)
+{
+ if (__builtin_constant_p (__excepts)
+ && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ {
+ if ((FE_INVALID & __excepts) != 0)
+ {
+ /* One example of a invalid operation is 0.0 / 0.0. */
+ float __f = 0.0;
+
+ __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
+ (void) &__f;
+ }
+ if ((FE_DIVBYZERO & __excepts) != 0)
+ {
+ float f = 1.0;
+ float g = 0.0;
+
+ __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g));
+ (void) &f;
+ }
+
+ return 0;
+ }
+
+ return __feraiseexcept_renamed (__excepts);
+}
+#endif
diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h
index 780f878..5bdf47e 100644
--- a/sysdeps/x86_64/fpu/bits/mathinline.h
+++ b/sysdeps/x86_64/fpu/bits/mathinline.h
@@ -103,7 +103,8 @@ __NTH (llrint (double __x))
}
# endif
-# if __FINITE_MATH_ONLY__ == 1 && (__WORDSIZE == 64 || defined __SSE2_MATH__)
+# if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 \
+ && (__WORDSIZE == 64 || defined __SSE2_MATH__)
/* Determine maximum of two values. */
__MATH_INLINE float
__NTH (fmaxf (float __x, float __y))
diff --git a/sysdeps/x86_64/fpu/e_exp2l.S b/sysdeps/x86_64/fpu/e_exp2l.S
index 336b989..7abf425 100644
--- a/sysdeps/x86_64/fpu/e_exp2l.S
+++ b/sysdeps/x86_64/fpu/e_exp2l.S
@@ -36,3 +36,4 @@ ENTRY(__ieee754_exp2l)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp2l)
+strong_alias (__ieee754_exp2l, __exp2l_finite)
diff --git a/sysdeps/x86_64/fpu/e_fmodl.S b/sysdeps/x86_64/fpu/e_fmodl.S
index 2967bf2..07c50df 100644
--- a/sysdeps/x86_64/fpu/e_fmodl.S
+++ b/sysdeps/x86_64/fpu/e_fmodl.S
@@ -20,3 +20,4 @@ ENTRY(__ieee754_fmodl)
fstp %st(1)
ret
END (__ieee754_fmodl)
+strong_alias (__ieee754_fmodl, __fmodl_finite)
diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S
index 633234b..50c5875 100644
--- a/sysdeps/x86_64/fpu/e_log10l.S
+++ b/sysdeps/x86_64/fpu/e_log10l.S
@@ -10,14 +10,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -30,9 +28,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##(%rip)
+# define MO(op) op##(%rip)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -65,3 +63,20 @@ ENTRY(__ieee754_log10l)
fstp %st(1)
ret
END(__ieee754_log10l)
+
+
+ENTRY(__log10l_finite)
+ fldlg2 // log10(2)
+ fldt 8(%rsp) // x : log10(2)
+ fld %st // x : x : log10(2)
+4: fsubl MO(one) // x-1 : x : log10(2)
+ fld %st // x-1 : x-1 : x : log10(2)
+ fabs // |x-1| : x-1 : x : log10(2)
+ fcompl MO(limit) // x-1 : x : log10(2)
+ fnstsw // x-1 : x : log10(2)
+ andb $0x45, %ah
+ jz 2b
+ fstp %st(1) // x-1 : log10(2)
+ fyl2xp1 // log10(x)
+ ret
+END(__log10l_finite)
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
index f04d30a..78dc2d5 100644
--- a/sysdeps/x86_64/fpu/e_log2l.S
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -10,11 +10,11 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -27,9 +27,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##(%rip)
+# define MO(op) op##(%rip)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -62,3 +62,20 @@ ENTRY(__ieee754_log2l)
fstp %st(1)
ret
END (__ieee754_log2l)
+
+
+ENTRY(__log2l_finite)
+ fldl MO(one)
+ fldt 8(%rsp) // x : 1
+ fld %st // x : x : 1
+ fsub %st(2), %st // x-1 : x : 1
+ fld %st // x-1 : x-1 : x : 1
+ fabs // |x-1| : x-1 : x : 1
+ fcompl MO(limit) // x-1 : x : 1
+ fnstsw // x-1 : x : 1
+ andb $0x45, %ah
+ jz 2b
+ fstp %st(1) // x-1 : 1
+ fyl2xp1 // log(x)
+ ret
+END (__log2l_finite)
diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S
index 2ba91ee..2503b9a 100644
--- a/sysdeps/x86_64/fpu/e_logl.S
+++ b/sysdeps/x86_64/fpu/e_logl.S
@@ -8,15 +8,13 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -29,9 +27,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##(%rip)
+# define MO(op) op##(%rip)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -64,3 +62,20 @@ ENTRY(__ieee754_logl)
fstp %st(1)
ret
END (__ieee754_logl)
+
+
+ENTRY(__logl_finite)
+ fldln2 // log(2)
+ fldt 8(%rsp) // x : log(2)
+ fld %st // x : x : log(2)
+ fsubl MO(one) // x-1 : x : log(2)
+ fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2b
+ fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+END (__logl_finite)
diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S
index a0b1b1d..a65c465 100644
--- a/sysdeps/x86_64/fpu/e_powl.S
+++ b/sysdeps/x86_64/fpu/e_powl.S
@@ -22,12 +22,27 @@
#include <machine/asm.h>
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
+ .p2align 3
+ ASM_TYPE_DIRECTIVE(one,@object)
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ ASM_TYPE_DIRECTIVE(limit,@object)
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ ASM_TYPE_DIRECTIVE(p63,@object)
+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
+ ASM_SIZE_DIRECTIVE(p63)
- .align ALIGNARG(4)
+#ifdef __ELF__
+ .section .rodata.cst16,"aM",@progbits,16
+#else
+ .text
+#endif
+ .p2align 3
ASM_TYPE_DIRECTIVE(infinity,@object)
inf_zero:
infinity:
@@ -43,21 +58,11 @@ minfinity:
mzero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
ASM_SIZE_DIRECTIVE(minf_mzero)
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
- ASM_TYPE_DIRECTIVE(limit,@object)
-limit: .double 0.29
- ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(p63,@object)
-p63:
- .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
- ASM_SIZE_DIRECTIVE(p63)
#ifdef PIC
-#define MO(op) op##(%rip)
+# define MO(op) op##(%rip)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -339,3 +344,4 @@ ENTRY(__ieee754_powl)
ret
END(__ieee754_powl)
+strong_alias (__ieee754_powl, __powl_finite)
diff --git a/sysdeps/x86_64/fpu/e_remainderl.S b/sysdeps/x86_64/fpu/e_remainderl.S
index 480b1ca..4ee0910 100644
--- a/sysdeps/x86_64/fpu/e_remainderl.S
+++ b/sysdeps/x86_64/fpu/e_remainderl.S
@@ -18,3 +18,4 @@ ENTRY(__ieee754_remainderl)
fstp %st(1)
ret
END (__ieee754_remainderl)
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/sysdeps/x86_64/fpu/e_scalbl.S b/sysdeps/x86_64/fpu/e_scalbl.S
index 6b22970..5833321 100644
--- a/sysdeps/x86_64/fpu/e_scalbl.S
+++ b/sysdeps/x86_64/fpu/e_scalbl.S
@@ -10,8 +10,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: $")
-
#ifdef __ELF__
.section .rodata
#else
@@ -23,16 +21,15 @@ RCSID("$NetBSD: $")
zero_nan:
.double 0.0
nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
-minus_zero:
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
ASM_SIZE_DIRECTIVE(zero_nan)
#ifdef PIC
-#define MO(op) op##(%rip)
+# define MO(op) op##(%rip)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -98,3 +95,4 @@ ENTRY(__ieee754_scalbl)
fdiv %st
ret
END(__ieee754_scalbl)
+strong_alias (__ieee754_scalbl, __scalbl_finite)
diff --git a/sysdeps/x86_64/fpu/e_sqrt.c b/sysdeps/x86_64/fpu/e_sqrt.c
index d588a8b..9912099 100644
--- a/sysdeps/x86_64/fpu/e_sqrt.c
+++ b/sysdeps/x86_64/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
/* Square root of floating point number.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,12 +19,14 @@
#include <math_private.h>
+#undef __ieee754_sqrt
double
__ieee754_sqrt (double x)
{
double res;
- asm ("sqrtsd %0, %1" : "=x" (res) : "x" (x));
+ asm ("sqrtsd %1, %0" : "=x" (res) : "xm" (x));
return res;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/x86_64/fpu/e_sqrtf.c b/sysdeps/x86_64/fpu/e_sqrtf.c
index f7801f0..dade4f5 100644
--- a/sysdeps/x86_64/fpu/e_sqrtf.c
+++ b/sysdeps/x86_64/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
/* Square root of floating point number.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,12 +19,14 @@
#include <math_private.h>
+#undef __ieee754_sqrtf
float
__ieee754_sqrtf (float x)
{
float res;
- asm ("sqrtss %0, %1" : "=x" (res) : "x" (x));
+ asm ("sqrtss %1, %0" : "=x" (res) : "xm" (x));
return res;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 37357d3..523ec54 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -58,22 +58,35 @@ do { \
#endif
#define __isnan(d) \
- ({ long int __di; EXTRACT_WORDS64 (__di, d); \
+ ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \
(__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; })
#define __isnanf(d) \
- ({ int __di; GET_FLOAT_WORD (__di, d); \
+ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) > 0x7f800000; })
#define __isinf_ns(d) \
- ({ long int __di; EXTRACT_WORDS64 (__di, d); \
+ ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \
(__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; })
#define __isinf_nsf(d) \
- ({ int __di; GET_FLOAT_WORD (__di, d); \
+ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) == 0x7f800000; })
#define __finite(d) \
- ({ long int __di; EXTRACT_WORDS64 (__di, d); \
+ ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \
(__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; })
#define __finitef(d) \
- ({ int __di; GET_FLOAT_WORD (__di, d); \
+ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) < 0x7f800000; })
+
+#define __ieee754_sqrt(d) \
+ ({ double __res; \
+ asm ("sqrtsd %1, %0" : "=x" (__res) : "xm" ((double) d)); \
+ __res; })
+#define __ieee754_sqrtf(d) \
+ ({ float __res; \
+ asm ("sqrtss %1, %0" : "=x" (__res) : "xm" ((float) d)); \
+ __res; })
+#define __ieee754_sqrtl(d) \
+ ({ long double __res; \
+ asm ("fsqrt" : "=t" (__res) : "0" ((long double) d)); \
+ __res; })