From abfbdde177c3a7155070dda1b2cdc8292054cc26 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 14 Jul 1999 00:54:57 +0000 Subject: Update. --- ChangeLog | 1127 +++++++++++++++++++++++++++++ math/machine/endian.h | 4 - math/math_private.h | 99 +-- math/w_acos.c | 48 ++ math/w_acosf.c | 48 ++ math/w_acosh.c | 47 ++ math/w_acoshf.c | 48 ++ math/w_acoshl.c | 47 ++ math/w_acosl.c | 48 ++ math/w_asin.c | 49 ++ math/w_asinf.c | 49 ++ math/w_asinl.c | 49 ++ math/w_atan2.c | 47 ++ math/w_atan2f.c | 46 ++ math/w_atan2l.c | 47 ++ math/w_atanh.c | 52 ++ math/w_atanhf.c | 53 ++ math/w_atanhl.c | 52 ++ math/w_cosh.c | 47 ++ math/w_coshf.c | 47 ++ math/w_coshl.c | 47 ++ math/w_drem.c | 20 + math/w_dremf.c | 17 + math/w_dreml.c | 18 + math/w_exp10.c | 61 ++ math/w_exp10f.c | 57 ++ math/w_exp10l.c | 56 ++ math/w_exp2.c | 36 + math/w_exp2f.c | 32 + math/w_exp2l.c | 30 + math/w_fmod.c | 48 ++ math/w_fmodf.c | 48 ++ math/w_fmodl.c | 48 ++ math/w_hypot.c | 48 ++ math/w_hypotf.c | 48 ++ math/w_hypotl.c | 48 ++ math/w_j0.c | 76 ++ math/w_j0f.c | 74 ++ math/w_j0l.c | 73 ++ math/w_j1.c | 77 ++ math/w_j1f.c | 75 ++ math/w_j1l.c | 74 ++ math/w_jn.c | 99 +++ math/w_jnf.c | 71 ++ math/w_jnl.c | 96 +++ math/w_lgamma.c | 60 ++ math/w_lgamma_r.c | 51 ++ math/w_lgammaf.c | 53 ++ math/w_lgammaf_r.c | 52 ++ math/w_lgammal.c | 58 ++ math/w_lgammal_r.c | 52 ++ math/w_log.c | 48 ++ math/w_log10.c | 51 ++ math/w_log10f.c | 52 ++ math/w_log10l.c | 51 ++ math/w_logf.c | 49 ++ math/w_logl.c | 48 ++ math/w_pow.c | 70 ++ math/w_powf.c | 77 ++ math/w_powl.c | 68 ++ math/w_remainder.c | 47 ++ math/w_remainderf.c | 47 ++ math/w_remainderl.c | 48 ++ math/w_scalb.c | 65 ++ math/w_scalbf.c | 66 ++ math/w_scalbl.c | 65 ++ math/w_sinh.c | 47 ++ math/w_sinhf.c | 47 ++ math/w_sinhl.c | 47 ++ math/w_sqrt.c | 47 ++ math/w_sqrtf.c | 47 ++ math/w_sqrtl.c | 47 ++ math/w_tgamma.c | 54 ++ math/w_tgammaf.c | 50 ++ math/w_tgammal.c | 53 ++ stdio-common/printf_fp.c | 25 +- sysdeps/alpha/Implies | 5 +- sysdeps/arm/Implies | 3 +- sysdeps/generic/e_atanhl.c | 14 + sysdeps/generic/e_coshl.c | 14 + sysdeps/generic/e_exp10.c | 30 + sysdeps/generic/e_exp10f.c | 30 + sysdeps/generic/e_exp10l.c | 30 + sysdeps/generic/e_gammal_r.c | 14 + sysdeps/generic/e_hypotl.c | 14 + sysdeps/generic/e_scalb.c | 59 ++ sysdeps/generic/e_scalbf.c | 56 ++ sysdeps/generic/e_scalbl.c | 63 ++ sysdeps/generic/e_sinhl.c | 14 + sysdeps/generic/ldbl2mpn.c | 33 +- sysdeps/generic/math_ldbl.h | 5 + sysdeps/generic/mpn2ldbl.c | 31 +- sysdeps/generic/printf_fphex.c | 64 +- sysdeps/generic/s_asinhl.c | 15 + sysdeps/generic/s_cacos.c | 41 ++ sysdeps/generic/s_cacosf.c | 37 + sysdeps/generic/s_cacosh.c | 88 +++ sysdeps/generic/s_cacoshf.c | 99 +++ sysdeps/generic/s_cacoshl.c | 84 +++ sysdeps/generic/s_cacosl.c | 37 + sysdeps/generic/s_casin.c | 66 ++ sysdeps/generic/s_casinf.c | 62 ++ sysdeps/generic/s_casinh.c | 84 +++ sysdeps/generic/s_casinhf.c | 80 ++ sysdeps/generic/s_casinhl.c | 80 ++ sysdeps/generic/s_casinl.c | 62 ++ sysdeps/generic/s_catan.c | 89 +++ sysdeps/generic/s_catanf.c | 85 +++ sysdeps/generic/s_catanh.c | 84 +++ sysdeps/generic/s_catanhf.c | 80 ++ sysdeps/generic/s_catanhl.c | 80 ++ sysdeps/generic/s_catanl.c | 85 +++ sysdeps/generic/s_cbrtl.c | 15 + sysdeps/generic/s_ccos.c | 80 ++ sysdeps/generic/s_ccosf.c | 76 ++ sysdeps/generic/s_ccosh.c | 105 +++ sysdeps/generic/s_ccoshf.c | 101 +++ sysdeps/generic/s_ccoshl.c | 101 +++ sysdeps/generic/s_ccosl.c | 76 ++ sysdeps/generic/s_cexp.c | 127 ++++ sysdeps/generic/s_cexpf.c | 123 ++++ sysdeps/generic/s_cexpl.c | 123 ++++ sysdeps/generic/s_clog.c | 65 ++ sysdeps/generic/s_clog10.c | 65 ++ sysdeps/generic/s_clog10f.c | 61 ++ sysdeps/generic/s_clog10l.c | 61 ++ sysdeps/generic/s_clogf.c | 61 ++ sysdeps/generic/s_clogl.c | 61 ++ sysdeps/generic/s_cpow.c | 34 + sysdeps/generic/s_cpowf.c | 30 + sysdeps/generic/s_cpowl.c | 30 + sysdeps/generic/s_cproj.c | 49 ++ sysdeps/generic/s_cprojf.c | 45 ++ sysdeps/generic/s_cprojl.c | 46 ++ sysdeps/generic/s_csin.c | 131 ++++ sysdeps/generic/s_csinf.c | 127 ++++ sysdeps/generic/s_csinh.c | 126 ++++ sysdeps/generic/s_csinhf.c | 122 ++++ sysdeps/generic/s_csinhl.c | 122 ++++ sysdeps/generic/s_csinl.c | 127 ++++ sysdeps/generic/s_csqrt.c | 114 +++ sysdeps/generic/s_csqrtf.c | 110 +++ sysdeps/generic/s_csqrtl.c | 110 +++ sysdeps/generic/s_ctan.c | 74 ++ sysdeps/generic/s_ctanf.c | 70 ++ sysdeps/generic/s_ctanh.c | 74 ++ sysdeps/generic/s_ctanhf.c | 70 ++ sysdeps/generic/s_ctanhl.c | 70 ++ sysdeps/generic/s_ctanl.c | 70 ++ sysdeps/generic/s_fdim.c | 40 + sysdeps/generic/s_fdimf.c | 36 + sysdeps/generic/s_fdiml.c | 36 + sysdeps/generic/s_fma.c | 28 + sysdeps/generic/s_fmaf.c | 28 + sysdeps/generic/s_fmal.c | 28 + sysdeps/generic/s_fmax.c | 33 + sysdeps/generic/s_fmaxf.c | 29 + sysdeps/generic/s_fmaxl.c | 29 + sysdeps/generic/s_fmin.c | 33 + sysdeps/generic/s_fminf.c | 29 + sysdeps/generic/s_fminl.c | 29 + sysdeps/generic/s_ldexp.c | 37 + sysdeps/generic/s_ldexpf.c | 36 + sysdeps/generic/s_ldexpl.c | 37 + sysdeps/generic/s_nan.c | 44 ++ sysdeps/generic/s_nanf.c | 40 + sysdeps/generic/s_nanl.c | 40 + sysdeps/generic/s_nextafter.c | 86 +++ sysdeps/generic/s_nexttowardf.c | 79 ++ sysdeps/generic/s_nexttowardl.c | 1 + sysdeps/generic/s_significand.c | 39 + sysdeps/generic/s_significandf.c | 32 + sysdeps/generic/s_significandl.c | 39 + sysdeps/generic/s_tanhl.c | 15 + sysdeps/generic/strtold.c | 42 +- sysdeps/generic/w_expl.c | 13 + sysdeps/i386/Implies | 4 +- sysdeps/i386/fpu/Implies | 2 - sysdeps/i386/fpu/e_acos.S | 21 + sysdeps/i386/fpu/e_acosf.S | 22 + sysdeps/i386/fpu/e_acosh.S | 105 +++ sysdeps/i386/fpu/e_acoshf.S | 105 +++ sysdeps/i386/fpu/e_acoshl.S | 112 +++ sysdeps/i386/fpu/e_acosl.S | 22 + sysdeps/i386/fpu/e_asin.S | 20 + sysdeps/i386/fpu/e_asinf.S | 21 + sysdeps/i386/fpu/e_asinl.S | 22 + sysdeps/i386/fpu/e_atan2.S | 15 + sysdeps/i386/fpu/e_atan2f.S | 15 + sysdeps/i386/fpu/e_atan2l.S | 17 + sysdeps/i386/fpu/e_atanh.S | 101 +++ sysdeps/i386/fpu/e_atanhf.S | 102 +++ sysdeps/i386/fpu/e_atanhl.S | 108 +++ sysdeps/i386/fpu/e_exp.S | 41 ++ sysdeps/i386/fpu/e_exp10.S | 38 + sysdeps/i386/fpu/e_exp10f.S | 38 + sysdeps/i386/fpu/e_exp10l.S | 38 + sysdeps/i386/fpu/e_expf.S | 42 ++ sysdeps/i386/fpu/e_expl.S | 43 ++ sysdeps/i386/fpu/e_fmod.S | 19 + sysdeps/i386/fpu/e_fmodf.S | 20 + sysdeps/i386/fpu/e_fmodl.S | 21 + sysdeps/i386/fpu/e_hypot.S | 62 ++ sysdeps/i386/fpu/e_hypotf.S | 62 ++ sysdeps/i386/fpu/e_log.S | 59 ++ sysdeps/i386/fpu/e_log10.S | 59 ++ sysdeps/i386/fpu/e_log10f.S | 60 ++ sysdeps/i386/fpu/e_log10l.S | 61 ++ sysdeps/i386/fpu/e_logf.S | 60 ++ sysdeps/i386/fpu/e_logl.S | 60 ++ sysdeps/i386/fpu/e_pow.S | 320 ++++++++ sysdeps/i386/fpu/e_powf.S | 310 ++++++++ sysdeps/i386/fpu/e_powl.S | 307 ++++++++ sysdeps/i386/fpu/e_rem_pio2.c | 3 + sysdeps/i386/fpu/e_rem_pio2f.c | 3 + sysdeps/i386/fpu/e_rem_pio2l.c | 3 + sysdeps/i386/fpu/e_remainder.S | 19 + sysdeps/i386/fpu/e_remainderf.S | 19 + sysdeps/i386/fpu/e_remainderl.S | 21 + sysdeps/i386/fpu/e_scalb.S | 94 +++ sysdeps/i386/fpu/e_scalbf.S | 96 +++ sysdeps/i386/fpu/e_scalbl.S | 96 +++ sysdeps/i386/fpu/e_sqrt.S | 14 + sysdeps/i386/fpu/e_sqrtf.S | 14 + sysdeps/i386/fpu/e_sqrtl.S | 16 + sysdeps/i386/fpu/k_rem_pio2.c | 3 + sysdeps/i386/fpu/k_rem_pio2f.c | 3 + sysdeps/i386/fpu/k_rem_pio2l.c | 3 + sysdeps/i386/fpu/s_asinh.S | 139 ++++ sysdeps/i386/fpu/s_asinhf.S | 139 ++++ sysdeps/i386/fpu/s_asinhl.S | 147 ++++ sysdeps/i386/fpu/s_atan.S | 16 + sysdeps/i386/fpu/s_atanf.S | 16 + sysdeps/i386/fpu/s_atanl.S | 18 + sysdeps/i386/fpu/s_cbrt.S | 201 +++++ sysdeps/i386/fpu/s_cbrtf.S | 178 +++++ sysdeps/i386/fpu/s_cbrtl.S | 229 ++++++ sysdeps/i386/fpu/s_ceil.S | 32 + sysdeps/i386/fpu/s_ceilf.S | 32 + sysdeps/i386/fpu/s_ceill.S | 33 + sysdeps/i386/fpu/s_cexp.S | 259 +++++++ sysdeps/i386/fpu/s_cexpf.S | 255 +++++++ sysdeps/i386/fpu/s_cexpl.S | 262 +++++++ sysdeps/i386/fpu/s_copysign.S | 20 + sysdeps/i386/fpu/s_copysignf.S | 20 + sysdeps/i386/fpu/s_copysignl.S | 21 + sysdeps/i386/fpu/s_cos.S | 29 + sysdeps/i386/fpu/s_cosf.S | 16 + sysdeps/i386/fpu/s_cosl.S | 31 + sysdeps/i386/fpu/s_exp2.S | 37 + sysdeps/i386/fpu/s_exp2f.S | 37 + sysdeps/i386/fpu/s_exp2l.S | 37 + sysdeps/i386/fpu/s_expm1.S | 88 +++ sysdeps/i386/fpu/s_expm1f.S | 88 +++ sysdeps/i386/fpu/s_expm1l.S | 88 +++ sysdeps/i386/fpu/s_fdim.S | 51 ++ sysdeps/i386/fpu/s_fdimf.S | 51 ++ sysdeps/i386/fpu/s_fdiml.S | 51 ++ sysdeps/i386/fpu/s_finite.S | 15 + sysdeps/i386/fpu/s_finitef.S | 15 + sysdeps/i386/fpu/s_finitel.S | 14 + sysdeps/i386/fpu/s_floor.S | 32 + sysdeps/i386/fpu/s_floorf.S | 32 + sysdeps/i386/fpu/s_floorl.S | 33 + sysdeps/i386/fpu/s_fma.S | 31 + sysdeps/i386/fpu/s_fmaf.S | 31 + sysdeps/i386/fpu/s_fmal.S | 32 + sysdeps/i386/fpu/s_fmax.S | 44 ++ sysdeps/i386/fpu/s_fmaxf.S | 44 ++ sysdeps/i386/fpu/s_fmaxl.S | 44 ++ sysdeps/i386/fpu/s_fmin.S | 44 ++ sysdeps/i386/fpu/s_fminf.S | 44 ++ sysdeps/i386/fpu/s_fminl.S | 44 ++ sysdeps/i386/fpu/s_frexp.S | 82 +++ sysdeps/i386/fpu/s_frexpf.S | 80 ++ sysdeps/i386/fpu/s_frexpl.S | 82 +++ sysdeps/i386/fpu/s_ilogb.S | 22 + sysdeps/i386/fpu/s_ilogbf.S | 22 + sysdeps/i386/fpu/s_ilogbl.S | 23 + sysdeps/i386/fpu/s_isinfl.c | 36 + sysdeps/i386/fpu/s_isnanl.c | 47 ++ sysdeps/i386/fpu/s_llrint.S | 34 + sysdeps/i386/fpu/s_llrintf.S | 34 + sysdeps/i386/fpu/s_llrintl.S | 34 + sysdeps/i386/fpu/s_log1p.S | 62 ++ sysdeps/i386/fpu/s_log1pf.S | 62 ++ sysdeps/i386/fpu/s_log1pl.S | 68 ++ sysdeps/i386/fpu/s_log2.S | 59 ++ sysdeps/i386/fpu/s_log2f.S | 59 ++ sysdeps/i386/fpu/s_log2l.S | 59 ++ sysdeps/i386/fpu/s_logb.S | 16 + sysdeps/i386/fpu/s_logbf.S | 16 + sysdeps/i386/fpu/s_logbl.S | 17 + sysdeps/i386/fpu/s_lrint.S | 33 + sysdeps/i386/fpu/s_lrintf.S | 33 + sysdeps/i386/fpu/s_lrintl.S | 33 + sysdeps/i386/fpu/s_nearbyint.S | 25 + sysdeps/i386/fpu/s_nearbyintf.S | 25 + sysdeps/i386/fpu/s_nearbyintl.S | 25 + sysdeps/i386/fpu/s_nextafterl.c | 102 +++ sysdeps/i386/fpu/s_remquo.S | 36 + sysdeps/i386/fpu/s_remquof.S | 36 + sysdeps/i386/fpu/s_remquol.S | 36 + sysdeps/i386/fpu/s_rint.S | 15 + sysdeps/i386/fpu/s_rintf.S | 15 + sysdeps/i386/fpu/s_rintl.S | 16 + sysdeps/i386/fpu/s_scalbln.c | 2 + sysdeps/i386/fpu/s_scalblnf.c | 2 + sysdeps/i386/fpu/s_scalblnl.c | 2 + sysdeps/i386/fpu/s_scalbn.S | 19 + sysdeps/i386/fpu/s_scalbnf.S | 19 + sysdeps/i386/fpu/s_scalbnl.S | 20 + sysdeps/i386/fpu/s_significand.S | 16 + sysdeps/i386/fpu/s_significandf.S | 16 + sysdeps/i386/fpu/s_significandl.S | 17 + sysdeps/i386/fpu/s_sin.S | 29 + sysdeps/i386/fpu/s_sincos.S | 48 ++ sysdeps/i386/fpu/s_sincosf.S | 48 ++ sysdeps/i386/fpu/s_sincosl.S | 48 ++ sysdeps/i386/fpu/s_sinf.S | 16 + sysdeps/i386/fpu/s_sinl.S | 31 + sysdeps/i386/fpu/s_tan.S | 30 + sysdeps/i386/fpu/s_tanf.S | 17 + sysdeps/i386/fpu/s_tanl.S | 32 + sysdeps/i386/fpu/s_trunc.S | 36 + sysdeps/i386/fpu/s_truncf.S | 36 + sysdeps/i386/fpu/s_truncl.S | 36 + sysdeps/i386/fpu/t_exp.c | 1 + sysdeps/i386/i686/Implies | 1 - sysdeps/i386/i686/fpu/s_fdim.S | 42 ++ sysdeps/i386/i686/fpu/s_fdimf.S | 42 ++ sysdeps/i386/i686/fpu/s_fdiml.S | 42 ++ sysdeps/i386/i686/fpu/s_fmax.S | 40 + sysdeps/i386/i686/fpu/s_fmaxf.S | 40 + sysdeps/i386/i686/fpu/s_fmaxl.S | 40 + sysdeps/i386/i686/fpu/s_fmin.S | 38 + sysdeps/i386/i686/fpu/s_fminf.S | 38 + sysdeps/i386/i686/fpu/s_fminl.S | 38 + sysdeps/i960/Implies | 3 +- sysdeps/ieee754/Implies | 2 - sysdeps/ieee754/dbl-64/Dist | 1 + sysdeps/ieee754/dbl-64/dbl2mpn.c | 107 +++ sysdeps/ieee754/dbl-64/e_acos.c | 144 ++++ sysdeps/ieee754/dbl-64/e_acosh.c | 69 ++ sysdeps/ieee754/dbl-64/e_asin.c | 143 ++++ sysdeps/ieee754/dbl-64/e_atan2.c | 130 ++++ sysdeps/ieee754/dbl-64/e_atanh.c | 74 ++ sysdeps/ieee754/dbl-64/e_cosh.c | 92 +++ sysdeps/ieee754/dbl-64/e_exp.c | 162 +++++ sysdeps/ieee754/dbl-64/e_fmod.c | 140 ++++ sysdeps/ieee754/dbl-64/e_gamma_r.c | 51 ++ sysdeps/ieee754/dbl-64/e_hypot.c | 128 ++++ sysdeps/ieee754/dbl-64/e_j0.c | 531 ++++++++++++++ sysdeps/ieee754/dbl-64/e_j1.c | 532 ++++++++++++++ sysdeps/ieee754/dbl-64/e_jn.c | 281 +++++++ sysdeps/ieee754/dbl-64/e_lgamma_r.c | 314 ++++++++ sysdeps/ieee754/dbl-64/e_log.c | 165 +++++ sysdeps/ieee754/dbl-64/e_log10.c | 98 +++ sysdeps/ieee754/dbl-64/e_pow.c | 352 +++++++++ sysdeps/ieee754/dbl-64/e_rem_pio2.c | 183 +++++ sysdeps/ieee754/dbl-64/e_remainder.c | 80 ++ sysdeps/ieee754/dbl-64/e_sinh.c | 86 +++ sysdeps/ieee754/dbl-64/e_sqrt.c | 452 ++++++++++++ sysdeps/ieee754/dbl-64/k_cos.c | 107 +++ sysdeps/ieee754/dbl-64/k_rem_pio2.c | 320 ++++++++ sysdeps/ieee754/dbl-64/k_sin.c | 91 +++ sysdeps/ieee754/dbl-64/k_tan.c | 145 ++++ sysdeps/ieee754/dbl-64/mpn2dbl.c | 46 ++ sysdeps/ieee754/dbl-64/s_asinh.c | 70 ++ sysdeps/ieee754/dbl-64/s_atan.c | 163 +++++ sysdeps/ieee754/dbl-64/s_cbrt.c | 76 ++ sysdeps/ieee754/dbl-64/s_ceil.c | 85 +++ sysdeps/ieee754/dbl-64/s_copysign.c | 43 ++ sysdeps/ieee754/dbl-64/s_cos.c | 87 +++ sysdeps/ieee754/dbl-64/s_erf.c | 431 +++++++++++ sysdeps/ieee754/dbl-64/s_exp2.c | 129 ++++ sysdeps/ieee754/dbl-64/s_expm1.c | 243 +++++++ sysdeps/ieee754/dbl-64/s_fabs.c | 40 + sysdeps/ieee754/dbl-64/s_finite.c | 40 + sysdeps/ieee754/dbl-64/s_floor.c | 86 +++ sysdeps/ieee754/dbl-64/s_fpclassify.c | 43 ++ sysdeps/ieee754/dbl-64/s_frexp.c | 64 ++ sysdeps/ieee754/dbl-64/s_ilogb.c | 56 ++ sysdeps/ieee754/dbl-64/s_isinf.c | 32 + sysdeps/ieee754/dbl-64/s_isnan.c | 43 ++ sysdeps/ieee754/dbl-64/s_llrint.c | 95 +++ sysdeps/ieee754/dbl-64/s_llround.c | 81 +++ sysdeps/ieee754/dbl-64/s_log1p.c | 191 +++++ sysdeps/ieee754/dbl-64/s_log2.c | 136 ++++ sysdeps/ieee754/dbl-64/s_logb.c | 47 ++ sysdeps/ieee754/dbl-64/s_lrint.c | 95 +++ sysdeps/ieee754/dbl-64/s_lround.c | 78 ++ sysdeps/ieee754/dbl-64/s_modf.c | 85 +++ sysdeps/ieee754/dbl-64/s_nearbyint.c | 98 +++ sysdeps/ieee754/dbl-64/s_nexttoward.c | 1 + sysdeps/ieee754/dbl-64/s_remquo.c | 113 +++ sysdeps/ieee754/dbl-64/s_rint.c | 91 +++ sysdeps/ieee754/dbl-64/s_round.c | 97 +++ sysdeps/ieee754/dbl-64/s_scalbln.c | 70 ++ sysdeps/ieee754/dbl-64/s_scalbn.c | 70 ++ sysdeps/ieee754/dbl-64/s_signbit.c | 32 + sysdeps/ieee754/dbl-64/s_sin.c | 87 +++ sysdeps/ieee754/dbl-64/s_sincos.c | 78 ++ sysdeps/ieee754/dbl-64/s_tan.c | 81 +++ sysdeps/ieee754/dbl-64/s_tanh.c | 93 +++ sysdeps/ieee754/dbl-64/s_trunc.c | 61 ++ sysdeps/ieee754/dbl-64/t_exp.c | 436 +++++++++++ sysdeps/ieee754/dbl-64/t_exp2.h | 585 +++++++++++++++ sysdeps/ieee754/dbl-64/w_exp.c | 58 ++ sysdeps/ieee754/dbl2mpn.c | 107 --- sysdeps/ieee754/flt-32/Dist | 1 + sysdeps/ieee754/flt-32/e_acosf.c | 89 +++ sysdeps/ieee754/flt-32/e_acoshf.c | 57 ++ sysdeps/ieee754/flt-32/e_asinf.c | 93 +++ sysdeps/ieee754/flt-32/e_atan2f.c | 105 +++ sysdeps/ieee754/flt-32/e_atanhf.c | 58 ++ sysdeps/ieee754/flt-32/e_coshf.c | 72 ++ sysdeps/ieee754/flt-32/e_expf.c | 140 ++++ sysdeps/ieee754/flt-32/e_fmodf.c | 113 +++ sysdeps/ieee754/flt-32/e_gammaf_r.c | 50 ++ sysdeps/ieee754/flt-32/e_hypotf.c | 87 +++ sysdeps/ieee754/flt-32/e_j0f.c | 444 ++++++++++++ sysdeps/ieee754/flt-32/e_j1f.c | 444 ++++++++++++ sysdeps/ieee754/flt-32/e_jnf.c | 213 ++++++ sysdeps/ieee754/flt-32/e_lgammaf_r.c | 250 +++++++ sysdeps/ieee754/flt-32/e_log10f.c | 67 ++ sysdeps/ieee754/flt-32/e_logf.c | 99 +++ sysdeps/ieee754/flt-32/e_powf.c | 253 +++++++ sysdeps/ieee754/flt-32/e_rem_pio2f.c | 196 +++++ sysdeps/ieee754/flt-32/e_remainderf.c | 73 ++ sysdeps/ieee754/flt-32/e_sinhf.c | 68 ++ sysdeps/ieee754/flt-32/e_sqrtf.c | 97 +++ sysdeps/ieee754/flt-32/k_cosf.c | 64 ++ sysdeps/ieee754/flt-32/k_rem_pio2f.c | 213 ++++++ sysdeps/ieee754/flt-32/k_sinf.c | 54 ++ sysdeps/ieee754/flt-32/k_tanf.c | 101 +++ sysdeps/ieee754/flt-32/mpn2flt.c | 42 ++ sysdeps/ieee754/flt-32/s_asinhf.c | 58 ++ sysdeps/ieee754/flt-32/s_atanf.c | 120 +++ sysdeps/ieee754/flt-32/s_cbrtf.c | 64 ++ sysdeps/ieee754/flt-32/s_ceilf.c | 62 ++ sysdeps/ieee754/flt-32/s_copysignf.c | 42 ++ sysdeps/ieee754/flt-32/s_cosf.c | 60 ++ sysdeps/ieee754/flt-32/s_erff.c | 225 ++++++ sysdeps/ieee754/flt-32/s_exp2f.c | 127 ++++ sysdeps/ieee754/flt-32/s_expm1f.c | 135 ++++ sysdeps/ieee754/flt-32/s_fabsf.c | 39 + sysdeps/ieee754/flt-32/s_finitef.c | 39 + sysdeps/ieee754/flt-32/s_floorf.c | 71 ++ sysdeps/ieee754/flt-32/s_fpclassifyf.c | 42 ++ sysdeps/ieee754/flt-32/s_frexpf.c | 53 ++ sysdeps/ieee754/flt-32/s_ilogbf.c | 44 ++ sysdeps/ieee754/flt-32/s_isinff.c | 28 + sysdeps/ieee754/flt-32/s_isnanf.c | 41 ++ sysdeps/ieee754/flt-32/s_llrintf.c | 78 ++ sysdeps/ieee754/flt-32/s_llroundf.c | 63 ++ sysdeps/ieee754/flt-32/s_log1pf.c | 115 +++ sysdeps/ieee754/flt-32/s_log2f.c | 91 +++ sysdeps/ieee754/flt-32/s_logbf.c | 40 + sysdeps/ieee754/flt-32/s_lrintf.c | 78 ++ sysdeps/ieee754/flt-32/s_lroundf.c | 63 ++ sysdeps/ieee754/flt-32/s_modff.c | 66 ++ sysdeps/ieee754/flt-32/s_nearbyintf.c | 77 ++ sysdeps/ieee754/flt-32/s_nextafterf.c | 71 ++ sysdeps/ieee754/flt-32/s_remquof.c | 108 +++ sysdeps/ieee754/flt-32/s_rintf.c | 72 ++ sysdeps/ieee754/flt-32/s_roundf.c | 73 ++ sysdeps/ieee754/flt-32/s_scalblnf.c | 63 ++ sysdeps/ieee754/flt-32/s_scalbnf.c | 63 ++ sysdeps/ieee754/flt-32/s_signbitf.c | 32 + sysdeps/ieee754/flt-32/s_sincosf.c | 74 ++ sysdeps/ieee754/flt-32/s_sinf.c | 54 ++ sysdeps/ieee754/flt-32/s_tanf.c | 49 ++ sysdeps/ieee754/flt-32/s_tanhf.c | 67 ++ sysdeps/ieee754/flt-32/s_truncf.c | 52 ++ sysdeps/ieee754/flt-32/t_exp2f.h | 352 +++++++++ sysdeps/ieee754/flt-32/w_expf.c | 59 ++ sysdeps/ieee754/k_standard.c | 943 ++++++++++++++++++++++++ sysdeps/ieee754/ldbl-128/e_acoshl.c | 68 ++ sysdeps/ieee754/ldbl-128/e_atan2l.c | 129 ++++ sysdeps/ieee754/ldbl-128/e_fmodl.c | 138 ++++ sysdeps/ieee754/ldbl-128/e_gammal_r.c | 52 ++ sysdeps/ieee754/ldbl-128/e_remainderl.c | 78 ++ sysdeps/ieee754/ldbl-128/ieee754.h | 171 +++++ sysdeps/ieee754/ldbl-128/ldbl2mpn.c | 137 ++++ sysdeps/ieee754/ldbl-128/math_ldbl.h | 82 +++ sysdeps/ieee754/ldbl-128/mpn2ldbl.c | 51 ++ sysdeps/ieee754/ldbl-128/printf_fphex.c | 84 +++ sysdeps/ieee754/ldbl-128/s_ceill.c | 84 +++ sysdeps/ieee754/ldbl-128/s_copysignl.c | 43 ++ sysdeps/ieee754/ldbl-128/s_cosl.c | 83 +++ sysdeps/ieee754/ldbl-128/s_fabsl.c | 39 + sysdeps/ieee754/ldbl-128/s_finitel.c | 40 + sysdeps/ieee754/ldbl-128/s_floorl.c | 85 +++ sysdeps/ieee754/ldbl-128/s_fpclassifyl.c | 44 ++ sysdeps/ieee754/ldbl-128/s_frexpl.c | 63 ++ sysdeps/ieee754/ldbl-128/s_ilogbl.c | 55 ++ sysdeps/ieee754/ldbl-128/s_isinfl.c | 28 + sysdeps/ieee754/ldbl-128/s_isnanl.c | 42 ++ sysdeps/ieee754/ldbl-128/s_llrintl.c | 75 ++ sysdeps/ieee754/ldbl-128/s_llroundl.c | 74 ++ sysdeps/ieee754/ldbl-128/s_logbl.c | 46 ++ sysdeps/ieee754/ldbl-128/s_lrintl.c | 91 +++ sysdeps/ieee754/ldbl-128/s_lroundl.c | 74 ++ sysdeps/ieee754/ldbl-128/s_modfl.c | 88 +++ sysdeps/ieee754/ldbl-128/s_nearbyintl.c | 93 +++ sysdeps/ieee754/ldbl-128/s_nextafterl.c | 85 +++ sysdeps/ieee754/ldbl-128/s_nexttoward.c | 97 +++ sysdeps/ieee754/ldbl-128/s_nexttowardf.c | 81 +++ sysdeps/ieee754/ldbl-128/s_remquol.c | 110 +++ sysdeps/ieee754/ldbl-128/s_rintl.c | 90 +++ sysdeps/ieee754/ldbl-128/s_roundl.c | 94 +++ sysdeps/ieee754/ldbl-128/s_scalblnl.c | 70 ++ sysdeps/ieee754/ldbl-128/s_scalbnl.c | 70 ++ sysdeps/ieee754/ldbl-128/s_signbitl.c | 32 + sysdeps/ieee754/ldbl-128/s_sincosl.c | 77 ++ sysdeps/ieee754/ldbl-128/s_sinl.c | 83 +++ sysdeps/ieee754/ldbl-128/s_tanl.c | 77 ++ sysdeps/ieee754/ldbl-128/s_truncl.c | 57 ++ sysdeps/ieee754/ldbl-128/strtold.c | 42 ++ sysdeps/ieee754/ldbl-96/e_acoshl.c | 72 ++ sysdeps/ieee754/ldbl-96/e_atan2l.c | 136 ++++ sysdeps/ieee754/ldbl-96/e_atanhl.c | 79 ++ sysdeps/ieee754/ldbl-96/e_coshl.c | 94 +++ sysdeps/ieee754/ldbl-96/e_gammal_r.c | 50 ++ sysdeps/ieee754/ldbl-96/e_hypotl.c | 133 ++++ sysdeps/ieee754/ldbl-96/e_remainderl.c | 83 +++ sysdeps/ieee754/ldbl-96/e_sinhl.c | 91 +++ sysdeps/ieee754/ldbl-96/ldbl2mpn.c | 95 +++ sysdeps/ieee754/ldbl-96/math_ldbl.h | 98 +++ sysdeps/ieee754/ldbl-96/mpn2ldbl.c | 47 ++ sysdeps/ieee754/ldbl-96/printf_fphex.c | 61 ++ sysdeps/ieee754/ldbl-96/s_asinhl.c | 70 ++ sysdeps/ieee754/ldbl-96/s_cbrtl.c | 78 ++ sysdeps/ieee754/ldbl-96/s_ceill.c | 89 +++ sysdeps/ieee754/ldbl-96/s_copysignl.c | 43 ++ sysdeps/ieee754/ldbl-96/s_cosl.c | 88 +++ sysdeps/ieee754/ldbl-96/s_fabsl.c | 40 + sysdeps/ieee754/ldbl-96/s_finitel.c | 40 + sysdeps/ieee754/ldbl-96/s_floorl.c | 90 +++ sysdeps/ieee754/ldbl-96/s_fpclassifyl.c | 44 ++ sysdeps/ieee754/ldbl-96/s_frexpl.c | 69 ++ sysdeps/ieee754/ldbl-96/s_ilogbl.c | 56 ++ sysdeps/ieee754/ldbl-96/s_isinfl.c | 29 + sysdeps/ieee754/ldbl-96/s_isnanl.c | 44 ++ sysdeps/ieee754/ldbl-96/s_llrintl.c | 77 ++ sysdeps/ieee754/ldbl-96/s_llroundl.c | 81 +++ sysdeps/ieee754/ldbl-96/s_logbl.c | 47 ++ sysdeps/ieee754/ldbl-96/s_lrintl.c | 86 +++ sysdeps/ieee754/ldbl-96/s_lroundl.c | 78 ++ sysdeps/ieee754/ldbl-96/s_modfl.c | 85 +++ sysdeps/ieee754/ldbl-96/s_nearbyintl.c | 95 +++ sysdeps/ieee754/ldbl-96/s_nextafterl.c | 101 +++ sysdeps/ieee754/ldbl-96/s_nexttoward.c | 98 +++ sysdeps/ieee754/ldbl-96/s_nexttowardf.c | 78 ++ sysdeps/ieee754/ldbl-96/s_remquol.c | 109 +++ sysdeps/ieee754/ldbl-96/s_rintl.c | 91 +++ sysdeps/ieee754/ldbl-96/s_roundl.c | 106 +++ sysdeps/ieee754/ldbl-96/s_scalblnl.c | 71 ++ sysdeps/ieee754/ldbl-96/s_scalbnl.c | 71 ++ sysdeps/ieee754/ldbl-96/s_signbitl.c | 32 + sysdeps/ieee754/ldbl-96/s_sincosl.c | 74 ++ sysdeps/ieee754/ldbl-96/s_sinl.c | 88 +++ sysdeps/ieee754/ldbl-96/s_tanhl.c | 95 +++ sysdeps/ieee754/ldbl-96/s_tanl.c | 81 +++ sysdeps/ieee754/ldbl-96/s_truncl.c | 57 ++ sysdeps/ieee754/ldbl-96/strtold.c | 42 ++ sysdeps/ieee754/ldbl-96/w_expl.c | 60 ++ sysdeps/ieee754/ldbl2mpn.c | 99 --- sysdeps/ieee754/mpn2dbl.c | 46 -- sysdeps/ieee754/mpn2flt.c | 42 -- sysdeps/ieee754/mpn2ldbl.c | 51 -- sysdeps/ieee754/s_lib_version.c | 40 + sysdeps/ieee754/s_matherr.c | 35 + sysdeps/ieee754/s_signgam.c | 3 + sysdeps/libm-i387/e_acos.S | 21 - sysdeps/libm-i387/e_acosf.S | 22 - sysdeps/libm-i387/e_acosh.S | 105 --- sysdeps/libm-i387/e_acoshf.S | 105 --- sysdeps/libm-i387/e_acoshl.S | 112 --- sysdeps/libm-i387/e_acosl.S | 22 - sysdeps/libm-i387/e_asin.S | 20 - sysdeps/libm-i387/e_asinf.S | 21 - sysdeps/libm-i387/e_asinl.S | 22 - sysdeps/libm-i387/e_atan2.S | 15 - sysdeps/libm-i387/e_atan2f.S | 15 - sysdeps/libm-i387/e_atan2l.S | 17 - sysdeps/libm-i387/e_atanh.S | 101 --- sysdeps/libm-i387/e_atanhf.S | 102 --- sysdeps/libm-i387/e_atanhl.S | 108 --- sysdeps/libm-i387/e_exp.S | 41 -- sysdeps/libm-i387/e_exp10.S | 38 - sysdeps/libm-i387/e_exp10f.S | 38 - sysdeps/libm-i387/e_exp10l.S | 38 - sysdeps/libm-i387/e_expf.S | 42 -- sysdeps/libm-i387/e_expl.S | 43 -- sysdeps/libm-i387/e_fmod.S | 19 - sysdeps/libm-i387/e_fmodf.S | 20 - sysdeps/libm-i387/e_fmodl.S | 21 - sysdeps/libm-i387/e_hypot.S | 62 -- sysdeps/libm-i387/e_hypotf.S | 62 -- sysdeps/libm-i387/e_log.S | 59 -- sysdeps/libm-i387/e_log10.S | 59 -- sysdeps/libm-i387/e_log10f.S | 60 -- sysdeps/libm-i387/e_log10l.S | 61 -- sysdeps/libm-i387/e_logf.S | 60 -- sysdeps/libm-i387/e_logl.S | 60 -- sysdeps/libm-i387/e_pow.S | 320 -------- sysdeps/libm-i387/e_powf.S | 310 -------- sysdeps/libm-i387/e_powl.S | 307 -------- sysdeps/libm-i387/e_rem_pio2.c | 3 - sysdeps/libm-i387/e_rem_pio2f.c | 3 - sysdeps/libm-i387/e_rem_pio2l.c | 3 - sysdeps/libm-i387/e_remainder.S | 19 - sysdeps/libm-i387/e_remainderf.S | 19 - sysdeps/libm-i387/e_remainderl.S | 21 - sysdeps/libm-i387/e_scalb.S | 94 --- sysdeps/libm-i387/e_scalbf.S | 96 --- sysdeps/libm-i387/e_scalbl.S | 96 --- sysdeps/libm-i387/e_sqrt.S | 14 - sysdeps/libm-i387/e_sqrtf.S | 14 - sysdeps/libm-i387/e_sqrtl.S | 16 - sysdeps/libm-i387/i686/s_fdim.S | 42 -- sysdeps/libm-i387/i686/s_fdimf.S | 42 -- sysdeps/libm-i387/i686/s_fdiml.S | 42 -- sysdeps/libm-i387/i686/s_fmax.S | 40 - sysdeps/libm-i387/i686/s_fmaxf.S | 40 - sysdeps/libm-i387/i686/s_fmaxl.S | 40 - sysdeps/libm-i387/i686/s_fmin.S | 38 - sysdeps/libm-i387/i686/s_fminf.S | 38 - sysdeps/libm-i387/i686/s_fminl.S | 38 - sysdeps/libm-i387/k_rem_pio2.c | 3 - sysdeps/libm-i387/k_rem_pio2f.c | 3 - sysdeps/libm-i387/k_rem_pio2l.c | 3 - sysdeps/libm-i387/s_asinh.S | 139 ---- sysdeps/libm-i387/s_asinhf.S | 139 ---- sysdeps/libm-i387/s_asinhl.S | 147 ---- sysdeps/libm-i387/s_atan.S | 16 - sysdeps/libm-i387/s_atanf.S | 16 - sysdeps/libm-i387/s_atanl.S | 18 - sysdeps/libm-i387/s_cbrt.S | 201 ----- sysdeps/libm-i387/s_cbrtf.S | 178 ----- sysdeps/libm-i387/s_cbrtl.S | 229 ------ sysdeps/libm-i387/s_ceil.S | 32 - sysdeps/libm-i387/s_ceilf.S | 32 - sysdeps/libm-i387/s_ceill.S | 33 - sysdeps/libm-i387/s_cexp.S | 259 ------- sysdeps/libm-i387/s_cexpf.S | 255 ------- sysdeps/libm-i387/s_cexpl.S | 262 ------- sysdeps/libm-i387/s_copysign.S | 20 - sysdeps/libm-i387/s_copysignf.S | 20 - sysdeps/libm-i387/s_copysignl.S | 21 - sysdeps/libm-i387/s_cos.S | 29 - sysdeps/libm-i387/s_cosf.S | 16 - sysdeps/libm-i387/s_cosl.S | 31 - sysdeps/libm-i387/s_exp2.S | 37 - sysdeps/libm-i387/s_exp2f.S | 37 - sysdeps/libm-i387/s_exp2l.S | 37 - sysdeps/libm-i387/s_expm1.S | 88 --- sysdeps/libm-i387/s_expm1f.S | 88 --- sysdeps/libm-i387/s_expm1l.S | 88 --- sysdeps/libm-i387/s_fdim.S | 51 -- sysdeps/libm-i387/s_fdimf.S | 51 -- sysdeps/libm-i387/s_fdiml.S | 51 -- sysdeps/libm-i387/s_finite.S | 15 - sysdeps/libm-i387/s_finitef.S | 15 - sysdeps/libm-i387/s_finitel.S | 14 - sysdeps/libm-i387/s_floor.S | 32 - sysdeps/libm-i387/s_floorf.S | 32 - sysdeps/libm-i387/s_floorl.S | 33 - sysdeps/libm-i387/s_fma.S | 31 - sysdeps/libm-i387/s_fmaf.S | 31 - sysdeps/libm-i387/s_fmal.S | 32 - sysdeps/libm-i387/s_fmax.S | 44 -- sysdeps/libm-i387/s_fmaxf.S | 44 -- sysdeps/libm-i387/s_fmaxl.S | 44 -- sysdeps/libm-i387/s_fmin.S | 44 -- sysdeps/libm-i387/s_fminf.S | 44 -- sysdeps/libm-i387/s_fminl.S | 44 -- sysdeps/libm-i387/s_frexp.S | 82 --- sysdeps/libm-i387/s_frexpf.S | 80 -- sysdeps/libm-i387/s_frexpl.S | 82 --- sysdeps/libm-i387/s_ilogb.S | 22 - sysdeps/libm-i387/s_ilogbf.S | 22 - sysdeps/libm-i387/s_ilogbl.S | 23 - sysdeps/libm-i387/s_isinfl.c | 36 - sysdeps/libm-i387/s_isnanl.c | 47 -- sysdeps/libm-i387/s_llrint.S | 34 - sysdeps/libm-i387/s_llrintf.S | 34 - sysdeps/libm-i387/s_llrintl.S | 34 - sysdeps/libm-i387/s_log1p.S | 62 -- sysdeps/libm-i387/s_log1pf.S | 62 -- sysdeps/libm-i387/s_log1pl.S | 68 -- sysdeps/libm-i387/s_log2.S | 59 -- sysdeps/libm-i387/s_log2f.S | 59 -- sysdeps/libm-i387/s_log2l.S | 59 -- sysdeps/libm-i387/s_logb.S | 16 - sysdeps/libm-i387/s_logbf.S | 16 - sysdeps/libm-i387/s_logbl.S | 17 - sysdeps/libm-i387/s_lrint.S | 33 - sysdeps/libm-i387/s_lrintf.S | 33 - sysdeps/libm-i387/s_lrintl.S | 33 - sysdeps/libm-i387/s_nearbyint.S | 25 - sysdeps/libm-i387/s_nearbyintf.S | 25 - sysdeps/libm-i387/s_nearbyintl.S | 25 - sysdeps/libm-i387/s_nextafterl.c | 102 --- sysdeps/libm-i387/s_remquo.S | 36 - sysdeps/libm-i387/s_remquof.S | 36 - sysdeps/libm-i387/s_remquol.S | 36 - sysdeps/libm-i387/s_rint.S | 15 - sysdeps/libm-i387/s_rintf.S | 15 - sysdeps/libm-i387/s_rintl.S | 16 - sysdeps/libm-i387/s_scalbln.c | 2 - sysdeps/libm-i387/s_scalblnf.c | 2 - sysdeps/libm-i387/s_scalblnl.c | 2 - sysdeps/libm-i387/s_scalbn.S | 19 - sysdeps/libm-i387/s_scalbnf.S | 19 - sysdeps/libm-i387/s_scalbnl.S | 20 - sysdeps/libm-i387/s_significand.S | 16 - sysdeps/libm-i387/s_significandf.S | 16 - sysdeps/libm-i387/s_significandl.S | 17 - sysdeps/libm-i387/s_sin.S | 29 - sysdeps/libm-i387/s_sincos.S | 48 -- sysdeps/libm-i387/s_sincosf.S | 48 -- sysdeps/libm-i387/s_sincosl.S | 48 -- sysdeps/libm-i387/s_sinf.S | 16 - sysdeps/libm-i387/s_sinl.S | 31 - sysdeps/libm-i387/s_tan.S | 30 - sysdeps/libm-i387/s_tanf.S | 17 - sysdeps/libm-i387/s_tanl.S | 32 - sysdeps/libm-i387/s_trunc.S | 36 - sysdeps/libm-i387/s_truncf.S | 36 - sysdeps/libm-i387/s_truncl.S | 36 - sysdeps/libm-i387/t_exp.c | 1 - sysdeps/libm-ieee754/Dist | 2 - sysdeps/libm-ieee754/e_acos.c | 144 ---- sysdeps/libm-ieee754/e_acosf.c | 89 --- sysdeps/libm-ieee754/e_acosh.c | 69 -- sysdeps/libm-ieee754/e_acoshf.c | 57 -- sysdeps/libm-ieee754/e_acoshl.c | 72 -- sysdeps/libm-ieee754/e_asin.c | 143 ---- sysdeps/libm-ieee754/e_asinf.c | 93 --- sysdeps/libm-ieee754/e_atan2.c | 130 ---- sysdeps/libm-ieee754/e_atan2f.c | 105 --- sysdeps/libm-ieee754/e_atan2l.c | 136 ---- sysdeps/libm-ieee754/e_atanh.c | 74 -- sysdeps/libm-ieee754/e_atanhf.c | 58 -- sysdeps/libm-ieee754/e_atanhl.c | 79 -- sysdeps/libm-ieee754/e_cosh.c | 92 --- sysdeps/libm-ieee754/e_coshf.c | 72 -- sysdeps/libm-ieee754/e_coshl.c | 94 --- sysdeps/libm-ieee754/e_exp.c | 162 ----- sysdeps/libm-ieee754/e_exp10.c | 30 - sysdeps/libm-ieee754/e_exp10f.c | 30 - sysdeps/libm-ieee754/e_exp10l.c | 30 - sysdeps/libm-ieee754/e_expf.c | 140 ---- sysdeps/libm-ieee754/e_fmod.c | 140 ---- sysdeps/libm-ieee754/e_fmodf.c | 113 --- sysdeps/libm-ieee754/e_gamma_r.c | 51 -- sysdeps/libm-ieee754/e_gammaf_r.c | 50 -- sysdeps/libm-ieee754/e_gammal_r.c | 50 -- sysdeps/libm-ieee754/e_hypot.c | 128 ---- sysdeps/libm-ieee754/e_hypotf.c | 87 --- sysdeps/libm-ieee754/e_hypotl.c | 133 ---- sysdeps/libm-ieee754/e_j0.c | 531 -------------- sysdeps/libm-ieee754/e_j0f.c | 444 ------------ sysdeps/libm-ieee754/e_j1.c | 532 -------------- sysdeps/libm-ieee754/e_j1f.c | 444 ------------ sysdeps/libm-ieee754/e_jn.c | 281 ------- sysdeps/libm-ieee754/e_jnf.c | 213 ------ sysdeps/libm-ieee754/e_lgamma_r.c | 314 -------- sysdeps/libm-ieee754/e_lgammaf_r.c | 250 ------- sysdeps/libm-ieee754/e_log.c | 165 ----- sysdeps/libm-ieee754/e_log10.c | 98 --- sysdeps/libm-ieee754/e_log10f.c | 67 -- sysdeps/libm-ieee754/e_logf.c | 99 --- sysdeps/libm-ieee754/e_pow.c | 352 --------- sysdeps/libm-ieee754/e_powf.c | 253 ------- sysdeps/libm-ieee754/e_rem_pio2.c | 183 ----- sysdeps/libm-ieee754/e_rem_pio2f.c | 196 ----- sysdeps/libm-ieee754/e_remainder.c | 80 -- sysdeps/libm-ieee754/e_remainderf.c | 73 -- sysdeps/libm-ieee754/e_remainderl.c | 83 --- sysdeps/libm-ieee754/e_scalb.c | 59 -- sysdeps/libm-ieee754/e_scalbf.c | 56 -- sysdeps/libm-ieee754/e_scalbl.c | 63 -- sysdeps/libm-ieee754/e_sinh.c | 86 --- sysdeps/libm-ieee754/e_sinhf.c | 68 -- sysdeps/libm-ieee754/e_sinhl.c | 91 --- sysdeps/libm-ieee754/e_sqrt.c | 452 ------------ sysdeps/libm-ieee754/e_sqrtf.c | 97 --- sysdeps/libm-ieee754/k_cos.c | 107 --- sysdeps/libm-ieee754/k_cosf.c | 64 -- sysdeps/libm-ieee754/k_rem_pio2.c | 320 -------- sysdeps/libm-ieee754/k_rem_pio2f.c | 213 ------ sysdeps/libm-ieee754/k_sin.c | 91 --- sysdeps/libm-ieee754/k_sinf.c | 54 -- sysdeps/libm-ieee754/k_standard.c | 943 ------------------------ sysdeps/libm-ieee754/k_tan.c | 145 ---- sysdeps/libm-ieee754/k_tanf.c | 101 --- sysdeps/libm-ieee754/s_asinh.c | 70 -- sysdeps/libm-ieee754/s_asinhf.c | 58 -- sysdeps/libm-ieee754/s_asinhl.c | 70 -- sysdeps/libm-ieee754/s_atan.c | 163 ----- sysdeps/libm-ieee754/s_atanf.c | 120 --- sysdeps/libm-ieee754/s_cacos.c | 41 -- sysdeps/libm-ieee754/s_cacosf.c | 37 - sysdeps/libm-ieee754/s_cacosh.c | 88 --- sysdeps/libm-ieee754/s_cacoshf.c | 99 --- sysdeps/libm-ieee754/s_cacoshl.c | 84 --- sysdeps/libm-ieee754/s_cacosl.c | 37 - sysdeps/libm-ieee754/s_casin.c | 66 -- sysdeps/libm-ieee754/s_casinf.c | 62 -- sysdeps/libm-ieee754/s_casinh.c | 84 --- sysdeps/libm-ieee754/s_casinhf.c | 80 -- sysdeps/libm-ieee754/s_casinhl.c | 80 -- sysdeps/libm-ieee754/s_casinl.c | 62 -- sysdeps/libm-ieee754/s_catan.c | 89 --- sysdeps/libm-ieee754/s_catanf.c | 85 --- sysdeps/libm-ieee754/s_catanh.c | 84 --- sysdeps/libm-ieee754/s_catanhf.c | 80 -- sysdeps/libm-ieee754/s_catanhl.c | 80 -- sysdeps/libm-ieee754/s_catanl.c | 85 --- sysdeps/libm-ieee754/s_cbrt.c | 76 -- sysdeps/libm-ieee754/s_cbrtf.c | 64 -- sysdeps/libm-ieee754/s_cbrtl.c | 78 -- sysdeps/libm-ieee754/s_ccos.c | 80 -- sysdeps/libm-ieee754/s_ccosf.c | 76 -- sysdeps/libm-ieee754/s_ccosh.c | 105 --- sysdeps/libm-ieee754/s_ccoshf.c | 101 --- sysdeps/libm-ieee754/s_ccoshl.c | 101 --- sysdeps/libm-ieee754/s_ccosl.c | 76 -- sysdeps/libm-ieee754/s_ceil.c | 85 --- sysdeps/libm-ieee754/s_ceilf.c | 62 -- sysdeps/libm-ieee754/s_ceill.c | 89 --- sysdeps/libm-ieee754/s_cexp.c | 127 ---- sysdeps/libm-ieee754/s_cexpf.c | 123 ---- sysdeps/libm-ieee754/s_cexpl.c | 123 ---- sysdeps/libm-ieee754/s_clog.c | 65 -- sysdeps/libm-ieee754/s_clog10.c | 65 -- sysdeps/libm-ieee754/s_clog10f.c | 61 -- sysdeps/libm-ieee754/s_clog10l.c | 61 -- sysdeps/libm-ieee754/s_clogf.c | 61 -- sysdeps/libm-ieee754/s_clogl.c | 61 -- sysdeps/libm-ieee754/s_copysign.c | 43 -- sysdeps/libm-ieee754/s_copysignf.c | 42 -- sysdeps/libm-ieee754/s_copysignl.c | 43 -- sysdeps/libm-ieee754/s_cos.c | 87 --- sysdeps/libm-ieee754/s_cosf.c | 60 -- sysdeps/libm-ieee754/s_cosl.c | 88 --- sysdeps/libm-ieee754/s_cpow.c | 34 - sysdeps/libm-ieee754/s_cpowf.c | 30 - sysdeps/libm-ieee754/s_cpowl.c | 30 - sysdeps/libm-ieee754/s_cproj.c | 49 -- sysdeps/libm-ieee754/s_cprojf.c | 45 -- sysdeps/libm-ieee754/s_cprojl.c | 46 -- sysdeps/libm-ieee754/s_csin.c | 131 ---- sysdeps/libm-ieee754/s_csinf.c | 127 ---- sysdeps/libm-ieee754/s_csinh.c | 126 ---- sysdeps/libm-ieee754/s_csinhf.c | 122 ---- sysdeps/libm-ieee754/s_csinhl.c | 122 ---- sysdeps/libm-ieee754/s_csinl.c | 127 ---- sysdeps/libm-ieee754/s_csqrt.c | 114 --- sysdeps/libm-ieee754/s_csqrtf.c | 110 --- sysdeps/libm-ieee754/s_csqrtl.c | 110 --- sysdeps/libm-ieee754/s_ctan.c | 74 -- sysdeps/libm-ieee754/s_ctanf.c | 70 -- sysdeps/libm-ieee754/s_ctanh.c | 74 -- sysdeps/libm-ieee754/s_ctanhf.c | 70 -- sysdeps/libm-ieee754/s_ctanhl.c | 70 -- sysdeps/libm-ieee754/s_ctanl.c | 70 -- sysdeps/libm-ieee754/s_erf.c | 431 ----------- sysdeps/libm-ieee754/s_erff.c | 225 ------ sysdeps/libm-ieee754/s_exp2.c | 129 ---- sysdeps/libm-ieee754/s_exp2f.c | 127 ---- sysdeps/libm-ieee754/s_expm1.c | 243 ------- sysdeps/libm-ieee754/s_expm1f.c | 135 ---- sysdeps/libm-ieee754/s_fabs.c | 40 - sysdeps/libm-ieee754/s_fabsf.c | 39 - sysdeps/libm-ieee754/s_fabsl.c | 40 - sysdeps/libm-ieee754/s_fdim.c | 40 - sysdeps/libm-ieee754/s_fdimf.c | 36 - sysdeps/libm-ieee754/s_fdiml.c | 36 - sysdeps/libm-ieee754/s_finite.c | 40 - sysdeps/libm-ieee754/s_finitef.c | 39 - sysdeps/libm-ieee754/s_finitel.c | 40 - sysdeps/libm-ieee754/s_floor.c | 86 --- sysdeps/libm-ieee754/s_floorf.c | 71 -- sysdeps/libm-ieee754/s_floorl.c | 90 --- sysdeps/libm-ieee754/s_fma.c | 28 - sysdeps/libm-ieee754/s_fmaf.c | 28 - sysdeps/libm-ieee754/s_fmal.c | 28 - sysdeps/libm-ieee754/s_fmax.c | 33 - sysdeps/libm-ieee754/s_fmaxf.c | 29 - sysdeps/libm-ieee754/s_fmaxl.c | 29 - sysdeps/libm-ieee754/s_fmin.c | 33 - sysdeps/libm-ieee754/s_fminf.c | 29 - sysdeps/libm-ieee754/s_fminl.c | 29 - sysdeps/libm-ieee754/s_fpclassify.c | 43 -- sysdeps/libm-ieee754/s_fpclassifyf.c | 42 -- sysdeps/libm-ieee754/s_fpclassifyl.c | 44 -- sysdeps/libm-ieee754/s_frexp.c | 64 -- sysdeps/libm-ieee754/s_frexpf.c | 53 -- sysdeps/libm-ieee754/s_frexpl.c | 69 -- sysdeps/libm-ieee754/s_ilogb.c | 56 -- sysdeps/libm-ieee754/s_ilogbf.c | 44 -- sysdeps/libm-ieee754/s_ilogbl.c | 56 -- sysdeps/libm-ieee754/s_isinf.c | 32 - sysdeps/libm-ieee754/s_isinff.c | 28 - sysdeps/libm-ieee754/s_isinfl.c | 29 - sysdeps/libm-ieee754/s_isnan.c | 43 -- sysdeps/libm-ieee754/s_isnanf.c | 41 -- sysdeps/libm-ieee754/s_isnanl.c | 44 -- sysdeps/libm-ieee754/s_ldexp.c | 37 - sysdeps/libm-ieee754/s_ldexpf.c | 36 - sysdeps/libm-ieee754/s_ldexpl.c | 37 - sysdeps/libm-ieee754/s_lib_version.c | 40 - sysdeps/libm-ieee754/s_llrint.c | 95 --- sysdeps/libm-ieee754/s_llrintf.c | 78 -- sysdeps/libm-ieee754/s_llrintl.c | 77 -- sysdeps/libm-ieee754/s_llround.c | 81 --- sysdeps/libm-ieee754/s_llroundf.c | 63 -- sysdeps/libm-ieee754/s_llroundl.c | 81 --- sysdeps/libm-ieee754/s_log1p.c | 191 ----- sysdeps/libm-ieee754/s_log1pf.c | 115 --- sysdeps/libm-ieee754/s_log2.c | 136 ---- sysdeps/libm-ieee754/s_log2f.c | 91 --- sysdeps/libm-ieee754/s_logb.c | 47 -- sysdeps/libm-ieee754/s_logbf.c | 40 - sysdeps/libm-ieee754/s_logbl.c | 47 -- sysdeps/libm-ieee754/s_lrint.c | 95 --- sysdeps/libm-ieee754/s_lrintf.c | 78 -- sysdeps/libm-ieee754/s_lrintl.c | 86 --- sysdeps/libm-ieee754/s_lround.c | 78 -- sysdeps/libm-ieee754/s_lroundf.c | 63 -- sysdeps/libm-ieee754/s_lroundl.c | 78 -- sysdeps/libm-ieee754/s_matherr.c | 35 - sysdeps/libm-ieee754/s_modf.c | 85 --- sysdeps/libm-ieee754/s_modff.c | 66 -- sysdeps/libm-ieee754/s_modfl.c | 85 --- sysdeps/libm-ieee754/s_nan.c | 44 -- sysdeps/libm-ieee754/s_nanf.c | 40 - sysdeps/libm-ieee754/s_nanl.c | 40 - sysdeps/libm-ieee754/s_nearbyint.c | 98 --- sysdeps/libm-ieee754/s_nearbyintf.c | 77 -- sysdeps/libm-ieee754/s_nearbyintl.c | 100 --- sysdeps/libm-ieee754/s_nextafter.c | 84 --- sysdeps/libm-ieee754/s_nextafterf.c | 71 -- sysdeps/libm-ieee754/s_nextafterl.c | 101 --- sysdeps/libm-ieee754/s_nexttoward.c | 98 --- sysdeps/libm-ieee754/s_nexttowardf.c | 78 -- sysdeps/libm-ieee754/s_nexttowardl.c | 1 - sysdeps/libm-ieee754/s_remquo.c | 113 --- sysdeps/libm-ieee754/s_remquof.c | 108 --- sysdeps/libm-ieee754/s_remquol.c | 109 --- sysdeps/libm-ieee754/s_rint.c | 91 --- sysdeps/libm-ieee754/s_rintf.c | 72 -- sysdeps/libm-ieee754/s_rintl.c | 96 --- sysdeps/libm-ieee754/s_round.c | 97 --- sysdeps/libm-ieee754/s_roundf.c | 73 -- sysdeps/libm-ieee754/s_roundl.c | 106 --- sysdeps/libm-ieee754/s_scalbln.c | 70 -- sysdeps/libm-ieee754/s_scalblnf.c | 63 -- sysdeps/libm-ieee754/s_scalblnl.c | 71 -- sysdeps/libm-ieee754/s_scalbn.c | 70 -- sysdeps/libm-ieee754/s_scalbnf.c | 63 -- sysdeps/libm-ieee754/s_scalbnl.c | 71 -- sysdeps/libm-ieee754/s_signbit.c | 32 - sysdeps/libm-ieee754/s_signbitf.c | 32 - sysdeps/libm-ieee754/s_signbitl.c | 32 - sysdeps/libm-ieee754/s_signgam.c | 3 - sysdeps/libm-ieee754/s_significand.c | 39 - sysdeps/libm-ieee754/s_significandf.c | 32 - sysdeps/libm-ieee754/s_significandl.c | 39 - sysdeps/libm-ieee754/s_sin.c | 87 --- sysdeps/libm-ieee754/s_sincos.c | 78 -- sysdeps/libm-ieee754/s_sincosf.c | 74 -- sysdeps/libm-ieee754/s_sincosl.c | 74 -- sysdeps/libm-ieee754/s_sinf.c | 54 -- sysdeps/libm-ieee754/s_sinl.c | 88 --- sysdeps/libm-ieee754/s_tan.c | 81 --- sysdeps/libm-ieee754/s_tanf.c | 49 -- sysdeps/libm-ieee754/s_tanh.c | 93 --- sysdeps/libm-ieee754/s_tanhf.c | 67 -- sysdeps/libm-ieee754/s_tanhl.c | 95 --- sysdeps/libm-ieee754/s_tanl.c | 81 --- sysdeps/libm-ieee754/s_trunc.c | 61 -- sysdeps/libm-ieee754/s_truncf.c | 52 -- sysdeps/libm-ieee754/s_truncl.c | 57 -- sysdeps/libm-ieee754/t_exp.c | 436 ----------- sysdeps/libm-ieee754/t_exp2.h | 585 --------------- sysdeps/libm-ieee754/t_exp2f.h | 352 --------- sysdeps/libm-ieee754/w_acos.c | 48 -- sysdeps/libm-ieee754/w_acosf.c | 48 -- sysdeps/libm-ieee754/w_acosh.c | 47 -- sysdeps/libm-ieee754/w_acoshf.c | 48 -- sysdeps/libm-ieee754/w_acoshl.c | 47 -- sysdeps/libm-ieee754/w_acosl.c | 48 -- sysdeps/libm-ieee754/w_asin.c | 49 -- sysdeps/libm-ieee754/w_asinf.c | 49 -- sysdeps/libm-ieee754/w_asinl.c | 49 -- sysdeps/libm-ieee754/w_atan2.c | 47 -- sysdeps/libm-ieee754/w_atan2f.c | 46 -- sysdeps/libm-ieee754/w_atan2l.c | 47 -- sysdeps/libm-ieee754/w_atanh.c | 52 -- sysdeps/libm-ieee754/w_atanhf.c | 53 -- sysdeps/libm-ieee754/w_atanhl.c | 52 -- sysdeps/libm-ieee754/w_cosh.c | 47 -- sysdeps/libm-ieee754/w_coshf.c | 47 -- sysdeps/libm-ieee754/w_coshl.c | 47 -- sysdeps/libm-ieee754/w_drem.c | 20 - sysdeps/libm-ieee754/w_dremf.c | 17 - sysdeps/libm-ieee754/w_dreml.c | 18 - sysdeps/libm-ieee754/w_exp.c | 58 -- sysdeps/libm-ieee754/w_exp10.c | 61 -- sysdeps/libm-ieee754/w_exp10f.c | 57 -- sysdeps/libm-ieee754/w_exp10l.c | 56 -- sysdeps/libm-ieee754/w_exp2.c | 36 - sysdeps/libm-ieee754/w_exp2f.c | 32 - sysdeps/libm-ieee754/w_exp2l.c | 30 - sysdeps/libm-ieee754/w_expf.c | 59 -- sysdeps/libm-ieee754/w_expl.c | 60 -- sysdeps/libm-ieee754/w_fmod.c | 48 -- sysdeps/libm-ieee754/w_fmodf.c | 48 -- sysdeps/libm-ieee754/w_fmodl.c | 48 -- sysdeps/libm-ieee754/w_hypot.c | 48 -- sysdeps/libm-ieee754/w_hypotf.c | 48 -- sysdeps/libm-ieee754/w_hypotl.c | 48 -- sysdeps/libm-ieee754/w_j0.c | 76 -- sysdeps/libm-ieee754/w_j0f.c | 74 -- sysdeps/libm-ieee754/w_j0l.c | 73 -- sysdeps/libm-ieee754/w_j1.c | 77 -- sysdeps/libm-ieee754/w_j1f.c | 75 -- sysdeps/libm-ieee754/w_j1l.c | 74 -- sysdeps/libm-ieee754/w_jn.c | 99 --- sysdeps/libm-ieee754/w_jnf.c | 71 -- sysdeps/libm-ieee754/w_jnl.c | 96 --- sysdeps/libm-ieee754/w_lgamma.c | 60 -- sysdeps/libm-ieee754/w_lgamma_r.c | 51 -- sysdeps/libm-ieee754/w_lgammaf.c | 53 -- sysdeps/libm-ieee754/w_lgammaf_r.c | 52 -- sysdeps/libm-ieee754/w_lgammal.c | 58 -- sysdeps/libm-ieee754/w_lgammal_r.c | 52 -- sysdeps/libm-ieee754/w_log.c | 48 -- sysdeps/libm-ieee754/w_log10.c | 51 -- sysdeps/libm-ieee754/w_log10f.c | 52 -- sysdeps/libm-ieee754/w_log10l.c | 51 -- sysdeps/libm-ieee754/w_logf.c | 49 -- sysdeps/libm-ieee754/w_logl.c | 48 -- sysdeps/libm-ieee754/w_pow.c | 70 -- sysdeps/libm-ieee754/w_powf.c | 77 -- sysdeps/libm-ieee754/w_powl.c | 68 -- sysdeps/libm-ieee754/w_remainder.c | 47 -- sysdeps/libm-ieee754/w_remainderf.c | 47 -- sysdeps/libm-ieee754/w_remainderl.c | 48 -- sysdeps/libm-ieee754/w_scalb.c | 65 -- sysdeps/libm-ieee754/w_scalbf.c | 66 -- sysdeps/libm-ieee754/w_scalbl.c | 65 -- sysdeps/libm-ieee754/w_sinh.c | 47 -- sysdeps/libm-ieee754/w_sinhf.c | 47 -- sysdeps/libm-ieee754/w_sinhl.c | 47 -- sysdeps/libm-ieee754/w_sqrt.c | 47 -- sysdeps/libm-ieee754/w_sqrtf.c | 47 -- sysdeps/libm-ieee754/w_sqrtl.c | 47 -- sysdeps/libm-ieee754/w_tgamma.c | 54 -- sysdeps/libm-ieee754/w_tgammaf.c | 50 -- sysdeps/libm-ieee754/w_tgammal.c | 53 -- sysdeps/m68k/Implies | 4 +- sysdeps/m68k/printf_fphex.c | 2 +- sysdeps/m68k/strtold.c | 2 +- sysdeps/mips/Implies | 3 +- sysdeps/mips/mips64/Implies | 3 +- sysdeps/powerpc/Implies | 3 +- sysdeps/sparc/Implies | 2 - sysdeps/sparc/bits/wordsize.h | 7 - sysdeps/sparc/fpu/bits/mathdef.h | 15 +- sysdeps/sparc/fpu/bits/mathinline.h | 211 ++++++ sysdeps/sparc/sparc32/Implies | 3 + sysdeps/sparc/sparc32/bits/wordsize.h | 7 + sysdeps/sparc/sparc32/fpu/bits/huge_val.h | 100 +++ sysdeps/sparc/sparc64/Implies | 4 + sysdeps/sparc/sparc64/Makefile | 13 +- sysdeps/sparc/sparc64/addmul_1.S | 36 +- sysdeps/sparc/sparc64/bits/wordsize.h | 7 + sysdeps/sparc/sparc64/fpu/bits/huge_val.h | 100 +++ 1085 files changed, 43516 insertions(+), 38569 deletions(-) delete mode 100644 math/machine/endian.h create mode 100644 math/w_acos.c create mode 100644 math/w_acosf.c create mode 100644 math/w_acosh.c create mode 100644 math/w_acoshf.c create mode 100644 math/w_acoshl.c create mode 100644 math/w_acosl.c create mode 100644 math/w_asin.c create mode 100644 math/w_asinf.c create mode 100644 math/w_asinl.c create mode 100644 math/w_atan2.c create mode 100644 math/w_atan2f.c create mode 100644 math/w_atan2l.c create mode 100644 math/w_atanh.c create mode 100644 math/w_atanhf.c create mode 100644 math/w_atanhl.c create mode 100644 math/w_cosh.c create mode 100644 math/w_coshf.c create mode 100644 math/w_coshl.c create mode 100644 math/w_drem.c create mode 100644 math/w_dremf.c create mode 100644 math/w_dreml.c create mode 100644 math/w_exp10.c create mode 100644 math/w_exp10f.c create mode 100644 math/w_exp10l.c create mode 100644 math/w_exp2.c create mode 100644 math/w_exp2f.c create mode 100644 math/w_exp2l.c create mode 100644 math/w_fmod.c create mode 100644 math/w_fmodf.c create mode 100644 math/w_fmodl.c create mode 100644 math/w_hypot.c create mode 100644 math/w_hypotf.c create mode 100644 math/w_hypotl.c create mode 100644 math/w_j0.c create mode 100644 math/w_j0f.c create mode 100644 math/w_j0l.c create mode 100644 math/w_j1.c create mode 100644 math/w_j1f.c create mode 100644 math/w_j1l.c create mode 100644 math/w_jn.c create mode 100644 math/w_jnf.c create mode 100644 math/w_jnl.c create mode 100644 math/w_lgamma.c create mode 100644 math/w_lgamma_r.c create mode 100644 math/w_lgammaf.c create mode 100644 math/w_lgammaf_r.c create mode 100644 math/w_lgammal.c create mode 100644 math/w_lgammal_r.c create mode 100644 math/w_log.c create mode 100644 math/w_log10.c create mode 100644 math/w_log10f.c create mode 100644 math/w_log10l.c create mode 100644 math/w_logf.c create mode 100644 math/w_logl.c create mode 100644 math/w_pow.c create mode 100644 math/w_powf.c create mode 100644 math/w_powl.c create mode 100644 math/w_remainder.c create mode 100644 math/w_remainderf.c create mode 100644 math/w_remainderl.c create mode 100644 math/w_scalb.c create mode 100644 math/w_scalbf.c create mode 100644 math/w_scalbl.c create mode 100644 math/w_sinh.c create mode 100644 math/w_sinhf.c create mode 100644 math/w_sinhl.c create mode 100644 math/w_sqrt.c create mode 100644 math/w_sqrtf.c create mode 100644 math/w_sqrtl.c create mode 100644 math/w_tgamma.c create mode 100644 math/w_tgammaf.c create mode 100644 math/w_tgammal.c create mode 100644 sysdeps/generic/e_atanhl.c create mode 100644 sysdeps/generic/e_coshl.c create mode 100644 sysdeps/generic/e_exp10.c create mode 100644 sysdeps/generic/e_exp10f.c create mode 100644 sysdeps/generic/e_exp10l.c create mode 100644 sysdeps/generic/e_gammal_r.c create mode 100644 sysdeps/generic/e_hypotl.c create mode 100644 sysdeps/generic/e_scalb.c create mode 100644 sysdeps/generic/e_scalbf.c create mode 100644 sysdeps/generic/e_scalbl.c create mode 100644 sysdeps/generic/e_sinhl.c create mode 100644 sysdeps/generic/math_ldbl.h create mode 100644 sysdeps/generic/s_asinhl.c create mode 100644 sysdeps/generic/s_cacos.c create mode 100644 sysdeps/generic/s_cacosf.c create mode 100644 sysdeps/generic/s_cacosh.c create mode 100644 sysdeps/generic/s_cacoshf.c create mode 100644 sysdeps/generic/s_cacoshl.c create mode 100644 sysdeps/generic/s_cacosl.c create mode 100644 sysdeps/generic/s_casin.c create mode 100644 sysdeps/generic/s_casinf.c create mode 100644 sysdeps/generic/s_casinh.c create mode 100644 sysdeps/generic/s_casinhf.c create mode 100644 sysdeps/generic/s_casinhl.c create mode 100644 sysdeps/generic/s_casinl.c create mode 100644 sysdeps/generic/s_catan.c create mode 100644 sysdeps/generic/s_catanf.c create mode 100644 sysdeps/generic/s_catanh.c create mode 100644 sysdeps/generic/s_catanhf.c create mode 100644 sysdeps/generic/s_catanhl.c create mode 100644 sysdeps/generic/s_catanl.c create mode 100644 sysdeps/generic/s_cbrtl.c create mode 100644 sysdeps/generic/s_ccos.c create mode 100644 sysdeps/generic/s_ccosf.c create mode 100644 sysdeps/generic/s_ccosh.c create mode 100644 sysdeps/generic/s_ccoshf.c create mode 100644 sysdeps/generic/s_ccoshl.c create mode 100644 sysdeps/generic/s_ccosl.c create mode 100644 sysdeps/generic/s_cexp.c create mode 100644 sysdeps/generic/s_cexpf.c create mode 100644 sysdeps/generic/s_cexpl.c create mode 100644 sysdeps/generic/s_clog.c create mode 100644 sysdeps/generic/s_clog10.c create mode 100644 sysdeps/generic/s_clog10f.c create mode 100644 sysdeps/generic/s_clog10l.c create mode 100644 sysdeps/generic/s_clogf.c create mode 100644 sysdeps/generic/s_clogl.c create mode 100644 sysdeps/generic/s_cpow.c create mode 100644 sysdeps/generic/s_cpowf.c create mode 100644 sysdeps/generic/s_cpowl.c create mode 100644 sysdeps/generic/s_cproj.c create mode 100644 sysdeps/generic/s_cprojf.c create mode 100644 sysdeps/generic/s_cprojl.c create mode 100644 sysdeps/generic/s_csin.c create mode 100644 sysdeps/generic/s_csinf.c create mode 100644 sysdeps/generic/s_csinh.c create mode 100644 sysdeps/generic/s_csinhf.c create mode 100644 sysdeps/generic/s_csinhl.c create mode 100644 sysdeps/generic/s_csinl.c create mode 100644 sysdeps/generic/s_csqrt.c create mode 100644 sysdeps/generic/s_csqrtf.c create mode 100644 sysdeps/generic/s_csqrtl.c create mode 100644 sysdeps/generic/s_ctan.c create mode 100644 sysdeps/generic/s_ctanf.c create mode 100644 sysdeps/generic/s_ctanh.c create mode 100644 sysdeps/generic/s_ctanhf.c create mode 100644 sysdeps/generic/s_ctanhl.c create mode 100644 sysdeps/generic/s_ctanl.c create mode 100644 sysdeps/generic/s_fdim.c create mode 100644 sysdeps/generic/s_fdimf.c create mode 100644 sysdeps/generic/s_fdiml.c create mode 100644 sysdeps/generic/s_fma.c create mode 100644 sysdeps/generic/s_fmaf.c create mode 100644 sysdeps/generic/s_fmal.c create mode 100644 sysdeps/generic/s_fmax.c create mode 100644 sysdeps/generic/s_fmaxf.c create mode 100644 sysdeps/generic/s_fmaxl.c create mode 100644 sysdeps/generic/s_fmin.c create mode 100644 sysdeps/generic/s_fminf.c create mode 100644 sysdeps/generic/s_fminl.c create mode 100644 sysdeps/generic/s_ldexp.c create mode 100644 sysdeps/generic/s_ldexpf.c create mode 100644 sysdeps/generic/s_ldexpl.c create mode 100644 sysdeps/generic/s_nan.c create mode 100644 sysdeps/generic/s_nanf.c create mode 100644 sysdeps/generic/s_nanl.c create mode 100644 sysdeps/generic/s_nextafter.c create mode 100644 sysdeps/generic/s_nexttowardf.c create mode 100644 sysdeps/generic/s_nexttowardl.c create mode 100644 sysdeps/generic/s_significand.c create mode 100644 sysdeps/generic/s_significandf.c create mode 100644 sysdeps/generic/s_significandl.c create mode 100644 sysdeps/generic/s_tanhl.c create mode 100644 sysdeps/generic/w_expl.c delete mode 100644 sysdeps/i386/fpu/Implies create mode 100644 sysdeps/i386/fpu/e_acos.S create mode 100644 sysdeps/i386/fpu/e_acosf.S create mode 100644 sysdeps/i386/fpu/e_acosh.S create mode 100644 sysdeps/i386/fpu/e_acoshf.S create mode 100644 sysdeps/i386/fpu/e_acoshl.S create mode 100644 sysdeps/i386/fpu/e_acosl.S create mode 100644 sysdeps/i386/fpu/e_asin.S create mode 100644 sysdeps/i386/fpu/e_asinf.S create mode 100644 sysdeps/i386/fpu/e_asinl.S create mode 100644 sysdeps/i386/fpu/e_atan2.S create mode 100644 sysdeps/i386/fpu/e_atan2f.S create mode 100644 sysdeps/i386/fpu/e_atan2l.S create mode 100644 sysdeps/i386/fpu/e_atanh.S create mode 100644 sysdeps/i386/fpu/e_atanhf.S create mode 100644 sysdeps/i386/fpu/e_atanhl.S create mode 100644 sysdeps/i386/fpu/e_exp.S create mode 100644 sysdeps/i386/fpu/e_exp10.S create mode 100644 sysdeps/i386/fpu/e_exp10f.S create mode 100644 sysdeps/i386/fpu/e_exp10l.S create mode 100644 sysdeps/i386/fpu/e_expf.S create mode 100644 sysdeps/i386/fpu/e_expl.S create mode 100644 sysdeps/i386/fpu/e_fmod.S create mode 100644 sysdeps/i386/fpu/e_fmodf.S create mode 100644 sysdeps/i386/fpu/e_fmodl.S create mode 100644 sysdeps/i386/fpu/e_hypot.S create mode 100644 sysdeps/i386/fpu/e_hypotf.S create mode 100644 sysdeps/i386/fpu/e_log.S create mode 100644 sysdeps/i386/fpu/e_log10.S create mode 100644 sysdeps/i386/fpu/e_log10f.S create mode 100644 sysdeps/i386/fpu/e_log10l.S create mode 100644 sysdeps/i386/fpu/e_logf.S create mode 100644 sysdeps/i386/fpu/e_logl.S create mode 100644 sysdeps/i386/fpu/e_pow.S create mode 100644 sysdeps/i386/fpu/e_powf.S create mode 100644 sysdeps/i386/fpu/e_powl.S create mode 100644 sysdeps/i386/fpu/e_rem_pio2.c create mode 100644 sysdeps/i386/fpu/e_rem_pio2f.c create mode 100644 sysdeps/i386/fpu/e_rem_pio2l.c create mode 100644 sysdeps/i386/fpu/e_remainder.S create mode 100644 sysdeps/i386/fpu/e_remainderf.S create mode 100644 sysdeps/i386/fpu/e_remainderl.S create mode 100644 sysdeps/i386/fpu/e_scalb.S create mode 100644 sysdeps/i386/fpu/e_scalbf.S create mode 100644 sysdeps/i386/fpu/e_scalbl.S create mode 100644 sysdeps/i386/fpu/e_sqrt.S create mode 100644 sysdeps/i386/fpu/e_sqrtf.S create mode 100644 sysdeps/i386/fpu/e_sqrtl.S create mode 100644 sysdeps/i386/fpu/k_rem_pio2.c create mode 100644 sysdeps/i386/fpu/k_rem_pio2f.c create mode 100644 sysdeps/i386/fpu/k_rem_pio2l.c create mode 100644 sysdeps/i386/fpu/s_asinh.S create mode 100644 sysdeps/i386/fpu/s_asinhf.S create mode 100644 sysdeps/i386/fpu/s_asinhl.S create mode 100644 sysdeps/i386/fpu/s_atan.S create mode 100644 sysdeps/i386/fpu/s_atanf.S create mode 100644 sysdeps/i386/fpu/s_atanl.S create mode 100644 sysdeps/i386/fpu/s_cbrt.S create mode 100644 sysdeps/i386/fpu/s_cbrtf.S create mode 100644 sysdeps/i386/fpu/s_cbrtl.S create mode 100644 sysdeps/i386/fpu/s_ceil.S create mode 100644 sysdeps/i386/fpu/s_ceilf.S create mode 100644 sysdeps/i386/fpu/s_ceill.S create mode 100644 sysdeps/i386/fpu/s_cexp.S create mode 100644 sysdeps/i386/fpu/s_cexpf.S create mode 100644 sysdeps/i386/fpu/s_cexpl.S create mode 100644 sysdeps/i386/fpu/s_copysign.S create mode 100644 sysdeps/i386/fpu/s_copysignf.S create mode 100644 sysdeps/i386/fpu/s_copysignl.S create mode 100644 sysdeps/i386/fpu/s_cos.S create mode 100644 sysdeps/i386/fpu/s_cosf.S create mode 100644 sysdeps/i386/fpu/s_cosl.S create mode 100644 sysdeps/i386/fpu/s_exp2.S create mode 100644 sysdeps/i386/fpu/s_exp2f.S create mode 100644 sysdeps/i386/fpu/s_exp2l.S create mode 100644 sysdeps/i386/fpu/s_expm1.S create mode 100644 sysdeps/i386/fpu/s_expm1f.S create mode 100644 sysdeps/i386/fpu/s_expm1l.S create mode 100644 sysdeps/i386/fpu/s_fdim.S create mode 100644 sysdeps/i386/fpu/s_fdimf.S create mode 100644 sysdeps/i386/fpu/s_fdiml.S create mode 100644 sysdeps/i386/fpu/s_finite.S create mode 100644 sysdeps/i386/fpu/s_finitef.S create mode 100644 sysdeps/i386/fpu/s_finitel.S create mode 100644 sysdeps/i386/fpu/s_floor.S create mode 100644 sysdeps/i386/fpu/s_floorf.S create mode 100644 sysdeps/i386/fpu/s_floorl.S create mode 100644 sysdeps/i386/fpu/s_fma.S create mode 100644 sysdeps/i386/fpu/s_fmaf.S create mode 100644 sysdeps/i386/fpu/s_fmal.S create mode 100644 sysdeps/i386/fpu/s_fmax.S create mode 100644 sysdeps/i386/fpu/s_fmaxf.S create mode 100644 sysdeps/i386/fpu/s_fmaxl.S create mode 100644 sysdeps/i386/fpu/s_fmin.S create mode 100644 sysdeps/i386/fpu/s_fminf.S create mode 100644 sysdeps/i386/fpu/s_fminl.S create mode 100644 sysdeps/i386/fpu/s_frexp.S create mode 100644 sysdeps/i386/fpu/s_frexpf.S create mode 100644 sysdeps/i386/fpu/s_frexpl.S create mode 100644 sysdeps/i386/fpu/s_ilogb.S create mode 100644 sysdeps/i386/fpu/s_ilogbf.S create mode 100644 sysdeps/i386/fpu/s_ilogbl.S create mode 100644 sysdeps/i386/fpu/s_isinfl.c create mode 100644 sysdeps/i386/fpu/s_isnanl.c create mode 100644 sysdeps/i386/fpu/s_llrint.S create mode 100644 sysdeps/i386/fpu/s_llrintf.S create mode 100644 sysdeps/i386/fpu/s_llrintl.S create mode 100644 sysdeps/i386/fpu/s_log1p.S create mode 100644 sysdeps/i386/fpu/s_log1pf.S create mode 100644 sysdeps/i386/fpu/s_log1pl.S create mode 100644 sysdeps/i386/fpu/s_log2.S create mode 100644 sysdeps/i386/fpu/s_log2f.S create mode 100644 sysdeps/i386/fpu/s_log2l.S create mode 100644 sysdeps/i386/fpu/s_logb.S create mode 100644 sysdeps/i386/fpu/s_logbf.S create mode 100644 sysdeps/i386/fpu/s_logbl.S create mode 100644 sysdeps/i386/fpu/s_lrint.S create mode 100644 sysdeps/i386/fpu/s_lrintf.S create mode 100644 sysdeps/i386/fpu/s_lrintl.S create mode 100644 sysdeps/i386/fpu/s_nearbyint.S create mode 100644 sysdeps/i386/fpu/s_nearbyintf.S create mode 100644 sysdeps/i386/fpu/s_nearbyintl.S create mode 100644 sysdeps/i386/fpu/s_nextafterl.c create mode 100644 sysdeps/i386/fpu/s_remquo.S create mode 100644 sysdeps/i386/fpu/s_remquof.S create mode 100644 sysdeps/i386/fpu/s_remquol.S create mode 100644 sysdeps/i386/fpu/s_rint.S create mode 100644 sysdeps/i386/fpu/s_rintf.S create mode 100644 sysdeps/i386/fpu/s_rintl.S create mode 100644 sysdeps/i386/fpu/s_scalbln.c create mode 100644 sysdeps/i386/fpu/s_scalblnf.c create mode 100644 sysdeps/i386/fpu/s_scalblnl.c create mode 100644 sysdeps/i386/fpu/s_scalbn.S create mode 100644 sysdeps/i386/fpu/s_scalbnf.S create mode 100644 sysdeps/i386/fpu/s_scalbnl.S create mode 100644 sysdeps/i386/fpu/s_significand.S create mode 100644 sysdeps/i386/fpu/s_significandf.S create mode 100644 sysdeps/i386/fpu/s_significandl.S create mode 100644 sysdeps/i386/fpu/s_sin.S create mode 100644 sysdeps/i386/fpu/s_sincos.S create mode 100644 sysdeps/i386/fpu/s_sincosf.S create mode 100644 sysdeps/i386/fpu/s_sincosl.S create mode 100644 sysdeps/i386/fpu/s_sinf.S create mode 100644 sysdeps/i386/fpu/s_sinl.S create mode 100644 sysdeps/i386/fpu/s_tan.S create mode 100644 sysdeps/i386/fpu/s_tanf.S create mode 100644 sysdeps/i386/fpu/s_tanl.S create mode 100644 sysdeps/i386/fpu/s_trunc.S create mode 100644 sysdeps/i386/fpu/s_truncf.S create mode 100644 sysdeps/i386/fpu/s_truncl.S create mode 100644 sysdeps/i386/fpu/t_exp.c create mode 100644 sysdeps/i386/i686/fpu/s_fdim.S create mode 100644 sysdeps/i386/i686/fpu/s_fdimf.S create mode 100644 sysdeps/i386/i686/fpu/s_fdiml.S create mode 100644 sysdeps/i386/i686/fpu/s_fmax.S create mode 100644 sysdeps/i386/i686/fpu/s_fmaxf.S create mode 100644 sysdeps/i386/i686/fpu/s_fmaxl.S create mode 100644 sysdeps/i386/i686/fpu/s_fmin.S create mode 100644 sysdeps/i386/i686/fpu/s_fminf.S create mode 100644 sysdeps/i386/i686/fpu/s_fminl.S delete mode 100644 sysdeps/ieee754/Implies create mode 100644 sysdeps/ieee754/dbl-64/Dist create mode 100644 sysdeps/ieee754/dbl-64/dbl2mpn.c create mode 100644 sysdeps/ieee754/dbl-64/e_acos.c create mode 100644 sysdeps/ieee754/dbl-64/e_acosh.c create mode 100644 sysdeps/ieee754/dbl-64/e_asin.c create mode 100644 sysdeps/ieee754/dbl-64/e_atan2.c create mode 100644 sysdeps/ieee754/dbl-64/e_atanh.c create mode 100644 sysdeps/ieee754/dbl-64/e_cosh.c create mode 100644 sysdeps/ieee754/dbl-64/e_exp.c create mode 100644 sysdeps/ieee754/dbl-64/e_fmod.c create mode 100644 sysdeps/ieee754/dbl-64/e_gamma_r.c create mode 100644 sysdeps/ieee754/dbl-64/e_hypot.c create mode 100644 sysdeps/ieee754/dbl-64/e_j0.c create mode 100644 sysdeps/ieee754/dbl-64/e_j1.c create mode 100644 sysdeps/ieee754/dbl-64/e_jn.c create mode 100644 sysdeps/ieee754/dbl-64/e_lgamma_r.c create mode 100644 sysdeps/ieee754/dbl-64/e_log.c create mode 100644 sysdeps/ieee754/dbl-64/e_log10.c create mode 100644 sysdeps/ieee754/dbl-64/e_pow.c create mode 100644 sysdeps/ieee754/dbl-64/e_rem_pio2.c create mode 100644 sysdeps/ieee754/dbl-64/e_remainder.c create mode 100644 sysdeps/ieee754/dbl-64/e_sinh.c create mode 100644 sysdeps/ieee754/dbl-64/e_sqrt.c create mode 100644 sysdeps/ieee754/dbl-64/k_cos.c create mode 100644 sysdeps/ieee754/dbl-64/k_rem_pio2.c create mode 100644 sysdeps/ieee754/dbl-64/k_sin.c create mode 100644 sysdeps/ieee754/dbl-64/k_tan.c create mode 100644 sysdeps/ieee754/dbl-64/mpn2dbl.c create mode 100644 sysdeps/ieee754/dbl-64/s_asinh.c create mode 100644 sysdeps/ieee754/dbl-64/s_atan.c create mode 100644 sysdeps/ieee754/dbl-64/s_cbrt.c create mode 100644 sysdeps/ieee754/dbl-64/s_ceil.c create mode 100644 sysdeps/ieee754/dbl-64/s_copysign.c create mode 100644 sysdeps/ieee754/dbl-64/s_cos.c create mode 100644 sysdeps/ieee754/dbl-64/s_erf.c create mode 100644 sysdeps/ieee754/dbl-64/s_exp2.c create mode 100644 sysdeps/ieee754/dbl-64/s_expm1.c create mode 100644 sysdeps/ieee754/dbl-64/s_fabs.c create mode 100644 sysdeps/ieee754/dbl-64/s_finite.c create mode 100644 sysdeps/ieee754/dbl-64/s_floor.c create mode 100644 sysdeps/ieee754/dbl-64/s_fpclassify.c create mode 100644 sysdeps/ieee754/dbl-64/s_frexp.c create mode 100644 sysdeps/ieee754/dbl-64/s_ilogb.c create mode 100644 sysdeps/ieee754/dbl-64/s_isinf.c create mode 100644 sysdeps/ieee754/dbl-64/s_isnan.c create mode 100644 sysdeps/ieee754/dbl-64/s_llrint.c create mode 100644 sysdeps/ieee754/dbl-64/s_llround.c create mode 100644 sysdeps/ieee754/dbl-64/s_log1p.c create mode 100644 sysdeps/ieee754/dbl-64/s_log2.c create mode 100644 sysdeps/ieee754/dbl-64/s_logb.c create mode 100644 sysdeps/ieee754/dbl-64/s_lrint.c create mode 100644 sysdeps/ieee754/dbl-64/s_lround.c create mode 100644 sysdeps/ieee754/dbl-64/s_modf.c create mode 100644 sysdeps/ieee754/dbl-64/s_nearbyint.c create mode 100644 sysdeps/ieee754/dbl-64/s_nexttoward.c create mode 100644 sysdeps/ieee754/dbl-64/s_remquo.c create mode 100644 sysdeps/ieee754/dbl-64/s_rint.c create mode 100644 sysdeps/ieee754/dbl-64/s_round.c create mode 100644 sysdeps/ieee754/dbl-64/s_scalbln.c create mode 100644 sysdeps/ieee754/dbl-64/s_scalbn.c create mode 100644 sysdeps/ieee754/dbl-64/s_signbit.c create mode 100644 sysdeps/ieee754/dbl-64/s_sin.c create mode 100644 sysdeps/ieee754/dbl-64/s_sincos.c create mode 100644 sysdeps/ieee754/dbl-64/s_tan.c create mode 100644 sysdeps/ieee754/dbl-64/s_tanh.c create mode 100644 sysdeps/ieee754/dbl-64/s_trunc.c create mode 100644 sysdeps/ieee754/dbl-64/t_exp.c create mode 100644 sysdeps/ieee754/dbl-64/t_exp2.h create mode 100644 sysdeps/ieee754/dbl-64/w_exp.c delete mode 100644 sysdeps/ieee754/dbl2mpn.c create mode 100644 sysdeps/ieee754/flt-32/Dist create mode 100644 sysdeps/ieee754/flt-32/e_acosf.c create mode 100644 sysdeps/ieee754/flt-32/e_acoshf.c create mode 100644 sysdeps/ieee754/flt-32/e_asinf.c create mode 100644 sysdeps/ieee754/flt-32/e_atan2f.c create mode 100644 sysdeps/ieee754/flt-32/e_atanhf.c create mode 100644 sysdeps/ieee754/flt-32/e_coshf.c create mode 100644 sysdeps/ieee754/flt-32/e_expf.c create mode 100644 sysdeps/ieee754/flt-32/e_fmodf.c create mode 100644 sysdeps/ieee754/flt-32/e_gammaf_r.c create mode 100644 sysdeps/ieee754/flt-32/e_hypotf.c create mode 100644 sysdeps/ieee754/flt-32/e_j0f.c create mode 100644 sysdeps/ieee754/flt-32/e_j1f.c create mode 100644 sysdeps/ieee754/flt-32/e_jnf.c create mode 100644 sysdeps/ieee754/flt-32/e_lgammaf_r.c create mode 100644 sysdeps/ieee754/flt-32/e_log10f.c create mode 100644 sysdeps/ieee754/flt-32/e_logf.c create mode 100644 sysdeps/ieee754/flt-32/e_powf.c create mode 100644 sysdeps/ieee754/flt-32/e_rem_pio2f.c create mode 100644 sysdeps/ieee754/flt-32/e_remainderf.c create mode 100644 sysdeps/ieee754/flt-32/e_sinhf.c create mode 100644 sysdeps/ieee754/flt-32/e_sqrtf.c create mode 100644 sysdeps/ieee754/flt-32/k_cosf.c create mode 100644 sysdeps/ieee754/flt-32/k_rem_pio2f.c create mode 100644 sysdeps/ieee754/flt-32/k_sinf.c create mode 100644 sysdeps/ieee754/flt-32/k_tanf.c create mode 100644 sysdeps/ieee754/flt-32/mpn2flt.c create mode 100644 sysdeps/ieee754/flt-32/s_asinhf.c create mode 100644 sysdeps/ieee754/flt-32/s_atanf.c create mode 100644 sysdeps/ieee754/flt-32/s_cbrtf.c create mode 100644 sysdeps/ieee754/flt-32/s_ceilf.c create mode 100644 sysdeps/ieee754/flt-32/s_copysignf.c create mode 100644 sysdeps/ieee754/flt-32/s_cosf.c create mode 100644 sysdeps/ieee754/flt-32/s_erff.c create mode 100644 sysdeps/ieee754/flt-32/s_exp2f.c create mode 100644 sysdeps/ieee754/flt-32/s_expm1f.c create mode 100644 sysdeps/ieee754/flt-32/s_fabsf.c create mode 100644 sysdeps/ieee754/flt-32/s_finitef.c create mode 100644 sysdeps/ieee754/flt-32/s_floorf.c create mode 100644 sysdeps/ieee754/flt-32/s_fpclassifyf.c create mode 100644 sysdeps/ieee754/flt-32/s_frexpf.c create mode 100644 sysdeps/ieee754/flt-32/s_ilogbf.c create mode 100644 sysdeps/ieee754/flt-32/s_isinff.c create mode 100644 sysdeps/ieee754/flt-32/s_isnanf.c create mode 100644 sysdeps/ieee754/flt-32/s_llrintf.c create mode 100644 sysdeps/ieee754/flt-32/s_llroundf.c create mode 100644 sysdeps/ieee754/flt-32/s_log1pf.c create mode 100644 sysdeps/ieee754/flt-32/s_log2f.c create mode 100644 sysdeps/ieee754/flt-32/s_logbf.c create mode 100644 sysdeps/ieee754/flt-32/s_lrintf.c create mode 100644 sysdeps/ieee754/flt-32/s_lroundf.c create mode 100644 sysdeps/ieee754/flt-32/s_modff.c create mode 100644 sysdeps/ieee754/flt-32/s_nearbyintf.c create mode 100644 sysdeps/ieee754/flt-32/s_nextafterf.c create mode 100644 sysdeps/ieee754/flt-32/s_remquof.c create mode 100644 sysdeps/ieee754/flt-32/s_rintf.c create mode 100644 sysdeps/ieee754/flt-32/s_roundf.c create mode 100644 sysdeps/ieee754/flt-32/s_scalblnf.c create mode 100644 sysdeps/ieee754/flt-32/s_scalbnf.c create mode 100644 sysdeps/ieee754/flt-32/s_signbitf.c create mode 100644 sysdeps/ieee754/flt-32/s_sincosf.c create mode 100644 sysdeps/ieee754/flt-32/s_sinf.c create mode 100644 sysdeps/ieee754/flt-32/s_tanf.c create mode 100644 sysdeps/ieee754/flt-32/s_tanhf.c create mode 100644 sysdeps/ieee754/flt-32/s_truncf.c create mode 100644 sysdeps/ieee754/flt-32/t_exp2f.h create mode 100644 sysdeps/ieee754/flt-32/w_expf.c create mode 100644 sysdeps/ieee754/k_standard.c create mode 100644 sysdeps/ieee754/ldbl-128/e_acoshl.c create mode 100644 sysdeps/ieee754/ldbl-128/e_atan2l.c create mode 100644 sysdeps/ieee754/ldbl-128/e_fmodl.c create mode 100644 sysdeps/ieee754/ldbl-128/e_gammal_r.c create mode 100644 sysdeps/ieee754/ldbl-128/e_remainderl.c create mode 100644 sysdeps/ieee754/ldbl-128/ieee754.h create mode 100644 sysdeps/ieee754/ldbl-128/ldbl2mpn.c create mode 100644 sysdeps/ieee754/ldbl-128/math_ldbl.h create mode 100644 sysdeps/ieee754/ldbl-128/mpn2ldbl.c create mode 100644 sysdeps/ieee754/ldbl-128/printf_fphex.c create mode 100644 sysdeps/ieee754/ldbl-128/s_ceill.c create mode 100644 sysdeps/ieee754/ldbl-128/s_copysignl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_cosl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_fabsl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_finitel.c create mode 100644 sysdeps/ieee754/ldbl-128/s_floorl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_fpclassifyl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_frexpl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_ilogbl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_isinfl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_isnanl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_llrintl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_llroundl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_logbl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_lrintl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_lroundl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_modfl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_nearbyintl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_nextafterl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_nexttoward.c create mode 100644 sysdeps/ieee754/ldbl-128/s_nexttowardf.c create mode 100644 sysdeps/ieee754/ldbl-128/s_remquol.c create mode 100644 sysdeps/ieee754/ldbl-128/s_rintl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_roundl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_scalblnl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_scalbnl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_signbitl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_sincosl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_sinl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_tanl.c create mode 100644 sysdeps/ieee754/ldbl-128/s_truncl.c create mode 100644 sysdeps/ieee754/ldbl-128/strtold.c create mode 100644 sysdeps/ieee754/ldbl-96/e_acoshl.c create mode 100644 sysdeps/ieee754/ldbl-96/e_atan2l.c create mode 100644 sysdeps/ieee754/ldbl-96/e_atanhl.c create mode 100644 sysdeps/ieee754/ldbl-96/e_coshl.c create mode 100644 sysdeps/ieee754/ldbl-96/e_gammal_r.c create mode 100644 sysdeps/ieee754/ldbl-96/e_hypotl.c create mode 100644 sysdeps/ieee754/ldbl-96/e_remainderl.c create mode 100644 sysdeps/ieee754/ldbl-96/e_sinhl.c create mode 100644 sysdeps/ieee754/ldbl-96/ldbl2mpn.c create mode 100644 sysdeps/ieee754/ldbl-96/math_ldbl.h create mode 100644 sysdeps/ieee754/ldbl-96/mpn2ldbl.c create mode 100644 sysdeps/ieee754/ldbl-96/printf_fphex.c create mode 100644 sysdeps/ieee754/ldbl-96/s_asinhl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_cbrtl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_ceill.c create mode 100644 sysdeps/ieee754/ldbl-96/s_copysignl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_cosl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_fabsl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_finitel.c create mode 100644 sysdeps/ieee754/ldbl-96/s_floorl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_fpclassifyl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_frexpl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_ilogbl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_isinfl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_isnanl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_llrintl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_llroundl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_logbl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_lrintl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_lroundl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_modfl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_nearbyintl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_nextafterl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_nexttoward.c create mode 100644 sysdeps/ieee754/ldbl-96/s_nexttowardf.c create mode 100644 sysdeps/ieee754/ldbl-96/s_remquol.c create mode 100644 sysdeps/ieee754/ldbl-96/s_rintl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_roundl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_scalblnl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_scalbnl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_signbitl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_sincosl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_sinl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_tanhl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_tanl.c create mode 100644 sysdeps/ieee754/ldbl-96/s_truncl.c create mode 100644 sysdeps/ieee754/ldbl-96/strtold.c create mode 100644 sysdeps/ieee754/ldbl-96/w_expl.c delete mode 100644 sysdeps/ieee754/ldbl2mpn.c delete mode 100644 sysdeps/ieee754/mpn2dbl.c delete mode 100644 sysdeps/ieee754/mpn2flt.c delete mode 100644 sysdeps/ieee754/mpn2ldbl.c create mode 100644 sysdeps/ieee754/s_lib_version.c create mode 100644 sysdeps/ieee754/s_matherr.c create mode 100644 sysdeps/ieee754/s_signgam.c delete mode 100644 sysdeps/libm-i387/e_acos.S delete mode 100644 sysdeps/libm-i387/e_acosf.S delete mode 100644 sysdeps/libm-i387/e_acosh.S delete mode 100644 sysdeps/libm-i387/e_acoshf.S delete mode 100644 sysdeps/libm-i387/e_acoshl.S delete mode 100644 sysdeps/libm-i387/e_acosl.S delete mode 100644 sysdeps/libm-i387/e_asin.S delete mode 100644 sysdeps/libm-i387/e_asinf.S delete mode 100644 sysdeps/libm-i387/e_asinl.S delete mode 100644 sysdeps/libm-i387/e_atan2.S delete mode 100644 sysdeps/libm-i387/e_atan2f.S delete mode 100644 sysdeps/libm-i387/e_atan2l.S delete mode 100644 sysdeps/libm-i387/e_atanh.S delete mode 100644 sysdeps/libm-i387/e_atanhf.S delete mode 100644 sysdeps/libm-i387/e_atanhl.S delete mode 100644 sysdeps/libm-i387/e_exp.S delete mode 100644 sysdeps/libm-i387/e_exp10.S delete mode 100644 sysdeps/libm-i387/e_exp10f.S delete mode 100644 sysdeps/libm-i387/e_exp10l.S delete mode 100644 sysdeps/libm-i387/e_expf.S delete mode 100644 sysdeps/libm-i387/e_expl.S delete mode 100644 sysdeps/libm-i387/e_fmod.S delete mode 100644 sysdeps/libm-i387/e_fmodf.S delete mode 100644 sysdeps/libm-i387/e_fmodl.S delete mode 100644 sysdeps/libm-i387/e_hypot.S delete mode 100644 sysdeps/libm-i387/e_hypotf.S delete mode 100644 sysdeps/libm-i387/e_log.S delete mode 100644 sysdeps/libm-i387/e_log10.S delete mode 100644 sysdeps/libm-i387/e_log10f.S delete mode 100644 sysdeps/libm-i387/e_log10l.S delete mode 100644 sysdeps/libm-i387/e_logf.S delete mode 100644 sysdeps/libm-i387/e_logl.S delete mode 100644 sysdeps/libm-i387/e_pow.S delete mode 100644 sysdeps/libm-i387/e_powf.S delete mode 100644 sysdeps/libm-i387/e_powl.S delete mode 100644 sysdeps/libm-i387/e_rem_pio2.c delete mode 100644 sysdeps/libm-i387/e_rem_pio2f.c delete mode 100644 sysdeps/libm-i387/e_rem_pio2l.c delete mode 100644 sysdeps/libm-i387/e_remainder.S delete mode 100644 sysdeps/libm-i387/e_remainderf.S delete mode 100644 sysdeps/libm-i387/e_remainderl.S delete mode 100644 sysdeps/libm-i387/e_scalb.S delete mode 100644 sysdeps/libm-i387/e_scalbf.S delete mode 100644 sysdeps/libm-i387/e_scalbl.S delete mode 100644 sysdeps/libm-i387/e_sqrt.S delete mode 100644 sysdeps/libm-i387/e_sqrtf.S delete mode 100644 sysdeps/libm-i387/e_sqrtl.S delete mode 100644 sysdeps/libm-i387/i686/s_fdim.S delete mode 100644 sysdeps/libm-i387/i686/s_fdimf.S delete mode 100644 sysdeps/libm-i387/i686/s_fdiml.S delete mode 100644 sysdeps/libm-i387/i686/s_fmax.S delete mode 100644 sysdeps/libm-i387/i686/s_fmaxf.S delete mode 100644 sysdeps/libm-i387/i686/s_fmaxl.S delete mode 100644 sysdeps/libm-i387/i686/s_fmin.S delete mode 100644 sysdeps/libm-i387/i686/s_fminf.S delete mode 100644 sysdeps/libm-i387/i686/s_fminl.S delete mode 100644 sysdeps/libm-i387/k_rem_pio2.c delete mode 100644 sysdeps/libm-i387/k_rem_pio2f.c delete mode 100644 sysdeps/libm-i387/k_rem_pio2l.c delete mode 100644 sysdeps/libm-i387/s_asinh.S delete mode 100644 sysdeps/libm-i387/s_asinhf.S delete mode 100644 sysdeps/libm-i387/s_asinhl.S delete mode 100644 sysdeps/libm-i387/s_atan.S delete mode 100644 sysdeps/libm-i387/s_atanf.S delete mode 100644 sysdeps/libm-i387/s_atanl.S delete mode 100644 sysdeps/libm-i387/s_cbrt.S delete mode 100644 sysdeps/libm-i387/s_cbrtf.S delete mode 100644 sysdeps/libm-i387/s_cbrtl.S delete mode 100644 sysdeps/libm-i387/s_ceil.S delete mode 100644 sysdeps/libm-i387/s_ceilf.S delete mode 100644 sysdeps/libm-i387/s_ceill.S delete mode 100644 sysdeps/libm-i387/s_cexp.S delete mode 100644 sysdeps/libm-i387/s_cexpf.S delete mode 100644 sysdeps/libm-i387/s_cexpl.S delete mode 100644 sysdeps/libm-i387/s_copysign.S delete mode 100644 sysdeps/libm-i387/s_copysignf.S delete mode 100644 sysdeps/libm-i387/s_copysignl.S delete mode 100644 sysdeps/libm-i387/s_cos.S delete mode 100644 sysdeps/libm-i387/s_cosf.S delete mode 100644 sysdeps/libm-i387/s_cosl.S delete mode 100644 sysdeps/libm-i387/s_exp2.S delete mode 100644 sysdeps/libm-i387/s_exp2f.S delete mode 100644 sysdeps/libm-i387/s_exp2l.S delete mode 100644 sysdeps/libm-i387/s_expm1.S delete mode 100644 sysdeps/libm-i387/s_expm1f.S delete mode 100644 sysdeps/libm-i387/s_expm1l.S delete mode 100644 sysdeps/libm-i387/s_fdim.S delete mode 100644 sysdeps/libm-i387/s_fdimf.S delete mode 100644 sysdeps/libm-i387/s_fdiml.S delete mode 100644 sysdeps/libm-i387/s_finite.S delete mode 100644 sysdeps/libm-i387/s_finitef.S delete mode 100644 sysdeps/libm-i387/s_finitel.S delete mode 100644 sysdeps/libm-i387/s_floor.S delete mode 100644 sysdeps/libm-i387/s_floorf.S delete mode 100644 sysdeps/libm-i387/s_floorl.S delete mode 100644 sysdeps/libm-i387/s_fma.S delete mode 100644 sysdeps/libm-i387/s_fmaf.S delete mode 100644 sysdeps/libm-i387/s_fmal.S delete mode 100644 sysdeps/libm-i387/s_fmax.S delete mode 100644 sysdeps/libm-i387/s_fmaxf.S delete mode 100644 sysdeps/libm-i387/s_fmaxl.S delete mode 100644 sysdeps/libm-i387/s_fmin.S delete mode 100644 sysdeps/libm-i387/s_fminf.S delete mode 100644 sysdeps/libm-i387/s_fminl.S delete mode 100644 sysdeps/libm-i387/s_frexp.S delete mode 100644 sysdeps/libm-i387/s_frexpf.S delete mode 100644 sysdeps/libm-i387/s_frexpl.S delete mode 100644 sysdeps/libm-i387/s_ilogb.S delete mode 100644 sysdeps/libm-i387/s_ilogbf.S delete mode 100644 sysdeps/libm-i387/s_ilogbl.S delete mode 100644 sysdeps/libm-i387/s_isinfl.c delete mode 100644 sysdeps/libm-i387/s_isnanl.c delete mode 100644 sysdeps/libm-i387/s_llrint.S delete mode 100644 sysdeps/libm-i387/s_llrintf.S delete mode 100644 sysdeps/libm-i387/s_llrintl.S delete mode 100644 sysdeps/libm-i387/s_log1p.S delete mode 100644 sysdeps/libm-i387/s_log1pf.S delete mode 100644 sysdeps/libm-i387/s_log1pl.S delete mode 100644 sysdeps/libm-i387/s_log2.S delete mode 100644 sysdeps/libm-i387/s_log2f.S delete mode 100644 sysdeps/libm-i387/s_log2l.S delete mode 100644 sysdeps/libm-i387/s_logb.S delete mode 100644 sysdeps/libm-i387/s_logbf.S delete mode 100644 sysdeps/libm-i387/s_logbl.S delete mode 100644 sysdeps/libm-i387/s_lrint.S delete mode 100644 sysdeps/libm-i387/s_lrintf.S delete mode 100644 sysdeps/libm-i387/s_lrintl.S delete mode 100644 sysdeps/libm-i387/s_nearbyint.S delete mode 100644 sysdeps/libm-i387/s_nearbyintf.S delete mode 100644 sysdeps/libm-i387/s_nearbyintl.S delete mode 100644 sysdeps/libm-i387/s_nextafterl.c delete mode 100644 sysdeps/libm-i387/s_remquo.S delete mode 100644 sysdeps/libm-i387/s_remquof.S delete mode 100644 sysdeps/libm-i387/s_remquol.S delete mode 100644 sysdeps/libm-i387/s_rint.S delete mode 100644 sysdeps/libm-i387/s_rintf.S delete mode 100644 sysdeps/libm-i387/s_rintl.S delete mode 100644 sysdeps/libm-i387/s_scalbln.c delete mode 100644 sysdeps/libm-i387/s_scalblnf.c delete mode 100644 sysdeps/libm-i387/s_scalblnl.c delete mode 100644 sysdeps/libm-i387/s_scalbn.S delete mode 100644 sysdeps/libm-i387/s_scalbnf.S delete mode 100644 sysdeps/libm-i387/s_scalbnl.S delete mode 100644 sysdeps/libm-i387/s_significand.S delete mode 100644 sysdeps/libm-i387/s_significandf.S delete mode 100644 sysdeps/libm-i387/s_significandl.S delete mode 100644 sysdeps/libm-i387/s_sin.S delete mode 100644 sysdeps/libm-i387/s_sincos.S delete mode 100644 sysdeps/libm-i387/s_sincosf.S delete mode 100644 sysdeps/libm-i387/s_sincosl.S delete mode 100644 sysdeps/libm-i387/s_sinf.S delete mode 100644 sysdeps/libm-i387/s_sinl.S delete mode 100644 sysdeps/libm-i387/s_tan.S delete mode 100644 sysdeps/libm-i387/s_tanf.S delete mode 100644 sysdeps/libm-i387/s_tanl.S delete mode 100644 sysdeps/libm-i387/s_trunc.S delete mode 100644 sysdeps/libm-i387/s_truncf.S delete mode 100644 sysdeps/libm-i387/s_truncl.S delete mode 100644 sysdeps/libm-i387/t_exp.c delete mode 100644 sysdeps/libm-ieee754/Dist delete mode 100644 sysdeps/libm-ieee754/e_acos.c delete mode 100644 sysdeps/libm-ieee754/e_acosf.c delete mode 100644 sysdeps/libm-ieee754/e_acosh.c delete mode 100644 sysdeps/libm-ieee754/e_acoshf.c delete mode 100644 sysdeps/libm-ieee754/e_acoshl.c delete mode 100644 sysdeps/libm-ieee754/e_asin.c delete mode 100644 sysdeps/libm-ieee754/e_asinf.c delete mode 100644 sysdeps/libm-ieee754/e_atan2.c delete mode 100644 sysdeps/libm-ieee754/e_atan2f.c delete mode 100644 sysdeps/libm-ieee754/e_atan2l.c delete mode 100644 sysdeps/libm-ieee754/e_atanh.c delete mode 100644 sysdeps/libm-ieee754/e_atanhf.c delete mode 100644 sysdeps/libm-ieee754/e_atanhl.c delete mode 100644 sysdeps/libm-ieee754/e_cosh.c delete mode 100644 sysdeps/libm-ieee754/e_coshf.c delete mode 100644 sysdeps/libm-ieee754/e_coshl.c delete mode 100644 sysdeps/libm-ieee754/e_exp.c delete mode 100644 sysdeps/libm-ieee754/e_exp10.c delete mode 100644 sysdeps/libm-ieee754/e_exp10f.c delete mode 100644 sysdeps/libm-ieee754/e_exp10l.c delete mode 100644 sysdeps/libm-ieee754/e_expf.c delete mode 100644 sysdeps/libm-ieee754/e_fmod.c delete mode 100644 sysdeps/libm-ieee754/e_fmodf.c delete mode 100644 sysdeps/libm-ieee754/e_gamma_r.c delete mode 100644 sysdeps/libm-ieee754/e_gammaf_r.c delete mode 100644 sysdeps/libm-ieee754/e_gammal_r.c delete mode 100644 sysdeps/libm-ieee754/e_hypot.c delete mode 100644 sysdeps/libm-ieee754/e_hypotf.c delete mode 100644 sysdeps/libm-ieee754/e_hypotl.c delete mode 100644 sysdeps/libm-ieee754/e_j0.c delete mode 100644 sysdeps/libm-ieee754/e_j0f.c delete mode 100644 sysdeps/libm-ieee754/e_j1.c delete mode 100644 sysdeps/libm-ieee754/e_j1f.c delete mode 100644 sysdeps/libm-ieee754/e_jn.c delete mode 100644 sysdeps/libm-ieee754/e_jnf.c delete mode 100644 sysdeps/libm-ieee754/e_lgamma_r.c delete mode 100644 sysdeps/libm-ieee754/e_lgammaf_r.c delete mode 100644 sysdeps/libm-ieee754/e_log.c delete mode 100644 sysdeps/libm-ieee754/e_log10.c delete mode 100644 sysdeps/libm-ieee754/e_log10f.c delete mode 100644 sysdeps/libm-ieee754/e_logf.c delete mode 100644 sysdeps/libm-ieee754/e_pow.c delete mode 100644 sysdeps/libm-ieee754/e_powf.c delete mode 100644 sysdeps/libm-ieee754/e_rem_pio2.c delete mode 100644 sysdeps/libm-ieee754/e_rem_pio2f.c delete mode 100644 sysdeps/libm-ieee754/e_remainder.c delete mode 100644 sysdeps/libm-ieee754/e_remainderf.c delete mode 100644 sysdeps/libm-ieee754/e_remainderl.c delete mode 100644 sysdeps/libm-ieee754/e_scalb.c delete mode 100644 sysdeps/libm-ieee754/e_scalbf.c delete mode 100644 sysdeps/libm-ieee754/e_scalbl.c delete mode 100644 sysdeps/libm-ieee754/e_sinh.c delete mode 100644 sysdeps/libm-ieee754/e_sinhf.c delete mode 100644 sysdeps/libm-ieee754/e_sinhl.c delete mode 100644 sysdeps/libm-ieee754/e_sqrt.c delete mode 100644 sysdeps/libm-ieee754/e_sqrtf.c delete mode 100644 sysdeps/libm-ieee754/k_cos.c delete mode 100644 sysdeps/libm-ieee754/k_cosf.c delete mode 100644 sysdeps/libm-ieee754/k_rem_pio2.c delete mode 100644 sysdeps/libm-ieee754/k_rem_pio2f.c delete mode 100644 sysdeps/libm-ieee754/k_sin.c delete mode 100644 sysdeps/libm-ieee754/k_sinf.c delete mode 100644 sysdeps/libm-ieee754/k_standard.c delete mode 100644 sysdeps/libm-ieee754/k_tan.c delete mode 100644 sysdeps/libm-ieee754/k_tanf.c delete mode 100644 sysdeps/libm-ieee754/s_asinh.c delete mode 100644 sysdeps/libm-ieee754/s_asinhf.c delete mode 100644 sysdeps/libm-ieee754/s_asinhl.c delete mode 100644 sysdeps/libm-ieee754/s_atan.c delete mode 100644 sysdeps/libm-ieee754/s_atanf.c delete mode 100644 sysdeps/libm-ieee754/s_cacos.c delete mode 100644 sysdeps/libm-ieee754/s_cacosf.c delete mode 100644 sysdeps/libm-ieee754/s_cacosh.c delete mode 100644 sysdeps/libm-ieee754/s_cacoshf.c delete mode 100644 sysdeps/libm-ieee754/s_cacoshl.c delete mode 100644 sysdeps/libm-ieee754/s_cacosl.c delete mode 100644 sysdeps/libm-ieee754/s_casin.c delete mode 100644 sysdeps/libm-ieee754/s_casinf.c delete mode 100644 sysdeps/libm-ieee754/s_casinh.c delete mode 100644 sysdeps/libm-ieee754/s_casinhf.c delete mode 100644 sysdeps/libm-ieee754/s_casinhl.c delete mode 100644 sysdeps/libm-ieee754/s_casinl.c delete mode 100644 sysdeps/libm-ieee754/s_catan.c delete mode 100644 sysdeps/libm-ieee754/s_catanf.c delete mode 100644 sysdeps/libm-ieee754/s_catanh.c delete mode 100644 sysdeps/libm-ieee754/s_catanhf.c delete mode 100644 sysdeps/libm-ieee754/s_catanhl.c delete mode 100644 sysdeps/libm-ieee754/s_catanl.c delete mode 100644 sysdeps/libm-ieee754/s_cbrt.c delete mode 100644 sysdeps/libm-ieee754/s_cbrtf.c delete mode 100644 sysdeps/libm-ieee754/s_cbrtl.c delete mode 100644 sysdeps/libm-ieee754/s_ccos.c delete mode 100644 sysdeps/libm-ieee754/s_ccosf.c delete mode 100644 sysdeps/libm-ieee754/s_ccosh.c delete mode 100644 sysdeps/libm-ieee754/s_ccoshf.c delete mode 100644 sysdeps/libm-ieee754/s_ccoshl.c delete mode 100644 sysdeps/libm-ieee754/s_ccosl.c delete mode 100644 sysdeps/libm-ieee754/s_ceil.c delete mode 100644 sysdeps/libm-ieee754/s_ceilf.c delete mode 100644 sysdeps/libm-ieee754/s_ceill.c delete mode 100644 sysdeps/libm-ieee754/s_cexp.c delete mode 100644 sysdeps/libm-ieee754/s_cexpf.c delete mode 100644 sysdeps/libm-ieee754/s_cexpl.c delete mode 100644 sysdeps/libm-ieee754/s_clog.c delete mode 100644 sysdeps/libm-ieee754/s_clog10.c delete mode 100644 sysdeps/libm-ieee754/s_clog10f.c delete mode 100644 sysdeps/libm-ieee754/s_clog10l.c delete mode 100644 sysdeps/libm-ieee754/s_clogf.c delete mode 100644 sysdeps/libm-ieee754/s_clogl.c delete mode 100644 sysdeps/libm-ieee754/s_copysign.c delete mode 100644 sysdeps/libm-ieee754/s_copysignf.c delete mode 100644 sysdeps/libm-ieee754/s_copysignl.c delete mode 100644 sysdeps/libm-ieee754/s_cos.c delete mode 100644 sysdeps/libm-ieee754/s_cosf.c delete mode 100644 sysdeps/libm-ieee754/s_cosl.c delete mode 100644 sysdeps/libm-ieee754/s_cpow.c delete mode 100644 sysdeps/libm-ieee754/s_cpowf.c delete mode 100644 sysdeps/libm-ieee754/s_cpowl.c delete mode 100644 sysdeps/libm-ieee754/s_cproj.c delete mode 100644 sysdeps/libm-ieee754/s_cprojf.c delete mode 100644 sysdeps/libm-ieee754/s_cprojl.c delete mode 100644 sysdeps/libm-ieee754/s_csin.c delete mode 100644 sysdeps/libm-ieee754/s_csinf.c delete mode 100644 sysdeps/libm-ieee754/s_csinh.c delete mode 100644 sysdeps/libm-ieee754/s_csinhf.c delete mode 100644 sysdeps/libm-ieee754/s_csinhl.c delete mode 100644 sysdeps/libm-ieee754/s_csinl.c delete mode 100644 sysdeps/libm-ieee754/s_csqrt.c delete mode 100644 sysdeps/libm-ieee754/s_csqrtf.c delete mode 100644 sysdeps/libm-ieee754/s_csqrtl.c delete mode 100644 sysdeps/libm-ieee754/s_ctan.c delete mode 100644 sysdeps/libm-ieee754/s_ctanf.c delete mode 100644 sysdeps/libm-ieee754/s_ctanh.c delete mode 100644 sysdeps/libm-ieee754/s_ctanhf.c delete mode 100644 sysdeps/libm-ieee754/s_ctanhl.c delete mode 100644 sysdeps/libm-ieee754/s_ctanl.c delete mode 100644 sysdeps/libm-ieee754/s_erf.c delete mode 100644 sysdeps/libm-ieee754/s_erff.c delete mode 100644 sysdeps/libm-ieee754/s_exp2.c delete mode 100644 sysdeps/libm-ieee754/s_exp2f.c delete mode 100644 sysdeps/libm-ieee754/s_expm1.c delete mode 100644 sysdeps/libm-ieee754/s_expm1f.c delete mode 100644 sysdeps/libm-ieee754/s_fabs.c delete mode 100644 sysdeps/libm-ieee754/s_fabsf.c delete mode 100644 sysdeps/libm-ieee754/s_fabsl.c delete mode 100644 sysdeps/libm-ieee754/s_fdim.c delete mode 100644 sysdeps/libm-ieee754/s_fdimf.c delete mode 100644 sysdeps/libm-ieee754/s_fdiml.c delete mode 100644 sysdeps/libm-ieee754/s_finite.c delete mode 100644 sysdeps/libm-ieee754/s_finitef.c delete mode 100644 sysdeps/libm-ieee754/s_finitel.c delete mode 100644 sysdeps/libm-ieee754/s_floor.c delete mode 100644 sysdeps/libm-ieee754/s_floorf.c delete mode 100644 sysdeps/libm-ieee754/s_floorl.c delete mode 100644 sysdeps/libm-ieee754/s_fma.c delete mode 100644 sysdeps/libm-ieee754/s_fmaf.c delete mode 100644 sysdeps/libm-ieee754/s_fmal.c delete mode 100644 sysdeps/libm-ieee754/s_fmax.c delete mode 100644 sysdeps/libm-ieee754/s_fmaxf.c delete mode 100644 sysdeps/libm-ieee754/s_fmaxl.c delete mode 100644 sysdeps/libm-ieee754/s_fmin.c delete mode 100644 sysdeps/libm-ieee754/s_fminf.c delete mode 100644 sysdeps/libm-ieee754/s_fminl.c delete mode 100644 sysdeps/libm-ieee754/s_fpclassify.c delete mode 100644 sysdeps/libm-ieee754/s_fpclassifyf.c delete mode 100644 sysdeps/libm-ieee754/s_fpclassifyl.c delete mode 100644 sysdeps/libm-ieee754/s_frexp.c delete mode 100644 sysdeps/libm-ieee754/s_frexpf.c delete mode 100644 sysdeps/libm-ieee754/s_frexpl.c delete mode 100644 sysdeps/libm-ieee754/s_ilogb.c delete mode 100644 sysdeps/libm-ieee754/s_ilogbf.c delete mode 100644 sysdeps/libm-ieee754/s_ilogbl.c delete mode 100644 sysdeps/libm-ieee754/s_isinf.c delete mode 100644 sysdeps/libm-ieee754/s_isinff.c delete mode 100644 sysdeps/libm-ieee754/s_isinfl.c delete mode 100644 sysdeps/libm-ieee754/s_isnan.c delete mode 100644 sysdeps/libm-ieee754/s_isnanf.c delete mode 100644 sysdeps/libm-ieee754/s_isnanl.c delete mode 100644 sysdeps/libm-ieee754/s_ldexp.c delete mode 100644 sysdeps/libm-ieee754/s_ldexpf.c delete mode 100644 sysdeps/libm-ieee754/s_ldexpl.c delete mode 100644 sysdeps/libm-ieee754/s_lib_version.c delete mode 100644 sysdeps/libm-ieee754/s_llrint.c delete mode 100644 sysdeps/libm-ieee754/s_llrintf.c delete mode 100644 sysdeps/libm-ieee754/s_llrintl.c delete mode 100644 sysdeps/libm-ieee754/s_llround.c delete mode 100644 sysdeps/libm-ieee754/s_llroundf.c delete mode 100644 sysdeps/libm-ieee754/s_llroundl.c delete mode 100644 sysdeps/libm-ieee754/s_log1p.c delete mode 100644 sysdeps/libm-ieee754/s_log1pf.c delete mode 100644 sysdeps/libm-ieee754/s_log2.c delete mode 100644 sysdeps/libm-ieee754/s_log2f.c delete mode 100644 sysdeps/libm-ieee754/s_logb.c delete mode 100644 sysdeps/libm-ieee754/s_logbf.c delete mode 100644 sysdeps/libm-ieee754/s_logbl.c delete mode 100644 sysdeps/libm-ieee754/s_lrint.c delete mode 100644 sysdeps/libm-ieee754/s_lrintf.c delete mode 100644 sysdeps/libm-ieee754/s_lrintl.c delete mode 100644 sysdeps/libm-ieee754/s_lround.c delete mode 100644 sysdeps/libm-ieee754/s_lroundf.c delete mode 100644 sysdeps/libm-ieee754/s_lroundl.c delete mode 100644 sysdeps/libm-ieee754/s_matherr.c delete mode 100644 sysdeps/libm-ieee754/s_modf.c delete mode 100644 sysdeps/libm-ieee754/s_modff.c delete mode 100644 sysdeps/libm-ieee754/s_modfl.c delete mode 100644 sysdeps/libm-ieee754/s_nan.c delete mode 100644 sysdeps/libm-ieee754/s_nanf.c delete mode 100644 sysdeps/libm-ieee754/s_nanl.c delete mode 100644 sysdeps/libm-ieee754/s_nearbyint.c delete mode 100644 sysdeps/libm-ieee754/s_nearbyintf.c delete mode 100644 sysdeps/libm-ieee754/s_nearbyintl.c delete mode 100644 sysdeps/libm-ieee754/s_nextafter.c delete mode 100644 sysdeps/libm-ieee754/s_nextafterf.c delete mode 100644 sysdeps/libm-ieee754/s_nextafterl.c delete mode 100644 sysdeps/libm-ieee754/s_nexttoward.c delete mode 100644 sysdeps/libm-ieee754/s_nexttowardf.c delete mode 100644 sysdeps/libm-ieee754/s_nexttowardl.c delete mode 100644 sysdeps/libm-ieee754/s_remquo.c delete mode 100644 sysdeps/libm-ieee754/s_remquof.c delete mode 100644 sysdeps/libm-ieee754/s_remquol.c delete mode 100644 sysdeps/libm-ieee754/s_rint.c delete mode 100644 sysdeps/libm-ieee754/s_rintf.c delete mode 100644 sysdeps/libm-ieee754/s_rintl.c delete mode 100644 sysdeps/libm-ieee754/s_round.c delete mode 100644 sysdeps/libm-ieee754/s_roundf.c delete mode 100644 sysdeps/libm-ieee754/s_roundl.c delete mode 100644 sysdeps/libm-ieee754/s_scalbln.c delete mode 100644 sysdeps/libm-ieee754/s_scalblnf.c delete mode 100644 sysdeps/libm-ieee754/s_scalblnl.c delete mode 100644 sysdeps/libm-ieee754/s_scalbn.c delete mode 100644 sysdeps/libm-ieee754/s_scalbnf.c delete mode 100644 sysdeps/libm-ieee754/s_scalbnl.c delete mode 100644 sysdeps/libm-ieee754/s_signbit.c delete mode 100644 sysdeps/libm-ieee754/s_signbitf.c delete mode 100644 sysdeps/libm-ieee754/s_signbitl.c delete mode 100644 sysdeps/libm-ieee754/s_signgam.c delete mode 100644 sysdeps/libm-ieee754/s_significand.c delete mode 100644 sysdeps/libm-ieee754/s_significandf.c delete mode 100644 sysdeps/libm-ieee754/s_significandl.c delete mode 100644 sysdeps/libm-ieee754/s_sin.c delete mode 100644 sysdeps/libm-ieee754/s_sincos.c delete mode 100644 sysdeps/libm-ieee754/s_sincosf.c delete mode 100644 sysdeps/libm-ieee754/s_sincosl.c delete mode 100644 sysdeps/libm-ieee754/s_sinf.c delete mode 100644 sysdeps/libm-ieee754/s_sinl.c delete mode 100644 sysdeps/libm-ieee754/s_tan.c delete mode 100644 sysdeps/libm-ieee754/s_tanf.c delete mode 100644 sysdeps/libm-ieee754/s_tanh.c delete mode 100644 sysdeps/libm-ieee754/s_tanhf.c delete mode 100644 sysdeps/libm-ieee754/s_tanhl.c delete mode 100644 sysdeps/libm-ieee754/s_tanl.c delete mode 100644 sysdeps/libm-ieee754/s_trunc.c delete mode 100644 sysdeps/libm-ieee754/s_truncf.c delete mode 100644 sysdeps/libm-ieee754/s_truncl.c delete mode 100644 sysdeps/libm-ieee754/t_exp.c delete mode 100644 sysdeps/libm-ieee754/t_exp2.h delete mode 100644 sysdeps/libm-ieee754/t_exp2f.h delete mode 100644 sysdeps/libm-ieee754/w_acos.c delete mode 100644 sysdeps/libm-ieee754/w_acosf.c delete mode 100644 sysdeps/libm-ieee754/w_acosh.c delete mode 100644 sysdeps/libm-ieee754/w_acoshf.c delete mode 100644 sysdeps/libm-ieee754/w_acoshl.c delete mode 100644 sysdeps/libm-ieee754/w_acosl.c delete mode 100644 sysdeps/libm-ieee754/w_asin.c delete mode 100644 sysdeps/libm-ieee754/w_asinf.c delete mode 100644 sysdeps/libm-ieee754/w_asinl.c delete mode 100644 sysdeps/libm-ieee754/w_atan2.c delete mode 100644 sysdeps/libm-ieee754/w_atan2f.c delete mode 100644 sysdeps/libm-ieee754/w_atan2l.c delete mode 100644 sysdeps/libm-ieee754/w_atanh.c delete mode 100644 sysdeps/libm-ieee754/w_atanhf.c delete mode 100644 sysdeps/libm-ieee754/w_atanhl.c delete mode 100644 sysdeps/libm-ieee754/w_cosh.c delete mode 100644 sysdeps/libm-ieee754/w_coshf.c delete mode 100644 sysdeps/libm-ieee754/w_coshl.c delete mode 100644 sysdeps/libm-ieee754/w_drem.c delete mode 100644 sysdeps/libm-ieee754/w_dremf.c delete mode 100644 sysdeps/libm-ieee754/w_dreml.c delete mode 100644 sysdeps/libm-ieee754/w_exp.c delete mode 100644 sysdeps/libm-ieee754/w_exp10.c delete mode 100644 sysdeps/libm-ieee754/w_exp10f.c delete mode 100644 sysdeps/libm-ieee754/w_exp10l.c delete mode 100644 sysdeps/libm-ieee754/w_exp2.c delete mode 100644 sysdeps/libm-ieee754/w_exp2f.c delete mode 100644 sysdeps/libm-ieee754/w_exp2l.c delete mode 100644 sysdeps/libm-ieee754/w_expf.c delete mode 100644 sysdeps/libm-ieee754/w_expl.c delete mode 100644 sysdeps/libm-ieee754/w_fmod.c delete mode 100644 sysdeps/libm-ieee754/w_fmodf.c delete mode 100644 sysdeps/libm-ieee754/w_fmodl.c delete mode 100644 sysdeps/libm-ieee754/w_hypot.c delete mode 100644 sysdeps/libm-ieee754/w_hypotf.c delete mode 100644 sysdeps/libm-ieee754/w_hypotl.c delete mode 100644 sysdeps/libm-ieee754/w_j0.c delete mode 100644 sysdeps/libm-ieee754/w_j0f.c delete mode 100644 sysdeps/libm-ieee754/w_j0l.c delete mode 100644 sysdeps/libm-ieee754/w_j1.c delete mode 100644 sysdeps/libm-ieee754/w_j1f.c delete mode 100644 sysdeps/libm-ieee754/w_j1l.c delete mode 100644 sysdeps/libm-ieee754/w_jn.c delete mode 100644 sysdeps/libm-ieee754/w_jnf.c delete mode 100644 sysdeps/libm-ieee754/w_jnl.c delete mode 100644 sysdeps/libm-ieee754/w_lgamma.c delete mode 100644 sysdeps/libm-ieee754/w_lgamma_r.c delete mode 100644 sysdeps/libm-ieee754/w_lgammaf.c delete mode 100644 sysdeps/libm-ieee754/w_lgammaf_r.c delete mode 100644 sysdeps/libm-ieee754/w_lgammal.c delete mode 100644 sysdeps/libm-ieee754/w_lgammal_r.c delete mode 100644 sysdeps/libm-ieee754/w_log.c delete mode 100644 sysdeps/libm-ieee754/w_log10.c delete mode 100644 sysdeps/libm-ieee754/w_log10f.c delete mode 100644 sysdeps/libm-ieee754/w_log10l.c delete mode 100644 sysdeps/libm-ieee754/w_logf.c delete mode 100644 sysdeps/libm-ieee754/w_logl.c delete mode 100644 sysdeps/libm-ieee754/w_pow.c delete mode 100644 sysdeps/libm-ieee754/w_powf.c delete mode 100644 sysdeps/libm-ieee754/w_powl.c delete mode 100644 sysdeps/libm-ieee754/w_remainder.c delete mode 100644 sysdeps/libm-ieee754/w_remainderf.c delete mode 100644 sysdeps/libm-ieee754/w_remainderl.c delete mode 100644 sysdeps/libm-ieee754/w_scalb.c delete mode 100644 sysdeps/libm-ieee754/w_scalbf.c delete mode 100644 sysdeps/libm-ieee754/w_scalbl.c delete mode 100644 sysdeps/libm-ieee754/w_sinh.c delete mode 100644 sysdeps/libm-ieee754/w_sinhf.c delete mode 100644 sysdeps/libm-ieee754/w_sinhl.c delete mode 100644 sysdeps/libm-ieee754/w_sqrt.c delete mode 100644 sysdeps/libm-ieee754/w_sqrtf.c delete mode 100644 sysdeps/libm-ieee754/w_sqrtl.c delete mode 100644 sysdeps/libm-ieee754/w_tgamma.c delete mode 100644 sysdeps/libm-ieee754/w_tgammaf.c delete mode 100644 sysdeps/libm-ieee754/w_tgammal.c delete mode 100644 sysdeps/sparc/Implies delete mode 100644 sysdeps/sparc/bits/wordsize.h create mode 100644 sysdeps/sparc/fpu/bits/mathinline.h create mode 100644 sysdeps/sparc/sparc32/bits/wordsize.h create mode 100644 sysdeps/sparc/sparc32/fpu/bits/huge_val.h create mode 100644 sysdeps/sparc/sparc64/bits/wordsize.h create mode 100644 sysdeps/sparc/sparc64/fpu/bits/huge_val.h diff --git a/ChangeLog b/ChangeLog index 27c491de9f..6e901aa96f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,1130 @@ +1999-07-12 Jakub Jelinek + + * stdio-common/printf_fp.c (__printf_fp): Adjust for IEEE quad + as _FPIO_CONST_OFFSET does not cover all bits after binary dot. + * sysdeps/generic/printf_fphex.c (__printf_fphex): Support IEEE + quad by moving long double support into PRINT_FPHEX_LONG_DOUBLE + macro. + * sysdeps/alpha/Implies: Imply ieee754/flt-32 and ieee754/dbl-64 + instead of ieee754. + * sysdeps/arm/Implies: Likewise. + * sysdeps/i386/Implies: Imply ieee754/flt-32, ieee754/dbl-64, and + ieee754/ldbl-96 instead of ieee754. + * sysdeps/i386/i686/Implies: Remove implication for libm-i387/i686. + * sysdeps/generic/strtold.c: Remove. + * sysdeps/generic/e_atanhl.c: New file. + * sysdeps/generic/e_coshl.c: New file. + * sysdeps/generic/e_sinhl.c: New file. + * sysdeps/generic/e_gammal_r.c: New file. + * sysdeps/generic/e_hypotl.c: New file. + * sysdeps/generic/s_cbrtl.c: New file. + * sysdeps/generic/s_asinhl.c: New file. + * sysdeps/generic/s_tanhl.c: New file. + * sysdeps/generic/w_expl.c: New file. + * sysdeps/m68k/Implies: Imply ieee754/flt-32, ieee754/dbl-64, and + ieee754/ldbl-96 instead of ieee754. + * sysdeps/m68k/strtold.c: Include ldbl-96 version of strtold. + * sysdeps/m68k/printf_fphex.c: Include ldbl-96 version of + printf_fphex. + * sysdeps/mips/Implies: Imply ieee754/flt-32 and ieee754/dbl-64 + instead of ieee754. + * sysdeps/mips/mips64/Implies: Likewise. + * sysdeps/powerpc/Implies: Likewise. + * sysdeps/sparc/Implies: Remove. + * sysdeps/sparc/sparc32/Implies: Imply ieee754/flt-32 and + ieee754/dbl-64. + * sysdeps/sparc/sparc64/Implies: Imply ieee754/flt-32, ieee754/dbl-64, + and ieee754/ldbl-128. + + * sysdeps/sparc/bits/wordsize.h: Remove. + * sysdeps/sparc/fpu/bits/mathinline.h: New file. + * sysdeps/sparc/fpu/bits/mathdef.h: __NO_LONG_DOUBLE_MATH + only for sparc32. + * sysdeps/sparc/sparc32/fpu/bits/huge_val.h: New file. + * sysdeps/sparc/sparc32/bits/wordsize.h: New file. + * sysdeps/sparc/sparc64/fpu/bits/huge_val.h: New file. + * sysdeps/sparc/sparc64/bits/wordsize.h: New file. + * sysdeps/sparc/sparc64/Makefile: Add IEEE quad long double + support. + + * sysdeps/sparc/sparc64/addmul_1.S: Fix miscalculation + of carries. Optimize. + + * sysdeps/libm-ieee754/e_exp10.c: Moved to ... + * math/e_exp10.c: ...here. + * sysdeps/libm-ieee754/e_exp10f.c: Moved to ... + * math/e_exp10f.c: ...here. + * sysdeps/libm-ieee754/e_exp10l.c: Moved to ... + * math/e_exp10l.c: ...here. + * sysdeps/libm-ieee754/e_scalb.c: Moved to ... + * math/e_scalb.c: ...here. + * sysdeps/libm-ieee754/e_scalbf.c: Moved to ... + * math/e_scalbf.c: ...here. + * sysdeps/libm-ieee754/e_scalbl.c: Moved to ... + * math/e_scalbl.c: ...here. + * sysdeps/libm-ieee754/s_cacos.c: Moved to ... + * math/s_cacos.c: ...here. + * sysdeps/libm-ieee754/s_cacosf.c: Moved to ... + * math/s_cacosf.c: ...here. + * sysdeps/libm-ieee754/s_cacosh.c: Moved to ... + * math/s_cacosh.c: ...here. + * sysdeps/libm-ieee754/s_cacoshf.c: Moved to ... + * math/s_cacoshf.c: ...here. + * sysdeps/libm-ieee754/s_cacoshl.c: Moved to ... + * math/s_cacoshl.c: ...here. + * sysdeps/libm-ieee754/s_cacosl.c: Moved to ... + * math/s_cacosl.c: ...here. + * sysdeps/libm-ieee754/s_casin.c: Moved to ... + * math/s_casin.c: ...here. + * sysdeps/libm-ieee754/s_casinf.c: Moved to ... + * math/s_casinf.c: ...here. + * sysdeps/libm-ieee754/s_casinh.c: Moved to ... + * math/s_casinh.c: ...here. + * sysdeps/libm-ieee754/s_casinhf.c: Moved to ... + * math/s_casinhf.c: ...here. + * sysdeps/libm-ieee754/s_casinhl.c: Moved to ... + * math/s_casinhl.c: ...here. + * sysdeps/libm-ieee754/s_casinl.c: Moved to ... + * math/s_casinl.c: ...here. + * sysdeps/libm-ieee754/s_catan.c: Moved to ... + * math/s_catan.c: ...here. + * sysdeps/libm-ieee754/s_catanf.c: Moved to ... + * math/s_catanf.c: ...here. + * sysdeps/libm-ieee754/s_catanh.c: Moved to ... + * math/s_catanh.c: ...here. + * sysdeps/libm-ieee754/s_catanhf.c: Moved to ... + * math/s_catanhf.c: ...here. + * sysdeps/libm-ieee754/s_catanhl.c: Moved to ... + * math/s_catanhl.c: ...here. + * sysdeps/libm-ieee754/s_catanl.c: Moved to ... + * math/s_catanl.c: ...here. + * sysdeps/libm-ieee754/s_ccos.c: Moved to ... + * math/s_ccos.c: ...here. + * sysdeps/libm-ieee754/s_ccosf.c: Moved to ... + * math/s_ccosf.c: ...here. + * sysdeps/libm-ieee754/s_ccosh.c: Moved to ... + * math/s_ccosh.c: ...here. + * sysdeps/libm-ieee754/s_ccoshf.c: Moved to ... + * math/s_ccoshf.c: ...here. + * sysdeps/libm-ieee754/s_ccoshl.c: Moved to ... + * math/s_ccoshl.c: ...here. + * sysdeps/libm-ieee754/s_ccosl.c: Moved to ... + * math/s_ccosl.c: ...here. + * sysdeps/libm-ieee754/s_cexp.c: Moved to ... + * math/s_cexp.c: ...here. + * sysdeps/libm-ieee754/s_cexpf.c: Moved to ... + * math/s_cexpf.c: ...here. + * sysdeps/libm-ieee754/s_cexpl.c: Moved to ... + * math/s_cexpl.c: ...here. + * sysdeps/libm-ieee754/s_clog.c: Moved to ... + * math/s_clog.c: ...here. + * sysdeps/libm-ieee754/s_clog10.c: Moved to ... + * math/s_clog10.c: ...here. + * sysdeps/libm-ieee754/s_clog10f.c: Moved to ... + * math/s_clog10f.c: ...here. + * sysdeps/libm-ieee754/s_clog10l.c: Moved to ... + * math/s_clog10l.c: ...here. + * sysdeps/libm-ieee754/s_clogf.c: Moved to ... + * math/s_clogf.c: ...here. + * sysdeps/libm-ieee754/s_clogl.c: Moved to ... + * math/s_clogl.c: ...here. + * sysdeps/libm-ieee754/s_cpow.c: Moved to ... + * math/s_cpow.c: ...here. + * sysdeps/libm-ieee754/s_cpowf.c: Moved to ... + * math/s_cpowf.c: ...here. + * sysdeps/libm-ieee754/s_cpowl.c: Moved to ... + * math/s_cpowl.c: ...here. + * sysdeps/libm-ieee754/s_cproj.c: Moved to ... + * math/s_cproj.c: ...here. + * sysdeps/libm-ieee754/s_cprojf.c: Moved to ... + * math/s_cprojf.c: ...here. + * sysdeps/libm-ieee754/s_cprojl.c: Moved to ... + * math/s_cprojl.c: ...here. + * sysdeps/libm-ieee754/s_csin.c: Moved to ... + * math/s_csin.c: ...here. + * sysdeps/libm-ieee754/s_csinf.c: Moved to ... + * math/s_csinf.c: ...here. + * sysdeps/libm-ieee754/s_csinh.c: Moved to ... + * math/s_csinh.c: ...here. + * sysdeps/libm-ieee754/s_csinhf.c: Moved to ... + * math/s_csinhf.c: ...here. + * sysdeps/libm-ieee754/s_csinhl.c: Moved to ... + * math/s_csinhl.c: ...here. + * sysdeps/libm-ieee754/s_csinl.c: Moved to ... + * math/s_csinl.c: ...here. + * sysdeps/libm-ieee754/s_csqrt.c: Moved to ... + * math/s_csqrt.c: ...here. + * sysdeps/libm-ieee754/s_csqrtf.c: Moved to ... + * math/s_csqrtf.c: ...here. + * sysdeps/libm-ieee754/s_csqrtl.c: Moved to ... + * math/s_csqrtl.c: ...here. + * sysdeps/libm-ieee754/s_ctan.c: Moved to ... + * math/s_ctan.c: ...here. + * sysdeps/libm-ieee754/s_ctanf.c: Moved to ... + * math/s_ctanf.c: ...here. + * sysdeps/libm-ieee754/s_ctanh.c: Moved to ... + * math/s_ctanh.c: ...here. + * sysdeps/libm-ieee754/s_ctanhf.c: Moved to ... + * math/s_ctanhf.c: ...here. + * sysdeps/libm-ieee754/s_ctanhl.c: Moved to ... + * math/s_ctanhl.c: ...here. + * sysdeps/libm-ieee754/s_ctanl.c: Moved to ... + * math/s_ctanl.c: ...here. + * sysdeps/libm-ieee754/s_fdim.c: Moved to ... + * math/s_fdim.c: ...here. + * sysdeps/libm-ieee754/s_fdimf.c: Moved to ... + * math/s_fdimf.c: ...here. + * sysdeps/libm-ieee754/s_fdiml.c: Moved to ... + * math/s_fdiml.c: ...here. + * sysdeps/libm-ieee754/s_fma.c: Moved to ... + * math/s_fma.c: ...here. + * sysdeps/libm-ieee754/s_fmaf.c: Moved to ... + * math/s_fmaf.c: ...here. + * sysdeps/libm-ieee754/s_fmal.c: Moved to ... + * math/s_fmal.c: ...here. + * sysdeps/libm-ieee754/s_fmax.c: Moved to ... + * math/s_fmax.c: ...here. + * sysdeps/libm-ieee754/s_fmaxf.c: Moved to ... + * math/s_fmaxf.c: ...here. + * sysdeps/libm-ieee754/s_fmaxl.c: Moved to ... + * math/s_fmaxl.c: ...here. + * sysdeps/libm-ieee754/s_fmin.c: Moved to ... + * math/s_fmin.c: ...here. + * sysdeps/libm-ieee754/s_fminf.c: Moved to ... + * math/s_fminf.c: ...here. + * sysdeps/libm-ieee754/s_fminl.c: Moved to ... + * math/s_fminl.c: ...here. + * sysdeps/libm-ieee754/s_ldexp.c: Moved to ... + * math/s_ldexp.c: ...here. + * sysdeps/libm-ieee754/s_ldexpf.c: Moved to ... + * math/s_ldexpf.c: ...here. + * sysdeps/libm-ieee754/s_ldexpl.c: Moved to ... + * math/s_ldexpl.c: ...here. + * sysdeps/libm-ieee754/s_nan.c: Moved to ... + * math/s_nan.c: ...here. + * sysdeps/libm-ieee754/s_nanf.c: Moved to ... + * math/s_nanf.c: ...here. + * sysdeps/libm-ieee754/s_nanl.c: Moved to ... + * math/s_nanl.c: ...here. + * sysdeps/libm-ieee754/s_significand.c: Moved to ... + * math/s_significand.c: ...here. + * sysdeps/libm-ieee754/s_significandf.c: Moved to ... + * math/s_significandf.c: ...here. + * sysdeps/libm-ieee754/s_significandl.c: Moved to ... + * math/s_significandl.c: ...here. + Avoid conversion from int to double and then to long double. + * sysdeps/libm-ieee754/w_acos.c: Moved to ... + * math/w_acos.c: ...here. + * sysdeps/libm-ieee754/w_acosf.c: Moved to ... + * math/w_acosf.c: ...here. + * sysdeps/libm-ieee754/w_acosh.c: Moved to ... + * math/w_acosh.c: ...here. + * sysdeps/libm-ieee754/w_acoshf.c: Moved to ... + * math/w_acoshf.c: ...here. + * sysdeps/libm-ieee754/w_acoshl.c: Moved to ... + * math/w_acoshl.c: ...here. + * sysdeps/libm-ieee754/w_acosl.c: Moved to ... + * math/w_acosl.c: ...here. + * sysdeps/libm-ieee754/w_asin.c: Moved to ... + * math/w_asin.c: ...here. + * sysdeps/libm-ieee754/w_asinf.c: Moved to ... + * math/w_asinf.c: ...here. + * sysdeps/libm-ieee754/w_asinl.c: Moved to ... + * math/w_asinl.c: ...here. + * sysdeps/libm-ieee754/w_atan2.c: Moved to ... + * math/w_atan2.c: ...here. + * sysdeps/libm-ieee754/w_atan2f.c: Moved to ... + * math/w_atan2f.c: ...here. + * sysdeps/libm-ieee754/w_atan2l.c: Moved to ... + * math/w_atan2l.c: ...here. + * sysdeps/libm-ieee754/w_atanh.c: Moved to ... + * math/w_atanh.c: ...here. + * sysdeps/libm-ieee754/w_atanhf.c: Moved to ... + * math/w_atanhf.c: ...here. + * sysdeps/libm-ieee754/w_atanhl.c: Moved to ... + * math/w_atanhl.c: ...here. + * sysdeps/libm-ieee754/w_cosh.c: Moved to ... + * math/w_cosh.c: ...here. + * sysdeps/libm-ieee754/w_coshf.c: Moved to ... + * math/w_coshf.c: ...here. + * sysdeps/libm-ieee754/w_coshl.c: Moved to ... + * math/w_coshl.c: ...here. + * sysdeps/libm-ieee754/w_drem.c: Moved to ... + * math/w_drem.c: ...here. + * sysdeps/libm-ieee754/w_dremf.c: Moved to ... + * math/w_dremf.c: ...here. + * sysdeps/libm-ieee754/w_dreml.c: Moved to ... + * math/w_dreml.c: ...here. + * sysdeps/libm-ieee754/w_exp10.c: Moved to ... + * math/w_exp10.c: ...here. + * sysdeps/libm-ieee754/w_exp10f.c: Moved to ... + * math/w_exp10f.c: ...here. + * sysdeps/libm-ieee754/w_exp10l.c: Moved to ... + * math/w_exp10l.c: ...here. + * sysdeps/libm-ieee754/w_exp2.c: Moved to ... + * math/w_exp2.c: ...here. + * sysdeps/libm-ieee754/w_exp2f.c: Moved to ... + * math/w_exp2f.c: ...here. + * sysdeps/libm-ieee754/w_exp2l.c: Moved to ... + * math/w_exp2l.c: ...here. + * sysdeps/libm-ieee754/w_fmod.c: Moved to ... + * math/w_fmod.c: ...here. + * sysdeps/libm-ieee754/w_fmodf.c: Moved to ... + * math/w_fmodf.c: ...here. + * sysdeps/libm-ieee754/w_fmodl.c: Moved to ... + * math/w_fmodl.c: ...here. + * sysdeps/libm-ieee754/w_hypot.c: Moved to ... + * math/w_hypot.c: ...here. + * sysdeps/libm-ieee754/w_hypotf.c: Moved to ... + * math/w_hypotf.c: ...here. + * sysdeps/libm-ieee754/w_hypotl.c: Moved to ... + * math/w_hypotl.c: ...here. + * sysdeps/libm-ieee754/w_j0.c: Moved to ... + * math/w_j0.c: ...here. + * sysdeps/libm-ieee754/w_j0f.c: Moved to ... + * math/w_j0f.c: ...here. + * sysdeps/libm-ieee754/w_j0l.c: Moved to ... + * math/w_j0l.c: ...here. + * sysdeps/libm-ieee754/w_j1.c: Moved to ... + * math/w_j1.c: ...here. + * sysdeps/libm-ieee754/w_j1f.c: Moved to ... + * math/w_j1f.c: ...here. + * sysdeps/libm-ieee754/w_j1l.c: Moved to ... + * math/w_j1l.c: ...here. + * sysdeps/libm-ieee754/w_jn.c: Moved to ... + * math/w_jn.c: ...here. + * sysdeps/libm-ieee754/w_jnf.c: Moved to ... + * math/w_jnf.c: ...here. + * sysdeps/libm-ieee754/w_jnl.c: Moved to ... + * math/w_jnl.c: ...here. + * sysdeps/libm-ieee754/w_lgamma.c: Moved to ... + * math/w_lgamma.c: ...here. + * sysdeps/libm-ieee754/w_lgamma_r.c: Moved to ... + * math/w_lgamma_r.c: ...here. + * sysdeps/libm-ieee754/w_lgammaf.c: Moved to ... + * math/w_lgammaf.c: ...here. + * sysdeps/libm-ieee754/w_lgammaf_r.c: Moved to ... + * math/w_lgammaf_r.c: ...here. + * sysdeps/libm-ieee754/w_lgammal.c: Moved to ... + * math/w_lgammal.c: ...here. + * sysdeps/libm-ieee754/w_lgammal_r.c: Moved to ... + * math/w_lgammal_r.c: ...here. + * sysdeps/libm-ieee754/w_log.c: Moved to ... + * math/w_log.c: ...here. + * sysdeps/libm-ieee754/w_log10.c: Moved to ... + * math/w_log10.c: ...here. + * sysdeps/libm-ieee754/w_log10f.c: Moved to ... + * math/w_log10f.c: ...here. + * sysdeps/libm-ieee754/w_log10l.c: Moved to ... + * math/w_log10l.c: ...here. + * sysdeps/libm-ieee754/w_logf.c: Moved to ... + * math/w_logf.c: ...here. + * sysdeps/libm-ieee754/w_logl.c: Moved to ... + * math/w_logl.c: ...here. + * sysdeps/libm-ieee754/w_pow.c: Moved to ... + * math/w_pow.c: ...here. + * sysdeps/libm-ieee754/w_powf.c: Moved to ... + * math/w_powf.c: ...here. + * sysdeps/libm-ieee754/w_powl.c: Moved to ... + * math/w_powl.c: ...here. + * sysdeps/libm-ieee754/w_remainder.c: Moved to ... + * math/w_remainder.c: ...here. + * sysdeps/libm-ieee754/w_remainderf.c: Moved to ... + * math/w_remainderf.c: ...here. + * sysdeps/libm-ieee754/w_remainderl.c: Moved to ... + * math/w_remainderl.c: ...here. + * sysdeps/libm-ieee754/w_scalb.c: Moved to ... + * math/w_scalb.c: ...here. + * sysdeps/libm-ieee754/w_scalbf.c: Moved to ... + * math/w_scalbf.c: ...here. + * sysdeps/libm-ieee754/w_scalbl.c: Moved to ... + * math/w_scalbl.c: ...here. + * sysdeps/libm-ieee754/w_sinh.c: Moved to ... + * math/w_sinh.c: ...here. + * sysdeps/libm-ieee754/w_sinhf.c: Moved to ... + * math/w_sinhf.c: ...here. + * sysdeps/libm-ieee754/w_sinhl.c: Moved to ... + * math/w_sinhl.c: ...here. + * sysdeps/libm-ieee754/w_sqrt.c: Moved to ... + * math/w_sqrt.c: ...here. + * sysdeps/libm-ieee754/w_sqrtf.c: Moved to ... + * math/w_sqrtf.c: ...here. + * sysdeps/libm-ieee754/w_sqrtl.c: Moved to ... + * math/w_sqrtl.c: ...here. + * sysdeps/libm-ieee754/w_tgamma.c: Moved to ... + * math/w_tgamma.c: ...here. + * sysdeps/libm-ieee754/w_tgammaf.c: Moved to ... + * math/w_tgammaf.c: ...here. + * sysdeps/libm-ieee754/w_tgammal.c: Moved to ... + * math/w_tgammal.c: ...here. + * sysdeps/libm-i387/e_acos.S: Moved to ... + * sysdeps/i386/fpu/e_acos.S: ...here. + * sysdeps/libm-i387/e_acosf.S: Moved to ... + * sysdeps/i386/fpu/e_acosf.S: ...here. + * sysdeps/libm-i387/e_acosh.S: Moved to ... + * sysdeps/i386/fpu/e_acosh.S: ...here. + * sysdeps/libm-i387/e_acoshf.S: Moved to ... + * sysdeps/i386/fpu/e_acoshf.S: ...here. + * sysdeps/libm-i387/e_acoshl.S: Moved to ... + * sysdeps/i386/fpu/e_acoshl.S: ...here. + * sysdeps/libm-i387/e_acosl.S: Moved to ... + * sysdeps/i386/fpu/e_acosl.S: ...here. + * sysdeps/libm-i387/e_asin.S: Moved to ... + * sysdeps/i386/fpu/e_asin.S: ...here. + * sysdeps/libm-i387/e_asinf.S: Moved to ... + * sysdeps/i386/fpu/e_asinf.S: ...here. + * sysdeps/libm-i387/e_asinl.S: Moved to ... + * sysdeps/i386/fpu/e_asinl.S: ...here. + * sysdeps/libm-i387/e_atan2.S: Moved to ... + * sysdeps/i386/fpu/e_atan2.S: ...here. + * sysdeps/libm-i387/e_atan2f.S: Moved to ... + * sysdeps/i386/fpu/e_atan2f.S: ...here. + * sysdeps/libm-i387/e_atan2l.S: Moved to ... + * sysdeps/i386/fpu/e_atan2l.S: ...here. + * sysdeps/libm-i387/e_atanh.S: Moved to ... + * sysdeps/i386/fpu/e_atanh.S: ...here. + * sysdeps/libm-i387/e_atanhf.S: Moved to ... + * sysdeps/i386/fpu/e_atanhf.S: ...here. + * sysdeps/libm-i387/e_atanhl.S: Moved to ... + * sysdeps/i386/fpu/e_atanhl.S: ...here. + * sysdeps/libm-i387/e_exp.S: Moved to ... + * sysdeps/i386/fpu/e_exp.S: ...here. + * sysdeps/libm-i387/e_exp10.S: Moved to ... + * sysdeps/i386/fpu/e_exp10.S: ...here. + * sysdeps/libm-i387/e_exp10f.S: Moved to ... + * sysdeps/i386/fpu/e_exp10f.S: ...here. + * sysdeps/libm-i387/e_exp10l.S: Moved to ... + * sysdeps/i386/fpu/e_exp10l.S: ...here. + * sysdeps/libm-i387/e_expf.S: Moved to ... + * sysdeps/i386/fpu/e_expf.S: ...here. + * sysdeps/libm-i387/e_expl.S: Moved to ... + * sysdeps/i386/fpu/e_expl.S: ...here. + * sysdeps/libm-i387/e_fmod.S: Moved to ... + * sysdeps/i386/fpu/e_fmod.S: ...here. + * sysdeps/libm-i387/e_fmodf.S: Moved to ... + * sysdeps/i386/fpu/e_fmodf.S: ...here. + * sysdeps/libm-i387/e_fmodl.S: Moved to ... + * sysdeps/i386/fpu/e_fmodl.S: ...here. + * sysdeps/libm-i387/e_hypot.S: Moved to ... + * sysdeps/i386/fpu/e_hypot.S: ...here. + * sysdeps/libm-i387/e_hypotf.S: Moved to ... + * sysdeps/i386/fpu/e_hypotf.S: ...here. + * sysdeps/libm-i387/e_log.S: Moved to ... + * sysdeps/i386/fpu/e_log.S: ...here. + * sysdeps/libm-i387/e_log10.S: Moved to ... + * sysdeps/i386/fpu/e_log10.S: ...here. + * sysdeps/libm-i387/e_log10f.S: Moved to ... + * sysdeps/i386/fpu/e_log10f.S: ...here. + * sysdeps/libm-i387/e_log10l.S: Moved to ... + * sysdeps/i386/fpu/e_log10l.S: ...here. + * sysdeps/libm-i387/e_logf.S: Moved to ... + * sysdeps/i386/fpu/e_logf.S: ...here. + * sysdeps/libm-i387/e_logl.S: Moved to ... + * sysdeps/i386/fpu/e_logl.S: ...here. + * sysdeps/libm-i387/e_pow.S: Moved to ... + * sysdeps/i386/fpu/e_pow.S: ...here. + * sysdeps/libm-i387/e_powf.S: Moved to ... + * sysdeps/i386/fpu/e_powf.S: ...here. + * sysdeps/libm-i387/e_powl.S: Moved to ... + * sysdeps/i386/fpu/e_powl.S: ...here. + * sysdeps/libm-i387/e_rem_pio2l.c: Moved to ... + * sysdeps/i386/fpu/e_rem_pio2l.c: ...here. + * sysdeps/libm-i387/e_remainder.S: Moved to ... + * sysdeps/i386/fpu/e_remainder.S: ...here. + * sysdeps/libm-i387/e_remainderf.S: Moved to ... + * sysdeps/i386/fpu/e_remainderf.S: ...here. + * sysdeps/libm-i387/e_remainderl.S: Moved to ... + * sysdeps/i386/fpu/e_remainderl.S: ...here. + * sysdeps/libm-i387/e_scalb.S: Moved to ... + * sysdeps/i386/fpu/e_scalb.S: ...here. + * sysdeps/libm-i387/e_scalbf.S: Moved to ... + * sysdeps/i386/fpu/e_scalbf.S: ...here. + * sysdeps/libm-i387/e_scalbl.S: Moved to ... + * sysdeps/i386/fpu/e_scalbl.S: ...here. + * sysdeps/libm-i387/e_sqrt.S: Moved to ... + * sysdeps/i386/fpu/e_sqrt.S: ...here. + * sysdeps/libm-i387/e_sqrtf.S: Moved to ... + * sysdeps/i386/fpu/e_sqrtf.S: ...here. + * sysdeps/libm-i387/e_sqrtl.S: Moved to ... + * sysdeps/i386/fpu/e_sqrtl.S: ...here. + * sysdeps/libm-i387/k_rem_pio2l.c: Moved to ... + * sysdeps/i386/fpu/k_rem_pio2l.c: ...here. + * sysdeps/libm-i387/s_asinh.S: Moved to ... + * sysdeps/i386/fpu/s_asinh.S: ...here. + * sysdeps/libm-i387/s_asinhf.S: Moved to ... + * sysdeps/i386/fpu/s_asinhf.S: ...here. + * sysdeps/libm-i387/s_asinhl.S: Moved to ... + * sysdeps/i386/fpu/s_asinhl.S: ...here. + * sysdeps/libm-i387/s_atan.S: Moved to ... + * sysdeps/i386/fpu/s_atan.S: ...here. + * sysdeps/libm-i387/s_atanf.S: Moved to ... + * sysdeps/i386/fpu/s_atanf.S: ...here. + * sysdeps/libm-i387/s_atanl.S: Moved to ... + * sysdeps/i386/fpu/s_atanl.S: ...here. + * sysdeps/libm-i387/s_cbrt.S: Moved to ... + * sysdeps/i386/fpu/s_cbrt.S: ...here. + * sysdeps/libm-i387/s_cbrtf.S: Moved to ... + * sysdeps/i386/fpu/s_cbrtf.S: ...here. + * sysdeps/libm-i387/s_cbrtl.S: Moved to ... + * sysdeps/i386/fpu/s_cbrtl.S: ...here. + * sysdeps/libm-i387/s_ceil.S: Moved to ... + * sysdeps/i386/fpu/s_ceil.S: ...here. + * sysdeps/libm-i387/s_ceilf.S: Moved to ... + * sysdeps/i386/fpu/s_ceilf.S: ...here. + * sysdeps/libm-i387/s_ceill.S: Moved to ... + * sysdeps/i386/fpu/s_ceill.S: ...here. + * sysdeps/libm-i387/s_cexp.S: Moved to ... + * sysdeps/i386/fpu/s_cexp.S: ...here. + * sysdeps/libm-i387/s_cexpf.S: Moved to ... + * sysdeps/i386/fpu/s_cexpf.S: ...here. + * sysdeps/libm-i387/s_cexpl.S: Moved to ... + * sysdeps/i386/fpu/s_cexpl.S: ...here. + * sysdeps/libm-i387/s_copysign.S: Moved to ... + * sysdeps/i386/fpu/s_copysign.S: ...here. + * sysdeps/libm-i387/s_copysignf.S: Moved to ... + * sysdeps/i386/fpu/s_copysignf.S: ...here. + * sysdeps/libm-i387/s_copysignl.S: Moved to ... + * sysdeps/i386/fpu/s_copysignl.S: ...here. + * sysdeps/libm-i387/s_cos.S: Moved to ... + * sysdeps/i386/fpu/s_cos.S: ...here. + * sysdeps/libm-i387/s_cosf.S: Moved to ... + * sysdeps/i386/fpu/s_cosf.S: ...here. + * sysdeps/libm-i387/s_cosl.S: Moved to ... + * sysdeps/i386/fpu/s_cosl.S: ...here. + * sysdeps/libm-i387/s_exp2.S: Moved to ... + * sysdeps/i386/fpu/s_exp2.S: ...here. + * sysdeps/libm-i387/s_exp2f.S: Moved to ... + * sysdeps/i386/fpu/s_exp2f.S: ...here. + * sysdeps/libm-i387/s_exp2l.S: Moved to ... + * sysdeps/i386/fpu/s_exp2l.S: ...here. + * sysdeps/libm-i387/s_expm1.S: Moved to ... + * sysdeps/i386/fpu/s_expm1.S: ...here. + * sysdeps/libm-i387/s_expm1f.S: Moved to ... + * sysdeps/i386/fpu/s_expm1f.S: ...here. + * sysdeps/libm-i387/s_expm1l.S: Moved to ... + * sysdeps/i386/fpu/s_expm1l.S: ...here. + * sysdeps/libm-i387/s_fdim.S: Moved to ... + * sysdeps/i386/fpu/s_fdim.S: ...here. + * sysdeps/libm-i387/s_fdimf.S: Moved to ... + * sysdeps/i386/fpu/s_fdimf.S: ...here. + * sysdeps/libm-i387/s_fdiml.S: Moved to ... + * sysdeps/i386/fpu/s_fdiml.S: ...here. + * sysdeps/libm-i387/s_finite.S: Moved to ... + * sysdeps/i386/fpu/s_finite.S: ...here. + * sysdeps/libm-i387/s_finitef.S: Moved to ... + * sysdeps/i386/fpu/s_finitef.S: ...here. + * sysdeps/libm-i387/s_finitel.S: Moved to ... + * sysdeps/i386/fpu/s_finitel.S: ...here. + * sysdeps/libm-i387/s_floor.S: Moved to ... + * sysdeps/i386/fpu/s_floor.S: ...here. + * sysdeps/libm-i387/s_floorf.S: Moved to ... + * sysdeps/i386/fpu/s_floorf.S: ...here. + * sysdeps/libm-i387/s_floorl.S: Moved to ... + * sysdeps/i386/fpu/s_floorl.S: ...here. + * sysdeps/libm-i387/s_fma.S: Moved to ... + * sysdeps/i386/fpu/s_fma.S: ...here. + * sysdeps/libm-i387/s_fmaf.S: Moved to ... + * sysdeps/i386/fpu/s_fmaf.S: ...here. + * sysdeps/libm-i387/s_fmal.S: Moved to ... + * sysdeps/i386/fpu/s_fmal.S: ...here. + * sysdeps/libm-i387/s_fmax.S: Moved to ... + * sysdeps/i386/fpu/s_fmax.S: ...here. + * sysdeps/libm-i387/s_fmaxf.S: Moved to ... + * sysdeps/i386/fpu/s_fmaxf.S: ...here. + * sysdeps/libm-i387/s_fmaxl.S: Moved to ... + * sysdeps/i386/fpu/s_fmaxl.S: ...here. + * sysdeps/libm-i387/s_fmin.S: Moved to ... + * sysdeps/i386/fpu/s_fmin.S: ...here. + * sysdeps/libm-i387/s_fminf.S: Moved to ... + * sysdeps/i386/fpu/s_fminf.S: ...here. + * sysdeps/libm-i387/s_fminl.S: Moved to ... + * sysdeps/i386/fpu/s_fminl.S: ...here. + * sysdeps/libm-i387/s_frexp.S: Moved to ... + * sysdeps/i386/fpu/s_frexp.S: ...here. + * sysdeps/libm-i387/s_frexpf.S: Moved to ... + * sysdeps/i386/fpu/s_frexpf.S: ...here. + * sysdeps/libm-i387/s_frexpl.S: Moved to ... + * sysdeps/i386/fpu/s_frexpl.S: ...here. + * sysdeps/libm-i387/s_ilogb.S: Moved to ... + * sysdeps/i386/fpu/s_ilogb.S: ...here. + * sysdeps/libm-i387/s_ilogbf.S: Moved to ... + * sysdeps/i386/fpu/s_ilogbf.S: ...here. + * sysdeps/libm-i387/s_ilogbl.S: Moved to ... + * sysdeps/i386/fpu/s_ilogbl.S: ...here. + * sysdeps/libm-i387/s_llrint.S: Moved to ... + * sysdeps/i386/fpu/s_llrint.S: ...here. + * sysdeps/libm-i387/s_llrintf.S: Moved to ... + * sysdeps/i386/fpu/s_llrintf.S: ...here. + * sysdeps/libm-i387/s_llrintl.S: Moved to ... + * sysdeps/i386/fpu/s_llrintl.S: ...here. + * sysdeps/libm-i387/s_log1p.S: Moved to ... + * sysdeps/i386/fpu/s_log1p.S: ...here. + * sysdeps/libm-i387/s_log1pf.S: Moved to ... + * sysdeps/i386/fpu/s_log1pf.S: ...here. + * sysdeps/libm-i387/s_log1pl.S: Moved to ... + * sysdeps/i386/fpu/s_log1pl.S: ...here. + * sysdeps/libm-i387/s_log2.S: Moved to ... + * sysdeps/i386/fpu/s_log2.S: ...here. + * sysdeps/libm-i387/s_log2f.S: Moved to ... + * sysdeps/i386/fpu/s_log2f.S: ...here. + * sysdeps/libm-i387/s_log2l.S: Moved to ... + * sysdeps/i386/fpu/s_log2l.S: ...here. + * sysdeps/libm-i387/s_logb.S: Moved to ... + * sysdeps/i386/fpu/s_logb.S: ...here. + * sysdeps/libm-i387/s_logbf.S: Moved to ... + * sysdeps/i386/fpu/s_logbf.S: ...here. + * sysdeps/libm-i387/s_logbl.S: Moved to ... + * sysdeps/i386/fpu/s_logbl.S: ...here. + * sysdeps/libm-i387/s_lrint.S: Moved to ... + * sysdeps/i386/fpu/s_lrint.S: ...here. + * sysdeps/libm-i387/s_lrintf.S: Moved to ... + * sysdeps/i386/fpu/s_lrintf.S: ...here. + * sysdeps/libm-i387/s_lrintl.S: Moved to ... + * sysdeps/i386/fpu/s_lrintl.S: ...here. + * sysdeps/libm-i387/s_nearbyint.S: Moved to ... + * sysdeps/i386/fpu/s_nearbyint.S: ...here. + * sysdeps/libm-i387/s_nearbyintf.S: Moved to ... + * sysdeps/i386/fpu/s_nearbyintf.S: ...here. + * sysdeps/libm-i387/s_nearbyintl.S: Moved to ... + * sysdeps/i386/fpu/s_nearbyintl.S: ...here. + * sysdeps/libm-i387/s_remquo.S: Moved to ... + * sysdeps/i386/fpu/s_remquo.S: ...here. + * sysdeps/libm-i387/s_remquof.S: Moved to ... + * sysdeps/i386/fpu/s_remquof.S: ...here. + * sysdeps/libm-i387/s_remquol.S: Moved to ... + * sysdeps/i386/fpu/s_remquol.S: ...here. + * sysdeps/libm-i387/s_rint.S: Moved to ... + * sysdeps/i386/fpu/s_rint.S: ...here. + * sysdeps/libm-i387/s_rintf.S: Moved to ... + * sysdeps/i386/fpu/s_rintf.S: ...here. + * sysdeps/libm-i387/s_rintl.S: Moved to ... + * sysdeps/i386/fpu/s_rintl.S: ...here. + * sysdeps/libm-i387/s_scalbn.S: Moved to ... + * sysdeps/i386/fpu/s_scalbn.S: ...here. + * sysdeps/libm-i387/s_scalbnf.S: Moved to ... + * sysdeps/i386/fpu/s_scalbnf.S: ...here. + * sysdeps/libm-i387/s_scalbnl.S: Moved to ... + * sysdeps/i386/fpu/s_scalbnl.S: ...here. + * sysdeps/libm-i387/s_significand.S: Moved to ... + * sysdeps/i386/fpu/s_significand.S: ...here. + * sysdeps/libm-i387/s_significandf.S: Moved to ... + * sysdeps/i386/fpu/s_significandf.S: ...here. + * sysdeps/libm-i387/s_significandl.S: Moved to ... + * sysdeps/i386/fpu/s_significandl.S: ...here. + * sysdeps/libm-i387/s_sin.S: Moved to ... + * sysdeps/i386/fpu/s_sin.S: ...here. + * sysdeps/libm-i387/s_sincos.S: Moved to ... + * sysdeps/i386/fpu/s_sincos.S: ...here. + * sysdeps/libm-i387/s_sincosf.S: Moved to ... + * sysdeps/i386/fpu/s_sincosf.S: ...here. + * sysdeps/libm-i387/s_sincosl.S: Moved to ... + * sysdeps/i386/fpu/s_sincosl.S: ...here. + * sysdeps/libm-i387/s_sinf.S: Moved to ... + * sysdeps/i386/fpu/s_sinf.S: ...here. + * sysdeps/libm-i387/s_sinl.S: Moved to ... + * sysdeps/i386/fpu/s_sinl.S: ...here. + * sysdeps/libm-i387/s_tan.S: Moved to ... + * sysdeps/i386/fpu/s_tan.S: ...here. + * sysdeps/libm-i387/s_tanf.S: Moved to ... + * sysdeps/i386/fpu/s_tanf.S: ...here. + * sysdeps/libm-i387/s_tanl.S: Moved to ... + * sysdeps/i386/fpu/s_tanl.S: ...here. + * sysdeps/libm-i387/s_trunc.S: Moved to ... + * sysdeps/i386/fpu/s_trunc.S: ...here. + * sysdeps/libm-i387/s_truncf.S: Moved to ... + * sysdeps/i386/fpu/s_truncf.S: ...here. + * sysdeps/libm-i387/s_truncl.S: Moved to ... + * sysdeps/i386/fpu/s_truncl.S: ...here. + * sysdeps/libm-ieee754/k_standard.c: Moved to ... + * sysdeps/ieee754/k_standard.c: ...here. + * sysdeps/libm-ieee754/s_lib_version.c: Moved to ... + * sysdeps/ieee754/s_lib_version.c: ...here. + * sysdeps/libm-ieee754/s_matherr.c: Moved to ... + * sysdeps/ieee754/s_matherr.c: ...here. + * sysdeps/libm-ieee754/s_signgam.c: Moved to ... + * sysdeps/ieee754/s_signgam.c: ...here. + * sysdeps/ieee754/dbl2mpn.c: Moved to ... + * sysdeps/ieee754/dbl-64/dbl2mpn.c: ...here. + * sysdeps/ieee754/mpn2dbl.c: Moved to ... + * sysdeps/ieee754/dbl-64/mpn2dbl.c: ...here. + * sysdeps/libm-ieee754/e_acos.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_acos.c: ...here. + * sysdeps/libm-ieee754/e_acosh.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_acosh.c: ...here. + * sysdeps/libm-ieee754/e_asin.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_asin.c: ...here. + * sysdeps/libm-ieee754/e_atan2.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_atan2.c: ...here. + * sysdeps/libm-ieee754/e_atanh.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_atanh.c: ...here. + * sysdeps/libm-ieee754/e_cosh.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_cosh.c: ...here. + * sysdeps/libm-ieee754/e_exp.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_exp.c: ...here. + * sysdeps/libm-ieee754/e_fmod.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_fmod.c: ...here. + * sysdeps/libm-ieee754/e_gamma_r.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_gamma_r.c: ...here. + * sysdeps/libm-ieee754/e_hypot.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_hypot.c: ...here. + * sysdeps/libm-ieee754/e_j0.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_j0.c: ...here. + * sysdeps/libm-ieee754/e_j1.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_j1.c: ...here. + * sysdeps/libm-ieee754/e_jn.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_jn.c: ...here. + * sysdeps/libm-ieee754/e_lgamma_r.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_lgamma_r.c: ...here. + * sysdeps/libm-ieee754/e_log.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_log.c: ...here. + * sysdeps/libm-ieee754/e_log10.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_log10.c: ...here. + * sysdeps/libm-ieee754/e_pow.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_pow.c: ...here. + * sysdeps/libm-ieee754/e_remainder.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_remainder.c: ...here. + * sysdeps/libm-ieee754/e_sinh.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_sinh.c: ...here. + * sysdeps/libm-ieee754/e_sqrt.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_sqrt.c: ...here. + * sysdeps/libm-ieee754/k_cos.c: Moved to ... + * sysdeps/ieee754/dbl-64/k_cos.c: ...here. + * sysdeps/libm-ieee754/k_sin.c: Moved to ... + * sysdeps/ieee754/dbl-64/k_sin.c: ...here. + * sysdeps/libm-ieee754/k_tan.c: Moved to ... + * sysdeps/ieee754/dbl-64/k_tan.c: ...here. + * sysdeps/libm-ieee754/s_asinh.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_asinh.c: ...here. + * sysdeps/libm-ieee754/s_atan.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_atan.c: ...here. + * sysdeps/libm-ieee754/s_cbrt.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_cbrt.c: ...here. + * sysdeps/libm-ieee754/s_ceil.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_ceil.c: ...here. + * sysdeps/libm-ieee754/s_copysign.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_copysign.c: ...here. + * sysdeps/libm-ieee754/s_cos.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_cos.c: ...here. + * sysdeps/libm-ieee754/s_erf.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_erf.c: ...here. + * sysdeps/libm-ieee754/s_exp2.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_exp2.c: ...here. + * sysdeps/libm-ieee754/s_expm1.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_expm1.c: ...here. + * sysdeps/libm-ieee754/s_fabs.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_fabs.c: ...here. + * sysdeps/libm-ieee754/s_finite.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_finite.c: ...here. + * sysdeps/libm-ieee754/s_floor.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_floor.c: ...here. + * sysdeps/libm-ieee754/s_fpclassify.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_fpclassify.c: ...here. + * sysdeps/libm-ieee754/s_frexp.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_frexp.c: ...here. + * sysdeps/libm-ieee754/s_ilogb.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_ilogb.c: ...here. + * sysdeps/libm-ieee754/s_isinf.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_isinf.c: ...here. + * sysdeps/libm-ieee754/s_isnan.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_isnan.c: ...here. + (__isnan): Comment above function says it returns 0 or 1, but it + used to return 0 or -1. + * sysdeps/libm-ieee754/s_llrint.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_llrint.c: ...here. + * sysdeps/libm-ieee754/s_llround.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_llround.c: ...here. + * sysdeps/libm-ieee754/s_log1p.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_log1p.c: ...here. + * sysdeps/libm-ieee754/s_log2.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_log2.c: ...here. + * sysdeps/libm-ieee754/s_logb.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_logb.c: ...here. + * sysdeps/libm-ieee754/s_lrint.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_lrint.c: ...here. + * sysdeps/libm-ieee754/s_lround.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_lround.c: ...here. + * sysdeps/libm-ieee754/s_modf.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_modf.c: ...here. + * sysdeps/libm-ieee754/s_nearbyint.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_nearbyint.c: ...here. + * sysdeps/libm-ieee754/s_nextafter.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_nextafter.c: ...here. + Add __nexttoward and nexttoward aliases if NO_LONG_DOUBLE. + * sysdeps/libm-ieee754/s_remquo.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_remquo.c: ...here. + * sysdeps/libm-ieee754/s_rint.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_rint.c: ...here. + * sysdeps/libm-ieee754/s_round.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_round.c: ...here. + * sysdeps/libm-ieee754/s_scalbn.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_scalbn.c: ...here. + * sysdeps/libm-ieee754/s_signbit.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_signbit.c: ...here. + * sysdeps/libm-ieee754/s_sin.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_sin.c: ...here. + * sysdeps/libm-ieee754/s_sincos.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_sincos.c: ...here. + * sysdeps/libm-ieee754/s_tan.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_tan.c: ...here. + * sysdeps/libm-ieee754/s_tanh.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_tanh.c: ...here. + * sysdeps/libm-ieee754/s_trunc.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_trunc.c: ...here. + * sysdeps/libm-ieee754/t_exp2.h: Moved to ... + * sysdeps/ieee754/dbl-64/t_exp2.h: ...here. + * sysdeps/libm-ieee754/w_exp.c: Moved to ... + * sysdeps/ieee754/dbl-64/w_exp.c: ...here. + * sysdeps/ieee754/mpn2flt.c: Moved to ... + * sysdeps/ieee754/flt-32/mpn2flt.c: ...here. + * sysdeps/libm-ieee754/e_acosf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_acosf.c: ...here. + * sysdeps/libm-ieee754/e_acoshf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_acoshf.c: ...here. + * sysdeps/libm-ieee754/e_asinf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_asinf.c: ...here. + * sysdeps/libm-ieee754/e_atan2f.c: Moved to ... + * sysdeps/ieee754/flt-32/e_atan2f.c: ...here. + * sysdeps/libm-ieee754/e_atanhf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_atanhf.c: ...here. + * sysdeps/libm-ieee754/e_coshf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_coshf.c: ...here. + * sysdeps/libm-ieee754/e_expf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_expf.c: ...here. + * sysdeps/libm-ieee754/e_fmodf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_fmodf.c: ...here. + * sysdeps/libm-ieee754/e_gammaf_r.c: Moved to ... + * sysdeps/ieee754/flt-32/e_gammaf_r.c: ...here. + * sysdeps/libm-ieee754/e_hypotf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_hypotf.c: ...here. + * sysdeps/libm-ieee754/e_j0f.c: Moved to ... + * sysdeps/ieee754/flt-32/e_j0f.c: ...here. + * sysdeps/libm-ieee754/e_j1f.c: Moved to ... + * sysdeps/ieee754/flt-32/e_j1f.c: ...here. + * sysdeps/libm-ieee754/e_jnf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_jnf.c: ...here. + * sysdeps/libm-ieee754/e_lgammaf_r.c: Moved to ... + * sysdeps/ieee754/flt-32/e_lgammaf_r.c: ...here. + * sysdeps/libm-ieee754/e_log10f.c: Moved to ... + * sysdeps/ieee754/flt-32/e_log10f.c: ...here. + * sysdeps/libm-ieee754/e_logf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_logf.c: ...here. + * sysdeps/libm-ieee754/e_powf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_powf.c: ...here. + * sysdeps/libm-ieee754/e_remainderf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_remainderf.c: ...here. + * sysdeps/libm-ieee754/e_sinhf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_sinhf.c: ...here. + * sysdeps/libm-ieee754/e_sqrtf.c: Moved to ... + * sysdeps/ieee754/flt-32/e_sqrtf.c: ...here. + * sysdeps/libm-ieee754/k_cosf.c: Moved to ... + * sysdeps/ieee754/flt-32/k_cosf.c: ...here. + * sysdeps/libm-ieee754/k_sinf.c: Moved to ... + * sysdeps/ieee754/flt-32/k_sinf.c: ...here. + * sysdeps/libm-ieee754/k_tanf.c: Moved to ... + * sysdeps/ieee754/flt-32/k_tanf.c: ...here. + * sysdeps/libm-ieee754/s_asinhf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_asinhf.c: ...here. + * sysdeps/libm-ieee754/s_atanf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_atanf.c: ...here. + * sysdeps/libm-ieee754/s_cbrtf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_cbrtf.c: ...here. + * sysdeps/libm-ieee754/s_ceilf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_ceilf.c: ...here. + * sysdeps/libm-ieee754/s_copysignf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_copysignf.c: ...here. + * sysdeps/libm-ieee754/s_cosf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_cosf.c: ...here. + * sysdeps/libm-ieee754/s_erff.c: Moved to ... + * sysdeps/ieee754/flt-32/s_erff.c: ...here. + * sysdeps/libm-ieee754/s_exp2f.c: Moved to ... + * sysdeps/ieee754/flt-32/s_exp2f.c: ...here. + * sysdeps/libm-ieee754/s_expm1f.c: Moved to ... + * sysdeps/ieee754/flt-32/s_expm1f.c: ...here. + * sysdeps/libm-ieee754/s_fabsf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_fabsf.c: ...here. + * sysdeps/libm-ieee754/s_finitef.c: Moved to ... + * sysdeps/ieee754/flt-32/s_finitef.c: ...here. + * sysdeps/libm-ieee754/s_floorf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_floorf.c: ...here. + * sysdeps/libm-ieee754/s_fpclassifyf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_fpclassifyf.c: ...here. + * sysdeps/libm-ieee754/s_frexpf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_frexpf.c: ...here. + * sysdeps/libm-ieee754/s_ilogbf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_ilogbf.c: ...here. + * sysdeps/libm-ieee754/s_isinff.c: Moved to ... + * sysdeps/ieee754/flt-32/s_isinff.c: ...here. + * sysdeps/libm-ieee754/s_isnanf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_isnanf.c: ...here. + * sysdeps/libm-ieee754/s_llrintf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_llrintf.c: ...here. + * sysdeps/libm-ieee754/s_llroundf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_llroundf.c: ...here. + * sysdeps/libm-ieee754/s_log1pf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_log1pf.c: ...here. + * sysdeps/libm-ieee754/s_log2f.c: Moved to ... + * sysdeps/ieee754/flt-32/s_log2f.c: ...here. + * sysdeps/libm-ieee754/s_logbf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_logbf.c: ...here. + * sysdeps/libm-ieee754/s_lrintf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_lrintf.c: ...here. + * sysdeps/libm-ieee754/s_lroundf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_lroundf.c: ...here. + * sysdeps/libm-ieee754/s_modff.c: Moved to ... + * sysdeps/ieee754/flt-32/s_modff.c: ...here. + * sysdeps/libm-ieee754/s_nearbyintf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_nearbyintf.c: ...here. + * sysdeps/libm-ieee754/s_nextafterf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_nextafterf.c: ...here. + * sysdeps/libm-ieee754/s_remquof.c: Moved to ... + * sysdeps/ieee754/flt-32/s_remquof.c: ...here. + * sysdeps/libm-ieee754/s_rintf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_rintf.c: ...here. + * sysdeps/libm-ieee754/s_roundf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_roundf.c: ...here. + * sysdeps/libm-ieee754/s_scalbnf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_scalbnf.c: ...here. + * sysdeps/libm-ieee754/s_signbitf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_signbitf.c: ...here. + * sysdeps/libm-ieee754/s_sincosf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_sincosf.c: ...here. + * sysdeps/libm-ieee754/s_sinf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_sinf.c: ...here. + * sysdeps/libm-ieee754/s_tanf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_tanf.c: ...here. + * sysdeps/libm-ieee754/s_tanhf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_tanhf.c: ...here. + * sysdeps/libm-ieee754/s_truncf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_truncf.c: ...here. + * sysdeps/libm-ieee754/t_exp2f.h: Moved to ... + * sysdeps/ieee754/flt-32/t_exp2f.h: ...here. + * sysdeps/libm-ieee754/w_expf.c: Moved to ... + * sysdeps/ieee754/flt-32/w_expf.c: ...here. + * sysdeps/libm-ieee754/e_acoshl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_acoshl.c: ...here. + * sysdeps/libm-ieee754/e_atan2l.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_atan2l.c: ...here. + * sysdeps/libm-ieee754/e_atanhl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_atanhl.c: ...here. + * sysdeps/libm-ieee754/e_coshl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_coshl.c: ...here. + * sysdeps/libm-ieee754/e_gammal_r.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_gammal_r.c: ...here. + * sysdeps/libm-ieee754/e_hypotl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_hypotl.c: ...here. + * sysdeps/libm-ieee754/e_remainderl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_remainderl.c: ...here. + * sysdeps/libm-ieee754/e_sinhl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/e_sinhl.c: ...here. + * sysdeps/libm-ieee754/s_asinhl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_asinhl.c: ...here. + * sysdeps/libm-ieee754/s_cbrtl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_cbrtl.c: ...here. + * sysdeps/libm-ieee754/s_ceill.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_ceill.c: ...here. + * sysdeps/libm-ieee754/s_copysignl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_copysignl.c: ...here. + * sysdeps/libm-ieee754/s_cosl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_cosl.c: ...here. + * sysdeps/libm-ieee754/s_fabsl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_fabsl.c: ...here. + * sysdeps/libm-ieee754/s_finitel.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_finitel.c: ...here. + * sysdeps/libm-ieee754/s_floorl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_floorl.c: ...here. + * sysdeps/libm-ieee754/s_fpclassifyl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_fpclassifyl.c: ...here. + * sysdeps/libm-ieee754/s_frexpl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_frexpl.c: ...here. + * sysdeps/libm-ieee754/s_ilogbl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_ilogbl.c: ...here. + * sysdeps/libm-ieee754/s_llrintl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_llrintl.c: ...here. + * sysdeps/libm-ieee754/s_llroundl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_llroundl.c: ...here. + * sysdeps/libm-ieee754/s_logbl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_logbl.c: ...here. + * sysdeps/libm-ieee754/s_lrintl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_lrintl.c: ...here. + * sysdeps/libm-ieee754/s_lroundl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_lroundl.c: ...here. + * sysdeps/libm-ieee754/s_modfl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_modfl.c: ...here. + (__modfl): IEEE 854 long doubles should use SET_LDOUBLE_WORDS, not + INSERT_WORDS. + * sysdeps/libm-ieee754/s_nearbyintl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_nearbyintl.c: ...here. + (__nearbyintl): Fix for exponents 2^30. + * sysdeps/libm-ieee754/s_remquol.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_remquol.c: ...here. + * sysdeps/libm-ieee754/s_rintl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_rintl.c: ...here. + (__rintl): Fix for exponents 2^30. + * sysdeps/libm-ieee754/s_roundl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_roundl.c: ...here. + * sysdeps/libm-ieee754/s_scalbnl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_scalbnl.c: ...here. + (__scalbnl): Fix exponent for subnormal result. + * sysdeps/libm-ieee754/s_signbitl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_signbitl.c: ...here. + * sysdeps/libm-ieee754/s_sincosl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_sincosl.c: ...here. + * sysdeps/libm-ieee754/s_sinl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_sinl.c: ...here. + * sysdeps/libm-ieee754/s_tanhl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_tanhl.c: ...here. + * sysdeps/libm-ieee754/s_tanl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_tanl.c: ...here. + * sysdeps/libm-ieee754/s_truncl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_truncl.c: ...here. + * sysdeps/libm-ieee754/w_expl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/w_expl.c: ...here. + * sysdeps/libm-i387/i686/s_fminl.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fminl.S: ...here. + * sysdeps/libm-i387/s_scalblnf.c: Moved to ... + * sysdeps/i386/fpu/s_scalblnf.c: ...here. + * sysdeps/libm-ieee754/s_scalblnf.c: Moved to ... + * sysdeps/ieee754/flt-32/s_scalblnf.c: ...here. + * sysdeps/libm-i387/i686/s_fdiml.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fdiml.S: ...here. + * sysdeps/libm-i387/e_rem_pio2f.c: Moved to ... + * sysdeps/i386/fpu/e_rem_pio2f.c: ...here. + * sysdeps/libm-ieee754/e_rem_pio2f.c: Moved to ... + * sysdeps/ieee754/flt-32/e_rem_pio2f.c: ...here. + * sysdeps/libm-i387/i686/s_fmin.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fmin.S: ...here. + * sysdeps/libm-i387/k_rem_pio2.c: Moved to ... + * sysdeps/i386/fpu/k_rem_pio2.c: ...here. + * sysdeps/libm-ieee754/k_rem_pio2.c: Moved to ... + * sysdeps/ieee754/dbl-64/k_rem_pio2.c: ...here. + * sysdeps/libm-i387/k_rem_pio2f.c: Moved to ... + * sysdeps/i386/fpu/k_rem_pio2f.c: ...here. + * sysdeps/libm-ieee754/k_rem_pio2f.c: Moved to ... + * sysdeps/ieee754/flt-32/k_rem_pio2f.c: ...here. + * sysdeps/libm-i387/s_scalbln.c: Moved to ... + * sysdeps/i386/fpu/s_scalbln.c: ...here. + * sysdeps/libm-ieee754/s_scalbln.c: Moved to ... + * sysdeps/ieee754/dbl-64/s_scalbln.c: ...here. + * sysdeps/libm-i387/i686/s_fmax.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fmax.S: ...here. + * sysdeps/libm-i387/t_exp.c: Moved to ... + * sysdeps/i386/fpu/t_exp.c: ...here. + * sysdeps/libm-ieee754/t_exp.c: Moved to ... + * sysdeps/ieee754/dbl-64/t_exp.c: ...here. + * sysdeps/libm-i387/e_rem_pio2.c: Moved to ... + * sysdeps/i386/fpu/e_rem_pio2.c: ...here. + * sysdeps/libm-ieee754/e_rem_pio2.c: Moved to ... + * sysdeps/ieee754/dbl-64/e_rem_pio2.c: ...here. + * sysdeps/libm-i387/s_isinfl.c: Moved to ... + * sysdeps/i386/fpu/s_isinfl.c: ...here. + * sysdeps/libm-ieee754/s_isinfl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_isinfl.c: ...here. + * sysdeps/libm-i387/s_scalblnl.c: Moved to ... + * sysdeps/i386/fpu/s_scalblnl.c: ...here. + * sysdeps/libm-ieee754/s_scalblnl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_scalblnl.c: ...here. + Fix exponent for subnormal result. + * sysdeps/libm-ieee754/s_nexttowardl.c: Moved to ... + * math/s_nexttowardl.c: ...here. + * sysdeps/libm-i387/i686/s_fmaxf.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fmaxf.S: ...here. + * sysdeps/libm-i387/s_isnanl.c: Moved to ... + * sysdeps/i386/fpu/s_isnanl.c: ...here. + * sysdeps/libm-ieee754/s_isnanl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_isnanl.c: ...here. + Comment above function says it returns 0 or 1, but it used to return + 0 or -1. + * sysdeps/libm-i387/i686/s_fminf.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fminf.S: ...here. + * sysdeps/libm-i387/i686/s_fdim.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fdim.S: ...here. + * sysdeps/libm-i387/i686/s_fdimf.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fdimf.S: ...here. + * sysdeps/libm-i387/i686/s_fmaxl.S: Moved to ... + * sysdeps/i386/i686/fpu/s_fmaxl.S: ...here. + * sysdeps/libm-ieee754/s_nexttoward.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_nexttoward.c: ...here. + Cannot compare exponents with different biases without adjusting. + * sysdeps/libm-ieee754/s_nexttowardf.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_nexttowardf.c: ...here. + Cannot compare exponents with different biases without adjusting. + * sysdeps/libm-i387/s_nextafterl.c: Moved to ... + * sysdeps/i386/fpu/s_nextafterl.c: ...here. + * sysdeps/libm-ieee754/s_nextafterl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/s_nextafterl.c: ...here. + * sysdeps/ieee754/ldbl2mpn.c: Moved to ... + * sysdeps/ieee754/ldbl-96/ldbl2mpn.c: ...here. + Removed __NO_LONG_DOUBLE_MATH ifndef around the whole file. + * sysdeps/ieee754/mpn2ldbl.c: Moved to ... + * sysdeps/ieee754/ldbl-96/mpn2ldbl.c: ...here. + Removed __NO_LONG_DOUBLE_MATH ifndef around the whole file. + * sysdeps/libm-ieee754/Dist: Split into ... + * sysdeps/ieee754/dbl-64/Dist: ...this and ... + * sysdeps/ieee754/flt-32/Dist: ...this file. + + * sysdeps/ieee754/flt-32/Implies: New file. + * sysdeps/ieee754/dbl-64/Implies: New file. + * sysdeps/ieee754/dbl-64/math_ldbl.h: New file. + * sysdeps/ieee754/dbl-64/s_nexttoward.c: New file. + * sysdeps/ieee754/dbl-64/s_nexttowardf.c: New file. + * sysdeps/ieee754/dbl-64/strtold.c: New file. + * sysdeps/ieee754/dbl-64/mpn2ldbl.c: New file. + * sysdeps/ieee754/dbl-64/ldbl2mpn.c: New file. + * sysdeps/ieee754/ldbl-96/Implies: New file. + * sysdeps/ieee754/ldbl-96/math_ldbl.h: New file. + * sysdeps/ieee754/ldbl-96/strtold.c: New file. + * sysdeps/ieee754/ldbl-96/printf_fphex.c: New file. + * sysdeps/ieee754/ldbl-128/Implies: New file. + * sysdeps/ieee754/ldbl-128/s_sinl.c: New file. + * sysdeps/ieee754/ldbl-128/s_ceill.c: New file. + * sysdeps/ieee754/ldbl-128/e_remainderl.c: New file. + * sysdeps/ieee754/ldbl-128/ieee754.h: New file. + * sysdeps/ieee754/ldbl-128/e_atan2l.c: New file. + * sysdeps/ieee754/ldbl-128/s_finitel.c: New file. + * sysdeps/ieee754/ldbl-128/s_roundl.c: New file. + * sysdeps/ieee754/ldbl-128/s_llrintl.c: New file. + * sysdeps/ieee754/ldbl-128/e_gammal_r.c: New file. + * sysdeps/ieee754/ldbl-128/s_llroundl.c: New file. + * sysdeps/ieee754/ldbl-128/s_sincosl.c: New file. + * sysdeps/ieee754/ldbl-128/s_cosl.c: New file. + * sysdeps/ieee754/ldbl-128/s_fpclassifyl.c: New file. + * sysdeps/ieee754/ldbl-128/s_ilogbl.c: New file. + * sysdeps/ieee754/ldbl-128/s_floorl.c: New file. + * sysdeps/ieee754/ldbl-128/s_logbl.c: New file. + * sysdeps/ieee754/ldbl-128/s_scalbnl.c: New file. + * sysdeps/ieee754/ldbl-128/s_remquol.c: New file. + * sysdeps/ieee754/ldbl-128/s_nearbyintl.c: New file. + * sysdeps/ieee754/ldbl-128/s_tanl.c: New file. + * sysdeps/ieee754/ldbl-128/s_rintl.c: New file. + * sysdeps/ieee754/ldbl-128/e_acoshl.c: New file. + * sysdeps/ieee754/ldbl-128/s_lroundl.c: New file. + * sysdeps/ieee754/ldbl-128/s_signbitl.c: New file. + * sysdeps/ieee754/ldbl-128/s_copysignl.c: New file. + * sysdeps/ieee754/ldbl-128/s_fabsl.c: New file. + * sysdeps/ieee754/ldbl-128/s_frexpl.c: New file. + * sysdeps/ieee754/ldbl-128/s_truncl.c: New file. + * sysdeps/ieee754/ldbl-128/s_modfl.c: New file. + * sysdeps/ieee754/ldbl-128/s_lrintl.c: New file. + * sysdeps/ieee754/ldbl-128/s_isinfl.c: New file. + * sysdeps/ieee754/ldbl-128/s_scalblnl.c: New file. + * sysdeps/ieee754/ldbl-128/e_fmodl.c: New file. + * sysdeps/ieee754/ldbl-128/s_isnanl.c: New file. + * sysdeps/ieee754/ldbl-128/math_ldbl.h: New file. + * sysdeps/ieee754/ldbl-128/strtold.c: New file. + * sysdeps/ieee754/ldbl-128/s_nextafterl.c: New file. + * sysdeps/ieee754/ldbl-128/s_nexttoward.c: New file. + * sysdeps/ieee754/ldbl-128/s_nexttowardf.c: New file. + * sysdeps/ieee754/ldbl-128/printf_fphex.c: New file. + * sysdeps/ieee754/ldbl-128/mpn2ldbl.c: New file. + * sysdeps/ieee754/ldbl-128/ldbl2mpn.c: New file. + + * math/machine/endian.h: Remove. + * sysdeps/i386/fpu/Implies: Remove. + * sysdeps/ieee754/Implies: Remove. + + * math/math_private.h: Move long double macros to math_ldbl.h + header. + 1999-07-12 Ulrich Drepper * sysdeps/posix/getaddrinfo.c (gaih_inet): For non-passive diff --git a/math/machine/endian.h b/math/machine/endian.h deleted file mode 100644 index 88804564bf..0000000000 --- a/math/machine/endian.h +++ /dev/null @@ -1,4 +0,0 @@ -/* math_private.h wants to include ; we provide this - file so it can, leaving math_private.h unmodified from the original. */ - -#include diff --git a/math/math_private.h b/math/math_private.h index 906b1dabba..35e3e4e7ca 100644 --- a/math/math_private.h +++ b/math/math_private.h @@ -17,7 +17,7 @@ #ifndef _MATH_PRIVATE_H_ #define _MATH_PRIVATE_H_ -#include +#include #include /* The original fdlibm code used statements like: @@ -147,101 +147,8 @@ do { \ (d) = sf_u.value; \ } while (0) -/* A union which permits us to convert between a long double and - three 32 bit ints. */ - -#if __FLOAT_WORD_ORDER == BIG_ENDIAN - -typedef union -{ - long double value; - struct - { - unsigned int sign_exponent:16; - unsigned int empty:16; - u_int32_t msw; - u_int32_t lsw; - } parts; -} ieee_long_double_shape_type; - -#endif - -#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN - -typedef union -{ - long double value; - struct - { - u_int32_t lsw; - u_int32_t msw; - unsigned int sign_exponent:16; - unsigned int empty:16; - } parts; -} ieee_long_double_shape_type; - -#endif - -/* Get three 32 bit ints from a double. */ - -#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \ -do { \ - ieee_long_double_shape_type ew_u; \ - ew_u.value = (d); \ - (exp) = ew_u.parts.sign_exponent; \ - (ix0) = ew_u.parts.msw; \ - (ix1) = ew_u.parts.lsw; \ -} while (0) - -/* Set a double from two 32 bit ints. */ - -#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \ -do { \ - ieee_long_double_shape_type iw_u; \ - iw_u.parts.sign_exponent = (exp); \ - iw_u.parts.msw = (ix0); \ - iw_u.parts.lsw = (ix1); \ - (d) = iw_u.value; \ -} while (0) - -/* Get the more significant 32 bits of a long double mantissa. */ - -#define GET_LDOUBLE_MSW(v,d) \ -do { \ - ieee_long_double_shape_type sh_u; \ - sh_u.value = (d); \ - (v) = sh_u.parts.msw; \ -} while (0) - -/* Set the more significant 32 bits of a long double mantissa from an int. */ - -#define SET_LDOUBLE_MSW(d,v) \ -do { \ - ieee_long_double_shape_type sh_u; \ - sh_u.value = (d); \ - sh_u.parts.msw = (v); \ - (d) = sh_u.value; \ -} while (0) - -/* Get int from the exponent of a long double. */ - -#define GET_LDOUBLE_EXP(exp,d) \ -do { \ - ieee_long_double_shape_type ge_u; \ - ge_u.value = (d); \ - (exp) = ge_u.parts.sign_exponent; \ -} while (0) - -/* Set exponent of a long double from an int. */ - -#define SET_LDOUBLE_EXP(d,exp) \ -do { \ - ieee_long_double_shape_type se_u; \ - se_u.value = (d); \ - se_u.parts.sign_exponent = (exp); \ - (d) = se_u.value; \ -} while (0) - +/* Get long double macros from a separate header. */ +#include /* ieee style elementary functions */ extern double __ieee754_sqrt __P((double)); diff --git a/math/w_acos.c b/math/w_acos.c new file mode 100644 index 0000000000..5a1158ea7a --- /dev/null +++ b/math/w_acos.c @@ -0,0 +1,48 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrap_acos(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __acos(double x) /* wrapper acos */ +#else + double __acos(x) /* wrapper acos */ + double x; +#endif +{ +#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 +} +weak_alias (__acos, acos) +#ifdef NO_LONG_DOUBLE +strong_alias (__acos, __acosl) +weak_alias (__acos, acosl) +#endif diff --git a/math/w_acosf.c b/math/w_acosf.c new file mode 100644 index 0000000000..28260ddd3e --- /dev/null +++ b/math/w_acosf.c @@ -0,0 +1,48 @@ +/* w_acosf.c -- float version of w_acos.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrap_acosf(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __acosf(float x) /* wrapper acosf */ +#else + float __acosf(x) /* wrapper acosf */ + float x; +#endif +{ +#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 +} +weak_alias (__acosf, acosf) diff --git a/math/w_acosh.c b/math/w_acosh.c new file mode 100644 index 0000000000..2b5d60f7ea --- /dev/null +++ b/math/w_acosh.c @@ -0,0 +1,47 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper acosh(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __acosh(double x) /* wrapper acosh */ +#else + double __acosh(x) /* wrapper acosh */ + double x; +#endif +{ +#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 +} +weak_alias (__acosh, acosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__acosh, __acoshl) +weak_alias (__acosh, acoshl) +#endif diff --git a/math/w_acoshf.c b/math/w_acoshf.c new file mode 100644 index 0000000000..f701983dc2 --- /dev/null +++ b/math/w_acoshf.c @@ -0,0 +1,48 @@ +/* w_acoshf.c -- float version of w_acosh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + * + */ + +#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 + +/* + * wrapper acoshf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __acoshf(float x) /* wrapper acoshf */ +#else + float __acoshf(x) /* wrapper acoshf */ + float x; +#endif +{ +#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 +} +weak_alias (__acoshf, acoshf) diff --git a/math/w_acoshl.c b/math/w_acoshl.c new file mode 100644 index 0000000000..a37d4c15d9 --- /dev/null +++ b/math/w_acoshl.c @@ -0,0 +1,47 @@ +/* w_acoshl.c -- long double version of w_acosh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper acoshl(x) + */ + +#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 +{ +#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 +} +weak_alias (__acoshl, acoshl) diff --git a/math/w_acosl.c b/math/w_acosl.c new file mode 100644 index 0000000000..cd9cecf2f9 --- /dev/null +++ b/math/w_acosl.c @@ -0,0 +1,48 @@ +/* w_acosl.c -- long double version of w_acos.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrap_acosl(x) + */ + +#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 +{ +#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 +} +weak_alias (__acosl, acosl) diff --git a/math/w_asin.c b/math/w_asin.c new file mode 100644 index 0000000000..a7ca4ef9fd --- /dev/null +++ b/math/w_asin.c @@ -0,0 +1,49 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper asin(x) + */ + + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __asin(double x) /* wrapper asin */ +#else + double __asin(x) /* wrapper asin */ + double x; +#endif +{ +#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 +} +weak_alias (__asin, asin) +#ifdef NO_LONG_DOUBLE +strong_alias (__asin, __asinl) +weak_alias (__asin, asinl) +#endif diff --git a/math/w_asinf.c b/math/w_asinf.c new file mode 100644 index 0000000000..d7f7a253b0 --- /dev/null +++ b/math/w_asinf.c @@ -0,0 +1,49 @@ +/* w_asinf.c -- float version of w_asin.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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) + */ + + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __asinf(float x) /* wrapper asinf */ +#else + float __asinf(x) /* wrapper asinf */ + float x; +#endif +{ +#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 +} +weak_alias (__asinf, asinf) diff --git a/math/w_asinl.c b/math/w_asinl.c new file mode 100644 index 0000000000..0ac3038e95 --- /dev/null +++ b/math/w_asinl.c @@ -0,0 +1,49 @@ +/* w_asinl.c -- long double version of w_asin.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper asinl(x) + */ + + +#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 +{ +#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 +} +weak_alias (__asinl, asinl) diff --git a/math/w_atan2.c b/math/w_atan2.c new file mode 100644 index 0000000000..801baa2347 --- /dev/null +++ b/math/w_atan2.c @@ -0,0 +1,47 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper atan2(y,x) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__atan2, atan2) +#ifdef NO_LONG_DOUBLE +strong_alias (__atan2, __atan2l) +weak_alias (__atan2, atan2l) +#endif diff --git a/math/w_atan2f.c b/math/w_atan2f.c new file mode 100644 index 0000000000..09caa06f00 --- /dev/null +++ b/math/w_atan2f.c @@ -0,0 +1,46 @@ +/* w_atan2f.c -- float version of w_atan2.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper atan2f(y,x) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__atan2f, atan2f) diff --git a/math/w_atan2l.c b/math/w_atan2l.c new file mode 100644 index 0000000000..2897c8c5f9 --- /dev/null +++ b/math/w_atan2l.c @@ -0,0 +1,47 @@ +/* w_atan2l.c -- long double version of w_atan2.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper atan2l(y,x) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__atan2l, atan2l) diff --git a/math/w_atanh.c b/math/w_atanh.c new file mode 100644 index 0000000000..e7995b1830 --- /dev/null +++ b/math/w_atanh.c @@ -0,0 +1,52 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper atanh(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __atanh(double x) /* wrapper atanh */ +#else + double __atanh(x) /* wrapper atanh */ + double x; +#endif +{ +#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 +} +weak_alias (__atanh, atanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__atanh, __atanhl) +weak_alias (__atanh, atanhl) +#endif diff --git a/math/w_atanhf.c b/math/w_atanhf.c new file mode 100644 index 0000000000..0b24f2c71a --- /dev/null +++ b/math/w_atanhf.c @@ -0,0 +1,53 @@ +/* w_atanhf.c -- float version of w_atanh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper atanhf(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __atanhf(float x) /* wrapper atanhf */ +#else + float __atanhf(x) /* wrapper atanhf */ + float x; +#endif +{ +#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 +} +weak_alias (__atanhf, atanhf) diff --git a/math/w_atanhl.c b/math/w_atanhl.c new file mode 100644 index 0000000000..d675fc6fe7 --- /dev/null +++ b/math/w_atanhl.c @@ -0,0 +1,52 @@ +/* w_atanhl.c -- long double version of w_atanh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper atanhl(x) + */ + +#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 +{ +#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 +} +weak_alias (__atanhl, atanhl) diff --git a/math/w_cosh.c b/math/w_cosh.c new file mode 100644 index 0000000000..8db25c868c --- /dev/null +++ b/math/w_cosh.c @@ -0,0 +1,47 @@ +/* @(#)w_cosh.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. + * ==================================================== + */ + +#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) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __cosh(double x) /* wrapper cosh */ +#else + double __cosh(x) /* wrapper cosh */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_cosh(x); +#else + double z; + z = __ieee754_cosh(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(fabs(x)>7.10475860073943863426e+02) { + return __kernel_standard(x,x,5); /* cosh overflow */ + } else + return z; +#endif +} +weak_alias (__cosh, cosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__cosh, __coshl) +weak_alias (__cosh, coshl) +#endif diff --git a/math/w_coshf.c b/math/w_coshf.c new file mode 100644 index 0000000000..53ca84108e --- /dev/null +++ b/math/w_coshf.c @@ -0,0 +1,47 @@ +/* w_coshf.c -- float version of w_cosh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_coshf(x); +#else + float z; + z = __ieee754_coshf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(fabsf(x)>(float)8.9415985107e+01) { + /* cosh overflow */ + return (float)__kernel_standard((double)x,(double)x,105); + } else + return z; +#endif +} +weak_alias (__coshf, coshf) diff --git a/math/w_coshl.c b/math/w_coshl.c new file mode 100644 index 0000000000..343d5724b9 --- /dev/null +++ b/math/w_coshl.c @@ -0,0 +1,47 @@ +/* w_acoshl.c -- long double version of w_acosh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper coshl(x) + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_coshl(x); +#else + long double z; + z = __ieee754_coshl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(fabsl(x)>7.10475860073943863426e+02) { + return __kernel_standard(x,x,205); /* cosh overflow */ + } else + return z; +#endif +} +weak_alias (__coshl, coshl) diff --git a/math/w_drem.c b/math/w_drem.c new file mode 100644 index 0000000000..9e2b1e7472 --- /dev/null +++ b/math/w_drem.c @@ -0,0 +1,20 @@ +/* + * drem() wrapper for remainder(). + * + * Written by J.T. Conklin, + * Placed into the Public Domain, 1994. + */ + +#include + +double +__drem(x, y) + double x, y; +{ + return __remainder(x, y); +} +weak_alias (__drem, drem) +#ifdef NO_LONG_DOUBLE +strong_alias (__drem, __dreml) +weak_alias (__drem, dreml) +#endif diff --git a/math/w_dremf.c b/math/w_dremf.c new file mode 100644 index 0000000000..b740ea304c --- /dev/null +++ b/math/w_dremf.c @@ -0,0 +1,17 @@ +/* + * dremf() wrapper for remainderf(). + * + * Written by J.T. Conklin, + * Placed into the Public Domain, 1994. + */ + +#include "math.h" +#include "math_private.h" + +float +__dremf(x, y) + float x, y; +{ + return __remainderf(x, y); +} +weak_alias (__dremf, dremf) diff --git a/math/w_dreml.c b/math/w_dreml.c new file mode 100644 index 0000000000..aa73eedc49 --- /dev/null +++ b/math/w_dreml.c @@ -0,0 +1,18 @@ +/* + * dreml() wrapper for remainderl(). + * + * Written by J.T. Conklin, + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + * Placed into the Public Domain, 1994. + */ + +#include + +long double +__dreml(x, y) + long double x, y; +{ + return __remainderl(x, y); +} +weak_alias (__dreml, dreml) diff --git a/math/w_exp10.c b/math/w_exp10.c new file mode 100644 index 0000000000..bf0d361f52 --- /dev/null +++ b/math/w_exp10.c @@ -0,0 +1,61 @@ +/* @(#)w_exp10.c + * Conversion to exp10 by Ulrich Drepper . + */ + +/* + * ==================================================== + * 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) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +o_threshold= 3.0825471555991674389672e+02, +u_threshold= -3.2360724533877978485251e+02; + +#ifdef __STDC__ + double __exp10(double x) /* wrapper exp10 */ +#else + double __exp10(x) /* wrapper exp10 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10(x); +#else + double z; + z = __ieee754_exp10(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finite(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,46); /* exp10 overflow */ + else if(x. + */ + +/* + * ==================================================== + * 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) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +o_threshold= 3.853183944498959298709e+01, +u_threshold= -4.515449934959717928174e+01; + +#ifdef __STDC__ + float __exp10f(float x) /* wrapper exp10f */ +#else + float __exp10f(x) /* wrapper exp10f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10f(x); +#else + float z; + z = __ieee754_exp10f(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitef(x)) { + if(x>o_threshold) + /* exp overflow */ + return (float)__kernel_standard((double)x,(double)x,146); + else if(xo_threshold) + return __kernel_standard(x,x,246); /* exp10 overflow */ + else if(x +#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; + +double +__exp2 (double x) /* wrapper exp2 */ +{ +#ifdef _IEEE_LIBM + 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 +strong_alias (__exp2, __expl2) +weak_alias (__exp2, expl2) +#endif diff --git a/math/w_exp2f.c b/math/w_exp2f.c new file mode 100644 index 0000000000..d2c340db3f --- /dev/null +++ b/math/w_exp2f.c @@ -0,0 +1,32 @@ +/* + * wrapper exp2f(x) + */ + +#include +#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; + +float +__exp2f (float x) /* wrapper exp2f */ +{ +#ifdef _IEEE_LIBM + 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 new file mode 100644 index 0000000000..965e9bf3e4 --- /dev/null +++ b/math/w_exp2l.c @@ -0,0 +1,30 @@ +/* + * wrapper exp2l(x) + */ + +#include +#include "math.h" +#include "math_private.h" + +static const long double o_threshold = (long double) LDBL_MAX_EXP; +static const long double u_threshold = (long double) LDBL_MIN_EXP; + +long double +__exp2l (long double x) /* wrapper exp2l */ +{ +#ifdef _IEEE_LIBM + 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 new file mode 100644 index 0000000000..0ceeb98c55 --- /dev/null +++ b/math/w_fmod.c @@ -0,0 +1,48 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper fmod(x,y) + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_fmod(x,y); +#else + double z; + z = __ieee754_fmod(x,y); + if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z; + if(y==0.0) { + return __kernel_standard(x,y,27); /* fmod(x,0) */ + } else + return z; +#endif +} +weak_alias (__fmod, fmod) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmod, __fmodl) +weak_alias (__fmod, fmodl) +#endif diff --git a/math/w_fmodf.c b/math/w_fmodf.c new file mode 100644 index 0000000000..9afe5ddfdd --- /dev/null +++ b/math/w_fmodf.c @@ -0,0 +1,48 @@ +/* w_fmodf.c -- float version of w_fmod.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper fmodf(x,y) + */ + +#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 +{ +#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(y==(float)0.0) { + /* fmodf(x,0) */ + return (float)__kernel_standard((double)x,(double)y,127); + } else + return z; +#endif +} +weak_alias (__fmodf, fmodf) diff --git a/math/w_fmodl.c b/math/w_fmodl.c new file mode 100644 index 0000000000..71ed4a94a4 --- /dev/null +++ b/math/w_fmodl.c @@ -0,0 +1,48 @@ +/* w_fmodl.c -- long double version of w_fmod.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper fmodl(x,y) + */ + +#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 +{ +#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(y==0.0) { + return __kernel_standard(x,y,227); /* fmod(x,0) */ + } else + return z; +#endif +} +weak_alias (__fmodl, fmodl) diff --git a/math/w_hypot.c b/math/w_hypot.c new file mode 100644 index 0000000000..e91db17083 --- /dev/null +++ b/math/w_hypot.c @@ -0,0 +1,48 @@ +/* @(#)w_hypot.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. + * ==================================================== + */ + +#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) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__hypot, hypot) +#ifdef NO_LONG_DOUBLE +strong_alias (__hypot, __hypotl) +weak_alias (__hypot, hypotl) +#endif diff --git a/math/w_hypotf.c b/math/w_hypotf.c new file mode 100644 index 0000000000..a7e5c1fdb6 --- /dev/null +++ b/math/w_hypotf.c @@ -0,0 +1,48 @@ +/* w_hypotf.c -- float version of w_hypot.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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) + */ + +#include "math.h" +#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 +{ +#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)) + /* hypot overflow */ + return (float)__kernel_standard((double)x,(double)y,104); + else + return z; +#endif +} +weak_alias (__hypotf, hypotf) diff --git a/math/w_hypotl.c b/math/w_hypotl.c new file mode 100644 index 0000000000..2ec215fd13 --- /dev/null +++ b/math/w_hypotl.c @@ -0,0 +1,48 @@ +/* w_hypotl.c -- long double version of w_hypot.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper hypotl(x,y) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__hypotl, hypotl) diff --git a/math/w_j0.c b/math/w_j0.c new file mode 100644 index 0000000000..5a018760bb --- /dev/null +++ b/math/w_j0.c @@ -0,0 +1,76 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper j0(double x), y0(double x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double j0(double x) /* wrapper j0 */ +#else + double j0(x) /* wrapper j0 */ + double x; +#endif +{ +#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 +} +#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 +{ +#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 +} +#ifdef NO_LONG_DOUBLE +strong_alias (y0, y0l) +#endif diff --git a/math/w_j0f.c b/math/w_j0f.c new file mode 100644 index 0000000000..32e2eebb56 --- /dev/null +++ b/math/w_j0f.c @@ -0,0 +1,74 @@ +/* w_j0f.c -- float version of w_j0.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper j0f(float x), y0f(float x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float j0f(float x) /* wrapper j0f */ +#else + float j0f(x) /* wrapper j0f */ + float x; +#endif +{ +#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 +} + +#ifdef __STDC__ + float y0f(float x) /* wrapper y0f */ +#else + float y0f(x) /* wrapper y0f */ + float x; +#endif +{ +#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 +} diff --git a/math/w_j0l.c b/math/w_j0l.c new file mode 100644 index 0000000000..b74d9ddcff --- /dev/null +++ b/math/w_j0l.c @@ -0,0 +1,73 @@ +/* w_j0l.c -- long double version of w_j0.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper j0l(long double x), y0l(long double x) + */ + +#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 +{ +#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 +} + +#ifdef __STDC__ + long double y0l(long double x) /* wrapper y0l */ +#else + long double y0l(x) /* wrapper y0 */ + long double x; +#endif +{ +#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 +} diff --git a/math/w_j1.c b/math/w_j1.c new file mode 100644 index 0000000000..39fe8543b1 --- /dev/null +++ b/math/w_j1.c @@ -0,0 +1,77 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper of j1,y1 + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double j1(double x) /* wrapper j1 */ +#else + double j1(x) /* wrapper j1 */ + double x; +#endif +{ +#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 +} +#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 +{ +#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 +} +#ifdef NO_LONG_DOUBLE +strong_alias (y1, y1l) +#endif diff --git a/math/w_j1f.c b/math/w_j1f.c new file mode 100644 index 0000000000..2a7c8db819 --- /dev/null +++ b/math/w_j1f.c @@ -0,0 +1,75 @@ +/* w_j1f.c -- float version of w_j1.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper of j1f,y1f + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float j1f(float x) /* wrapper j1f */ +#else + float j1f(x) /* wrapper j1f */ + float x; +#endif +{ +#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 +} + +#ifdef __STDC__ + float y1f(float x) /* wrapper y1f */ +#else + float y1f(x) /* wrapper y1f */ + float x; +#endif +{ +#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 +} diff --git a/math/w_j1l.c b/math/w_j1l.c new file mode 100644 index 0000000000..49a486cf8e --- /dev/null +++ b/math/w_j1l.c @@ -0,0 +1,74 @@ +/* w_j1l.c -- long double version of w_j1.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper of j1l,y1l + */ + +#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 +{ +#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 +} + +#ifdef __STDC__ + long double y1l(long double x) /* wrapper y1l */ +#else + long double y1l(x) /* wrapper y1l */ + long double x; +#endif +{ +#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 +} diff --git a/math/w_jn.c b/math/w_jn.c new file mode 100644 index 0000000000..85fc383fb7 --- /dev/null +++ b/math/w_jn.c @@ -0,0 +1,99 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * 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 nx, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double jn(int n, double x) /* wrapper jn */ +#else + double jn(n,x) /* wrapper jn */ + double x; int n; +#endif +{ +#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 +} +#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 +{ +#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 +} +#ifdef NO_LONG_DOUBLE +strong_alias (yn, ynl) +#endif diff --git a/math/w_jnf.c b/math/w_jnf.c new file mode 100644 index 0000000000..63ad335573 --- /dev/null +++ b/math/w_jnf.c @@ -0,0 +1,71 @@ +/* w_jnf.c -- float version of w_jn.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +#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 +{ +#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 +} + +#ifdef __STDC__ + float ynf(int n, float x) /* wrapper ynf */ +#else + float ynf(n,x) /* wrapper ynf */ + float x; int n; +#endif +{ +#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 +} diff --git a/math/w_jnl.c b/math/w_jnl.c new file mode 100644 index 0000000000..866e3cdb00 --- /dev/null +++ b/math/w_jnl.c @@ -0,0 +1,96 @@ +/* w_jnl.c -- long double version of w_jn.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * 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 nx, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double jnl(int n, long double x) /* wrapper jnl */ +#else + long double jnl(n,x) /* wrapper jnl */ + long double x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_jnl(n,x); +#else + long double z; + z = __ieee754_jnl(n,x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(fabsl(x)>X_TLOSS) { + return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ + } else + return z; +#endif +} + +#ifdef __STDC__ + long double ynl(int n, long double x) /* wrapper ynl */ +#else + long double ynl(n,x) /* wrapper ynl */ + long double x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_ynl(n,x); +#else + long double z; + z = __ieee754_ynl(n,x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard((double)n,x,212); + else + /* d = zero/(x-x); */ + return __kernel_standard((double)n,x,213); + } + if(x>X_TLOSS) { + return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */ + } else + return z; +#endif +} diff --git a/math/w_lgamma.c b/math/w_lgamma.c new file mode 100644 index 0000000000..0cc62a1784 --- /dev/null +++ b/math/w_lgamma.c @@ -0,0 +1,60 @@ +/* @(#)w_lgamma.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. + * ==================================================== + */ + +#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. + * + * Method: call __ieee754_lgamma_r + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __lgamma(double x) +#else + double __lgamma(x) + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgamma_r(x,&signgam); +#else + double y; + int local_signgam; + y = __ieee754_lgamma_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x 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 +} +weak_alias (__lgamma, lgamma) +strong_alias (__lgamma, __gamma) +weak_alias (__gamma, gamma) +#ifdef NO_LONG_DOUBLE +strong_alias (__lgamma, __lgammal) +weak_alias (__lgamma, lgammal) +strong_alias (__gamma, __gammal) +weak_alias (__gamma, gammal) +#endif diff --git a/math/w_lgamma_r.c b/math/w_lgamma_r.c new file mode 100644 index 0000000000..f3e7d821e2 --- /dev/null +++ b/math/w_lgamma_r.c @@ -0,0 +1,51 @@ +/* @(#)wr_lgamma.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. + * ==================================================== + */ + +#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) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__lgamma_r, lgamma_r) +#ifdef NO_LONG_DOUBLE +strong_alias (__lgamma_r, __lgammal_r) +weak_alias (__lgamma_r, lgammal_r) +#endif diff --git a/math/w_lgammaf.c b/math/w_lgammaf.c new file mode 100644 index 0000000000..4c64aa4130 --- /dev/null +++ b/math/w_lgammaf.c @@ -0,0 +1,53 @@ +/* w_lgammaf.c -- float version of w_lgamma.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammaf_r(x,&signgam); +#else + float y; + int local_signgam; + y = __ieee754_lgammaf_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x 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 +} +weak_alias (__lgammaf, lgammaf) +strong_alias (__lgammaf, __gammaf) +weak_alias (__gammaf, gammaf) diff --git a/math/w_lgammaf_r.c b/math/w_lgammaf_r.c new file mode 100644 index 0000000000..66962acc7e --- /dev/null +++ b/math/w_lgammaf_r.c @@ -0,0 +1,52 @@ +/* w_lgammaf_r.c -- float version of w_lgamma_r.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__lgammaf_r, lgammaf_r) diff --git a/math/w_lgammal.c b/math/w_lgammal.c new file mode 100644 index 0000000000..41104e47e4 --- /dev/null +++ b/math/w_lgammal.c @@ -0,0 +1,58 @@ +/* w_lgammal.c -- long double version of w_lgamma.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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. + * + * Method: call __ieee754_lgammal_r + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __lgammal(long double x) +#else + long double __lgammal(x) + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammal_r(x,&signgam); +#else + long double y; + int local_signgam; + y = __ieee754_lgammal_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x 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 +} +weak_alias (__lgammal, lgammal) +strong_alias (__lgammal, __gammal) +weak_alias (__gammal, gammal) diff --git a/math/w_lgammal_r.c b/math/w_lgammal_r.c new file mode 100644 index 0000000000..71f5c005d0 --- /dev/null +++ b/math/w_lgammal_r.c @@ -0,0 +1,52 @@ +/* w_lgammal_r.c -- long double version of w_lgamma_r.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper long double lgammal_r(long double x, int *signgamp) + */ + +#include "math.h" +#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 +{ +#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 +} +weak_alias (__lgammal_r, lgammal_r) diff --git a/math/w_log.c b/math/w_log.c new file mode 100644 index 0000000000..5f0af79731 --- /dev/null +++ b/math/w_log.c @@ -0,0 +1,48 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper log(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __log(double x) /* wrapper log */ +#else + double __log(x) /* wrapper log */ + double x; +#endif +{ +#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 +} +weak_alias (__log, log) +#ifdef NO_LONG_DOUBLE +strong_alias (__log, __logl) +weak_alias (__log, logl) +#endif diff --git a/math/w_log10.c b/math/w_log10.c new file mode 100644 index 0000000000..8a0a70bdf7 --- /dev/null +++ b/math/w_log10.c @@ -0,0 +1,51 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper log10(X) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __log10(double x) /* wrapper log10 */ +#else + double __log10(x) /* wrapper log10 */ + double x; +#endif +{ +#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 +} +weak_alias (__log10, log10) +#ifdef NO_LONG_DOUBLE +strong_alias (__log10, __log10l) +weak_alias (__log10, log10l) +#endif diff --git a/math/w_log10f.c b/math/w_log10f.c new file mode 100644 index 0000000000..f90cb0cabc --- /dev/null +++ b/math/w_log10f.c @@ -0,0 +1,52 @@ +/* w_log10f.c -- float version of w_log10.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper log10f(X) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __log10f(float x) /* wrapper log10f */ +#else + float __log10f(x) /* wrapper log10f */ + float x; +#endif +{ +#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 +} +weak_alias (__log10f, log10f) diff --git a/math/w_log10l.c b/math/w_log10l.c new file mode 100644 index 0000000000..0d0861689d --- /dev/null +++ b/math/w_log10l.c @@ -0,0 +1,51 @@ +/* w_log10l.c -- long double version of w_log10.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper log10l(X) + */ + +#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 +{ +#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 +} +weak_alias (__log10l, log10l) diff --git a/math/w_logf.c b/math/w_logf.c new file mode 100644 index 0000000000..9eabe4b34c --- /dev/null +++ b/math/w_logf.c @@ -0,0 +1,49 @@ +/* w_logf.c -- float version of w_log.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper logf(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __logf(float x) /* wrapper logf */ +#else + float __logf(x) /* wrapper logf */ + float x; +#endif +{ +#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 +} +weak_alias (__logf, logf) diff --git a/math/w_logl.c b/math/w_logl.c new file mode 100644 index 0000000000..bb979c26c3 --- /dev/null +++ b/math/w_logl.c @@ -0,0 +1,48 @@ +/* w_logl.c -- long double version of w_log.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper logl(x) + */ + +#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 +{ +#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 +} +weak_alias (__logl, logl) diff --git a/math/w_pow.c b/math/w_pow.c new file mode 100644 index 0000000000..5850651a1a --- /dev/null +++ b/math/w_pow.c @@ -0,0 +1,70 @@ + + +/* @(#)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. + * ==================================================== + */ + +/* + * wrapper pow(x,y) return x**y + */ + +#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 +{ +#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) */ + else + return __kernel_standard(x,y,43); /* pow(+0.0,negative) */ + } + 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 */ + } + } + if(z==0.0&&__finite(x)&&__finite(y)) + return __kernel_standard(x,y,22); /* pow underflow */ + return z; +#endif +} +weak_alias (__pow, pow) +#ifdef NO_LONG_DOUBLE +strong_alias (__pow, __powl) +weak_alias (__pow, powl) +#endif diff --git a/math/w_powf.c b/math/w_powf.c new file mode 100644 index 0000000000..32196fd89f --- /dev/null +++ b/math/w_powf.c @@ -0,0 +1,77 @@ +/* w_powf.c -- float version of w_pow.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper powf(x,y) return x**y + */ + +#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 +{ +#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); + else + return (float)__kernel_standard((double)x,(double)y,143); + } + 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); + } + } + if(z==(float)0.0&&__finitef(x)&&__finitef(y)) + /* powf underflow */ + return (float)__kernel_standard((double)x,(double)y,122); + return z; +#endif +} +weak_alias (__powf, powf) diff --git a/math/w_powl.c b/math/w_powl.c new file mode 100644 index 0000000000..17feb9fc61 --- /dev/null +++ b/math/w_powl.c @@ -0,0 +1,68 @@ +/* w_powl.c -- long double version of w_pow.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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 powl(x,y) return x**y + */ + +#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 +{ +#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) */ + else + return __kernel_standard(x,y,243); /* pow(+0.0,negative) */ + } + 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 */ + } + } + if(z==0.0&&__finitel(x)&&__finitel(y)) + return __kernel_standard(x,y,222); /* pow underflow */ + return z; +#endif +} +weak_alias (__powl, powl) diff --git a/math/w_remainder.c b/math/w_remainder.c new file mode 100644 index 0000000000..d85a3febce --- /dev/null +++ b/math/w_remainder.c @@ -0,0 +1,47 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper remainder(x,p) + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_remainder(x,y); +#else + double z; + z = __ieee754_remainder(x,y); + if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z; + if(y==0.0) + return __kernel_standard(x,y,28); /* remainder(x,0) */ + else + return z; +#endif +} +weak_alias (__remainder, remainder) +#ifdef NO_LONG_DOUBLE +strong_alias (__remainder, __remainderl) +weak_alias (__remainder, remainderl) +#endif diff --git a/math/w_remainderf.c b/math/w_remainderf.c new file mode 100644 index 0000000000..58255f5be5 --- /dev/null +++ b/math/w_remainderf.c @@ -0,0 +1,47 @@ +/* w_remainderf.c -- float version of w_remainder.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper remainderf(x,p) + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_remainderf(x,y); +#else + float z; + z = __ieee754_remainderf(x,y); + if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z; + if(y==(float)0.0) + /* remainder(x,0) */ + return (float)__kernel_standard((double)x,(double)y,128); + else + return z; +#endif +} +weak_alias (__remainderf, remainderf) diff --git a/math/w_remainderl.c b/math/w_remainderl.c new file mode 100644 index 0000000000..284140174d --- /dev/null +++ b/math/w_remainderl.c @@ -0,0 +1,48 @@ +/* w_remainderl.c -- long double version of w_remainder.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper remainderl(x,p) + */ + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_remainderl(x,y); +#else + long double z; + z = __ieee754_remainderl(x,y); + if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z; + if(y==0.0) + return __kernel_standard(x,y,228); /* remainder(x,0) */ + else + return z; +#endif +} +weak_alias (__remainderl, remainderl) diff --git a/math/w_scalb.c b/math/w_scalb.c new file mode 100644 index 0000000000..e5c407a435 --- /dev/null +++ b/math/w_scalb.c @@ -0,0 +1,65 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper scalb(double x, double fn) is provide for + * passing various standard test suite. One + * should use scalbn() instead. + */ + +#include "math.h" +#include "math_private.h" + +#include + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_scalb(x,fn); +#else + double z; + z = __ieee754_scalb(x,fn); + if(_LIB_VERSION == _IEEE_) 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 +} +weak_alias (__scalb, scalb) +#ifdef NO_LONG_DOUBLE +strong_alias (__scalb, __scalbl) +weak_alias (__scalb, scalbl) +#endif diff --git a/math/w_scalbf.c b/math/w_scalbf.c new file mode 100644 index 0000000000..488a717503 --- /dev/null +++ b/math/w_scalbf.c @@ -0,0 +1,66 @@ +/* w_scalbf.c -- float version of w_scalb.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper scalbf(float x, float fn) is provide for + * passing various standard test suite. One + * should use scalbn() instead. + */ + +#include "math.h" +#include "math_private.h" + +#include + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_scalbf(x,fn); +#else + float z; + z = __ieee754_scalbf(x,fn); + if(_LIB_VERSION == _IEEE_) 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 +} +weak_alias (__scalbf, scalbf) diff --git a/math/w_scalbl.c b/math/w_scalbl.c new file mode 100644 index 0000000000..3ca8d9601d --- /dev/null +++ b/math/w_scalbl.c @@ -0,0 +1,65 @@ +/* w_scalbl.c -- long double version of w_scalb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper scalbl(long double x, long double fn) is provide for + * passing various standard test suite. One + * should use scalbnl() instead. + */ + +#include "math.h" +#include "math_private.h" + +#include + +#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 +{ +#ifdef _IEEE_LIBM + return __ieee754_scalbl(x,fn); +#else + long double z; + z = __ieee754_scalbl(x,fn); + if(_LIB_VERSION == _IEEE_) 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 +} +weak_alias (__scalbl, scalbl) diff --git a/math/w_sinh.c b/math/w_sinh.c new file mode 100644 index 0000000000..9b34cd1873 --- /dev/null +++ b/math/w_sinh.c @@ -0,0 +1,47 @@ +/* @(#)w_sinh.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. + * ==================================================== + */ + +#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) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __sinh(double x) /* wrapper sinh */ +#else + double __sinh(x) /* wrapper sinh */ + double x; +#endif +{ +#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 +} +weak_alias (__sinh, sinh) +#ifdef NO_LONG_DOUBLE +strong_alias (__sinh, __sinhl) +weak_alias (__sinh, sinhl) +#endif diff --git a/math/w_sinhf.c b/math/w_sinhf.c new file mode 100644 index 0000000000..a69cf3072d --- /dev/null +++ b/math/w_sinhf.c @@ -0,0 +1,47 @@ +/* w_sinhf.c -- float version of w_sinh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 +{ +#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 +} +weak_alias (__sinhf, sinhf) diff --git a/math/w_sinhl.c b/math/w_sinhl.c new file mode 100644 index 0000000000..3e93cc598d --- /dev/null +++ b/math/w_sinhl.c @@ -0,0 +1,47 @@ +/* w_sinhl.c -- long double version of w_sinh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper sinhl(x) + */ + +#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 +{ +#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 +} +weak_alias (__sinhl, sinhl) diff --git a/math/w_sqrt.c b/math/w_sqrt.c new file mode 100644 index 0000000000..be15d959ea --- /dev/null +++ b/math/w_sqrt.c @@ -0,0 +1,47 @@ +/* @(#)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. + * ==================================================== + */ + +#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 + +/* + * wrapper sqrt(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __sqrt(double x) /* wrapper sqrt */ +#else + double __sqrt(x) /* wrapper sqrt */ + double x; +#endif +{ +#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 +} +weak_alias (__sqrt, sqrt) +#ifdef NO_LONG_DOUBLE +strong_alias (__sqrt, __sqrtl) +weak_alias (__sqrt, sqrtl) +#endif diff --git a/math/w_sqrtf.c b/math/w_sqrtf.c new file mode 100644 index 0000000000..f5ccc73868 --- /dev/null +++ b/math/w_sqrtf.c @@ -0,0 +1,47 @@ +/* w_sqrtf.c -- float version of w_sqrt.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +/* + * wrapper sqrtf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __sqrtf(float x) /* wrapper sqrtf */ +#else + float sqrt(x) /* wrapper sqrtf */ + float x; +#endif +{ +#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 +} +weak_alias (__sqrtf, sqrtf) diff --git a/math/w_sqrtl.c b/math/w_sqrtl.c new file mode 100644 index 0000000000..5873ce93ab --- /dev/null +++ b/math/w_sqrtl.c @@ -0,0 +1,47 @@ +/* w_sqrtl.c -- long double version of w_sqrt.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper sqrtl(x) + */ + +#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 +{ +#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 +} +weak_alias (__sqrtl, sqrtl) diff --git a/math/w_tgamma.c b/math/w_tgamma.c new file mode 100644 index 0000000000..2adbc2e14d --- /dev/null +++ b/math/w_tgamma.c @@ -0,0 +1,54 @@ +/* @(#)w_gamma.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. + * ==================================================== + */ + +#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. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __tgamma(double x) +#else + double __tgamma(x) + double x; +#endif +{ + double y; + int local_signgam; + y = __ieee754_gamma_r(x,&local_signgam); + if (local_signgam < 0) y = -y; +#ifdef _IEEE_LIBM + return y; +#else + if(_LIB_VERSION == _IEEE_) return y; + + if(!__finite(y)&&__finite(x)) { + if(__floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,41); /* tgamma pole */ + else + return __kernel_standard(x,x,40); /* tgamma overflow */ + } + return y; +#endif +} +weak_alias (__tgamma, tgamma) +#ifdef NO_LONG_DOUBLE +strong_alias (__tgamma, __tgammal) +weak_alias (__tgamma, tgammal) +#endif diff --git a/math/w_tgammaf.c b/math/w_tgammaf.c new file mode 100644 index 0000000000..152f4be156 --- /dev/null +++ b/math/w_tgammaf.c @@ -0,0 +1,50 @@ +/* w_gammaf.c -- float version of w_gamma.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 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; + + if(!__finitef(y)&&__finitef(x)) { + if(__floorf(x)==x&&x<=(float)0.0) + /* tgammaf pole */ + return (float)__kernel_standard((double)x,(double)x,141); + else + /* tgammaf overflow */ + return (float)__kernel_standard((double)x,(double)x,140); + } + return y; +#endif +} +weak_alias (__tgammaf, tgammaf) diff --git a/math/w_tgammal.c b/math/w_tgammal.c new file mode 100644 index 0000000000..9efce2bb95 --- /dev/null +++ b/math/w_tgammal.c @@ -0,0 +1,53 @@ +/* w_gammal.c -- long double version of w_gamma.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* long double gammal(double x) + * Return the Gamma function of x. + */ + +#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 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; + + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) + return __kernel_standard(x,x,241); /* tgamma pole */ + else + return __kernel_standard(x,x,240); /* tgamma overflow */ + } + return y; +#endif +} +weak_alias (__tgammal, tgammal) diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index 1b550abe4f..0a2efb7891 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -439,9 +439,28 @@ __printf_fp (FILE *fp, { if (scalesize == 0) { - tmpsize = powers->arraysize; - memcpy (tmp, &__tens[powers->arrayoff], - tmpsize * sizeof (mp_limb_t)); +#ifndef __NO_LONG_DOUBLE_MATH + if (LDBL_MANT_DIG > _FPIO_CONST_OFFSET * BITS_PER_MP_LIMB + && info->is_long_double) + { +#define _FPIO_CONST_SHIFT \ + (((LDBL_MANT_DIG + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB) \ + - _FPIO_CONST_OFFSET) + /* 64bit const offset is not enough for + IEEE quad long double. */ + tmpsize = powers->arraysize + _FPIO_CONST_SHIFT; + memcpy (tmp + _FPIO_CONST_SHIFT, + &__tens[powers->arrayoff], + tmpsize * sizeof (mp_limb_t)); + MPN_ZERO (tmp, _FPIO_CONST_SHIFT); + } + else +#endif + { + tmpsize = powers->arraysize; + memcpy (tmp, &__tens[powers->arrayoff], + tmpsize * sizeof (mp_limb_t)); + } } else { diff --git a/sysdeps/alpha/Implies b/sysdeps/alpha/Implies index 37fee79d97..2c6af5b7bb 100644 --- a/sysdeps/alpha/Implies +++ b/sysdeps/alpha/Implies @@ -1,3 +1,4 @@ wordsize-64 -# Alpha uses IEEE 754 floating point. -ieee754 +# Alpha uses IEEE 754 single and double precision floating point. +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/arm/Implies b/sysdeps/arm/Implies index d6acf04a82..780c4e2467 100644 --- a/sysdeps/arm/Implies +++ b/sysdeps/arm/Implies @@ -1,2 +1,3 @@ wordsize-32 -ieee754 +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/generic/e_atanhl.c b/sysdeps/generic/e_atanhl.c new file mode 100644 index 0000000000..625d42db31 --- /dev/null +++ b/sysdeps/generic/e_atanhl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_atanhl (long double x) +{ + fputs ("__ieee754_atanhl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_atanhl) +#include diff --git a/sysdeps/generic/e_coshl.c b/sysdeps/generic/e_coshl.c new file mode 100644 index 0000000000..0da319b785 --- /dev/null +++ b/sysdeps/generic/e_coshl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_coshl (long double x) +{ + fputs ("__ieee754_coshl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_coshl) +#include diff --git a/sysdeps/generic/e_exp10.c b/sysdeps/generic/e_exp10.c new file mode 100644 index 0000000000..55d676ec09 --- /dev/null +++ b/sysdeps/generic/e_exp10.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "math_private.h" + + +double +__ieee754_exp10 (double arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_exp (M_LN10 * arg); +} diff --git a/sysdeps/generic/e_exp10f.c b/sysdeps/generic/e_exp10f.c new file mode 100644 index 0000000000..d6cc9dc03d --- /dev/null +++ b/sysdeps/generic/e_exp10f.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "math_private.h" + + +float +__ieee754_exp10f (float arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expf (M_LN10 * arg); +} diff --git a/sysdeps/generic/e_exp10l.c b/sysdeps/generic/e_exp10l.c new file mode 100644 index 0000000000..cf8658b747 --- /dev/null +++ b/sysdeps/generic/e_exp10l.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "math_private.h" + + +long double +__ieee754_exp10l (long double arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expl (M_LN10l * arg); +} diff --git a/sysdeps/generic/e_gammal_r.c b/sysdeps/generic/e_gammal_r.c new file mode 100644 index 0000000000..16b641bdd9 --- /dev/null +++ b/sysdeps/generic/e_gammal_r.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_gammal_r (long double x, int *signgamp) +{ + fputs ("__ieee754_gammal_r not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_gammal_r) +#include diff --git a/sysdeps/generic/e_hypotl.c b/sysdeps/generic/e_hypotl.c new file mode 100644 index 0000000000..07df22eb36 --- /dev/null +++ b/sysdeps/generic/e_hypotl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_hypotl (long double x, long double y) +{ + fputs ("__ieee754_hypotl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_hypotl) +#include diff --git a/sysdeps/generic/e_scalb.c b/sysdeps/generic/e_scalb.c new file mode 100644 index 0000000000..d9a326b2b2 --- /dev/null +++ b/sysdeps/generic/e_scalb.c @@ -0,0 +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. + * ==================================================== + */ + +#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 + +/* + * __ieee754_scalb(x, fn) is provide for + * passing various standard test suite. One + * should use scalbn() instead. + */ + +#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 +{ +#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)) + return __nan (""); + else return x/(-fn); + } + if (__rint(fn)!=fn) return __nan (""); + if ( fn > 65000.0) return __scalbn(x, 65000); + if (-fn > 65000.0) return __scalbn(x,-65000); + return __scalbn(x,(int)fn); +#endif +} diff --git a/sysdeps/generic/e_scalbf.c b/sysdeps/generic/e_scalbf.c new file mode 100644 index 0000000000..f51057e7b4 --- /dev/null +++ b/sysdeps/generic/e_scalbf.c @@ -0,0 +1,56 @@ +/* e_scalbf.c -- float version of e_scalb.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +#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 +{ +#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)) + return __nanf (""); + else return x/(-fn); + } + if (__rintf(fn)!=fn) 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 +} diff --git a/sysdeps/generic/e_scalbl.c b/sysdeps/generic/e_scalbl.c new file mode 100644 index 0000000000..dccc876c85 --- /dev/null +++ b/sysdeps/generic/e_scalbl.c @@ -0,0 +1,63 @@ +/* e_scalbl.c -- long double version of s_scalb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * __ieee754_scalbl(x, fn) is provide for + * passing various standard test suite. One + * should use scalbnl() instead. + */ + +#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 +{ +#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)) + return __nanl (""); + else return x/(-fn); + } + if (__rintl(fn)!=fn) return __nanl (""); + if ( fn > 65000.0) return __scalbnl(x, 65000); + if (-fn > 65000.0) return __scalbnl(x,-65000); + return __scalbnl(x,(int)fn); +#endif +} diff --git a/sysdeps/generic/e_sinhl.c b/sysdeps/generic/e_sinhl.c new file mode 100644 index 0000000000..4cec79cb2d --- /dev/null +++ b/sysdeps/generic/e_sinhl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_sinhl (long double x) +{ + fputs ("__ieee754_sinhl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_sinhl) +#include diff --git a/sysdeps/generic/ldbl2mpn.c b/sysdeps/generic/ldbl2mpn.c index e456d59e1d..450f9381cc 100644 --- a/sysdeps/generic/ldbl2mpn.c +++ b/sysdeps/generic/ldbl2mpn.c @@ -1,32 +1 @@ -/* Copyright (C) 1995, 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" - -/* Convert a `long double' to a multi-precision integer representing the - significand scaled up by the highest possible number of significant bits - of fraction (LDBL_MANT_DIG), and an integral power of two (MPN frexpl). */ - -mp_size_t -__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, - int *expt, int *is_neg, - double value) -{ -#error "not implemented for this floating point format" -} +/* Empty. Not needed unless ldbl support is in. */ diff --git a/sysdeps/generic/math_ldbl.h b/sysdeps/generic/math_ldbl.h new file mode 100644 index 0000000000..83684e61c4 --- /dev/null +++ b/sysdeps/generic/math_ldbl.h @@ -0,0 +1,5 @@ +#ifndef _MATH_PRIVATE_H +#error "Never use directly; include instead." +#endif + +/* This is empty. Any machine using long double type will override this header. */ diff --git a/sysdeps/generic/mpn2ldbl.c b/sysdeps/generic/mpn2ldbl.c index c269ce689b..450f9381cc 100644 --- a/sysdeps/generic/mpn2ldbl.c +++ b/sysdeps/generic/mpn2ldbl.c @@ -1,30 +1 @@ -/* Copyright (C) 1995, 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include - -/* Convert a multi-precision integer of the needed number of bits and an - integral power of two to a `long double'. */ - -long double -__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int negative) -{ -#error "__mpn_construct_long_double not implemented for floating point format" -} +/* Empty. Not needed unless ldbl support is in. */ diff --git a/sysdeps/generic/printf_fphex.c b/sysdeps/generic/printf_fphex.c index 9e9fd07dfc..53e3254286 100644 --- a/sysdeps/generic/printf_fphex.c +++ b/sysdeps/generic/printf_fphex.c @@ -106,8 +106,8 @@ __printf_fphex (FILE *fp, const char *special = NULL; /* Buffer for the generated number string for the mantissa. The - maximal size for the mantissa is 64 bits. */ - char numbuf[16]; + maximal size for the mantissa is 128 bits. */ + char numbuf[32]; char *numstr; char *numend; int negative; @@ -229,8 +229,6 @@ __printf_fphex (FILE *fp, return done; } - /* We are handling here only 64 and 80 bit IEEE foating point - numbers. */ if (info->is_long_double == 0 || sizeof (double) == sizeof (long double)) { /* We have 52 bits of mantissa plus one implicit digit. Since @@ -281,64 +279,10 @@ __printf_fphex (FILE *fp, exponent = -(exponent - IEEE754_DOUBLE_BIAS); } } +#ifdef PRINT_FPHEX_LONG_DOUBLE else - { - /* The "strange" 80 bit format on ix86 and m68k has an explicit - leading digit in the 64 bit mantissa. */ - unsigned long long int num; - - assert (sizeof (long double) == 12); - - num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 - | fpnum.ldbl.ieee.mantissa1); - - zero_mantissa = num == 0; - - if (sizeof (unsigned long int) > 6) - numstr = _itoa_word (num, numbuf + sizeof numbuf, 16, - info->spec == 'A'); - else - numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A'); - - /* Fill with zeroes. */ - while (numstr > numbuf + (sizeof numbuf - 64 / 4)) - *--numstr = '0'; - - /* We use a full nibble for the leading digit. */ - leading = *numstr++; - - /* We have 3 bits from the mantissa in the leading nibble. - Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ - exponent = fpnum.ldbl.ieee.exponent; - - if (exponent == 0) - { - if (zero_mantissa) - expnegative = 0; - else - { - /* This is a denormalized number. */ - expnegative = 1; - /* This is a hook for the m68k long double format, where the - exponent bias is the same for normalized and denormalized - numbers. */ -#ifndef LONG_DOUBLE_DENORM_BIAS -# define LONG_DOUBLE_DENORM_BIAS (IEEE854_LONG_DOUBLE_BIAS - 1) + PRINT_FPHEX_LONG_DOUBLE; #endif - exponent = LONG_DOUBLE_DENORM_BIAS + 3; - } - } - else if (exponent >= IEEE854_LONG_DOUBLE_BIAS + 3) - { - expnegative = 0; - exponent -= IEEE854_LONG_DOUBLE_BIAS + 3; - } - else - { - expnegative = 1; - exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3)); - } - } /* Look for trailing zeroes. */ if (! zero_mantissa) diff --git a/sysdeps/generic/s_asinhl.c b/sysdeps/generic/s_asinhl.c new file mode 100644 index 0000000000..1d5cf47a4f --- /dev/null +++ b/sysdeps/generic/s_asinhl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +long double +__asinhl(long double x) +{ + fputs ("__asinhl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +weak_alias (__asinhl, asinhl) +stub_warning (asinhl) +#include diff --git a/sysdeps/generic/s_cacos.c b/sysdeps/generic/s_cacos.c new file mode 100644 index 0000000000..9b007598f0 --- /dev/null +++ b/sysdeps/generic/s_cacos.c @@ -0,0 +1,41 @@ +/* Return cosine of complex double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +__complex__ double +__cacos (__complex__ double x) +{ + __complex__ double y; + __complex__ double res; + + y = __casin (x); + + __real__ res = (double) M_PI_2 - __real__ y; + __imag__ res = -__imag__ y; + + return res; +} +weak_alias (__cacos, cacos) +#ifdef NO_LONG_DOUBLE +strong_alias (__cacos, __cacosl) +weak_alias (__cacos, cacosl) +#endif diff --git a/sysdeps/generic/s_cacosf.c b/sysdeps/generic/s_cacosf.c new file mode 100644 index 0000000000..6fb132dc23 --- /dev/null +++ b/sysdeps/generic/s_cacosf.c @@ -0,0 +1,37 @@ +/* Return cosine of complex float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +__complex__ float +__cacosf (__complex__ float x) +{ + __complex__ float y; + __complex__ float res; + + y = __casinf (x); + + __real__ res = (float) M_PI_2 - __real__ y; + __imag__ res = -__imag__ y; + + return res; +} +weak_alias (__cacosf, cacosf) diff --git a/sysdeps/generic/s_cacosh.c b/sysdeps/generic/s_cacosh.c new file mode 100644 index 0000000000..d938c64473 --- /dev/null +++ b/sysdeps/generic/s_cacosh.c @@ -0,0 +1,88 @@ +/* Return arc hyperbole cosine for double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ double +__cacosh (__complex__ double x) +{ + __complex__ double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = HUGE_VAL; + + if (rcls == FP_NAN) + __imag__ res = __nan (""); + else + __imag__ res = __copysign ((rcls == FP_INFINITE + ? (__real__ x < 0.0 + ? M_PI - M_PI_4 : M_PI_4) + : M_PI_2), __imag__ x); + } + else if (rcls == FP_INFINITE) + { + __real__ res = HUGE_VAL; + + if (icls >= FP_ZERO) + __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0, + __imag__ x); + else + __imag__ res = __nan (""); + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + __real__ res = 0.0; + __imag__ res = __copysign (M_PI_2, __imag__ x); + } + else + { + __complex__ double y; + + __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; + __imag__ y = 2.0 * __real__ x * __imag__ x; + + y = __csqrt (y); + + __real__ y += __real__ x; + __imag__ y += __imag__ x; + + res = __clog (y); + } + + return res; +} +weak_alias (__cacosh, cacosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__cacosh, __cacoshl) +weak_alias (__cacosh, cacoshl) +#endif diff --git a/sysdeps/generic/s_cacoshf.c b/sysdeps/generic/s_cacoshf.c new file mode 100644 index 0000000000..6aa33e5a48 --- /dev/null +++ b/sysdeps/generic/s_cacoshf.c @@ -0,0 +1,99 @@ +/* Return arc hyperbole cosine for float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + +__complex__ float +__cacoshf (__complex__ float x) +{ + __complex__ float res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = HUGE_VALF; + + if (rcls == FP_NAN) + __imag__ res = __nanf (""); + else + __imag__ res = __copysignf ((rcls == FP_INFINITE + ? (__real__ x < 0.0 + ? M_PI - M_PI_4 : M_PI_4) + : M_PI_2), __imag__ x); + } + else if (rcls == FP_INFINITE) + { + __real__ res = HUGE_VALF; + + if (icls >= FP_ZERO) + __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0, + __imag__ x); + else + __imag__ res = __nanf (""); + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + __real__ res = 0.0; + __imag__ res = __copysignf (M_PI_2, __imag__ x); + } + else + { +#if 1 + __complex__ float y; + + __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; + __imag__ y = 2.0 * __real__ x * __imag__ x; + + y = __csqrtf (y); + + __real__ y += __real__ x; + __imag__ y += __imag__ x; + + res = __clogf (y); +#else + float re2 = __real__ x * __real__ x; + float im2 = __imag__ x * __imag__ x; + float sq = re2 - im2 - 1.0; + float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2); + float a = __ieee754_sqrtf ((sq + ro) / 2.0); + float b = __ieee754_sqrtf ((-sq + ro) / 2.0); + + __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a + + im2 + __imag__ x * 2 * b + + ro); + __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a); +#endif + } + + return res; +} +weak_alias (__cacoshf, cacoshf) diff --git a/sysdeps/generic/s_cacoshl.c b/sysdeps/generic/s_cacoshl.c new file mode 100644 index 0000000000..1c91e93fab --- /dev/null +++ b/sysdeps/generic/s_cacoshl.c @@ -0,0 +1,84 @@ +/* Return arc hyperbole cosine for long double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ long double +__cacoshl (__complex__ long double x) +{ + __complex__ long double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = HUGE_VALL; + + if (rcls == FP_NAN) + __imag__ res = __nanl (""); + else + __imag__ res = __copysignl ((rcls == FP_INFINITE + ? (__real__ x < 0.0 + ? M_PIl - M_PI_4l : M_PI_4l) + : M_PI_2l), __imag__ x); + } + else if (rcls == FP_INFINITE) + { + __real__ res = HUGE_VALL; + + if (icls >= FP_ZERO) + __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0, + __imag__ x); + else + __imag__ res = __nanl (""); + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + __real__ res = 0.0; + __imag__ res = __copysignl (M_PI_2l, __imag__ x); + } + else + { + __complex__ long double y; + + __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; + __imag__ y = 2.0 * __real__ x * __imag__ x; + + y = __csqrtl (y); + + __real__ y += __real__ x; + __imag__ y += __imag__ x; + + res = __clogl (y); + } + + return res; +} +weak_alias (__cacoshl, cacoshl) diff --git a/sysdeps/generic/s_cacosl.c b/sysdeps/generic/s_cacosl.c new file mode 100644 index 0000000000..40ad812aa1 --- /dev/null +++ b/sysdeps/generic/s_cacosl.c @@ -0,0 +1,37 @@ +/* Return cosine of complex long double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +__complex__ long double +__cacosl (__complex__ long double x) +{ + __complex__ long double y; + __complex__ long double res; + + y = __casinl (x); + + __real__ res = M_PI_2l - __real__ y; + __imag__ res = -__imag__ y; + + return res; +} +weak_alias (__cacosl, cacosl) diff --git a/sysdeps/generic/s_casin.c b/sysdeps/generic/s_casin.c new file mode 100644 index 0000000000..516aea0464 --- /dev/null +++ b/sysdeps/generic/s_casin.c @@ -0,0 +1,66 @@ +/* Return arc sine of complex double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ double +__casin (__complex__ double x) +{ + __complex__ double res; + + if (isnan (__real__ x) || isnan (__imag__ x)) + { + if (__real__ x == 0.0) + { + res = x; + } + else if (__isinf (__real__ x) || __isinf (__imag__ x)) + { + __real__ res = __nan (""); + __imag__ res = __copysign (HUGE_VAL, __imag__ x); + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + } + } + else + { + __complex__ double y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + y = __casinh (y); + + __real__ res = __imag__ y; + __imag__ res = -__real__ y; + } + + return res; +} +weak_alias (__casin, casin) +#ifdef NO_LONG_DOUBLE +strong_alias (__casin, __casinl) +weak_alias (__casin, casinl) +#endif diff --git a/sysdeps/generic/s_casinf.c b/sysdeps/generic/s_casinf.c new file mode 100644 index 0000000000..aaf0d66c28 --- /dev/null +++ b/sysdeps/generic/s_casinf.c @@ -0,0 +1,62 @@ +/* Return arc sine of complex float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ float +__casinf (__complex__ float x) +{ + __complex__ float res; + + if (isnan (__real__ x) || isnan (__imag__ x)) + { + if (__real__ x == 0.0) + { + res = x; + } + else if (__isinff (__real__ x) || __isinff (__imag__ x)) + { + __real__ res = __nanf (""); + __imag__ res = __copysignf (HUGE_VALF, __imag__ x); + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + } + } + else + { + __complex__ float y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + y = __casinhf (y); + + __real__ res = __imag__ y; + __imag__ res = -__real__ y; + } + + return res; +} +weak_alias (__casinf, casinf) diff --git a/sysdeps/generic/s_casinh.c b/sysdeps/generic/s_casinh.c new file mode 100644 index 0000000000..da7d1ed429 --- /dev/null +++ b/sysdeps/generic/s_casinh.c @@ -0,0 +1,84 @@ +/* Return arc hyperbole sine for double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ double +__casinh (__complex__ double x) +{ + __complex__ double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = __copysign (HUGE_VAL, __real__ x); + + if (rcls == FP_NAN) + __imag__ res = __nan (""); + else + __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4, + __imag__ x); + } + else if (rcls <= FP_INFINITE) + { + __real__ res = __real__ x; + if ((rcls == FP_INFINITE && icls >= FP_ZERO) + || (rcls == FP_NAN && icls == FP_ZERO)) + __imag__ res = __copysign (0.0, __imag__ x); + else + __imag__ res = __nan (""); + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + __complex__ double y; + + __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; + __imag__ y = 2.0 * __real__ x * __imag__ x; + + y = __csqrt (y); + + __real__ y += __real__ x; + __imag__ y += __imag__ x; + + res = __clog (y); + } + + return res; +} +weak_alias (__casinh, casinh) +#ifdef NO_LONG_DOUBLE +strong_alias (__casinh, __casinhl) +weak_alias (__casinh, casinhl) +#endif diff --git a/sysdeps/generic/s_casinhf.c b/sysdeps/generic/s_casinhf.c new file mode 100644 index 0000000000..e8441f4fa0 --- /dev/null +++ b/sysdeps/generic/s_casinhf.c @@ -0,0 +1,80 @@ +/* Return arc hyperbole sine for float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ float +__casinhf (__complex__ float x) +{ + __complex__ float res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = __copysignf (HUGE_VALF, __real__ x); + + if (rcls == FP_NAN) + __imag__ res = __nanf (""); + else + __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4, + __imag__ x); + } + else if (rcls <= FP_INFINITE) + { + __real__ res = __real__ x; + if ((rcls == FP_INFINITE && icls >= FP_ZERO) + || (rcls == FP_NAN && icls == FP_ZERO)) + __imag__ res = __copysignf (0.0, __imag__ x); + else + __imag__ res = __nanf (""); + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + __complex__ float y; + + __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; + __imag__ y = 2.0 * __real__ x * __imag__ x; + + y = __csqrtf (y); + + __real__ y += __real__ x; + __imag__ y += __imag__ x; + + res = __clogf (y); + } + + return res; +} +weak_alias (__casinhf, casinhf) diff --git a/sysdeps/generic/s_casinhl.c b/sysdeps/generic/s_casinhl.c new file mode 100644 index 0000000000..44e07f773f --- /dev/null +++ b/sysdeps/generic/s_casinhl.c @@ -0,0 +1,80 @@ +/* Return arc hyperbole sine for long double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ long double +__casinhl (__complex__ long double x) +{ + __complex__ long double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = __copysignl (HUGE_VALL, __real__ x); + + if (rcls == FP_NAN) + __imag__ res = __nanl (""); + else + __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l, + __imag__ x); + } + else if (rcls <= FP_INFINITE) + { + __real__ res = __real__ x; + if ((rcls == FP_INFINITE && icls >= FP_ZERO) + || (rcls == FP_NAN && icls == FP_ZERO)) + __imag__ res = __copysignl (0.0, __imag__ x); + else + __imag__ res = __nanl (""); + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + __complex__ long double y; + + __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; + __imag__ y = 2.0 * __real__ x * __imag__ x; + + y = __csqrtl (y); + + __real__ y += __real__ x; + __imag__ y += __imag__ x; + + res = __clogl (y); + } + + return res; +} +weak_alias (__casinhl, casinhl) diff --git a/sysdeps/generic/s_casinl.c b/sysdeps/generic/s_casinl.c new file mode 100644 index 0000000000..cc750d4a11 --- /dev/null +++ b/sysdeps/generic/s_casinl.c @@ -0,0 +1,62 @@ +/* Return arc sine of complex long double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ long double +__casinl (__complex__ long double x) +{ + __complex__ long double res; + + if (isnan (__real__ x) || isnan (__imag__ x)) + { + if (__real__ x == 0.0) + { + res = x; + } + else if (__isinfl (__real__ x) || __isinfl (__imag__ x)) + { + __real__ res = __nanl (""); + __imag__ res = __copysignl (HUGE_VALL, __imag__ x); + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + } + } + else + { + __complex__ long double y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + y = __casinhl (y); + + __real__ res = __imag__ y; + __imag__ res = -__real__ y; + } + + return res; +} +weak_alias (__casinl, casinl) diff --git a/sysdeps/generic/s_catan.c b/sysdeps/generic/s_catan.c new file mode 100644 index 0000000000..a3fc9ad3e8 --- /dev/null +++ b/sysdeps/generic/s_catan.c @@ -0,0 +1,89 @@ +/* Return arc tangent of complex double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ double +__catan (__complex__ double x) +{ + __complex__ double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (rcls == FP_INFINITE) + { + __real__ res = __copysign (M_PI_2, __real__ x); + __imag__ res = __copysign (0.0, __imag__ x); + } + else if (icls == FP_INFINITE) + { + if (rcls >= FP_ZERO) + __real__ res = __copysign (M_PI_2, __real__ x); + else + __real__ res = __nan (""); + __imag__ res = __copysign (0.0, __imag__ x); + } + else if (icls == FP_ZERO || icls == FP_INFINITE) + { + __real__ res = __nan (""); + __imag__ res = __copysign (0.0, __imag__ x); + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + double r2, num, den; + + r2 = __real__ x * __real__ x; + + den = 1 - r2 - __imag__ x * __imag__ x; + + __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den); + + num = __imag__ x + 1.0; + num = r2 + num * num; + + den = __imag__ x - 1.0; + den = r2 + den * den; + + __imag__ res = 0.25 * __ieee754_log (num / den); + } + + return res; +} +weak_alias (__catan, catan) +#ifdef NO_LONG_DOUBLE +strong_alias (__catan, __catanl) +weak_alias (__catan, catanl) +#endif diff --git a/sysdeps/generic/s_catanf.c b/sysdeps/generic/s_catanf.c new file mode 100644 index 0000000000..18881cd6c9 --- /dev/null +++ b/sysdeps/generic/s_catanf.c @@ -0,0 +1,85 @@ +/* Return arc tangent of complex float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ float +__catanf (__complex__ float x) +{ + __complex__ float res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (rcls == FP_INFINITE) + { + __real__ res = __copysignf (M_PI_2, __real__ x); + __imag__ res = __copysignf (0.0, __imag__ x); + } + else if (icls == FP_INFINITE) + { + if (rcls >= FP_ZERO) + __real__ res = __copysignf (M_PI_2, __real__ x); + else + __real__ res = __nanf (""); + __imag__ res = __copysignf (0.0, __imag__ x); + } + else if (icls == FP_ZERO || icls == FP_INFINITE) + { + __real__ res = __nanf (""); + __imag__ res = __copysignf (0.0, __imag__ x); + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + float r2, num, den; + + r2 = __real__ x * __real__ x; + + den = 1 - r2 - __imag__ x * __imag__ x; + + __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den); + + num = __imag__ x + 1.0; + num = r2 + num * num; + + den = __imag__ x - 1.0; + den = r2 + den * den; + + __imag__ res = 0.25 * __ieee754_logf (num / den); + } + + return res; +} +weak_alias (__catanf, catanf) diff --git a/sysdeps/generic/s_catanh.c b/sysdeps/generic/s_catanh.c new file mode 100644 index 0000000000..0cb852a069 --- /dev/null +++ b/sysdeps/generic/s_catanh.c @@ -0,0 +1,84 @@ +/* Return arc hyperbole tangent for double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ double +__catanh (__complex__ double x) +{ + __complex__ double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = __copysign (0.0, __real__ x); + __imag__ res = __copysign (M_PI_2, __imag__ x); + } + else if (rcls == FP_INFINITE || rcls == FP_ZERO) + { + __real__ res = __copysign (0.0, __real__ x); + if (icls >= FP_ZERO) + __imag__ res = __copysign (M_PI_2, __imag__ x); + else + __imag__ res = __nan (""); + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + double i2, num, den; + + i2 = __imag__ x * __imag__ x; + + num = 1.0 + __real__ x; + num = i2 + num * num; + + den = 1.0 - __real__ x; + den = i2 + den * den; + + __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den)); + + den = 1 - __real__ x * __real__ x - i2; + + __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den); + } + + return res; +} +weak_alias (__catanh, catanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__catanh, __catanhl) +weak_alias (__catanh, catanhl) +#endif diff --git a/sysdeps/generic/s_catanhf.c b/sysdeps/generic/s_catanhf.c new file mode 100644 index 0000000000..ac0ed17edb --- /dev/null +++ b/sysdeps/generic/s_catanhf.c @@ -0,0 +1,80 @@ +/* Return arc hyperbole tangent for float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ float +__catanhf (__complex__ float x) +{ + __complex__ float res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = __copysignf (0.0, __real__ x); + __imag__ res = __copysignf (M_PI_2, __imag__ x); + } + else if (rcls == FP_INFINITE || rcls == FP_ZERO) + { + __real__ res = __copysignf (0.0, __real__ x); + if (icls >= FP_ZERO) + __imag__ res = __copysignf (M_PI_2, __imag__ x); + else + __imag__ res = __nanf (""); + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + float i2, num, den; + + i2 = __imag__ x * __imag__ x; + + num = 1.0 + __real__ x; + num = i2 + num * num; + + den = 1.0 - __real__ x; + den = i2 + den * den; + + __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den)); + + den = 1 - __real__ x * __real__ x - i2; + + __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den); + } + + return res; +} +weak_alias (__catanhf, catanhf) diff --git a/sysdeps/generic/s_catanhl.c b/sysdeps/generic/s_catanhl.c new file mode 100644 index 0000000000..22f3d4b646 --- /dev/null +++ b/sysdeps/generic/s_catanhl.c @@ -0,0 +1,80 @@ +/* Return arc hyperbole tangent for long double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ long double +__catanhl (__complex__ long double x) +{ + __complex__ long double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = __copysignl (0.0, __real__ x); + __imag__ res = __copysignl (M_PI_2l, __imag__ x); + } + else if (rcls == FP_INFINITE || rcls == FP_ZERO) + { + __real__ res = __copysignl (0.0, __real__ x); + if (icls >= FP_ZERO) + __imag__ res = __copysignl (M_PI_2l, __imag__ x); + else + __imag__ res = __nanl (""); + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + long double i2, num, den; + + i2 = __imag__ x * __imag__ x; + + num = 1.0 + __real__ x; + num = i2 + num * num; + + den = 1.0 - __real__ x; + den = i2 + den * den; + + __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den)); + + den = 1 - __real__ x * __real__ x - i2; + + __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den); + } + + return res; +} +weak_alias (__catanhl, catanhl) diff --git a/sysdeps/generic/s_catanl.c b/sysdeps/generic/s_catanl.c new file mode 100644 index 0000000000..b7df5c39c2 --- /dev/null +++ b/sysdeps/generic/s_catanl.c @@ -0,0 +1,85 @@ +/* Return arc tangent of complex long double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ long double +__catanl (__complex__ long double x) +{ + __complex__ long double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (rcls == FP_INFINITE) + { + __real__ res = __copysignl (M_PI_2l, __real__ x); + __imag__ res = __copysignl (0.0, __imag__ x); + } + else if (icls == FP_INFINITE) + { + if (rcls >= FP_ZERO) + __real__ res = __copysignl (M_PI_2l, __real__ x); + else + __real__ res = __nanl (""); + __imag__ res = __copysignl (0.0, __imag__ x); + } + else if (icls == FP_ZERO || icls == FP_INFINITE) + { + __real__ res = __nanl (""); + __imag__ res = __copysignl (0.0, __imag__ x); + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + long double r2, num, den; + + r2 = __real__ x * __real__ x; + + den = 1 - r2 - __imag__ x * __imag__ x; + + __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den); + + num = __imag__ x + 1.0; + num = r2 + num * num; + + den = __imag__ x - 1.0; + den = r2 + den * den; + + __imag__ res = 0.25 * __ieee754_logl (num / den); + } + + return res; +} +weak_alias (__catanl, catanl) diff --git a/sysdeps/generic/s_cbrtl.c b/sysdeps/generic/s_cbrtl.c new file mode 100644 index 0000000000..d668e377af --- /dev/null +++ b/sysdeps/generic/s_cbrtl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +long double +__cbrtl(long double x) +{ + fputs ("__cbrtl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +weak_alias (__cbrtl, cbrtl) +stub_warning (cbrtl) +#include diff --git a/sysdeps/generic/s_ccos.c b/sysdeps/generic/s_ccos.c new file mode 100644 index 0000000000..f8dfcc8af6 --- /dev/null +++ b/sysdeps/generic/s_ccos.c @@ -0,0 +1,80 @@ +/* Return cosine of complex double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + + +__complex__ double +__ccos (__complex__ double x) +{ + __complex__ double res; + + if (!isfinite (__real__ x) || __isnan (__imag__ x)) + { + if (__real__ x == 0.0 || __imag__ x == 0.0) + { + __real__ res = __nan (""); + __imag__ res = 0.0; + +#ifdef FE_INVALID + if (__isinf (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + else if (__isinf (__imag__ x)) + { + __real__ res = HUGE_VAL; + __imag__ res = __nan (""); + +#ifdef FE_INVALID + if (__isinf (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + +#ifdef FE_INVALID + if (isfinite (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __complex__ double y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + res = __ccosh (y); + } + + return res; +} +weak_alias (__ccos, ccos) +#ifdef NO_LONG_DOUBLE +strong_alias (__ccos, __ccosl) +weak_alias (__ccos, ccosl) +#endif diff --git a/sysdeps/generic/s_ccosf.c b/sysdeps/generic/s_ccosf.c new file mode 100644 index 0000000000..b090ae5747 --- /dev/null +++ b/sysdeps/generic/s_ccosf.c @@ -0,0 +1,76 @@ +/* Return cosine of complex float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + + +__complex__ float +__ccosf (__complex__ float x) +{ + __complex__ float res; + + if (!isfinite (__real__ x) || __isnanf (__imag__ x)) + { + if (__real__ x == 0.0 || __imag__ x == 0.0) + { + __real__ res = __nanf (""); + __imag__ res = 0.0; + +#ifdef FE_INVALID + if (__isinff (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + else if (__isinff (__imag__ x)) + { + __real__ res = HUGE_VALF; + __imag__ res = __nanf (""); + +#ifdef FE_INVALID + if (__isinff (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + +#ifdef FE_INVALID + if (isfinite (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __complex__ float y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + res = __ccoshf (y); + } + + return res; +} +weak_alias (__ccosf, ccosf) diff --git a/sysdeps/generic/s_ccosh.c b/sysdeps/generic/s_ccosh.c new file mode 100644 index 0000000000..394101f23a --- /dev/null +++ b/sysdeps/generic/s_ccosh.c @@ -0,0 +1,105 @@ +/* Complex cosine hyperbole function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ double +__ccosh (__complex__ double x) +{ + __complex__ double retval; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + double sinh_val = __ieee754_sinh (__real__ x); + double cosh_val = __ieee754_cosh (__real__ x); + double sinix, cosix; + + __sincos (__imag__ x, &sinix, &cosix); + + __real__ retval = cosh_val * cosix; + __imag__ retval = sinh_val * sinix; + } + else + { + __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); + __real__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = HUGE_VAL; + __imag__ retval = __imag__ x * __copysign (1.0, __real__ x); + } + else if (icls > FP_ZERO) + { + /* Imaginary part is finite. */ + double sinix, cosix; + + __sincos (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysign (HUGE_VAL, cosix); + __imag__ retval = (__copysign (HUGE_VAL, sinix) + * __copysign (1.0, __real__ x)); + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = HUGE_VAL; + __imag__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = __nan (""); + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan (""); + } + + return retval; +} +weak_alias (__ccosh, ccosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__ccosh, __ccoshl) +weak_alias (__ccosh, ccoshl) +#endif diff --git a/sysdeps/generic/s_ccoshf.c b/sysdeps/generic/s_ccoshf.c new file mode 100644 index 0000000000..a8043fdd39 --- /dev/null +++ b/sysdeps/generic/s_ccoshf.c @@ -0,0 +1,101 @@ +/* Complex cosine hyperbole function for float. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ float +__ccoshf (__complex__ float x) +{ + __complex__ float retval; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + float sinh_val = __ieee754_sinhf (__real__ x); + float cosh_val = __ieee754_coshf (__real__ x); + float sinix, cosix; + + __sincosf (__imag__ x, &sinix, &cosix); + + __real__ retval = cosh_val * cosix; + __imag__ retval = sinh_val * sinix; + } + else + { + __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf (""); + __real__ retval = __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = HUGE_VALF; + __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x); + } + else if (icls > FP_ZERO) + { + /* Imaginary part is finite. */ + float sinix, cosix; + + __sincosf (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysignf (HUGE_VALF, cosix); + __imag__ retval = (__copysignf (HUGE_VALF, sinix) + * __copysignf (1.0, __real__ x)); + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = HUGE_VALF; + __imag__ retval = __nanf ("") + __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = __nanf (""); + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf (""); + } + + return retval; +} +weak_alias (__ccoshf, ccoshf) diff --git a/sysdeps/generic/s_ccoshl.c b/sysdeps/generic/s_ccoshl.c new file mode 100644 index 0000000000..9301a9e10d --- /dev/null +++ b/sysdeps/generic/s_ccoshl.c @@ -0,0 +1,101 @@ +/* Complex cosine hyperbole function for long double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ long double +__ccoshl (__complex__ long double x) +{ + __complex__ long double retval; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + long double sinh_val = __ieee754_sinhl (__real__ x); + long double cosh_val = __ieee754_coshl (__real__ x); + long double sinix, cosix; + + __sincosl (__imag__ x, &sinix, &cosix); + + __real__ retval = cosh_val * cosix; + __imag__ retval = sinh_val * sinix; + } + else + { + __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl (""); + __real__ retval = __nanl ("") + __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = HUGE_VALL; + __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x); + } + else if (icls > FP_ZERO) + { + /* Imaginary part is finite. */ + long double sinix, cosix; + + __sincosl (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysignl (HUGE_VALL, cosix); + __imag__ retval = (__copysignl (HUGE_VALL, sinix) + * __copysignl (1.0, __real__ x)); + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = HUGE_VALL; + __imag__ retval = __nanl ("") + __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = __nanl (""); + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl (""); + } + + return retval; +} +weak_alias (__ccoshl, ccoshl) diff --git a/sysdeps/generic/s_ccosl.c b/sysdeps/generic/s_ccosl.c new file mode 100644 index 0000000000..fdcc7a63dd --- /dev/null +++ b/sysdeps/generic/s_ccosl.c @@ -0,0 +1,76 @@ +/* Return cosine of complex long double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + + +__complex__ long double +__ccosl (__complex__ long double x) +{ + __complex__ long double res; + + if (!isfinite (__real__ x) || __isnanl (__imag__ x)) + { + if (__real__ x == 0.0 || __imag__ x == 0.0) + { + __real__ res = __nanl (""); + __imag__ res = 0.0; + +#ifdef FE_INVALID + if (__isinfl (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + else if (__isinfl (__imag__ x)) + { + __real__ res = HUGE_VALL; + __imag__ res = __nanl (""); + +#ifdef FE_INVALID + if (__isinfl (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + +#ifdef FE_INVALID + if (isfinite (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __complex__ long double y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + res = __ccoshl (y); + } + + return res; +} +weak_alias (__ccosl, ccosl) diff --git a/sysdeps/generic/s_cexp.c b/sysdeps/generic/s_cexp.c new file mode 100644 index 0000000000..6ba5b0a4a5 --- /dev/null +++ b/sysdeps/generic/s_cexp.c @@ -0,0 +1,127 @@ +/* Return value of complex exponential function for double complex value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ double +__cexp (__complex__ double x) +{ + __complex__ double retval; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + double exp_val = __ieee754_exp (__real__ x); + double sinix, cosix; + + __sincos (__imag__ x, &sinix, &cosix); + + if (isfinite (exp_val)) + { + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; + } + else + { + __real__ retval = __copysign (exp_val, cosix); + __imag__ retval = __copysign (exp_val, sinix); + } + } + else + { + /* If the imaginary part is +-inf or NaN and the real part + is not +-inf the result is NaN + iNaN. */ + __real__ retval = __nan (""); + __imag__ retval = __nan (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + double value = signbit (__real__ x) ? 0.0 : HUGE_VAL; + + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = value; + __imag__ retval = __imag__ x; + } + else + { + double sinix, cosix; + + __sincos (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysign (value, cosix); + __imag__ retval = __copysign (value, sinix); + } + } + else if (signbit (__real__ x) == 0) + { + __real__ retval = HUGE_VAL; + __imag__ retval = __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = 0.0; + __imag__ retval = __copysign (0.0, __imag__ x); + } + } + else + { + /* If the real part is NaN the result is NaN + iNaN. */ + __real__ retval = __nan (""); + __imag__ retval = __nan (""); + +#ifdef FE_INVALID + if (rcls != FP_NAN || icls != FP_NAN) + feraiseexcept (FE_INVALID); +#endif + } + + return retval; +} +weak_alias (__cexp, cexp) +#ifdef NO_LONG_DOUBLE +strong_alias (__cexp, __cexpl) +weak_alias (__cexp, cexpl) +#endif diff --git a/sysdeps/generic/s_cexpf.c b/sysdeps/generic/s_cexpf.c new file mode 100644 index 0000000000..603e78d716 --- /dev/null +++ b/sysdeps/generic/s_cexpf.c @@ -0,0 +1,123 @@ +/* Return value of complex exponential function for float complex value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ float +__cexpf (__complex__ float x) +{ + __complex__ float retval; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + float exp_val = __ieee754_expf (__real__ x); + float sinix, cosix; + + __sincosf (__imag__ x, &sinix, &cosix); + + if (isfinite (exp_val)) + { + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; + } + else + { + __real__ retval = __copysignf (exp_val, cosix); + __imag__ retval = __copysignf (exp_val, sinix); + } + } + else + { + /* If the imaginary part is +-inf or NaN and the real part + is not +-inf the result is NaN + iNaN. */ + __real__ retval = __nanf (""); + __imag__ retval = __nanf (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + float value = signbit (__real__ x) ? 0.0 : HUGE_VALF; + + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = value; + __imag__ retval = __imag__ x; + } + else + { + float sinix, cosix; + + __sincosf (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysignf (value, cosix); + __imag__ retval = __copysignf (value, sinix); + } + } + else if (signbit (__real__ x) == 0) + { + __real__ retval = HUGE_VALF; + __imag__ retval = __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = 0.0; + __imag__ retval = __copysignf (0.0, __imag__ x); + } + } + else + { + /* If the real part is NaN the result is NaN + iNaN. */ + __real__ retval = __nanf (""); + __imag__ retval = __nanf (""); + +#ifdef FE_INVALID + if (rcls != FP_NAN || icls != FP_NAN) + feraiseexcept (FE_INVALID); +#endif + } + + return retval; +} +weak_alias (__cexpf, cexpf) diff --git a/sysdeps/generic/s_cexpl.c b/sysdeps/generic/s_cexpl.c new file mode 100644 index 0000000000..67fa7a08b9 --- /dev/null +++ b/sysdeps/generic/s_cexpl.c @@ -0,0 +1,123 @@ +/* Return value of complex exponential function for long double complex value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ long double +__cexpl (__complex__ long double x) +{ + __complex__ long double retval; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + long double exp_val = __ieee754_expl (__real__ x); + long double sinix, cosix; + + __sincosl (__imag__ x, &sinix, &cosix); + + if (isfinite (exp_val)) + { + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; + } + else + { + __real__ retval = __copysignl (exp_val, cosix); + __imag__ retval = __copysignl (exp_val, sinix); + } + } + else + { + /* If the imaginary part is +-inf or NaN and the real part + is not +-inf the result is NaN + iNaN. */ + __real__ retval = __nanl (""); + __imag__ retval = __nanl (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL; + + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = value; + __imag__ retval = __imag__ x; + } + else + { + long double sinix, cosix; + + __sincosl (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysignl (value, cosix); + __imag__ retval = __copysignl (value, sinix); + } + } + else if (signbit (__real__ x) == 0) + { + __real__ retval = HUGE_VALL; + __imag__ retval = __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = 0.0; + __imag__ retval = __copysignl (0.0, __imag__ x); + } + } + else + { + /* If the real part is NaN the result is NaN + iNaN. */ + __real__ retval = __nanl (""); + __imag__ retval = __nanl (""); + +#ifdef FE_INVALID + if (rcls != FP_NAN || icls != FP_NAN) + feraiseexcept (FE_INVALID); +#endif + } + + return retval; +} +weak_alias (__cexpl, cexpl) diff --git a/sysdeps/generic/s_clog.c b/sysdeps/generic/s_clog.c new file mode 100644 index 0000000000..c14a734759 --- /dev/null +++ b/sysdeps/generic/s_clog.c @@ -0,0 +1,65 @@ +/* Compute complex natural logarithm. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ double +__clog (__complex__ double x) +{ + __complex__ double result; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls == FP_ZERO && icls == FP_ZERO) + { + /* Real and imaginary part are 0.0. */ + __imag__ result = signbit (__real__ x) ? M_PI : 0.0; + __imag__ result = __copysign (__imag__ result, __imag__ x); + /* Yes, the following line raises an exception. */ + __real__ result = -1.0 / fabs (__real__ x); + } + else if (rcls != FP_NAN && icls != FP_NAN) + { + /* Neither real nor imaginary part is NaN. */ + __real__ result = __ieee754_log (__ieee754_hypot (__real__ x, + __imag__ x)); + __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x); + } + else + { + __imag__ result = __nan (""); + if (rcls == FP_INFINITE || icls == FP_INFINITE) + /* Real or imaginary part is infinite. */ + __real__ result = HUGE_VAL; + else + __real__ result = __nan (""); + } + + return result; +} +weak_alias (__clog, clog) +#ifdef NO_LONG_DOUBLE +strong_alias (__clog, __clogl) +weak_alias (__clog, clogl) +#endif diff --git a/sysdeps/generic/s_clog10.c b/sysdeps/generic/s_clog10.c new file mode 100644 index 0000000000..7b2e474b8f --- /dev/null +++ b/sysdeps/generic/s_clog10.c @@ -0,0 +1,65 @@ +/* Compute complex base 10 logarithm. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ double +__clog10 (__complex__ double x) +{ + __complex__ double result; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls == FP_ZERO && icls == FP_ZERO) + { + /* Real and imaginary part are 0.0. */ + __imag__ result = signbit (__real__ x) ? M_PI : 0.0; + __imag__ result = __copysign (__imag__ result, __imag__ x); + /* Yes, the following line raises an exception. */ + __real__ result = -1.0 / fabs (__real__ x); + } + else if (rcls != FP_NAN && icls != FP_NAN) + { + /* Neither real nor imaginary part is NaN. */ + __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x, + __imag__ x)); + __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x); + } + else + { + __imag__ result = __nan (""); + if (rcls == FP_INFINITE || icls == FP_INFINITE) + /* Real or imaginary part is infinite. */ + __real__ result = HUGE_VAL; + else + __real__ result = __nan (""); + } + + return result; +} +weak_alias (__clog10, clog10) +#ifdef NO_LONG_DOUBLE +strong_alias (__clog10, __clog10l) +weak_alias (__clog10, clog10l) +#endif diff --git a/sysdeps/generic/s_clog10f.c b/sysdeps/generic/s_clog10f.c new file mode 100644 index 0000000000..bc4094b8ba --- /dev/null +++ b/sysdeps/generic/s_clog10f.c @@ -0,0 +1,61 @@ +/* Compute complex base 10 logarithm. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ float +__clog10f (__complex__ float x) +{ + __complex__ float result; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls == FP_ZERO && icls == FP_ZERO) + { + /* Real and imaginary part are 0.0. */ + __imag__ result = signbit (__real__ x) ? M_PI : 0.0; + __imag__ result = __copysignf (__imag__ result, __imag__ x); + /* Yes, the following line raises an exception. */ + __real__ result = -1.0 / fabsf (__real__ x); + } + else if (rcls != FP_NAN && icls != FP_NAN) + { + /* Neither real nor imaginary part is NaN. */ + __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x, + __imag__ x)); + __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x); + } + else + { + __imag__ result = __nanf (""); + if (rcls == FP_INFINITE || icls == FP_INFINITE) + /* Real or imaginary part is infinite. */ + __real__ result = HUGE_VALF; + else + __real__ result = __nanf (""); + } + + return result; +} +weak_alias (__clog10f, clog10f) diff --git a/sysdeps/generic/s_clog10l.c b/sysdeps/generic/s_clog10l.c new file mode 100644 index 0000000000..186eba25cd --- /dev/null +++ b/sysdeps/generic/s_clog10l.c @@ -0,0 +1,61 @@ +/* Compute complex base 10 logarithm. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ long double +__clog10l (__complex__ long double x) +{ + __complex__ long double result; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls == FP_ZERO && icls == FP_ZERO) + { + /* Real and imaginary part are 0.0. */ + __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; + __imag__ result = __copysignl (__imag__ result, __imag__ x); + /* Yes, the following line raises an exception. */ + __real__ result = -1.0 / fabsl (__real__ x); + } + else if (rcls != FP_NAN && icls != FP_NAN) + { + /* Neither real nor imaginary part is NaN. */ + __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x, + __imag__ x)); + __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x); + } + else + { + __imag__ result = __nanl (""); + if (rcls == FP_INFINITE || icls == FP_INFINITE) + /* Real or imaginary part is infinite. */ + __real__ result = HUGE_VALL; + else + __real__ result = __nanl (""); + } + + return result; +} +weak_alias (__clog10l, clog10l) diff --git a/sysdeps/generic/s_clogf.c b/sysdeps/generic/s_clogf.c new file mode 100644 index 0000000000..9c9aa83e33 --- /dev/null +++ b/sysdeps/generic/s_clogf.c @@ -0,0 +1,61 @@ +/* Compute complex natural logarithm. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ float +__clogf (__complex__ float x) +{ + __complex__ float result; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls == FP_ZERO && icls == FP_ZERO) + { + /* Real and imaginary part are 0.0. */ + __imag__ result = signbit (__real__ x) ? M_PI : 0.0; + __imag__ result = __copysignf (__imag__ result, __imag__ x); + /* Yes, the following line raises an exception. */ + __real__ result = -1.0 / fabsf (__real__ x); + } + else if (rcls != FP_NAN && icls != FP_NAN) + { + /* Neither real nor imaginary part is NaN. */ + __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x, + __imag__ x)); + __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x); + } + else + { + __imag__ result = __nanf (""); + if (rcls == FP_INFINITE || icls == FP_INFINITE) + /* Real or imaginary part is infinite. */ + __real__ result = HUGE_VALF; + else + __real__ result = __nanf (""); + } + + return result; +} +weak_alias (__clogf, clogf) diff --git a/sysdeps/generic/s_clogl.c b/sysdeps/generic/s_clogl.c new file mode 100644 index 0000000000..a297ec9628 --- /dev/null +++ b/sysdeps/generic/s_clogl.c @@ -0,0 +1,61 @@ +/* Compute complex natural logarithm. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ long double +__clogl (__complex__ long double x) +{ + __complex__ long double result; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls == FP_ZERO && icls == FP_ZERO) + { + /* Real and imaginary part are 0.0. */ + __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; + __imag__ result = __copysignl (__imag__ result, __imag__ x); + /* Yes, the following line raises an exception. */ + __real__ result = -1.0 / fabsl (__real__ x); + } + else if (rcls != FP_NAN && icls != FP_NAN) + { + /* Neither real nor imaginary part is NaN. */ + __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x, + __imag__ x)); + __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x); + } + else + { + __imag__ result = __nanl (""); + if (rcls == FP_INFINITE || icls == FP_INFINITE) + /* Real or imaginary part is infinite. */ + __real__ result = HUGE_VALL; + else + __real__ result = __nanl (""); + } + + return result; +} +weak_alias (__clogl, clogl) diff --git a/sysdeps/generic/s_cpow.c b/sysdeps/generic/s_cpow.c new file mode 100644 index 0000000000..074b38bd2d --- /dev/null +++ b/sysdeps/generic/s_cpow.c @@ -0,0 +1,34 @@ +/* Complex power of double values. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ double +__cpow (__complex__ double x, __complex__ double c) +{ + return __cexp (c * __clog (x)); +} +weak_alias (__cpow, cpow) +#ifdef NO_LONG_DOUBLE +strong_alias (__cpow, __cpowl) +weak_alias (__cpow, cpowl) +#endif diff --git a/sysdeps/generic/s_cpowf.c b/sysdeps/generic/s_cpowf.c new file mode 100644 index 0000000000..fa4541ca2b --- /dev/null +++ b/sysdeps/generic/s_cpowf.c @@ -0,0 +1,30 @@ +/* Complex power of float values. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ float +__cpowf (__complex__ float x, __complex__ float c) +{ + return __cexpf (c * __clogf (x)); +} +weak_alias (__cpowf, cpowf) diff --git a/sysdeps/generic/s_cpowl.c b/sysdeps/generic/s_cpowl.c new file mode 100644 index 0000000000..69097d5dcc --- /dev/null +++ b/sysdeps/generic/s_cpowl.c @@ -0,0 +1,30 @@ +/* Complex power of long double values. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ long double +__cpowl (__complex__ long double x, __complex__ long double c) +{ + return __cexpl (c * __clogl (x)); +} +weak_alias (__cpowl, cpowl) diff --git a/sysdeps/generic/s_cproj.c b/sysdeps/generic/s_cproj.c new file mode 100644 index 0000000000..fb50bb5a88 --- /dev/null +++ b/sysdeps/generic/s_cproj.c @@ -0,0 +1,49 @@ +/* Compute projection of complex double value to Riemann sphere. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ double +__cproj (__complex__ double x) +{ + __complex__ double res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + __real__ res = INFINITY; + __imag__ res = __copysign (0.0, __imag__ x); + } + else + { + double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0; + + __real__ res = (2.0 * __real__ x) / den; + __imag__ res = (2.0 * __imag__ x) / den; + } + + return res; +} +weak_alias (__cproj, cproj) +#ifdef NO_LONG_DOUBLE +strong_alias (__cproj, __cprojl) +weak_alias (__cproj, cprojl) +#endif diff --git a/sysdeps/generic/s_cprojf.c b/sysdeps/generic/s_cprojf.c new file mode 100644 index 0000000000..b90590835c --- /dev/null +++ b/sysdeps/generic/s_cprojf.c @@ -0,0 +1,45 @@ +/* Compute projection of complex float value to Riemann sphere. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ float +__cprojf (__complex__ float x) +{ + __complex__ float res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + __real__ res = INFINITY; + __imag__ res = __copysignf (0.0, __imag__ x); + } + else + { + float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0; + + __real__ res = (2.0 * __real__ x) / den; + __imag__ res = (2.0 * __imag__ x) / den; + } + + return res; +} +weak_alias (__cprojf, cprojf) diff --git a/sysdeps/generic/s_cprojl.c b/sysdeps/generic/s_cprojl.c new file mode 100644 index 0000000000..13da4b417d --- /dev/null +++ b/sysdeps/generic/s_cprojl.c @@ -0,0 +1,46 @@ +/* Compute projection of complex long double value to Riemann sphere. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +__complex__ long double +__cprojl (__complex__ long double x) +{ + __complex__ long double res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + __real__ res = INFINITY; + __imag__ res = __copysignl (0.0, __imag__ x); + } + else + { + long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x + + 1.0); + + __real__ res = (2.0 * __real__ x) / den; + __imag__ res = (2.0 * __imag__ x) / den; + } + + return res; +} +weak_alias (__cprojl, cprojl) diff --git a/sysdeps/generic/s_csin.c b/sysdeps/generic/s_csin.c new file mode 100644 index 0000000000..6627387d42 --- /dev/null +++ b/sysdeps/generic/s_csin.c @@ -0,0 +1,131 @@ +/* Complex sine function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ double +__csin (__complex__ double x) +{ + __complex__ double retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = fabs (__real__ x); + + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + double sinh_val = __ieee754_sinh (__imag__ x); + double cosh_val = __ieee754_cosh (__imag__ x); + double sinix, cosix; + + __sincos (__real__ x, &sinix, &cosix); + + __real__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * cosix; + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = __nan (""); + __imag__ retval = __imag__ x; + +#ifdef FE_INVALID + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = __nan (""); + __imag__ retval = __nan (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + } + else if (icls == FP_INFINITE) + { + /* Imaginary part is infinite. */ + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); + __imag__ retval = __imag__ x; + } + else if (rcls > FP_ZERO) + { + /* Real part is finite. */ + double sinix, cosix; + + __sincos (__real__ x, &sinix, &cosix); + + __real__ retval = __copysign (HUGE_VAL, sinix); + __imag__ retval = __copysign (HUGE_VAL, cosix); + + if (negate) + __real__ retval = -__real__ retval; + if (signbit (__imag__ x)) + __imag__ retval = -__imag__ retval; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = __nan (""); + __imag__ retval = HUGE_VAL; + +#ifdef FE_INVALID + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + if (rcls == FP_ZERO) + __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); + else + __real__ retval = __nan (""); + __imag__ retval = __nan (""); + } + + return retval; +} +weak_alias (__csin, csin) +#ifdef NO_LONG_DOUBLE +strong_alias (__csin, __csinl) +weak_alias (__csin, csinl) +#endif diff --git a/sysdeps/generic/s_csinf.c b/sysdeps/generic/s_csinf.c new file mode 100644 index 0000000000..31d2f1fd54 --- /dev/null +++ b/sysdeps/generic/s_csinf.c @@ -0,0 +1,127 @@ +/* Complex sine function for float. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ float +__csinf (__complex__ float x) +{ + __complex__ float retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = fabsf (__real__ x); + + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + float sinh_val = __ieee754_sinhf (__imag__ x); + float cosh_val = __ieee754_coshf (__imag__ x); + float sinix, cosix; + + __sincosf (__real__ x, &sinix, &cosix); + + __real__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * cosix; + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = __nanf (""); + __imag__ retval = __imag__ x; + +#ifdef FE_INVALID + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = __nanf (""); + __imag__ retval = __nanf (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + } + else if (icls == FP_INFINITE) + { + /* Imaginary part is infinite. */ + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); + __imag__ retval = __imag__ x; + } + else if (rcls > FP_ZERO) + { + /* Real part is finite. */ + float sinix, cosix; + + __sincosf (__real__ x, &sinix, &cosix); + + __real__ retval = __copysignf (HUGE_VALF, sinix); + __imag__ retval = __copysignf (HUGE_VALF, cosix); + + if (negate) + __real__ retval = -__real__ retval; + if (signbit (__imag__ x)) + __imag__ retval = -__imag__ retval; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = __nanf (""); + __imag__ retval = HUGE_VALF; + +#ifdef FE_INVALID + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + if (rcls == FP_ZERO) + __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); + else + __real__ retval = __nanf (""); + __imag__ retval = __nanf (""); + } + + return retval; +} +weak_alias (__csinf, csinf) diff --git a/sysdeps/generic/s_csinh.c b/sysdeps/generic/s_csinh.c new file mode 100644 index 0000000000..29a271fec6 --- /dev/null +++ b/sysdeps/generic/s_csinh.c @@ -0,0 +1,126 @@ +/* Complex sine hyperbole function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ double +__csinh (__complex__ double x) +{ + __complex__ double retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = fabs (__real__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + double sinh_val = __ieee754_sinh (__real__ x); + double cosh_val = __ieee754_cosh (__real__ x); + double sinix, cosix; + + __sincos (__imag__ x, &sinix, &cosix); + + __real__ retval = sinh_val * cosix; + __imag__ retval = cosh_val * sinix; + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); + __imag__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = __nan (""); + __imag__ retval = __nan (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = negate ? -HUGE_VAL : HUGE_VAL; + __imag__ retval = __imag__ x; + } + else if (icls > FP_ZERO) + { + /* Imaginary part is finite. */ + double sinix, cosix; + + __sincos (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysign (HUGE_VAL, cosix); + __imag__ retval = __copysign (HUGE_VAL, sinix); + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = HUGE_VAL; + __imag__ retval = __nan ("") + __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = __nan (""); + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan (""); + } + + return retval; +} +weak_alias (__csinh, csinh) +#ifdef NO_LONG_DOUBLE +strong_alias (__csinh, __csinhl) +weak_alias (__csinh, csinhl) +#endif diff --git a/sysdeps/generic/s_csinhf.c b/sysdeps/generic/s_csinhf.c new file mode 100644 index 0000000000..9c479bba95 --- /dev/null +++ b/sysdeps/generic/s_csinhf.c @@ -0,0 +1,122 @@ +/* Complex sine hyperbole function for float. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ float +__csinhf (__complex__ float x) +{ + __complex__ float retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = fabsf (__real__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + float sinh_val = __ieee754_sinhf (__real__ x); + float cosh_val = __ieee754_coshf (__real__ x); + float sinix, cosix; + + __sincosf (__imag__ x, &sinix, &cosix); + + __real__ retval = sinh_val * cosix; + __imag__ retval = cosh_val * sinix; + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); + __imag__ retval = __nanf ("") + __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = __nanf (""); + __imag__ retval = __nanf (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = negate ? -HUGE_VALF : HUGE_VALF; + __imag__ retval = __imag__ x; + } + else if (icls > FP_ZERO) + { + /* Imaginary part is finite. */ + float sinix, cosix; + + __sincosf (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysignf (HUGE_VALF, cosix); + __imag__ retval = __copysignf (HUGE_VALF, sinix); + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = HUGE_VALF; + __imag__ retval = __nanf ("") + __nanf (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = __nanf (""); + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf (""); + } + + return retval; +} +weak_alias (__csinhf, csinhf) diff --git a/sysdeps/generic/s_csinhl.c b/sysdeps/generic/s_csinhl.c new file mode 100644 index 0000000000..471cc7e81e --- /dev/null +++ b/sysdeps/generic/s_csinhl.c @@ -0,0 +1,122 @@ +/* Complex sine hyperbole function for long double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ long double +__csinhl (__complex__ long double x) +{ + __complex__ long double retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = fabsl (__real__ x); + + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + long double sinh_val = __ieee754_sinhl (__real__ x); + long double cosh_val = __ieee754_coshl (__real__ x); + long double sinix, cosix; + + __sincosl (__imag__ x, &sinix, &cosix); + + __real__ retval = sinh_val * cosix; + __imag__ retval = cosh_val * sinix; + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); + __imag__ retval = __nanl ("") + __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = __nanl (""); + __imag__ retval = __nanl (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + } + else if (rcls == FP_INFINITE) + { + /* Real part is infinite. */ + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = negate ? -HUGE_VALL : HUGE_VALL; + __imag__ retval = __imag__ x; + } + else if (icls > FP_ZERO) + { + /* Imaginary part is finite. */ + long double sinix, cosix; + + __sincosl (__imag__ x, &sinix, &cosix); + + __real__ retval = __copysignl (HUGE_VALL, cosix); + __imag__ retval = __copysignl (HUGE_VALL, sinix); + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = HUGE_VALL; + __imag__ retval = __nanl ("") + __nanl (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = __nanl (""); + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl (""); + } + + return retval; +} +weak_alias (__csinhl, csinhl) diff --git a/sysdeps/generic/s_csinl.c b/sysdeps/generic/s_csinl.c new file mode 100644 index 0000000000..bae8648c32 --- /dev/null +++ b/sysdeps/generic/s_csinl.c @@ -0,0 +1,127 @@ +/* Complex sine function for long double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ long double +__csinl (__complex__ long double x) +{ + __complex__ long double retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = fabsl (__real__ x); + + if (icls >= FP_ZERO) + { + /* Imaginary part is finite. */ + if (rcls >= FP_ZERO) + { + /* Real part is finite. */ + long double sinh_val = __ieee754_sinhl (__imag__ x); + long double cosh_val = __ieee754_coshl (__imag__ x); + long double sinix, cosix; + + __sincosl (__real__ x, &sinix, &cosix); + + __real__ retval = cosh_val * sinix; + __imag__ retval = sinh_val * cosix; + + if (negate) + __real__ retval = -__real__ retval; + } + else + { + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = __nanl (""); + __imag__ retval = __imag__ x; + +#ifdef FE_INVALID + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + else + { + __real__ retval = __nanl (""); + __imag__ retval = __nanl (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif + } + } + } + else if (icls == FP_INFINITE) + { + /* Imaginary part is infinite. */ + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); + __imag__ retval = __imag__ x; + } + else if (rcls > FP_ZERO) + { + /* Real part is finite. */ + long double sinix, cosix; + + __sincosl (__real__ x, &sinix, &cosix); + + __real__ retval = __copysignl (HUGE_VALL, sinix); + __imag__ retval = __copysignl (HUGE_VALL, cosix); + + if (negate) + __real__ retval = -__real__ retval; + if (signbit (__imag__ x)) + __imag__ retval = -__imag__ retval; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = __nanl (""); + __imag__ retval = HUGE_VALL; + +#ifdef FE_INVALID + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + if (rcls == FP_ZERO) + __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); + else + __real__ retval = __nanl (""); + __imag__ retval = __nanl (""); + } + + return retval; +} +weak_alias (__csinl, csinl) diff --git a/sysdeps/generic/s_csqrt.c b/sysdeps/generic/s_csqrt.c new file mode 100644 index 0000000000..a4dedf8806 --- /dev/null +++ b/sysdeps/generic/s_csqrt.c @@ -0,0 +1,114 @@ +/* Complex square root of double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Based on an algorithm by Stephen L. Moshier . + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ double +__csqrt (__complex__ double x) +{ + __complex__ double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = HUGE_VAL; + __imag__ res = __imag__ x; + } + else if (rcls == FP_INFINITE) + { + if (__real__ x < 0.0) + { + __real__ res = icls == FP_NAN ? __nan ("") : 0; + __imag__ res = __copysign (HUGE_VAL, __imag__ x); + } + else + { + __real__ res = __real__ x; + __imag__ res = (icls == FP_NAN + ? __nan ("") : __copysign (0.0, __imag__ x)); + } + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + } + } + else + { + if (icls == FP_ZERO) + { + if (__real__ x < 0.0) + { + __real__ res = 0.0; + __imag__ res = __copysign (__ieee754_sqrt (-__real__ x), + __imag__ x); + } + else + { + __real__ res = fabs (__ieee754_sqrt (__real__ x)); + __imag__ res = __copysign (0.0, __imag__ x); + } + } + else if (rcls == FP_ZERO) + { + double r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); + + __real__ res = __copysign (r, __imag__ x); + __imag__ res = r; + } + else + { + double d, r, s; + + d = __ieee754_hypot (__real__ x, __imag__ x); + /* Use the identity 2 Re res Im res = Im x + to avoid cancellation error in d +/- Re x. */ + if (__real__ x > 0) + { + r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x); + s = (0.5 * __imag__ x) / r; + } + else + { + s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x); + r = fabs ((0.5 * __imag__ x) / s); + } + + __real__ res = r; + __imag__ res = __copysign (s, __imag__ x); + } + } + + return res; +} +weak_alias (__csqrt, csqrt) +#ifdef NO_LONG_DOUBLE +strong_alias (__csqrt, __csqrtl) +weak_alias (__csqrt, csqrtl) +#endif diff --git a/sysdeps/generic/s_csqrtf.c b/sysdeps/generic/s_csqrtf.c new file mode 100644 index 0000000000..3bc979f6e2 --- /dev/null +++ b/sysdeps/generic/s_csqrtf.c @@ -0,0 +1,110 @@ +/* Complex square root of float value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Based on an algorithm by Stephen L. Moshier . + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ float +__csqrtf (__complex__ float x) +{ + __complex__ float res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = HUGE_VALF; + __imag__ res = __imag__ x; + } + else if (rcls == FP_INFINITE) + { + if (__real__ x < 0.0) + { + __real__ res = icls == FP_NAN ? __nanf ("") : 0; + __imag__ res = __copysignf (HUGE_VALF, __imag__ x); + } + else + { + __real__ res = __real__ x; + __imag__ res = (icls == FP_NAN + ? __nanf ("") : __copysignf (0.0, __imag__ x)); + } + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + } + } + else + { + if (icls == FP_ZERO) + { + if (__real__ x < 0.0) + { + __real__ res = 0.0; + __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x), + __imag__ x); + } + else + { + __real__ res = fabsf (__ieee754_sqrtf (__real__ x)); + __imag__ res = __copysignf (0.0, __imag__ x); + } + } + else if (rcls == FP_ZERO) + { + float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x)); + + __real__ res = __copysignf (r, __imag__ x); + __imag__ res = r; + } + else + { + float d, r, s; + + d = __ieee754_hypotf (__real__ x, __imag__ x); + /* Use the identity 2 Re res Im res = Im x + to avoid cancellation error in d +/- Re x. */ + if (__real__ x > 0) + { + r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x); + s = (0.5f * __imag__ x) / r; + } + else + { + s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x); + r = fabsf ((0.5f * __imag__ x) / s); + } + + __real__ res = r; + __imag__ res = __copysignf (s, __imag__ x); + } + } + + return res; +} +weak_alias (__csqrtf, csqrtf) diff --git a/sysdeps/generic/s_csqrtl.c b/sysdeps/generic/s_csqrtl.c new file mode 100644 index 0000000000..b806bc6785 --- /dev/null +++ b/sysdeps/generic/s_csqrtl.c @@ -0,0 +1,110 @@ +/* Complex square root of long double value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Based on an algorithm by Stephen L. Moshier . + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include "math_private.h" + + +__complex__ long double +__csqrtl (__complex__ long double x) +{ + __complex__ long double res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = HUGE_VALL; + __imag__ res = __imag__ x; + } + else if (rcls == FP_INFINITE) + { + if (__real__ x < 0.0) + { + __real__ res = icls == FP_NAN ? __nanl ("") : 0; + __imag__ res = __copysignl (HUGE_VALL, __imag__ x); + } + else + { + __real__ res = __real__ x; + __imag__ res = (icls == FP_NAN + ? __nanl ("") : __copysignl (0.0, __imag__ x)); + } + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + } + } + else + { + if (icls == FP_ZERO) + { + if (__real__ x < 0.0) + { + __real__ res = 0.0; + __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x), + __imag__ x); + } + else + { + __real__ res = fabsl (__ieee754_sqrtl (__real__ x)); + __imag__ res = __copysignl (0.0, __imag__ x); + } + } + else if (rcls == FP_ZERO) + { + long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x)); + + __real__ res = __copysignl (r, __imag__ x); + __imag__ res = r; + } + else + { + long double d, r, s; + + d = __ieee754_hypotl (__real__ x, __imag__ x); + /* Use the identity 2 Re res Im res = Im x + to avoid cancellation error in d +/- Re x. */ + if (__real__ x > 0) + { + r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x); + s = (0.5L * __imag__ x) / r; + } + else + { + s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x); + r = fabsl ((0.5L * __imag__ x) / s); + } + + __real__ res = r; + __imag__ res = __copysignl (s, __imag__ x); + } + } + + return res; +} +weak_alias (__csqrtl, csqrtl) diff --git a/sysdeps/generic/s_ctan.c b/sysdeps/generic/s_ctan.c new file mode 100644 index 0000000000..f1ce9688bb --- /dev/null +++ b/sysdeps/generic/s_ctan.c @@ -0,0 +1,74 @@ +/* Complex tangent function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ double +__ctan (__complex__ double x) +{ + __complex__ double res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + if (__isinf (__imag__ x)) + { + __real__ res = __copysign (0.0, __real__ x); + __imag__ res = __copysign (1.0, __imag__ x); + } + else if (__real__ x == 0.0) + { + res = x; + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + +#ifdef FE_INVALID + if (__isinf (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + double sin2rx, cos2rx; + double den; + + __sincos (2.0 * __real__ x, &sin2rx, &cos2rx); + + den = cos2rx + __ieee754_cosh (2.0 * __imag__ x); + + __real__ res = sin2rx / den; + __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den; + } + + return res; +} +weak_alias (__ctan, ctan) +#ifdef NO_LONG_DOUBLE +strong_alias (__ctan, __ctanl) +weak_alias (__ctan, ctanl) +#endif diff --git a/sysdeps/generic/s_ctanf.c b/sysdeps/generic/s_ctanf.c new file mode 100644 index 0000000000..750d3511b9 --- /dev/null +++ b/sysdeps/generic/s_ctanf.c @@ -0,0 +1,70 @@ +/* Complex tangent function for float. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ float +__ctanf (__complex__ float x) +{ + __complex__ float res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + if (__isinff (__imag__ x)) + { + __real__ res = __copysignf (0.0, __real__ x); + __imag__ res = __copysignf (1.0, __imag__ x); + } + else if (__real__ x == 0.0) + { + res = x; + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + +#ifdef FE_INVALID + if (__isinff (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + float sin2rx, cos2rx; + float den; + + __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx); + + den = cos2rx + __ieee754_coshf (2.0 * __imag__ x); + + __real__ res = sin2rx / den; + __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den; + } + + return res; +} +weak_alias (__ctanf, ctanf) diff --git a/sysdeps/generic/s_ctanh.c b/sysdeps/generic/s_ctanh.c new file mode 100644 index 0000000000..d8825f35f9 --- /dev/null +++ b/sysdeps/generic/s_ctanh.c @@ -0,0 +1,74 @@ +/* Complex hyperbole tangent for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ double +__ctanh (__complex__ double x) +{ + __complex__ double res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + if (__isinf (__real__ x)) + { + __real__ res = __copysign (1.0, __real__ x); + __imag__ res = __copysign (0.0, __imag__ x); + } + else if (__imag__ x == 0.0) + { + res = x; + } + else + { + __real__ res = __nan (""); + __imag__ res = __nan (""); + +#ifdef FE_INVALID + if (__isinf (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + double sin2ix, cos2ix; + double den; + + __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix); + + den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix); + + __real__ res = __ieee754_sinh (2.0 * __real__ x) / den; + __imag__ res = sin2ix / den; + } + + return res; +} +weak_alias (__ctanh, ctanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__ctanh, __ctanhl) +weak_alias (__ctanh, ctanhl) +#endif diff --git a/sysdeps/generic/s_ctanhf.c b/sysdeps/generic/s_ctanhf.c new file mode 100644 index 0000000000..fd66648d79 --- /dev/null +++ b/sysdeps/generic/s_ctanhf.c @@ -0,0 +1,70 @@ +/* Complex hyperbole tangent for float. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ float +__ctanhf (__complex__ float x) +{ + __complex__ float res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + if (__isinff (__real__ x)) + { + __real__ res = __copysignf (1.0, __real__ x); + __imag__ res = __copysignf (0.0, __imag__ x); + } + else if (__imag__ x == 0.0) + { + res = x; + } + else + { + __real__ res = __nanf (""); + __imag__ res = __nanf (""); + +#ifdef FE_INVALID + if (__isinff (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + float sin2ix, cos2ix; + float den; + + __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix); + + den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix); + + __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den; + __imag__ res = sin2ix / den; + } + + return res; +} +weak_alias (__ctanhf, ctanhf) diff --git a/sysdeps/generic/s_ctanhl.c b/sysdeps/generic/s_ctanhl.c new file mode 100644 index 0000000000..5ec06a6fa4 --- /dev/null +++ b/sysdeps/generic/s_ctanhl.c @@ -0,0 +1,70 @@ +/* Complex hyperbole tangent for long double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ long double +__ctanhl (__complex__ long double x) +{ + __complex__ long double res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + if (__isinfl (__real__ x)) + { + __real__ res = __copysignl (1.0, __real__ x); + __imag__ res = __copysignl (0.0, __imag__ x); + } + else if (__imag__ x == 0.0) + { + res = x; + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + +#ifdef FE_INVALID + if (__isinfl (__imag__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + long double sin2ix, cos2ix; + long double den; + + __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix); + + den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix); + + __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den; + __imag__ res = sin2ix / den; + } + + return res; +} +weak_alias (__ctanhl, ctanhl) diff --git a/sysdeps/generic/s_ctanl.c b/sysdeps/generic/s_ctanl.c new file mode 100644 index 0000000000..31ab3b48a6 --- /dev/null +++ b/sysdeps/generic/s_ctanl.c @@ -0,0 +1,70 @@ +/* Complex tangent function for long double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include "math_private.h" + + +__complex__ long double +__ctanl (__complex__ long double x) +{ + __complex__ long double res; + + if (!isfinite (__real__ x) || !isfinite (__imag__ x)) + { + if (__isinfl (__imag__ x)) + { + __real__ res = __copysignl (0.0, __real__ x); + __imag__ res = __copysignl (1.0, __imag__ x); + } + else if (__real__ x == 0.0) + { + res = x; + } + else + { + __real__ res = __nanl (""); + __imag__ res = __nanl (""); + +#ifdef FE_INVALID + if (__isinfl (__real__ x)) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + long double sin2rx, cos2rx; + long double den; + + __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx); + + den = cos2rx + __ieee754_coshl (2.0 * __imag__ x); + + __real__ res = sin2rx / den; + __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den; + } + + return res; +} +weak_alias (__ctanl, ctanl) diff --git a/sysdeps/generic/s_fdim.c b/sysdeps/generic/s_fdim.c new file mode 100644 index 0000000000..b45c413cb8 --- /dev/null +++ b/sysdeps/generic/s_fdim.c @@ -0,0 +1,40 @@ +/* Return positive difference between arguments. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +double +__fdim (double x, double y) +{ + int clsx = fpclassify (x); + int clsy = fpclassify (y); + + if (clsx == FP_NAN || clsy == FP_NAN + || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) + /* Raise invalid flag. */ + return x - y; + + return x < y ? 0 : x - y; +} +weak_alias (__fdim, fdim) +#ifdef NO_LONG_DOUBLE +strong_alias (__fdim, __fdiml) +weak_alias (__fdim, fdiml) +#endif diff --git a/sysdeps/generic/s_fdimf.c b/sysdeps/generic/s_fdimf.c new file mode 100644 index 0000000000..a8d8192c0f --- /dev/null +++ b/sysdeps/generic/s_fdimf.c @@ -0,0 +1,36 @@ +/* Return positive difference between arguments. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +float +__fdimf (float x, float y) +{ + int clsx = fpclassify (x); + int clsy = fpclassify (y); + + if (clsx == FP_NAN || clsy == FP_NAN + || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) + /* Raise invalid flag. */ + return x - y; + + return x < y ? 0 : x - y; +} +weak_alias (__fdimf, fdimf) diff --git a/sysdeps/generic/s_fdiml.c b/sysdeps/generic/s_fdiml.c new file mode 100644 index 0000000000..c97a668f10 --- /dev/null +++ b/sysdeps/generic/s_fdiml.c @@ -0,0 +1,36 @@ +/* Return positive difference between arguments. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +long double +__fdiml (long double x, long double y) +{ + int clsx = fpclassify (x); + int clsy = fpclassify (y); + + if (clsx == FP_NAN || clsy == FP_NAN + || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) + /* Raise invalid flag. */ + return x - y; + + return x < y ? 0 : x - y; +} +weak_alias (__fdiml, fdiml) diff --git a/sysdeps/generic/s_fma.c b/sysdeps/generic/s_fma.c new file mode 100644 index 0000000000..53974dc40c --- /dev/null +++ b/sysdeps/generic/s_fma.c @@ -0,0 +1,28 @@ +/* Compute x * y + z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +double +__fma (double x, double y, double z) +{ + return (x * y) + z; +} +weak_alias (__fma, fma) diff --git a/sysdeps/generic/s_fmaf.c b/sysdeps/generic/s_fmaf.c new file mode 100644 index 0000000000..44e5e15def --- /dev/null +++ b/sysdeps/generic/s_fmaf.c @@ -0,0 +1,28 @@ +/* Compute x * y + z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +float +__fmaf (float x, float y, float z) +{ + return (x * y) + z; +} +weak_alias (__fmaf, fmaf) diff --git a/sysdeps/generic/s_fmal.c b/sysdeps/generic/s_fmal.c new file mode 100644 index 0000000000..f73751f4db --- /dev/null +++ b/sysdeps/generic/s_fmal.c @@ -0,0 +1,28 @@ +/* Compute x * y + z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +long double +__fmal (long double x, long double y, long double z) +{ + return (x * y) + z; +} +weak_alias (__fmal, fmal) diff --git a/sysdeps/generic/s_fmax.c b/sysdeps/generic/s_fmax.c new file mode 100644 index 0000000000..bc6af7286c --- /dev/null +++ b/sysdeps/generic/s_fmax.c @@ -0,0 +1,33 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +double +__fmax (double x, double y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmax, fmax) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmax, __fmaxl) +weak_alias (__fmax, fmaxl) +#endif diff --git a/sysdeps/generic/s_fmaxf.c b/sysdeps/generic/s_fmaxf.c new file mode 100644 index 0000000000..e56193fe7b --- /dev/null +++ b/sysdeps/generic/s_fmaxf.c @@ -0,0 +1,29 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +float +__fmaxf (float x, float y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/generic/s_fmaxl.c b/sysdeps/generic/s_fmaxl.c new file mode 100644 index 0000000000..6e1c7152ed --- /dev/null +++ b/sysdeps/generic/s_fmaxl.c @@ -0,0 +1,29 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +long double +__fmaxl (long double x, long double y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/generic/s_fmin.c b/sysdeps/generic/s_fmin.c new file mode 100644 index 0000000000..b79e6eca5a --- /dev/null +++ b/sysdeps/generic/s_fmin.c @@ -0,0 +1,33 @@ +/* Return minimum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +double +__fmin (double x, double y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmin, fmin) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmin, __fminl) +weak_alias (__fmin, fminl) +#endif diff --git a/sysdeps/generic/s_fminf.c b/sysdeps/generic/s_fminf.c new file mode 100644 index 0000000000..72c656e1ac --- /dev/null +++ b/sysdeps/generic/s_fminf.c @@ -0,0 +1,29 @@ +/* Return minimum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +float +__fminf (float x, float y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fminf, fminf) diff --git a/sysdeps/generic/s_fminl.c b/sysdeps/generic/s_fminl.c new file mode 100644 index 0000000000..0f06194b77 --- /dev/null +++ b/sysdeps/generic/s_fminl.c @@ -0,0 +1,29 @@ +/* Return minimum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +long double +__fminl (long double x, long double y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fminl, fminl) diff --git a/sysdeps/generic/s_ldexp.c b/sysdeps/generic/s_ldexp.c new file mode 100644 index 0000000000..12c336fad4 --- /dev/null +++ b/sysdeps/generic/s_ldexp.c @@ -0,0 +1,37 @@ +/* @(#)s_ldexp.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" +#include + +#ifdef __STDC__ + double __ldexp(double value, int exp) +#else + double __ldexp(value, exp) + double value; int exp; +#endif +{ + if(!__finite(value)||value==0.0) return value; + value = __scalbn(value,exp); + if(!__finite(value)||value==0.0) __set_errno (ERANGE); + return value; +} +weak_alias (__ldexp, ldexp) +#ifdef NO_LONG_DOUBLE +strong_alias (__ldexp, __ldexpl) +weak_alias (__ldexp, ldexpl) +#endif diff --git a/sysdeps/generic/s_ldexpf.c b/sysdeps/generic/s_ldexpf.c new file mode 100644 index 0000000000..1ecbe8346b --- /dev/null +++ b/sysdeps/generic/s_ldexpf.c @@ -0,0 +1,36 @@ +/* s_ldexpf.c -- float version of s_ldexp.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" +#include + +#ifdef __STDC__ + float __ldexpf(float value, int exp) +#else + float __ldexpf(value, exp) + float value; int exp; +#endif +{ + if(!__finitef(value)||value==(float)0.0) return value; + value = __scalbnf(value,exp); + if(!__finitef(value)||value==(float)0.0) __set_errno (ERANGE); + return value; +} +weak_alias (__ldexpf, ldexpf) diff --git a/sysdeps/generic/s_ldexpl.c b/sysdeps/generic/s_ldexpl.c new file mode 100644 index 0000000000..123a6b3b58 --- /dev/null +++ b/sysdeps/generic/s_ldexpl.c @@ -0,0 +1,37 @@ +/* s_ldexpl.c -- long double version of s_ldexp.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +#include "math.h" +#include "math_private.h" +#include + +#ifdef __STDC__ + long double __ldexpl(long double value, int exp) +#else + long double __ldexpl(value, exp) + long double value; int exp; +#endif +{ + if(!__finitel(value)||value==0.0) return value; + value = __scalbnl(value,exp); + if(!__finitel(value)||value==0.0) __set_errno (ERANGE); + return value; +} +weak_alias (__ldexpl, ldexpl) diff --git a/sysdeps/generic/s_nan.c b/sysdeps/generic/s_nan.c new file mode 100644 index 0000000000..ff3b26855f --- /dev/null +++ b/sysdeps/generic/s_nan.c @@ -0,0 +1,44 @@ +/* Return quiet nan. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include + + +double +__nan (const char *tagp) +{ + if (tagp[0] != '\0') + { + char buf[6 + strlen (tagp)]; + sprintf (buf, "NAN(%s)", tagp); + return strtod (buf, NULL); + } + + return NAN; +} +weak_alias (__nan, nan) +#ifdef NO_LONG_DOUBLE +strong_alias (__nan, __nanl) +weak_alias (__nan, nanl) +#endif diff --git a/sysdeps/generic/s_nanf.c b/sysdeps/generic/s_nanf.c new file mode 100644 index 0000000000..b59040ac82 --- /dev/null +++ b/sysdeps/generic/s_nanf.c @@ -0,0 +1,40 @@ +/* Return quiet nan. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include + + +float +__nanf (const char *tagp) +{ + if (tagp[0] != '\0') + { + char buf[6 + strlen (tagp)]; + sprintf (buf, "NAN(%s)", tagp); + return strtof (buf, NULL); + } + + return NAN; +} +weak_alias (__nanf, nanf) diff --git a/sysdeps/generic/s_nanl.c b/sysdeps/generic/s_nanl.c new file mode 100644 index 0000000000..bd42689b78 --- /dev/null +++ b/sysdeps/generic/s_nanl.c @@ -0,0 +1,40 @@ +/* Return quiet nan. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include + + +long double +__nanl (const char *tagp) +{ + if (tagp[0] != '\0') + { + char buf[6 + strlen (tagp)]; + sprintf (buf, "NAN(%s)", tagp); + return strtold (buf, NULL); + } + + return NAN; +} +weak_alias (__nanl, nanl) diff --git a/sysdeps/generic/s_nextafter.c b/sysdeps/generic/s_nextafter.c new file mode 100644 index 0000000000..8b81e563d9 --- /dev/null +++ b/sysdeps/generic/s_nextafter.c @@ -0,0 +1,86 @@ +/* @(#)s_nextafter.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp $"; +#endif + +/* IEEE functions + * nextafter(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __nextafter(double x, double y) +#else + double __nextafter(x,y) + double x,y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t lx,ly; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hy,ly,y); + ix = hx&0x7fffffff; /* |x| */ + iy = hy&0x7fffffff; /* |y| */ + + if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ + ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ + return x+y; + if(x==y) return y; /* x=y, return y */ + if((ix|lx)==0) { /* x == 0 */ + INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } else { /* x < 0 */ + if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } + hy = hx&0x7ff00000; + if(hy>=0x7ff00000) return x+x; /* overflow */ + if(hy<0x00100000) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + INSERT_WORDS(y,hx,lx); + return y; + } + } + INSERT_WORDS(x,hx,lx); + return x; +} +weak_alias (__nextafter, nextafter) +#ifdef NO_LONG_DOUBLE +strong_alias (__nextafter, __nextafterl) +weak_alias (__nextafter, nextafterl) +strong_alias (__nextafter, __nexttoward) +weak_alias (__nextafter, nexttoward) +#endif diff --git a/sysdeps/generic/s_nexttowardf.c b/sysdeps/generic/s_nexttowardf.c new file mode 100644 index 0000000000..f4cf18d06e --- /dev/null +++ b/sysdeps/generic/s_nexttowardf.c @@ -0,0 +1,79 @@ +/* Single precision version of nexttoward.c. + Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* IEEE functions + * nexttowardf(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * This is for machines which use the same binary type for double and + * long double. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __nexttowardf(float x, long double y) +#else + float __nexttowardf(x,y) + float x; + long double y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t ly; + + GET_FLOAT_WORD(hx,x); + EXTRACT_WORDS(hy,ly,y); + ix = hx&0x7fffffff; /* |x| */ + iy = hy&0x7fffffff; /* |y| */ + + if(((ix>=0x7f800000) || /* x is nan */ + ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ + return x+y; + if((long double) x==y) return y; /* x=y, return y */ + if(ix==0) { /* x == 0 */ + float x2; + SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/ + x2 = x*x; + if(x2==x) return x2; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(hy<0||(ix>>23)>(iy>>20)-0x380 + || ((ix>>23)==(iy>>20)-0x380 + && (ix&0x7fffff)>((hy<<3)|(ly>>29))&0x7fffff)) /* x > y, x -= ulp */ + hx -= 1; + else /* x < y, x += ulp */ + hx += 1; + } else { /* x < 0 */ + if(hy>=0||(ix>>23)>(iy>>20)-0x380 + || ((ix>>23)==(iy>>20)-0x380 + && (ix&0x7fffff)>((hy<<3)|(ly>>29))&0x7fffff)) /* x < y, x -= ulp */ + hx -= 1; + else /* x > y, x += ulp */ + hx += 1; + } + hy = hx&0x7f800000; + if(hy>=0x7f800000) return x+x; /* overflow */ + if(hy<0x00800000) { /* underflow */ + float x2 = x*x; + if(x2!=x) { /* raise underflow flag */ + SET_FLOAT_WORD(x2,hx); + return x2; + } + } + SET_FLOAT_WORD(x,hx); + return x; +} +weak_alias (__nexttowardf, nexttowardf) diff --git a/sysdeps/generic/s_nexttowardl.c b/sysdeps/generic/s_nexttowardl.c new file mode 100644 index 0000000000..73c3610fc1 --- /dev/null +++ b/sysdeps/generic/s_nexttowardl.c @@ -0,0 +1 @@ +/* This function is the same as nextafterl so we use an alias there. */ diff --git a/sysdeps/generic/s_significand.c b/sysdeps/generic/s_significand.c new file mode 100644 index 0000000000..4ab078c473 --- /dev/null +++ b/sysdeps/generic/s_significand.c @@ -0,0 +1,39 @@ +/* @(#)s_signif.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Exp $"; +#endif + +/* + * significand(x) computes just + * scalb(x, (double) -ilogb(x)), + * for exercising the fraction-part(F) IEEE 754-1985 test vector. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __significand(double x) +#else + double __significand(x) + double x; +#endif +{ + return __ieee754_scalb(x,(double) -ilogb(x)); +} +weak_alias (__significand, significand) +#ifdef NO_LONG_DOUBLE +strong_alias (__significand, __significandl) +weak_alias (__significand, significandl) +#endif diff --git a/sysdeps/generic/s_significandf.c b/sysdeps/generic/s_significandf.c new file mode 100644 index 0000000000..2893a4e1b7 --- /dev/null +++ b/sysdeps/generic/s_significandf.c @@ -0,0 +1,32 @@ +/* s_significandf.c -- float version of s_significand.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __significandf(float x) +#else + float __significandf(x) + float x; +#endif +{ + return __ieee754_scalbf(x,(float) -ilogbf(x)); +} +weak_alias (__significandf, significandf) diff --git a/sysdeps/generic/s_significandl.c b/sysdeps/generic/s_significandl.c new file mode 100644 index 0000000000..d84e806fdc --- /dev/null +++ b/sysdeps/generic/s_significandl.c @@ -0,0 +1,39 @@ +/* s_significandl.c -- long double version of s_significand.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * significandl(x) computes just + * scalbl(x, (long double) -ilogbl(x)), + * for exercising the fraction-part(F) IEEE 754-1985 test vector. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __significandl(long double x) +#else + long double __significandl(x) + long double x; +#endif +{ + return __ieee754_scalbl(x,(long double) -ilogbl(x)); +} +weak_alias (__significandl, significandl) diff --git a/sysdeps/generic/s_tanhl.c b/sysdeps/generic/s_tanhl.c new file mode 100644 index 0000000000..bc9a2d7f48 --- /dev/null +++ b/sysdeps/generic/s_tanhl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +long double +__tanhl(long double x) +{ + fputs ("__tanhl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +weak_alias (__tanhl, tanhl) +stub_warning (tanhl) +#include diff --git a/sysdeps/generic/strtold.c b/sysdeps/generic/strtold.c index f1bb2f1c0d..86b2f7f2f4 100644 --- a/sysdeps/generic/strtold.c +++ b/sysdeps/generic/strtold.c @@ -1,31 +1,23 @@ -#include +/* Copyright (C) 1999 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -#ifndef __NO_LONG_DOUBLE_MATH -/* The actual implementation for all floating point sizes is in strtod.c. - These macros tell it to produce the `long double' version, `strtold'. */ + 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 + Library General Public License for more details. -# define FLOAT long double -# define FLT LDBL -# ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define STRTOF __strtold_l -# else -# define STRTOF strtold -# endif -# define MPN2FLOAT __mpn_construct_long_double -# define FLOAT_HUGE_VAL HUGE_VALL -# define SET_MANTISSA(flt, mant) \ - do { union ieee854_long_double u; \ - u.d = (flt); \ - if ((mant & 0x7fffffffffffffffULL) == 0) \ - mant = 0x4000000000000000ULL; \ - u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000; \ - u.ieee.mantissa1 = (mant) & 0xffffffff; \ - (flt) = u.d; \ - } while (0) + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include -# include "strtod.c" -#else -# include /* There is no `long double' type, use the `double' implementations. */ long double __strtold_internal (const char *nptr, char **endptr, int group) diff --git a/sysdeps/generic/w_expl.c b/sysdeps/generic/w_expl.c new file mode 100644 index 0000000000..70096a820c --- /dev/null +++ b/sysdeps/generic/w_expl.c @@ -0,0 +1,13 @@ +#include +#include +#include + +long double +__expl(long double x) +{ + fputs ("__expl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +weak_alias (__expl, expl) diff --git a/sysdeps/i386/Implies b/sysdeps/i386/Implies index d6acf04a82..ac22f59f78 100644 --- a/sysdeps/i386/Implies +++ b/sysdeps/i386/Implies @@ -1,2 +1,4 @@ wordsize-32 -ieee754 +ieee754/flt-32 +ieee754/dbl-64 +ieee754/ldbl-96 diff --git a/sysdeps/i386/fpu/Implies b/sysdeps/i386/fpu/Implies deleted file mode 100644 index de9b0b27aa..0000000000 --- a/sysdeps/i386/fpu/Implies +++ /dev/null @@ -1,2 +0,0 @@ -# For x86 machines with FPU, use the i387 port of libm by JT Conklin. -libm-i387 diff --git a/sysdeps/i386/fpu/e_acos.S b/sysdeps/i386/fpu/e_acos.S new file mode 100644 index 0000000000..b9d07b1091 --- /dev/null +++ b/sysdeps/i386/fpu/e_acos.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: e_acos.S,v 1.4 1995/05/08 23:44:37 jtc Exp $") + +/* acos = atan (sqrt(1 - x^2) / x) */ +ENTRY(__ieee754_acos) + fldl 4(%esp) /* x */ + fld %st /* x : x */ + fmul %st(0) /* x^2 : x */ + fld1 /* 1 : x^2 : x */ + fsubp /* 1 - x^2 : x */ + fsqrt /* sqrt (1 - x^2) : x */ + fxch %st(1) /* x : sqrt (1 - x^2) */ + fpatan /* atan (sqrt(1 - x^2) / x) */ + ret +END (__ieee754_acos) diff --git a/sysdeps/i386/fpu/e_acosf.S b/sysdeps/i386/fpu/e_acosf.S new file mode 100644 index 0000000000..50b13fd1bd --- /dev/null +++ b/sysdeps/i386/fpu/e_acosf.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float type by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +/* acos = atan (sqrt(1 - x^2) / x) */ +ENTRY(__ieee754_acosf) + flds 4(%esp) /* x */ + fld %st + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fxch %st(1) + fpatan + ret +END (__ieee754_acosf) diff --git a/sysdeps/i386/fpu/e_acosh.S b/sysdeps/i386/fpu/e_acosh.S new file mode 100644 index 0000000000..a3397b365c --- /dev/null +++ b/sysdeps/i386/fpu/e_acosh.S @@ -0,0 +1,105 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + 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) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acosh) + movl 8(%esp), %ecx + cmpl $0x3ff00000, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + fldl 4(%esp) // x : log(2) + cmpl $0x41b00000, %ecx + ja 3f // x > 2^28 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^28 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acosh) diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S new file mode 100644 index 0000000000..8aa78957e2 --- /dev/null +++ b/sysdeps/i386/fpu/e_acoshf.S @@ -0,0 +1,105 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + 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) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acoshf) + movl 4(%esp), %ecx + cmpl $0x3f800000, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + flds 4(%esp) // x : log(2) + cmpl $0x47000000, %ecx + ja 3f // x > 2^14 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^14 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acoshf) diff --git a/sysdeps/i386/fpu/e_acoshl.S b/sysdeps/i386/fpu/e_acoshl.S new file mode 100644 index 0000000000..0c81daaebe --- /dev/null +++ b/sysdeps/i386/fpu/e_acoshl.S @@ -0,0 +1,112 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + /* 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. */ + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acoshl) + movl 12(%esp), %ecx + andl $0xffff, %ecx + cmpl $0x3fff, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + fldt 4(%esp) // x : log(2) + cmpl $0x4020, %ecx + ja 3f // x > 2^34 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x4000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^34 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^34 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acoshl) diff --git a/sysdeps/i386/fpu/e_acosl.S b/sysdeps/i386/fpu/e_acosl.S new file mode 100644 index 0000000000..d69f056556 --- /dev/null +++ b/sysdeps/i386/fpu/e_acosl.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + + +/* acosl = atanl (sqrtl(1 - x^2) / x) */ +ENTRY(__ieee754_acosl) + fldt 4(%esp) /* x */ + fld %st + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrtl (1 - x^2) */ + fxch %st(1) + fpatan + ret +END (__ieee754_acosl) diff --git a/sysdeps/i386/fpu/e_asin.S b/sysdeps/i386/fpu/e_asin.S new file mode 100644 index 0000000000..945e308245 --- /dev/null +++ b/sysdeps/i386/fpu/e_asin.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: e_asin.S,v 1.4 1995/05/08 23:45:40 jtc Exp $") + +/* asin = atan (x / sqrt(1 - x^2)) */ +ENTRY(__ieee754_asin) + fldl 4(%esp) /* x */ + fld %st + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fpatan + ret +END (__ieee754_asin) diff --git a/sysdeps/i386/fpu/e_asinf.S b/sysdeps/i386/fpu/e_asinf.S new file mode 100644 index 0000000000..d450e9a740 --- /dev/null +++ b/sysdeps/i386/fpu/e_asinf.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float type by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +/* asin = atan (x / sqrt(1 - x^2)) */ +ENTRY(__ieee754_asinf) + flds 4(%esp) /* x */ + fld %st + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fpatan + ret +END (__ieee754_asinf) diff --git a/sysdeps/i386/fpu/e_asinl.S b/sysdeps/i386/fpu/e_asinl.S new file mode 100644 index 0000000000..3919fbcf58 --- /dev/null +++ b/sysdeps/i386/fpu/e_asinl.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +/* asinl = atanl (x / sqrtl(1 - x^2)) */ +ENTRY(__ieee754_asinl) + fldt 4(%esp) /* x */ + fld %st + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fpatan + ret +END (__ieee754_asinl) diff --git a/sysdeps/i386/fpu/e_atan2.S b/sysdeps/i386/fpu/e_atan2.S new file mode 100644 index 0000000000..8df04e485e --- /dev/null +++ b/sysdeps/i386/fpu/e_atan2.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: e_atan2.S,v 1.4 1995/05/08 23:46:28 jtc Exp $") + +ENTRY(__ieee754_atan2) + fldl 4(%esp) + fldl 12(%esp) + fpatan + ret +END (__ieee754_atan2) diff --git a/sysdeps/i386/fpu/e_atan2f.S b/sysdeps/i386/fpu/e_atan2f.S new file mode 100644 index 0000000000..fc6621f183 --- /dev/null +++ b/sysdeps/i386/fpu/e_atan2f.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: e_atan2f.S,v 1.1 1995/05/08 23:35:10 jtc Exp $") + +ENTRY(__ieee754_atan2f) + flds 4(%esp) + flds 8(%esp) + fpatan + ret +END (__ieee754_atan2f) diff --git a/sysdeps/i386/fpu/e_atan2l.S b/sysdeps/i386/fpu/e_atan2l.S new file mode 100644 index 0000000000..f58eaa94a9 --- /dev/null +++ b/sysdeps/i386/fpu/e_atan2l.S @@ -0,0 +1,17 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_atan2l) + fldt 4(%esp) + fldt 16(%esp) + fpatan + ret +END (__ieee754_atan2l) diff --git a/sysdeps/i386/fpu/e_atanh.S b/sysdeps/i386/fpu/e_atanh.S new file mode 100644 index 0000000000..231e96f57f --- /dev/null +++ b/sysdeps/i386/fpu/e_atanh.S @@ -0,0 +1,101 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + 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(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanh) + movl 8(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x80000000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 8(%esp) + fldl 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanh) diff --git a/sysdeps/i386/fpu/e_atanhf.S b/sysdeps/i386/fpu/e_atanhf.S new file mode 100644 index 0000000000..687d4c97fb --- /dev/null +++ b/sysdeps/i386/fpu/e_atanhf.S @@ -0,0 +1,102 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + 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) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanhf) + movl 4(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x80000000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 4(%esp) + flds 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st(0) // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanhf) diff --git a/sysdeps/i386/fpu/e_atanhl.S b/sysdeps/i386/fpu/e_atanhl.S new file mode 100644 index 0000000000..8a2bd11ce4 --- /dev/null +++ b/sysdeps/i386/fpu/e_atanhl.S @@ -0,0 +1,108 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + /* Please note that we use double values for 0.5 and 1.0. These + numbers have exact representations and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanhl) + movl 12(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x8000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 12(%esp) + fldt 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st(0) // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanhl) diff --git a/sysdeps/i386/fpu/e_exp.S b/sysdeps/i386/fpu/e_exp.S new file mode 100644 index 0000000000..4a75fa1d1c --- /dev/null +++ b/sysdeps/i386/fpu/e_exp.S @@ -0,0 +1,41 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: e_exp.S,v 1.7 1996/07/03 17:31:28 jtc Exp $") + +/* e^x = 2^(x * log2(e)) */ +ENTRY(__ieee754_exp) + fldl 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2e + fmulp /* x * log2(e) */ + fld %st + frndint /* int(x * log2(e)) */ + fsubr %st,%st(1) /* fract(x * log2(e)) */ + fxch + f2xm1 /* 2^(fract(x * log2(e))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(e))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp) diff --git a/sysdeps/i386/fpu/e_exp10.S b/sysdeps/i386/fpu/e_exp10.S new file mode 100644 index 0000000000..6bfcdbb723 --- /dev/null +++ b/sysdeps/i386/fpu/e_exp10.S @@ -0,0 +1,38 @@ +/* + * Written by Ulrich Drepper . + */ + +#include + +/* 10^x = 2^(x * log2(10)) */ +ENTRY(__ieee754_exp10) + fldl 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2t + fmulp /* x * log2(10) */ + fld %st + frndint /* int(x * log2(10)) */ + fsubr %st,%st(1) /* fract(x * log2(10)) */ + fxch + f2xm1 /* 2^(fract(x * log2(10))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(10))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp10) diff --git a/sysdeps/i386/fpu/e_exp10f.S b/sysdeps/i386/fpu/e_exp10f.S new file mode 100644 index 0000000000..4791b99afa --- /dev/null +++ b/sysdeps/i386/fpu/e_exp10f.S @@ -0,0 +1,38 @@ +/* + * Written by Ulrich Drepper. + */ + +#include + +/* e^x = 2^(x * log2(10)) */ +ENTRY(__ieee754_exp10f) + flds 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2t + fmulp /* x * log2(10) */ + fld %st + frndint /* int(x * log2(10)) */ + fsubr %st,%st(1) /* fract(x * log2(10)) */ + fxch + f2xm1 /* 2^(fract(x * log2(10))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(10))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp10f) diff --git a/sysdeps/i386/fpu/e_exp10l.S b/sysdeps/i386/fpu/e_exp10l.S new file mode 100644 index 0000000000..71f0da792d --- /dev/null +++ b/sysdeps/i386/fpu/e_exp10l.S @@ -0,0 +1,38 @@ +/* + * Written by Ulrich Drepper . + */ + +#include + +/* e^x = 2^(x * log2l(10)) */ +ENTRY(__ieee754_exp10l) + fldt 4(%esp) +/* I added the following ugly construct because expl(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2t + fmulp /* x * log2(10) */ + fld %st + frndint /* int(x * log2(10)) */ + fsubr %st,%st(1) /* fract(x * log2(10)) */ + fxch + f2xm1 /* 2^(fract(x * log2(10))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(10))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp10l) diff --git a/sysdeps/i386/fpu/e_expf.S b/sysdeps/i386/fpu/e_expf.S new file mode 100644 index 0000000000..5fd49b89fd --- /dev/null +++ b/sysdeps/i386/fpu/e_expf.S @@ -0,0 +1,42 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float type by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +/* e^x = 2^(x * log2(e)) */ +ENTRY(__ieee754_expf) + flds 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2e + fmulp /* x * log2(e) */ + fld %st + frndint /* int(x * log2(e)) */ + fsubr %st,%st(1) /* fract(x * log2(e)) */ + fxch + f2xm1 /* 2^(fract(x * log2(e))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(e))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_expf) diff --git a/sysdeps/i386/fpu/e_expl.S b/sysdeps/i386/fpu/e_expl.S new file mode 100644 index 0000000000..2bcdf58c58 --- /dev/null +++ b/sysdeps/i386/fpu/e_expl.S @@ -0,0 +1,43 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +/* e^x = 2^(x * log2l(e)) */ +ENTRY(__ieee754_expl) + fldt 4(%esp) +/* I added the following ugly construct because expl(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2e + fmulp /* x * log2(e) */ + fld %st + frndint /* int(x * log2(e)) */ + fsubr %st,%st(1) /* fract(x * log2(e)) */ + fxch + f2xm1 /* 2^(fract(x * log2(e))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(e))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_expl) diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S new file mode 100644 index 0000000000..4cf6e92054 --- /dev/null +++ b/sysdeps/i386/fpu/e_fmod.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +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) +1: fprem + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret +END (__ieee754_fmod) diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S new file mode 100644 index 0000000000..bbce40976d --- /dev/null +++ b/sysdeps/i386/fpu/e_fmodf.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float type by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_fmodf) + flds 8(%esp) + flds 4(%esp) +1: fprem + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret +END(__ieee754_fmodf) diff --git a/sysdeps/i386/fpu/e_fmodl.S b/sysdeps/i386/fpu/e_fmodl.S new file mode 100644 index 0000000000..7ae63a40ab --- /dev/null +++ b/sysdeps/i386/fpu/e_fmodl.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_fmodl) + fldt 16(%esp) + fldt 4(%esp) +1: fprem + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret +END (__ieee754_fmodl) diff --git a/sysdeps/i386/fpu/e_hypot.S b/sysdeps/i386/fpu/e_hypot.S new file mode 100644 index 0000000000..07a32878a0 --- /dev/null +++ b/sysdeps/i386/fpu/e_hypot.S @@ -0,0 +1,62 @@ +/* Compute the hypothenuse of X and Y. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__ieee754_hypot) + fldl 4(%esp) // x + fxam + fnstsw + fldl 12(%esp) // y : x + movb %ah, %ch + fxam + fnstsw + movb %ah, %al + orb %ch, %ah + sahf + jc 1f + fmul %st(0) // y * y : x + fxch // x : y * y + fmul %st(0) // x * x : y * y + faddp // x * x + y * y + fsqrt +2: ret + + // We have to test whether any of the parameters is Inf. + // In this case the result is infinity. +1: andb $0x45, %al + cmpb $5, %al + je 3f // jump if y is Inf + andb $0x45, %ch + cmpb $5, %ch + jne 4f // jump if x is not Inf + fxch +3: fstp %st(1) + fabs + jmp 2b + +4: testb $1, %al + jnz 5f // y is NaN + fxch +5: fstp %st(1) + jmp 2b + +END(__ieee754_hypot) diff --git a/sysdeps/i386/fpu/e_hypotf.S b/sysdeps/i386/fpu/e_hypotf.S new file mode 100644 index 0000000000..bf5416b664 --- /dev/null +++ b/sysdeps/i386/fpu/e_hypotf.S @@ -0,0 +1,62 @@ +/* Compute the hypothenuse of X and Y. + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__ieee754_hypotf) + flds 4(%esp) // x + fxam + fnstsw + flds 8(%esp) // y : x + movb %ah, %ch + fxam + fnstsw + movb %ah, %al + orb %ch, %ah + sahf + jc 1f + fmul %st(0) // y * y : x + fxch // x : y * y + fmul %st(0) // x * x : y * y + faddp // x * x + y * y + fsqrt +2: ret + + // We have to test whether any of the parameters is Inf. + // In this case the result is infinity. +1: andb $0x45, %al + cmpb $5, %al + je 3f // jump if y is Inf + andb $0x45, %ch + cmpb $5, %ch + jne 4f // jump if x is not Inf + fxch +3: fstp %st(1) + fabs + jmp 2b + +4: testb $1, %al + jnz 5f // y is NaN + fxch +5: fstp %st(1) + jmp 2b + +END(__ieee754_hypotf) diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S new file mode 100644 index 0000000000..c7cacdfb0a --- /dev/null +++ b/sysdeps/i386/fpu/e_log.S @@ -0,0 +1,59 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_log) + fldln2 // log(2) + fldl 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + 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 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : log(2) + fyl2x // log(x) + ret +END (__ieee754_log) diff --git a/sysdeps/i386/fpu/e_log10.S b/sysdeps/i386/fpu/e_log10.S new file mode 100644 index 0000000000..2c8488c3a9 --- /dev/null +++ b/sysdeps/i386/fpu/e_log10.S @@ -0,0 +1,59 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_log10) + fldlg2 // log10(2) + fldl 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + 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 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fstp %st(0) // x : log10(2) + fyl2x // log10(x) + ret +END (__ieee754_log10) diff --git a/sysdeps/i386/fpu/e_log10f.S b/sysdeps/i386/fpu/e_log10f.S new file mode 100644 index 0000000000..2c07161085 --- /dev/null +++ b/sysdeps/i386/fpu/e_log10f.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float type by Ulrich Drepper . + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_log10f) + fldlg2 // log10(2) + flds 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + 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 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fstp %st(0) // x : log10(2) + fyl2x // log10(x) + ret +END (__ieee754_log10f) diff --git a/sysdeps/i386/fpu/e_log10l.S b/sysdeps/i386/fpu/e_log10l.S new file mode 100644 index 0000000000..6fe7c5a6f7 --- /dev/null +++ b/sysdeps/i386/fpu/e_log10l.S @@ -0,0 +1,61 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_log10l) + fldlg2 // log10(2) + fldt 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + 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 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fstp %st(0) // x : log10(2) + fyl2x // log10(x) + ret +END(__ieee754_log10l) diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S new file mode 100644 index 0000000000..bdba1d3225 --- /dev/null +++ b/sysdeps/i386/fpu/e_logf.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float by Ulrich Drepper . + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_logf) + fldln2 // log(2) + flds 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + 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 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : log(2) + fyl2x // log(x) + ret +END (__ieee754_logf) diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S new file mode 100644 index 0000000000..bda3ea508e --- /dev/null +++ b/sysdeps/i386/fpu/e_logl.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_logl) + fldln2 // log(2) + fldt 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + 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 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : log(2) + fyl2x // log(x) + ret +END (__ieee754_logl) diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S new file mode 100644 index 0000000000..75ad211872 --- /dev/null +++ b/sysdeps/i386/fpu/e_pow.S @@ -0,0 +1,320 @@ +/* ix87 specific implementation of pow function. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(infinity,@object) +inf_zero: +infinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + ASM_SIZE_DIRECTIVE(infinity) + ASM_TYPE_DIRECTIVE(zero,@object) +zero: .double 0.0 + ASM_SIZE_DIRECTIVE(zero) + ASM_TYPE_DIRECTIVE(minf_mzero,@object) +minf_mzero: +minfinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff +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) + +#ifdef PIC +#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) +#endif + + .text +ENTRY(__ieee754_pow) + fldl 12(%esp) // y + fxam + +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + + fnstsw + movb %ah, %dl + andb $0x45, %ah + cmpb $0x40, %ah // is y == 0 ? + je 11f + + cmpb $0x05, %ah // is y == ±inf ? + je 12f + + cmpb $0x01, %ah // is y == NaN ? + je 30f + + fldl 4(%esp) // x : y + + subl $8,%esp + + fxam + fnstsw + movb %ah, %dh + andb $0x45, %ah + cmpb $0x40, %ah + je 20f // x is ±0 + + cmpb $0x05, %ah + je 15f // x is ±inf + + fxch // y : x + + /* First see whether `y' is a natural number. In this case we + can use a more precise algorithm. */ + fld %st // y : y : x + fistpll (%esp) // y : x + fildll (%esp) // int(y) : y : x + fucomp %st(1) // y : x + fnstsw + sahf + jne 2f + + /* OK, we have an integer value for y. */ + popl %eax + popl %edx + orl $0, %edx + fstp %st(0) // x + jns 4f // y >= 0, jump + fdivrl MO(one) // 1/x (now referred to as x) + negl %eax + adcl $0, %edx + negl %edx +4: fldl MO(one) // 1 : x + fxch + +6: shrdl $1, %edx, %eax + jnc 5f + fxch + fmul %st(1) // x : ST*x + fxch +5: fmul %st(0), %st // x*x : ST*x + shrl $1, %edx + movl %eax, %ecx + orl %edx, %ecx + jnz 6b + fstp %st(0) // ST*x +30: ret + + .align ALIGNARG(4) +2: /* y is a real number. */ + fxch // x : y + fldl MO(one) // 1.0 : x : y + fld %st(1) // x : 1.0 : x : y + fsub %st(1) // x-1 : 1.0 : x : y + fabs // |x-1| : 1.0 : x : y + fcompl MO(limit) // 1.0 : x : y + fnstsw + fxch // x : 1.0 : y + sahf + ja 7f + fsub %st(1) // x-1 : 1.0 : y + fyl2xp1 // log2(x) : y + jmp 8f + +7: fyl2x // log2(x) : y +8: fmul %st(1) // y*log2(x) : y + fst %st(1) // y*log2(x) : y*log2(x) + frndint // int(y*log2(x)) : y*log2(x) + fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) + fxch // fract(y*log2(x)) : int(y*log2(x)) + f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) + faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) + fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) + addl $8, %esp + fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) + ret + + + // pow(x,±0) = 1 + .align ALIGNARG(4) +11: fstp %st(0) // pop y + fldl MO(one) + ret + + // y == ±inf + .align ALIGNARG(4) +12: fstp %st(0) // pop y + fldl 4(%esp) // x + fabs + fcompl MO(one) // < 1, == 1, or > 1 + fnstsw + andb $0x45, %ah + cmpb $0x45, %ah + je 13f // jump if x is NaN + + cmpb $0x40, %ah + je 14f // jump if |x| == 1 + + shlb $1, %ah + xorb %ah, %dl + andl $2, %edx + fldl MOX(inf_zero, %edx, 4) + ret + + .align ALIGNARG(4) +14: fldl MO(infinity) + fmull MO(zero) // raise invalid exception + ret + + .align ALIGNARG(4) +13: fldl 4(%esp) // load x == NaN + ret + + .align ALIGNARG(4) + // x is ±inf +15: fstp %st(0) // y + testb $2, %dh + jz 16f // jump if x == +inf + + // We must find out whether y is an odd integer. + fld %st // y : y + fistpll (%esp) // y + fildll (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 17f + + // OK, the value is an integer, but is the number of bits small + // enough so that all are coming from the mantissa? + popl %eax + popl %edx + andb $1, %al + jz 18f // jump if not odd + movl %edx, %eax + orl %edx, %edx + jns 155f + negl %eax +155: cmpl $0x00200000, %eax + ja 18f // does not fit in mantissa bits + // It's an odd integer. + shrl $31, %edx + fldl MOX(minf_mzero, %edx, 8) + ret + + .align ALIGNARG(4) +16: fcompl MO(zero) + addl $8, %esp + fnstsw + shrl $5, %eax + andl $8, %eax + fldl MOX(inf_zero, %eax, 1) + ret + + .align ALIGNARG(4) +17: shll $30, %edx // sign bit for y in right position + addl $8, %esp +18: shrl $31, %edx + fldl MOX(inf_zero, %edx, 8) + ret + + .align ALIGNARG(4) + // x is ±0 +20: fstp %st(0) // y + testb $2, %dl + jz 21f // y > 0 + + // x is ±0 and y is < 0. We must find out whether y is an odd integer. + testb $2, %dh + jz 25f + + fld %st // y : y + fistpll (%esp) // y + fildll (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 26f + + // OK, the value is an integer, but is the number of bits small + // enough so that all are coming from the mantissa? + popl %eax + popl %edx + andb $1, %al + jz 27f // jump if not odd + cmpl $0xffe00000, %edx + jbe 27f // does not fit in mantissa bits + // It's an odd integer. + // Raise divide-by-zero exception and get minus infinity value. + fldl MO(one) + fdivl MO(zero) + fchs + ret + +25: fstp %st(0) +26: popl %eax + popl %edx +27: // Raise divide-by-zero exception and get infinity value. + fldl MO(one) + fdivl MO(zero) + ret + + .align ALIGNARG(4) + // x is ±0 and y is > 0. We must find out whether y is an odd integer. +21: testb $2, %dh + jz 22f + + fld %st // y : y + fistpll (%esp) // y + fildll (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 23f + + // OK, the value is an integer, but is the number of bits small + // enough so that all are coming from the mantissa? + popl %eax + popl %edx + andb $1, %al + jz 24f // jump if not odd + cmpl $0xffe00000, %edx + jae 24f // does not fit in mantissa bits + // It's an odd integer. + fldl MO(mzero) + ret + +22: fstp %st(0) +23: popl %eax + popl %edx +24: fldl MO(zero) + ret + +END(__ieee754_pow) diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S new file mode 100644 index 0000000000..d7342bf56f --- /dev/null +++ b/sysdeps/i386/fpu/e_powf.S @@ -0,0 +1,310 @@ +/* ix87 specific implementation of pow function. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(infinity,@object) +inf_zero: +infinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + ASM_SIZE_DIRECTIVE(infinity) + ASM_TYPE_DIRECTIVE(zero,@object) +zero: .double 0.0 + ASM_SIZE_DIRECTIVE(zero) + ASM_TYPE_DIRECTIVE(minf_mzero,@object) +minf_mzero: +minfinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff +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) + +#ifdef PIC +#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) +#endif + + .text +ENTRY(__ieee754_powf) + flds 8(%esp) // y + fxam + +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + + fnstsw + movb %ah, %dl + andb $0x45, %ah + cmpb $0x40, %ah // is y == 0 ? + je 11f + + cmpb $0x05, %ah // is y == ±inf ? + je 12f + + cmpb $0x01, %ah // is y == NaN ? + je 30f + + flds 4(%esp) // x : y + + subl $4, %esp + + fxam + fnstsw + movb %ah, %dh + andb $0x45, %ah + cmpb $0x40, %ah + je 20f // x is ±0 + + cmpb $0x05, %ah + je 15f // x is ±inf + + fxch // y : x + + /* First see whether `y' is a natural number. In this case we + can use a more precise algorithm. */ + fld %st // y : y : x + fistpl (%esp) // y : x + fildl (%esp) // int(y) : y : x + fucomp %st(1) // y : x + fnstsw + sahf + jne 2f + + /* OK, we have an integer value for y. */ + popl %edx + orl $0, %edx + fstp %st(0) // x + jns 4f // y >= 0, jump + fdivrl MO(one) // 1/x (now referred to as x) + negl %edx +4: fldl MO(one) // 1 : x + fxch + +6: shrl $1, %edx + jnc 5f + fxch + fmul %st(1) // x : ST*x + fxch +5: fmul %st(0), %st // x*x : ST*x + testl %edx, %edx + jnz 6b + fstp %st(0) // ST*x +30: ret + + .align ALIGNARG(4) +2: /* y is a real number. */ + fxch // x : y + fldl MO(one) // 1.0 : x : y + fld %st(1) // x : 1.0 : x : y + fsub %st(1) // x-1 : 1.0 : x : y + fabs // |x-1| : 1.0 : x : y + fcompl MO(limit) // 1.0 : x : y + fnstsw + fxch // x : 1.0 : y + sahf + ja 7f + fsub %st(1) // x-1 : 1.0 : y + fyl2xp1 // log2(x) : y + jmp 8f + +7: fyl2x // log2(x) : y +8: fmul %st(1) // y*log2(x) : y + fst %st(1) // y*log2(x) : y*log2(x) + frndint // int(y*log2(x)) : y*log2(x) + fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) + fxch // fract(y*log2(x)) : int(y*log2(x)) + f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) + faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) + fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) + addl $4, %esp + fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) + ret + + + // pow(x,±0) = 1 + .align ALIGNARG(4) +11: fstp %st(0) // pop y + fldl MO(one) + ret + + // y == ±inf + .align ALIGNARG(4) +12: fstp %st(0) // pop y + flds 4(%esp) // x + fabs + fcompl MO(one) // < 1, == 1, or > 1 + fnstsw + andb $0x45, %ah + cmpb $0x45, %ah + je 13f // jump if x is NaN + + cmpb $0x40, %ah + je 14f // jump if |x| == 1 + + shlb $1, %ah + xorb %ah, %dl + andl $2, %edx + fldl MOX(inf_zero, %edx, 4) + ret + + .align ALIGNARG(4) +14: fldl MO(infinity) + fmull MO(zero) // raise invalid exception + ret + + .align ALIGNARG(4) +13: flds 4(%esp) // load x == NaN + ret + + .align ALIGNARG(4) + // x is ±inf +15: fstp %st(0) // y + testb $2, %dh + jz 16f // jump if x == +inf + + // We must find out whether y is an odd integer. + fld %st // y : y + fistpl (%esp) // y + fildl (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 17f + + // OK, the value is an integer, but is the number of bits small + // enough so that all are coming from the mantissa? + popl %edx + testb $1, %dl + jz 18f // jump if not odd + movl %edx, %eax + orl %edx, %edx + jns 155f + negl %eax +155: cmpl $0x01000000, %eax + ja 18f // does not fit in mantissa bits + // It's an odd integer. + shrl $31, %edx + fldl MOX(minf_mzero, %edx, 8) + ret + + .align ALIGNARG(4) +16: fcompl MO(zero) + addl $4, %esp + fnstsw + shrl $5, %eax + andl $8, %eax + fldl MOX(inf_zero, %eax, 1) + ret + + .align ALIGNARG(4) +17: shll $30, %edx // sign bit for y in right position + addl $4, %esp +18: shrl $31, %edx + fldl MOX(inf_zero, %edx, 8) + ret + + .align ALIGNARG(4) + // x is ±0 +20: fstp %st(0) // y + testb $2, %dl + jz 21f // y > 0 + + // x is ±0 and y is < 0. We must find out whether y is an odd integer. + testb $2, %dh + jz 25f + + fld %st // y : y + fistpl (%esp) // y + fildl (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 26f + + // OK, the value is an integer, but is the number of bits small + // enough so that all are coming from the mantissa? + popl %edx + testb $1, %dl + jz 27f // jump if not odd + cmpl $0xff000000, %edx + jbe 27f // does not fit in mantissa bits + // It's an odd integer. + // Raise divide-by-zero exception and get minus infinity value. + fldl MO(one) + fdivl MO(zero) + fchs + ret + +25: fstp %st(0) +26: popl %eax +27: // Raise divide-by-zero exception and get infinity value. + fldl MO(one) + fdivl MO(zero) + ret + + .align ALIGNARG(4) + // x is ±0 and y is > 0. We must find out whether y is an odd integer. +21: testb $2, %dh + jz 22f + + fld %st // y : y + fistpl (%esp) // y + fildl (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 23f + + // OK, the value is an integer, but is the number of bits small + // enough so that all are coming from the mantissa? + popl %edx + testb $1, %dl + jz 24f // jump if not odd + cmpl $0xff000000, %edx + jae 24f // does not fit in mantissa bits + // It's an odd integer. + fldl MO(mzero) + ret + +22: fstp %st(0) +23: popl %eax +24: fldl MO(zero) + ret + +END(__ieee754_powf) diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S new file mode 100644 index 0000000000..2e09dcc820 --- /dev/null +++ b/sysdeps/i386/fpu/e_powl.S @@ -0,0 +1,307 @@ +/* ix87 specific implementation of pow function. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(infinity,@object) +inf_zero: +infinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + ASM_SIZE_DIRECTIVE(infinity) + ASM_TYPE_DIRECTIVE(zero,@object) +zero: .double 0.0 + ASM_SIZE_DIRECTIVE(zero) + ASM_TYPE_DIRECTIVE(minf_mzero,@object) +minf_mzero: +minfinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff +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) + +#ifdef PIC +#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) +#endif + + .text +ENTRY(__ieee754_powl) + fldt 16(%esp) // y + fxam + +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + + fnstsw + movb %ah, %dl + andb $0x45, %ah + cmpb $0x40, %ah // is y == 0 ? + je 11f + + cmpb $0x05, %ah // is y == ±inf ? + je 12f + + cmpb $0x01, %ah // is y == NaN ? + je 30f + + fldt 4(%esp) // x : y + + subl $8,%esp + + fxam + fnstsw + movb %ah, %dh + andb $0x45, %ah + cmpb $0x40, %ah + je 20f // x is ±0 + + cmpb $0x05, %ah + je 15f // x is ±inf + + fxch // y : x + + /* First see whether `y' is a natural number. In this case we + can use a more precise algorithm. */ + fld %st // y : y : x + fistpll (%esp) // y : x + fildll (%esp) // int(y) : y : x + fucomp %st(1) // y : x + fnstsw + sahf + jne 2f + + /* OK, we have an integer value for y. */ + popl %eax + popl %edx + orl $0, %edx + fstp %st(0) // x + jns 4f // y >= 0, jump + fdivrl MO(one) // 1/x (now referred to as x) + negl %eax + adcl $0, %edx + negl %edx +4: fldl MO(one) // 1 : x + fxch + +6: shrdl $1, %edx, %eax + jnc 5f + fxch + fmul %st(1) // x : ST*x + fxch +5: fmul %st(0), %st // x*x : ST*x + shrl $1, %edx + movl %eax, %ecx + orl %edx, %ecx + jnz 6b + fstp %st(0) // ST*x +30: ret + + .align ALIGNARG(4) +2: /* y is a real number. */ + fxch // x : y + fldl MO(one) // 1.0 : x : y + fld %st(1) // x : 1.0 : x : y + fsub %st(1) // x-1 : 1.0 : x : y + fabs // |x-1| : 1.0 : x : y + fcompl MO(limit) // 1.0 : x : y + fnstsw + fxch // x : 1.0 : y + sahf + ja 7f + fsub %st(1) // x-1 : 1.0 : y + fyl2xp1 // log2(x) : y + jmp 8f + +7: fyl2x // log2(x) : y +8: fmul %st(1) // y*log2(x) : y + fst %st(1) // y*log2(x) : y*log2(x) + frndint // int(y*log2(x)) : y*log2(x) + fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) + fxch // fract(y*log2(x)) : int(y*log2(x)) + f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) + faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) + fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) + addl $8, %esp + fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) + ret + + + // pow(x,±0) = 1 + .align ALIGNARG(4) +11: fstp %st(0) // pop y + fldl MO(one) + ret + + // y == ±inf + .align ALIGNARG(4) +12: fstp %st(0) // pop y + fldt 4(%esp) // x + fabs + fcompl MO(one) // < 1, == 1, or > 1 + fnstsw + andb $0x45, %ah + cmpb $0x45, %ah + je 13f // jump if x is NaN + + cmpb $0x40, %ah + je 14f // jump if |x| == 1 + + shlb $1, %ah + xorb %ah, %dl + andl $2, %edx + fldl MOX(inf_zero, %edx, 4) + ret + + .align ALIGNARG(4) +14: fldl MO(infinity) + fmull MO(zero) // raise invalid exception + ret + + .align ALIGNARG(4) +13: fldt 4(%esp) // load x == NaN + ret + + .align ALIGNARG(4) + // x is ±inf +15: fstp %st(0) // y + testb $2, %dh + jz 16f // jump if x == +inf + + // We must find out whether y is an odd integer. + fld %st // y : y + fistpll (%esp) // y + fildll (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 17f + + // OK, the value is an integer, but is it odd? + popl %eax + popl %edx + andb $1, %al + jz 18f // jump if not odd + // It's an odd integer. + shrl $31, %edx + fldl MOX(minf_mzero, %edx, 8) + ret + + .align ALIGNARG(4) +16: fcompl MO(zero) + addl $8, %esp + fnstsw + shrl $5, %eax + andl $8, %eax + fldl MOX(inf_zero, %eax, 1) + ret + + .align ALIGNARG(4) +17: shll $30, %edx // sign bit for y in right position + addl $8, %esp +18: shrl $31, %edx + fldl MOX(inf_zero, %edx, 8) + ret + + .align ALIGNARG(4) + // x is ±0 +20: fstp %st(0) // y + testb $2, %dl + jz 21f // y > 0 + + // x is ±0 and y is < 0. We must find out whether y is an odd integer. + testb $2, %dh + jz 25f + + fld %st // y : y + fistpll (%esp) // y + fildll (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 26f + + // OK, the value is an integer, but is it odd? + popl %eax + popl %edx + andb $1, %al + jz 27f // jump if not odd + // It's an odd integer. + // Raise divide-by-zero exception and get minus infinity value. + fldl MO(one) + fdivl MO(zero) + fchs + ret + +25: fstp %st(0) +26: popl %eax + popl %edx +27: // Raise divide-by-zero exception and get infinity value. + fldl MO(one) + fdivl MO(zero) + ret + + .align ALIGNARG(4) + // x is ±0 and y is > 0. We must find out whether y is an odd integer. +21: testb $2, %dh + jz 22f + + fld %st // y : y + fistpll (%esp) // y + fildll (%esp) // int(y) : y + fucompp // + fnstsw + sahf + jne 23f + + // OK, the value is an integer, but is it odd? + popl %eax + popl %edx + andb $1, %al + jz 24f // jump if not odd + // It's an odd integer. + fldl MO(mzero) + ret + +22: fstp %st(0) +23: popl %eax + popl %edx +24: fldl MO(zero) + ret + +END(__ieee754_powl) diff --git a/sysdeps/i386/fpu/e_rem_pio2.c b/sysdeps/i386/fpu/e_rem_pio2.c new file mode 100644 index 0000000000..1347b0468c --- /dev/null +++ b/sysdeps/i386/fpu/e_rem_pio2.c @@ -0,0 +1,3 @@ +/* Empty. This file is only meant to avoid compiling the file with the + same name in the libm-ieee754 directory. The code is not used since + there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/e_rem_pio2f.c b/sysdeps/i386/fpu/e_rem_pio2f.c new file mode 100644 index 0000000000..1347b0468c --- /dev/null +++ b/sysdeps/i386/fpu/e_rem_pio2f.c @@ -0,0 +1,3 @@ +/* Empty. This file is only meant to avoid compiling the file with the + same name in the libm-ieee754 directory. The code is not used since + there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/e_rem_pio2l.c b/sysdeps/i386/fpu/e_rem_pio2l.c new file mode 100644 index 0000000000..1347b0468c --- /dev/null +++ b/sysdeps/i386/fpu/e_rem_pio2l.c @@ -0,0 +1,3 @@ +/* Empty. This file is only meant to avoid compiling the file with the + same name in the libm-ieee754 directory. The code is not used since + there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/e_remainder.S b/sysdeps/i386/fpu/e_remainder.S new file mode 100644 index 0000000000..2f43cb894c --- /dev/null +++ b/sysdeps/i386/fpu/e_remainder.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +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) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret +END (__ieee754_remainder) diff --git a/sysdeps/i386/fpu/e_remainderf.S b/sysdeps/i386/fpu/e_remainderf.S new file mode 100644 index 0000000000..79f821993b --- /dev/null +++ b/sysdeps/i386/fpu/e_remainderf.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +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) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret +END (__ieee754_remainderf) diff --git a/sysdeps/i386/fpu/e_remainderl.S b/sysdeps/i386/fpu/e_remainderl.S new file mode 100644 index 0000000000..5f50b626a2 --- /dev/null +++ b/sysdeps/i386/fpu/e_remainderl.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_remainderl) + fldt 16(%esp) + fldt 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret +END (__ieee754_remainderl) diff --git a/sysdeps/i386/fpu/e_scalb.S b/sysdeps/i386/fpu/e_scalb.S new file mode 100644 index 0000000000..7ff5541e2f --- /dev/null +++ b/sysdeps/i386/fpu/e_scalb.S @@ -0,0 +1,94 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Correct handling of y==-inf + */ + +#include + +RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(zero_nan,@object) +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) +#else +#define MO(op) op +#define MOX(op,x,f) op(,x,f) +#endif + + .text +ENTRY(__ieee754_scalb) + fldl 12(%esp) + fxam + fnstsw + fldl 4(%esp) + andl $0x4700, %eax + cmpl $0x0700, %eax + je 1f + andl $0x4500, %eax + cmpl $0x0100, %eax + je 2f + fxam + fnstsw + andl $0x4500, %eax + cmpl $0x0100, %eax + je 2f + fld %st(1) + frndint + fcomp %st(2) + fnstsw + sahf + jne 2f + fscale + fstp %st(1) + ret + + /* y is -inf */ +1: fxam +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + fnstsw + movl 8(%esp), %edx + shrl $5, %eax + fstp %st + fstp %st + andl $0x80000000, %edx + andl $8, %eax + shrl $27, %edx + addl %edx, %eax + fldl MOX(zero_nan, %eax, 1) + ret + + /* The result is NaN, but we must not raise an exception. + So use a variable. */ +2: fstp %st + fstp %st +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + fldl MO(nan) + ret +END(__ieee754_scalb) diff --git a/sysdeps/i386/fpu/e_scalbf.S b/sysdeps/i386/fpu/e_scalbf.S new file mode 100644 index 0000000000..4222eecc97 --- /dev/null +++ b/sysdeps/i386/fpu/e_scalbf.S @@ -0,0 +1,96 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * Adapted for float type by Ulrich Drepper . + * + * Correct handling of y==-inf + */ + +#include + +RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(zero_nan,@object) +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) +#else +#define MO(op) op +#define MOX(op,x,f) op(,x,f) +#endif + + + .text +ENTRY(__ieee754_scalbf) + flds 8(%esp) + fxam + fnstsw + flds 4(%esp) + andl $0x4700, %eax + cmpl $0x0700, %eax + je 1f + andl $0x4500, %eax + cmpl $0x0100, %eax + je 2f + fxam + fnstsw + andl $0x4500, %eax + cmpl $0x0100, %eax + je 2f + fld %st(1) + frndint + fcomp %st(2) + fnstsw + sahf + jne 2f + fscale + fstp %st(1) + ret + + /* y is -inf */ +1: fxam +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + fnstsw + movl 4(%esp), %edx + shrl $5, %eax + fstp %st + fstp %st + andl $0x80000000, %edx + andl $8, %eax + shrl $27, %edx + addl %edx, %eax + fldl MOX(zero_nan, %eax, 1) + ret + + /* The result is NaN, but we must not raise an exception. + So use a variable. */ +2: fstp %st + fstp %st +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + fldl MO(nan) + ret +END(__ieee754_scalbf) diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S new file mode 100644 index 0000000000..56cc833a56 --- /dev/null +++ b/sysdeps/i386/fpu/e_scalbl.S @@ -0,0 +1,96 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + * + * Correct handling of y==-inf + */ + +#include + +RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(zero_nan,@object) +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) +#else +#define MO(op) op +#define MOX(op,x,f) op(,x,f) +#endif + + .text +ENTRY(__ieee754_scalbl) + fldt 16(%esp) + fxam + fnstsw + fldt 4(%esp) + andl $0x4700, %eax + cmpl $0x0700, %eax + je 1f + andl $0x4500, %eax + cmpl $0x0100, %eax + je 2f + fxam + fnstsw + andl $0x4500, %eax + cmpl $0x0100, %eax + je 2f + fld %st(1) + frndint + fcomp %st(2) + fnstsw + sahf + jne 2f + fscale + fstp %st(1) + ret + + /* y is -inf */ +1: fxam +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + fnstsw + movl 12(%esp), %edx + shrl $5, %eax + fstp %st + fstp %st + andl $0x8000, %edx + andl $8, %eax + shrl $11, %edx + addl %edx, %eax + fldl MOX(zero_nan, %eax, 1) + ret + + /* The result is NaN, but we must not raise an exception. + So use a variable. */ +2: fstp %st + fstp %st +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + fldl MO(nan) + ret +END(__ieee754_scalbl) diff --git a/sysdeps/i386/fpu/e_sqrt.S b/sysdeps/i386/fpu/e_sqrt.S new file mode 100644 index 0000000000..6f253d51aa --- /dev/null +++ b/sysdeps/i386/fpu/e_sqrt.S @@ -0,0 +1,14 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +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) diff --git a/sysdeps/i386/fpu/e_sqrtf.S b/sysdeps/i386/fpu/e_sqrtf.S new file mode 100644 index 0000000000..5ce1ad0544 --- /dev/null +++ b/sysdeps/i386/fpu/e_sqrtf.S @@ -0,0 +1,14 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +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) diff --git a/sysdeps/i386/fpu/e_sqrtl.S b/sysdeps/i386/fpu/e_sqrtl.S new file mode 100644 index 0000000000..d47aae5cb5 --- /dev/null +++ b/sysdeps/i386/fpu/e_sqrtl.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_sqrtl) + fldt 4(%esp) + fsqrt + ret +END (__ieee754_sqrtl) diff --git a/sysdeps/i386/fpu/k_rem_pio2.c b/sysdeps/i386/fpu/k_rem_pio2.c new file mode 100644 index 0000000000..1347b0468c --- /dev/null +++ b/sysdeps/i386/fpu/k_rem_pio2.c @@ -0,0 +1,3 @@ +/* Empty. This file is only meant to avoid compiling the file with the + same name in the libm-ieee754 directory. The code is not used since + there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/k_rem_pio2f.c b/sysdeps/i386/fpu/k_rem_pio2f.c new file mode 100644 index 0000000000..1347b0468c --- /dev/null +++ b/sysdeps/i386/fpu/k_rem_pio2f.c @@ -0,0 +1,3 @@ +/* Empty. This file is only meant to avoid compiling the file with the + same name in the libm-ieee754 directory. The code is not used since + there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/k_rem_pio2l.c b/sysdeps/i386/fpu/k_rem_pio2l.c new file mode 100644 index 0000000000..1347b0468c --- /dev/null +++ b/sysdeps/i386/fpu/k_rem_pio2l.c @@ -0,0 +1,3 @@ +/* Empty. This file is only meant to avoid compiling the file with the + same name in the libm-ieee754 directory. The code is not used since + there is an assembler version for all users of this file. */ diff --git a/sysdeps/i386/fpu/s_asinh.S b/sysdeps/i386/fpu/s_asinh.S new file mode 100644 index 0000000000..a4c52cb67c --- /dev/null +++ b/sysdeps/i386/fpu/s_asinh.S @@ -0,0 +1,139 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .double 1e+300 + ASM_SIZE_DIRECTIVE(huge) + 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) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinh) + movl 8(%esp), %ecx + movl $0x7fffffff, %eax + andl %ecx, %eax + andl $0x80000000, %ecx + movl %eax, %edx + orl $0x800fffff, %edx + incl %edx + jz 7f // x in ±Inf or NaN + xorl %ecx, 8(%esp) + fldl 4(%esp) // |x| + cmpl $0x3e300000, %eax + jb 2f // |x| < 2^-28 + fldln2 // log(2) : |x| + cmpl $0x41b00000, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^28 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %eax + ja 5f // |x| > 2 + + // 2^-28 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +7: fldl 4(%esp) + ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-28 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + faddl MO(huge) // huge+x : x + fstp %st(0) // x + ret + + // |x| > 2^28 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinh) +weak_alias (__asinh, asinh) diff --git a/sysdeps/i386/fpu/s_asinhf.S b/sysdeps/i386/fpu/s_asinhf.S new file mode 100644 index 0000000000..a6925c7b4c --- /dev/null +++ b/sysdeps/i386/fpu/s_asinhf.S @@ -0,0 +1,139 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .double 1e+36 + ASM_SIZE_DIRECTIVE(huge) + 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) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinhf) + movl 4(%esp), %ecx + movl $0x7fffffff, %eax + andl %ecx, %eax + andl $0x80000000, %ecx + movl %eax, %edx + orl $0x807fffff, %edx + incl %edx + jz 7f // x in ±Inf or NaN + xorl %ecx, 4(%esp) + flds 4(%esp) // |x| + cmpl $0x38000000, %eax + jb 2f // |x| < 2^-14 + fldln2 // log(2) : |x| + cmpl $0x47000000, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^14 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %eax + ja 5f // |x| > 2 + + // 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +7: flds 4(%esp) + ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-14 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + faddl MO(huge) // huge+x : x + fstp %st(0) // x + ret + + // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinhf) +weak_alias (__asinhf, asinhf) diff --git a/sysdeps/i386/fpu/s_asinhl.S b/sysdeps/i386/fpu/s_asinhl.S new file mode 100644 index 0000000000..62e29bc58e --- /dev/null +++ b/sysdeps/i386/fpu/s_asinhl.S @@ -0,0 +1,147 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .tfloat 1e+4930 + ASM_SIZE_DIRECTIVE(huge) + .align ALIGNARG(4) + /* 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. */ + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinhl) + movl 12(%esp), %ecx + movl $0x7fff, %eax + andl %ecx, %eax + andl $0x8000, %ecx + movl %eax, %edx + orl $0xffff8000, %edx + incl %edx + jz 7f // x in ±Inf or NaN + xorl %ecx, 12(%esp) + fldt 4(%esp) // |x| + cmpl $0x3fde, %eax + jb 2f // |x| < 2^-34 + fldln2 // log(2) : |x| + cmpl $0x4020, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^34 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x4000, %eax + ja 5f // |x| > 2 + + // 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +7: fldt 4(%esp) + ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-34 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + fldt MO(huge) // huge : x : x + faddp // huge+x : x + fstp %st(0) // x + ret + + // |x| > 2^34 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinhl) +weak_alias (__asinhl, asinhl) diff --git a/sysdeps/i386/fpu/s_atan.S b/sysdeps/i386/fpu/s_atan.S new file mode 100644 index 0000000000..7502f6d828 --- /dev/null +++ b/sysdeps/i386/fpu/s_atan.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_atan.S,v 1.4 1995/05/08 23:50:41 jtc Exp $") + +ENTRY(__atan) + fldl 4(%esp) + fld1 + fpatan + ret +END (__atan) +weak_alias (__atan, atan) diff --git a/sysdeps/i386/fpu/s_atanf.S b/sysdeps/i386/fpu/s_atanf.S new file mode 100644 index 0000000000..70232c8240 --- /dev/null +++ b/sysdeps/i386/fpu/s_atanf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_atanf.S,v 1.3 1995/05/08 23:51:33 jtc Exp $") + +ENTRY(__atanf) + flds 4(%esp) + fld1 + fpatan + ret +END (__atanf) +weak_alias (__atanf, atanf) diff --git a/sysdeps/i386/fpu/s_atanl.S b/sysdeps/i386/fpu/s_atanl.S new file mode 100644 index 0000000000..8b07272764 --- /dev/null +++ b/sysdeps/i386/fpu/s_atanl.S @@ -0,0 +1,18 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__atanl) + fldt 4(%esp) + fld1 + fpatan + ret +END (__atanl) +weak_alias (__atanl, atanl) diff --git a/sysdeps/i386/fpu/s_cbrt.S b/sysdeps/i386/fpu/s_cbrt.S new file mode 100644 index 0000000000..3f6a0174f2 --- /dev/null +++ b/sysdeps/i386/fpu/s_cbrt.S @@ -0,0 +1,201 @@ +/* Compute cubic root of double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Dirk Alboth and + Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f7,@object) +f7: .double -0.145263899385486377 + ASM_SIZE_DIRECTIVE(f7) + ASM_TYPE_DIRECTIVE(f6,@object) +f6: .double 0.784932344976639262 + ASM_SIZE_DIRECTIVE(f6) + ASM_TYPE_DIRECTIVE(f5,@object) +f5: .double -1.83469277483613086 + ASM_SIZE_DIRECTIVE(f5) + ASM_TYPE_DIRECTIVE(f4,@object) +f4: .double 2.44693122563534430 + ASM_SIZE_DIRECTIVE(f4) + ASM_TYPE_DIRECTIVE(f3,@object) +f3: .double -2.11499494167371287 + ASM_SIZE_DIRECTIVE(f3) + ASM_TYPE_DIRECTIVE(f2,@object) +f2: .double 1.50819193781584896 + ASM_SIZE_DIRECTIVE(f2) + ASM_TYPE_DIRECTIVE(f1,@object) +f1: .double 0.354895765043919860 + ASM_SIZE_DIRECTIVE(f1) + +#define CBRT2 1.2599210498948731648 +#define ONE_CBRT2 0.793700525984099737355196796584 +#define SQR_CBRT2 1.5874010519681994748 +#define ONE_SQR_CBRT2 0.629960524947436582364439673883 + + ASM_TYPE_DIRECTIVE(factor,@object) +factor: .double ONE_SQR_CBRT2 + .double ONE_CBRT2 + .double 1.0 + .double CBRT2 + .double SQR_CBRT2 + ASM_SIZE_DIRECTIVE(factor) + + ASM_TYPE_DIRECTIVE(two54,@object) +two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43 + ASM_SIZE_DIRECTIVE(two54) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%ebx) +#define MOX(op,x) op##@GOTOFF(%ebx,x,1) +#else +#define MO(op) op +#define MOX(op,x) op(x) +#endif + + .text +ENTRY(__cbrt) + movl 4(%esp), %ecx + movl 8(%esp), %eax + movl %eax, %edx + andl $0x7fffffff, %eax + orl %eax, %ecx + jz 1f + xorl %ecx, %ecx + cmpl $0x7ff00000, %eax + jae 1f + +#ifdef PIC + pushl %ebx + call 3f +3: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx +#endif + + cmpl $0x00100000, %eax + jae 2f + +#ifdef PIC + fldl 8(%esp) +#else + fldl 4(%esp) +#endif + fmull MO(two54) + movl $-54, %ecx +#ifdef PIC + fstpl 8(%esp) + movl 12(%esp), %eax +#else + fstpl 4(%esp) + movl 8(%esp), %eax +#endif + movl %eax, %edx + andl $0x7fffffff, %eax + +2: shrl $20, %eax + andl $0x800fffff, %edx + subl $1022, %eax + orl $0x3fe00000, %edx + addl %eax, %ecx +#ifdef PIC + movl %edx, 12(%esp) + + fldl 8(%esp) /* xm */ +#else + movl %edx, 8(%esp) + + fldl 4(%esp) /* xm */ +#endif + fabs + + /* The following code has two tracks: + a) compute the normalized cbrt value + b) compute xe/3 and xe%3 + The right track computes the value for b) and this is done + in an optimized way by avoiding division. + + But why two tracks at all? Very easy: efficiency. Some FP + instruction can overlap with a certain amount of integer (and + FP) instructions. So we get (except for the imull) all + instructions for free. */ + + fld %st(0) /* xm : xm */ + + fmull MO(f7) /* f7*xm : xm */ + movl $1431655766, %eax + faddl MO(f6) /* f6+f7*xm : xm */ + imull %ecx + fmul %st(1) /* (f6+f7*xm)*xm : xm */ + movl %ecx, %eax + faddl MO(f5) /* f5+(f6+f7*xm)*xm : xm */ + sarl $31, %eax + fmul %st(1) /* (f5+(f6+f7*xm)*xm)*xm : xm */ + subl %eax, %edx + faddl MO(f4) /* f4+(f5+(f6+f7*xm)*xm)*xm : xm */ + fmul %st(1) /* (f4+(f5+(f6+f7*xm)*xm)*xm)*xm : xm */ + faddl MO(f3) /* f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm : xm */ + fmul %st(1) /* (f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm : xm */ + faddl MO(f2) /* f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm : xm */ + fmul %st(1) /* (f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm)*xm : xm */ + faddl MO(f1) /* u:=f1+(f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm)*xm : xm */ + + fld %st /* u : u : xm */ + fmul %st(1) /* u*u : u : xm */ + fld %st(2) /* xm : u*u : u : xm */ + fadd %st /* 2*xm : u*u : u : xm */ + fxch %st(1) /* u*u : 2*xm : u : xm */ + fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */ + movl %edx, %eax + fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */ + leal (%edx,%edx,2),%edx + fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */ + subl %edx, %ecx + faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */ + shll $3, %ecx + fmulp /* u*(t2+2*xm) : 2*t2+xm */ + fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ + fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */ + pushl %eax + fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ + fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ + fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ + popl %edx +#ifdef PIC + movl 12(%esp), %eax + popl %ebx +#else + movl 8(%esp), %eax +#endif + testl %eax, %eax + fstp %st(1) + jns 4f + fchs +4: ret + + /* Return the argument. */ +1: fldl 4(%esp) + ret +END(__cbrt) +weak_alias (__cbrt, cbrt) diff --git a/sysdeps/i386/fpu/s_cbrtf.S b/sysdeps/i386/fpu/s_cbrtf.S new file mode 100644 index 0000000000..a14e04ed2f --- /dev/null +++ b/sysdeps/i386/fpu/s_cbrtf.S @@ -0,0 +1,178 @@ +/* Compute cubic root of float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Dirk Alboth and + Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f3,@object) +f3: .double 0.191502161678719066 + ASM_SIZE_DIRECTIVE(f3) + ASM_TYPE_DIRECTIVE(f2,@object) +f2: .double 0.697570460207922770 + ASM_SIZE_DIRECTIVE(f2) + ASM_TYPE_DIRECTIVE(f1,@object) +f1: .double 0.492659620528969547 + ASM_SIZE_DIRECTIVE(f1) + +#define CBRT2 1.2599210498948731648 +#define ONE_CBRT2 0.793700525984099737355196796584 +#define SQR_CBRT2 1.5874010519681994748 +#define ONE_SQR_CBRT2 0.629960524947436582364439673883 + + ASM_TYPE_DIRECTIVE(factor,@object) + .align ALIGNARG(4) +factor: .double ONE_SQR_CBRT2 + .double ONE_CBRT2 + .double 1.0 + .double CBRT2 + .double SQR_CBRT2 + ASM_SIZE_DIRECTIVE(factor) + + ASM_TYPE_DIRECTIVE(two25,@object) +two25: .byte 0, 0, 0, 0x4c + ASM_SIZE_DIRECTIVE(two25) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%ebx) +#define MOX(op,x) op##@GOTOFF(%ebx,x,1) +#else +#define MO(op) op +#define MOX(op,x) op(x) +#endif + + .text +ENTRY(__cbrtf) + movl 4(%esp), %eax + xorl %ecx, %ecx + movl %eax, %edx + andl $0x7fffffff, %eax + jz 1f + cmpl $0x7f800000, %eax + jae 1f + +#ifdef PIC + pushl %ebx + call 3f +3: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx +#endif + + cmpl $0x00800000, %eax + jae 2f + +#ifdef PIC + flds 8(%esp) +#else + flds 4(%esp) +#endif + fmuls MO(two25) + movl $-25, %ecx +#ifdef PIC + fstps 8(%esp) + movl 8(%esp), %eax +#else + fstps 4(%esp) + movl 4(%esp), %eax +#endif + movl %eax, %edx + andl $0x7fffffff, %eax + +2: shrl $23, %eax + andl $0x807fffff, %edx + subl $126, %eax + orl $0x3f000000, %edx + addl %eax, %ecx +#ifdef PIC + movl %edx, 8(%esp) + + flds 8(%esp) /* xm */ +#else + movl %edx, 4(%esp) + + flds 4(%esp) /* xm */ +#endif + fabs + + /* The following code has two tracks: + a) compute the normalized cbrt value + b) compute xe/3 and xe%3 + The right track computes the value for b) and this is done + in an optimized way by avoiding division. + + But why two tracks at all? Very easy: efficiency. Some FP + instruction can overlap with a certain amount of integer (and + FP) instructions. So we get (except for the imull) all + instructions for free. */ + + fld %st(0) /* xm : xm */ + fmull MO(f3) /* f3*xm : xm */ + movl $1431655766, %eax + fsubrl MO(f2) /* f2-f3*xm : xm */ + imull %ecx + fmul %st(1) /* (f2-f3*xm)*xm : xm */ + movl %ecx, %eax + faddl MO(f1) /* u:=f1+(f2-f3*xm)*xm : xm */ + sarl $31, %eax + fld %st /* u : u : xm */ + subl %eax, %edx + fmul %st(1) /* u*u : u : xm */ + fld %st(2) /* xm : u*u : u : xm */ + fadd %st /* 2*xm : u*u : u : xm */ + fxch %st(1) /* u*u : 2*xm : u : xm */ + fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */ + movl %edx, %eax + fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */ + leal (%edx,%edx,2),%edx + fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */ + subl %edx, %ecx + faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */ + shll $3, %ecx + fmulp /* u*(t2+2*xm) : 2*t2+xm */ + fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ + fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */ + pushl %eax + fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ + fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ + fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ + popl %edx +#ifdef PIC + movl 8(%esp), %eax + popl %ebx +#else + movl 4(%esp), %eax +#endif + testl %eax, %eax + fstp %st(1) + jns 4f + fchs +4: ret + + /* Return the argument. */ +1: flds 4(%esp) + ret +END(__cbrtf) +weak_alias (__cbrtf, cbrtf) diff --git a/sysdeps/i386/fpu/s_cbrtl.S b/sysdeps/i386/fpu/s_cbrtl.S new file mode 100644 index 0000000000..6a3b9a8dc5 --- /dev/null +++ b/sysdeps/i386/fpu/s_cbrtl.S @@ -0,0 +1,229 @@ +/* Compute cubic root of long double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Dirk Alboth and + Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f8,@object) +f8: .tfloat 0.161617097923756032 + ASM_SIZE_DIRECTIVE(f8) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f7,@object) +f7: .tfloat -0.988553671195413709 + ASM_SIZE_DIRECTIVE(f7) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f6,@object) +f6: .tfloat 2.65298938441952296 + ASM_SIZE_DIRECTIVE(f6) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f5,@object) +f5: .tfloat -4.11151425200350531 + ASM_SIZE_DIRECTIVE(f5) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f4,@object) +f4: .tfloat 4.09559907378707839 + ASM_SIZE_DIRECTIVE(f4) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f3,@object) +f3: .tfloat -2.82414939754975962 + ASM_SIZE_DIRECTIVE(f3) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f2,@object) +f2: .tfloat 1.67595307700780102 + ASM_SIZE_DIRECTIVE(f2) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(f1,@object) +f1: .tfloat 0.338058687610520237 + ASM_SIZE_DIRECTIVE(f1) + +#define CBRT2 1.2599210498948731648 +#define ONE_CBRT2 0.793700525984099737355196796584 +#define SQR_CBRT2 1.5874010519681994748 +#define ONE_SQR_CBRT2 0.629960524947436582364439673883 + + /* We make the entries in the following table all 16 bytes + wide to avoid having to implement a multiplication by 10. */ + ASM_TYPE_DIRECTIVE(factor,@object) + .align ALIGNARG(4) +factor: .tfloat ONE_SQR_CBRT2 + .byte 0, 0, 0, 0, 0, 0 + .tfloat ONE_CBRT2 + .byte 0, 0, 0, 0, 0, 0 + .tfloat 1.0 + .byte 0, 0, 0, 0, 0, 0 + .tfloat CBRT2 + .byte 0, 0, 0, 0, 0, 0 + .tfloat SQR_CBRT2 + ASM_SIZE_DIRECTIVE(factor) + + ASM_TYPE_DIRECTIVE(two64,@object) + .align ALIGNARG(4) +two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43 + ASM_SIZE_DIRECTIVE(two64) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%ebx) +#define MOX(op,x) op##@GOTOFF(%ebx,x,1) +#else +#define MO(op) op +#define MOX(op,x) op(x) +#endif + + .text +ENTRY(__cbrtl) + movl 4(%esp), %ecx + movl 12(%esp), %eax + orl 8(%esp), %ecx + movl %eax, %edx + andl $0x7fff, %eax + orl %eax, %ecx + jz 1f + xorl %ecx, %ecx + cmpl $0x7fff, %eax + je 1f + +#ifdef PIC + pushl %ebx + call 3f +3: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx +#endif + + cmpl $0, %eax + jne 2f + +#ifdef PIC + fldt 8(%esp) +#else + fldt 4(%esp) +#endif + fmull MO(two64) + movl $-64, %ecx +#ifdef PIC + fstpt 8(%esp) + movl 16(%esp), %eax +#else + fstpt 4(%esp) + movl 12(%esp), %eax +#endif + movl %eax, %edx + andl $0x7fff, %eax + +2: andl $0x8000, %edx + subl $16382, %eax + orl $0x3ffe, %edx + addl %eax, %ecx +#ifdef PIC + movl %edx, 16(%esp) + + fldt 8(%esp) /* xm */ +#else + movl %edx, 12(%esp) + + fldt 4(%esp) /* xm */ +#endif + fabs + + /* The following code has two tracks: + a) compute the normalized cbrt value + b) compute xe/3 and xe%3 + The right track computes the value for b) and this is done + in an optimized way by avoiding division. + + But why two tracks at all? Very easy: efficiency. Some FP + instruction can overlap with a certain amount of integer (and + FP) instructions. So we get (except for the imull) all + instructions for free. */ + + fldt MO(f8) /* f8 : xm */ + fmul %st(1) /* f8*xm : xm */ + + fldt MO(f7) + faddp /* f7+f8*xm : xm */ + fmul %st(1) /* (f7+f8*xm)*xm : xm */ + movl $1431655766, %eax + fldt MO(f6) + faddp /* f6+(f7+f8*xm)*xm : xm */ + imull %ecx + fmul %st(1) /* (f6+(f7+f8*xm)*xm)*xm : xm */ + movl %ecx, %eax + fldt MO(f5) + faddp /* f5+(f6+(f7+f8*xm)*xm)*xm : xm */ + sarl $31, %eax + fmul %st(1) /* (f5+(f6+(f7+f8*xm)*xm)*xm)*xm : xm */ + subl %eax, %edx + fldt MO(f4) + faddp /* f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm : xm */ + fmul %st(1) /* (f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm : xm */ + fldt MO(f3) + faddp /* f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm : xm */ + fmul %st(1) /* (f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm : xm */ + fldt MO(f2) + faddp /* f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm : xm */ + fmul %st(1) /* (f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm)*xm : xm */ + fldt MO(f1) + faddp /* u:=f1+(f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm)*xm : xm */ + + fld %st /* u : u : xm */ + fmul %st(1) /* u*u : u : xm */ + fld %st(2) /* xm : u*u : u : xm */ + fadd %st /* 2*xm : u*u : u : xm */ + fxch %st(1) /* u*u : 2*xm : u : xm */ + fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */ + movl %edx, %eax + fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */ + leal (%edx,%edx,2),%edx + fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */ + subl %edx, %ecx + faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */ + shll $4, %ecx + fmulp /* u*(t2+2*xm) : 2*t2+xm */ + fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ + fldt MOX(32+factor,%ecx) + fmulp /* u*(t2+2*xm)/(2*t2+xm)*FACT */ + pushl %eax + fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ + fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ + fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ + popl %edx +#ifdef PIC + movl 16(%esp), %eax + popl %ebx +#else + movl 12(%esp), %eax +#endif + testl $0x8000, %eax + fstp %st(1) + jz 4f + fchs +4: ret + + /* Return the argument. */ +1: fldt 4(%esp) + ret +END(__cbrtl) +weak_alias (__cbrtl, cbrtl) diff --git a/sysdeps/i386/fpu/s_ceil.S b/sysdeps/i386/fpu/s_ceil.S new file mode 100644 index 0000000000..b0159128aa --- /dev/null +++ b/sysdeps/i386/fpu/s_ceil.S @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $") + +ENTRY(__ceil) + fldl 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x0800,%edx /* round towards +oo */ + orl 4(%esp),%edx + andl $0xfbff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +END (__ceil) +weak_alias (__ceil, ceil) diff --git a/sysdeps/i386/fpu/s_ceilf.S b/sysdeps/i386/fpu/s_ceilf.S new file mode 100644 index 0000000000..352d40d7ce --- /dev/null +++ b/sysdeps/i386/fpu/s_ceilf.S @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") + +ENTRY(__ceilf) + flds 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x0800,%edx /* round towards +oo */ + orl 4(%esp),%edx + andl $0xfbff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +END (__ceilf) +weak_alias (__ceilf, ceilf) diff --git a/sysdeps/i386/fpu/s_ceill.S b/sysdeps/i386/fpu/s_ceill.S new file mode 100644 index 0000000000..0128966ebe --- /dev/null +++ b/sysdeps/i386/fpu/s_ceill.S @@ -0,0 +1,33 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ceill) + fldt 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x0800,%edx /* round towards +oo */ + orl 4(%esp),%edx + andl $0xfbff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +END (__ceill) +weak_alias (__ceill, ceill) diff --git a/sysdeps/i386/fpu/s_cexp.S b/sysdeps/i386/fpu/s_cexp.S new file mode 100644 index 0000000000..61158d9540 --- /dev/null +++ b/sysdeps/i386/fpu/s_cexp.S @@ -0,0 +1,259 @@ +/* ix87 specific implementation of complex exponential function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object) +huge_nan_null_null: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f + .double 0.0 +zero: .double 0.0 +infinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f + .double 0.0 + .byte 0, 0, 0, 0, 0, 0, 0, 0x80 + ASM_SIZE_DIRECTIVE(huge_nan_null_null) + + ASM_TYPE_DIRECTIVE(twopi,@object) +twopi: + .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40 + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(twopi) + + ASM_TYPE_DIRECTIVE(l2e,@object) +l2e: + .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(l2e) + + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + + +#ifdef PIC +#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) +#endif + + .text +ENTRY(__cexp) + fldl 8(%esp) /* x */ + fxam + fnstsw + fldl 16(%esp) /* y : x */ +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + movb %ah, %dh + andb $0x45, %ah + cmpb $0x05, %ah + je 1f /* Jump if real part is +-Inf */ + cmpb $0x01, %ah + je 2f /* Jump if real part is NaN */ + + fxam /* y : x */ + fnstsw + /* If the imaginary part is not finite we return NaN+i NaN, as + for the case when the real part is NaN. A test for +-Inf and + NaN would be necessary. But since we know the stack register + we applied `fxam' to is not empty we can simply use one test. + Check your FPU manual for more information. */ + andb $0x01, %ah + cmpb $0x01, %ah + je 20f + + /* We have finite numbers in the real and imaginary part. Do + the real work now. */ + fxch /* x : y */ + fldt MO(l2e) /* log2(e) : x : y */ + fmulp /* x * log2(e) : y */ + fld %st /* x * log2(e) : x * log2(e) : y */ + frndint /* int(x * log2(e)) : x * log2(e) : y */ + fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */ + fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */ + f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */ + faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */ + fscale /* e^x : int(x * log2(e)) : y */ + fst %st(1) /* e^x : e^x : y */ + fxch %st(2) /* y : e^x : e^x */ + fsincos /* cos(y) : sin(y) : e^x : e^x */ + fnstsw + testl $0x400, %eax + jnz 7f + fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ + fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ + movl 4(%esp), %eax /* Pointer to memory for result. */ + fstpl 8(%eax) + fstpl (%eax) + ret $4 + + /* We have to reduce the argument to fsincos. */ + .align ALIGNARG(4) +7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */ + fxch /* y : 2*pi : e^x : e^x */ +8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */ + fnstsw + testl $0x400, %eax + jnz 8b + fstp %st(1) /* y%(2*pi) : e^x : e^x */ + fsincos /* cos(y) : sin(y) : e^x : e^x */ + fmulp %st, %st(3) + fmulp %st, %st(1) + movl 4(%esp), %eax /* Pointer to memory for result. */ + fstpl 8(%eax) + fstpl (%eax) + ret $4 + + /* The real part is +-inf. We must make further differences. */ + .align ALIGNARG(4) +1: fxam /* y : x */ + fnstsw + movb %ah, %dl + testb $0x01, %ah /* See above why 0x01 is usable here. */ + jne 3f + + + /* The real part is +-Inf and the imaginary part is finite. */ + andl $0x245, %edx + cmpb $0x40, %dl /* Imaginary part == 0? */ + je 4f /* Yes -> */ + + fxch /* x : y */ + shrl $5, %edx + fstp %st(0) /* y */ /* Drop the real part. */ + andl $16, %edx /* This puts the sign bit of the real part + in bit 4. So we can use it to index a + small array to select 0 or Inf. */ + fsincos /* cos(y) : sin(y) */ + fnstsw + testl $0x0400, %eax + jnz 5f + fldl MOX(huge_nan_null_null,%edx,1) + movl 4(%esp), %edx /* Pointer to memory for result. */ + fstl 8(%edx) + fstpl (%edx) + ftst + fnstsw + shll $23, %eax + andl $0x80000000, %eax + orl %eax, 4(%edx) + fstp %st(0) + ftst + fnstsw + shll $23, %eax + andl $0x80000000, %eax + orl %eax, 12(%edx) + fstp %st(0) + ret $4 + /* We must reduce the argument to fsincos. */ + .align ALIGNARG(4) +5: fldt MO(twopi) + fxch +6: fprem1 + fnstsw + testl $0x400, %eax + jnz 6b + fstp %st(1) + fsincos + fldl MOX(huge_nan_null_null,%edx,1) + movl 4(%esp), %edx /* Pointer to memory for result. */ + fstl 8(%edx) + fstpl (%edx) + ftst + fnstsw + shll $23, %eax + andl $0x80000000, %eax + orl %eax, 4(%edx) + fstp %st(0) + ftst + fnstsw + shll $23, %eax + andl $0x80000000, %eax + orl %eax, 12(%edx) + fstp %st(0) + ret $4 + + /* The real part is +-Inf and the imaginary part is +-0. So return + +-Inf+-0i. */ + .align ALIGNARG(4) +4: movl 4(%esp), %eax /* Pointer to memory for result. */ + fstpl 8(%eax) + shrl $5, %edx + fstp %st(0) + andl $16, %edx + fldl MOX(huge_nan_null_null,%edx,1) + fstpl (%eax) + ret $4 + + /* The real part is +-Inf, the imaginary is also is not finite. */ + .align ALIGNARG(4) +3: fstp %st(0) + fstp %st(0) /* */ + andb $0x45, %ah + andb $0x47, %dh + xorb %dh, %ah + jnz 30f + fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) +30: movl %edx, %eax + shrl $5, %edx + shll $4, %eax + andl $16, %edx + andl $32, %eax + orl %eax, %edx + movl 4(%esp), %eax /* Pointer to memory for result. */ + + fldl MOX(huge_nan_null_null,%edx,1) + fldl MOX(huge_nan_null_null+8,%edx,1) + fxch + fstpl (%eax) + fstpl 8(%eax) + ret $4 + + /* The real part is NaN. */ + .align ALIGNARG(4) +20: fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) +2: fstp %st(0) + fstp %st(0) + movl 4(%esp), %eax /* Pointer to memory for result. */ + fldl MO(huge_nan_null_null+8) + fstl (%eax) + fstpl 8(%eax) + ret $4 + +END(__cexp) +weak_alias (__cexp, cexp) diff --git a/sysdeps/i386/fpu/s_cexpf.S b/sysdeps/i386/fpu/s_cexpf.S new file mode 100644 index 0000000000..d6dcebcb23 --- /dev/null +++ b/sysdeps/i386/fpu/s_cexpf.S @@ -0,0 +1,255 @@ +/* ix87 specific implementation of complex exponential function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object) +huge_nan_null_null: + .byte 0, 0, 0x80, 0x7f + .byte 0, 0, 0xc0, 0x7f + .float 0.0 +zero: .float 0.0 +infinity: + .byte 0, 0, 0x80, 0x7f + .byte 0, 0, 0xc0, 0x7f + .float 0.0 + .byte 0, 0, 0, 0x80 + ASM_SIZE_DIRECTIVE(huge_nan_null_null) + + ASM_TYPE_DIRECTIVE(twopi,@object) +twopi: + .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40 + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(twopi) + + ASM_TYPE_DIRECTIVE(l2e,@object) +l2e: + .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(l2e) + + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + + +#ifdef PIC +#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) +#endif + + .text +ENTRY(__cexpf) + flds 4(%esp) /* x */ + fxam + fnstsw + flds 8(%esp) /* y : x */ +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + movb %ah, %dh + andb $0x45, %ah + cmpb $0x05, %ah + je 1f /* Jump if real part is +-Inf */ + cmpb $0x01, %ah + je 2f /* Jump if real part is NaN */ + + fxam /* y : x */ + fnstsw + /* If the imaginary part is not finite we return NaN+i NaN, as + for the case when the real part is NaN. A test for +-Inf and + NaN would be necessary. But since we know the stack register + we applied `fxam' to is not empty we can simply use one test. + Check your FPU manual for more information. */ + andb $0x01, %ah + cmpb $0x01, %ah + je 20f + + /* We have finite numbers in the real and imaginary part. Do + the real work now. */ + fxch /* x : y */ + fldt MO(l2e) /* log2(e) : x : y */ + fmulp /* x * log2(e) : y */ + fld %st /* x * log2(e) : x * log2(e) : y */ + frndint /* int(x * log2(e)) : x * log2(e) : y */ + fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */ + fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */ + f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */ + faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */ + fscale /* e^x : int(x * log2(e)) : y */ + fst %st(1) /* e^x : e^x : y */ + fxch %st(2) /* y : e^x : e^x */ + fsincos /* cos(y) : sin(y) : e^x : e^x */ + fnstsw + testl $0x400, %eax + jnz 7f + fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ + fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ + subl $8, %esp + fstps 4(%esp) + fstps (%esp) + popl %eax + popl %edx + ret + + /* We have to reduce the argument to fsincos. */ + .align ALIGNARG(4) +7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */ + fxch /* y : 2*pi : e^x : e^x */ +8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */ + fnstsw + testl $0x400, %eax + jnz 8b + fstp %st(1) /* y%(2*pi) : e^x : e^x */ + fsincos /* cos(y) : sin(y) : e^x : e^x */ + fmulp %st, %st(3) + fmulp %st, %st(1) + subl $8, %esp + fstps 4(%esp) + fstps (%esp) + popl %eax + popl %edx + ret + + /* The real part is +-inf. We must make further differences. */ + .align ALIGNARG(4) +1: fxam /* y : x */ + fnstsw + movb %ah, %dl + testb $0x01, %ah /* See above why 0x01 is usable here. */ + jne 3f + + + /* The real part is +-Inf and the imaginary part is finite. */ + andl $0x245, %edx + cmpb $0x40, %dl /* Imaginary part == 0? */ + je 4f /* Yes -> */ + + fxch /* x : y */ + shrl $6, %edx + fstp %st(0) /* y */ /* Drop the real part. */ + andl $8, %edx /* This puts the sign bit of the real part + in bit 3. So we can use it to index a + small array to select 0 or Inf. */ + fsincos /* cos(y) : sin(y) */ + fnstsw + testl $0x0400, %eax + jnz 5f + fxch + ftst + fnstsw + fstp %st(0) + shll $23, %eax + andl $0x80000000, %eax + orl MOX(huge_nan_null_null,%edx,1), %eax + movl MOX(huge_nan_null_null,%edx,1), %ecx + movl %eax, %edx + ftst + fnstsw + fstp %st(0) + shll $23, %eax + andl $0x80000000, %eax + orl %ecx, %eax + ret + /* We must reduce the argument to fsincos. */ + .align ALIGNARG(4) +5: fldt MO(twopi) + fxch +6: fprem1 + fnstsw + testl $0x400, %eax + jnz 6b + fstp %st(1) + fsincos + fxch + ftst + fnstsw + fstp %st(0) + shll $23, %eax + andl $0x80000000, %eax + orl MOX(huge_nan_null_null,%edx,1), %eax + movl MOX(huge_nan_null_null,%edx,1), %ecx + movl %eax, %edx + ftst + fnstsw + fstp %st(0) + shll $23, %eax + andl $0x80000000, %eax + orl %ecx, %eax + ret + + /* The real part is +-Inf and the imaginary part is +-0. So return + +-Inf+-0i. */ + .align ALIGNARG(4) +4: subl $4, %esp + fstps (%esp) + shrl $6, %edx + fstp %st(0) + andl $8, %edx + movl MOX(huge_nan_null_null,%edx,1), %eax + popl %edx + ret + + /* The real part is +-Inf, the imaginary is also is not finite. */ + .align ALIGNARG(4) +3: fstp %st(0) + fstp %st(0) /* */ + andb $0x45, %ah + andb $0x47, %dh + xorb %dh, %ah + jnz 30f + flds MO(infinity) /* Raise invalid exception. */ + fmuls MO(zero) + fstp %st(0) +30: movl %edx, %eax + shrl $6, %edx + shll $3, %eax + andl $8, %edx + andl $16, %eax + orl %eax, %edx + + movl MOX(huge_nan_null_null,%edx,1), %eax + movl MOX(huge_nan_null_null+4,%edx,1), %edx + ret + + /* The real part is NaN. */ + .align ALIGNARG(4) +20: flds MO(infinity) /* Raise invalid exception. */ + fmuls MO(zero) + fstp %st(0) +2: fstp %st(0) + fstp %st(0) + movl MO(huge_nan_null_null+4), %eax + movl %eax, %edx + ret + +END(__cexpf) +weak_alias (__cexpf, cexpf) diff --git a/sysdeps/i386/fpu/s_cexpl.S b/sysdeps/i386/fpu/s_cexpl.S new file mode 100644 index 0000000000..203a7ee779 --- /dev/null +++ b/sysdeps/i386/fpu/s_cexpl.S @@ -0,0 +1,262 @@ +/* ix87 specific implementation of complex exponential function for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object) +huge_nan_null_null: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f + .double 0.0 +zero: .double 0.0 +infinity: + .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f + .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f + .double 0.0 + .byte 0, 0, 0, 0, 0, 0, 0, 0x80 + ASM_SIZE_DIRECTIVE(huge_nan_null_null) + + ASM_TYPE_DIRECTIVE(twopi,@object) +twopi: + .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40 + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(twopi) + + ASM_TYPE_DIRECTIVE(l2e,@object) +l2e: + .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(l2e) + + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + + +#ifdef PIC +#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) +#endif + + .text +ENTRY(__cexpl) + fldt 8(%esp) /* x */ + fxam + fnstsw + fldt 20(%esp) /* y : x */ +#ifdef PIC + call 1f +1: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx +#endif + movb %ah, %dh + andb $0x45, %ah + cmpb $0x05, %ah + je 1f /* Jump if real part is +-Inf */ + cmpb $0x01, %ah + je 2f /* Jump if real part is NaN */ + + fxam /* y : x */ + fnstsw + /* If the imaginary part is not finite we return NaN+i NaN, as + for the case when the real part is NaN. A test for +-Inf and + NaN would be necessary. But since we know the stack register + we applied `fxam' to is not empty we can simply use one test. + Check your FPU manual for more information. */ + andb $0x01, %ah + cmpb $0x01, %ah + je 20f + + /* We have finite numbers in the real and imaginary part. Do + the real work now. */ + fxch /* x : y */ + fldt MO(l2e) /* log2(e) : x : y */ + fmulp /* x * log2(e) : y */ + fld %st /* x * log2(e) : x * log2(e) : y */ + frndint /* int(x * log2(e)) : x * log2(e) : y */ + fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */ + fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */ + f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */ + faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */ + fscale /* e^x : int(x * log2(e)) : y */ + fst %st(1) /* e^x : e^x : y */ + fxch %st(2) /* y : e^x : e^x */ + fsincos /* cos(y) : sin(y) : e^x : e^x */ + fnstsw + testl $0x400, %eax + jnz 7f + fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ + fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ + movl 4(%esp), %eax /* Pointer to memory for result. */ + fstpt 12(%eax) + fstpt (%eax) + ret $4 + + /* We have to reduce the argument to fsincos. */ + .align ALIGNARG(4) +7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */ + fxch /* y : 2*pi : e^x : e^x */ +8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */ + fnstsw + testl $0x400, %eax + jnz 8b + fstp %st(1) /* y%(2*pi) : e^x : e^x */ + fsincos /* cos(y) : sin(y) : e^x : e^x */ + fmulp %st, %st(3) + fmulp %st, %st(1) + movl 4(%esp), %eax /* Pointer to memory for result. */ + fstpt 12(%eax) + fstpt (%eax) + ret $4 + + /* The real part is +-inf. We must make further differences. */ + .align ALIGNARG(4) +1: fxam /* y : x */ + fnstsw + movb %ah, %dl + testb $0x01, %ah /* See above why 0x01 is usable here. */ + jne 3f + + + /* The real part is +-Inf and the imaginary part is finite. */ + andl $0x245, %edx + cmpb $0x40, %dl /* Imaginary part == 0? */ + je 4f /* Yes -> */ + + fxch /* x : y */ + shrl $5, %edx + fstp %st(0) /* y */ /* Drop the real part. */ + andl $16, %edx /* This puts the sign bit of the real part + in bit 4. So we can use it to index a + small array to select 0 or Inf. */ + fsincos /* cos(y) : sin(y) */ + fnstsw + testl $0x0400, %eax + jnz 5f + fldl MOX(huge_nan_null_null,%edx,1) + movl 4(%esp), %edx /* Pointer to memory for result. */ + fld %st + fstpt 12(%edx) + fstpt (%edx) + ftst + fnstsw + shll $7, %eax + andl $0x8000, %eax + orl %eax, 8(%edx) + fstp %st(0) + ftst + fnstsw + shll $7, %eax + andl $0x8000, %eax + orl %eax, 20(%edx) + fstp %st(0) + ret $4 + /* We must reduce the argument to fsincos. */ + .align ALIGNARG(4) +5: fldt MO(twopi) + fxch +6: fprem1 + fnstsw + testl $0x400, %eax + jnz 6b + fstp %st(1) + fsincos + fldl MOX(huge_nan_null_null,%edx,1) + movl 4(%esp), %edx /* Pointer to memory for result. */ + fld %st + fstpt 12(%edx) + fstpt (%edx) + ftst + fnstsw + shll $7, %eax + andl $0x8000, %eax + orl %eax, 8(%edx) + fstp %st(0) + ftst + fnstsw + shll $7, %eax + andl $0x8000, %eax + orl %eax, 20(%edx) + fstp %st(0) + ret $4 + + /* The real part is +-Inf and the imaginary part is +-0. So return + +-Inf+-0i. */ + .align ALIGNARG(4) +4: movl 4(%esp), %eax /* Pointer to memory for result. */ + fstpt 12(%eax) + shrl $5, %edx + fstp %st(0) + andl $16, %edx + fldl MOX(huge_nan_null_null,%edx,1) + fstpt (%eax) + ret $4 + + /* The real part is +-Inf, the imaginary is also is not finite. */ + .align ALIGNARG(4) +3: fstp %st(0) + fstp %st(0) /* */ + andb $0x45, %ah + andb $0x47, %dh + xorb %dh, %ah + jnz 30f + fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) +30: movl %edx, %eax + shrl $5, %edx + shll $4, %eax + andl $16, %edx + andl $32, %eax + orl %eax, %edx + movl 4(%esp), %eax /* Pointer to memory for result. */ + + fldl MOX(huge_nan_null_null,%edx,1) + fldl MOX(huge_nan_null_null+8,%edx,1) + fxch + fstpt (%eax) + fstpt 12(%eax) + ret $4 + + /* The real part is NaN. */ + .align ALIGNARG(4) +20: fldl MO(infinity) /* Raise invalid exception. */ + fmull MO(zero) + fstp %st(0) +2: fstp %st(0) + fstp %st(0) + movl 4(%esp), %eax /* Pointer to memory for result. */ + fldl MO(huge_nan_null_null+8) + fld %st(0) + fstpt (%eax) + fstpt 12(%eax) + ret $4 + +END(__cexpl) +weak_alias (__cexpl, cexpl) diff --git a/sysdeps/i386/fpu/s_copysign.S b/sysdeps/i386/fpu/s_copysign.S new file mode 100644 index 0000000000..2520a94427 --- /dev/null +++ b/sysdeps/i386/fpu/s_copysign.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_copysign.S,v 1.4 1995/05/08 23:53:02 jtc Exp $") + +ENTRY(__copysign) + movl 16(%esp),%edx + movl 8(%esp),%eax + andl $0x80000000,%edx + andl $0x7fffffff,%eax + orl %edx,%eax + movl %eax,8(%esp) + fldl 4(%esp) + ret +END (__copysign) +weak_alias (__copysign, copysign) diff --git a/sysdeps/i386/fpu/s_copysignf.S b/sysdeps/i386/fpu/s_copysignf.S new file mode 100644 index 0000000000..57b1a6f119 --- /dev/null +++ b/sysdeps/i386/fpu/s_copysignf.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $") + +ENTRY(__copysignf) + movl 8(%esp),%edx + movl 4(%esp),%eax + andl $0x80000000,%edx + andl $0x7fffffff,%eax + orl %edx,%eax + movl %eax,4(%esp) + flds 4(%esp) + ret +END (__copysignf) +weak_alias (__copysignf, copysignf) diff --git a/sysdeps/i386/fpu/s_copysignl.S b/sysdeps/i386/fpu/s_copysignl.S new file mode 100644 index 0000000000..2163e7b014 --- /dev/null +++ b/sysdeps/i386/fpu/s_copysignl.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__copysignl) + movl 24(%esp),%edx + movl 12(%esp),%eax + andl $0x8000,%edx + andl $0x7fff,%eax + orl %edx,%eax + movl %eax,12(%esp) + fldt 4(%esp) + ret +END (__copysignl) +weak_alias (__copysignl, copysignl) diff --git a/sysdeps/i386/fpu/s_cos.S b/sysdeps/i386/fpu/s_cos.S new file mode 100644 index 0000000000..ac8b1459d9 --- /dev/null +++ b/sysdeps/i386/fpu/s_cos.S @@ -0,0 +1,29 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_cos.S,v 1.5 1995/05/08 23:54:00 jtc Exp $") + +ENTRY(__cos) + fldl 4(%esp) + fcos + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fcos + ret +END (__cos) +weak_alias (__cos, cos) diff --git a/sysdeps/i386/fpu/s_cosf.S b/sysdeps/i386/fpu/s_cosf.S new file mode 100644 index 0000000000..d8e8090639 --- /dev/null +++ b/sysdeps/i386/fpu/s_cosf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $") + +/* A float's domain isn't large enough to require argument reduction. */ +ENTRY(__cosf) + flds 4(%esp) + fcos + ret +END (__cosf) +weak_alias (__cosf, cosf) diff --git a/sysdeps/i386/fpu/s_cosl.S b/sysdeps/i386/fpu/s_cosl.S new file mode 100644 index 0000000000..61c9010c99 --- /dev/null +++ b/sysdeps/i386/fpu/s_cosl.S @@ -0,0 +1,31 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__cosl) + fldt 4(%esp) + fcos + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fcos + ret +END (__cosl) +weak_alias (__cosl, cosl) diff --git a/sysdeps/i386/fpu/s_exp2.S b/sysdeps/i386/fpu/s_exp2.S new file mode 100644 index 0000000000..778c0c0eb6 --- /dev/null +++ b/sysdeps/i386/fpu/s_exp2.S @@ -0,0 +1,37 @@ +/* + * Written by J.T. Conklin . + * Adapted for exp2 by Ulrich Drepper . + * Public domain. + */ + +#include + +ENTRY(__ieee754_exp2) + fldl 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fld %st + frndint /* int(x) */ + fsubr %st,%st(1) /* fract(x) */ + fxch + f2xm1 /* 2^(fract(x)) - 1 */ + fld1 + faddp /* 2^(fract(x)) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp2) diff --git a/sysdeps/i386/fpu/s_exp2f.S b/sysdeps/i386/fpu/s_exp2f.S new file mode 100644 index 0000000000..c2d1af1af1 --- /dev/null +++ b/sysdeps/i386/fpu/s_exp2f.S @@ -0,0 +1,37 @@ +/* + * Written by J.T. Conklin . + * Adapted for exp2 by Ulrich Drepper . + * Public domain. + */ + +#include + +ENTRY(__ieee754_exp2f) + flds 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fld %st + frndint /* int(x) */ + fsubr %st,%st(1) /* fract(x) */ + fxch + f2xm1 /* 2^(fract(x)) - 1 */ + fld1 + faddp /* 2^(fract(x)) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp2f) diff --git a/sysdeps/i386/fpu/s_exp2l.S b/sysdeps/i386/fpu/s_exp2l.S new file mode 100644 index 0000000000..fa1fdc9236 --- /dev/null +++ b/sysdeps/i386/fpu/s_exp2l.S @@ -0,0 +1,37 @@ +/* + * Written by J.T. Conklin . + * Adapted for exp2 by Ulrich Drepper . + * Public domain. + */ + +#include + +ENTRY(__ieee754_exp2l) + fldt 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fld %st + frndint /* int(x) */ + fsubr %st,%st(1) /* fract(x) */ + fxch + f2xm1 /* 2^(fract(x)) - 1 */ + fld1 + faddp /* 2^(fract(x)) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp2l) diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S new file mode 100644 index 0000000000..92beaf0776 --- /dev/null +++ b/sysdeps/i386/fpu/s_expm1.S @@ -0,0 +1,88 @@ +/* ix87 specific implementation of exp(x)-1. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + Based on code by John C. Bowman . + Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(minus1,@object) +minus1: .double -1.0 + ASM_SIZE_DIRECTIVE(minus1) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(l2e,@object) +l2e: .tfloat 1.442695040888963407359924681002 + ASM_SIZE_DIRECTIVE(l2e) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__expm1) + fldl 4(%esp) // x + fxam // Is NaN or +-Inf? + fstsw %ax + movb $0x45, %ch + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpb $0x05, %ch + je 2f // If +-Inf, jump. + + fldt MO(l2e) // log2(e) : x + fmulp // log2(e)*x + fld %st // log2(e)*x : log2(e)*x + frndint // int(log2(e)*x) : log2(e)*x + fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x) + fxch // fract(log2(e)*x) : int(log2(e)*x) + f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x) + fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x) + fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fsubrp %st, %st(1) // 2^(log2(e)*x) + ret + +2: testl $0x200, %eax // Test sign. + jz 3f // If positive, jump. + fstp %st + fldl MO(minus1) // Set result to -1.0. +3: ret +END(__expm1) +weak_alias (__expm1, expm1) diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S new file mode 100644 index 0000000000..45a60fe010 --- /dev/null +++ b/sysdeps/i386/fpu/s_expm1f.S @@ -0,0 +1,88 @@ +/* ix87 specific implementation of exp(x)-1. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + Based on code by John C. Bowman . + Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(minus1,@object) +minus1: .double -1.0 + ASM_SIZE_DIRECTIVE(minus1) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(l2e,@object) +l2e: .tfloat 1.442695040888963407359924681002 + ASM_SIZE_DIRECTIVE(l2e) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__expm1f) + flds 4(%esp) // x + fxam // Is NaN or +-Inf? + fstsw %ax + movb $0x45, %ch + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpb $0x05, %ch + je 2f // If +-Inf, jump. + + fldt MO(l2e) // log2(e) : x + fmulp // log2(e)*x + fld %st // log2(e)*x : log2(e)*x + frndint // int(log2(e)*x) : log2(e)*x + fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x) + fxch // fract(log2(e)*x) : int(log2(e)*x) + f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x) + fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x) + fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fsubrp %st, %st(1) // 2^(log2(e)*x) + ret + +2: testl $0x200, %eax // Test sign. + jz 3f // If positive, jump. + fstp %st + fldl MO(minus1) // Set result to -1.0. +3: ret +END(__expm1f) +weak_alias (__expm1f, expm1f) diff --git a/sysdeps/i386/fpu/s_expm1l.S b/sysdeps/i386/fpu/s_expm1l.S new file mode 100644 index 0000000000..13fa698cc7 --- /dev/null +++ b/sysdeps/i386/fpu/s_expm1l.S @@ -0,0 +1,88 @@ +/* ix87 specific implementation of exp(x)-1. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + Based on code by John C. Bowman . + Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(minus1,@object) +minus1: .double -1.0 + ASM_SIZE_DIRECTIVE(minus1) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(l2e,@object) +l2e: .tfloat 1.442695040888963407359924681002 + ASM_SIZE_DIRECTIVE(l2e) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__expm1l) + fldt 4(%esp) // x + fxam // Is NaN or +-Inf? + fstsw %ax + movb $0x45, %ch + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpb $0x05, %ch + je 2f // If +-Inf, jump. + + fldt MO(l2e) // log2(e) : x + fmulp // log2(e)*x + fld %st // log2(e)*x : log2(e)*x + frndint // int(log2(e)*x) : log2(e)*x + fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x) + fxch // fract(log2(e)*x) : int(log2(e)*x) + f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x) + fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x) + fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) + fsubrp %st, %st(1) // 2^(log2(e)*x) + ret + +2: testl $0x200, %eax // Test sign. + jz 3f // If positive, jump. + fstp %st + fldl MO(minus1) // Set result to -1.0. +3: ret +END(__expm1l) +weak_alias (__expm1l, expm1l) diff --git a/sysdeps/i386/fpu/s_fdim.S b/sysdeps/i386/fpu/s_fdim.S new file mode 100644 index 0000000000..7a1e2ffa49 --- /dev/null +++ b/sysdeps/i386/fpu/s_fdim.S @@ -0,0 +1,51 @@ +/* Compute positive difference. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fdim) + fldl 4(%esp) // x + fldl 12(%esp) // x : y + + fucom %st(1) + fnstsw + sahf + jp 1f + + fsubrp %st, %st(1) + jc 2f + + fstp %st(0) + fldz + jmp 2f + +1: fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 3f + + fxch +3: fstp %st(1) + +2: ret +END(__fdim) +weak_alias (__fdim, fdim) diff --git a/sysdeps/i386/fpu/s_fdimf.S b/sysdeps/i386/fpu/s_fdimf.S new file mode 100644 index 0000000000..7e58f6752b --- /dev/null +++ b/sysdeps/i386/fpu/s_fdimf.S @@ -0,0 +1,51 @@ +/* Compute positive difference. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fdimf) + flds 4(%esp) // x + flds 8(%esp) // x : y + + fucom %st(1) + fnstsw + sahf + jp 1f + + fsubrp %st, %st(1) + jc 2f + + fstp %st(0) + fldz + jmp 2f + +1: fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 3f + + fxch +3: fstp %st(1) + +2: ret +END(__fdimf) +weak_alias (__fdimf, fdimf) diff --git a/sysdeps/i386/fpu/s_fdiml.S b/sysdeps/i386/fpu/s_fdiml.S new file mode 100644 index 0000000000..7a8c18a5d3 --- /dev/null +++ b/sysdeps/i386/fpu/s_fdiml.S @@ -0,0 +1,51 @@ +/* Compute positive difference. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fdiml) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + + fucom %st(1) + fnstsw + sahf + jp 1f + + fsubrp %st, %st(1) + jc 2f + + fstp %st(0) + fldz + jmp 2f + +1: fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 3f + + fxch +3: fstp %st(1) + +2: ret +END(__fdiml) +weak_alias (__fdiml, fdiml) diff --git a/sysdeps/i386/fpu/s_finite.S b/sysdeps/i386/fpu/s_finite.S new file mode 100644 index 0000000000..63c766a950 --- /dev/null +++ b/sysdeps/i386/fpu/s_finite.S @@ -0,0 +1,15 @@ +/* + * Written by Joe Keane . + */ + +#include + +ENTRY(__finite) + movl 8(%esp),%eax + movl $0xFFEFFFFF,%ecx + subl %eax,%ecx + xorl %ecx,%eax + shrl $31, %eax + ret +END (__finite) +weak_alias (__finite, finite) diff --git a/sysdeps/i386/fpu/s_finitef.S b/sysdeps/i386/fpu/s_finitef.S new file mode 100644 index 0000000000..dabb71a115 --- /dev/null +++ b/sysdeps/i386/fpu/s_finitef.S @@ -0,0 +1,15 @@ +/* + * Written by Joe Keane . + */ + +#include + +ENTRY(__finitef) + movl 4(%esp),%eax + movl $0xFF7FFFFF,%ecx + subl %eax,%ecx + xorl %ecx,%eax + shrl $31,%eax + ret +END (__finitef) +weak_alias (__finitef, finitef) diff --git a/sysdeps/i386/fpu/s_finitel.S b/sysdeps/i386/fpu/s_finitel.S new file mode 100644 index 0000000000..acc5ad4cd0 --- /dev/null +++ b/sysdeps/i386/fpu/s_finitel.S @@ -0,0 +1,14 @@ +/* + * Written by Joe Keane . + */ + +#include + +ENTRY(__finitel) + movl 12(%esp),%eax + orl $0xffff8000, %eax + incl %eax + shrl $31, %eax + ret +END (__finitel) +weak_alias (__finitel, finitel) diff --git a/sysdeps/i386/fpu/s_floor.S b/sysdeps/i386/fpu/s_floor.S new file mode 100644 index 0000000000..20a8660424 --- /dev/null +++ b/sysdeps/i386/fpu/s_floor.S @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $") + +ENTRY(__floor) + fldl 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x400,%edx /* round towards -oo */ + orl 4(%esp),%edx + andl $0xf7ff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +END (__floor) +weak_alias (__floor, floor) diff --git a/sysdeps/i386/fpu/s_floorf.S b/sysdeps/i386/fpu/s_floorf.S new file mode 100644 index 0000000000..eca93a2aa3 --- /dev/null +++ b/sysdeps/i386/fpu/s_floorf.S @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") + +ENTRY(__floorf) + flds 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x400,%edx /* round towards -oo */ + orl 4(%esp),%edx + andl $0xf7ff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +END (__floorf) +weak_alias (__floorf, floorf) diff --git a/sysdeps/i386/fpu/s_floorl.S b/sysdeps/i386/fpu/s_floorl.S new file mode 100644 index 0000000000..c2bf091d73 --- /dev/null +++ b/sysdeps/i386/fpu/s_floorl.S @@ -0,0 +1,33 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__floorl) + fldt 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x400,%edx /* round towards -oo */ + orl 4(%esp),%edx + andl $0xf7ff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +END (__floorl) +weak_alias (__floorl, floorl) diff --git a/sysdeps/i386/fpu/s_fma.S b/sysdeps/i386/fpu/s_fma.S new file mode 100644 index 0000000000..2affafcbf5 --- /dev/null +++ b/sysdeps/i386/fpu/s_fma.S @@ -0,0 +1,31 @@ +/* Compute (X * Y) + Z as ternary operation. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fma) + fldl 4(%esp) // x + fmull 12(%esp) // x * y + fldl 20(%esp) // z : x * y + faddp // (x * y) + z + ret +END(__fma) +weak_alias (__fma, fma) diff --git a/sysdeps/i386/fpu/s_fmaf.S b/sysdeps/i386/fpu/s_fmaf.S new file mode 100644 index 0000000000..03c6cc0f9e --- /dev/null +++ b/sysdeps/i386/fpu/s_fmaf.S @@ -0,0 +1,31 @@ +/* Compute (X * Y) + Z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmaf) + flds 4(%esp) // x + fmuls 8(%esp) // x * y + flds 12(%esp) // z : x * y + faddp // (x * y) + z + ret +END(__fmaf) +weak_alias (__fmaf, fmaf) diff --git a/sysdeps/i386/fpu/s_fmal.S b/sysdeps/i386/fpu/s_fmal.S new file mode 100644 index 0000000000..c15fca8dab --- /dev/null +++ b/sysdeps/i386/fpu/s_fmal.S @@ -0,0 +1,32 @@ +/* Compute (X * Y) + Z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmal) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + fmulp // x * y + fldt 28(%esp) // z : x * y + faddp // (x * y) + z + ret +END(__fmal) +weak_alias (__fmal, fmal) diff --git a/sysdeps/i386/fpu/s_fmax.S b/sysdeps/i386/fpu/s_fmax.S new file mode 100644 index 0000000000..3dbaa139ad --- /dev/null +++ b/sysdeps/i386/fpu/s_fmax.S @@ -0,0 +1,44 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmax) + fldl 12(%esp) // y + fxam + fnstsw + fldl 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jnc 1f + + fxch %st(1) +1: fstp %st(1) + + ret +END(__fmax) +weak_alias (__fmax, fmax) diff --git a/sysdeps/i386/fpu/s_fmaxf.S b/sysdeps/i386/fpu/s_fmaxf.S new file mode 100644 index 0000000000..5dd94a43c4 --- /dev/null +++ b/sysdeps/i386/fpu/s_fmaxf.S @@ -0,0 +1,44 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmaxf) + flds 8(%esp) // y + fxam + fnstsw + flds 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jnc 1f + + fxch %st(1) +1: fstp %st(1) + + ret +END(__fmaxf) +weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/i386/fpu/s_fmaxl.S b/sysdeps/i386/fpu/s_fmaxl.S new file mode 100644 index 0000000000..d833bd1985 --- /dev/null +++ b/sysdeps/i386/fpu/s_fmaxl.S @@ -0,0 +1,44 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmaxl) + fldt 16(%esp) // y + fxam + fnstsw + fldt 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jnc 1f + + fxch %st(1) +1: fstp %st(1) + + ret +END(__fmaxl) +weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/i386/fpu/s_fmin.S b/sysdeps/i386/fpu/s_fmin.S new file mode 100644 index 0000000000..1ac46c7d21 --- /dev/null +++ b/sysdeps/i386/fpu/s_fmin.S @@ -0,0 +1,44 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmin) + fldl 4(%esp) // x + fldl 12(%esp) // x : y + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jc 2f + +1: fxch %st(1) +2: fstp %st(1) + + ret +END(__fmin) +weak_alias (__fmin, fmin) diff --git a/sysdeps/i386/fpu/s_fminf.S b/sysdeps/i386/fpu/s_fminf.S new file mode 100644 index 0000000000..7dd346d2bc --- /dev/null +++ b/sysdeps/i386/fpu/s_fminf.S @@ -0,0 +1,44 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fminf) + flds 4(%esp) // x + flds 8(%esp) // x : y + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jc 2f + +1: fxch %st(1) +2: fstp %st(1) + + ret +END(__fminf) +weak_alias (__fminf, fminf) diff --git a/sysdeps/i386/fpu/s_fminl.S b/sysdeps/i386/fpu/s_fminl.S new file mode 100644 index 0000000000..883735d32c --- /dev/null +++ b/sysdeps/i386/fpu/s_fminl.S @@ -0,0 +1,44 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fminl) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jc 2f + +1: fxch %st(1) +2: fstp %st(1) + + ret +END(__fminl) +weak_alias (__fminl, fminl) diff --git a/sysdeps/i386/fpu/s_frexp.S b/sysdeps/i386/fpu/s_frexp.S new file mode 100644 index 0000000000..6a05f26720 --- /dev/null +++ b/sysdeps/i386/fpu/s_frexp.S @@ -0,0 +1,82 @@ +/* ix87 specific frexp implementation for double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(two54,@object) +two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43 + ASM_SIZE_DIRECTIVE(two54) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__frexp) + movl 4(%esp), %ecx + movl 8(%esp), %eax + movl %eax, %edx + andl $0x7fffffff, %eax + orl %eax, %ecx + jz 1f + xorl %ecx, %ecx + cmpl $0x7ff00000, %eax + jae 1f + + cmpl $0x00100000, %eax + jae 2f + + fldl 4(%esp) +#ifdef PIC + call 3f +3: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx +#endif + fmull MO(two54) + movl $-54, %ecx + fstpl 4(%esp) + movl 8(%esp), %eax + movl %eax, %edx + andl $0x7fffffff, %eax + +2: shrl $20, %eax + andl $0x800fffff, %edx + subl $1022, %eax + orl $0x3fe00000, %edx + addl %eax, %ecx + movl %edx, 8(%esp) + + /* Store %ecx in the variable pointed to by the second argument, + get the factor from the stack and return. */ +1: movl 12(%esp), %eax + fldl 4(%esp) + movl %ecx, (%eax) + ret +END(__frexp) +weak_alias (__frexp, frexp) diff --git a/sysdeps/i386/fpu/s_frexpf.S b/sysdeps/i386/fpu/s_frexpf.S new file mode 100644 index 0000000000..1021b97aee --- /dev/null +++ b/sysdeps/i386/fpu/s_frexpf.S @@ -0,0 +1,80 @@ +/* ix87 specific frexp implementation for float. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(two25,@object) +two25: .byte 0, 0, 0, 0x4c + ASM_SIZE_DIRECTIVE(two25) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__frexpf) + movl 4(%esp), %eax + xorl %ecx, %ecx + movl %eax, %edx + andl $0x7fffffff, %eax + jz 1f + cmpl $0x7f800000, %eax + jae 1f + + cmpl $0x00800000, %eax + jae 2f + + flds 4(%esp) +#ifdef PIC + call 3f +3: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx +#endif + fmuls MO(two25) + movl $-25, %ecx + fstps 4(%esp) + movl 4(%esp), %eax + movl %eax, %edx + andl $0x7fffffff, %eax + +2: shrl $23, %eax + andl $0x807fffff, %edx + subl $126, %eax + orl $0x3f000000, %edx + addl %eax, %ecx + movl %edx, 4(%esp) + + /* Store %ecx in the variable pointed to by the second argument, + get the factor from the stack and return. */ +1: movl 8(%esp), %eax + flds 4(%esp) + movl %ecx, (%eax) + ret +END(__frexpf) +weak_alias (__frexpf, frexpf) diff --git a/sysdeps/i386/fpu/s_frexpl.S b/sysdeps/i386/fpu/s_frexpl.S new file mode 100644 index 0000000000..e3019ced6d --- /dev/null +++ b/sysdeps/i386/fpu/s_frexpl.S @@ -0,0 +1,82 @@ +/* ix87 specific frexp implementation for long double. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(two64,@object) +two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43 + ASM_SIZE_DIRECTIVE(two64) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__frexpl) + movl 4(%esp), %ecx + movl 12(%esp), %eax + orl 8(%esp), %ecx + movl %eax, %edx + andl $0x7fff, %eax + orl %eax, %ecx + jz 1f + xorl %ecx, %ecx + cmpl $0x7fff, %eax + je 1f + + cmpl $0, %eax + je 2f + + fldt 4(%esp) +#ifdef PIC + call 3f +3: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx +#endif + fmull MO(two64) /* It's not necessary to use a 80bit factor */ + movl $-64, %ecx + fstpt 4(%esp) + movl 12(%esp), %eax + movl %eax, %edx + andl $0x7fff, %eax + +2: andl $0x8000, %edx + subl $16382, %eax + orl $0x3ffe, %edx + addl %eax, %ecx + movl %edx, 12(%esp) + + /* Store %ecx in the variable pointed to by the second argument, + get the factor from the stack and return. */ +1: movl 16(%esp), %eax + fldt 4(%esp) + movl %ecx, (%eax) + ret +END(__frexpl) +weak_alias (__frexpl, frexpl) diff --git a/sysdeps/i386/fpu/s_ilogb.S b/sysdeps/i386/fpu/s_ilogb.S new file mode 100644 index 0000000000..36fb000c02 --- /dev/null +++ b/sysdeps/i386/fpu/s_ilogb.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_ilogb.S,v 1.5 1995/10/12 15:53:09 jtc Exp $") + +ENTRY(__ilogb) + fldl 4(%esp) + fxtract + pushl %eax + fstp %st + + fistpl (%esp) + fwait + popl %eax + + ret +END (__ilogb) +weak_alias (__ilogb, ilogb) diff --git a/sysdeps/i386/fpu/s_ilogbf.S b/sysdeps/i386/fpu/s_ilogbf.S new file mode 100644 index 0000000000..54f9d4647e --- /dev/null +++ b/sysdeps/i386/fpu/s_ilogbf.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_ilogbf.S,v 1.4 1995/10/22 20:32:43 pk Exp $") + +ENTRY(__ilogbf) + flds 4(%esp) + fxtract + pushl %eax + fstp %st + + fistpl (%esp) + fwait + popl %eax + + ret +END (__ilogbf) +weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/i386/fpu/s_ilogbl.S b/sysdeps/i386/fpu/s_ilogbl.S new file mode 100644 index 0000000000..1dad93abeb --- /dev/null +++ b/sysdeps/i386/fpu/s_ilogbl.S @@ -0,0 +1,23 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__ilogbl) + fldt 4(%esp) + fxtract + pushl %eax + fstp %st + + fistpl (%esp) + fwait + popl %eax + + ret +END (__ilogbl) +weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/i386/fpu/s_isinfl.c b/sysdeps/i386/fpu/s_isinfl.c new file mode 100644 index 0000000000..f07898fd1b --- /dev/null +++ b/sysdeps/i386/fpu/s_isinfl.c @@ -0,0 +1,36 @@ +/* + * Written by J.T. Conklin . + * Change for long double by Ulrich Drepper . + * Intel i387 specific version. + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isinfl(long double x) +#else + int __isinfl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + /* This additional ^ 0x80000000 is necessary because in Intel's + internal representation of the implicit one is explicit. */ + lx |= (hx ^ 0x80000000) | ((se & 0x7fff) ^ 0x7fff); + lx |= -lx; + se &= 0x8000; + return ~(lx >> 31) & (1 - (se >> 14)); +} +weak_alias (__isinfl, isinfl) diff --git a/sysdeps/i386/fpu/s_isnanl.c b/sysdeps/i386/fpu/s_isnanl.c new file mode 100644 index 0000000000..6a74b956cc --- /dev/null +++ b/sysdeps/i386/fpu/s_isnanl.c @@ -0,0 +1,47 @@ +/* s_isnanl.c -- long double version for i387 of s_isnan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isnanl(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanl(long double x) +#else + int __isnanl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se = (se & 0x7fff) << 1; + /* The additional & 0x7fffffff is required because Intel's + extended format has the normally implicit 1 explicit + present. Sigh! */ + lx |= hx & 0x7fffffff; + se |= (u_int32_t)(lx|(-lx))>>31; + se = 0xfffe - se; + return (int)((u_int32_t)(se))>>16; +} +weak_alias (__isnanl, isnanl) diff --git a/sysdeps/i386/fpu/s_llrint.S b/sysdeps/i386/fpu/s_llrint.S new file mode 100644 index 0000000000..6109ec45c3 --- /dev/null +++ b/sysdeps/i386/fpu/s_llrint.S @@ -0,0 +1,34 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__llrint) + fldl 4(%esp) + subl $8, %esp + fistpll (%esp) + fwait + popl %eax + popl %edx + ret +END(__llrint) +weak_alias (__llrint, llrint) diff --git a/sysdeps/i386/fpu/s_llrintf.S b/sysdeps/i386/fpu/s_llrintf.S new file mode 100644 index 0000000000..c1e1c225c0 --- /dev/null +++ b/sysdeps/i386/fpu/s_llrintf.S @@ -0,0 +1,34 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__llrintf) + flds 4(%esp) + subl $8, %esp + fistpll (%esp) + fwait + popl %eax + popl %edx + ret +END(__llrintf) +weak_alias (__llrintf, llrintf) diff --git a/sysdeps/i386/fpu/s_llrintl.S b/sysdeps/i386/fpu/s_llrintl.S new file mode 100644 index 0000000000..d894897d5e --- /dev/null +++ b/sysdeps/i386/fpu/s_llrintl.S @@ -0,0 +1,34 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__llrintl) + fldt 4(%esp) + subl $8, %esp + fistpll (%esp) + fwait + popl %eax + popl %edx + ret +END(__llrintl) +weak_alias (__llrintl, llrintl) diff --git a/sysdeps/i386/fpu/s_log1p.S b/sysdeps/i386/fpu/s_log1p.S new file mode 100644 index 0000000000..10e8a36369 --- /dev/null +++ b/sysdeps/i386/fpu/s_log1p.S @@ -0,0 +1,62 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .double 0.29 +one: .double 1.0 + +/* + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. + */ + .text +ENTRY(__log1p) + fldln2 + + fldl 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fcompl limit@GOTOFF(%edx) +#else + fcompl limit +#endif + fnstsw + sahf + jc 2f + +#ifdef PIC + faddl one@GOTOFF(%edx) +#else + faddl one +#endif + fyl2x + ret + +2: fyl2xp1 + ret + +END (__log1p) +weak_alias (__log1p, log1p) diff --git a/sysdeps/i386/fpu/s_log1pf.S b/sysdeps/i386/fpu/s_log1pf.S new file mode 100644 index 0000000000..df9fdcbcfc --- /dev/null +++ b/sysdeps/i386/fpu/s_log1pf.S @@ -0,0 +1,62 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .float 0.29 +one: .float 1.0 + +/* + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. + */ + .text +ENTRY(__log1pf) + fldln2 + + flds 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fcomps limit@GOTOFF(%edx) +#else + fcomps limit +#endif + fnstsw + sahf + jc 2f + +#ifdef PIC + fadds one@GOTOFF(%edx) +#else + fadds one +#endif + fyl2x + ret + +2: fyl2xp1 + ret + +END (__log1pf) +weak_alias (__log1pf, log1pf) diff --git a/sysdeps/i386/fpu/s_log1pl.S b/sysdeps/i386/fpu/s_log1pl.S new file mode 100644 index 0000000000..05a17b2831 --- /dev/null +++ b/sysdeps/i386/fpu/s_log1pl.S @@ -0,0 +1,68 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .tfloat 0.29 + /* Please note: we use a double value here. Since 1.0 has + an exact representation this does not effect the accuracy + but it helps to optimize the code. */ +one: .double 1.0 + +/* + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. + */ + .text +ENTRY(__log1pl) + fldln2 + + fldt 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fldt limit@GOTOFF(%edx) +#else + fldt limit +#endif + fcompp + fnstsw + sahf + jnc 2f + +#ifdef PIC + faddl one@GOTOFF(%edx) +#else + faddl one +#endif + fyl2x + ret + +2: fyl2xp1 + ret + +END (__log1pl) +weak_alias (__log1pl, log1pl) diff --git a/sysdeps/i386/fpu/s_log2.S b/sysdeps/i386/fpu/s_log2.S new file mode 100644 index 0000000000..4632c96f67 --- /dev/null +++ b/sysdeps/i386/fpu/s_log2.S @@ -0,0 +1,59 @@ +/* + * Written by J.T. Conklin . + * Adapted for use as log2 by Ulrich Drepper . + * Public domain. + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__log2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fldl MO(one) + fldl 4(%esp) // 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 2f + fstp %st(1) // x-1 : 1 + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : 1 + fyl2x // log(x) + ret +END (__log2) +weak_alias (__log2, log2) diff --git a/sysdeps/i386/fpu/s_log2f.S b/sysdeps/i386/fpu/s_log2f.S new file mode 100644 index 0000000000..bfdd0ef88e --- /dev/null +++ b/sysdeps/i386/fpu/s_log2f.S @@ -0,0 +1,59 @@ +/* + * Written by J.T. Conklin . + * Adapted for use as log2 by Ulrich Drepper . + * Public domain. + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__log2f) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fldl MO(one) + flds 4(%esp) // 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 2f + fstp %st(1) // x-1 : 1 + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : 1 + fyl2x // log(x) + ret +END (__log2f) +weak_alias (__log2f, log2f) diff --git a/sysdeps/i386/fpu/s_log2l.S b/sysdeps/i386/fpu/s_log2l.S new file mode 100644 index 0000000000..184981c4bb --- /dev/null +++ b/sysdeps/i386/fpu/s_log2l.S @@ -0,0 +1,59 @@ +/* + * Written by J.T. Conklin . + * Adapted for use as log2 by Ulrich Drepper . + * Public domain. + * + * Changed to use fyl2xp1 for values near 1, . + */ + +#include + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__log2l) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fldl MO(one) + fldt 4(%esp) // 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 2f + fstp %st(1) // x-1 : 1 + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : 1 + fyl2x // log(x) + ret +END (__log2l) +weak_alias (__log2l, log2l) diff --git a/sysdeps/i386/fpu/s_logb.S b/sysdeps/i386/fpu/s_logb.S new file mode 100644 index 0000000000..f78c091c8a --- /dev/null +++ b/sysdeps/i386/fpu/s_logb.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_logb.S,v 1.4 1995/05/09 00:14:30 jtc Exp $") + +ENTRY(__logb) + fldl 4(%esp) + fxtract + fstp %st + ret +END (__logb) +weak_alias (__logb, logb) diff --git a/sysdeps/i386/fpu/s_logbf.S b/sysdeps/i386/fpu/s_logbf.S new file mode 100644 index 0000000000..91eb3d2925 --- /dev/null +++ b/sysdeps/i386/fpu/s_logbf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $") + +ENTRY(__logbf) + flds 4(%esp) + fxtract + fstp %st + ret +END (__logbf) +weak_alias (__logbf, logbf) diff --git a/sysdeps/i386/fpu/s_logbl.S b/sysdeps/i386/fpu/s_logbl.S new file mode 100644 index 0000000000..5c9a9c1c9d --- /dev/null +++ b/sysdeps/i386/fpu/s_logbl.S @@ -0,0 +1,17 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__logbl) + fldt 4(%esp) + fxtract + fstp %st + ret +END (__logbl) +weak_alias (__logbl, logbl) diff --git a/sysdeps/i386/fpu/s_lrint.S b/sysdeps/i386/fpu/s_lrint.S new file mode 100644 index 0000000000..40956ab0d0 --- /dev/null +++ b/sysdeps/i386/fpu/s_lrint.S @@ -0,0 +1,33 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__lrint) + fldl 4(%esp) + subl $4, %esp + fistpl (%esp) + fwait + popl %eax + ret +END(__lrint) +weak_alias (__lrint, lrint) diff --git a/sysdeps/i386/fpu/s_lrintf.S b/sysdeps/i386/fpu/s_lrintf.S new file mode 100644 index 0000000000..2f49bdbabe --- /dev/null +++ b/sysdeps/i386/fpu/s_lrintf.S @@ -0,0 +1,33 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__lrintf) + flds 4(%esp) + subl $4, %esp + fistpl (%esp) + fwait + popl %eax + ret +END(__lrintf) +weak_alias (__lrintf, lrintf) diff --git a/sysdeps/i386/fpu/s_lrintl.S b/sysdeps/i386/fpu/s_lrintl.S new file mode 100644 index 0000000000..3a06c91b29 --- /dev/null +++ b/sysdeps/i386/fpu/s_lrintl.S @@ -0,0 +1,33 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__lrintl) + fldt 4(%esp) + subl $4, %esp + fistpl (%esp) + fwait + popl %eax + ret +END(__lrintl) +weak_alias (__lrintl, lrintl) diff --git a/sysdeps/i386/fpu/s_nearbyint.S b/sysdeps/i386/fpu/s_nearbyint.S new file mode 100644 index 0000000000..65ce4f76a1 --- /dev/null +++ b/sysdeps/i386/fpu/s_nearbyint.S @@ -0,0 +1,25 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ +/* Adapted for use as nearbyint by Ulrich Drepper . */ + +#include + +ENTRY(__nearbyint) + fldl 4(%esp) + pushl %eax + pushl %ecx + fnstcw (%esp) + movl (%esp), %eax + andl $~0x20, %eax + movl %eax, 4(%esp) + fldcw 4(%esp) + frndint + fclex + fldcw (%esp) + popl %ecx + popl %eax + ret +END (__nearbyint) +weak_alias (__nearbyint, nearbyint) diff --git a/sysdeps/i386/fpu/s_nearbyintf.S b/sysdeps/i386/fpu/s_nearbyintf.S new file mode 100644 index 0000000000..090c631607 --- /dev/null +++ b/sysdeps/i386/fpu/s_nearbyintf.S @@ -0,0 +1,25 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ +/* Adapted for use as nearbyint by Ulrich Drepper . */ + +#include + +ENTRY(__nearbyintf) + flds 4(%esp) + pushl %eax + pushl %ecx + fnstcw (%esp) + movl (%esp), %eax + andl $~0x20, %eax + movl %eax, 4(%esp) + fldcw 4(%esp) + frndint + fclex + fldcw (%esp) + popl %ecx + popl %eax + ret +END (__nearbyintf) +weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/i386/fpu/s_nearbyintl.S b/sysdeps/i386/fpu/s_nearbyintl.S new file mode 100644 index 0000000000..2f60af8f18 --- /dev/null +++ b/sysdeps/i386/fpu/s_nearbyintl.S @@ -0,0 +1,25 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ +/* Adapted for use as nearbyint by Ulrich Drepper . */ + +#include + +ENTRY(__nearbyintl) + fldt 4(%esp) + pushl %eax + pushl %ecx + fnstcw (%esp) + movl (%esp), %eax + andl $~0x20, %eax + movl %eax, 4(%esp) + fldcw 4(%esp) + frndint + fclex + fldcw (%esp) + popl %ecx + popl %eax + ret +END (__nearbyintl) +weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c new file mode 100644 index 0000000000..4596c6b93c --- /dev/null +++ b/sysdeps/i386/fpu/s_nextafterl.c @@ -0,0 +1,102 @@ +/* s_nextafterl.c -- long double version of s_nextafter.c. + * Special version for i387. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterl(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __nextafterl(long double x, long double y) +#else + long double __nextafterl(x,y) + long double x,y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t lx,ly,esx,esy; + + GET_LDOUBLE_WORDS(esx,hx,lx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = esx&0x7fff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + /* The additional &hx/&hy is required because Intel's extended format + has the normally implicit 1 explicit present. Sigh! */ + if(((ix==0x7fff)&&(((hx|lx)|-(hx|lx))&hx)>>31!=0) || /* x is nan */ + ((iy==0x7fff)&&(((hy|ly)|-(hy|ly))&hy)>>31!=0)) /* y is nan */ + return x+y; + if(x==y) return y; /* x=y, return y */ + if((ix|hx|lx)==0) { /* x == 0 */ + SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(esx<0x8000) { /* x > 0 */ + if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { + /* x > y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) + esx += 1; + } + } + } else { /* x < 0 */ + if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ + /* x < y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) esx += 1; + } + } + } + esy = esx&0x7fff; + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS(y,esx,hx,lx); + return y; + } + } + SET_LDOUBLE_WORDS(x,esx,hx,lx); + return x; +} +weak_alias (__nextafterl, nextafterl) diff --git a/sysdeps/i386/fpu/s_remquo.S b/sysdeps/i386/fpu/s_remquo.S new file mode 100644 index 0000000000..8ada191771 --- /dev/null +++ b/sysdeps/i386/fpu/s_remquo.S @@ -0,0 +1,36 @@ +/* + * Written by Ulrich Drepper . + * Based on e_remainder by J.T. Conklin . + * Public domain. + */ + +#include + +ENTRY(__remquo) + fldl 12(%esp) + fldl 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + /* Compute the congruent of the quotient. */ + movl %eax, %ecx + shrl $8, %eax + shrl $12, %ecx + andl $4, %ecx + andl $3, %eax + orl %eax, %ecx + movl $0xef2960, %eax + shrl %cl, %eax + andl $3, %eax + movl 20(%esp), %ecx + movl 8(%esp), %edx + xorl 16(%esp), %edx + testl $0x80000000, %edx + jz 1f + negl %eax +1: movl %eax, (%ecx) + ret +END (__remquo) +weak_alias (__remquo, remquo) diff --git a/sysdeps/i386/fpu/s_remquof.S b/sysdeps/i386/fpu/s_remquof.S new file mode 100644 index 0000000000..f60aec9c46 --- /dev/null +++ b/sysdeps/i386/fpu/s_remquof.S @@ -0,0 +1,36 @@ +/* + * Written by Ulrich Drepper . + * Based on e_remainder by J.T. Conklin . + * Public domain. + */ + +#include + +ENTRY(__remquof) + flds 8(%esp) + flds 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + /* Compute the congruent of the quotient. */ + movl %eax, %ecx + shrl $8, %eax + shrl $12, %ecx + andl $4, %ecx + andl $3, %eax + orl %eax, %ecx + movl $0xef2960, %eax + shrl %cl, %eax + andl $3, %eax + movl 12(%esp), %ecx + movl 4(%esp), %edx + xorl 8(%esp), %edx + testl $0x80000000, %edx + jz 1f + negl %eax +1: movl %eax, (%ecx) + ret +END (__remquof) +weak_alias (__remquof, remquof) diff --git a/sysdeps/i386/fpu/s_remquol.S b/sysdeps/i386/fpu/s_remquol.S new file mode 100644 index 0000000000..115d6e874b --- /dev/null +++ b/sysdeps/i386/fpu/s_remquol.S @@ -0,0 +1,36 @@ +/* + * Written by Ulrich Drepper . + * Based on e_remainder by J.T. Conklin . + * Public domain. + */ + +#include + +ENTRY(__remquol) + fldt 16(%esp) + fldt 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + /* Compute the congruent of the quotient. */ + movl %eax, %ecx + shrl $8, %eax + shrl $12, %ecx + andl $4, %ecx + andl $3, %eax + orl %eax, %ecx + movl $0xef2960, %eax + shrl %cl, %eax + andl $3, %eax + movl 28(%esp), %ecx + movl 12(%esp), %edx + xorl 24(%esp), %edx + testl $0x8000, %edx + jz 1f + negl %eax +1: movl %eax, (%ecx) + ret +END (__remquol) +weak_alias (__remquol, remquol) diff --git a/sysdeps/i386/fpu/s_rint.S b/sysdeps/i386/fpu/s_rint.S new file mode 100644 index 0000000000..be36c5f0ca --- /dev/null +++ b/sysdeps/i386/fpu/s_rint.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_rint.S,v 1.4 1995/05/09 00:16:08 jtc Exp $") + +ENTRY(__rint) + fldl 4(%esp) + frndint + ret +END (__rint) +weak_alias (__rint, rint) diff --git a/sysdeps/i386/fpu/s_rintf.S b/sysdeps/i386/fpu/s_rintf.S new file mode 100644 index 0000000000..2b358c1cf1 --- /dev/null +++ b/sysdeps/i386/fpu/s_rintf.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $") + +ENTRY(__rintf) + flds 4(%esp) + frndint + ret +END (__rintf) +weak_alias (__rintf, rintf) diff --git a/sysdeps/i386/fpu/s_rintl.S b/sysdeps/i386/fpu/s_rintl.S new file mode 100644 index 0000000000..fd1ae6324e --- /dev/null +++ b/sysdeps/i386/fpu/s_rintl.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__rintl) + fldt 4(%esp) + frndint + ret +END (__rintl) +weak_alias (__rintl, rintl) diff --git a/sysdeps/i386/fpu/s_scalbln.c b/sysdeps/i386/fpu/s_scalbln.c new file mode 100644 index 0000000000..1009713fbc --- /dev/null +++ b/sysdeps/i386/fpu/s_scalbln.c @@ -0,0 +1,2 @@ +/* Nothing to do. This function is the same as scalbn. So we define an + alias. */ diff --git a/sysdeps/i386/fpu/s_scalblnf.c b/sysdeps/i386/fpu/s_scalblnf.c new file mode 100644 index 0000000000..5e558c3540 --- /dev/null +++ b/sysdeps/i386/fpu/s_scalblnf.c @@ -0,0 +1,2 @@ +/* Nothing to do. This function is the same as scalbnf. So we define an + alias. */ diff --git a/sysdeps/i386/fpu/s_scalblnl.c b/sysdeps/i386/fpu/s_scalblnl.c new file mode 100644 index 0000000000..cda2ec11c8 --- /dev/null +++ b/sysdeps/i386/fpu/s_scalblnl.c @@ -0,0 +1,2 @@ +/* Nothing to do. This function is the same as scalbnl. So we define an + alias. */ diff --git a/sysdeps/i386/fpu/s_scalbn.S b/sysdeps/i386/fpu/s_scalbn.S new file mode 100644 index 0000000000..ea9e25f094 --- /dev/null +++ b/sysdeps/i386/fpu/s_scalbn.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_scalbn.S,v 1.4 1995/05/09 00:19:06 jtc Exp $") + +ENTRY(__scalbn) + fildl 12(%esp) + fldl 4(%esp) + fscale + fstp %st(1) + ret +END (__scalbn) +weak_alias (__scalbn, scalbn) +strong_alias (__scalbn, __scalbln) +weak_alias (__scalbn, scalbln) diff --git a/sysdeps/i386/fpu/s_scalbnf.S b/sysdeps/i386/fpu/s_scalbnf.S new file mode 100644 index 0000000000..dc8cfb4296 --- /dev/null +++ b/sysdeps/i386/fpu/s_scalbnf.S @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_scalbnf.S,v 1.3 1995/05/09 00:19:59 jtc Exp $") + +ENTRY(__scalbnf) + fildl 8(%esp) + flds 4(%esp) + fscale + fstp %st(1) + ret +END (__scalbnf) +weak_alias (__scalbnf, scalbnf) +strong_alias (__scalbnf, __scalblnf) +weak_alias (__scalbnf, scalblnf) diff --git a/sysdeps/i386/fpu/s_scalbnl.S b/sysdeps/i386/fpu/s_scalbnl.S new file mode 100644 index 0000000000..295494b3d2 --- /dev/null +++ b/sysdeps/i386/fpu/s_scalbnl.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__scalbnl) + fildl 16(%esp) + fldt 4(%esp) + fscale + fstp %st(1) + ret +END (__scalbnl) +weak_alias (__scalbnl, scalbnl) +strong_alias (__scalbnl, __scalblnl) +weak_alias (__scalbnl, scalblnl) diff --git a/sysdeps/i386/fpu/s_significand.S b/sysdeps/i386/fpu/s_significand.S new file mode 100644 index 0000000000..4859b7ed71 --- /dev/null +++ b/sysdeps/i386/fpu/s_significand.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_significand.S,v 1.4 1995/05/09 00:21:47 jtc Exp $") + +ENTRY(__significand) + fldl 4(%esp) + fxtract + fstp %st(1) + ret +END (__significand) +weak_alias (__significand, significand) diff --git a/sysdeps/i386/fpu/s_significandf.S b/sysdeps/i386/fpu/s_significandf.S new file mode 100644 index 0000000000..3a2de97759 --- /dev/null +++ b/sysdeps/i386/fpu/s_significandf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_significandf.S,v 1.3 1995/05/09 00:24:07 jtc Exp $") + +ENTRY(__significandf) + flds 4(%esp) + fxtract + fstp %st(1) + ret +END (__significandf) +weak_alias (__significandf, significandf) diff --git a/sysdeps/i386/fpu/s_significandl.S b/sysdeps/i386/fpu/s_significandl.S new file mode 100644 index 0000000000..e3a69cba73 --- /dev/null +++ b/sysdeps/i386/fpu/s_significandl.S @@ -0,0 +1,17 @@ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__significandl) + fldt 4(%esp) + fxtract + fstp %st(0) + ret +END (__significandl) +weak_alias (__significandl, significandl) diff --git a/sysdeps/i386/fpu/s_sin.S b/sysdeps/i386/fpu/s_sin.S new file mode 100644 index 0000000000..eb22d7e98b --- /dev/null +++ b/sysdeps/i386/fpu/s_sin.S @@ -0,0 +1,29 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $") + +ENTRY(__sin) + fldl 4(%esp) + fsin + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsin + ret +END (__sin) +weak_alias (__sin, sin) diff --git a/sysdeps/i386/fpu/s_sincos.S b/sysdeps/i386/fpu/s_sincos.S new file mode 100644 index 0000000000..fe99f42d18 --- /dev/null +++ b/sysdeps/i386/fpu/s_sincos.S @@ -0,0 +1,48 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__sincos) + fldl 4(%esp) + fsincos + movl 12(%esp), %ecx + movl 16(%esp), %edx + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstpl (%edx) + fstpl (%ecx) + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsincos + fstpl (%edx) + fstpl (%ecx) + ret +END(__sincos) +weak_alias(__sincos, sincos) diff --git a/sysdeps/i386/fpu/s_sincosf.S b/sysdeps/i386/fpu/s_sincosf.S new file mode 100644 index 0000000000..5bb13f3c33 --- /dev/null +++ b/sysdeps/i386/fpu/s_sincosf.S @@ -0,0 +1,48 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__sincosf) + flds 4(%esp) + fsincos + movl 8(%esp), %ecx + movl 12(%esp), %edx + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstps (%edx) + fstps (%ecx) + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsincos + fstps (%edx) + fstps (%ecx) + ret +END(__sincosf) +weak_alias(__sincosf, sincosf) diff --git a/sysdeps/i386/fpu/s_sincosl.S b/sysdeps/i386/fpu/s_sincosl.S new file mode 100644 index 0000000000..8b6694f09f --- /dev/null +++ b/sysdeps/i386/fpu/s_sincosl.S @@ -0,0 +1,48 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__sincosl) + fldt 4(%esp) + fsincos + movl 16(%esp), %ecx + movl 20(%esp), %edx + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstpt (%edx) + fstpt (%ecx) + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsincos + fstpt (%edx) + fstpt (%ecx) + ret +END(__sincosl) +weak_alias(__sincosl, sincosl) diff --git a/sysdeps/i386/fpu/s_sinf.S b/sysdeps/i386/fpu/s_sinf.S new file mode 100644 index 0000000000..a010d60f5e --- /dev/null +++ b/sysdeps/i386/fpu/s_sinf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $") + +/* A float's domain isn't large enough to require argument reduction. */ +ENTRY(__sinf) + flds 4(%esp) + fsin + ret +END (__sinf) +weak_alias (__sinf, sinf) diff --git a/sysdeps/i386/fpu/s_sinl.S b/sysdeps/i386/fpu/s_sinl.S new file mode 100644 index 0000000000..3e215de5e1 --- /dev/null +++ b/sysdeps/i386/fpu/s_sinl.S @@ -0,0 +1,31 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__sinl) + fldt 4(%esp) + fsin + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align ALIGNARG(4) +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsin + ret +END (__sinl) +weak_alias (__sinl, sinl) diff --git a/sysdeps/i386/fpu/s_tan.S b/sysdeps/i386/fpu/s_tan.S new file mode 100644 index 0000000000..7b3547af4c --- /dev/null +++ b/sysdeps/i386/fpu/s_tan.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_tan.S,v 1.5 1995/05/09 00:30:00 jtc Exp $") + +ENTRY(__tan) + fldl 4(%esp) + fptan + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstp %st(0) + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fptan + fstp %st(0) + ret +END (__tan) +weak_alias (__tan, tan) diff --git a/sysdeps/i386/fpu/s_tanf.S b/sysdeps/i386/fpu/s_tanf.S new file mode 100644 index 0000000000..7a7509119b --- /dev/null +++ b/sysdeps/i386/fpu/s_tanf.S @@ -0,0 +1,17 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $") + +/* A float's domain isn't large enough to require argument reduction. */ +ENTRY(__tanf) + flds 4(%esp) + fptan + fstp %st(0) + ret +END (__tanf) +weak_alias (__tanf, tanf) diff --git a/sysdeps/i386/fpu/s_tanl.S b/sysdeps/i386/fpu/s_tanl.S new file mode 100644 index 0000000000..f2bdd6a605 --- /dev/null +++ b/sysdeps/i386/fpu/s_tanl.S @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +RCSID("$NetBSD: $") + +ENTRY(__tanl) + fldt 4(%esp) + fptan + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstp %st(0) + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fptan + fstp %st(0) + ret +END (__tanl) +weak_alias (__tanl, tanl) diff --git a/sysdeps/i386/fpu/s_trunc.S b/sysdeps/i386/fpu/s_trunc.S new file mode 100644 index 0000000000..3100d716a9 --- /dev/null +++ b/sysdeps/i386/fpu/s_trunc.S @@ -0,0 +1,36 @@ +/* Truncate double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__trunc) + fldl 4(%esp) + subl $8, %esp + fstcw 4(%esp) + movl $0xc00, %edx + orl 4(%esp), %edx + movl %edx, (%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8, %esp + ret +END(__trunc) +weak_alias (__trunc, trunc) diff --git a/sysdeps/i386/fpu/s_truncf.S b/sysdeps/i386/fpu/s_truncf.S new file mode 100644 index 0000000000..275e5f714c --- /dev/null +++ b/sysdeps/i386/fpu/s_truncf.S @@ -0,0 +1,36 @@ +/* Truncate float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__truncf) + flds 4(%esp) + subl $8, %esp + fstcw 4(%esp) + movl $0xc00, %edx + orl 4(%esp), %edx + movl %edx, (%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8, %esp + ret +END(__truncf) +weak_alias (__truncf, truncf) diff --git a/sysdeps/i386/fpu/s_truncl.S b/sysdeps/i386/fpu/s_truncl.S new file mode 100644 index 0000000000..4c0bb0ce53 --- /dev/null +++ b/sysdeps/i386/fpu/s_truncl.S @@ -0,0 +1,36 @@ +/* Truncate long double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +ENTRY(__truncl) + fldt 4(%esp) + subl $8, %esp + fstcw 4(%esp) + movl $0xc00, %edx + orl 4(%esp), %edx + movl %edx, (%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8, %esp + ret +END(__truncl) +weak_alias (__truncl, truncl) diff --git a/sysdeps/i386/fpu/t_exp.c b/sysdeps/i386/fpu/t_exp.c new file mode 100644 index 0000000000..fd37963b05 --- /dev/null +++ b/sysdeps/i386/fpu/t_exp.c @@ -0,0 +1 @@ +/* Empty. Not needed. */ diff --git a/sysdeps/i386/i686/Implies b/sysdeps/i386/i686/Implies index 5e3b4cb5e7..b5c05ec7f2 100644 --- a/sysdeps/i386/i686/Implies +++ b/sysdeps/i386/i686/Implies @@ -2,4 +2,3 @@ # not really good to use heavily i586 optimized code on a i686. It's # better to use i486/i386 code. i386/i486 -libm-i387/i686 diff --git a/sysdeps/i386/i686/fpu/s_fdim.S b/sysdeps/i386/i686/fpu/s_fdim.S new file mode 100644 index 0000000000..6f722c5b07 --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fdim.S @@ -0,0 +1,42 @@ +/* Compute positive difference. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fdim) + fldl 4(%esp) // x + fldl 12(%esp) // x : y + + fucomi %st(1), %st + jp 1f + + fsubrp %st, %st(1) + fldz + fcomi %st(1), %st + fcmovb %st(1), %st + jmp 2f + +1: fucomi %st(0), %st + fcmovnu %st(1), %st +2: fstp %st(1) + ret +END(__fdim) +weak_alias (__fdim, fdim) diff --git a/sysdeps/i386/i686/fpu/s_fdimf.S b/sysdeps/i386/i686/fpu/s_fdimf.S new file mode 100644 index 0000000000..1bcaf0012e --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fdimf.S @@ -0,0 +1,42 @@ +/* Compute positive difference. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fdimf) + flds 4(%esp) // x + flds 8(%esp) // x : y + + fucomi %st(1), %st + jp 1f + + fsubrp %st, %st(1) + fldz + fcomi %st(1), %st + fcmovb %st(1), %st + jmp 2f + +1: fucomi %st(0), %st + fcmovnu %st(1), %st +2: fstp %st(1) + ret +END(__fdimf) +weak_alias (__fdimf, fdimf) diff --git a/sysdeps/i386/i686/fpu/s_fdiml.S b/sysdeps/i386/i686/fpu/s_fdiml.S new file mode 100644 index 0000000000..9e909ba60e --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fdiml.S @@ -0,0 +1,42 @@ +/* Compute positive difference. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fdiml) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + + fucomi %st(1), %st + jp 1f + + fsubrp %st, %st(1) + fldz + fcomi %st(1), %st + fcmovb %st(1), %st + jmp 2f + +1: fucomi %st(0), %st + fcmovnu %st(1), %st +2: fstp %st(1) + ret +END(__fdiml) +weak_alias (__fdiml, fdiml) diff --git a/sysdeps/i386/i686/fpu/s_fmax.S b/sysdeps/i386/i686/fpu/s_fmax.S new file mode 100644 index 0000000000..3639ba7470 --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fmax.S @@ -0,0 +1,40 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmax) + fldl 4(%esp) // x + fldl 12(%esp) // x : y + + fucomi %st(0), %st + fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise + + fxch + + fucomi %st(1), %st + fcmovb %st(1), %st + + fstp %st(1) + + ret +END(__fmax) +weak_alias (__fmax, fmax) diff --git a/sysdeps/i386/i686/fpu/s_fmaxf.S b/sysdeps/i386/i686/fpu/s_fmaxf.S new file mode 100644 index 0000000000..ad948d0b62 --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fmaxf.S @@ -0,0 +1,40 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmaxf) + flds 4(%esp) // x + flds 8(%esp) // x : y + + fucomi %st(0), %st + fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise + + fxch + + fucomi %st(1), %st + fcmovb %st(1), %st + + fstp %st(1) + + ret +END(__fmaxf) +weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/i386/i686/fpu/s_fmaxl.S b/sysdeps/i386/i686/fpu/s_fmaxl.S new file mode 100644 index 0000000000..14859b0a6d --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fmaxl.S @@ -0,0 +1,40 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmaxl) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + + fucomi %st(0), %st + fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise + + fxch + + fucomi %st(1), %st + fcmovb %st(1), %st + + fstp %st(1) + + ret +END(__fmaxl) +weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/i386/i686/fpu/s_fmin.S b/sysdeps/i386/i686/fpu/s_fmin.S new file mode 100644 index 0000000000..383e9579f6 --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fmin.S @@ -0,0 +1,38 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fmin) + fldl 4(%esp) // x + fldl 12(%esp) // x : y + + fucomi %st(0), %st + fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise + + fucomi %st(1), %st + fcmovnb %st(1), %st + + fstp %st(1) + + ret +END(__fmin) +weak_alias (__fmin, fmin) diff --git a/sysdeps/i386/i686/fpu/s_fminf.S b/sysdeps/i386/i686/fpu/s_fminf.S new file mode 100644 index 0000000000..f3dae00377 --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fminf.S @@ -0,0 +1,38 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fminf) + flds 4(%esp) // x + flds 8(%esp) // x : y + + fucomi %st(0), %st + fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise + + fucomi %st(1), %st + fcmovnb %st(1), %st + + fstp %st(1) + + ret +END(__fminf) +weak_alias (__fminf, fminf) diff --git a/sysdeps/i386/i686/fpu/s_fminl.S b/sysdeps/i386/i686/fpu/s_fminl.S new file mode 100644 index 0000000000..f125531112 --- /dev/null +++ b/sysdeps/i386/i686/fpu/s_fminl.S @@ -0,0 +1,38 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + .text +ENTRY(__fminl) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + + fucomi %st(0), %st + fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise + + fucomi %st(1), %st + fcmovnb %st(1), %st + + fstp %st(1) + + ret +END(__fminl) +weak_alias (__fminl, fminl) diff --git a/sysdeps/i960/Implies b/sysdeps/i960/Implies index f8c4079ab5..1d569744ab 100644 --- a/sysdeps/i960/Implies +++ b/sysdeps/i960/Implies @@ -1,2 +1,3 @@ # i960 family uses IEEE 754 floating point. -ieee754 +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/ieee754/Implies b/sysdeps/ieee754/Implies deleted file mode 100644 index 5c9e98b7ae..0000000000 --- a/sysdeps/ieee754/Implies +++ /dev/null @@ -1,2 +0,0 @@ -# For all IEEE machines, use Sun's fdlibm code. -libm-ieee754 diff --git a/sysdeps/ieee754/dbl-64/Dist b/sysdeps/ieee754/dbl-64/Dist new file mode 100644 index 0000000000..1bb7be3537 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/Dist @@ -0,0 +1 @@ +t_exp2.h diff --git a/sysdeps/ieee754/dbl-64/dbl2mpn.c b/sysdeps/ieee754/dbl-64/dbl2mpn.c new file mode 100644 index 0000000000..f7dead4936 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/dbl2mpn.c @@ -0,0 +1,107 @@ +/* Copyright (C) 1993, 1994, 1995, 1996, 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" +#include +#include +#include + +/* Convert a `double' in IEEE754 standard double-precision format to a + multi-precision integer representing the significand scaled up by its + number of bits (52 for double) and an integral power of two (MPN frexp). */ + +mp_size_t +__mpn_extract_double (mp_ptr res_ptr, mp_size_t size, + int *expt, int *is_neg, + double value) +{ + union ieee754_double u; + u.d = value; + + *is_neg = u.ieee.negative; + *expt = (int) u.ieee.exponent - IEEE754_DOUBLE_BIAS; + +#if BITS_PER_MP_LIMB == 32 + res_ptr[0] = u.ieee.mantissa1; /* Low-order 32 bits of fraction. */ + res_ptr[1] = u.ieee.mantissa0; /* High-order 20 bits. */ + #define N 2 +#elif BITS_PER_MP_LIMB == 64 + /* Hopefully the compiler will combine the two bitfield extracts + and this composition into just the original quadword extract. */ + res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; + #define N 1 +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif +/* The format does not fill the last limb. There are some zeros. */ +#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \ + - (DBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB))) + + if (u.ieee.exponent == 0) + { + /* A biased exponent of zero is a special case. + Either it is a zero or it is a denormal number. */ + if (res_ptr[0] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=2. */ + /* It's zero. */ + *expt = 0; + else + { + /* It is a denormal number, meaning it has no implicit leading + one bit, and its exponent is in fact the format minimum. */ + int cnt; + + if (res_ptr[N - 1] != 0) + { + count_leading_zeros (cnt, res_ptr[N - 1]); + cnt -= NUM_LEADING_ZEROS; +#if N == 2 + res_ptr[N - 1] = res_ptr[1] << cnt + | (N - 1) + * (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt)); + res_ptr[0] <<= cnt; +#else + res_ptr[N - 1] <<= cnt; +#endif + *expt = DBL_MIN_EXP - 1 - cnt; + } + else + { + count_leading_zeros (cnt, res_ptr[0]); + if (cnt >= NUM_LEADING_ZEROS) + { + res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS); + res_ptr[0] = 0; + } + else + { + res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt); + res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt); + } + *expt = DBL_MIN_EXP - 1 + - (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt; + } + } + } + else + /* Add the implicit leading one bit for a normalized number. */ + res_ptr[N - 1] |= 1L << (DBL_MANT_DIG - 1 - ((N - 1) * BITS_PER_MP_LIMB)); + + return N; +} diff --git a/sysdeps/ieee754/dbl-64/e_acos.c b/sysdeps/ieee754/dbl-64/e_acos.c new file mode 100644 index 0000000000..eb4080a8b8 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_acos.c @@ -0,0 +1,144 @@ +/* @(#)e_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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_acos.c,v 1.9 1995/05/12 04:57:13 jtc Exp $"; +#endif + +/* __ieee754_acos(x) + * Method : + * acos(x) = pi/2 - asin(x) + * acos(-x) = pi/2 + asin(x) + * For |x|<=0.5 + * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) + * For x>0.5 + * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) + * = 2asin(sqrt((1-x)/2)) + * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) + * = 2f + (2c + 2s*z*R(z)) + * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term + * for f so that f+c ~ sqrt(z). + * For x<-0.5 + * acos(x) = pi - 2asin(sqrt((1-|x|)/2)) + * = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z) + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN with invalid signal. + * + * Function needed: __ieee754_sqrt + */ + +#include "math.h" +#include "math_private.h" +#define one qS[0] + +#ifdef __STDC__ +static const double +#else +static double +#endif +pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ +pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ +pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ +pS[] = {1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ + -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ + 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ + -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ + 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ + 3.47933107596021167570e-05}, /* 0x3F023DE1, 0x0DFDF709 */ +qS[] ={1.0, -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ + 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ + -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ + 7.70381505559019352791e-02}; /* 0x3FB3B8C5, 0xB12E9282 */ + +#ifdef __STDC__ + double __ieee754_acos(double x) +#else + double __ieee754_acos(x) + double x; +#endif +{ + double z,p,q,r,w,s,c,df,p1,p2,p3,q1,q2,z2,z4,z6; + int32_t hx,ix; + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x3ff00000) { /* |x| >= 1 */ + u_int32_t lx; + GET_LOW_WORD(lx,x); + if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */ + if(hx>0) return 0.0; /* acos(1) = 0 */ + else return pi+2.0*pio2_lo; /* acos(-1)= pi */ + } + return (x-x)/(x-x); /* acos(|x|>1) is NaN */ + } + if(ix<0x3fe00000) { /* |x| < 0.5 */ + if(ix<=0x3c600000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ + z = x*x; +#ifdef DO_NOT_USE_THIS + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); +#else + p1 = z*pS[0]; z2=z*z; + p2 = pS[1]+z*pS[2]; z4=z2*z2; + p3 = pS[3]+z*pS[4]; z6=z4*z2; + q1 = one+z*qS[1]; + q2 = qS[2]+z*qS[3]; + p = p1 + z2*p2 + z4*p3 + z6*pS[5]; + q = q1 + z2*q2 + z4*qS[4]; +#endif + r = p/q; + return pio2_hi - (x - (pio2_lo-x*r)); + } else if (hx<0) { /* x < -0.5 */ + z = (one+x)*0.5; +#ifdef DO_NOT_USE_THIS + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); +#else + p1 = z*pS[0]; z2=z*z; + p2 = pS[1]+z*pS[2]; z4=z2*z2; + p3 = pS[3]+z*pS[4]; z6=z4*z2; + q1 = one+z*qS[1]; + q2 = qS[2]+z*qS[3]; + p = p1 + z2*p2 + z4*p3 + z6*pS[5]; + q = q1 + z2*q2 + z4*qS[4]; +#endif + s = __ieee754_sqrt(z); + r = p/q; + w = r*s-pio2_lo; + return pi - 2.0*(s+w); + } else { /* x > 0.5 */ + z = (one-x)*0.5; + s = __ieee754_sqrt(z); + df = s; + SET_LOW_WORD(df,0); + c = (z-df*df)/(s+df); +#ifdef DO_NOT_USE_THIS + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); +#else + p1 = z*pS[0]; z2=z*z; + p2 = pS[1]+z*pS[2]; z4=z2*z2; + p3 = pS[3]+z*pS[4]; z6=z4*z2; + q1 = one+z*qS[1]; + q2 = qS[2]+z*qS[3]; + p = p1 + z2*p2 + z4*p3 + z6*pS[5]; + q = q1 + z2*q2 + z4*qS[4]; +#endif + r = p/q; + w = r*s+c; + return 2.0*(df+w); + } +} diff --git a/sysdeps/ieee754/dbl-64/e_acosh.c b/sysdeps/ieee754/dbl-64/e_acosh.c new file mode 100644 index 0000000000..27c29cd8c9 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_acosh.c @@ -0,0 +1,69 @@ +/* @(#)e_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. + * ==================================================== + */ + +#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 + * acosh(x) = log [ x + sqrt(x*x-1) ] + * we have + * acosh(x) := log(x)+ln2, if x is large; else + * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. + * + * Special cases: + * acosh(x) is NaN with signal if x<1. + * acosh(NaN) is NaN without signal. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +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 t; + int32_t hx; + u_int32_t lx; + EXTRACT_WORDS(hx,lx,x); + if(hx<0x3ff00000) { /* x < 1 */ + 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 __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */ + } else if(((hx-0x3ff00000)|lx)==0) { + return 0.0; /* acosh(1) = 0 */ + } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ + t=x*x; + return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one))); + } else { /* 10.98 + * asin(x) = pi/2 - 2*(s+s*z*R(z)) + * = 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) + * and + * asin(x) = pi/2 - 2*(s+s*z*R(z)) + * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) + * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN with invalid signal. + * + */ + + +#include "math.h" +#include "math_private.h" +#define one qS[0] +#ifdef __STDC__ +static const double +#else +static double +#endif +huge = 1.000e+300, +pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ +pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ +pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ + /* coefficient for R(x^2) */ +pS[] = {1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ + -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ + 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ + -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ + 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ + 3.47933107596021167570e-05}, /* 0x3F023DE1, 0x0DFDF709 */ +qS[] = {1.0, -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ + 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ + -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ + 7.70381505559019352791e-02}; /* 0x3FB3B8C5, 0xB12E9282 */ + +#ifdef __STDC__ + double __ieee754_asin(double x) +#else + double __ieee754_asin(x) + double x; +#endif +{ + double t,w,p,q,c,r,s,p1,p2,p3,q1,q2,z2,z4,z6; + int32_t hx,ix; + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>= 0x3ff00000) { /* |x|>= 1 */ + u_int32_t lx; + GET_LOW_WORD(lx,x); + if(((ix-0x3ff00000)|lx)==0) + /* asin(1)=+-pi/2 with inexact */ + return x*pio2_hi+x*pio2_lo; + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + } else if (ix<0x3fe00000) { /* |x|<0.5 */ + if(ix<0x3e400000) { /* if |x| < 2**-27 */ + if(huge+x>one) return x;/* return x with inexact if x!=0*/ + } else { + t = x*x; +#ifdef DO_NOT_USE_THIS + p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); + q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); +#else + p1 = t*pS[0]; z2=t*t; + p2 = pS[1]+t*pS[2]; z4=z2*z2; + p3 = pS[3]+t*pS[4]; z6=z4*z2; + q1 = one+t*qS[1]; + q2 = qS[2]+t*qS[3]; + p = p1 + z2*p2 + z4*p3 + z6*pS[5]; + q = q1 + z2*q2 + z4*qS[4]; +#endif + w = p/q; + return x+x*w; + } + } + /* 1> |x|>= 0.5 */ + w = one-fabs(x); + t = w*0.5; +#ifdef DO_NOT_USE_THIS + p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); + q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); +#else + p1 = t*pS[0]; z2=t*t; + p2 = pS[1]+t*pS[2]; z4=z2*z2; + p3 = pS[3]+t*pS[4]; z6=z4*z2; + q1 = one+t*qS[1]; + q2 = qS[2]+t*qS[3]; + p = p1 + z2*p2 + z4*p3 + z6*pS[5]; + q = q1 + z2*q2 + z4*qS[4]; +#endif + s = __ieee754_sqrt(t); + if(ix>=0x3FEF3333) { /* if |x| > 0.975 */ + w = p/q; + t = pio2_hi-(2.0*(s+s*w)-pio2_lo); + } else { + w = s; + SET_LOW_WORD(w,0); + c = (t-w*w)/(s+w); + r = p/q; + p = 2.0*s*r-(pio2_lo-2.0*c); + q = pio4_hi-2.0*w; + t = pio4_hi-(p-q); + } + if(hx>0) return t; else return -t; +} diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c new file mode 100644 index 0000000000..ae7d759a9f --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_atan2.c @@ -0,0 +1,130 @@ +/* @(#)e_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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_atan2.c,v 1.8 1995/05/10 20:44:51 jtc Exp $"; +#endif + +/* __ieee754_atan2(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) = pi - arctan[y/(-x)] ... if x < 0, + * + * Special cases: + * + * ATAN2((anything), NaN ) is NaN; + * ATAN2(NAN , (anything) ) is NaN; + * ATAN2(+-0, +(anything but NaN)) is +-0 ; + * ATAN2(+-0, -(anything but NaN)) is +-pi ; + * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; + * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; + * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; + * ATAN2(+-INF,+INF ) is +-pi/4 ; + * ATAN2(+-INF,-INF ) is +-3pi/4; + * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +tiny = 1.0e-300, +zero = 0.0, +pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ +pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */ +pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ +pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ + +#ifdef __STDC__ + double __ieee754_atan2(double y, double x) +#else + double __ieee754_atan2(y,x) + double y,x; +#endif +{ + double z; + int32_t k,m,hx,hy,ix,iy; + u_int32_t lx,ly; + + EXTRACT_WORDS(hx,lx,x); + ix = hx&0x7fffffff; + EXTRACT_WORDS(hy,ly,y); + iy = hy&0x7fffffff; + if(((ix|((lx|-lx)>>31))>0x7ff00000)|| + ((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */ + return x+y; + if(((hx-0x3ff00000)|lx)==0) return __atan(y); /* x=1.0 */ + m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if((iy|ly)==0) { + switch(m) { + case 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 */ + } + } + /* when x = 0 */ + if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* when x is INF */ + if(ix==0x7ff00000) { + if(iy==0x7ff00000) { + switch(m) { + case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ + case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ + case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ + } + } else { + switch(m) { + case 0: return zero ; /* atan(+...,+INF) */ + case 1: return -zero ; /* atan(-...,+INF) */ + case 2: return pi+tiny ; /* atan(+...,-INF) */ + case 3: return -pi-tiny ; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* compute y/x */ + k = (iy-ix)>>20; + if(k > 60) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**60 */ + else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */ + else z=__atan(fabs(y/x)); /* safe to do y/x */ + switch (m) { + case 0: return z ; /* atan(+,+) */ + case 1: { + u_int32_t zh; + GET_HIGH_WORD(zh,z); + SET_HIGH_WORD(z,zh ^ 0x80000000); + } + return z ; /* atan(-,+) */ + case 2: return pi-(z-pi_lo);/* atan(+,-) */ + default: /* case 3 */ + return (z-pi_lo)-pi;/* atan(-,-) */ + } +} diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c new file mode 100644 index 0000000000..fa4fe675c9 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_atanh.c @@ -0,0 +1,74 @@ +/* @(#)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. + * ==================================================== + */ + +#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. + * + */ + +#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 + +#ifdef __STDC__ + double __ieee754_atanh(double x) +#else + double __ieee754_atanh(x) + double x; +#endif +{ + 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; +} diff --git a/sysdeps/ieee754/dbl-64/e_cosh.c b/sysdeps/ieee754/dbl-64/e_cosh.c new file mode 100644 index 0000000000..65106b9989 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_cosh.c @@ -0,0 +1,92 @@ +/* @(#)e_cosh.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. + * ==================================================== + */ + +#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 + * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- + * 2*exp(x) + * + * exp(x) + 1/exp(x) + * ln2/2 <= x <= 22 : cosh(x) := ------------------- + * 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) + * + * Special cases: + * cosh(x) is |x| if x is +INF, -INF, or NaN. + * only cosh(0)=1 is exact for finite x. + */ + +#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 t,w; + int32_t ix; + u_int32_t lx; + + /* High word of |x|. */ + 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; */ + if (ix < 0x40360000) { + t = __ieee754_exp(fabs(x)); + return half*t+half/t; + } + + /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ + if (ix < 0x40862e42) return half*__ieee754_exp(fabs(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + GET_LOW_WORD(lx,x); + if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { + w = __ieee754_exp(half*fabs(x)); + t = half*w; + return t*w; + } + + /* |x| > overflowthresold, cosh(x) overflow */ + return huge*huge; +} diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c new file mode 100644 index 0000000000..ee0b22f6ae --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_exp.c @@ -0,0 +1,162 @@ +/* Double-precision floating point e^x. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* How this works: + The basic design here is from + Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical + Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., + 17 (1), March 1991, pp. 26-45. + + The input value, x, is written as + + x = n * ln(2)_0 + t/512 + delta[t] + x + n * ln(2)_1 + + where: + - n is an integer, 1024 >= n >= -1075; + - ln(2)_0 is the first 43 bits of ln(2), and ln(2)_1 is the remainder, so + that |ln(2)_1| < 2^-32; + - t is an integer, 177 >= t >= -177 + - delta is based on a table entry, delta[t] < 2^-28 + - x is whatever is left, |x| < 2^-10 + + Then e^x is approximated as + + e^x = 2^n_1 ( 2^n_0 e^(t/512 + delta[t]) + + ( 2^n_0 e^(t/512 + delta[t]) + * ( p(x + n * ln(2)_1) + - n*ln(2)_1 + - n*ln(2)_1 * p(x + n * ln(2)_1) ) ) ) + + where + - p(x) is a polynomial approximating e(x)-1; + - e^(t/512 + delta[t]) is obtained from a table; + - n_1 + n_0 = n, so that |n_0| < DBL_MIN_EXP-1. + + If it happens that n_1 == 0 (this is the usual case), that multiplication + is omitted. + */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include + +extern const float __exp_deltatable[178]; +extern const double __exp_atable[355] /* __attribute__((mode(DF))) */; + +static const volatile double TWO1023 = 8.988465674311579539e+307; +static const volatile double TWOM1000 = 9.3326361850321887899e-302; + +double +__ieee754_exp (double x) +{ + static const double himark = 709.7827128933840868; + static const double lomark = -745.1332191019412221; + /* Check for usual case. */ + if (isless (x, himark) && isgreater (x, lomark)) + { + static const double THREEp42 = 13194139533312.0; + static const double THREEp51 = 6755399441055744.0; + /* 1/ln(2). */ + static const double M_1_LN2 = 1.442695040888963387; + /* ln(2), part 1 */ + static const double M_LN2_0 = .6931471805598903302; + /* ln(2), part 2 */ + static const double M_LN2_1 = 5.497923018708371155e-14; + + int tval, unsafe, n_i; + double x22, n, t, dely, result; + union ieee754_double ex2_u, scale_u; + fenv_t oldenv; + + feholdexcept (&oldenv); +#ifdef FE_TONEAREST + fesetround (FE_TONEAREST); +#endif + + /* Calculate n. */ + n = x * M_1_LN2 + THREEp51; + n -= THREEp51; + x = x - n*M_LN2_0; + + /* Calculate t/512. */ + t = x + THREEp42; + t -= THREEp42; + x -= t; + + /* Compute tval = t. */ + tval = (int) (t * 512.0); + + if (t >= 0) + x -= __exp_deltatable[tval]; + else + x += __exp_deltatable[-tval]; + + /* Now, the variable x contains x + n*ln(2)_1. */ + dely = n*M_LN2_1; + + /* Compute ex2 = 2^n_0 e^(t/512+delta[t]). */ + ex2_u.d = __exp_atable[tval+177]; + n_i = (int)n; + /* 'unsafe' is 1 iff n_1 != 0. */ + unsafe = abs(n_i) >= -DBL_MIN_EXP - 1; + ex2_u.ieee.exponent += n_i >> unsafe; + + /* Compute scale = 2^n_1. */ + scale_u.d = 1.0; + scale_u.ieee.exponent += n_i - (n_i >> unsafe); + + /* Approximate e^x2 - 1, using a fourth-degree polynomial, + with maximum error in [-2^-10-2^-28,2^-10+2^-28] + less than 4.9e-19. */ + x22 = (((0.04166666898464281565 + * x + 0.1666666766008501610) + * x + 0.499999999999990008) + * x + 0.9999999999999976685) * x; + /* Allow for impact of dely. */ + x22 -= dely + dely*x22; + + /* Return result. */ + fesetenv (&oldenv); + + result = x22 * ex2_u.d + ex2_u.d; + if (!unsafe) + return result; + else + return result * scale_u.d; + } + /* Exceptional cases: */ + else if (isless (x, himark)) + { + if (__isinf (x)) + /* e^-inf == 0, with no error. */ + return 0; + else + /* Underflow */ + return TWOM1000 * TWOM1000; + } + else + /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ + return TWO1023*x; +} diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c new file mode 100644 index 0000000000..2ce613574a --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_fmod.c @@ -0,0 +1,140 @@ +/* @(#)e_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. + * ==================================================== + */ + +#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 + */ + +#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 +{ + int32_t n,hx,hy,hz,ix,iy,sx,i; + u_int32_t lx,ly,lz; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hy,ly,y); + sx = hx&0x80000000; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ + ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx<=hy) { + if((hx>31]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(hx<0x00100000) { /* subnormal x */ + if(hx==0) { + for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; + } else { + for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; + } + } else ix = (hx>>20)-1023; + + /* determine iy = ilogb(y) */ + if(hy<0x00100000) { /* subnormal y */ + if(hy==0) { + for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; + } else { + for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; + } + } else iy = (hy>>20)-1023; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -1022) + hx = 0x00100000|(0x000fffff&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + if(n<=31) { + hx = (hx<>(32-n)); + lx <<= n; + } else { + hx = lx<<(n-32); + lx = 0; + } + } + if(iy >= -1022) + hy = 0x00100000|(0x000fffff&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + if(n<=31) { + hy = (hy<>(32-n)); + ly <<= n; + } else { + hy = ly<<(n-32); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} + else { + if((hz|lz)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + hx = hz+hz+(lz>>31); lx = lz+lz; + } + } + hz=hx-hy;lz=lx-ly; if(lx=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]; + while(hx<0x00100000) { /* normalize x */ + hx = hx+hx+(lx>>31); lx = lx+lx; + iy -= 1; + } + if(iy>= -1022) { /* normalize output */ + hx = ((hx-0x00100000)|((iy+1023)<<20)); + INSERT_WORDS(x,hx|sx,lx); + } else { /* subnormal output */ + n = -1022 - iy; + if(n<=20) { + lx = (lx>>n)|((u_int32_t)hx<<(32-n)); + hx >>= n; + } else if (n<=31) { + lx = (hx<<(32-n))|(lx>>n); hx = sx; + } else { + lx = hx>>(n-32); hx = sx; + } + INSERT_WORDS(x,hx|sx,lx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c new file mode 100644 index 0000000000..bd802c24f1 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c @@ -0,0 +1,51 @@ +/* Implementation of gamma function according to ISO C. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +double +__ieee754_gamma_r (double x, int *signgamp) +{ + /* We don't have a real gamma implementation now. We'll use lgamma + and the exp function. But due to the required boundary + conditions we must check some values separately. */ + int32_t hx; + u_int32_t lx; + + EXTRACT_WORDS (hx, lx, x); + + if (((hx & 0x7fffffff) | lx) == 0) + { + /* Return value for x == 0 is NaN with invalid exception. */ + *signgamp = 0; + return x / x; + } + if (hx < 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); + } + + /* XXX FIXME. */ + return __ieee754_exp (__ieee754_lgamma_r (x, signgamp)); +} diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c new file mode 100644 index 0000000000..76a77ec33a --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_hypot.c @@ -0,0 +1,128 @@ +/* @(#)e_hypot.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. + * ==================================================== + */ + +#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 : + * If (assume round-to-nearest) z=x*x+y*y + * has error less than sqrt(2)/2 ulp, than + * sqrt(z) has error less than 1 ulp (exercise). + * + * So, compute sqrt(x*x+y*y) with some care as + * follows to get the error below 1 ulp: + * + * Assume x>y>0; + * (if possible, set rounding to round-to-nearest) + * 1. if x > 2y use + * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y + * where x1 = x with lower 32 bits cleared, x2 = x-x1; else + * 2. if x <= 2y use + * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) + * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, + * y1= y with lower 32 bits chopped, y2 = y-y1. + * + * NOTE: scaling may be necessary if some argument is too + * large or too tiny + * + * Special cases: + * hypot(x,y) is INF if x or y is +INF or -INF; else + * 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) + */ + +#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 a,b,t1,t2,y1,y2,w; + int32_t j,k,ha,hb; + + GET_HIGH_WORD(ha,x); + ha &= 0x7fffffff; + GET_HIGH_WORD(hb,y); + hb &= 0x7fffffff; + if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} + SET_HIGH_WORD(a,ha); /* a <- |a| */ + 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(ha >= 0x7ff00000) { /* Inf or NaN */ + u_int32_t low; + w = a+b; /* for sNaN */ + GET_LOW_WORD(low,a); + if(((ha&0xfffff)|low)==0) w = a; + GET_LOW_WORD(low,b); + if(((hb^0x7ff00000)|low)==0) w = b; + return w; + } + /* scale a and b by 2**-600 */ + ha -= 0x25800000; hb -= 0x25800000; k += 600; + SET_HIGH_WORD(a,ha); + SET_HIGH_WORD(b,hb); + } + if(hb < 0x20b00000) { /* b < 2**-500 */ + if(hb <= 0x000fffff) { /* subnormal b or 0 */ + u_int32_t low; + GET_LOW_WORD(low,b); + if((hb|low)==0) return a; + t1=0; + SET_HIGH_WORD(t1,0x7fd00000); /* t1=2^1022 */ + b *= t1; + a *= t1; + k -= 1022; + } else { /* scale a and b by 2^600 */ + ha += 0x25800000; /* a *= 2^600 */ + hb += 0x25800000; /* b *= 2^600 */ + k -= 600; + SET_HIGH_WORD(a,ha); + SET_HIGH_WORD(b,hb); + } + } + /* medium size a and b */ + w = a-b; + if (w>b) { + t1 = 0; + SET_HIGH_WORD(t1,ha); + t2 = a-t1; + w = __ieee754_sqrt(t1*t1-(b*(-b)-t2*(a+t1))); + } else { + a = a+a; + y1 = 0; + SET_HIGH_WORD(y1,hb); + y2 = b - y1; + t1 = 0; + SET_HIGH_WORD(t1,ha+0x00100000); + t2 = a - t1; + w = __ieee754_sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); + } + if(k!=0) { + u_int32_t high; + t1 = 1.0; + GET_HIGH_WORD(high,t1); + SET_HIGH_WORD(t1,high+(k<<20)); + return t1*w; + } else return w; +} diff --git a/sysdeps/ieee754/dbl-64/e_j0.c b/sysdeps/ieee754/dbl-64/e_j0.c new file mode 100644 index 0000000000..55e8294bb9 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_j0.c @@ -0,0 +1,531 @@ +/* @(#)e_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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26, + 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): + * 1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ... + * 2. Reduce x to |x| since j0(x)=j0(-x), and + * for x in (0,2) + * 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) + * 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 + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one.) + * + * 3 Special cases + * j0(nan)= nan + * j0(0) = 1 + * j0(inf) = 0 + * + * Method -- y0(x): + * 1. For x<2. + * Since + * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) + * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. + * We use the following function to approximate y0, + * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 + * where + * U(z) = u00 + u01*z + ... + u06*z^6 + * V(z) = 1 + v01*z + ... + v04*z^4 + * with absolute approximation error bounded by 2**-72. + * 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) + * by the method mentioned above. + * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. + */ + +#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, +one = 1.0, +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + /* 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 */ + -4.61832688532103189199e-09}, /* 0xBE33D5E7, 0x73D63FCE */ +S[] = {0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */ + 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */ + 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 z, s,c,ss,cc,r,u,v,r1,r2,s1,s2,z2,z4; + int32_t hx,ix; + + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return one/(x*x); + x = fabs(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = __sin(x); + c = __cos(x); + ss = s-c; + cc = s+c; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = -__cos(x+x); + if ((s*c)0x48000000) z = (invsqrtpi*cc)/__sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*cc-v*ss)/__sqrt(x); + } + return z; + } + 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; + } + } + z = x*x; +#ifdef DO_NOT_USE_THIS + r = z*(R02+z*(R03+z*(R04+z*R05))); + s = one+z*(S01+z*(S02+z*(S03+z*S04))); +#else + r1 = z*R[2]; z2=z*z; + r2 = R[3]+z*R[4]; z4=z2*z2; + r = r1 + z2*r2 + z4*R[5]; + s1 = one+z*S[1]; + s2 = S[2]+z*S[3]; + s = s1 + z2*s2 + z4*S[4]; +#endif + if(ix < 0x3FF00000) { /* |x| < 1.00 */ + return one + z*(-0.25+(r/s)); + } else { + u = 0.5*x; + return((one+u)*(one-u)+z*(r/s)); + } +} + +#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 */ + 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */ + -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */ + 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */ + -3.98205194132103398453e-11}, /* 0xBDC5E43D, 0x693FB3C8 */ +V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ + 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */ + 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 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; + /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ + if(ix>=0x7ff00000) return one/(x+x*x); + if((ix|lx)==0) return -one/zero; + if(hx<0) return zero/zero; + 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. + */ + s = __sin(x); + c = __cos(x); + 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)0x48000000) z = (invsqrtpi*ss)/__sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*ss+v*cc)/__sqrt(x); + } + return z; + } + if(ix<=0x3e400000) { /* x < 2**-27 */ + return(U[0] + tpi*__ieee754_log(x)); + } + z = x*x; +#ifdef DO_NOT_USE_THIS + u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); + v = one+z*(v01+z*(v02+z*(v03+z*v04))); +#else + u1 = U[0]+z*U[1]; z2=z*z; + u2 = U[2]+z*U[3]; z4=z2*z2; + u3 = U[4]+z*U[5]; z6=z4*z2; + u = u1 + z2*u2 + z4*u3 + z6*U[6]; + v1 = one+z*V[0]; + v2 = V[1]+z*V[2]; + v = v1 + z2*v2 + z4*V[3]; +#endif + return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x))); +} + +/* 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) + * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*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 */ + -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */ + -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 */ + 1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */ + 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 */ + -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */ + -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 */ + 9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */ + 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 */ + -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */ + -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 */ + 1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */ + 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 */ + -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */ + -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 */ + 1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */ + 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ +}; + +#ifdef __STDC__ + static double pzero(double x) +#else + static double pzero(x) + double x; +#endif +{ +#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); + 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); +#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])))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; + r = r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3; +#endif + return one+ r/s; +} + + +/* 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)) + * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 + * 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 */ + 5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */ + 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 */ + 8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */ + 8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */ + -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 */ + 1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */ + 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 */ + 5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */ + 3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */ + -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 */ + 4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */ + 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 */ + 6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */ + 2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */ + -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 */ + 1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */ + 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 */ + 8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */ + 2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */ + -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ +}; + +#ifdef __STDC__ + static double qzero(double x) +#else + static double qzero(x) + double x; +#endif +{ +#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); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = qR8; q= qS8;} + else if(ix>=0x40122E8B){p = qR5; q= qS5;} + else if(ix>=0x4006DB6D){p = qR3; q= qS3;} + else if(ix>=0x40000000){p = qR2; q= qS2;} + 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]+z*q[5]))))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; z6=z4*z2; + r= r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3 +z6*q[5]; +#endif + return (-.125 + r/s)/x; +} diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c new file mode 100644 index 0000000000..daf025fdb7 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_j1.c @@ -0,0 +1,532 @@ +/* @(#)e_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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26, + 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): + * 1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ... + * 2. Reduce x to |x| since j1(x)=-j1(-x), and + * for x in (0,2) + * 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) + * 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 + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one.) + * + * 3 Special cases + * j1(nan)= nan + * j1(0) = 0 + * j1(inf) = 0 + * + * Method -- y1(x): + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 2. For x<2. + * Since + * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) + * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. + * We use the following function to approximate y1, + * y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2 + * where for x in [0,2] (abs err less than 2**-65.89) + * U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4 + * V(z) = 1 + v0[0]*z + ... + v0[4]*z^5 + * 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) + * 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 */ +tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + /* R0/S0 on [0,2] */ +R[] = {-6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */ + 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */ + -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */ + 4.96727999609584448412e-08}, /* 0x3E6AAAFA, 0x46CA0BD9 */ +S[] = {0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */ + 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */ + 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */ + 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 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; + y = fabs(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = __sin(y); + c = __cos(y); + ss = -s-c; + cc = s-c; + if(ix<0x7fe00000) { /* make sure y+y not overflow */ + z = __cos(y+y); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* + * 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>0x48000000) z = (invsqrtpi*cc)/__sqrt(y); + else { + u = pone(y); v = qone(y); + z = invsqrtpi*(u*cc-v*ss)/__sqrt(y); + } + if(hx<0) return -z; + else return z; + } + if(ix<0x3e400000) { /* |x|<2**-27 */ + if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */ + } + z = x*x; +#ifdef DO_NOT_USE_THIS + r = z*(r00+z*(r01+z*(r02+z*r03))); + s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); + r *= x; +#else + 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; + s1 = one+z*S[1]; + s2 = S[2]+z*S[3]; + s3 = S[4]+z*S[5]; + s = s1 + z2*s2 + z4*s3; +#endif + return(x*0.5+r/s); +} + +#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 */ + 6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */ + 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ +}; + +#ifdef __STDC__ + double __ieee754_y1(double x) +#else + double __ieee754_y1(x) + double x; +#endif +{ + 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; + /* 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 -one/zero; + if(hx<0) return zero/zero; + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = __sin(x); + c = __cos(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)/__sqrt(x); + else { + u = pone(x); v = qone(x); + z = invsqrtpi*(u*ss+v*cc)/__sqrt(x); + } + return z; + } + if(ix<=0x3c900000) { /* 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])))); +#else + u1 = U0[0]+z*U0[1];z2=z*z; + u2 = U0[2]+z*U0[3];z4=z2*z2; + u = u1 + z2*u2 + z4*U0[4]; + v1 = one+z*V0[0]; + v2 = V0[1]+z*V0[2]; + 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)); +} + +/* 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) + * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*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 */ + 4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */ + 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 */ + 9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */ + 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 */ + 1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */ + 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 */ + 7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */ + 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 */ + 3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */ + 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 */ + 8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */ + 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 */ + 1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */ + 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 */ + 1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */ + 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */ +}; + +#ifdef __STDC__ + static double pone(double x) +#else + static double pone(x) + double x; +#endif +{ +#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; + 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); +#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])))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; + r = r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3; +#endif + 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)) + * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 + * 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 */ + -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */ + -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 */ + 7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */ + 6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */ + -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 */ + -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */ + -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 */ + 4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */ + 2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */ + -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 */ + -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */ + -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 */ + 5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */ + 1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */ + -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 */ + -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */ + -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 */ + 7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */ + 1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */ + -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */ +}; + +#ifdef __STDC__ + static double qone(double x) +#else + static double qone(x) + double x; +#endif +{ +#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); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = qr8; q= qs8;} + else if(ix>=0x40122E8B){p = qr5; q= qs5;} + else if(ix>=0x4006DB6D){p = qr3; q= qs3;} + else if(ix>=0x40000000){p = qr2; q= qs2;} + 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]+z*q[5]))))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; z6=z4*z2; + r = r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3 + z6*q[5]; +#endif + return (.375 + r/s)/x; +} diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c new file mode 100644 index 0000000000..d63d7688a3 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -0,0 +1,281 @@ +/* @(#)e_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. + * ==================================================== + */ + +#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 + * 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 nx, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "math.h" +#include "math_private.h" + +#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 +{ + int32_t i,hx,ix,lx, sgn; + double a, b, temp, di; + double z, w; + + /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) + * Thus, J(-n,x) = J(n,-x) + */ + 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(n<0){ + n = -n; + x = -x; + hx ^= 0x80000000; + } + if(n==0) return(__ieee754_j0(x)); + 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; + 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 */ + /* (x >> n**2) + * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * + * n sin(xn)*sqt2 cos(xn)*sqt2 + * ---------------------------------- + * 0 s-c c+s + * 1 -s-c -c+s + * 2 -s+c -c-s + * 3 s+c c-s + */ + switch(n&3) { + case 0: temp = __cos(x)+__sin(x); break; + case 1: temp = -__cos(x)+__sin(x); break; + case 2: temp = -__cos(x)-__sin(x); break; + case 3: temp = __cos(x)-__sin(x); break; + } + b = invsqrtpi*temp/__sqrt(x); + } else { + a = __ieee754_j0(x); + b = __ieee754_j1(x); + for(i=1;i33) /* underflow */ + b = zero; + else { + temp = x*0.5; b = temp; + for (a=one,i=2;i<=n;i++) { + a *= (double)i; /* a = n! */ + b *= temp; /* b = (x/2)^n */ + } + b = b/a; + } + } else { + /* use backward recurrence */ + /* x x^2 x^2 + * J(n,x)/J(n-1,x) = ---- ------ ------ ..... + * 2n - 2(n+1) - 2(n+2) + * + * 1 1 1 + * (for large x) = ---- ------ ------ ..... + * 2n 2(n+1) 2(n+2) + * -- - ------ - ------ - + * x x x + * + * Let w = 2n/x and h=2/x, then the above quotient + * is equal to the continued fraction: + * 1 + * = ----------------------- + * 1 + * w - ----------------- + * 1 + * w+h - --------- + * w+2h - ... + * + * To determine how many terms needed, let + * Q(0) = w, Q(1) = w(w+h) - 1, + * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple + */ + /* determine k */ + double t,v; + double q0,q1,h,tmp; int32_t k,m; + w = (n+n)/(double)x; h = 2.0/(double)x; + q0 = w; z = w+h; q1 = w*z - 1.0; k=1; + while(q1<1.0e9) { + k += 1; z += h; + tmp = z*q1 - q0; + q0 = q1; + q1 = tmp; + } + m = n+n; + for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t); + a = t; + b = one; + /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) + * Hence, if n*(log(2n/x)) > ... + * single 8.8722839355e+01 + * double 7.09782712893383973096e+02 + * long double 1.1356523406294143949491931077970765006170e+04 + * then recurrent value may overflow and the result is + * likely underflow to zero + */ + tmp = n; + 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; + b *= di; + b = b/x - a; + a = temp; + di -= two; + } + } else { + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; + b *= di; + b = b/x - a; + a = temp; + di -= two; + /* scale b to avoid spurious overflow */ + if(b>1e100) { + a /= b; + t /= b; + b = one; + } + } + } + b = (t*__ieee754_j0(x)/b); + } + } + if(sgn==1) return -b; else return b; +} + +#ifdef __STDC__ + double __ieee754_yn(int n, double x) +#else + double __ieee754_yn(n,x) + int n; double x; +#endif +{ + int32_t i,hx,ix,lx; + int32_t sign; + double a, b, temp; + + 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 -one/zero; + if(hx<0) return zero/zero; + sign = 1; + if(n<0){ + n = -n; + sign = 1 - ((n&1)<<1); + } + if(n==0) return(__ieee754_y0(x)); + if(n==1) return(sign*__ieee754_y1(x)); + if(ix==0x7ff00000) return zero; + if(ix>=0x52D00000) { /* x > 2**302 */ + /* (x >> n**2) + * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * + * n sin(xn)*sqt2 cos(xn)*sqt2 + * ---------------------------------- + * 0 s-c c+s + * 1 -s-c -c+s + * 2 -s+c -c-s + * 3 s+c c-s + */ + switch(n&3) { + case 0: temp = __sin(x)-__cos(x); break; + case 1: temp = -__sin(x)-__cos(x); break; + case 2: temp = -__sin(x)+__cos(x); break; + case 3: temp = __sin(x)+__cos(x); break; + } + b = invsqrtpi*temp/__sqrt(x); + } else { + u_int32_t high; + a = __ieee754_y0(x); + b = __ieee754_y1(x); + /* quit if b is -inf */ + GET_HIGH_WORD(high,b); + for(i=1;i0) return b; else return -b; +} diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c new file mode 100644 index 0000000000..92e9556568 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c @@ -0,0 +1,314 @@ +/* @(#)er_lgamma.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. + * ==================================================== + */ + +#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) + * for example, + * lgamma(7.3) = log(6.3) + lgamma(6.3) + * = log(6.3*5.3) + lgamma(5.3) + * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) + * 2. Polynomial approximation of lgamma around its + * minimun ymin=1.461632144968362245 to maintain monotonicity. + * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use + * Let z = x-ymin; + * lgamma(x) = -1.214862905358496078218 + z^2*poly(z) + * where + * poly(z) is a 14 degree polynomial. + * 2. Rational approximation in the primary interval [2,3] + * We use the following approximation: + * s = x-2.0; + * lgamma(x) = 0.5*s + s*P(s)/Q(s) + * with accuracy + * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71 + * Our algorithms are based on the following observation + * + * zeta(2)-1 2 zeta(3)-1 3 + * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... + * 2 3 + * + * where Euler = 0.5771... is the Euler constant, which is very + * close to 0.5. + * + * 3. For x>=8, we have + * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... + * (better formula: + * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) + * Let z = 1/x, then we approximation + * f(z) = lgamma(x) - (x-0.5)(log(x)-1) + * by + * 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)) + * 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)|) + * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); + * Note: one should avoid compute pi*(-x) directly in the + * computation of sin(pi*(-x)). + * + * 5. Special Cases + * lgamma(2+s) ~ s*(1-Euler) for tiny s + * lgamma(1)=lgamma(2)=0 + * lgamma(x) ~ -log(x) for tiny x + * lgamma(0) = lgamma(inf) = 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 */ +pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ +a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */ +a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */ +a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */ +a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */ +a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */ +a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */ +a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */ +a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */ +a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */ +a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */ +a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */ +a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */ +tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */ +tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */ +/* tt = -(tail of tf) */ +tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */ +t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */ +t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */ +t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */ +t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */ +t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */ +t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */ +t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */ +t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */ +t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */ +t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */ +t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */ +t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */ +t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */ +t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */ +t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */ +u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ +u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */ +u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */ +u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */ +u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */ +u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */ +v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */ +v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */ +v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */ +v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */ +v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */ +s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ +s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */ +s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */ +s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */ +s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ +s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ +s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ +r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ +r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */ +r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */ +r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */ +r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */ +r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */ +w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */ +w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */ +w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */ +w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */ +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 +{ + double y,z; + int n,ix; + + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; + + if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0); + y = -x; /* x is assume negative */ + + /* + * argument reduction, make sure inexact flag not raised if input + * is an integer + */ + z = __floor(y); + if(z!=y) { /* inexact anyway */ + y *= 0.5; + 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 */ + GET_LOW_WORD(n,z); + n &= 1; + y = n; + n<<= 2; + } + } + switch (n) { + case 0: y = __kernel_sin(pi*y,zero,0); break; + case 1: + case 2: y = __kernel_cos(pi*(0.5-y),zero); break; + case 3: + case 4: y = __kernel_sin(pi*(one-y),zero,0); break; + case 5: + case 6: y = -__kernel_cos(pi*(y-1.5),zero); break; + default: y = __kernel_sin(pi*(y-2.0),zero,0); break; + } + return -y; +} + + +#ifdef __STDC__ + double __ieee754_lgamma_r(double x, int *signgamp) +#else + double __ieee754_lgamma_r(x,signgamp) + double x; int *signgamp; +#endif +{ + double t,y,z,nadj,p,p1,p2,p3,q,r,w; + int i,hx,lx,ix; + + EXTRACT_WORDS(hx,lx,x); + + /* purge off +-inf, NaN, +-0, and negative arguments */ + *signgamp = 1; + if ((unsigned int) hx==0xfff00000&&lx==0) + return x-x; + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return x*x; + if((ix|lx)==0) return one/fabs(x); + if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ + if(hx<0) { + *signgamp = -1; + return -__ieee754_log(-x); + } else return -__ieee754_log(x); + } + if(hx<0) { + if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ + return x/zero; + t = sin_pi(x); + if(t==zero) return one/fabsf(t); /* -integer */ + nadj = __ieee754_log(pi/fabs(t*x)); + if(t=0x3FE76944) {y = one-x; i= 0;} + else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} + 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] */ + else {y=x-one;i=2;} + } + switch(i) { + case 0: + z = y*y; + p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); + p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); + p = y*p1+p2; + r += (p-0.5*y); break; + case 1: + z = y*y; + w = z*y; + p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ + p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); + p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); + p = z*p1-(tt-w*(p2+y*p3)); + r += (tf + p); break; + case 2: + p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); + p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); + r += (-0.5*y + p1/p2); + } + } + else if(ix<0x40200000) { /* x < 8.0 */ + i = (int)x; + t = zero; + y = x-(double)i; + p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); + q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); + r = half*y+p/q; + z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ + switch(i) { + case 7: z *= (y+6.0); /* FALLTHRU */ + case 6: z *= (y+5.0); /* FALLTHRU */ + case 5: z *= (y+4.0); /* FALLTHRU */ + case 4: z *= (y+3.0); /* FALLTHRU */ + case 3: z *= (y+2.0); /* FALLTHRU */ + r += __ieee754_log(z); break; + } + /* 8.0 <= x < 2**58 */ + } else if (ix < 0x43900000) { + t = __ieee754_log(x); + z = one/x; + y = z*z; + w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); + r = (x-half)*(t-one)+w; + } else + /* 2**58 <= x <= inf */ + r = x*(__ieee754_log(x)-one); + if(hx<0) r = nadj - r; + return r; +} diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c new file mode 100644 index 0000000000..851bd30198 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_log.c @@ -0,0 +1,165 @@ +/* @(#)e_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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_log.c,v 1.8 1995/05/10 20:45:49 jtc Exp $"; +#endif + +/* __ieee754_log(x) + * Return the logarithm of x + * + * Method : + * 1. Argument Reduction: find k and f such that + * x = 2^k * (1+f), + * where sqrt(2)/2 < 1+f < sqrt(2) . + * + * 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 + * We use a special Reme algorithm on [0,0.1716] to generate + * 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 + * 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) + * and + * | 2 14 | -58.45 + * | Lg1*s +...+Lg7*s - R(z) | <= 2 + * | | + * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. + * In order to guarantee error in log below 1ulp, we compute log + * by + * log(1+f) = f - s*(f - R) (if f is not too large) + * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) + * + * 3. Finally, log(x) = k*ln2 + log(1+f). + * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) + * Here ln2 is split into two floating point number: + * ln2_hi + ln2_lo, + * where n*ln2_hi is always exact for |n| < 2000. + * + * Special cases: + * log(x) is NaN with signal if x < 0 (including -INF) ; + * log(+INF) is +INF; log(0) is -INF with signal; + * log(NaN) is that NaN with no signal. + * + * Accuracy: + * according to an error analysis, the error is always less than + * 1 ulp (unit in the last place). + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math.h" +#include "math_private.h" +#define half Lg[8] +#define two Lg[9] +#ifdef __STDC__ +static const double +#else +static double +#endif +ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ +ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ +two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ + Lg[] = {0.0, + 6.666666666666735130e-01, /* 3FE55555 55555593 */ + 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ + 2.857142874366239149e-01, /* 3FD24924 94229359 */ + 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ + 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ + 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ + 1.479819860511658591e-01, /* 3FC2F112 DF3E5244 */ + 0.5, + 2.0}; +#ifdef __STDC__ +static const double zero = 0.0; +#else +static double zero = 0.0; +#endif + +#ifdef __STDC__ + double __ieee754_log(double x) +#else + double __ieee754_log(x) + double x; +#endif +{ + double hfsq,f,s,z,R,w,dk,t11,t12,t21,t22,w2,zw2; +#ifdef DO_NOT_USE_THIS + double t1,t2; +#endif + int32_t k,hx,i,j; + u_int32_t lx; + + 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 */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + hx &= 0x000fffff; + i = (hx+0x95f64)&0x100000; + SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ + k += (i>>20); + f = x-1.0; + if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ + if(f==zero) { + if(k==0) return zero; else {dk=(double)k; + return dk*ln2_hi+dk*ln2_lo;} + } + R = f*f*(half-0.33333333333333333*f); + if(k==0) return f-R; else {dk=(double)k; + return dk*ln2_hi-((R-dk*ln2_lo)-f);} + } + s = f/(two+f); + dk = (double)k; + z = s*s; + i = hx-0x6147a; + w = z*z; + j = 0x6b851-hx; +#ifdef DO_NOT_USE_THIS + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + R = t2+t1; +#else + t21 = Lg[5]+w*Lg[7]; w2=w*w; + t22 = Lg[1]+w*Lg[3]; zw2=z*w2; + t11 = Lg[4]+w*Lg[6]; + t12 = w*Lg[2]; + R = t12 + w2*t11 + z*t22 + zw2*t21; +#endif + i |= j; + if(i>0) { + hfsq=0.5*f*f; + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); + } else { + if(k==0) return f-s*(f-R); else + return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); + } +} diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c new file mode 100644 index 0000000000..e8a3278eaf --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_log10.c @@ -0,0 +1,98 @@ +/* @(#)e_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. + * ==================================================== + */ + +#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 + * + * Method : + * Let log10_2hi = leading 40 bits of log10(2) and + * log10_2lo = log10(2) - log10_2hi, + * ivln10 = 1/log(10) rounded. + * Then + * n = ilogb(x), + * if(n<0) n = n+1; + * x = scalbn(x,-n); + * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) + * + * Note 1: + * To guarantee log10(10**n)=n, where 10**n is normal, the rounding + * mode must set to Round-to-Nearest. + * Note 2: + * [1/log(10)] rounded to 53 bits has error .198 ulps; + * log10 is monotonic at all binary break points. + * + * Special cases: + * log10(x) is NaN with signal if x < 0; + * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; + * log10(NaN) is that NaN with no signal; + * log10(10**N) = N for N=0,1,...,22. + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ + +#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 y,z; + int32_t i,k,hx; + u_int32_t lx; + + 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 */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + i = ((u_int32_t)k&0x80000000)>>31; + 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; +} diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c new file mode 100644 index 0000000000..1e1496f00d --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -0,0 +1,352 @@ +/* @(#)e_pow.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; +#endif + +/* __ieee754_pow(x,y) return x**y + * + * n + * Method: Let x = 2 * (1+f) + * 1. Compute and return log2(x) in two pieces: + * log2(x) = w1 + w2, + * where w1 has 53-24 = 29 bit trailing zeros. + * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * arithmetic, where |y'|<=0.5. + * 3. Return x**y = 2**n*exp(y'*log2) + * + * Special cases: + * 1. (anything) ** 0 is 1 + * 2. (anything) ** 1 is itself + * 3. (anything) ** NAN is NAN + * 4. NAN ** (anything except 0) is NAN + * 5. +-(|x| > 1) ** +INF is +INF + * 6. +-(|x| > 1) ** -INF is +0 + * 7. +-(|x| < 1) ** +INF is +0 + * 8. +-(|x| < 1) ** -INF is +INF + * 9. +-1 ** +-INF is NAN + * 10. +0 ** (+anything except 0, NAN) is +0 + * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 12. +0 ** (-anything except 0, NAN) is +INF + * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 15. +INF ** (+anything except 0,NAN) is +INF + * 16. +INF ** (-anything except 0,NAN) is +0 + * 17. -INF ** (anything) = -0 ** (-anything) + * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 19. (-anything except 0 and inf) ** (non-integer) is NAN + * + * Accuracy: + * pow(x,y) returns x**y nearly rounded. In particular + * pow(integer,integer) + * always returns the correct integer provided it is + * representable. + * + * Constants : + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math.h" +#include "math_private.h" +#define zero C[0] +#define one C[1] +#define two C[2] +#define two53 C[3] +#define huge C[4] +#define tiny C[5] +#define L1 C[6] +#define L2 C[7] +#define L3 C[8] +#define L4 C[9] +#define L5 C[10] +#define L6 C[11] +#define P1 C[12] +#define P2 C[13] +#define P3 C[14] +#define P4 C[15] +#define P5 C[16] +#define lg2 C[17] +#define lg2_h C[18] +#define lg2_l C[19] +#define ovt C[20] +#define cp C[21] +#define cp_h C[22] +#define cp_l C[23] +#define ivln2 C[24] +#define ivln2_h C[25] +#define ivln2_l C[26] + +#ifdef __STDC__ +static const double +#else +static double +#endif +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ +dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +C[] = { +0.0, +1.0, +2.0, +9007199254740992.0 , +1.0e300, +1.0e-300, +5.99999999999994648725e-01 , +4.28571428578550184252e-01 , +3.33333329818377432918e-01 , +2.72728123808534006489e-01 , +2.30660745775561754067e-01 , +2.06975017800338417784e-01 , +1.66666666666666019037e-01 , +-2.77777777770155933842e-03 , +6.61375632143793436117e-05 , +-1.65339022054652515390e-06 , +4.13813679705723846039e-08 , +6.93147180559945286227e-01 , +6.93147182464599609375e-01 , +-1.90465429995776804525e-09 , +8.0085662595372944372e-0017 , +9.61796693925975554329e-01 , +9.61796700954437255859e-01 , +-7.02846165095275826516e-09 , +1.44269504088896338700e+00 , +1.44269502162933349609e+00 , +1.92596299112661746887e-08 }; + +#ifdef __STDC__ + double __ieee754_pow(double x, double y) +#else + double __ieee754_pow(x,y) + double x, y; +#endif +{ + double z,ax,z_h,z_l,p_h,p_l; + double y1,t1,t2,r,s,t,u,v,w, t12,t14,r_1,r_2,r_3; + int32_t i,j,k,yisint,n; + int32_t hx,hy,ix,iy; + u_int32_t lx,ly; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hy,ly,y); + ix = hx&0x7fffffff; iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if((iy|ly)==0) return C[1]; + + /* +-NaN return x+y */ + if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x43400000) yisint = 2; /* even integer y */ + else if(iy>=0x3ff00000) { + k = (iy>>20)-0x3ff; /* exponent */ + if(k>20) { + j = ly>>(52-k); + if((u_int32_t)(j<<(52-k))==ly) yisint = 2-(j&1); + } else if(ly==0) { + j = iy>>(20-k); + if((int32_t)(j<<(20-k))==iy) yisint = 2-(j&1); + } + } + } + + /* special value of y */ + if(ly==0) { + if (iy==0x7ff00000) { /* y is +-inf */ + if(((ix-0x3ff00000)|lx)==0) + return y - y; /* inf**+-1 is NaN */ + else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ + return (hy>=0)? y: C[0]; + else /* (|x|<1)**-,+inf = inf,0 */ + return (hy<0)?-y: C[0]; + } + if(iy==0x3ff00000) { /* y is +-1 */ + if(hy<0) return C[1]/x; else return x; + } + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3fe00000) { /* y is 0.5 */ + if(hx>=0) /* x >= +0 */ + return __ieee754_sqrt(x); + } + } + + ax = fabs(x); + /* special value of x */ + if(lx==0) { + if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = C[1]/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3ff00000)|yisint)==0) { + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + } + + /* (x<0)**(non-int) is NaN */ + if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + + /* |y| is huge */ + if(iy>0x41e00000) { /* if |y| > 2**31 */ + if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ + if(ix<=0x3fefffff) return (hy<0)? C[4]*C[4]:C[5]*C[5]; + if(ix>=0x3ff00000) return (hy>0)? C[4]*C[4]:C[5]*C[5]; + } + /* over/underflow if x is not close to one */ + if(ix<0x3fefffff) return (hy<0)? C[4]*C[4]:C[5]*C[5]; + if(ix>0x3ff00000) return (hy>0)? C[4]*C[4]:C[5]*C[5]; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-1; /* t has 20 trailing zeros */ + w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); + u = C[25]*t; /* ivln2_h has 21 sig. bits */ + v = t*C[26]-w*C[24]; + t1 = u+v; + SET_LOW_WORD(t1,0); + t2 = v-(t1-u); + } else { + double s2,s_h,s_l,t_h,t_l,s22,s24,s26,r1,r2,r3; + n = 0; + /* take care subnormal number */ + if(ix<0x00100000) + {ax *= C[3]; n -= 53; GET_HIGH_WORD(ix,ax); } + n += ((ix)>>20)-0x3ff; + j = ix&0x000fffff; + /* determine interval */ + ix = j|0x3ff00000; /* normalize ix */ + if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = s*s; +#ifdef DO_NOT_USE_THIS + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); +#else + r1 = C[10]+s2*C[11]; s22=s2*s2; + r2 = C[8]+s2*C[9]; s24=s22*s22; + r3 = C[6]+s2*C[7]; s26=s24*s22; + r = r3*s22 + r2*s24 + r1*s26; +#endif + r += s_l*(s_h+s); + s2 = s_h*s_h; + t_h = 3.0+s2+r; + SET_LOW_WORD(t_h,0); + t_l = r-((t_h-3.0)-s2); + /* u+v = s*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*s; + /* 2/(3log2)*(s+...) */ + p_h = u+v; + SET_LOW_WORD(p_h,0); + p_l = v-(p_h-u); + z_h = C[22]*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = C[23]*p_h+p_l*C[21]+dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (double)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + SET_LOW_WORD(t1,0); + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = C[1]; /* s (sign of result -ve**odd) = -1 else = 1 */ + if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) + s = -C[1];/* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + y1 = y; + SET_LOW_WORD(y1,0); + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + EXTRACT_WORDS(j,i,z); + if (j>=0x40900000) { /* z >= 1024 */ + if(((j-0x40900000)|i)!=0) /* if z > 1024 */ + return s*C[4]*C[4]; /* overflow */ + else { + if(p_l+C[20]>z-p_h) return s*C[4]*C[4]; /* overflow */ + } + } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ + if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ + return s*C[5]*C[5]; /* underflow */ + else { + if(p_l<=z-p_h) return s*C[5]*C[5]; /* underflow */ + } + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>20)-0x3ff; + n = 0; + if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00100000>>(k+1)); + k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ + t = C[0]; + SET_HIGH_WORD(t,n&~(0x000fffff>>k)); + n = ((n&0x000fffff)|0x00100000)>>(20-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + SET_LOW_WORD(t,0); + u = t*C[18]; + v = (p_l-(t-p_h))*C[17]+t*C[19]; + z = u+v; + w = v-(z-u); + t = z*z; +#ifdef DO_NOT_USE_THIS + t1 = z - t*(C[12]+t*(C[13]+t*(C[14]+t*(C[15]+t*C[16])))); +#else + r_1 = C[15]+t*C[16]; t12 = t*t; + r_2 = C[13]+t*C[14]; t14 = t12*t12; + r_3 = t*C[12]; + t1 = z - r_3 - t12*r_2 - t14*r_1; +#endif + r = (z*t1)/(t1-C[2])-(w+z*w); + z = C[1]-(r-z); + GET_HIGH_WORD(j,z); + j += (n<<20); + if((j>>20)<=0) z = __scalbn(z,n); /* subnormal output */ + else SET_HIGH_WORD(z,j); + return s*z; +} diff --git a/sysdeps/ieee754/dbl-64/e_rem_pio2.c b/sysdeps/ieee754/dbl-64/e_rem_pio2.c new file mode 100644 index 0000000000..a8a8cdb2b2 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_rem_pio2.c @@ -0,0 +1,183 @@ +/* @(#)e_rem_pio2.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_rem_pio2.c,v 1.8 1995/05/10 20:46:02 jtc Exp $"; +#endif + +/* __ieee754_rem_pio2(x,y) + * + * return the remainder of x rem pi/2 in y[0]+y[1] + * use __kernel_rem_pio2() + */ + +#include "math.h" +#include "math_private.h" + +/* + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + */ +#ifdef __STDC__ +static const int32_t two_over_pi[] = { +#else +static int32_t two_over_pi[] = { +#endif +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +}; + +#ifdef __STDC__ +static const int32_t npio2_hw[] = { +#else +static int32_t npio2_hw[] = { +#endif +0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, +0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, +0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, +0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, +0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, +0x404858EB, 0x404921FB, +}; + +/* + * invpio2: 53 bits of 2/pi + * pio2_1: first 33 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 33 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 33 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +#ifdef __STDC__ +static const double +#else +static double +#endif +zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ +pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ +pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ +pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ +pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ +pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ +pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ + +#ifdef __STDC__ + int32_t __ieee754_rem_pio2(double x, double *y) +#else + int32_t __ieee754_rem_pio2(x,y) + double x,y[]; +#endif +{ + double z,w,t,r,fn; + double tx[3]; + int32_t e0,i,j,nx,n,ix,hx; + u_int32_t low; + + GET_HIGH_WORD(hx,x); /* high word of x */ + ix = hx&0x7fffffff; + if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ + t = fabs(x); + n = (int32_t) (t*invpio2+half); + fn = (double)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 85 bit */ + if(n<32&&ix!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + u_int32_t high; + j = ix>>20; + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>16) { /* 2nd iteration needed, good to 118 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>49) { /* 3rd iteration need, 151 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } + /* + * all other (large) arguments + */ + if(ix>=0x7ff00000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } + /* set z = scalbn(|x|,ilogb(x)-23) */ + GET_LOW_WORD(low,x); + SET_LOW_WORD(z,low); + e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ + SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20))); + for(i=0;i<2;i++) { + tx[i] = (double)((int32_t)(z)); + z = (z-tx[i])*two24; + } + tx[2] = z; + nx = 3; + while(tx[nx-1]==zero) nx--; /* skip zero term */ + n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; +} diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c new file mode 100644 index 0000000000..6418081182 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_remainder.c @@ -0,0 +1,80 @@ +/* @(#)e_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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_remainder.c,v 1.8 1995/05/10 20:46:05 jtc Exp $"; +#endif + +/* __ieee754_remainder(x,p) + * 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 : + * Based on fmod() return x-[x/p]chopped*p exactlp. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double zero = 0.0; +#else +static double zero = 0.0; +#endif + + +#ifdef __STDC__ + double __ieee754_remainder(double x, double p) +#else + double __ieee754_remainder(x,p) + double x,p; +#endif +{ + int32_t hx,hp; + u_int32_t sx,lx,lp; + double p_half; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hp,lp,p); + sx = hx&0x80000000; + hp &= 0x7fffffff; + hx &= 0x7fffffff; + + /* purge off exception values */ + if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */ + if((hx>=0x7ff00000)|| /* x not finite */ + ((hp>=0x7ff00000)&& /* p is NaN */ + (((hp-0x7ff00000)|lp)!=0))) + return (x*p)/(x*p); + + + if (hp<=0x7fdfffff) x = __ieee754_fmod(x,p+p); /* now x < 2p */ + if (((hx-hp)|(lx-lp))==0) return zero*x; + x = fabs(x); + p = fabs(p); + if (hp<0x00200000) { + if(x+x>p) { + x-=p; + if(x+x>=p) x -= p; + } + } else { + p_half = 0.5*p; + if(x>p_half) { + x-=p; + if(x>=p_half) x -= p; + } + } + GET_HIGH_WORD(hx,x); + SET_HIGH_WORD(x,hx^sx); + return x; +} diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c new file mode 100644 index 0000000000..1701b9bb67 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_sinh.c @@ -0,0 +1,86 @@ +/* @(#)e_sinh.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. + * ==================================================== + */ + +#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) + * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(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) + * + * Special cases: + * sinh(x) is |x| if x is +INF, -INF, or NaN. + * only sinh(0)=0 is exact for finite x. + */ + +#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 t,w,h; + int32_t ix,jx; + u_int32_t lx; + + /* High word of |x|. */ + GET_HIGH_WORD(jx,x); + ix = jx&0x7fffffff; + + /* x is INF or NaN */ + if(ix>=0x7ff00000) 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 */ + t = __expm1(fabs(x)); + if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one)); + return h*(t+t/(t+one)); + } + + /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ + if (ix < 0x40862e42) return h*__ieee754_exp(fabs(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + GET_LOW_WORD(lx,x); + if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { + w = __ieee754_exp(0.5*fabs(x)); + t = h*w; + return t*w; + } + + /* |x| > overflowthresold, sinh(x) overflow */ + return x*shuge; +} diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c new file mode 100644 index 0000000000..67da5455f9 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/e_sqrt.c @@ -0,0 +1,452 @@ +/* @(#)e_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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_sqrt.c,v 1.8 1995/05/10 20:46:17 jtc Exp $"; +#endif + +/* __ieee754_sqrt(x) + * Return correctly rounded sqrt. + * ------------------------------------------ + * | Use the hardware sqrt if you have one | + * ------------------------------------------ + * Method: + * Bit by bit method using integer arithmetic. (Slow, but portable) + * 1. Normalization + * Scale x to y in [1,4) with even powers of 2: + * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then + * sqrt(x) = 2^k * sqrt(y) + * 2. Bit by bit computation + * Let q = sqrt(y) truncated to i bit after binary point (q = 1), + * i 0 + * i+1 2 + * s = 2*q , and y = 2 * ( y - q ). (1) + * i i i i + * + * To compute q from q , one checks whether + * i+1 i + * + * -(i+1) 2 + * (q + 2 ) <= y. (2) + * i + * -(i+1) + * If (2) is false, then q = q ; otherwise q = q + 2 . + * i+1 i i+1 i + * + * With some algebraic manipulation, it is not difficult to see + * that (2) is equivalent to + * -(i+1) + * s + 2 <= y (3) + * i i + * + * The advantage of (3) is that s and y can be computed by + * i i + * the following recurrence formula: + * if (3) is false + * + * s = s , y = y ; (4) + * i+1 i i+1 i + * + * otherwise, + * -i -(i+1) + * s = s + 2 , y = y - s - 2 (5) + * i+1 i i+1 i i + * + * One may easily use induction to prove (4) and (5). + * Note. Since the left hand side of (3) contain only i+2 bits, + * it does not necessary to do a full (53-bit) comparison + * in (3). + * 3. Final rounding + * After generating the 53 bits result, we compute one more bit. + * Together with the remainder, we can decide whether the + * result is exact, bigger than 1/2ulp, or less than 1/2ulp + * (it will never equal to 1/2ulp). + * The rounding mode can be detected by checking whether + * huge + tiny is equal to huge, and whether huge - tiny is + * equal to huge for some floating point number "huge" and "tiny". + * + * Special cases: + * sqrt(+-0) = +-0 ... exact + * sqrt(inf) = inf + * sqrt(-ve) = NaN ... with invalid signal + * sqrt(NaN) = NaN ... with invalid signal for signaling NaN + * + * Other methods : see the appended file at the end of the program below. + *--------------- + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double one = 1.0, tiny=1.0e-300; +#else +static double one = 1.0, tiny=1.0e-300; +#endif + +#ifdef __STDC__ + double __ieee754_sqrt(double x) +#else + double __ieee754_sqrt(x) + double x; +#endif +{ + double z; + int32_t sign = (int)0x80000000; + int32_t ix0,s0,q,m,t,i; + u_int32_t r,t1,s1,ix1,q1; + + EXTRACT_WORDS(ix0,ix1,x); + + /* take care of Inf and NaN */ + if((ix0&0x7ff00000)==0x7ff00000) { + return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf + sqrt(-inf)=sNaN */ + } + /* take care of zero */ + if(ix0<=0) { + if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ + else if(ix0<0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } + /* normalize x */ + m = (ix0>>20); + if(m==0) { /* subnormal x */ + while(ix0==0) { + m -= 21; + ix0 |= (ix1>>11); ix1 <<= 21; + } + for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; + m -= i-1; + ix0 |= (ix1>>(32-i)); + ix1 <<= i; + } + m -= 1023; /* unbias exponent */ + ix0 = (ix0&0x000fffff)|0x00100000; + if(m&1){ /* odd m, double x to make it even */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + } + m >>= 1; /* m = [m/2] */ + + /* generate sqrt(x) bit by bit */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ + r = 0x00200000; /* r = moving bit from right to left */ + + while(r!=0) { + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r>>=1; + } + + r = sign; + while(r!=0) { + t1 = s1+r; + t = s0; + if((t>31); + ix1 += ix1; + r>>=1; + } + + /* use floating add to find out rounding direction */ + if((ix0|ix1)!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;} + else if (z>one) { + if (q1==(u_int32_t)0xfffffffe) q+=1; + q1+=2; + } else + q1 += (q1&1); + } + } + ix0 = (q>>1)+0x3fe00000; + ix1 = q1>>1; + if ((q&1)==1) ix1 |= sign; + ix0 += (m <<20); + INSERT_WORDS(z,ix0,ix1); + return z; +} + +/* +Other methods (use floating-point arithmetic) +------------- +(This is a copy of a drafted paper by Prof W. Kahan +and K.C. Ng, written in May, 1986) + + Two algorithms are given here to implement sqrt(x) + (IEEE double precision arithmetic) in software. + Both supply sqrt(x) correctly rounded. The first algorithm (in + Section A) uses newton iterations and involves four divisions. + The second one uses reciproot iterations to avoid division, but + requires more multiplications. Both algorithms need the ability + to chop results of arithmetic operations instead of round them, + and the INEXACT flag to indicate when an arithmetic operation + is executed exactly with no roundoff error, all part of the + standard (IEEE 754-1985). The ability to perform shift, add, + subtract and logical AND operations upon 32-bit words is needed + too, though not part of the standard. + +A. sqrt(x) by Newton Iteration + + (1) Initial approximation + + Let x0 and x1 be the leading and the trailing 32-bit words of + a floating point number x (in IEEE double format) respectively + + 1 11 52 ...widths + ------------------------------------------------------ + x: |s| e | f | + ------------------------------------------------------ + msb lsb msb lsb ...order + + + ------------------------ ------------------------ + x0: |s| e | f1 | x1: | f2 | + ------------------------ ------------------------ + + By performing shifts and subtracts on x0 and x1 (both regarded + as integers), we obtain an 8-bit approximation of sqrt(x) as + follows. + + k := (x0>>1) + 0x1ff80000; + y0 := k - T1[31&(k>>15)]. ... y ~ sqrt(x) to 8 bits + Here k is a 32-bit integer and T1[] is an integer array containing + correction terms. Now magically the floating value of y (y's + leading 32-bit word is y0, the value of its trailing word is 0) + approximates sqrt(x) to almost 8-bit. + + Value of T1: + static int T1[32]= { + 0, 1024, 3062, 5746, 9193, 13348, 18162, 23592, + 29598, 36145, 43202, 50740, 58733, 67158, 75992, 85215, + 83599, 71378, 60428, 50647, 41945, 34246, 27478, 21581, + 16499, 12183, 8588, 5674, 3403, 1742, 661, 130,}; + + (2) Iterative refinement + + Apply Heron's rule three times to y, we have y approximates + sqrt(x) to within 1 ulp (Unit in the Last Place): + + y := (y+x/y)/2 ... almost 17 sig. bits + y := (y+x/y)/2 ... almost 35 sig. bits + y := y-(y-x/y)/2 ... within 1 ulp + + + Remark 1. + Another way to improve y to within 1 ulp is: + + y := (y+x/y) ... almost 17 sig. bits to 2*sqrt(x) + y := y - 0x00100006 ... almost 18 sig. bits to sqrt(x) + + 2 + (x-y )*y + y := y + 2* ---------- ...within 1 ulp + 2 + 3y + x + + + This formula has one division fewer than the one above; however, + it requires more multiplications and additions. Also x must be + scaled in advance to avoid spurious overflow in evaluating the + expression 3y*y+x. Hence it is not recommended uless division + is slow. If division is very slow, then one should use the + reciproot algorithm given in section B. + + (3) Final adjustment + + By twiddling y's last bit it is possible to force y to be + correctly rounded according to the prevailing rounding mode + as follows. Let r and i be copies of the rounding mode and + inexact flag before entering the square root program. Also we + use the expression y+-ulp for the next representable floating + numbers (up and down) of y. Note that y+-ulp = either fixed + point y+-1, or multiply y by nextafter(1,+-inf) in chopped + mode. + + I := FALSE; ... reset INEXACT flag I + R := RZ; ... set rounding mode to round-toward-zero + z := x/y; ... chopped quotient, possibly inexact + If(not I) then { ... if the quotient is exact + if(z=y) { + I := i; ... restore inexact flag + R := r; ... restore rounded mode + return sqrt(x):=y. + } else { + z := z - ulp; ... special rounding + } + } + i := TRUE; ... sqrt(x) is inexact + If (r=RN) then z=z+ulp ... rounded-to-nearest + If (r=RP) then { ... round-toward-+inf + y = y+ulp; z=z+ulp; + } + y := y+z; ... chopped sum + y0:=y0-0x00100000; ... y := y/2 is correctly rounded. + I := i; ... restore inexact flag + R := r; ... restore rounded mode + return sqrt(x):=y. + + (4) Special cases + + Square root of +inf, +-0, or NaN is itself; + Square root of a negative number is NaN with invalid signal. + + +B. sqrt(x) by Reciproot Iteration + + (1) Initial approximation + + Let x0 and x1 be the leading and the trailing 32-bit words of + a floating point number x (in IEEE double format) respectively + (see section A). By performing shifs and subtracts on x0 and y0, + we obtain a 7.8-bit approximation of 1/sqrt(x) as follows. + + k := 0x5fe80000 - (x0>>1); + y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits + + Here k is a 32-bit integer and T2[] is an integer array + containing correction terms. Now magically the floating + value of y (y's leading 32-bit word is y0, the value of + its trailing word y1 is set to zero) approximates 1/sqrt(x) + to almost 7.8-bit. + + Value of T2: + static int T2[64]= { + 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866, + 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f, + 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d, + 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0, + 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989, + 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd, + 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e, + 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd,}; + + (2) Iterative refinement + + Apply Reciproot iteration three times to y and multiply the + result by x to get an approximation z that matches sqrt(x) + to about 1 ulp. To be exact, we will have + -1ulp < sqrt(x)-z<1.0625ulp. + + ... set rounding mode to Round-to-nearest + y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x) + y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x) + ... special arrangement for better accuracy + z := x*y ... 29 bits to sqrt(x), with z*y<1 + z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x) + + Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that + (a) the term z*y in the final iteration is always less than 1; + (b) the error in the final result is biased upward so that + -1 ulp < sqrt(x) - z < 1.0625 ulp + instead of |sqrt(x)-z|<1.03125ulp. + + (3) Final adjustment + + By twiddling y's last bit it is possible to force y to be + correctly rounded according to the prevailing rounding mode + as follows. Let r and i be copies of the rounding mode and + inexact flag before entering the square root program. Also we + use the expression y+-ulp for the next representable floating + numbers (up and down) of y. Note that y+-ulp = either fixed + point y+-1, or multiply y by nextafter(1,+-inf) in chopped + mode. + + R := RZ; ... set rounding mode to round-toward-zero + switch(r) { + case RN: ... round-to-nearest + if(x<= z*(z-ulp)...chopped) z = z - ulp; else + if(x<= z*(z+ulp)...chopped) z = z; else z = z+ulp; + break; + case RZ:case RM: ... round-to-zero or round-to--inf + R:=RP; ... reset rounding mod to round-to-+inf + if(x=(z+ulp)*(z+ulp) ...rounded up) z = z+ulp; + break; + case RP: ... round-to-+inf + if(x>(z+ulp)*(z+ulp)...chopped) z = z+2*ulp; else + if(x>z*z ...chopped) z = z+ulp; + break; + } + + Remark 3. The above comparisons can be done in fixed point. For + example, to compare x and w=z*z chopped, it suffices to compare + x1 and w1 (the trailing parts of x and w), regarding them as + two's complement integers. + + ...Is z an exact square root? + To determine whether z is an exact square root of x, let z1 be the + trailing part of z, and also let x0 and x1 be the leading and + trailing parts of x. + + If ((z1&0x03ffffff)!=0) ... not exact if trailing 26 bits of z!=0 + I := 1; ... Raise Inexact flag: z is not exact + else { + j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2 + k := z1 >> 26; ... get z's 25-th and 26-th + fraction bits + I := i or (k&j) or ((k&(j+j+1))!=(x1&3)); + } + R:= r ... restore rounded mode + return sqrt(x):=z. + + If multiplication is cheaper then the foregoing red tape, the + Inexact flag can be evaluated by + + I := i; + I := (z*z!=x) or I. + + Note that z*z can overwrite I; this value must be sensed if it is + True. + + Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be + zero. + + -------------------- + z1: | f2 | + -------------------- + bit 31 bit 0 + + Further more, bit 27 and 26 of z1, bit 0 and 1 of x1, and the odd + or even of logb(x) have the following relations: + + ------------------------------------------------- + bit 27,26 of z1 bit 1,0 of x1 logb(x) + ------------------------------------------------- + 00 00 odd and even + 01 01 even + 10 10 odd + 10 00 even + 11 01 even + ------------------------------------------------- + + (4) Special cases (see (4) of Section A). + + */ diff --git a/sysdeps/ieee754/dbl-64/k_cos.c b/sysdeps/ieee754/dbl-64/k_cos.c new file mode 100644 index 0000000000..7e38ef7915 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/k_cos.c @@ -0,0 +1,107 @@ +/* @(#)k_cos.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_cos.c,v 1.8 1995/05/10 20:46:22 jtc Exp $"; +#endif + +/* + * __kernel_cos( x, y ) + * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * + * Algorithm + * 1. Since cos(-x) = cos(x), we need only to consider positive x. + * 2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0. + * 3. cos(x) is approximated by a polynomial of degree 14 on + * [0,pi/4] + * 4 14 + * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x + * where the remez error is + * + * | 2 4 6 8 10 12 14 | -58 + * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 + * | | + * + * 4 6 8 10 12 14 + * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then + * cos(x) = 1 - x*x/2 + r + * since cos(x+y) ~ cos(x) - sin(x)*y + * ~ cos(x) - x*y, + * a correction term is necessary in cos(x) and hence + * cos(x+y) = 1 - (x*x/2 - (r - x*y)) + * For better accuracy when x > 0.3, let qx = |x|/4 with + * the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125. + * Then + * cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)). + * Note that 1-qx and (x*x/2-qx) is EXACT here, and the + * magnitude of the latter is at least a quarter of x*x/2, + * thus, reducing the rounding error in the subtraction. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +C[] = { + 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ + 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ + -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ + 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ + -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ + 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ + -1.13596475577881948265e-11}; /* 0xBDA8FAE9, 0xBE8838D4 */ + +#ifdef __STDC__ + double __kernel_cos(double x, double y) +#else + double __kernel_cos(x, y) + double x,y; +#endif +{ + double a,hz,z,r,qx,r1,r2,r3,z1,z2,z3; + int32_t ix; + z = x*x; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x3e400000) { /* if x < 2**27 */ + if(((int)x)==0) return C[0]; /* generate inexact */ + } +#ifdef DO_NOT_USE_THIS + r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); +#else + r1=z*C[6];r1=r1+C[5];z1=z*z; + r2=z*C[4];r2=r2+C[3];z2=z1*z; + r3=z*C[2];r3=r3+C[1];z3=z2*z1; + r=z3*r1+z2*r2+z*r3; +#endif + if(ix < 0x3FD33333) /* if |x| < 0.3 */ + return C[0] - (0.5*z - (z*r - x*y)); + else { + if(ix > 0x3fe90000) { /* x > 0.78125 */ + qx = 0.28125; + } else { + INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */ + } + hz = 0.5*z-qx; + a = C[0]-qx; + return a - (hz - (z*r-x*y)); + } +} diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c new file mode 100644 index 0000000000..ccf1633bd4 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c @@ -0,0 +1,320 @@ +/* @(#)k_rem_pio2.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $"; +#endif + +/* + * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + * double x[],y[]; int e0,nx,prec; int ipio2[]; + * + * __kernel_rem_pio2 return the last three digits of N with + * y = x - N*pi/2 + * so that |y| < pi/2. + * + * The method is to compute the integer (mod 8) and fraction parts of + * (2/pi)*x without doing the full multiplication. In general we + * skip the part of the product that are known to be a huge integer ( + * more accurately, = 0 mod 8 ). Thus the number of operations are + * independent of the exponent of the input. + * + * (2/pi) is represented by an array of 24-bit integers in ipio2[]. + * + * Input parameters: + * x[] The input value (must be positive) is broken into nx + * pieces of 24-bit integers in double precision format. + * x[i] will be the i-th 24 bit of x. The scaled exponent + * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 + * match x's up to 24 bits. + * + * Example of breaking a double positive z into x[0]+x[1]+x[2]: + * e0 = ilogb(z)-23 + * z = scalbn(z,-e0) + * for i = 0,1,2 + * x[i] = floor(z) + * z = (z-x[i])*2**24 + * + * + * y[] ouput result in an array of double precision numbers. + * The dimension of y[] is: + * 24-bit precision 1 + * 53-bit precision 2 + * 64-bit precision 2 + * 113-bit precision 3 + * The actual value is the sum of them. Thus for 113-bit + * precision, one may have to do something like: + * + * long double t,w,r_head, r_tail; + * t = (long double)y[2] + (long double)y[1]; + * w = (long double)y[0]; + * r_head = t+w; + * r_tail = w - (r_head - t); + * + * e0 The exponent of x[0] + * + * nx dimension of x[] + * + * prec an integer indicating the precision: + * 0 24 bits (single) + * 1 53 bits (double) + * 2 64 bits (extended) + * 3 113 bits (quad) + * + * ipio2[] + * integer array, contains the (24*i)-th to (24*i+23)-th + * bit of 2/pi after binary point. The corresponding + * floating value is + * + * ipio2[i] * 2^(-24(i+1)). + * + * External function: + * double scalbn(), floor(); + * + * + * Here is the description of some local variables: + * + * jk jk+1 is the initial number of terms of ipio2[] needed + * in the computation. The recommended value is 2,3,4, + * 6 for single, double, extended,and quad. + * + * jz local integer variable indicating the number of + * terms of ipio2[] used. + * + * jx nx - 1 + * + * jv index for pointing to the suitable ipio2[] for the + * computation. In general, we want + * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 + * is an integer. Thus + * e0-3-24*jv >= 0 or (e0-3)/24 >= jv + * Hence jv = max(0,(e0-3)/24). + * + * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. + * + * q[] double array with integral value, representing the + * 24-bits chunk of the product of x and 2/pi. + * + * q0 the corresponding exponent of q[0]. Note that the + * exponent for q[i] would be q0-24*i. + * + * PIo2[] double precision array, obtained by cutting pi/2 + * into 24 bits chunks. + * + * f[] ipio2[] in floating point + * + * iq[] integer array by breaking up q[] in 24-bits chunk. + * + * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] + * + * ih integer. If >0 it indicates q[] is >= 0.5, hence + * it also indicates the *sign* of the result. + * + */ + + +/* + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ +#else +static int init_jk[] = {2,3,4,6}; +#endif + +#ifdef __STDC__ +static const double PIo2[] = { +#else +static double PIo2[] = { +#endif + 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ + 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ + 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ + 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ + 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ + 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ + 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ + 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ +}; + +#ifdef __STDC__ +static const double +#else +static double +#endif +zero = 0.0, +one = 1.0, +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ + +#ifdef __STDC__ + int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) +#else + int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + double x[], y[]; int e0,nx,prec; int32_t ipio2[]; +#endif +{ + int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + double z,fw,f[20],fq[20],q[20]; + + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; + + /* determine jx,jv,q0, note that 3>q0 */ + jx = nx-1; + jv = (e0-3)/24; if(jv<0) jv=0; + q0 = e0-24*(jv+1); + + /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; + + /* compute q[0],q[1],...q[jk] */ + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + } + + jz = jk; +recompute: + /* distill q[] into iq[] reversingly */ + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (double)((int32_t)(twon24* z)); + iq[i] = (int32_t)(z-two24*fw); + z = q[j-1]+fw; + } + + /* compute n */ + z = __scalbn(z,q0); /* actual value of z */ + z -= 8.0*__floor(z*0.125); /* trim off integer >= 8 */ + n = (int32_t) z; + z -= (double)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(24-q0)); n += i; + iq[jz-1] -= i<<(24-q0); + ih = iq[jz-1]>>(23-q0); + } + else if(q0==0) ih = iq[jz-1]>>23; + else if(z>=0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7fffff; break; + case 2: + iq[jz-1] &= 0x3fffff; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= __scalbn(one,q0); + } + } + + /* check if recomputation is needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ + + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (double) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } + + /* chop off zero terms */ + if(z==0.0) { + jz -= 1; q0 -= 24; + while(iq[jz]==0) { jz--; q0-=24;} + } else { /* break z into 24-bit if necessary */ + z = __scalbn(z,-q0); + if(z>=two24) { + fw = (double)((int32_t)(twon24*z)); + iq[jz] = (int32_t)(z-two24*fw); + jz += 1; q0 += 24; + iq[jz] = (int32_t) fw; + } else iq[jz] = (int32_t) z ; + } + + /* convert integer "bit" chunk to floating-point value */ + fw = __scalbn(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(double)iq[i]; fw*=twon24; + } + + /* compute PIo2[0,...,jp]*q[jz,...,0] */ + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } + + /* compress fq[] into y[] */ + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; +} diff --git a/sysdeps/ieee754/dbl-64/k_sin.c b/sysdeps/ieee754/dbl-64/k_sin.c new file mode 100644 index 0000000000..49c59228e0 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/k_sin.c @@ -0,0 +1,91 @@ +/* @(#)k_sin.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_sin.c,v 1.8 1995/05/10 20:46:31 jtc Exp $"; +#endif + +/* __kernel_sin( x, y, iy) + * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). + * + * Algorithm + * 1. Since sin(-x) = -sin(x), we need only to consider positive x. + * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. + * 3. sin(x) is approximated by a polynomial of degree 13 on + * [0,pi/4] + * 3 13 + * sin(x) ~ x + S1*x + ... + S6*x + * where + * + * |sin(x) 2 4 6 8 10 12 | -58 + * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 + * | x | + * + * 4. sin(x+y) = sin(x) + sin'(x')*y + * ~ sin(x) + (1-x*x/2)*y + * For better accuracy, let + * 3 2 2 2 2 + * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) + * then 3 2 + * sin(x) = x + (S1*x + (x *(r-y/2)+y)) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +S[] = { + 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ + -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ + 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ + -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ + 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ + -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ + 1.58969099521155010221e-10}; /* 0x3DE5D93A, 0x5ACFD57C */ + +#ifdef __STDC__ + double __kernel_sin(double x, double y, int iy) +#else + double __kernel_sin(x, y, iy) + double x,y; int iy; /* iy=0 if y is zero */ +#endif +{ + double z,r,v,z1,r1,r2; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* high word of x */ + if(ix<0x3e400000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; +#ifdef DO_NOT_USE_THIS + r = S2+z*(S3+z*(S4+z*(S5+z*S6))); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); +#else + r1 = S[5]+z*S[6]; z1 = z*z*z; + r2 = S[3]+z*S[4]; + r = S[2] + z*r2 + z1*r1; + if(iy==0) return x+v*(S[1]+z*r); + else return x-((z*(S[0]*y-v*r)-y)-v*S[1]); +#endif +} diff --git a/sysdeps/ieee754/dbl-64/k_tan.c b/sysdeps/ieee754/dbl-64/k_tan.c new file mode 100644 index 0000000000..55dafb8ebc --- /dev/null +++ b/sysdeps/ieee754/dbl-64/k_tan.c @@ -0,0 +1,145 @@ +/* @(#)k_tan.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_tan.c,v 1.8 1995/05/10 20:46:37 jtc Exp $"; +#endif + +/* __kernel_tan( x, y, k ) + * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * Input k indicates whether tan (if k=1) or + * -1/tan (if k= -1) is returned. + * + * Algorithm + * 1. Since tan(-x) = -tan(x), we need only to consider positive x. + * 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0. + * 3. tan(x) is approximated by a odd polynomial of degree 27 on + * [0,0.67434] + * 3 27 + * tan(x) ~ x + T1*x + ... + T13*x + * where + * + * |tan(x) 2 4 26 | -59.2 + * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2 + * | x | + * + * Note: tan(x+y) = tan(x) + tan'(x)*y + * ~ tan(x) + (1+x*x)*y + * Therefore, for better accuracy in computing tan(x+y), let + * 3 2 2 2 2 + * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13)))) + * then + * 3 2 + * tan(x+y) = x + (T1*x + (x *(r+y)+y)) + * + * 4. For x in [0.67434,pi/4], let y = pi/4 - x, then + * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y)) + * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y))) + */ + +#include "math.h" +#include "math_private.h" +#ifdef __STDC__ +static const double +#else +static double +#endif +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ +pio4lo= 3.06161699786838301793e-17, /* 0x3C81A626, 0x33145C07 */ +T[] = { + 3.33333333333334091986e-01, /* 0x3FD55555, 0x55555563 */ + 1.33333333333201242699e-01, /* 0x3FC11111, 0x1110FE7A */ + 5.39682539762260521377e-02, /* 0x3FABA1BA, 0x1BB341FE */ + 2.18694882948595424599e-02, /* 0x3F9664F4, 0x8406D637 */ + 8.86323982359930005737e-03, /* 0x3F8226E3, 0xE96E8493 */ + 3.59207910759131235356e-03, /* 0x3F6D6D22, 0xC9560328 */ + 1.45620945432529025516e-03, /* 0x3F57DBC8, 0xFEE08315 */ + 5.88041240820264096874e-04, /* 0x3F4344D8, 0xF2F26501 */ + 2.46463134818469906812e-04, /* 0x3F3026F7, 0x1A8D1068 */ + 7.81794442939557092300e-05, /* 0x3F147E88, 0xA03792A6 */ + 7.14072491382608190305e-05, /* 0x3F12B80F, 0x32F0A7E9 */ + -1.85586374855275456654e-05, /* 0xBEF375CB, 0xDB605373 */ + 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ +}; + +#ifdef __STDC__ + double __kernel_tan(double x, double y, int iy) +#else + double __kernel_tan(x, y, iy) + double x,y; int iy; +#endif +{ + double z,r,v,w,s,r1,r2,r3,v1,v2,v3,w2,w4; + int32_t ix,hx; + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; /* high word of |x| */ + if(ix<0x3e300000) /* x < 2**-28 */ + {if((int)x==0) { /* generate inexact */ + u_int32_t low; + GET_LOW_WORD(low,x); + if(((ix|low)|(iy+1))==0) return one/fabs(x); + else return (iy==1)? x: -one/x; + } + } + if(ix>=0x3FE59428) { /* |x|>=0.6744 */ + if(hx<0) {x = -x; y = -y;} + z = pio4-x; + w = pio4lo-y; + x = z+w; y = 0.0; + } + z = x*x; + w = z*z; + /* Break x^5*(T[1]+x^2*T[2]+...) into + * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + + * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) + */ +#ifdef DO_NOT_USE_THIS + r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); + v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); +#else + v1 = T[10]+w*T[12]; w2=w*w; + v2 = T[6]+w*T[8]; w4=w2*w2; + v3 = T[2]+w*T[4]; v1=z*v1; + r1 = T[9]+w*T[11]; v2=z*v2; + r2 = T[5]+w*T[7]; v3=z*v3; + r3 = T[1]+w*T[3]; + v = v3 + w2*v2 + w4*v1; + r = r3 + w2*r2 + w4*r1; +#endif + s = z*x; + r = y + z*(s*(r+v)+y); + r += T[0]*s; + w = x+r; + if(ix>=0x3FE59428) { + v = (double)iy; + return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r))); + } + if(iy==1) return w; + else { /* if allow error up to 2 ulp, + simply return -1.0/(x+r) here */ + /* compute -1.0/(x+r) accurately */ + double a,t; + z = w; + SET_LOW_WORD(z,0); + v = r-(z - x); /* z+v = r+x */ + t = a = -1.0/w; /* a = -1.0/w */ + SET_LOW_WORD(t,0); + s = 1.0+t*z; + return t+a*(s+t*v); + } +} diff --git a/sysdeps/ieee754/dbl-64/mpn2dbl.c b/sysdeps/ieee754/dbl-64/mpn2dbl.c new file mode 100644 index 0000000000..8145eb9c3d --- /dev/null +++ b/sysdeps/ieee754/dbl-64/mpn2dbl.c @@ -0,0 +1,46 @@ +/* Copyright (C) 1995, 1996, 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include +#include + +/* Convert a multi-precision integer of the needed number of bits (53 for + double) and an integral power of two to a `double' in IEEE754 double- + precision format. */ + +double +__mpn_construct_double (mp_srcptr frac_ptr, int expt, int negative) +{ + union ieee754_double u; + + u.ieee.negative = negative; + u.ieee.exponent = expt + IEEE754_DOUBLE_BIAS; +#if BITS_PER_MP_LIMB == 32 + u.ieee.mantissa1 = frac_ptr[0]; + u.ieee.mantissa0 = frac_ptr[1] & ((1 << (DBL_MANT_DIG - 32)) - 1); +#elif BITS_PER_MP_LIMB == 64 + u.ieee.mantissa1 = frac_ptr[0] & ((1L << 32) - 1); + u.ieee.mantissa0 = (frac_ptr[0] >> 32) & ((1 << (DBL_MANT_DIG - 32)) - 1); +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif + + return u.d; +} diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c new file mode 100644 index 0000000000..985cfe32e1 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_asinh.c @@ -0,0 +1,70 @@ +/* @(#)s_asinh.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. + * ==================================================== + */ + +#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 + * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] + * we have + * asinh(x) := x if 1+x*x=1, + * := sign(x)*(log(x)+ln2)) for large |x|, else + * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else + * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) + */ + +#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 t,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(huge+x>one) return x; /* return x inexact except 0 */ + } + if(ix>0x41b00000) { /* |x| > 2**28 */ + 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))); + } + if(hx>0) return w; else return -w; +} +weak_alias (__asinh, asinh) +#ifdef NO_LONG_DOUBLE +strong_alias (__asinh, __asinhl) +weak_alias (__asinh, asinhl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c new file mode 100644 index 0000000000..cad3ba12a8 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_atan.c @@ -0,0 +1,163 @@ +/* @(#)s_atan.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_atan.c,v 1.8 1995/05/10 20:46:45 jtc Exp $"; +#endif + +/* atan(x) + * Method + * 1. Reduce x to positive by atan(x) = -atan(-x). + * 2. According to the integer k=4t+0.25 chopped, t=x, the argument + * is further reduced to one of the following intervals and the + * arctangent of t is evaluated by the corresponding formula: + * + * [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) + * [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) ) + * [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) ) + * [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) ) + * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double atanhi[] = { +#else +static double atanhi[] = { +#endif + 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ + 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ + 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ + 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ +}; + +#ifdef __STDC__ +static const double atanlo[] = { +#else +static double atanlo[] = { +#endif + 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */ + 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */ + 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */ + 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */ +}; + +#ifdef __STDC__ +static const double aT[] = { +#else +static double aT[] = { +#endif + 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */ + -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */ + 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */ + -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */ + 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */ + -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */ + 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */ + -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */ + 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */ + -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */ + 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ +}; + +#ifdef __STDC__ + static const double +#else + static double +#endif +one = 1.0, +huge = 1.0e300; + +#ifdef __STDC__ + double __atan(double x) +#else + double __atan(x) + double x; +#endif +{ + double w,s1,z,s,w2,w4,s11,s12,s13,s21,s22,s23; + int32_t ix,hx,id; + + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x44100000) { /* if |x| >= 2^66 */ + u_int32_t low; + GET_LOW_WORD(low,x); + if(ix>0x7ff00000|| + (ix==0x7ff00000&&(low!=0))) + return x+x; /* NaN */ + if(hx>0) return atanhi[3]+atanlo[3]; + else return -atanhi[3]-atanlo[3]; + } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ + if (ix < 0x3e200000) { /* |x| < 2^-29 */ + if(huge+x>one) return x; /* raise inexact */ + } + id = -1; + } else { + x = fabs(x); + if (ix < 0x3ff30000) { /* |x| < 1.1875 */ + if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ + id = 0; x = (2.0*x-one)/(2.0+x); + } else { /* 11/16<=|x|< 19/16 */ + id = 1; x = (x-one)/(x+one); + } + } else { + if (ix < 0x40038000) { /* |x| < 2.4375 */ + id = 2; x = (x-1.5)/(one+1.5*x); + } else { /* 2.4375 <= |x| < 2^66 */ + id = 3; x = -1.0/x; + } + }} + /* end of argument reduction */ + z = x*x; + w = z*z; + /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ +#ifdef DO_NOT_USE_THIS + s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); + s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); + if (id<0) return x - x*(s1+s2); + else { + z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); + return (hx<0)? -z:z; + } +#else + s11 = aT[8]+w*aT[10]; w2=w*w; + s12 = aT[4]+w*aT[6]; w4=w2*w2; + s13 = aT[0]+w*aT[2]; + s21 = aT[7]+w*aT[9]; + s22 = aT[3]+w*aT[5]; + s23 = w*aT[1]; + s1 = s13 + w2*s12 + w4*s11; + s = s23 + w2*s22 + w4*s21 + z*s1; + if (id<0) return x - x*(s); + else { + z = atanhi[id] - ((x*(s) - atanlo[id]) - x); + return (hx<0)? -z:z; + } +#endif +} +weak_alias (__atan, atan) +#ifdef NO_LONG_DOUBLE +strong_alias (__atan, __atanl) +weak_alias (__atan, atanl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_cbrt.c b/sysdeps/ieee754/dbl-64/s_cbrt.c new file mode 100644 index 0000000000..753049d375 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_cbrt.c @@ -0,0 +1,76 @@ +/* Compute cubic root of double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Dirk Alboth and + Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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" + + +#define CBRT2 1.2599210498948731648 /* 2^(1/3) */ +#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */ + +static const double factor[5] = +{ + 1.0 / SQR_CBRT2, + 1.0 / CBRT2, + 1.0, + CBRT2, + SQR_CBRT2 +}; + + +double +__cbrt (double x) +{ + double xm, ym, u, t2; + int xe; + + /* Reduce X. XM now is an range 1.0 to 0.5. */ + xm = __frexp (fabs (x), &xe); + + /* If X is not finite or is null return it (with raising exceptions + if necessary. + Note: *Our* version of `frexp' sets XE to zero if the argument is + Inf or NaN. This is not portable but faster. */ + if (xe == 0 && fpclassify (x) <= FP_ZERO) + return x + x; + + u = (0.354895765043919860 + + ((1.50819193781584896 + + ((-2.11499494167371287 + + ((2.44693122563534430 + + ((-1.83469277483613086 + + (0.784932344976639262 - 0.145263899385486377 * xm) * xm) + * xm)) + * xm)) + * xm)) + * xm)); + + t2 = u * u * u; + + ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3]; + + return __ldexp (x > 0.0 ? ym : -ym, xe / 3); +} +weak_alias (__cbrt, cbrt) +#ifdef NO_LONG_DOUBLE +strong_alias (__cbrt, __cbrtl) +weak_alias (__cbrt, cbrtl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_ceil.c b/sysdeps/ieee754/dbl-64/s_ceil.c new file mode 100644 index 0000000000..1b352a679e --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_ceil.c @@ -0,0 +1,85 @@ +/* @(#)s_ceil.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_ceil.c,v 1.8 1995/05/10 20:46:53 jtc Exp $"; +#endif + +/* + * ceil(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to ceil(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double huge = 1.0e300; +#else +static double huge = 1.0e300; +#endif + +#ifdef __STDC__ + double __ceil(double x) +#else + double __ceil(x) + double x; +#endif +{ + int32_t i0,i1,j0; + u_int32_t i,j; + EXTRACT_WORDS(i0,i1,x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0<0) {i0=0x80000000;i1=0;} + else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0>0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0>0) { + if(j0==20) i0+=1; + else { + j = i1 + (1<<(52-j0)); + if(j=0x7ff00000) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_cos(y[0],y[1]); + case 1: return -__kernel_sin(y[0],y[1],1); + case 2: return -__kernel_cos(y[0],y[1]); + default: + return __kernel_sin(y[0],y[1],1); + } + } +} +weak_alias (__cos, cos) +#ifdef NO_LONG_DOUBLE +strong_alias (__cos, __cosl) +weak_alias (__cos, cosl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_erf.c b/sysdeps/ieee754/dbl-64/s_erf.c new file mode 100644 index 0000000000..d8b6629a72 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_erf.c @@ -0,0 +1,431 @@ +/* @(#)s_erf.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; +#endif + +/* double erf(double x) + * double erfc(double x) + * x + * 2 |\ + * erf(x) = --------- | exp(-t*t)dt + * sqrt(pi) \| + * 0 + * + * erfc(x) = 1-erf(x) + * Note that + * erf(-x) = -erf(x) + * erfc(-x) = 2 - erfc(x) + * + * Method: + * 1. For |x| in [0, 0.84375] + * erf(x) = x + x*R(x^2) + * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] + * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] + * where R = P/Q where P is an odd poly of degree 8 and + * Q is an odd poly of degree 10. + * -57.90 + * | R - (erf(x)-x)/x | <= 2 + * + * + * Remark. The formula is derived by noting + * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) + * and that + * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 + * is close to one. The interval is chosen because the fix + * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is + * near 0.6174), and by some experiment, 0.84375 is chosen to + * guarantee the error is less than one ulp for erf. + * + * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and + * c = 0.84506291151 rounded to single (24 bits) + * erf(x) = sign(x) * (c + P1(s)/Q1(s)) + * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 + * 1+(c+P1(s)/Q1(s)) if x < 0 + * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 + * Remark: here we use the taylor series expansion at x=1. + * erf(1+s) = erf(1) + s*Poly(s) + * = 0.845.. + P1(s)/Q1(s) + * That is, we use rational approximation to approximate + * erf(1+s) - (c = (single)0.84506291151) + * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] + * where + * P1(s) = degree 6 poly in s + * Q1(s) = degree 6 poly in s + * + * 3. For x in [1.25,1/0.35(~2.857143)], + * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) + * erf(x) = 1 - erfc(x) + * where + * R1(z) = degree 7 poly in z, (z=1/x^2) + * S1(z) = degree 8 poly in z + * + * 4. For x in [1/0.35,28] + * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 + * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 + * erf(x) = sign(x) *(1 - tiny) (raise inexact) + * erfc(x) = tiny*tiny (raise underflow) if x > 0 + * = 2 - tiny if x<0 + * + * 7. Special case: + * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, + * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, + * erfc/erf(NaN) is NaN + */ + + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +tiny = 1e-300, +half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ + /* c = (float)0.84506291151 */ +erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ +/* + * Coefficients for approximation to erf on [0,0.84375] + */ +efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ +efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ +pp[] = {1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ + -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ + -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ + -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ + -2.37630166566501626084e-05}, /* 0xBEF8EAD6, 0x120016AC */ +qq[] = {0.0, 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ + 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ + 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ + 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ + -3.96022827877536812320e-06}, /* 0xBED09C43, 0x42A26120 */ +/* + * Coefficients for approximation to erf in [0.84375,1.25] + */ +pa[] = {-2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ + 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ + -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ + 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ + -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ + 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ + -2.16637559486879084300e-03}, /* 0xBF61BF38, 0x0A96073F */ +qa[] = {0.0, 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ + 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ + 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ + 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ + 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ + 1.19844998467991074170e-02}, /* 0x3F888B54, 0x5735151D */ +/* + * Coefficients for approximation to erfc in [1.25,1/0.35] + */ +ra[] = {-9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ + -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ + -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ + -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ + -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ + -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ + -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ + -9.81432934416914548592e+00}, /* 0xC023A0EF, 0xC69AC25C */ +sa[] = {0.0,1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ + 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ + 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ + 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ + 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ + 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ + 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ + -6.04244152148580987438e-02}, /* 0xBFAEEFF2, 0xEE749A62 */ +/* + * Coefficients for approximation to erfc in [1/.35,28] + */ +rb[] = {-9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ + -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ + -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ + -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ + -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ + -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ + -4.83519191608651397019e+02}, /* 0xC07E384E, 0x9BDC383F */ +sb[] = {0.0,3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ + 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ + 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ + 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ + 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ + 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ + -2.24409524465858183362e+01}; /* 0xC03670E2, 0x42712D62 */ + +#ifdef __STDC__ + double __erf(double x) +#else + double __erf(x) + double x; +#endif +{ + int32_t hx,ix,i; + double R,S,P,Q,s,y,z,r; + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) { /* erf(nan)=nan */ + i = ((u_int32_t)hx>>31)<<1; + return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ + } + + if(ix < 0x3feb0000) { /* |x|<0.84375 */ + double r1,r2,s1,s2,s3,z2,z4; + if(ix < 0x3e300000) { /* |x|<2**-28 */ + if (ix < 0x00800000) + return 0.125*(8.0*x+efx8*x); /*avoid underflow */ + return x + efx*x; + } + z = x*x; +#ifdef DO_NOT_USE_THIS + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); +#else + r1 = pp[0]+z*pp[1]; z2=z*z; + r2 = pp[2]+z*pp[3]; z4=z2*z2; + s1 = one+z*qq[1]; + s2 = qq[2]+z*qq[3]; + s3 = qq[4]+z*qq[5]; + r = r1 + z2*r2 + z4*pp[4]; + s = s1 + z2*s2 + z4*s3; +#endif + y = r/s; + return x + x*y; + } + if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ + double s2,s4,s6,P1,P2,P3,P4,Q1,Q2,Q3,Q4; + s = fabs(x)-one; +#ifdef DO_NOT_USE_THIS + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); +#else + P1 = pa[0]+s*pa[1]; s2=s*s; + Q1 = one+s*qa[1]; s4=s2*s2; + P2 = pa[2]+s*pa[3]; s6=s4*s2; + Q2 = qa[2]+s*qa[3]; + P3 = pa[4]+s*pa[5]; + Q3 = qa[4]+s*qa[5]; + P4 = s6*pa[6]; + Q4 = s6*qa[6]; + P = P1 + s2*P2 + s4*P3 + s6*P4; + Q = Q1 + s2*Q2 + s4*Q3 + s6*Q4; +#endif + if(hx>=0) return erx + P/Q; else return -erx - P/Q; + } + if (ix >= 0x40180000) { /* inf>|x|>=6 */ + if(hx>=0) return one-tiny; else return tiny-one; + } + x = fabs(x); + s = one/(x*x); + if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ +#ifdef DO_NOT_USE_THIS + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( + ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( + sa5+s*(sa6+s*(sa7+s*sa8))))))); +#else + double R1,R2,R3,R4,S1,S2,S3,S4,s2,s4,s6,s8; + R1 = ra[0]+s*ra[1];s2 = s*s; + S1 = one+s*sa[1]; s4 = s2*s2; + R2 = ra[2]+s*ra[3];s6 = s4*s2; + S2 = sa[2]+s*sa[3];s8 = s4*s4; + R3 = ra[4]+s*ra[5]; + S3 = sa[4]+s*sa[5]; + R4 = ra[6]+s*ra[7]; + S4 = sa[6]+s*sa[7]; + R = R1 + s2*R2 + s4*R3 + s6*R4; + S = S1 + s2*S2 + s4*S3 + s6*S4 + s8*sa[8]; +#endif + } else { /* |x| >= 1/0.35 */ +#ifdef DO_NOT_USE_THIS + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( + rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( + sb5+s*(sb6+s*sb7)))))); +#else + double R1,R2,R3,S1,S2,S3,S4,s2,s4,s6; + R1 = rb[0]+s*rb[1];s2 = s*s; + S1 = one+s*sb[1]; s4 = s2*s2; + R2 = rb[2]+s*rb[3];s6 = s4*s2; + S2 = sb[2]+s*sb[3]; + R3 = rb[4]+s*rb[5]; + S3 = sb[4]+s*sb[5]; + S4 = sb[6]+s*sb[7]; + R = R1 + s2*R2 + s4*R3 + s6*rb[6]; + S = S1 + s2*S2 + s4*S3 + s6*S4; +#endif + } + z = x; + SET_LOW_WORD(z,0); + r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); + if(hx>=0) return one-r/x; else return r/x-one; +} +weak_alias (__erf, erf) +#ifdef NO_LONG_DOUBLE +strong_alias (__erf, __erfl) +weak_alias (__erf, erfl) +#endif + +#ifdef __STDC__ + double __erfc(double x) +#else + double __erfc(x) + double x; +#endif +{ + int32_t hx,ix; + double R,S,P,Q,s,y,z,r; + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) { /* erfc(nan)=nan */ + /* erfc(+-inf)=0,2 */ + return (double)(((u_int32_t)hx>>31)<<1)+one/x; + } + + if(ix < 0x3feb0000) { /* |x|<0.84375 */ + double r1,r2,s1,s2,s3,z2,z4; + if(ix < 0x3c700000) /* |x|<2**-56 */ + return one-x; + z = x*x; +#ifdef DO_NOT_USE_THIS + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); +#else + r1 = pp[0]+z*pp[1]; z2=z*z; + r2 = pp[2]+z*pp[3]; z4=z2*z2; + s1 = one+z*qq[1]; + s2 = qq[2]+z*qq[3]; + s3 = qq[4]+z*qq[5]; + r = r1 + z2*r2 + z4*pp[4]; + s = s1 + z2*s2 + z4*s3; +#endif + y = r/s; + if(hx < 0x3fd00000) { /* x<1/4 */ + return one-(x+x*y); + } else { + r = x*y; + r += (x-half); + return half - r ; + } + } + if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ + double s2,s4,s6,P1,P2,P3,P4,Q1,Q2,Q3,Q4; + s = fabs(x)-one; +#ifdef DO_NOT_USE_THIS + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); +#else + P1 = pa[0]+s*pa[1]; s2=s*s; + Q1 = one+s*qa[1]; s4=s2*s2; + P2 = pa[2]+s*pa[3]; s6=s4*s2; + Q2 = qa[2]+s*qa[3]; + P3 = pa[4]+s*pa[5]; + Q3 = qa[4]+s*qa[5]; + P4 = s6*pa[6]; + Q4 = s6*qa[6]; + P = P1 + s2*P2 + s4*P3 + s6*P4; + Q = Q1 + s2*Q2 + s4*Q3 + s6*Q4; +#endif + if(hx>=0) { + z = one-erx; return z - P/Q; + } else { + z = erx+P/Q; return one+z; + } + } + if (ix < 0x403c0000) { /* |x|<28 */ + x = fabs(x); + s = one/(x*x); + if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ +#ifdef DO_NOT_USE_THIS + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( + ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( + sa5+s*(sa6+s*(sa7+s*sa8))))))); +#else + double R1,R2,R3,R4,S1,S2,S3,S4,s2,s4,s6,s8; + R1 = ra[0]+s*ra[1];s2 = s*s; + S1 = one+s*sa[1]; s4 = s2*s2; + R2 = ra[2]+s*ra[3];s6 = s4*s2; + S2 = sa[2]+s*sa[3];s8 = s4*s4; + R3 = ra[4]+s*ra[5]; + S3 = sa[4]+s*sa[5]; + R4 = ra[6]+s*ra[7]; + S4 = sa[6]+s*sa[7]; + R = R1 + s2*R2 + s4*R3 + s6*R4; + S = S1 + s2*S2 + s4*S3 + s6*S4 + s8*sa[8]; +#endif + } else { /* |x| >= 1/.35 ~ 2.857143 */ + double R1,R2,R3,S1,S2,S3,S4,s2,s4,s6; + if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */ +#ifdef DO_NOT_USE_THIS + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( + rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( + sb5+s*(sb6+s*sb7)))))); +#else + R1 = rb[0]+s*rb[1];s2 = s*s; + S1 = one+s*sb[1]; s4 = s2*s2; + R2 = rb[2]+s*rb[3];s6 = s4*s2; + S2 = sb[2]+s*sb[3]; + R3 = rb[4]+s*rb[5]; + S3 = sb[4]+s*sb[5]; + S4 = sb[6]+s*sb[7]; + R = R1 + s2*R2 + s4*R3 + s6*rb[6]; + S = S1 + s2*S2 + s4*S3 + s6*S4; +#endif + } + z = x; + SET_LOW_WORD(z,0); + r = __ieee754_exp(-z*z-0.5625)* + __ieee754_exp((z-x)*(z+x)+R/S); + if(hx>0) return r/x; else return two-r/x; + } else { + if(hx>0) return tiny*tiny; else return two-tiny; + } +} +weak_alias (__erfc, erfc) +#ifdef NO_LONG_DOUBLE +strong_alias (__erfc, __erfcl) +weak_alias (__erfc, erfcl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_exp2.c b/sysdeps/ieee754/dbl-64/s_exp2.c new file mode 100644 index 0000000000..875d4d6f2c --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_exp2.c @@ -0,0 +1,129 @@ +/* Double-precision floating point 2^x. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* The basic design here is from + Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical + Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., + 17 (1), March 1991, pp. 26-45. + It has been slightly modified to compute 2^x instead of e^x. + */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include + +#include "t_exp2.h" + +static const volatile double TWO1023 = 8.988465674311579539e+307; +static const volatile double TWOM1000 = 9.3326361850321887899e-302; + +double +__ieee754_exp2 (double x) +{ + static const double himark = (double) DBL_MAX_EXP; + static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1) - 1.0; + + /* Check for usual case. */ + if (isless (x, himark) && isgreater (x, lomark)) + { + static const double THREEp42 = 13194139533312.0; + int tval, unsafe; + double rx, x22, result; + union ieee754_double ex2_u, scale_u; + fenv_t oldenv; + + feholdexcept (&oldenv); +#ifdef FE_TONEAREST + /* If we don't have this, it's too bad. */ + fesetround (FE_TONEAREST); +#endif + + /* 1. Argument reduction. + Choose integers ex, -256 <= t < 256, and some real + -1/1024 <= x1 <= 1024 so that + x = ex + t/512 + x1. + + First, calculate rx = ex + t/512. */ + rx = x + THREEp42; + rx -= THREEp42; + x -= rx; /* Compute x=x1. */ + /* Compute tval = (ex*512 + t)+256. + Now, t = (tval mod 512)-256 and ex=tval/512 [that's mod, NOT %; and + /-round-to-nearest not the usual c integer /]. */ + tval = (int) (rx * 512.0 + 256.0); + + /* 2. Adjust for accurate table entry. + Find e so that + x = ex + t/512 + e + x2 + where -1e6 < e < 1e6, and + (double)(2^(t/512+e)) + is accurate to one part in 2^-64. */ + + /* 'tval & 511' is the same as 'tval%512' except that it's always + positive. + Compute x = x2. */ + x -= exp2_deltatable[tval & 511]; + + /* 3. Compute ex2 = 2^(t/512+e+ex). */ + ex2_u.d = exp2_accuratetable[tval & 511]; + tval >>= 9; + unsafe = abs(tval) >= -DBL_MIN_EXP - 1; + ex2_u.ieee.exponent += tval >> unsafe; + scale_u.d = 1.0; + scale_u.ieee.exponent += tval - (tval >> unsafe); + + /* 4. Approximate 2^x2 - 1, using a fourth-degree polynomial, + with maximum error in [-2^-10-2^-30,2^-10+2^-30] + less than 10^-19. */ + + x22 = (((.0096181293647031180 + * x + .055504110254308625) + * x + .240226506959100583) + * x + .69314718055994495) * ex2_u.d; + + /* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */ + fesetenv (&oldenv); + + result = x22 * x + ex2_u.d; + + if (!unsafe) + return result; + else + return result * scale_u.d; + } + /* Exceptional cases: */ + else if (isless (x, himark)) + { + if (__isinf (x)) + /* e^-inf == 0, with no error. */ + return 0; + else + /* Underflow */ + return TWOM1000 * TWOM1000; + } + else + /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ + return TWO1023*x; +} diff --git a/sysdeps/ieee754/dbl-64/s_expm1.c b/sysdeps/ieee754/dbl-64/s_expm1.c new file mode 100644 index 0000000000..bfd15b2e31 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_expm1.c @@ -0,0 +1,243 @@ +/* @(#)s_expm1.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; +#endif + +/* expm1(x) + * Returns exp(x)-1, the exponential of x minus 1. + * + * Method + * 1. Argument reduction: + * Given x, find r and integer k such that + * + * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 + * + * Here a correction term c will be computed to compensate + * the error in r when rounded to a floating-point number. + * + * 2. Approximating expm1(r) by a special rational function on + * the interval [0,0.34658]: + * Since + * r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ... + * we define R1(r*r) by + * r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r) + * That is, + * R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r) + * = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r)) + * = 1 - r^2/60 + r^4/2520 - r^6/100800 + ... + * We use a special Reme algorithm on [0,0.347] to generate + * a polynomial of degree 5 in r*r to approximate R1. The + * maximum error of this polynomial approximation is bounded + * by 2**-61. In other words, + * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 + * where Q1 = -1.6666666666666567384E-2, + * Q2 = 3.9682539681370365873E-4, + * Q3 = -9.9206344733435987357E-6, + * Q4 = 2.5051361420808517002E-7, + * Q5 = -6.2843505682382617102E-9; + * (where z=r*r, and the values of Q1 to Q5 are listed below) + * with error bounded by + * | 5 | -61 + * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 + * | | + * + * expm1(r) = exp(r)-1 is then computed by the following + * specific way which minimize the accumulation rounding error: + * 2 3 + * r r [ 3 - (R1 + R1*r/2) ] + * expm1(r) = r + --- + --- * [--------------------] + * 2 2 [ 6 - r*(3 - R1*r/2) ] + * + * To compensate the error in the argument reduction, we use + * expm1(r+c) = expm1(r) + c + expm1(r)*c + * ~ expm1(r) + c + r*c + * Thus c+r*c will be added in as the correction terms for + * expm1(r+c). Now rearrange the term to avoid optimization + * screw up: + * ( 2 2 ) + * ({ ( r [ R1 - (3 - R1*r/2) ] ) } r ) + * expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- ) + * ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 ) + * ( ) + * + * = r - E + * 3. Scale back to obtain expm1(x): + * From step 1, we have + * expm1(x) = either 2^k*[expm1(r)+1] - 1 + * = or 2^k*[expm1(r) + (1-2^-k)] + * 4. Implementation notes: + * (A). To save one multiplication, we scale the coefficient Qi + * to Qi*2^i, and replace z by (x^2)/2. + * (B). To achieve maximum accuracy, we compute expm1(x) by + * (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf) + * (ii) if k=0, return r-E + * (iii) if k=-1, return 0.5*(r-E)-0.5 + * (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E) + * else return 1.0+2.0*(r-E); + * (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) + * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else + * (vii) return 2^k(1-((E+2^-k)-r)) + * + * Special cases: + * expm1(INF) is INF, expm1(NaN) is NaN; + * expm1(-INF) is -1, and + * for finite argument, only expm1(0)=0 is exact. + * + * Accuracy: + * according to an error analysis, the error is always less than + * 1 ulp (unit in the last place). + * + * Misc. info. + * For IEEE double + * if x > 7.09782712893383973096e+02 then expm1(x) overflow + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math.h" +#include "math_private.h" +#define one Q[0] +#ifdef __STDC__ +static const double +#else +static double +#endif +huge = 1.0e+300, +tiny = 1.0e-300, +o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ +ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */ +ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */ +invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */ + /* scaled coefficients related to expm1 */ +Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */ + 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ + -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ + 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ + -2.01099218183624371326e-07}; /* BE8AFDB7 6E09C32D */ + +#ifdef __STDC__ + double __expm1(double x) +#else + double __expm1(x) + double x; +#endif +{ + double y,hi,lo,c,t,e,hxs,hfx,r1,h2,h4,R1,R2,R3; + int32_t k,xsb; + u_int32_t hx; + + GET_HIGH_WORD(hx,x); + xsb = hx&0x80000000; /* sign bit of x */ + if(xsb==0) y=x; else y= -x; /* y = |x| */ + hx &= 0x7fffffff; /* high word of |x| */ + + /* filter out huge and non-finite argument */ + if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ + if(hx >= 0x40862E42) { /* if |x|>=709.78... */ + if(hx>=0x7ff00000) { + u_int32_t low; + GET_LOW_WORD(low,x); + if(((hx&0xfffff)|low)!=0) + return x+x; /* NaN */ + else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ + } + if(x > o_threshold) return huge*huge; /* overflow */ + } + if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */ + if(x+tiny<0.0) /* raise inexact */ + return tiny-one; /* return -1 */ + } + } + + /* argument reduction */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ + if(xsb==0) + {hi = x - ln2_hi; lo = ln2_lo; k = 1;} + else + {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} + } else { + k = invln2*x+((xsb==0)?0.5:-0.5); + t = k; + hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ + lo = t*ln2_lo; + } + x = hi - lo; + c = (hi-x)-lo; + } + else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ + t = huge+x; /* return x with inexact flags when x!=0 */ + return x - (t-(huge+x)); + } + else k = 0; + + /* x is now in primary range */ + hfx = 0.5*x; + hxs = x*hfx; +#ifdef DO_NOT_USE_THIS + r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); +#else + R1 = one+hxs*Q[1]; h2 = hxs*hxs; + R2 = Q[2]+hxs*Q[3]; h4 = h2*h2; + R3 = Q[4]+hxs*Q[5]; + r1 = R1 + h2*R2 + h4*R3; +#endif + t = 3.0-r1*hfx; + e = hxs*((r1-t)/(6.0 - x*t)); + if(k==0) return x - (x*e-hxs); /* c is 0 */ + else { + e = (x*(e-c)-c); + e -= hxs; + if(k== -1) return 0.5*(x-e)-0.5; + if(k==1) { + if(x < -0.25) return -2.0*(e-(x+0.5)); + else return one+2.0*(x-e); + } + if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ + u_int32_t high; + y = one-(e-x); + GET_HIGH_WORD(high,y); + SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ + return y-one; + } + t = one; + if(k<20) { + u_int32_t high; + SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ + y = t-(e-x); + GET_HIGH_WORD(high,y); + SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ + } else { + u_int32_t high; + SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */ + y = x-(e+t); + y += one; + GET_HIGH_WORD(high,y); + SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ + } + } + return y; +} +weak_alias (__expm1, expm1) +#ifdef NO_LONG_DOUBLE +strong_alias (__expm1, __expm1l) +weak_alias (__expm1, expm1l) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_fabs.c b/sysdeps/ieee754/dbl-64/s_fabs.c new file mode 100644 index 0000000000..1abe9432a3 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_fabs.c @@ -0,0 +1,40 @@ +/* @(#)s_fabs.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; +#endif + +/* + * fabs(x) returns the absolute value of x. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __fabs(double x) +#else + double __fabs(x) + double x; +#endif +{ + u_int32_t high; + GET_HIGH_WORD(high,x); + SET_HIGH_WORD(x,high&0x7fffffff); + return x; +} +weak_alias (__fabs, fabs) +#ifdef NO_LONG_DOUBLE +strong_alias (__fabs, __fabsl) +weak_alias (__fabs, fabsl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c new file mode 100644 index 0000000000..b12ff42360 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_finite.c @@ -0,0 +1,40 @@ +/* @(#)s_finite.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; +#endif + +/* + * finite(x) returns 1 is x is finite, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __finite(double x) +#else + int __finite(x) + double x; +#endif +{ + int32_t hx; + GET_HIGH_WORD(hx,x); + return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31); +} +weak_alias (__finite, finite) +#ifdef NO_LONG_DOUBLE +strong_alias (__finite, __finitel) +weak_alias (__finite, finitel) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_floor.c b/sysdeps/ieee754/dbl-64/s_floor.c new file mode 100644 index 0000000000..77db9ef392 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_floor.c @@ -0,0 +1,86 @@ +/* @(#)s_floor.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; +#endif + +/* + * floor(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double huge = 1.0e300; +#else +static double huge = 1.0e300; +#endif + +#ifdef __STDC__ + double __floor(double x) +#else + double __floor(x) + double x; +#endif +{ + int32_t i0,i1,j0; + u_int32_t i,j; + EXTRACT_WORDS(i0,i1,x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffff)|i1)!=0) + { i0=0xbff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) { + if(j0==20) i0+=1; + else { + j = i1+(1<<(52-j0)); + if(j, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +int +__fpclassify (double x) +{ + u_int32_t hx, lx; + int retval = FP_NORMAL; + + EXTRACT_WORDS (hx, lx, x); + lx |= hx & 0xfffff; + hx &= 0x7ff00000; + if ((hx | lx) == 0) + retval = FP_ZERO; + else if (hx == 0) + retval = FP_SUBNORMAL; + else if (hx == 0x7ff00000) + retval = lx != 0 ? FP_NAN : FP_INFINITE; + + return retval; +} diff --git a/sysdeps/ieee754/dbl-64/s_frexp.c b/sysdeps/ieee754/dbl-64/s_frexp.c new file mode 100644 index 0000000000..7dbddfde06 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_frexp.c @@ -0,0 +1,64 @@ +/* @(#)s_frexp.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_frexp.c,v 1.9 1995/05/10 20:47:24 jtc Exp $"; +#endif + +/* + * for non-zero x + * x = frexp(arg,&exp); + * return a double fp quantity x such that 0.5 <= |x| <1.0 + * and the corresponding binary exponent "exp". That is + * arg = x*2^exp. + * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg + * with *exp=0. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ + +#ifdef __STDC__ + double __frexp(double x, int *eptr) +#else + double __frexp(x, eptr) + double x; int *eptr; +#endif +{ + int32_t hx, ix, lx; + EXTRACT_WORDS(hx,lx,x); + ix = 0x7fffffff&hx; + *eptr = 0; + if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ + if (ix<0x00100000) { /* subnormal */ + x *= two54; + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + *eptr = -54; + } + *eptr += (ix>>20)-1022; + hx = (hx&0x800fffff)|0x3fe00000; + SET_HIGH_WORD(x,hx); + return x; +} +weak_alias (__frexp, frexp) +#ifdef NO_LONG_DOUBLE +strong_alias (__frexp, __frexpl) +weak_alias (__frexp, frexpl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_ilogb.c b/sysdeps/ieee754/dbl-64/s_ilogb.c new file mode 100644 index 0000000000..820f01c9b2 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_ilogb.c @@ -0,0 +1,56 @@ +/* @(#)s_ilogb.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $"; +#endif + +/* ilogb(double x) + * return the binary exponent of non-zero x + * ilogb(0) = 0x80000001 + * ilogb(inf/NaN) = 0x7fffffff (no signal is raised) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __ilogb(double x) +#else + int __ilogb(x) + double x; +#endif +{ + int32_t hx,lx,ix; + + GET_HIGH_WORD(hx,x); + hx &= 0x7fffffff; + if(hx<0x00100000) { + GET_LOW_WORD(lx,x); + if((hx|lx)==0) + return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ + else /* subnormal x */ + if(hx==0) { + for (ix = -1043; lx>0; lx<<=1) ix -=1; + } else { + for (ix = -1022,hx<<=11; hx>0; hx<<=1) ix -=1; + } + return ix; + } + else if (hx<0x7ff00000) return (hx>>20)-1023; + else return FP_ILOGBNAN; +} +weak_alias (__ilogb, ilogb) +#ifdef NO_LONG_DOUBLE +strong_alias (__ilogb, __ilogbl) +weak_alias (__ilogb, ilogbl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_isinf.c b/sysdeps/ieee754/dbl-64/s_isinf.c new file mode 100644 index 0000000000..4f063d09c5 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_isinf.c @@ -0,0 +1,32 @@ +/* + * Written by J.T. Conklin . + * Changed to return -1 for -Inf by Ulrich Drepper . + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; +#endif + +/* + * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +int +__isinf (double x) +{ + int32_t hx,lx; + EXTRACT_WORDS(hx,lx,x); + lx |= (hx & 0x7fffffff) ^ 0x7ff00000; + lx |= -lx; + return ~(lx >> 31) & (hx >> 30); +} +weak_alias (__isinf, isinf) +#ifdef NO_LONG_DOUBLE +strong_alias (__isinf, __isinfl) +weak_alias (__isinf, isinfl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c new file mode 100644 index 0000000000..86301e1531 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_isnan.c @@ -0,0 +1,43 @@ +/* @(#)s_isnan.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; +#endif + +/* + * isnan(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnan(double x) +#else + int __isnan(x) + double x; +#endif +{ + int32_t hx,lx; + EXTRACT_WORDS(hx,lx,x); + hx &= 0x7fffffff; + hx |= (u_int32_t)(lx|(-lx))>>31; + hx = 0x7ff00000 - hx; + return (int)(((u_int32_t)hx)>>31); +} +weak_alias (__isnan, isnan) +#ifdef NO_LONG_DOUBLE +strong_alias (__isnan, __isnanl) +weak_alias (__isnan, isnanl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c new file mode 100644 index 0000000000..8e70bcff36 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_llrint.c @@ -0,0 +1,95 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const long double two52[2] = +{ + 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ + -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ +}; + + +long long int +__llrint (double x) +{ + int32_t j0; + u_int32_t i1, i0; + long long int result; + volatile double w; + double t; + int sx; + + EXTRACT_WORDS (i0, i1, x); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + sx = i0 >> 31; + i0 &= 0xfffff; + i0 |= 0x100000; + + if (j0 < 20) + { + if (j0 < -1) + return 0; + else + { + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; + + result = i0 >> (20 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 >= 52) + result = (((long long int) i0 << 32) | i1) << (j0 - 52); + else + { + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; + + result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__llrint, llrint) +#ifdef NO_LONG_DOUBLE +strong_alias (__llrint, __llrintl) +weak_alias (__llrint, llrintl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_llround.c b/sysdeps/ieee754/dbl-64/s_llround.c new file mode 100644 index 0000000000..92ce10fc42 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_llround.c @@ -0,0 +1,81 @@ +/* Round double value to long long int. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long long int +__llround (double x) +{ + int32_t j0; + u_int32_t i1, i0; + long long int result; + int sign; + + EXTRACT_WORDS (i0, i1, x); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + sign = (i0 & 0x80000000) != 0 ? -1 : 1; + i0 &= 0xfffff; + i0 |= 0x100000; + + if (j0 < 20) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else + { + i0 += 0x80000 >> j0; + + result = i0 >> (20 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 >= 52) + result = (((long long int) i0 << 32) | i1) << (j0 - 52); + else + { + u_int32_t j = i1 + (0x80000000 >> (j0 - 20)); + if (j < i1) + ++i0; + + if (j0 == 20) + result = (long long int) i0; + else + result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sign * result; +} + +weak_alias (__llround, llround) +#ifdef NO_LONG_DOUBLE +strong_alias (__llround, __llroundl) +weak_alias (__llround, llroundl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_log1p.c b/sysdeps/ieee754/dbl-64/s_log1p.c new file mode 100644 index 0000000000..0a9801a931 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_log1p.c @@ -0,0 +1,191 @@ +/* @(#)s_log1p.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. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_log1p.c,v 1.8 1995/05/10 20:47:46 jtc Exp $"; +#endif + +/* double log1p(double x) + * + * Method : + * 1. Argument Reduction: find k and f such that + * 1+x = 2^k * (1+f), + * where sqrt(2)/2 < 1+f < sqrt(2) . + * + * Note. If k=0, then f=x is exact. However, if k!=0, then f + * may not be representable exactly. In that case, a correction + * term is need. Let u=1+x rounded. Let c = (1+x)-u, then + * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u), + * and add back the correction term c/u. + * (Note: when x > 2**53, one can simply return log(x)) + * + * 2. Approximation of log1p(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 + * We use a special Reme algorithm on [0,0.1716] to generate + * 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 + * R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s +Lp6*s +Lp7*s + * (the values of Lp1 to Lp7 are listed in the program) + * and + * | 2 14 | -58.45 + * | Lp1*s +...+Lp7*s - R(z) | <= 2 + * | | + * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. + * In order to guarantee error in log below 1ulp, we compute log + * by + * log1p(f) = f - (hfsq - s*(hfsq+R)). + * + * 3. Finally, log1p(x) = k*ln2 + log1p(f). + * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) + * Here ln2 is split into two floating point number: + * ln2_hi + ln2_lo, + * where n*ln2_hi is always exact for |n| < 2000. + * + * Special cases: + * log1p(x) is NaN with signal if x < -1 (including -INF) ; + * log1p(+INF) is +INF; log1p(-1) is -INF with signal; + * log1p(NaN) is that NaN with no signal. + * + * Accuracy: + * according to an error analysis, the error is always less than + * 1 ulp (unit in the last place). + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + * + * Note: Assuming log() return accurate answer, the following + * algorithm can be used to compute log1p(x) to within a few ULP: + * + * u = 1+x; + * if(u==1.0) return x ; else + * return log(u)*(x/(u-1.0)); + * + * See HP-15C Advanced Functions Handbook, p.193. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ +ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ +two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ +Lp[] = {0.0, 6.666666666666735130e-01, /* 3FE55555 55555593 */ + 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ + 2.857142874366239149e-01, /* 3FD24924 94229359 */ + 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ + 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ + 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ + 1.479819860511658591e-01}; /* 3FC2F112 DF3E5244 */ + +#ifdef __STDC__ +static const double zero = 0.0; +#else +static double zero = 0.0; +#endif + +#ifdef __STDC__ + double __log1p(double x) +#else + double __log1p(x) + double x; +#endif +{ + double hfsq,f,c,s,z,R,u,z2,z4,z6,R1,R2,R3,R4; + int32_t k,hx,hu,ax; + + GET_HIGH_WORD(hx,x); + ax = hx&0x7fffffff; + + k = 1; + if (hx < 0x3FDA827A) { /* x < 0.41422 */ + if(ax>=0x3ff00000) { /* x <= -1.0 */ + if(x==-1.0) return -two54/(x-x);/* log1p(-1)=+inf */ + else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ + } + if(ax<0x3e200000) { /* |x| < 2**-29 */ + if(two54+x>zero /* raise inexact */ + &&ax<0x3c900000) /* |x| < 2**-54 */ + return x; + else + return x - x*x*0.5; + } + if(hx>0||hx<=((int32_t)0xbfd2bec3)) { + k=0;f=x;hu=1;} /* -0.2929= 0x7ff00000) return x+x; + if(k!=0) { + if(hx<0x43400000) { + u = 1.0+x; + GET_HIGH_WORD(hu,u); + k = (hu>>20)-1023; + c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ + c /= u; + } else { + u = x; + GET_HIGH_WORD(hu,u); + k = (hu>>20)-1023; + c = 0; + } + hu &= 0x000fffff; + if(hu<0x6a09e) { + SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ + } else { + k += 1; + SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ + hu = (0x00100000-hu)>>2; + } + f = u-1.0; + } + hfsq=0.5*f*f; + if(hu==0) { /* |f| < 2**-20 */ + if(f==zero) { + if(k==0) return zero; + else {c += k*ln2_lo; return k*ln2_hi+c;} + } + R = hfsq*(1.0-0.66666666666666666*f); + if(k==0) return f-R; else + return k*ln2_hi-((R-(k*ln2_lo+c))-f); + } + s = f/(2.0+f); + z = s*s; +#ifdef DO_NOT_USE_THIS + R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); +#else + R1 = z*Lp[1]; z2=z*z; + R2 = Lp[2]+z*Lp[3]; z4=z2*z2; + R3 = Lp[4]+z*Lp[5]; z6=z4*z2; + R4 = Lp[6]+z*Lp[7]; + R = R1 + z2*R2 + z4*R3 + z6*R4; +#endif + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); +} +weak_alias (__log1p, log1p) +#ifdef NO_LONG_DOUBLE +strong_alias (__log1p, __log1pl) +weak_alias (__log1p, log1pl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_log2.c b/sysdeps/ieee754/dbl-64/s_log2.c new file mode 100644 index 0000000000..7379ce85e7 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_log2.c @@ -0,0 +1,136 @@ +/* Adapted for log2 by Ulrich Drepper . */ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* __log2(x) + * Return the logarithm to base 2 of x + * + * Method : + * 1. Argument Reduction: find k and f such that + * x = 2^k * (1+f), + * where sqrt(2)/2 < 1+f < sqrt(2) . + * + * 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 + * We use a special Reme algorithm on [0,0.1716] to generate + * 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 + * 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) + * and + * | 2 14 | -58.45 + * | Lg1*s +...+Lg7*s - R(z) | <= 2 + * | | + * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. + * In order to guarantee error in log below 1ulp, we compute log + * by + * log(1+f) = f - s*(f - R) (if f is not too large) + * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) + * + * 3. Finally, log(x) = k + log(1+f). + * = k+(f-(hfsq-(s*(hfsq+R)))) + * + * Special cases: + * log2(x) is NaN with signal if x < 0 (including -INF) ; + * log2(+INF) is +INF; log(0) is -INF with signal; + * log2(NaN) is that NaN with no signal. + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#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 */ +Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ +Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ +Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ +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 __log2(double x) +#else + double __log2(x) + double x; +#endif +{ + double hfsq,f,s,z,R,w,t1,t2,dk; + int32_t k,hx,i,j; + u_int32_t lx; + + 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 */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + hx &= 0x000fffff; + i = (hx+0x95f64)&0x100000; + SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ + k += (i>>20); + dk = (double) k; + f = x-1.0; + if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ + if(f==zero) return dk; + R = f*f*(0.5-0.33333333333333333*f); + return dk-(R-f)/ln2; + } + s = f/(2.0+f); + z = s*s; + i = hx-0x6147a; + w = z*z; + j = 0x6b851-hx; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=0.5*f*f; + return dk-((hfsq-(s*(hfsq+R)))-f)/ln2; + } else { + return dk-((s*(f-R))-f)/ln2; + } +} + +weak_alias (__log2, log2) +#ifdef NO_LONG_DOUBLE +strong_alias (__log2, __log2l) +weak_alias (__log2, log2l) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c new file mode 100644 index 0000000000..4668cf78f8 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_logb.c @@ -0,0 +1,47 @@ +/* @(#)s_logb.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $"; +#endif + +/* + * double logb(x) + * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. + * Use ilogb instead. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __logb(double x) +#else + double __logb(x) + double x; +#endif +{ + int32_t lx,ix; + EXTRACT_WORDS(ix,lx,x); + ix &= 0x7fffffff; /* high |x| */ + if((ix|lx)==0) return -1.0/fabs(x); + if(ix>=0x7ff00000) return x*x; + if((ix>>=20)==0) /* IEEE 754 logb */ + return -1022.0; + else + return (double) (ix-1023); +} +weak_alias (__logb, logb) +#ifdef NO_LONG_DOUBLE +strong_alias (__logb, __logbl) +weak_alias (__logb, logbl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c new file mode 100644 index 0000000000..8f0d717963 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_lrint.c @@ -0,0 +1,95 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const double two52[2] = +{ + 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ + -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ +}; + + +long int +__lrint (double x) +{ + int32_t j0; + u_int32_t i0,i1; + volatile double w; + double t; + long int result; + int sx; + + EXTRACT_WORDS (i0, i1, x); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + sx = i0 >> 31; + i0 &= 0xfffff; + i0 |= 0x100000; + + if (j0 < 20) + { + if (j0 < -1) + return 0; + else + { + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; + + result = i0 >> (20 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 >= 52) + result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); + else + { + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; + + result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__lrint, lrint) +#ifdef NO_LONG_DOUBLE +strong_alias (__lrint, __lrintl) +weak_alias (__lrint, lrintl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_lround.c b/sysdeps/ieee754/dbl-64/s_lround.c new file mode 100644 index 0000000000..49be12f03b --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_lround.c @@ -0,0 +1,78 @@ +/* Round double value to long int. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long int +__lround (double x) +{ + int32_t j0; + u_int32_t i1, i0; + long int result; + int sign; + + EXTRACT_WORDS (i0, i1, x); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + sign = (i0 & 0x80000000) != 0 ? -1 : 1; + i0 &= 0xfffff; + i0 |= 0x100000; + + if (j0 < 20) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else + { + i0 += 0x80000 >> j0; + + result = i0 >> (20 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 >= 52) + result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); + else + { + u_int32_t j = i1 + (0x80000000 >> (j0 - 20)); + if (j < i1) + ++i0; + + result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sign * result; +} + +weak_alias (__lround, lround) +#ifdef NO_LONG_DOUBLE +strong_alias (__lround, __lroundl) +weak_alias (__lround, lroundl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_modf.c b/sysdeps/ieee754/dbl-64/s_modf.c new file mode 100644 index 0000000000..7851f675a4 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_modf.c @@ -0,0 +1,85 @@ +/* @(#)s_modf.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_modf.c,v 1.8 1995/05/10 20:47:55 jtc Exp $"; +#endif + +/* + * modf(double x, double *iptr) + * return fraction part of x, and return x's integral part in *iptr. + * Method: + * Bit twiddling. + * + * Exception: + * No exception. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double one = 1.0; +#else +static double one = 1.0; +#endif + +#ifdef __STDC__ + double __modf(double x, double *iptr) +#else + double __modf(x, iptr) + double x,*iptr; +#endif +{ + int32_t i0,i1,j0; + u_int32_t i; + EXTRACT_WORDS(i0,i1,x); + j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */ + if(j0<20) { /* integer part in high x */ + if(j0<0) { /* |x|<1 */ + INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */ + return x; + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) { /* x is integral */ + *iptr = x; + INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ + return x; + } else { + INSERT_WORDS(*iptr,i0&(~i),0); + return x - *iptr; + } + } + } else if (j0>51) { /* no fraction part */ + *iptr = x*one; + /* We must handle NaNs separately. */ + if (j0 == 0x400 && ((i0 & 0xfffff) | i1)) + return x*one; + INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ + return x; + } else { /* fraction part in low x */ + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) { /* x is integral */ + *iptr = x; + INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ + return x; + } else { + INSERT_WORDS(*iptr,i0,i1&(~i)); + return x - *iptr; + } + } +} +weak_alias (__modf, modf) +#ifdef NO_LONG_DOUBLE +strong_alias (__modf, __modfl) +weak_alias (__modf, modfl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/s_nearbyint.c new file mode 100644 index 0000000000..32f5bf9447 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_nearbyint.c @@ -0,0 +1,98 @@ +/* Adapted for use as nearbyint by Ulrich Drepper . */ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $"; +#endif + +/* + * rint(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rint(x). + */ + +#include +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +TWO52[2]={ + 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ + -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ +}; + +#ifdef __STDC__ + double __nearbyint(double x) +#else + double __nearbyint(x) + double x; +#endif +{ + fenv_t env; + int32_t i0,j0,sx; + u_int32_t i,i1; + double w,t; + EXTRACT_WORDS(i0,i1,x); + sx = (i0>>31)&1; + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { + if(((i0&0x7fffffff)|i1)==0) return x; + i1 |= (i0&0x0fffff); + i0 &= 0xfffe0000; + i0 |= ((i1|-i1)>>12)&0x80000; + SET_HIGH_WORD(x,i0); + feholdexcept (&env); + w = TWO52[sx]+x; + t = w-TWO52[sx]; + fesetenv (&env); + GET_HIGH_WORD(i0,t); + SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); + return t; + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if(j0==19) i1 = 0x40000000; else + i0 = (i0&(~i))|((0x20000)>>j0); + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); + } + INSERT_WORDS(x,i0,i1); + feholdexcept (&env); + w = TWO52[sx]+x; + t = w-TWO52[sx]; + fesetenv (&env); + return t; +} +weak_alias (__nearbyint, nearbyint) +#ifdef NO_LONG_DOUBLE +strong_alias (__nearbyint, __nearbyintl) +weak_alias (__nearbyint, nearbyintl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_nexttoward.c b/sysdeps/ieee754/dbl-64/s_nexttoward.c new file mode 100644 index 0000000000..c68ba98cb3 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_nexttoward.c @@ -0,0 +1 @@ +/* This function is the same as nextafter so we use an alias there. */ diff --git a/sysdeps/ieee754/dbl-64/s_remquo.c b/sysdeps/ieee754/dbl-64/s_remquo.c new file mode 100644 index 0000000000..6e32efbba2 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_remquo.c @@ -0,0 +1,113 @@ +/* Compute remainder and a congruent to the quotient. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const double zero = 0.0; + + +double +__remquo (double x, double y, int *quo) +{ + int32_t hx,hy; + u_int32_t sx,lx,ly; + int cquo, qs; + + EXTRACT_WORDS (hx, lx, x); + EXTRACT_WORDS (hy, ly, y); + sx = hx & 0x80000000; + qs = sx ^ (hy & 0x80000000); + hy &= 0x7fffffff; + hx &= 0x7fffffff; + + /* Purge off exception values. */ + if ((hy | ly) == 0) + return (x * y) / (x * y); /* y = 0 */ + if ((hx >= 0x7ff00000) /* x not finite */ + || ((hy >= 0x7ff00000) /* p is NaN */ + && (((hy - 0x7ff00000) | ly) != 0))) + return (x * y) / (x * y); + + if (hy <= 0x7fbfffff) + x = __ieee754_fmod (x, 8 * y); /* now x < 8y */ + + if (((hx - hy) | (lx - ly)) == 0) + { + *quo = qs ? -1 : 1; + return zero * x; + } + + x = fabs (x); + y = fabs (y); + cquo = 0; + + if (x >= 4 * y) + { + x -= 4 * y; + cquo += 4; + } + if (x >= 2 * y) + { + x -= 2 * y; + cquo += 2; + } + + if (hy < 0x00200000) + { + if (x + x > y) + { + x -= y; + ++cquo; + if (x + x >= y) + { + x -= y; + ++cquo; + } + } + } + else + { + double y_half = 0.5 * y; + if (x > y_half) + { + x -= y; + ++cquo; + if (x >= y_half) + { + x -= y; + ++cquo; + } + } + } + + *quo = qs ? -cquo : cquo; + + if (sx) + x = -x; + return x; +} +weak_alias (__remquo, remquo) +#ifdef NO_LONG_DOUBLE +strong_alias (__remquo, __remquol) +weak_alias (__remquo, remquol) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_rint.c b/sysdeps/ieee754/dbl-64/s_rint.c new file mode 100644 index 0000000000..e5f241291c --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_rint.c @@ -0,0 +1,91 @@ +/* @(#)s_rint.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $"; +#endif + +/* + * rint(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rint(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +TWO52[2]={ + 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ + -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ +}; + +#ifdef __STDC__ + double __rint(double x) +#else + double __rint(x) + double x; +#endif +{ + int32_t i0,j0,sx; + u_int32_t i,i1; + double w,t; + EXTRACT_WORDS(i0,i1,x); + sx = (i0>>31)&1; + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { + if(((i0&0x7fffffff)|i1)==0) return x; + i1 |= (i0&0x0fffff); + i0 &= 0xfffe0000; + i0 |= ((i1|-i1)>>12)&0x80000; + SET_HIGH_WORD(x,i0); + w = TWO52[sx]+x; + t = w-TWO52[sx]; + GET_HIGH_WORD(i0,t); + SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); + return t; + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if(j0==19) i1 = 0x40000000; else + i0 = (i0&(~i))|((0x20000)>>j0); + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); + } + INSERT_WORDS(x,i0,i1); + w = TWO52[sx]+x; + return w-TWO52[sx]; +} +weak_alias (__rint, rint) +#ifdef NO_LONG_DOUBLE +strong_alias (__rint, __rintl) +weak_alias (__rint, rintl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_round.c b/sysdeps/ieee754/dbl-64/s_round.c new file mode 100644 index 0000000000..fdb17f8de8 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_round.c @@ -0,0 +1,97 @@ +/* Round double to integer away from zero. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const double huge = 1.0e300; + + +double +__round (double x) +{ + int32_t i0, j0; + u_int32_t i1; + + EXTRACT_WORDS (i0, i1, x); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + if (j0 < 20) + { + if (j0 < 0) + { + if (huge + x > 0.0) + { + i0 &= 0x80000000; + if (j0 == -1) + i0 |= 0x3ff00000; + i1 = 0; + } + } + else + { + u_int32_t i = 0x000fffff >> j0; + if (((i0 & i) | i1) == 0) + /* X is integral. */ + return x; + if (huge + x > 0.0) + { + /* Raise inexact if x != 0. */ + i0 += 0x00080000 >> j0; + i0 &= ~i; + i1 = 0; + } + } + } + else if (j0 > 51) + { + if (j0 == 0x400) + /* Inf or NaN. */ + return x + x; + else + return x; + } + else + { + u_int32_t i = 0xffffffff >> (j0 - 20); + if ((i1 & i) == 0) + /* X is integral. */ + return x; + + if (huge + x > 0.0) + { + /* Raise inexact if x != 0. */ + u_int32_t j = i1 + (1 << (51 - j0)); + if (j < i1) + i0 += 1; + i1 = j; + } + i1 &= ~i; + } + + INSERT_WORDS (x, i0, i1); + return x; +} +weak_alias (__round, round) +#ifdef NO_LONG_DOUBLE +strong_alias (__round, __roundl) +weak_alias (__round, roundl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_scalbln.c b/sysdeps/ieee754/dbl-64/s_scalbln.c new file mode 100644 index 0000000000..aa6134f093 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_scalbln.c @@ -0,0 +1,70 @@ +/* @(#)s_scalbn.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; +#endif + +/* + * scalbn (double x, int n) + * scalbn(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; + +#ifdef __STDC__ + double __scalbln (double x, long int n) +#else + double __scalbln (x,n) + double x; long int n; +#endif +{ + int32_t k,hx,lx; + EXTRACT_WORDS(hx,lx,x); + k = (hx&0x7ff00000)>>20; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ + x *= two54; + GET_HIGH_WORD(hx,x); + k = ((hx&0x7ff00000)>>20) - 54; + } + if (k==0x7ff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0x7fe) + return huge*__copysign(huge,x); /* overflow */ + if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} + if (k <= -54) + return tiny*__copysign(tiny,x); /*underflow*/ + k += 54; /* subnormal result */ + SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); + return x*twom54; +} +weak_alias (__scalbln, scalbln) +#ifdef NO_LONG_DOUBLE +strong_alias (__scalbln, __scalblnl) +weak_alias (__scalbln, scalblnl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_scalbn.c b/sysdeps/ieee754/dbl-64/s_scalbn.c new file mode 100644 index 0000000000..3dbfe8fef0 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_scalbn.c @@ -0,0 +1,70 @@ +/* @(#)s_scalbn.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; +#endif + +/* + * scalbn (double x, int n) + * scalbn(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; + +#ifdef __STDC__ + double __scalbn (double x, int n) +#else + double __scalbn (x,n) + double x; int n; +#endif +{ + int32_t k,hx,lx; + EXTRACT_WORDS(hx,lx,x); + k = (hx&0x7ff00000)>>20; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ + x *= two54; + GET_HIGH_WORD(hx,x); + k = ((hx&0x7ff00000)>>20) - 54; + } + if (k==0x7ff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0x7fe) + return huge*__copysign(huge,x); /* overflow */ + if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} + if (k <= -54) + return tiny*__copysign(tiny,x); /*underflow*/ + k += 54; /* subnormal result */ + SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); + return x*twom54; +} +weak_alias (__scalbn, scalbn) +#ifdef NO_LONG_DOUBLE +strong_alias (__scalbn, __scalbnl) +weak_alias (__scalbn, scalbnl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_signbit.c b/sysdeps/ieee754/dbl-64/s_signbit.c new file mode 100644 index 0000000000..ee340035fb --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_signbit.c @@ -0,0 +1,32 @@ +/* Return nonzero value if number is negative. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +int +__signbit (double x) +{ + int32_t hx; + + GET_HIGH_WORD (hx, x); + return hx & 0x80000000; +} diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c new file mode 100644 index 0000000000..376c69ed00 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -0,0 +1,87 @@ +/* @(#)s_sin.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; +#endif + +/* sin(x) + * Return sine function of x. + * + * kernel function: + * __kernel_sin ... sine function on [-pi/4,pi/4] + * __kernel_cos ... cose function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __sin(double x) +#else + double __sin(x) + double x; +#endif +{ + double y[2],z=0.0; + int32_t n, ix; + + /* High word of x. */ + GET_HIGH_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); + + /* sin(Inf or NaN) is NaN */ + else if (ix>=0x7ff00000) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_sin(y[0],y[1],1); + case 1: return __kernel_cos(y[0],y[1]); + case 2: return -__kernel_sin(y[0],y[1],1); + default: + return -__kernel_cos(y[0],y[1]); + } + } +} +weak_alias (__sin, sin) +#ifdef NO_LONG_DOUBLE +strong_alias (__sin, __sinl) +weak_alias (__sin, sinl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c new file mode 100644 index 0000000000..5bc564ba5b --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_sincos.c @@ -0,0 +1,78 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +void +__sincos (double x, double *sinx, double *cosx) +{ + int32_t ix; + + /* High word of x. */ + GET_HIGH_WORD (ix, x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if (ix <= 0x3fe921fb) + { + *sinx = __kernel_sin (x, 0.0, 0); + *cosx = __kernel_cos (x, 0.0); + } + else if (ix>=0x7ff00000) + { + /* sin(Inf or NaN) is NaN */ + *sinx = *cosx = x - x; + } + else + { + /* Argument reduction needed. */ + double y[2]; + int n; + + n = __ieee754_rem_pio2 (x, y); + switch (n & 3) + { + case 0: + *sinx = __kernel_sin (y[0], y[1], 1); + *cosx = __kernel_cos (y[0], y[1]); + break; + case 1: + *sinx = __kernel_cos (y[0], y[1]); + *cosx = -__kernel_sin (y[0], y[1], 1); + break; + case 2: + *sinx = -__kernel_sin (y[0], y[1], 1); + *cosx = -__kernel_cos (y[0], y[1]); + break; + default: + *sinx = -__kernel_cos (y[0], y[1]); + *cosx = __kernel_sin (y[0], y[1], 1); + break; + } + } +} +weak_alias (__sincos, sincos) +#ifdef NO_LONG_DOUBLE +strong_alias (__sincos, __sincosl) +weak_alias (__sincos, sincosl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c new file mode 100644 index 0000000000..714cf27dd2 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_tan.c @@ -0,0 +1,81 @@ +/* @(#)s_tan.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_tan.c,v 1.7 1995/05/10 20:48:18 jtc Exp $"; +#endif + +/* tan(x) + * Return tangent function of x. + * + * kernel function: + * __kernel_tan ... tangent function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __tan(double x) +#else + double __tan(x) + double x; +#endif +{ + double y[2],z=0.0; + int32_t n, ix; + + /* High word of x. */ + GET_HIGH_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1); + + /* tan(Inf or NaN) is NaN */ + else if (ix>=0x7ff00000) return x-x; /* NaN */ + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x,y); + return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even + -1 -- n odd */ + } +} +weak_alias (__tan, tan) +#ifdef NO_LONG_DOUBLE +strong_alias (__tan, __tanl) +weak_alias (__tan, tanl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_tanh.c b/sysdeps/ieee754/dbl-64/s_tanh.c new file mode 100644 index 0000000000..944f96386f --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_tanh.c @@ -0,0 +1,93 @@ +/* @(#)s_tanh.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $"; +#endif + +/* Tanh(x) + * Return the Hyperbolic Tangent of x + * + * Method : + * x -x + * e - e + * 0. tanh(x) is defined to be ----------- + * x -x + * e + e + * 1. reduce x to non-negative by tanh(-x) = -tanh(x). + * 2. 0 <= x <= 2**-55 : tanh(x) := x*(one+x) + * -t + * 2**-55 < x <= 1 : tanh(x) := -----; t = expm1(-2x) + * t + 2 + * 2 + * 1 <= x <= 22.0 : tanh(x) := 1- ----- ; t=expm1(2x) + * t + 2 + * 22.0 < x <= INF : tanh(x) := 1. + * + * Special cases: + * tanh(NaN) is NaN; + * only tanh(0)=0 is exact for finite argument. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double one=1.0, two=2.0, tiny = 1.0e-300; +#else +static double one=1.0, two=2.0, tiny = 1.0e-300; +#endif + +#ifdef __STDC__ + double __tanh(double x) +#else + double __tanh(x) + double x; +#endif +{ + double t,z; + int32_t jx,ix,lx; + + /* High word of |x|. */ + EXTRACT_WORDS(jx,lx,x); + ix = jx&0x7fffffff; + + /* x is INF or NaN */ + if(ix>=0x7ff00000) { + if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ + else return one/x-one; /* tanh(NaN) = NaN */ + } + + /* |x| < 22 */ + if (ix < 0x40360000) { /* |x|<22 */ + if ((ix | lx) == 0) + return x; /* x == +-0 */ + if (ix<0x3c800000) /* |x|<2**-55 */ + return x*(one+x); /* tanh(small) = small */ + if (ix>=0x3ff00000) { /* |x|>=1 */ + t = __expm1(two*fabs(x)); + z = one - two/(t+two); + } else { + t = __expm1(-two*fabs(x)); + z= -t/(t+two); + } + /* |x| > 22, return +-1 */ + } else { + z = one - tiny; /* raised inexact flag */ + } + return (jx>=0)? z: -z; +} +weak_alias (__tanh, tanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__tanh, __tanhl) +weak_alias (__tanh, tanhl) +#endif diff --git a/sysdeps/ieee754/dbl-64/s_trunc.c b/sysdeps/ieee754/dbl-64/s_trunc.c new file mode 100644 index 0000000000..07b4951bcb --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_trunc.c @@ -0,0 +1,61 @@ +/* Truncate argument to nearest integral value not larger than the argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +double +__trunc (double x) +{ + int32_t i0, j0; + u_int32_t i1; + int sx; + + EXTRACT_WORDS (i0, i1, x); + sx = i0 & 0x80000000; + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + if (j0 < 20) + { + if (j0 < 0) + /* The magnitude of the number is < 1 so the result is +-0. */ + INSERT_WORDS (x, sx, 0); + else + INSERT_WORDS (x, sx | (i0 & ~(0x000fffff >> j0)), 0); + } + else if (j0 > 51) + { + if (j0 == 0x400) + /* x is inf or NaN. */ + return x + x; + } + else + { + INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (j0 - 20))); + } + + return x; +} +weak_alias (__trunc, trunc) +#ifdef NO_LONG_DOUBLE +strong_alias (__trunc, __truncl) +weak_alias (__trunc, truncl) +#endif diff --git a/sysdeps/ieee754/dbl-64/t_exp.c b/sysdeps/ieee754/dbl-64/t_exp.c new file mode 100644 index 0000000000..b02b4f55ca --- /dev/null +++ b/sysdeps/ieee754/dbl-64/t_exp.c @@ -0,0 +1,436 @@ +/* Accurate tables for exp(). + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This table has the property that, for all integers -177 <= i <= 177, + exp(i/512.0 + __exp_deltatable[abs(i)]) == __exp_atable[i+177] + r + for some -2^-64 < r < 2^-64 (abs(r) < 2^-65 if i <= 0); and that + __exp_deltatable[abs(i)] == t * 2^-60 + for integer t so that abs(t) <= 8847927 * 2^8. */ + +#define W52 (2.22044605e-16) +#define W55 (2.77555756e-17) +#define W58 (3.46944695e-18) +#define W59 (1.73472348e-18) +#define W60 (8.67361738e-19) +const float __exp_deltatable[178] = { + 0*W60, 16558714*W60, -10672149*W59, 1441652*W60, + -15787963*W55, 462888*W60, 7291806*W60, 1698880*W60, + -14375103*W58, -2021016*W60, 728829*W60, -3759654*W60, + 3202123*W60, -10916019*W58, -251570*W60, -1043086*W60, + 8207536*W60, -409964*W60, -5993931*W60, -475500*W60, + 2237522*W60, 324170*W60, -244117*W60, 32077*W60, + 123907*W60, -1019734*W60, -143*W60, 813077*W60, + 743345*W60, 462461*W60, 629794*W60, 2125066*W60, + -2339121*W60, -337951*W60, 9922067*W60, -648704*W60, + 149407*W60, -2687209*W60, -631608*W60, 2128280*W60, + -4882082*W60, 2001360*W60, 175074*W60, 2923216*W60, + -538947*W60, -1212193*W60, -1920926*W60, -1080577*W60, + 3690196*W60, 2643367*W60, 2911937*W60, 671455*W60, + -1128674*W60, 593282*W60, -5219347*W60, -1941490*W60, + 11007953*W60, 239609*W60, -2969658*W60, -1183650*W60, + 942998*W60, 699063*W60, 450569*W60, -329250*W60, + -7257875*W60, -312436*W60, 51626*W60, 555877*W60, + -641761*W60, 1565666*W60, 884327*W60, -10960035*W60, + -2004679*W60, -995793*W60, -2229051*W60, -146179*W60, + -510327*W60, 1453482*W60, -3778852*W60, -2238056*W60, + -4895983*W60, 3398883*W60, -252738*W60, 1230155*W60, + 346918*W60, 1109352*W60, 268941*W60, -2930483*W60, + -1036263*W60, -1159280*W60, 1328176*W60, 2937642*W60, + -9371420*W60, -6902650*W60, -1419134*W60, 1442904*W60, + -1319056*W60, -16369*W60, 696555*W60, -279987*W60, + -7919763*W60, 252741*W60, 459711*W60, -1709645*W60, + 354913*W60, 6025867*W60, -421460*W60, -853103*W60, + -338649*W60, 962151*W60, 955965*W60, 784419*W60, + -3633653*W60, 2277133*W60, -8847927*W52, 1223028*W60, + 5907079*W60, 623167*W60, 5142888*W60, 2599099*W60, + 1214280*W60, 4870359*W60, 593349*W60, -57705*W60, + 7761209*W60, -5564097*W60, 2051261*W60, 6216869*W60, + 4692163*W60, 601691*W60, -5264906*W60, 1077872*W60, + -3205949*W60, 1833082*W60, 2081746*W60, -987363*W60, + -1049535*W60, 2015244*W60, 874230*W60, 2168259*W60, + -1740124*W60, -10068269*W60, -18242*W60, -3013583*W60, + 580601*W60, -2547161*W60, -535689*W60, 2220815*W60, + 1285067*W60, 2806933*W60, -983086*W60, -1729097*W60, + -1162985*W60, -2561904*W60, 801988*W60, 244351*W60, + 1441893*W60, -7517981*W60, 271781*W60, -15021588*W60, + -2341588*W60, -919198*W60, 1642232*W60, 4771771*W60, + -1220099*W60, -3062372*W60, 628624*W60, 1278114*W60, + 13083513*W60, -10521925*W60, 3180310*W60, -1659307*W60, + 3543773*W60, 2501203*W60, 4151*W60, -340748*W60, + -2285625*W60, 2495202*W60 +}; + +const double __exp_atable[355] /* __attribute__((mode(DF))) */ = { + 0.707722561055888932371, /* 0x0.b52d4e46605c27ffd */ + 0.709106182438804188967, /* 0x0.b587fb96f75097ffb */ + 0.710492508843861281234, /* 0x0.b5e2d649899167ffd */ + 0.711881545564593931623, /* 0x0.b63dde74d36bdfffe */ + 0.713273297897442870573, /* 0x0.b699142f945f87ffc */ + 0.714667771153751463236, /* 0x0.b6f477909c4ea0001 */ + 0.716064970655995725059, /* 0x0.b75008aec758f8004 */ + 0.717464901723956938193, /* 0x0.b7abc7a0eea7e0002 */ + 0.718867569715736398602, /* 0x0.b807b47e1586c7ff8 */ + 0.720272979947266023271, /* 0x0.b863cf5d10e380003 */ + 0.721681137825144314297, /* 0x0.b8c01855195c37ffb */ + 0.723092048691992950199, /* 0x0.b91c8f7d213740004 */ + 0.724505717938892290800, /* 0x0.b97934ec5002d0007 */ + 0.725922150953176470431, /* 0x0.b9d608b9c92ea7ffc */ + 0.727341353138962865022, /* 0x0.ba330afcc29e98003 */ + 0.728763329918453162104, /* 0x0.ba903bcc8618b7ffc */ + 0.730188086709957051568, /* 0x0.baed9b40591ba0000 */ + 0.731615628948127705309, /* 0x0.bb4b296f931e30002 */ + 0.733045962086486091436, /* 0x0.bba8e671a05617ff9 */ + 0.734479091556371366251, /* 0x0.bc06d25dd49568001 */ + 0.735915022857225542529, /* 0x0.bc64ed4bce8f6fff9 */ + 0.737353761441304711410, /* 0x0.bcc33752f915d7ff9 */ + 0.738795312814142124419, /* 0x0.bd21b08af98e78005 */ + 0.740239682467211168593, /* 0x0.bd80590b65e9a8000 */ + 0.741686875913991849885, /* 0x0.bddf30ebec4a10000 */ + 0.743136898669507939299, /* 0x0.be3e38443c84e0007 */ + 0.744589756269486091620, /* 0x0.be9d6f2c1d32a0002 */ + 0.746045454254026796384, /* 0x0.befcd5bb59baf8004 */ + 0.747503998175051087583, /* 0x0.bf5c6c09ca84c0003 */ + 0.748965393601880857739, /* 0x0.bfbc322f5b18b7ff8 */ + 0.750429646104262104698, /* 0x0.c01c2843f776fffff */ + 0.751896761271877989160, /* 0x0.c07c4e5fa18b88002 */ + 0.753366744698445112140, /* 0x0.c0dca49a5fb18fffd */ + 0.754839601988627206827, /* 0x0.c13d2b0c444db0005 */ + 0.756315338768691947122, /* 0x0.c19de1cd798578006 */ + 0.757793960659406629066, /* 0x0.c1fec8f623723fffd */ + 0.759275473314173443536, /* 0x0.c25fe09e8a0f47ff8 */ + 0.760759882363831851927, /* 0x0.c2c128dedc88f8000 */ + 0.762247193485956486805, /* 0x0.c322a1cf7d6e7fffa */ + 0.763737412354726363781, /* 0x0.c3844b88cb9347ffc */ + 0.765230544649828092739, /* 0x0.c3e626232bd8f7ffc */ + 0.766726596071518051729, /* 0x0.c44831b719bf18002 */ + 0.768225572321911687194, /* 0x0.c4aa6e5d12d078001 */ + 0.769727479119219348810, /* 0x0.c50cdc2da64a37ffb */ + 0.771232322196981678892, /* 0x0.c56f7b41744490001 */ + 0.772740107296721268087, /* 0x0.c5d24bb1259e70004 */ + 0.774250840160724651565, /* 0x0.c6354d95640dd0007 */ + 0.775764526565368872643, /* 0x0.c6988106fec447fff */ + 0.777281172269557396602, /* 0x0.c6fbe61eb1bd0ffff */ + 0.778800783068235302750, /* 0x0.c75f7cf560942fffc */ + 0.780323364758801041312, /* 0x0.c7c345a3f1983fffe */ + 0.781848923151573727006, /* 0x0.c8274043594cb0002 */ + 0.783377464064598849602, /* 0x0.c88b6cec94b3b7ff9 */ + 0.784908993312207869935, /* 0x0.c8efcbb89cba27ffe */ + 0.786443516765346961618, /* 0x0.c9545cc0a88c70003 */ + 0.787981040257604625744, /* 0x0.c9b9201dc643bfffa */ + 0.789521569657452682047, /* 0x0.ca1e15e92a5410007 */ + 0.791065110849462849192, /* 0x0.ca833e3c1ae510005 */ + 0.792611669712891875319, /* 0x0.cae8992fd84667ffd */ + 0.794161252150049179450, /* 0x0.cb4e26ddbc207fff8 */ + 0.795713864077794763584, /* 0x0.cbb3e75f301b60003 */ + 0.797269511407239561694, /* 0x0.cc19dacd978cd8002 */ + 0.798828200086368567220, /* 0x0.cc8001427e55d7ffb */ + 0.800389937624300440456, /* 0x0.cce65ade24d360006 */ + 0.801954725261124767840, /* 0x0.cd4ce7a5de839fffb */ + 0.803522573691593189330, /* 0x0.cdb3a7c79a678fffd */ + 0.805093487311204114563, /* 0x0.ce1a9b563965ffffc */ + 0.806667472122675088819, /* 0x0.ce81c26b838db8000 */ + 0.808244534127439906441, /* 0x0.cee91d213f8428002 */ + 0.809824679342317166307, /* 0x0.cf50ab9144d92fff9 */ + 0.811407913793616542005, /* 0x0.cfb86dd5758c2ffff */ + 0.812994243520784198882, /* 0x0.d0206407c20e20005 */ + 0.814583674571603966162, /* 0x0.d0888e4223facfff9 */ + 0.816176213022088536960, /* 0x0.d0f0ec9eb3f7c8002 */ + 0.817771864936188586101, /* 0x0.d1597f377d6768002 */ + 0.819370636400374108252, /* 0x0.d1c24626a46eafff8 */ + 0.820972533518165570298, /* 0x0.d22b41865ff1e7ff9 */ + 0.822577562404315121269, /* 0x0.d2947170f32ec7ff9 */ + 0.824185729164559344159, /* 0x0.d2fdd60097795fff8 */ + 0.825797039949601741075, /* 0x0.d3676f4fb796d0001 */ + 0.827411500902565544264, /* 0x0.d3d13d78b5f68fffb */ + 0.829029118181348834154, /* 0x0.d43b40960546d8001 */ + 0.830649897953322891022, /* 0x0.d4a578c222a058000 */ + 0.832273846408250750368, /* 0x0.d50fe617a3ba78005 */ + 0.833900969738858188772, /* 0x0.d57a88b1218e90002 */ + 0.835531274148056613016, /* 0x0.d5e560a94048f8006 */ + 0.837164765846411529371, /* 0x0.d6506e1aac8078003 */ + 0.838801451086016225394, /* 0x0.d6bbb1204074e0001 */ + 0.840441336100884561780, /* 0x0.d72729d4c28518004 */ + 0.842084427144139224814, /* 0x0.d792d8530e12b0001 */ + 0.843730730487052604790, /* 0x0.d7febcb61273e7fff */ + 0.845380252404570153833, /* 0x0.d86ad718c308dfff9 */ + 0.847032999194574087728, /* 0x0.d8d727962c69d7fff */ + 0.848688977161248581090, /* 0x0.d943ae49621ce7ffb */ + 0.850348192619261200615, /* 0x0.d9b06b4d832ef8005 */ + 0.852010651900976245816, /* 0x0.da1d5ebdc22220005 */ + 0.853676361342631029337, /* 0x0.da8a88b555baa0006 */ + 0.855345327311054837175, /* 0x0.daf7e94f965f98004 */ + 0.857017556155879489641, /* 0x0.db6580a7c98f7fff8 */ + 0.858693054267390953857, /* 0x0.dbd34ed9617befff8 */ + 0.860371828028939855647, /* 0x0.dc4153ffc8b65fff9 */ + 0.862053883854957292436, /* 0x0.dcaf90368bfca8004 */ + 0.863739228154875360306, /* 0x0.dd1e0399328d87ffe */ + 0.865427867361348468455, /* 0x0.dd8cae435d303fff9 */ + 0.867119807911702289458, /* 0x0.ddfb9050b1cee8006 */ + 0.868815056264353846599, /* 0x0.de6aa9dced8448001 */ + 0.870513618890481399881, /* 0x0.ded9fb03db7320006 */ + 0.872215502247877139094, /* 0x0.df4983e1380657ff8 */ + 0.873920712852848668986, /* 0x0.dfb94490ffff77ffd */ + 0.875629257204025623884, /* 0x0.e0293d2f1cb01fff9 */ + 0.877341141814212965880, /* 0x0.e0996dd786fff0007 */ + 0.879056373217612985183, /* 0x0.e109d6a64f5d57ffc */ + 0.880774957955916648615, /* 0x0.e17a77b78e72a7ffe */ + 0.882496902590150900078, /* 0x0.e1eb5127722cc7ff8 */ + 0.884222213673356738383, /* 0x0.e25c63121fb0c8006 */ + 0.885950897802399772740, /* 0x0.e2cdad93ec5340003 */ + 0.887682961567391237685, /* 0x0.e33f30c925fb97ffb */ + 0.889418411575228162725, /* 0x0.e3b0ecce2d05ffff9 */ + 0.891157254447957902797, /* 0x0.e422e1bf727718006 */ + 0.892899496816652704641, /* 0x0.e4950fb9713fc7ffe */ + 0.894645145323828439008, /* 0x0.e50776d8b0e60fff8 */ + 0.896394206626591749641, /* 0x0.e57a1739c8fadfffc */ + 0.898146687421414902124, /* 0x0.e5ecf0f97c5798007 */ + 0.899902594367530173098, /* 0x0.e660043464e378005 */ + 0.901661934163603406867, /* 0x0.e6d3510747e150006 */ + 0.903424713533971135418, /* 0x0.e746d78f06cd97ffd */ + 0.905190939194458810123, /* 0x0.e7ba97e879c91fffc */ + 0.906960617885092856864, /* 0x0.e82e92309390b0007 */ + 0.908733756358986566306, /* 0x0.e8a2c6845544afffa */ + 0.910510361377119825629, /* 0x0.e9173500c8abc7ff8 */ + 0.912290439722343249336, /* 0x0.e98bddc30f98b0002 */ + 0.914073998177417412765, /* 0x0.ea00c0e84bc4c7fff */ + 0.915861043547953501680, /* 0x0.ea75de8db8094fffe */ + 0.917651582652244779397, /* 0x0.eaeb36d09d3137ffe */ + 0.919445622318405764159, /* 0x0.eb60c9ce4ed3dffff */ + 0.921243169397334638073, /* 0x0.ebd697a43995b0007 */ + 0.923044230737526172328, /* 0x0.ec4ca06fc7768fffa */ + 0.924848813220121135342, /* 0x0.ecc2e44e865b6fffb */ + 0.926656923710931002014, /* 0x0.ed39635df34e70006 */ + 0.928468569126343790092, /* 0x0.edb01dbbc2f5b7ffa */ + 0.930283756368834757725, /* 0x0.ee2713859aab57ffa */ + 0.932102492359406786818, /* 0x0.ee9e44d9342870004 */ + 0.933924784042873379360, /* 0x0.ef15b1d4635438005 */ + 0.935750638358567643520, /* 0x0.ef8d5a94f60f50007 */ + 0.937580062297704630580, /* 0x0.f0053f38f345cffff */ + 0.939413062815381727516, /* 0x0.f07d5fde3a2d98001 */ + 0.941249646905368053689, /* 0x0.f0f5bca2d481a8004 */ + 0.943089821583810716806, /* 0x0.f16e55a4e497d7ffe */ + 0.944933593864477061592, /* 0x0.f1e72b028a2827ffb */ + 0.946780970781518460559, /* 0x0.f2603cd9fb5430001 */ + 0.948631959382661205081, /* 0x0.f2d98b497d2a87ff9 */ + 0.950486566729423554277, /* 0x0.f353166f63e3dffff */ + 0.952344799896018723290, /* 0x0.f3ccde6a11ae37ffe */ + 0.954206665969085765512, /* 0x0.f446e357f66120000 */ + 0.956072172053890279009, /* 0x0.f4c12557964f0fff9 */ + 0.957941325265908139014, /* 0x0.f53ba48781046fffb */ + 0.959814132734539637840, /* 0x0.f5b66106555d07ffa */ + 0.961690601603558903308, /* 0x0.f6315af2c2027fffc */ + 0.963570739036113010927, /* 0x0.f6ac926b8aeb80004 */ + 0.965454552202857141381, /* 0x0.f728078f7c5008002 */ + 0.967342048278315158608, /* 0x0.f7a3ba7d66a908001 */ + 0.969233234469444204768, /* 0x0.f81fab543e1897ffb */ + 0.971128118008140250896, /* 0x0.f89bda33122c78007 */ + 0.973026706099345495256, /* 0x0.f9184738d4cf97ff8 */ + 0.974929006031422851235, /* 0x0.f994f284d3a5c0008 */ + 0.976835024947348973265, /* 0x0.fa11dc35bc7820002 */ + 0.978744770239899142285, /* 0x0.fa8f046b4fb7f8007 */ + 0.980658249138918636210, /* 0x0.fb0c6b449ab1cfff9 */ + 0.982575468959622777535, /* 0x0.fb8a10e1088fb7ffa */ + 0.984496437054508843888, /* 0x0.fc07f5602d79afffc */ + 0.986421160608523028820, /* 0x0.fc8618e0e55e47ffb */ + 0.988349647107594098099, /* 0x0.fd047b83571b1fffa */ + 0.990281903873210800357, /* 0x0.fd831d66f4c018002 */ + 0.992217938695037382475, /* 0x0.fe01fead3320bfff8 */ + 0.994157757657894713987, /* 0x0.fe811f703491e8006 */ + 0.996101369488558541238, /* 0x0.ff007fd5744490005 */ + 0.998048781093141101932, /* 0x0.ff801ffa9b9280007 */ + 1.000000000000000000000, /* 0x1.00000000000000000 */ + 1.001955033605393285965, /* 0x1.0080200565d29ffff */ + 1.003913889319761887310, /* 0x1.0100802aa0e80fff0 */ + 1.005876574715736104818, /* 0x1.01812090377240007 */ + 1.007843096764807100351, /* 0x1.020201541aad7fff6 */ + 1.009813464316352327214, /* 0x1.0283229c4c9820007 */ + 1.011787683565730677817, /* 0x1.030484836910a000e */ + 1.013765762469146736174, /* 0x1.0386272b9c077fffe */ + 1.015747708536026694351, /* 0x1.04080ab526304fff0 */ + 1.017733529475172815584, /* 0x1.048a2f412375ffff0 */ + 1.019723232714418781378, /* 0x1.050c94ef7ad5e000a */ + 1.021716825883923762690, /* 0x1.058f3be0f1c2d0004 */ + 1.023714316605201180057, /* 0x1.06122436442e2000e */ + 1.025715712440059545995, /* 0x1.06954e0fec63afff2 */ + 1.027721021151397406936, /* 0x1.0718b98f41c92fff6 */ + 1.029730250269221158939, /* 0x1.079c66d49bb2ffff1 */ + 1.031743407506447551857, /* 0x1.082056011a9230009 */ + 1.033760500517691527387, /* 0x1.08a487359ebd50002 */ + 1.035781537016238873464, /* 0x1.0928fa93490d4fff3 */ + 1.037806524719013578963, /* 0x1.09adb03b3e5b3000d */ + 1.039835471338248051878, /* 0x1.0a32a84e9e5760004 */ + 1.041868384612101516848, /* 0x1.0ab7e2eea5340ffff */ + 1.043905272300907460835, /* 0x1.0b3d603ca784f0009 */ + 1.045946142174331239262, /* 0x1.0bc3205a042060000 */ + 1.047991002016745332165, /* 0x1.0c4923682a086fffe */ + 1.050039859627715177527, /* 0x1.0ccf698898f3a000d */ + 1.052092722826109660856, /* 0x1.0d55f2dce5d1dfffb */ + 1.054149599440827866881, /* 0x1.0ddcbf86b09a5fff6 */ + 1.056210497317612961855, /* 0x1.0e63cfa7abc97fffd */ + 1.058275424318780855142, /* 0x1.0eeb23619c146fffb */ + 1.060344388322010722446, /* 0x1.0f72bad65714bffff */ + 1.062417397220589476718, /* 0x1.0ffa9627c38d30004 */ + 1.064494458915699715017, /* 0x1.1082b577d0eef0003 */ + 1.066575581342167566880, /* 0x1.110b18e893a90000a */ + 1.068660772440545025953, /* 0x1.1193c09c267610006 */ + 1.070750040138235936705, /* 0x1.121cacb4959befff6 */ + 1.072843392435016474095, /* 0x1.12a5dd543cf36ffff */ + 1.074940837302467588937, /* 0x1.132f529d59552000b */ + 1.077042382749654914030, /* 0x1.13b90cb250d08fff5 */ + 1.079148036789447484528, /* 0x1.14430bb58da3dfff9 */ + 1.081257807444460983297, /* 0x1.14cd4fc984c4a000e */ + 1.083371702785017154417, /* 0x1.1557d910df9c7000e */ + 1.085489730853784307038, /* 0x1.15e2a7ae292d30002 */ + 1.087611899742884524772, /* 0x1.166dbbc422d8c0004 */ + 1.089738217537583819804, /* 0x1.16f9157586772ffff */ + 1.091868692357631731528, /* 0x1.1784b4e533cacfff0 */ + 1.094003332327482702577, /* 0x1.18109a360fc23fff2 */ + 1.096142145591650907149, /* 0x1.189cc58b155a70008 */ + 1.098285140311341168136, /* 0x1.1929370751ea50002 */ + 1.100432324652149906842, /* 0x1.19b5eecdd79cefff0 */ + 1.102583706811727015711, /* 0x1.1a42ed01dbdba000e */ + 1.104739294993289488947, /* 0x1.1ad031c69a2eafff0 */ + 1.106899097422573863281, /* 0x1.1b5dbd3f66e120003 */ + 1.109063122341542140286, /* 0x1.1beb8f8fa8150000b */ + 1.111231377994659874592, /* 0x1.1c79a8dac6ad0fff4 */ + 1.113403872669181282605, /* 0x1.1d0809445a97ffffc */ + 1.115580614653132185460, /* 0x1.1d96b0effc9db000e */ + 1.117761612217810673898, /* 0x1.1e25a001332190000 */ + 1.119946873713312474002, /* 0x1.1eb4d69bdb2a9fff1 */ + 1.122136407473298902480, /* 0x1.1f4454e3bfae00006 */ + 1.124330221845670330058, /* 0x1.1fd41afcbb48bfff8 */ + 1.126528325196519908506, /* 0x1.2064290abc98c0001 */ + 1.128730725913251964394, /* 0x1.20f47f31c9aa7000f */ + 1.130937432396844410880, /* 0x1.21851d95f776dfff0 */ + 1.133148453059692917203, /* 0x1.2216045b6784efffa */ + 1.135363796355857157764, /* 0x1.22a733a6692ae0004 */ + 1.137583470716100553249, /* 0x1.2338ab9b3221a0004 */ + 1.139807484614418608939, /* 0x1.23ca6c5e27aadfff7 */ + 1.142035846532929888057, /* 0x1.245c7613b7f6c0004 */ + 1.144268564977221958089, /* 0x1.24eec8e06b035000c */ + 1.146505648458203463465, /* 0x1.258164e8cea85fff8 */ + 1.148747105501412235671, /* 0x1.26144a5180d380009 */ + 1.150992944689175123667, /* 0x1.26a7793f5de2efffa */ + 1.153243174560058870217, /* 0x1.273af1d712179000d */ + 1.155497803703682491111, /* 0x1.27ceb43d81d42fff1 */ + 1.157756840726344771440, /* 0x1.2862c097a3d29000c */ + 1.160020294239811677834, /* 0x1.28f7170a74cf4fff1 */ + 1.162288172883275239058, /* 0x1.298bb7bb0faed0004 */ + 1.164560485298402170388, /* 0x1.2a20a2ce920dffff4 */ + 1.166837240167474476460, /* 0x1.2ab5d86a4631ffff6 */ + 1.169118446164539637555, /* 0x1.2b4b58b36d5220009 */ + 1.171404112007080167155, /* 0x1.2be123cf786790002 */ + 1.173694246390975415341, /* 0x1.2c7739e3c0aac000d */ + 1.175988858069749065617, /* 0x1.2d0d9b15deb58fff6 */ + 1.178287955789017793514, /* 0x1.2da4478b627040002 */ + 1.180591548323240091978, /* 0x1.2e3b3f69fb794fffc */ + 1.182899644456603782686, /* 0x1.2ed282d76421d0004 */ + 1.185212252993012693694, /* 0x1.2f6a11f96c685fff3 */ + 1.187529382762033236513, /* 0x1.3001ecf60082ffffa */ + 1.189851042595508889847, /* 0x1.309a13f30f28a0004 */ + 1.192177241354644978669, /* 0x1.31328716a758cfff7 */ + 1.194507987909589896687, /* 0x1.31cb4686e1e85fffb */ + 1.196843291137896336843, /* 0x1.32645269dfd04000a */ + 1.199183159977805113226, /* 0x1.32fdaae604c39000f */ + 1.201527603343041317132, /* 0x1.339750219980dfff3 */ + 1.203876630171082595692, /* 0x1.3431424300e480007 */ + 1.206230249419600664189, /* 0x1.34cb8170b3fee000e */ + 1.208588470077065268869, /* 0x1.35660dd14dbd4fffc */ + 1.210951301134513435915, /* 0x1.3600e78b6bdfc0005 */ + 1.213318751604272271958, /* 0x1.369c0ec5c38ebfff2 */ + 1.215690830512196507537, /* 0x1.373783a718d29000f */ + 1.218067546930756250870, /* 0x1.37d3465662f480007 */ + 1.220448909901335365929, /* 0x1.386f56fa770fe0008 */ + 1.222834928513994334780, /* 0x1.390bb5ba5fc540004 */ + 1.225225611877684750397, /* 0x1.39a862bd3c7a8fff3 */ + 1.227620969111500981433, /* 0x1.3a455e2a37bcafffd */ + 1.230021009336254911271, /* 0x1.3ae2a8287dfbefff6 */ + 1.232425741726685064472, /* 0x1.3b8040df76f39fffa */ + 1.234835175450728295084, /* 0x1.3c1e287682e48fff1 */ + 1.237249319699482263931, /* 0x1.3cbc5f151b86bfff8 */ + 1.239668183679933477545, /* 0x1.3d5ae4e2cc0a8000f */ + 1.242091776620540377629, /* 0x1.3df9ba07373bf0006 */ + 1.244520107762172811399, /* 0x1.3e98deaa0d8cafffe */ + 1.246953186383919165383, /* 0x1.3f3852f32973efff0 */ + 1.249391019292643401078, /* 0x1.3fd816ffc72b90001 */ + 1.251833623164381181797, /* 0x1.40782b17863250005 */ + 1.254280999953110153911, /* 0x1.41188f42caf400000 */ + 1.256733161434815393410, /* 0x1.41b943b42945bfffd */ + 1.259190116985283935980, /* 0x1.425a4893e5f10000a */ + 1.261651875958665236542, /* 0x1.42fb9e0a2df4c0009 */ + 1.264118447754797758244, /* 0x1.439d443f608c4fff9 */ + 1.266589841787181258708, /* 0x1.443f3b5bebf850008 */ + 1.269066067469190262045, /* 0x1.44e183883e561fff7 */ + 1.271547134259576328224, /* 0x1.45841cecf7a7a0001 */ + 1.274033051628237434048, /* 0x1.462707b2c43020009 */ + 1.276523829025464573684, /* 0x1.46ca44023aa410007 */ + 1.279019475999373156531, /* 0x1.476dd2045d46ffff0 */ + 1.281520002043128991825, /* 0x1.4811b1e1f1f19000b */ + 1.284025416692967214122, /* 0x1.48b5e3c3edd74fff4 */ + 1.286535729509738823464, /* 0x1.495a67d3613c8fff7 */ + 1.289050950070396384145, /* 0x1.49ff3e396e19d000b */ + 1.291571087985403654081, /* 0x1.4aa4671f5b401fff1 */ + 1.294096152842774794011, /* 0x1.4b49e2ae56d19000d */ + 1.296626154297237043484, /* 0x1.4befb10fd84a3fff4 */ + 1.299161101984141142272, /* 0x1.4c95d26d41d84fff8 */ + 1.301701005575179204100, /* 0x1.4d3c46f01d9f0fff3 */ + 1.304245874766450485904, /* 0x1.4de30ec21097d0003 */ + 1.306795719266019562007, /* 0x1.4e8a2a0ccce3d0002 */ + 1.309350548792467483458, /* 0x1.4f3198fa10346fff5 */ + 1.311910373099227200545, /* 0x1.4fd95bb3be8cffffd */ + 1.314475201942565174546, /* 0x1.50817263bf0e5fffb */ + 1.317045045107389400535, /* 0x1.5129dd3418575000e */ + 1.319619912422941299109, /* 0x1.51d29c4f01c54ffff */ + 1.322199813675649204855, /* 0x1.527bafde83a310009 */ + 1.324784758729532718739, /* 0x1.5325180cfb8b3fffd */ + 1.327374757430096474625, /* 0x1.53ced504b2bd0fff4 */ + 1.329969819671041886272, /* 0x1.5478e6f02775e0001 */ + 1.332569955346704748651, /* 0x1.55234df9d8a59fff8 */ + 1.335175174370685002822, /* 0x1.55ce0a4c5a6a9fff6 */ + 1.337785486688218616860, /* 0x1.56791c1263abefff7 */ + 1.340400902247843806217, /* 0x1.57248376aef21fffa */ + 1.343021431036279800211, /* 0x1.57d040a420c0bfff3 */ + 1.345647083048053138662, /* 0x1.587c53c5a630f0002 */ + 1.348277868295411074918, /* 0x1.5928bd063fd7bfff9 */ + 1.350913796821875845231, /* 0x1.59d57c9110ad60006 */ + 1.353554878672557082439, /* 0x1.5a8292913d68cfffc */ + 1.356201123929036356254, /* 0x1.5b2fff3212db00007 */ + 1.358852542671913132777, /* 0x1.5bddc29edcc06fff3 */ + 1.361509145047255398051, /* 0x1.5c8bdd032ed16000f */ + 1.364170941142184734180, /* 0x1.5d3a4e8a5bf61fff4 */ + 1.366837941171020309735, /* 0x1.5de9176042f1effff */ + 1.369510155261156381121, /* 0x1.5e9837b062f4e0005 */ + 1.372187593620959988833, /* 0x1.5f47afa69436cfff1 */ + 1.374870266463378287715, /* 0x1.5ff77f6eb3f8cfffd */ + 1.377558184010425845733, /* 0x1.60a7a734a9742fff9 */ + 1.380251356531521533853, /* 0x1.6158272490016000c */ + 1.382949794301995272203, /* 0x1.6208ff6a8978a000f */ + 1.385653507605306700170, /* 0x1.62ba3032c0a280004 */ + 1.388362506772382154503, /* 0x1.636bb9a994784000f */ + 1.391076802081129493127, /* 0x1.641d9bfb29a7bfff6 */ + 1.393796403973427855412, /* 0x1.64cfd7545928b0002 */ + 1.396521322756352656542, /* 0x1.65826be167badfff8 */ + 1.399251568859207761660, /* 0x1.663559cf20826000c */ + 1.401987152677323100733, /* 0x1.66e8a14a29486fffc */ + 1.404728084651919228815, /* 0x1.679c427f5a4b6000b */ + 1.407474375243217723560, /* 0x1.68503d9ba0add000f */ + 1.410226034922914983815, /* 0x1.690492cbf6303fff9 */ + 1.412983074197955213304, /* 0x1.69b9423d7b548fff6 */ +}; diff --git a/sysdeps/ieee754/dbl-64/t_exp2.h b/sysdeps/ieee754/dbl-64/t_exp2.h new file mode 100644 index 0000000000..1fd73338cf --- /dev/null +++ b/sysdeps/ieee754/dbl-64/t_exp2.h @@ -0,0 +1,585 @@ +/* These values are accurate to 52+12 bits when represented as + a double. */ +static const double exp2_accuratetable[512] = { +0.707106781187802013759 /* 0x0.b504f333fb3f80007 */, +0.708064712808760599040 /* 0x0.b543baa0f71b38000 */, +0.709023942160304065938 /* 0x0.b58297d3a8d518002 */, +0.709984470998547667624 /* 0x0.b5c18ad39b4ba0001 */, +0.710946301084324217006 /* 0x0.b60093a85e8d30001 */, +0.711909434180505784637 /* 0x0.b63fb25984e628005 */, +0.712873872052760648733 /* 0x0.b67ee6eea3b5f8003 */, +0.713839616467838999908 /* 0x0.b6be316f518c98001 */, +0.714806669195984345523 /* 0x0.b6fd91e328d148007 */, +0.715775032009894562898 /* 0x0.b73d0851c69e20002 */, +0.716744706683768884058 /* 0x0.b77c94c2c9b3d0003 */, +0.717715694995770148178 /* 0x0.b7bc373dd52eb0003 */, +0.718687998724665488852 /* 0x0.b7fbefca8cd530004 */, +0.719661619652575468291 /* 0x0.b83bbe70981da8001 */, +0.720636559564428180758 /* 0x0.b87ba337a194b0006 */, +0.721612820246623098989 /* 0x0.b8bb9e27556508004 */, +0.722590403488338473025 /* 0x0.b8fbaf4762c798006 */, +0.723569311081411870036 /* 0x0.b93bd69f7be1d0000 */, +0.724549544820974333906 /* 0x0.b97c1437567828007 */, +0.725531106502312561633 /* 0x0.b9bc6816a87ae8002 */, +0.726513997924421062181 /* 0x0.b9fcd2452bee00000 */, +0.727498220889519875430 /* 0x0.ba3d52ca9e6148002 */, +0.728483777200401694265 /* 0x0.ba7de9aebe05c8003 */, +0.729470668664712662563 /* 0x0.babe96f94e62a8002 */, +0.730458897090379144517 /* 0x0.baff5ab2134df0004 */, +0.731448464287988597833 /* 0x0.bb4034e0d38ab0000 */, +0.732439372072965166897 /* 0x0.bb81258d5b2d60001 */, +0.733431622260458326859 /* 0x0.bbc22cbf75fd28001 */, +0.734425216668725511232 /* 0x0.bc034a7ef32c00001 */, +0.735420157118880535324 /* 0x0.bc447ed3a50fe0005 */, +0.736416445434497690674 /* 0x0.bc85c9c560b350001 */, +0.737414083433310718618 /* 0x0.bcc72b5bf4b4e0000 */, +0.738413072966152328496 /* 0x0.bd08a39f5417a8007 */, +0.739413415848264365956 /* 0x0.bd4a32974abcd0002 */, +0.740415113911250699637 /* 0x0.bd8bd84bb68300002 */, +0.741418168994518067562 /* 0x0.bdcd94c47ddd30003 */, +0.742422582936659858376 /* 0x0.be0f6809865968006 */, +0.743428357577745613238 /* 0x0.be515222b72530003 */, +0.744435494762383687126 /* 0x0.be935317fc6ba0002 */, +0.745443996335090397492 /* 0x0.bed56af1423de8001 */, +0.746453864145572798553 /* 0x0.bf1799b67a6248007 */, +0.747465100043933849969 /* 0x0.bf59df6f970e70002 */, +0.748477705883256683178 /* 0x0.bf9c3c248dbee8001 */, +0.749491683518965001732 /* 0x0.bfdeafdd568308000 */, +0.750507034813367890373 /* 0x0.c0213aa1f0fc38004 */, +0.751523761622240105153 /* 0x0.c063dc7a559ca0003 */, +0.752541865811731880422 /* 0x0.c0a6956e883ed8000 */, +0.753561349247157341600 /* 0x0.c0e965868bd220006 */, +0.754582213796583967110 /* 0x0.c12c4cca664cb8002 */, +0.755604461332336940791 /* 0x0.c16f4b42225350006 */, +0.756628093726406381068 /* 0x0.c1b260f5ca2c48002 */, +0.757653112855631305506 /* 0x0.c1f58ded6d72d8001 */, +0.758679520599333412360 /* 0x0.c238d2311e7d08001 */, +0.759707318837184453227 /* 0x0.c27c2dc8f00368005 */, +0.760736509456435783249 /* 0x0.c2bfa0bcfd1400000 */, +0.761767094336480043995 /* 0x0.c3032b155818d0000 */, +0.762799075372231349951 /* 0x0.c346ccda248cc0001 */, +0.763832454453522768941 /* 0x0.c38a8613805488005 */, +0.764867233473625618441 /* 0x0.c3ce56c98d1ca8005 */, +0.765903414329434539816 /* 0x0.c4123f04708d80002 */, +0.766940998920452976510 /* 0x0.c4563ecc532dc0001 */, +0.767979989148100838946 /* 0x0.c49a56295f9f88006 */, +0.769020386915772125040 /* 0x0.c4de8523c2b0a0001 */, +0.770062194131770905170 /* 0x0.c522cbc3ae94e0003 */, +0.771105412703856241146 /* 0x0.c5672a1154e6b8004 */, +0.772150044545352520777 /* 0x0.c5aba014ed5f18003 */, +0.773196091570364285606 /* 0x0.c5f02dd6b09288003 */, +0.774243555696622731700 /* 0x0.c634d35edb1260003 */, +0.775292438842697939641 /* 0x0.c67990b5aa5c18004 */, +0.776342742931542928455 /* 0x0.c6be65e360bed8000 */, +0.777394469888802008854 /* 0x0.c70352f0437f50004 */, +0.778447621641124243320 /* 0x0.c74857e498fd00006 */, +0.779502200118583399303 /* 0x0.c78d74c8ab5b60000 */, +0.780558207255445668515 /* 0x0.c7d2a9a4c959f8000 */, +0.781615644985491186966 /* 0x0.c817f681412f80002 */, +0.782674515247667956808 /* 0x0.c85d5b6666c150006 */, +0.783734819983036512536 /* 0x0.c8a2d85c904760003 */, +0.784796561133562109454 /* 0x0.c8e86d6c14f850002 */, +0.785859740645942328471 /* 0x0.c92e1a9d513ec8002 */, +0.786924360469767103536 /* 0x0.c973dff8a4b390007 */, +0.787990422552312885808 /* 0x0.c9b9bd866c6440007 */, +0.789057928854407064640 /* 0x0.c9ffb34f1444b0001 */, +0.790126881326406182996 /* 0x0.ca45c15afcc570001 */, +0.791197281930050233534 /* 0x0.ca8be7b292db38000 */, +0.792269132620954885659 /* 0x0.cad2265e3cbee8000 */, +0.793342435380726906957 /* 0x0.cb187d667d3d38006 */, +0.794417192158282659010 /* 0x0.cb5eecd3b33158006 */, +0.795493404931386649540 /* 0x0.cba574ae5d2e80001 */, +0.796571075671306805268 /* 0x0.cbec14fef2a348004 */, +0.797650206352955137846 /* 0x0.cc32cdcdef0000000 */, +0.798730798954342069432 /* 0x0.cc799f23d11d18000 */, +0.799812855456121796232 /* 0x0.ccc089091abb28004 */, +0.800896377841454287795 /* 0x0.cd078b86505c18003 */, +0.801981368096190028208 /* 0x0.cd4ea6a3f97720007 */, +0.803067828208752554378 /* 0x0.cd95da6aa057b8007 */, +0.804155760170129796375 /* 0x0.cddd26e2d21b28001 */, +0.805245165974338261710 /* 0x0.ce248c151f3330001 */, +0.806336047619038653883 /* 0x0.ce6c0a0a1c1350001 */, +0.807428407102107836855 /* 0x0.ceb3a0ca5d6be0006 */, +0.808522246427078927792 /* 0x0.cefb505e7e2550007 */, +0.809617567597010201484 /* 0x0.cf4318cf18a268002 */, +0.810714372621179513182 /* 0x0.cf8afa24ce1c98004 */, +0.811812663508675536069 /* 0x0.cfd2f4683f9810005 */, +0.812912442272482604912 /* 0x0.d01b07a2126188003 */, +0.814013710929394895825 /* 0x0.d06333daeff618001 */, +0.815116471495287542325 /* 0x0.d0ab791b80d028006 */, +0.816220725993571205593 /* 0x0.d0f3d76c75b330000 */, +0.817326476447408967199 /* 0x0.d13c4ed67f1cf8000 */, +0.818433724883006474832 /* 0x0.d184df6250e3b0001 */, +0.819542473330909460055 /* 0x0.d1cd8918a3a328004 */, +0.820652723822034690935 /* 0x0.d2164c02305fa0002 */, +0.821764478391968422618 /* 0x0.d25f2827b53fb0005 */, +0.822877739077315761840 /* 0x0.d2a81d91f188b8000 */, +0.823992507918612782109 /* 0x0.d2f12c49a8d290005 */, +0.825108786960634610365 /* 0x0.d33a5457a35e40003 */, +0.826226578247117093869 /* 0x0.d38395c4a84848007 */, +0.827345883828319528258 /* 0x0.d3ccf09985d958004 */, +0.828466705754248966560 /* 0x0.d41664df0a1320005 */, +0.829589046080638992111 /* 0x0.d45ff29e094330000 */, +0.830712906863802391671 /* 0x0.d4a999df585a20005 */, +0.831838290163696481037 /* 0x0.d4f35aabd04a60006 */, +0.832965198041969556729 /* 0x0.d53d350c4be258002 */, +0.834093632565442222342 /* 0x0.d5872909aba050007 */, +0.835223595802037643865 /* 0x0.d5d136acd138e8006 */, +0.836355089820669306292 /* 0x0.d61b5dfe9f7780004 */, +0.837488116698010487424 /* 0x0.d6659f0801afa8005 */, +0.838622678508982644113 /* 0x0.d6aff9d1e147d8004 */, +0.839758777333464490056 /* 0x0.d6fa6e652d19e0000 */, +0.840896415254110962690 /* 0x0.d744fccad70d00003 */, +0.842035594355151628676 /* 0x0.d78fa50bd2c3b0000 */, +0.843176316724478125433 /* 0x0.d7da673117e730007 */, +0.844318584453106590905 /* 0x0.d8254343a19038003 */, +0.845462399634695271912 /* 0x0.d870394c6dbf30003 */, +0.846607764365415071965 /* 0x0.d8bb49547d37c0004 */, +0.847754680744707056494 /* 0x0.d9067364d45608003 */, +0.848903150873708822763 /* 0x0.d951b7867953b0006 */, +0.850053176859071113491 /* 0x0.d99d15c2787a30006 */, +0.851204760807439786431 /* 0x0.d9e88e21de11a0003 */, +0.852357904828824897169 /* 0x0.da3420adba1508003 */, +0.853512611037803181642 /* 0x0.da7fcd6f2184d8005 */, +0.854668881550406100980 /* 0x0.dacb946f2afaf8000 */, +0.855826718478671755185 /* 0x0.db1775b6e8ad48000 */, +0.856986123964844970247 /* 0x0.db63714f8e0818006 */, +0.858147100114499461478 /* 0x0.dbaf87422625b8000 */, +0.859309649060962410524 /* 0x0.dbfbb797daa460002 */, +0.860473772936213743282 /* 0x0.dc480259d3a710001 */, +0.861639473872910177676 /* 0x0.dc9467913a0f48006 */, +0.862806754008130227807 /* 0x0.dce0e7473b9b28003 */, +0.863975615481124226159 /* 0x0.dd2d8185086c20006 */, +0.865146060433749419813 /* 0x0.dd7a3653d38168005 */, +0.866318091005120138881 /* 0x0.ddc705bcccd628000 */, +0.867491709362415264210 /* 0x0.de13efc9434100004 */, +0.868666917636779056818 /* 0x0.de60f4825df9b8005 */, +0.869843717989716047624 /* 0x0.deae13f16599c0003 */, +0.871022112578215268471 /* 0x0.defb4e1f9dc388002 */, +0.872202103559697183859 /* 0x0.df48a3164a92f0001 */, +0.873383693097737778847 /* 0x0.df9612deb6e878007 */, +0.874566883362160263365 /* 0x0.dfe39d82348310001 */, +0.875751676517234511901 /* 0x0.e031430a0f0688000 */, +0.876938074732511840819 /* 0x0.e07f037f97e548001 */, +0.878126080186539592654 /* 0x0.e0ccdeec2a75e0006 */, +0.879315695055312818168 /* 0x0.e11ad5591f4078001 */, +0.880506921518618312932 /* 0x0.e168e6cfd2f880004 */, +0.881699761760385225541 /* 0x0.e1b71359a6df60003 */, +0.882894217964411143207 /* 0x0.e2055afffc1178000 */, +0.884090292325693805080 /* 0x0.e253bdcc3ffbb8001 */, +0.885287987031581180559 /* 0x0.e2a23bc7d7a1d8002 */, +0.886487304278189114386 /* 0x0.e2f0d4fc31ab80004 */, +0.887688246263368285778 /* 0x0.e33f8972bea8a8005 */, +0.888890815189881999840 /* 0x0.e38e5934f49010007 */, +0.890095013257492739835 /* 0x0.e3dd444c460bd0007 */, +0.891300842677948068626 /* 0x0.e42c4ac232f380000 */, +0.892508305659222567226 /* 0x0.e47b6ca036f8b8005 */, +0.893717404414979710310 /* 0x0.e4caa9efd40e58002 */, +0.894928141160697743242 /* 0x0.e51a02ba8e2610007 */, +0.896140518115016826430 /* 0x0.e5697709ecab90000 */, +0.897354537501434679237 /* 0x0.e5b906e77c61d0006 */, +0.898570201543732793877 /* 0x0.e608b25cca5ba8005 */, +0.899787512470129891014 /* 0x0.e6587973688ce8002 */, +0.901006472512270728537 /* 0x0.e6a85c34ecadb8000 */, +0.902227083902570559127 /* 0x0.e6f85aaaed4f20006 */, +0.903449348881299796343 /* 0x0.e74874df09a530003 */, +0.904673269686823378091 /* 0x0.e798aadadecba0007 */, +0.905898848559668845585 /* 0x0.e7e8fca80c3ee0001 */, +0.907126087750156795426 /* 0x0.e8396a503c3fe0005 */, +0.908354989505901100354 /* 0x0.e889f3dd1615b0002 */, +0.909585556079328783087 /* 0x0.e8da9958465228007 */, +0.910817789726044213523 /* 0x0.e92b5acb7d0578001 */, +0.912051692703457872481 /* 0x0.e97c38406c3c30003 */, +0.913287267274154990210 /* 0x0.e9cd31c0cbb370001 */, +0.914524515702244578108 /* 0x0.ea1e475654d540000 */, +0.915763440256158633982 /* 0x0.ea6f790ac5cc78001 */, +0.917004043205012497909 /* 0x0.eac0c6e7dd8448007 */, +0.918246326823137892807 /* 0x0.eb1230f760a428007 */, +0.919490293387826285200 /* 0x0.eb63b7431714a8007 */, +0.920735945178816406225 /* 0x0.ebb559d4cb6f30007 */, +0.921983284479243714322 /* 0x0.ec0718b64c0940002 */, +0.923232313574974705626 /* 0x0.ec58f3f16a3910002 */, +0.924483034755387955725 /* 0x0.ecaaeb8ffb3168005 */, +0.925735450311948926408 /* 0x0.ecfcff9bd67078000 */, +0.926989562542820610982 /* 0x0.ed4f301edad1a0007 */, +0.928245373740515189457 /* 0x0.eda17d22e0f9b0001 */, +0.929502886213858126045 /* 0x0.edf3e6b1d37d40001 */, +0.930762102264245716494 /* 0x0.ee466cd594c5c8005 */, +0.932023024199046146183 /* 0x0.ee990f980dcdb0005 */, +0.933285654329454095216 /* 0x0.eeebcf032bc470007 */, +0.934549994971191289044 /* 0x0.ef3eab20e0d3c0001 */, +0.935816048439005676599 /* 0x0.ef91a3fb1e1340004 */, +0.937083817055075818404 /* 0x0.efe4b99bdcc618006 */, +0.938353303143720007819 /* 0x0.f037ec0d1889b8000 */, +0.939624509028518128972 /* 0x0.f08b3b58cc2bb8006 */, +0.940897437041863904384 /* 0x0.f0dea788fc2a90000 */, +0.942172089516254085427 /* 0x0.f13230a7ad21b8003 */, +0.943448468787511540534 /* 0x0.f185d6bee754e0006 */, +0.944726577195256100890 /* 0x0.f1d999d8b73478005 */, +0.946006417082291717338 /* 0x0.f22d79ff2cb130000 */, +0.947287990793413858827 /* 0x0.f281773c59ec48007 */, +0.948571300678290207925 /* 0x0.f2d5919a566268001 */, +0.949856349088629370320 /* 0x0.f329c9233bceb0001 */, +0.951143138379053731954 /* 0x0.f37e1de1272068002 */, +0.952431670908847949364 /* 0x0.f3d28fde3a6728006 */, +0.953721949039916472305 /* 0x0.f4271f249a93f0001 */, +0.955013975135367898520 /* 0x0.f47bcbbe6deab0001 */, +0.956307751564417496418 /* 0x0.f4d095b5e16638004 */, +0.957603280698967163097 /* 0x0.f5257d1524f590006 */, +0.958900564911197350604 /* 0x0.f57a81e668d628000 */, +0.960199606581278120057 /* 0x0.f5cfa433e60e50007 */, +0.961500408088936442422 /* 0x0.f624e407d527a0007 */, +0.962802971817578789903 /* 0x0.f67a416c72b760006 */, +0.964107300155846558292 /* 0x0.f6cfbc6c011458004 */, +0.965413395493874504368 /* 0x0.f7255510c439a8002 */, +0.966721260225105960572 /* 0x0.f77b0b6503c5b8006 */, +0.968030896745834645873 /* 0x0.f7d0df730a7940005 */, +0.969342307458006424716 /* 0x0.f826d145294be8003 */, +0.970655494764855020231 /* 0x0.f87ce0e5b29fd8000 */, +0.971970461071268720958 /* 0x0.f8d30e5efaa8f0004 */, +0.973287208789983648852 /* 0x0.f92959bb5e3c08001 */, +0.974605740331924708124 /* 0x0.f97fc305383028004 */, +0.975926058115625383329 /* 0x0.f9d64a46ebb9f8004 */, +0.977248164559556209435 /* 0x0.fa2cef8adbfc68004 */, +0.978572062087848637573 /* 0x0.fa83b2db7253d0007 */, +0.979897753126343307191 /* 0x0.fada944319fda0005 */, +0.981225240104636631254 /* 0x0.fb3193cc425870002 */, +0.982554525455618277276 /* 0x0.fb88b1815e61d0003 */, +0.983885611617111077747 /* 0x0.fbdfed6ce683e0007 */, +0.985218501026348891812 /* 0x0.fc3747995282f8006 */, +0.986553196127724962867 /* 0x0.fc8ec0112202a0005 */, +0.987889699367056062238 /* 0x0.fce656ded63710002 */, +0.989228013193998778636 /* 0x0.fd3e0c0cf48d50005 */, +0.990568140061241164686 /* 0x0.fd95dfa605c7b0003 */, +0.991910082424819927754 /* 0x0.fdedd1b4965710004 */, +0.993253842749249660216 /* 0x0.fe45e2433bfea0000 */, +0.994599423484053835071 /* 0x0.fe9e115c7c05f0005 */, +0.995946827107488830167 /* 0x0.fef65f0afb4c28006 */, +0.997296056085008264529 /* 0x0.ff4ecb59509cc8001 */, +0.998647112892057764479 /* 0x0.ffa756521dbfd0007 */, +1.000000000000000000000 /* 0x1.00000000000000000 */, +1.001354719891689004659 /* 0x1.0058c86da14aa0005 */, +1.002711275050312211844 /* 0x1.00b1afa5abead0003 */, +1.004069667960743483835 /* 0x1.010ab5b2cc0660009 */, +1.005429901112333324093 /* 0x1.0163da9fb2af30008 */, +1.006791976999887428009 /* 0x1.01bd1e7716f6a0008 */, +1.008155898118476168101 /* 0x1.02168143b03890006 */, +1.009521666967782227439 /* 0x1.027003103ae320002 */, +1.010889286051850133326 /* 0x1.02c9a3e7783030002 */, +1.012258757875921233497 /* 0x1.032363d42aaa8000e */, +1.013630084952214405194 /* 0x1.037d42e11c88d0000 */, +1.015003269791313389451 /* 0x1.03d741191635a0001 */, +1.016378314911229763267 /* 0x1.04315e86e84630008 */, +1.017755222831652872635 /* 0x1.048b9b35652800002 */, +1.019133996077934645224 /* 0x1.04e5f72f65827000b */, +1.020514637175266248212 /* 0x1.0540727fc1cfa0006 */, +1.021897148653734488385 /* 0x1.059b0d3157ebb0002 */, +1.023281533050062419584 /* 0x1.05f5c74f0cfeb0002 */, +1.024667792897328677539 /* 0x1.0650a0e3c22ee0003 */, +1.026055930738840826806 /* 0x1.06ab99fa63e1b0008 */, +1.027445949118511947550 /* 0x1.0706b29ddf2700009 */, +1.028837850584049418178 /* 0x1.0761ead9253ab0009 */, +1.030231637685799839262 /* 0x1.07bd42b72a3f80008 */, +1.031627312979383592802 /* 0x1.0818ba42e824a000c */, +1.033024879021186448496 /* 0x1.0874518759b0b0008 */, +1.034424338374263729911 /* 0x1.08d0088f80ffa0006 */, +1.035825693601787333992 /* 0x1.092bdf66604e30005 */, +1.037228947273990842283 /* 0x1.0987d617019cd000a */, +1.038634101961269928846 /* 0x1.09e3ecac6f199000f */, +1.040041160239590700707 /* 0x1.0a402331b91270002 */, +1.041450124688240164200 /* 0x1.0a9c79b1f37c3000b */, +1.042860997889083929381 /* 0x1.0af8f038352160000 */, +1.044273782427270314011 /* 0x1.0b5586cf986890006 */, +1.045688480893644856116 /* 0x1.0bb23d833dfbf0006 */, +1.047105095879385272564 /* 0x1.0c0f145e46e330007 */, +1.048523629981608529302 /* 0x1.0c6c0b6bdaadc000f */, +1.049944085800634585634 /* 0x1.0cc922b72470a000f */, +1.051366465939483019223 /* 0x1.0d265a4b5238b0007 */, +1.052790773004648849929 /* 0x1.0d83b23395e510002 */, +1.054217009607077093512 /* 0x1.0de12a7b263970006 */, +1.055645178360430591625 /* 0x1.0e3ec32d3cf680000 */, +1.057075281882416506511 /* 0x1.0e9c7c55184f5000e */, +1.058507322794714378170 /* 0x1.0efa55fdfad51000a */, +1.059941303721639416236 /* 0x1.0f58503329fed0003 */, +1.061377227289284297385 /* 0x1.0fb66affed37f0000 */, +1.062815096132297298980 /* 0x1.1014a66f95540000c */, +1.064254912884593951029 /* 0x1.1073028d725850007 */, +1.065696680185205469411 /* 0x1.10d17f64d9ea2000b */, +1.067140400676658718053 /* 0x1.11301d012586a0007 */, +1.068586077004890055886 /* 0x1.118edb6db26ab0003 */, +1.070033711820396415998 /* 0x1.11edbab5e2d6e000b */, +1.071483307775789262099 /* 0x1.124cbae51b5ef0001 */, +1.072934867526001312439 /* 0x1.12abdc06c3240000c */, +1.074388393734249103080 /* 0x1.130b1e264a62e0005 */, +1.075843889063253344684 /* 0x1.136a814f20ccd0003 */, +1.077301356179926061823 /* 0x1.13ca058cbaaed000b */, +1.078760797756675327056 /* 0x1.1429aaea9260e000e */, +1.080222216468626150775 /* 0x1.148971742537c0009 */, +1.081685614993597610617 /* 0x1.14e95934f37e8000b */, +1.083150996013011013776 /* 0x1.1549623881762000d */, +1.084618362213087383633 /* 0x1.15a98c8a58a6a000b */, +1.086087716284427351384 /* 0x1.1609d8360768c0008 */, +1.087559060917626885283 /* 0x1.166a45471c13f0008 */, +1.089032398810997337465 /* 0x1.16cad3c92d7b50009 */, +1.090507732647478578212 /* 0x1.172b83c7c18b5000f */, +1.091985065182095926460 /* 0x1.178c554ead72a000c */, +1.093464399073070136880 /* 0x1.17ed48695befe000c */, +1.094945737045367906172 /* 0x1.184e5d23812500007 */, +1.096429081816546080591 /* 0x1.18af9388c90e40005 */, +1.097914436104650892651 /* 0x1.1910eba4e031a0001 */, +1.099401802629782043408 /* 0x1.19726583755720003 */, +1.100891184121537858001 /* 0x1.19d4013041b860007 */, +1.102382583308144647940 /* 0x1.1a35beb6fd0cd0007 */, +1.103876002922312915544 /* 0x1.1a979e2363fa10000 */, +1.105371445702084232160 /* 0x1.1af99f8139025000e */, +1.106868914387219016199 /* 0x1.1b5bc2dc408b9000e */, +1.108368411723785085252 /* 0x1.1bbe084045eb30002 */, +1.109869940458469095340 /* 0x1.1c206fb91524c000e */, +1.111373503344554869449 /* 0x1.1c82f952817cc0001 */, +1.112879103137133007859 /* 0x1.1ce5a51860344000f */, +1.114386742595953938610 /* 0x1.1d4873168babf000e */, +1.115896424484008608911 /* 0x1.1dab6358e1d4a000f */, +1.117408151567338414664 /* 0x1.1e0e75eb43f9c000c */, +1.118921926613465345265 /* 0x1.1e71aad995078000f */, +1.120437752409564780022 /* 0x1.1ed5022fcd8600003 */, +1.121955631720569668277 /* 0x1.1f387bf9cd88b0000 */, +1.123475567332998359439 /* 0x1.1f9c18438cdec000a */, +1.124997562033035469759 /* 0x1.1fffd71902f970002 */, +1.126521618608448571713 /* 0x1.2063b88629079000e */, +1.128047739853580200284 /* 0x1.20c7bc96ff72a0002 */, +1.129575928566289189112 /* 0x1.212be3578a81e0006 */, +1.131106187546149888259 /* 0x1.21902cd3d05f70007 */, +1.132638519598779369743 /* 0x1.21f49917ddda5000c */, +1.134172927531616359481 /* 0x1.2259282fc1c24000e */, +1.135709414157753949251 /* 0x1.22bdda27911e90007 */, +1.137247982292643566662 /* 0x1.2322af0b638e60007 */, +1.138788634756517259562 /* 0x1.2387a6e755f270000 */, +1.140331374372893558110 /* 0x1.23ecc1c788c890006 */, +1.141876203969685699176 /* 0x1.2451ffb821639000c */, +1.143423126377846266197 /* 0x1.24b760c5486dc0009 */, +1.144972144431494420774 /* 0x1.251ce4fb2a0cc0005 */, +1.146523260971646252006 /* 0x1.25828c65f9fb8000d */, +1.148076478839068270690 /* 0x1.25e85711ebaeb0000 */, +1.149631800883562204903 /* 0x1.264e450b3c8a30008 */, +1.151189229953253789786 /* 0x1.26b4565e281a20003 */, +1.152748768902654319399 /* 0x1.271a8b16f0f000002 */, +1.154310420590433317050 /* 0x1.2780e341de2fc0001 */, +1.155874187878668246681 /* 0x1.27e75eeb3abc90007 */, +1.157440073633736243899 /* 0x1.284dfe1f5633e000a */, +1.159008080725518974322 /* 0x1.28b4c0ea840d90001 */, +1.160578212048386514965 /* 0x1.291ba75932ae60000 */, +1.162150470417516290340 /* 0x1.2982b177796850008 */, +1.163724858777502646494 /* 0x1.29e9df51fdd900001 */, +1.165301379991388053320 /* 0x1.2a5130f50bf34000e */, +1.166880036952526289469 /* 0x1.2ab8a66d10fdc0008 */, +1.168460832550151540268 /* 0x1.2b203fc675b7a000a */, +1.170043769683112966389 /* 0x1.2b87fd0dad7260008 */, +1.171628851252754177681 /* 0x1.2befde4f2e3da000d */, +1.173216080163546060084 /* 0x1.2c57e397719940002 */, +1.174805459325657830448 /* 0x1.2cc00cf2f7491000c */, +1.176396991650083379037 /* 0x1.2d285a6e3ff90000b */, +1.177990680055698513602 /* 0x1.2d90cc15d4ff90005 */, +1.179586527463262646306 /* 0x1.2df961f641c57000c */, +1.181184536796979545103 /* 0x1.2e621c1c157cd000d */, +1.182784710984701836994 /* 0x1.2ecafa93e35af0004 */, +1.184387052960675701386 /* 0x1.2f33fd6a459cb0000 */, +1.185991565661414393112 /* 0x1.2f9d24abd8fd1000e */, +1.187598252026902612178 /* 0x1.300670653e083000a */, +1.189207115003001469262 /* 0x1.306fe0a31bc040008 */, +1.190818157535919796833 /* 0x1.30d9757219895000e */, +1.192431382587621380206 /* 0x1.31432edef01a1000f */, +1.194046793097208292195 /* 0x1.31ad0cf63f0630008 */, +1.195664392040319823392 /* 0x1.32170fc4ce0db000c */, +1.197284182375793593084 /* 0x1.32813757527750005 */, +1.198906167074650808198 /* 0x1.32eb83ba8eef3000f */, +1.200530349107333139048 /* 0x1.3355f4fb457e5000d */, +1.202156731453099647353 /* 0x1.33c08b2641df9000c */, +1.203785317090505513368 /* 0x1.342b46484f07b0005 */, +1.205416109005122526928 /* 0x1.3496266e3fa270005 */, +1.207049110184904572310 /* 0x1.35012ba4e8fa10000 */, +1.208684323627194912036 /* 0x1.356c55f92aabb0004 */, +1.210321752322854882437 /* 0x1.35d7a577dd33f0004 */, +1.211961399276747286580 /* 0x1.36431a2de8748000d */, +1.213603267492579629347 /* 0x1.36aeb4283309e000c */, +1.215247359985374142610 /* 0x1.371a7373b00160000 */, +1.216893679753690671322 /* 0x1.3786581d404e90000 */, +1.218542229828181611183 /* 0x1.37f26231e82e4000c */, +1.220193013225231215567 /* 0x1.385e91be9c2d20002 */, +1.221846032973555429280 /* 0x1.38cae6d05e66f0000 */, +1.223501292099485437962 /* 0x1.393761742e5830001 */, +1.225158793636904830441 /* 0x1.39a401b713cb3000e */, +1.226818540625497444577 /* 0x1.3a10c7a61ceae0007 */, +1.228480536107136034131 /* 0x1.3a7db34e5a4a50003 */, +1.230144783126481566885 /* 0x1.3aeac4bcdf8d60001 */, +1.231811284734168454619 /* 0x1.3b57fbfec6e950008 */, +1.233480043984379381835 /* 0x1.3bc559212e7a2000f */, +1.235151063936380300149 /* 0x1.3c32dc3139f2a0004 */, +1.236824347652524913647 /* 0x1.3ca0853c106ac000e */, +1.238499898199571624970 /* 0x1.3d0e544eddd240003 */, +1.240177718649636107175 /* 0x1.3d7c4976d3fcd0000 */, +1.241857812073360767273 /* 0x1.3dea64c1231f70004 */, +1.243540181554270152039 /* 0x1.3e58a63b099920005 */, +1.245224830175077013244 /* 0x1.3ec70df1c4e46000e */, +1.246911761022835740725 /* 0x1.3f359bf29741c000e */, +1.248600977188942806639 /* 0x1.3fa4504ac7b800009 */, +1.250292481770148400634 /* 0x1.40132b07a330d000a */, +1.251986277866492969263 /* 0x1.40822c367a340000b */, +1.253682368581898742876 /* 0x1.40f153e4a18e0000d */, +1.255380757024939564249 /* 0x1.4160a21f73289000d */, +1.257081446308726757662 /* 0x1.41d016f44deaa000c */, +1.258784439550028944083 /* 0x1.423fb27094c090008 */, +1.260489739869405489991 /* 0x1.42af74a1aec1c0006 */, +1.262197350394008266193 /* 0x1.431f5d950a453000c */, +1.263907274252603851764 /* 0x1.438f6d58176860004 */, +1.265619514578811388761 /* 0x1.43ffa3f84b9eb000d */, +1.267334074511444086425 /* 0x1.44700183221180008 */, +1.269050957191869555296 /* 0x1.44e0860618b930006 */, +1.270770165768063009230 /* 0x1.4551318eb4d20000e */, +1.272491703389059036805 /* 0x1.45c2042a7cc26000b */, +1.274215573211836316547 /* 0x1.4632fde6ffacd000d */, +1.275941778396075143580 /* 0x1.46a41ed1cfac40001 */, +1.277670322103555911043 /* 0x1.471566f8812ac0000 */, +1.279401207505722393185 /* 0x1.4786d668b33260005 */, +1.281134437771823675369 /* 0x1.47f86d3002637000a */, +1.282870016078732078362 /* 0x1.486a2b5c13c00000e */, +1.284607945607987078432 /* 0x1.48dc10fa916bd0004 */, +1.286348229545787758022 /* 0x1.494e1e192aaa30007 */, +1.288090871080605159846 /* 0x1.49c052c5913df000c */, +1.289835873406902644341 /* 0x1.4a32af0d7d8090002 */, +1.291583239722392528754 /* 0x1.4aa532feab5e10002 */, +1.293332973229098792374 /* 0x1.4b17dea6db8010008 */, +1.295085077135345708087 /* 0x1.4b8ab213d57d9000d */, +1.296839554650994097442 /* 0x1.4bfdad53629e10003 */, +1.298596408992440220988 /* 0x1.4c70d0735358a000d */, +1.300355643380135983739 /* 0x1.4ce41b817c99e0001 */, +1.302117261036232376282 /* 0x1.4d578e8bb52cb0003 */, +1.303881265192249561154 /* 0x1.4dcb299fde2920008 */, +1.305647659079073541490 /* 0x1.4e3eeccbd7f4c0003 */, +1.307416445934474813521 /* 0x1.4eb2d81d8a86f000b */, +1.309187629001237640529 /* 0x1.4f26eba2e35a5000e */, +1.310961211525240921493 /* 0x1.4f9b2769d35090009 */, +1.312737196755087820678 /* 0x1.500f8b804e4a30000 */, +1.314515587949291131086 /* 0x1.508417f4530d00009 */, +1.316296388365203462468 /* 0x1.50f8ccd3df1840003 */, +1.318079601265708777911 /* 0x1.516daa2cf60020002 */, +1.319865229921343141607 /* 0x1.51e2b00da3c2b0007 */, +1.321653277603506371251 /* 0x1.5257de83f5512000d */, +1.323443747588034513690 /* 0x1.52cd359dfc7d5000e */, +1.325236643161341820781 /* 0x1.5342b569d6baa000f */, +1.327031967602244177939 /* 0x1.53b85df59921b0000 */, +1.328829724206201046165 /* 0x1.542e2f4f6b17e0006 */, +1.330629916266568235675 /* 0x1.54a4298571b27000e */, +1.332432547083447937938 /* 0x1.551a4ca5d97190009 */, +1.334237619959296017340 /* 0x1.559098bed16bf0008 */, +1.336045138203900251029 /* 0x1.56070dde90c800000 */, +1.337855105129210686631 /* 0x1.567dac13510cd0009 */, +1.339667524053662184301 /* 0x1.56f4736b52e2c000c */, +1.341482398296830025383 /* 0x1.576b63f4d8333000f */, +1.343299731186792467254 /* 0x1.57e27dbe2c40e0003 */, +1.345119526053918823702 /* 0x1.5859c0d59cd37000f */, +1.346941786233264881662 /* 0x1.58d12d497cd9a0005 */, +1.348766515064854010261 /* 0x1.5948c32824b87000c */, +1.350593715891792223641 /* 0x1.59c0827ff03890007 */, +1.352423392064920459908 /* 0x1.5a386b5f43a3e0006 */, +1.354255546937278120764 /* 0x1.5ab07dd485af1000c */, +1.356090183865519494030 /* 0x1.5b28b9ee21085000f */, +1.357927306213322804534 /* 0x1.5ba11fba8816e000b */, +1.359766917346459269620 /* 0x1.5c19af482f8f2000f */, +1.361609020638567812980 /* 0x1.5c9268a594cc00004 */, +1.363453619463660171403 /* 0x1.5d0b4be135916000c */, +1.365300717204201985683 /* 0x1.5d84590998eeb0005 */, +1.367150317245710233754 /* 0x1.5dfd902d494e40001 */, +1.369002422974674892971 /* 0x1.5e76f15ad22c40008 */, +1.370857037789471544224 /* 0x1.5ef07ca0cc166000b */, +1.372714165088220639199 /* 0x1.5f6a320dcf5280006 */, +1.374573808273481745378 /* 0x1.5fe411b0790800009 */, +1.376435970755022220096 /* 0x1.605e1b976e4b1000e */, +1.378300655944092456600 /* 0x1.60d84fd155d15000e */, +1.380167867259843417228 /* 0x1.6152ae6cdf0030003 */, +1.382037608124419003675 /* 0x1.61cd3778bc879000d */, +1.383909881963391264069 /* 0x1.6247eb03a4dc40009 */, +1.385784692209972801544 /* 0x1.62c2c91c56d9b0002 */, +1.387662042298923203992 /* 0x1.633dd1d1930ec0001 */, +1.389541935670444372533 /* 0x1.63b90532200630004 */, +1.391424375772021271329 /* 0x1.6434634ccc4cc0007 */, +1.393309366052102982208 /* 0x1.64afec30677e90008 */, +1.395196909966106124701 /* 0x1.652b9febc8e0f000d */, +1.397087010973788290271 /* 0x1.65a77e8dcc7f10004 */, +1.398979672539331309267 /* 0x1.66238825534170000 */, +1.400874898129892187656 /* 0x1.669fbcc1415600008 */, +1.402772691220124823310 /* 0x1.671c1c708328e000a */, +1.404673055288671035301 /* 0x1.6798a7420988b000d */, +1.406575993818903302975 /* 0x1.68155d44ca77a000f */, +1.408481510297352468121 /* 0x1.68923e87bf70e000a */, +1.410389608216942924956 /* 0x1.690f4b19e8f74000c */, +1.412300291075172076232 /* 0x1.698c830a4c94c0008 */ +}; +#define S (1.0/4503599627370496.0) /* 2^-52 */ +static const float exp2_deltatable[512] = { + 11527*S, -963*S, 884*S, -781*S, -2363*S, -3441*S, 123*S, 526*S, + -6*S, 1254*S, -1138*S, 1519*S, 1576*S, -65*S, 1040*S, 793*S, + -1662*S, -5063*S, -387*S, 968*S, -941*S, 984*S, -2856*S, -545*S, + 495*S, -5246*S, -2109*S, 1281*S, 2075*S, 909*S, -1642*S,-78233*S, +-31653*S, -265*S, 130*S, 430*S, 2482*S, -742*S, 1616*S, -2213*S, + -519*S, 20*S, -3134*S,-13981*S, 1343*S, -1740*S, 247*S, 1679*S, + -1097*S, 3131*S, 871*S, -1480*S, 1936*S, -1827*S, 17325*S, 528*S, + -322*S, 1404*S, -152*S, -1845*S, -212*S, 2639*S, -476*S, 2960*S, + -962*S, -1012*S, -1231*S, 3030*S, 1659*S, -486*S, 2154*S, 1728*S, + -2793*S, 699*S, -1560*S, -2125*S, 2156*S, 142*S, -1888*S, 4426*S, +-13443*S, 1970*S, -50*S, 1771*S,-43399*S, 4979*S, -2448*S, -370*S, + 1414*S, 1075*S, 232*S, 206*S, 873*S, 2141*S, 2970*S, 1279*S, + -2331*S, 336*S, -2595*S, 753*S, -3384*S, -616*S, 89*S, -818*S, + 5755*S, -241*S, -528*S, -661*S, -3777*S, -354*S, 250*S, 3881*S, + 2632*S, -2131*S, 2565*S, -316*S, 1746*S, -2541*S, -1324*S, -50*S, + 2564*S, -782*S, 1176*S, 6452*S, -1002*S, 1288*S, 336*S, -185*S, + 3063*S, 3784*S, 2169*S, 686*S, 328*S, -400*S, 312*S, -4517*S, + -1457*S, 1046*S, -1530*S, -685*S, 1328*S,-49815*S, -895*S, 1063*S, + -2091*S, -672*S, -1710*S, -665*S, 1545*S, 1819*S,-45265*S, 3548*S, + -554*S, -568*S, 4752*S, -1907*S,-13738*S, 675*S, 9611*S, -1115*S, + -815*S, 408*S, -1281*S, -937*S,-16376*S, -4772*S, -1440*S, 992*S, + 788*S, 10364*S, -1602*S, -661*S, -1783*S, -265*S, -20*S, -3781*S, + -861*S, -345*S, -994*S, 1364*S, -5339*S, 1620*S, 9390*S, -1066*S, + -305*S, -170*S, 175*S, 2461*S, -490*S, -769*S, -1450*S, 3315*S, + 2418*S, -45*S, -852*S, -1295*S, -488*S, -96*S, 1142*S, -2639*S, + 7905*S, -9306*S, -3859*S, 760*S, 1057*S, -1570*S, 3977*S, 209*S, + -514*S, 7151*S, 1646*S, 627*S, 599*S, -774*S, -1468*S, 633*S, + -473*S, 851*S, 2406*S, 143*S, 74*S, 4260*S, 1177*S, -913*S, + 2670*S, -3298*S, -1662*S, -120*S, -3264*S, -2148*S, 410*S, 2078*S, + -2098*S, -926*S, 3580*S, -1289*S, 2450*S, -1158*S, 907*S, -590*S, + 986*S, 1801*S, 1145*S, -1677*S, 3455*S, 956*S, 710*S, 144*S, + 153*S, -255*S, -1898*S, 28102*S, 2748*S, 1194*S, -3009*S, 7076*S, + 0*S, -2720*S, 711*S, 1225*S, -3034*S, -473*S, 378*S, -1046*S, + 962*S, -2006*S, 4647*S, 3206*S, 1769*S, -2665*S, 1254*S, 2025*S, + -2430*S, 6193*S, 1224*S, -856*S, -1592*S, -325*S, -1521*S, 1827*S, + -264*S, 2403*S, -1065*S, 967*S, -681*S, -2106*S, -474*S, 1333*S, + -893*S, 2296*S, 592*S, -1220*S, -326*S, 990*S, 139*S, 206*S, + -779*S, -1683*S, 1238*S, 6098*S, 136*S, 1197*S, 790*S, -107*S, + -1004*S, -2449*S, 939*S, 5568*S, 156*S, 1812*S, 2792*S, -1094*S, + -2677*S, -251*S, 2297*S, 943*S, -1329*S, 2883*S, -853*S, -2626*S, +-105929*S, -6552*S, 1095*S, -1508*S, 1003*S, 5039*S, -2600*S, -749*S, + 1790*S, 890*S, 2016*S, -1073*S, 624*S, -2084*S, -1536*S, -1330*S, + 358*S, 2444*S, -179*S,-25759*S, -243*S, -552*S, -124*S, 3766*S, + 1192*S, -1614*S, 6*S, -1227*S, 345*S, -981*S, -295*S, -1006*S, + -995*S, -1195*S, 706*S, 2512*S, -1758*S, -734*S, -6286*S, -922*S, + 1530*S, 1542*S, 1223*S, 61*S, -83*S, 522*S,116937*S, -914*S, + -418*S, -7339*S, 249*S, -520*S, -762*S, 426*S, -505*S, 2664*S, + -1093*S, -1035*S, 2130*S, 4878*S, 1982*S, 1551*S, 2304*S, 193*S, + 1532*S, -7268*S, 24357*S, 531*S, 2676*S, -1170*S, 1465*S, -1917*S, + 2143*S, 1466*S, -7*S, -7300*S, 3297*S, -1197*S, -289*S, -1548*S, + 26226*S, 4401*S, 4123*S, -1588*S, 4243*S, 4069*S, -1276*S, -2010*S, + 1407*S, 1478*S, 488*S, -2366*S, -2909*S, -2534*S, -1285*S, 7095*S, + -645*S, -2089*S, -944*S, -40*S, -1363*S, -833*S, 917*S, 1609*S, + 1286*S, 1677*S, 1613*S, -2295*S, -1248*S, 40*S, 26*S, 2038*S, + 698*S, 2675*S, -1755*S, -3522*S, -1614*S, -6111*S, 270*S, 1822*S, + -234*S, -2844*S, -1201*S, -830*S, 1193*S, 2354*S, 47*S, 1522*S, + -78*S, -640*S, 2425*S, -1596*S, 1563*S, 1169*S, -1006*S, -83*S, + 2362*S, -3521*S, -314*S, 1814*S, -1751*S, 305*S, 1715*S, -3741*S, + 7847*S, 1291*S, 1206*S, 36*S, 1397*S, -1419*S, -1194*S, -2014*S, + 1742*S, -578*S, -207*S, 875*S, 1539*S, 2826*S, -1165*S, -909*S, + 1849*S, 927*S, 2018*S, -981*S, 1637*S, -463*S, 905*S, 6618*S, + 400*S, 630*S, 2614*S, 900*S, 2323*S, -1094*S, -1858*S, -212*S, + -2069*S, 747*S, 1845*S, -1450*S, 444*S, -213*S, -438*S, 1158*S, + 4738*S, 2497*S, -370*S, -2016*S, -518*S, -1160*S, -1510*S, 123*S +}; +/* Maximum magnitude in above table: 116937 */ +#undef S diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c new file mode 100644 index 0000000000..445c5788d2 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/w_exp.c @@ -0,0 +1,58 @@ +/* @(#)w_exp.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: w_exp.c,v 1.6 1995/05/10 20:48:51 jtc Exp $"; +#endif + +/* + * wrapper exp(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ +u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ + +#ifdef __STDC__ + double __exp(double x) /* wrapper exp */ +#else + double __exp(x) /* wrapper exp */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp(x); +#else + double z; + z = __ieee754_exp(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finite(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,6); /* exp overflow */ + else if(x -#include -#include - -/* Convert a `double' in IEEE754 standard double-precision format to a - multi-precision integer representing the significand scaled up by its - number of bits (52 for double) and an integral power of two (MPN frexp). */ - -mp_size_t -__mpn_extract_double (mp_ptr res_ptr, mp_size_t size, - int *expt, int *is_neg, - double value) -{ - union ieee754_double u; - u.d = value; - - *is_neg = u.ieee.negative; - *expt = (int) u.ieee.exponent - IEEE754_DOUBLE_BIAS; - -#if BITS_PER_MP_LIMB == 32 - res_ptr[0] = u.ieee.mantissa1; /* Low-order 32 bits of fraction. */ - res_ptr[1] = u.ieee.mantissa0; /* High-order 20 bits. */ - #define N 2 -#elif BITS_PER_MP_LIMB == 64 - /* Hopefully the compiler will combine the two bitfield extracts - and this composition into just the original quadword extract. */ - res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; - #define N 1 -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif -/* The format does not fill the last limb. There are some zeros. */ -#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \ - - (DBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB))) - - if (u.ieee.exponent == 0) - { - /* A biased exponent of zero is a special case. - Either it is a zero or it is a denormal number. */ - if (res_ptr[0] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=2. */ - /* It's zero. */ - *expt = 0; - else - { - /* It is a denormal number, meaning it has no implicit leading - one bit, and its exponent is in fact the format minimum. */ - int cnt; - - if (res_ptr[N - 1] != 0) - { - count_leading_zeros (cnt, res_ptr[N - 1]); - cnt -= NUM_LEADING_ZEROS; -#if N == 2 - res_ptr[N - 1] = res_ptr[1] << cnt - | (N - 1) - * (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt)); - res_ptr[0] <<= cnt; -#else - res_ptr[N - 1] <<= cnt; -#endif - *expt = DBL_MIN_EXP - 1 - cnt; - } - else - { - count_leading_zeros (cnt, res_ptr[0]); - if (cnt >= NUM_LEADING_ZEROS) - { - res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS); - res_ptr[0] = 0; - } - else - { - res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt); - res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt); - } - *expt = DBL_MIN_EXP - 1 - - (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt; - } - } - } - else - /* Add the implicit leading one bit for a normalized number. */ - res_ptr[N - 1] |= 1L << (DBL_MANT_DIG - 1 - ((N - 1) * BITS_PER_MP_LIMB)); - - return N; -} diff --git a/sysdeps/ieee754/flt-32/Dist b/sysdeps/ieee754/flt-32/Dist new file mode 100644 index 0000000000..045ac801f6 --- /dev/null +++ b/sysdeps/ieee754/flt-32/Dist @@ -0,0 +1 @@ +t_exp2f.h diff --git a/sysdeps/ieee754/flt-32/e_acosf.c b/sysdeps/ieee754/flt-32/e_acosf.c new file mode 100644 index 0000000000..0d85c4210d --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_acosf.c @@ -0,0 +1,89 @@ +/* e_acosf.c -- float version of e_acos.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 +one = 1.0000000000e+00, /* 0x3F800000 */ +pi = 3.1415925026e+00, /* 0x40490fda */ +pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ +pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ +pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ +pS1 = -3.2556581497e-01, /* 0xbea6b090 */ +pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ +pS3 = -4.0055535734e-02, /* 0xbd241146 */ +pS4 = 7.9153501429e-04, /* 0x3a4f7f04 */ +pS5 = 3.4793309169e-05, /* 0x3811ef08 */ +qS1 = -2.4033949375e+00, /* 0xc019d139 */ +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 z,p,q,r,w,s,c,df; + int32_t hx,ix; + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix==0x3f800000) { /* |x|==1 */ + if(hx>0) return 0.0; /* acos(1) = 0 */ + else return pi+(float)2.0*pio2_lo; /* acos(-1)= pi */ + } else if(ix>0x3f800000) { /* |x| >= 1 */ + return (x-x)/(x-x); /* acos(|x|>1) is NaN */ + } + if(ix<0x3f000000) { /* |x| < 0.5 */ + if(ix<=0x23000000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ + z = x*x; + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); + r = p/q; + return pio2_hi - (x - (pio2_lo-x*r)); + } else if (hx<0) { /* x < -0.5 */ + z = (one+x)*(float)0.5; + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); + s = __ieee754_sqrtf(z); + r = p/q; + w = r*s-pio2_lo; + return pi - (float)2.0*(s+w); + } else { /* x > 0.5 */ + int32_t idf; + z = (one-x)*(float)0.5; + s = __ieee754_sqrtf(z); + df = s; + GET_FLOAT_WORD(idf,df); + SET_FLOAT_WORD(df,idf&0xfffff000); + c = (z-df*df)/(s+df); + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); + r = p/q; + w = r*s+c; + return (float)2.0*(df+w); + } +} diff --git a/sysdeps/ieee754/flt-32/e_acoshf.c b/sysdeps/ieee754/flt-32/e_acoshf.c new file mode 100644 index 0000000000..c607f72117 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_acoshf.c @@ -0,0 +1,57 @@ +/* e_acoshf.c -- float version of e_acosh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_acoshf.c,v 1.5 1995/05/12 04:57:20 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +one = 1.0, +ln2 = 6.9314718246e-01; /* 0x3f317218 */ + +#ifdef __STDC__ + float __ieee754_acoshf(float x) +#else + float __ieee754_acoshf(x) + float x; +#endif +{ + float t; + int32_t hx; + GET_FLOAT_WORD(hx,x); + if(hx<0x3f800000) { /* x < 1 */ + 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 __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */ + } else if (hx==0x3f800000) { + return 0.0; /* acosh(1) = 0 */ + } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ + t=x*x; + return __ieee754_logf((float)2.0*x-one/(x+__ieee754_sqrtf(t-one))); + } else { /* 1 0x3f800000) { /* |x|>= 1 */ + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + } else if (ix<0x3f000000) { /* |x|<0.5 */ + if(ix<0x32000000) { /* if |x| < 2**-27 */ + if(huge+x>one) return x;/* return x with inexact if x!=0*/ + } else { + t = x*x; + p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); + q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); + w = p/q; + return x+x*w; + } + } + /* 1> |x|>= 0.5 */ + w = one-fabsf(x); + t = w*(float)0.5; + p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); + q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); + s = __ieee754_sqrtf(t); + if(ix>=0x3F79999A) { /* if |x| > 0.975 */ + w = p/q; + t = pio2_hi-((float)2.0*(s+s*w)-pio2_lo); + } else { + int32_t iw; + w = s; + GET_FLOAT_WORD(iw,w); + SET_FLOAT_WORD(w,iw&0xfffff000); + c = (t-w*w)/(s+w); + r = p/q; + p = (float)2.0*s*r-(pio2_lo-(float)2.0*c); + q = pio4_hi-(float)2.0*w; + t = pio4_hi-(p-q); + } + if(hx>0) return t; else return -t; +} diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c new file mode 100644 index 0000000000..8b3398c0a3 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_atan2f.c @@ -0,0 +1,105 @@ +/* e_atan2f.c -- float version of e_atan2.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 */ +pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ +pi = 3.1415927410e+00, /* 0x40490fdb */ +pi_lo = -8.7422776573e-07; /* 0xb3bbbd2e */ + +#ifdef __STDC__ + float __ieee754_atan2f(float y, float x) +#else + float __ieee754_atan2f(y,x) + float y,x; +#endif +{ + float z; + int32_t k,m,hx,hy,ix,iy; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + GET_FLOAT_WORD(hy,y); + iy = hy&0x7fffffff; + if((ix>0x7f800000)|| + (iy>0x7f800000)) /* x or y is NaN */ + return x+y; + if(hx==0x3f800000) return __atanf(y); /* x=1.0 */ + m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if(iy==0) { + switch(m) { + case 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 */ + } + } + /* when x = 0 */ + if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* when x is INF */ + if(ix==0x7f800000) { + if(iy==0x7f800000) { + switch(m) { + case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ + case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ + case 2: return (float)3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return (float)-3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ + } + } else { + switch(m) { + case 0: return zero ; /* atan(+...,+INF) */ + case 1: return -zero ; /* atan(-...,+INF) */ + case 2: return pi+tiny ; /* atan(+...,-INF) */ + case 3: return -pi-tiny ; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if(iy==0x7f800000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* 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 */ + else z=__atanf(fabsf(y/x)); /* safe to do y/x */ + switch (m) { + case 0: return z ; /* atan(+,+) */ + case 1: { + 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(-,-) */ + } +} diff --git a/sysdeps/ieee754/flt-32/e_atanhf.c b/sysdeps/ieee754/flt-32/e_atanhf.c new file mode 100644 index 0000000000..f26a15bbc1 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_atanhf.c @@ -0,0 +1,58 @@ +/* e_atanhf.c -- float version of e_atanh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + +#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 +{ + 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; +} diff --git a/sysdeps/ieee754/flt-32/e_coshf.c b/sysdeps/ieee754/flt-32/e_coshf.c new file mode 100644 index 0000000000..223fbeea20 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_coshf.c @@ -0,0 +1,72 @@ +/* e_coshf.c -- float version of e_cosh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 t,w; + int32_t ix; + + 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; */ + if (ix < 0x41b00000) { + t = __ieee754_expf(fabsf(x)); + return half*t+half/t; + } + + /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ + if (ix < 0x42b17180) return half*__ieee754_expf(fabsf(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + if (ix<=0x42b2d4fc) { + w = __ieee754_expf(half*fabsf(x)); + t = half*w; + return t*w; + } + + /* |x| > overflowthresold, cosh(x) overflow */ + return huge*huge; +} diff --git a/sysdeps/ieee754/flt-32/e_expf.c b/sysdeps/ieee754/flt-32/e_expf.c new file mode 100644 index 0000000000..e8a9c9d874 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_expf.c @@ -0,0 +1,140 @@ +/* Single-precision floating point e^x. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* How this works: + + The input value, x, is written as + + x = n * ln(2) + t/512 + delta[t] + x; + + where: + - n is an integer, 127 >= n >= -150; + - t is an integer, 177 >= t >= -177 + - delta is based on a table entry, delta[t] < 2^-28 + - x is whatever is left, |x| < 2^-10 + + Then e^x is approximated as + + e^x = 2^n ( e^(t/512 + delta[t]) + + ( e^(t/512 + delta[t]) + * ( p(x + delta[t] + n * ln(2)) - delta ) ) ) + + where + - p(x) is a polynomial approximating e(x)-1; + - e^(t/512 + delta[t]) is obtained from a table. + + The table used is the same one as for the double precision version; + since we have the table, we might as well use it. + + It turns out to be faster to do calculations in double precision than + to perform an 'accurate table method' expf, because of the range reduction + overhead (compare exp2f). + */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include + +extern const float __exp_deltatable[178]; +extern const double __exp_atable[355] /* __attribute__((mode(DF))) */; + +static const volatile float TWOM100 = 7.88860905e-31; +static const volatile float TWO127 = 1.7014118346e+38; + +float +__ieee754_expf (float x) +{ + static const float himark = 88.72283935546875; + static const float lomark = -103.972084045410; + /* Check for usual case. */ + if (isless (x, himark) && isgreater (x, lomark)) + { + static const float THREEp42 = 13194139533312.0; + static const float THREEp22 = 12582912.0; + /* 1/ln(2). */ +#undef M_1_LN2 + static const float M_1_LN2 = 1.44269502163f; + /* ln(2) */ +#undef M_LN2 + static const double M_LN2 = .6931471805599452862; + + int tval; + double x22, t, result, dx; + float n, delta; + union ieee754_double ex2_u; + fenv_t oldenv; + + feholdexcept (&oldenv); +#ifdef FE_TONEAREST + fesetround (FE_TONEAREST); +#endif + + /* Calculate n. */ + n = x * M_1_LN2 + THREEp22; + n -= THREEp22; + dx = x - n*M_LN2; + + /* Calculate t/512. */ + t = dx + THREEp42; + t -= THREEp42; + dx -= t; + + /* Compute tval = t. */ + tval = (int) (t * 512.0); + + if (t >= 0) + delta = - __exp_deltatable[tval]; + else + delta = __exp_deltatable[-tval]; + + /* Compute ex2 = 2^n e^(t/512+delta[t]). */ + ex2_u.d = __exp_atable[tval+177]; + ex2_u.ieee.exponent += (int) n; + + /* Approximate e^(dx+delta) - 1, using a second-degree polynomial, + with maximum error in [-2^-10-2^-28,2^-10+2^-28] + less than 5e-11. */ + x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; + + /* Return result. */ + fesetenv (&oldenv); + + result = x22 * ex2_u.d + ex2_u.d; + return (float) result; + } + /* Exceptional cases: */ + else if (isless (x, himark)) + { + if (__isinff (x)) + /* e^-inf == 0, with no error. */ + return 0; + else + /* Underflow */ + return TWOM100 * TWOM100; + } + else + /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ + return TWO127*x; +} diff --git a/sysdeps/ieee754/flt-32/e_fmodf.c b/sysdeps/ieee754/flt-32/e_fmodf.c new file mode 100644 index 0000000000..47b312392c --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_fmodf.c @@ -0,0 +1,113 @@ +/* e_fmodf.c -- float version of e_fmod.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 + */ + +#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 +{ + int32_t n,hx,hy,hz,ix,iy,sx,i; + + GET_FLOAT_WORD(hx,x); + GET_FLOAT_WORD(hy,y); + sx = hx&0x80000000; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if(hy==0||(hx>=0x7f800000)|| /* y=0,or x not finite */ + (hy>0x7f800000)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx>31]; /* |x|=|y| return x*0*/ + + /* determine ix = ilogb(x) */ + if(hx<0x00800000) { /* subnormal x */ + for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1; + } else ix = (hx>>23)-127; + + /* determine iy = ilogb(y) */ + if(hy<0x00800000) { /* subnormal y */ + for (iy = -126,i=(hy<<8); i>=0; i<<=1) iy -=1; + } else iy = (hy>>23)-127; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -126) + hx = 0x00800000|(0x007fffff&hx); + else { /* subnormal x, shift x to normal */ + n = -126-ix; + hx = hx<= -126) + hy = 0x00800000|(0x007fffff&hy); + else { /* subnormal y, shift y to normal */ + n = -126-iy; + hy = hy<>31]; + 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]; + while(hx<0x00800000) { /* normalize x */ + hx = hx+hx; + iy -= 1; + } + if(iy>= -126) { /* normalize output */ + hx = ((hx-0x00800000)|((iy+127)<<23)); + SET_FLOAT_WORD(x,hx|sx); + } else { /* subnormal output */ + n = -126 - iy; + hx >>= n; + SET_FLOAT_WORD(x,hx|sx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c new file mode 100644 index 0000000000..926905e7cd --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c @@ -0,0 +1,50 @@ +/* Implementation of gamma function according to ISO C. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +float +__ieee754_gammaf_r (float x, int *signgamp) +{ + /* We don't have a real gamma implementation now. We'll use lgamma + and the exp function. But due to the required boundary + conditions we must check some values separately. */ + int32_t hx; + + GET_FLOAT_WORD (hx, x); + + if ((hx & 0x7fffffff) == 0) + { + /* Return value for x == 0 is NaN with invalid exception. */ + *signgamp = 0; + return x / x; + } + if (hx < 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); + } + + /* XXX FIXME. */ + return __ieee754_expf (__ieee754_lgammaf_r (x, signgamp)); +} diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c new file mode 100644 index 0000000000..d6b1520cb8 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_hypotf.c @@ -0,0 +1,87 @@ +/* e_hypotf.c -- float version of e_hypot.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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_hypot(x,y) + float x, y; +#endif +{ + float a,b,t1,t2,y1,y2,w; + int32_t j,k,ha,hb; + + GET_FLOAT_WORD(ha,x); + ha &= 0x7fffffff; + GET_FLOAT_WORD(hb,y); + hb &= 0x7fffffff; + if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} + SET_FLOAT_WORD(a,ha); /* a <- |a| */ + 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(ha >= 0x7f800000) { /* Inf or NaN */ + w = a+b; /* for sNaN */ + if(ha == 0x7f800000) w = a; + if(hb == 0x7f800000) w = b; + return w; + } + /* scale a and b by 2**-60 */ + ha -= 0x5d800000; hb -= 0x5d800000; k += 60; + SET_FLOAT_WORD(a,ha); + SET_FLOAT_WORD(b,hb); + } + if(hb < 0x26800000) { /* b < 2**-50 */ + if(hb <= 0x007fffff) { /* subnormal b or 0 */ + if(hb==0) return a; + SET_FLOAT_WORD(t1,0x3f000000); /* t1=2^126 */ + b *= t1; + a *= t1; + k -= 126; + } else { /* scale a and b by 2^60 */ + ha += 0x5d800000; /* a *= 2^60 */ + hb += 0x5d800000; /* b *= 2^60 */ + k -= 60; + SET_FLOAT_WORD(a,ha); + SET_FLOAT_WORD(b,hb); + } + } + /* medium size a and b */ + w = a-b; + if (w>b) { + SET_FLOAT_WORD(t1,ha&0xfffff000); + t2 = a-t1; + w = __ieee754_sqrtf(t1*t1-(b*(-b)-t2*(a+t1))); + } else { + a = a+a; + SET_FLOAT_WORD(y1,hb&0xfffff000); + y2 = b - y1; + SET_FLOAT_WORD(t1,ha+0x00800000); + t2 = a - t1; + w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); + } + if(k!=0) { + SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + return t1*w; + } else return w; +} diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c new file mode 100644 index 0000000000..eed171cc90 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_j0f.c @@ -0,0 +1,444 @@ +/* e_j0f.c -- float version of e_j0.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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, +one = 1.0, +invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ +tpi = 6.3661974669e-01, /* 0x3f22f983 */ + /* R0/S0 on [0, 2.00] */ +R02 = 1.5625000000e-02, /* 0x3c800000 */ +R03 = -1.8997929874e-04, /* 0xb947352e */ +R04 = 1.8295404516e-06, /* 0x35f58e88 */ +R05 = -4.6183270541e-09, /* 0xb19eaf3c */ +S01 = 1.5619102865e-02, /* 0x3c7fe744 */ +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 z, s,c,ss,cc,r,u,v; + int32_t hx,ix; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7f800000) return one/(x*x); + x = fabsf(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = __sinf(x); + c = __cosf(x); + ss = s-c; + cc = s+c; + if(ix<0x7f000000) { /* make sure x+x not overflow */ + z = -__cosf(x+x); + if ((s*c)0x48000000) z = (invsqrtpi*cc)/__sqrtf(x); + else { + u = pzerof(x); v = qzerof(x); + z = invsqrtpi*(u*cc-v*ss)/__sqrtf(x); + } + return z; + } + 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; + } + } + z = x*x; + r = z*(R02+z*(R03+z*(R04+z*R05))); + s = one+z*(S01+z*(S02+z*(S03+z*S04))); + if(ix < 0x3F800000) { /* |x| < 1.00 */ + return one + z*((float)-0.25+(r/s)); + } else { + u = (float)0.5*x; + return((one+u)*(one-u)+z*(r/s)); + } +} + +#ifdef __STDC__ +static const float +#else +static float +#endif +u00 = -7.3804296553e-02, /* 0xbd9726b5 */ +u01 = 1.7666645348e-01, /* 0x3e34e80d */ +u02 = -1.3818567619e-02, /* 0xbc626746 */ +u03 = 3.4745343146e-04, /* 0x39b62a69 */ +u04 = -3.8140706238e-06, /* 0xb67ff53c */ +u05 = 1.9559013964e-08, /* 0x32a802ba */ +u06 = -3.9820518410e-11, /* 0xae2f21eb */ +v01 = 1.2730483897e-02, /* 0x3c509385 */ +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 z, s,c,ss,cc,u,v; + int32_t hx,ix; + + GET_FLOAT_WORD(hx,x); + ix = 0x7fffffff&hx; + /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ + if(ix>=0x7f800000) return one/(x+x*x); + if(ix==0) return -one/zero; + if(hx<0) return zero/zero; + 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. + */ + s = __sinf(x); + c = __cosf(x); + 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)0x48000000) z = (invsqrtpi*ss)/__sqrtf(x); + else { + u = pzerof(x); v = qzerof(x); + z = invsqrtpi*(u*ss+v*cc)/__sqrtf(x); + } + return z; + } + if(ix<=0x32000000) { /* x < 2**-27 */ + return(u00 + tpi*__ieee754_logf(x)); + } + z = x*x; + u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); + v = one+z*(v01+z*(v02+z*(v03+z*v04))); + return(u/v + tpi*(__ieee754_j0f(x)*__ieee754_logf(x))); +} + +/* 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) + * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*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 */ + -2.5706311035e+02, /* 0xc3808814 */ + -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 */ + -6.7674766541e+01, /* 0xc287597b */ + -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 */ + 9.6254453125e+03, /* 0x461665c8 */ + 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 */ + -2.1965976715e+01, /* 0xc1afba52 */ + -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 */ + 1.1279968262e+03, /* 0x448cffe6 */ + 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 */ + -7.6356959343e+00, /* 0xc0f4579f */ + -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 */ + 1.5387539673e+02, /* 0x4319e01a */ + 1.4657617569e+01, /* 0x416a859a */ +}; + +#ifdef __STDC__ + static float pzerof(float x) +#else + static float pzerof(x) + float x; +#endif +{ +#ifdef __STDC__ + const float *p,*q; +#else + float *p,*q; +#endif + float z,r,s; + 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; +} + + +/* 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)) + * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 + * 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 */ + 5.5767340088e+02, /* 0x440b6b19 */ + 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 */ + 8.0330925000e+05, /* 0x49441ed4 */ + 8.4050156250e+05, /* 0x494d3359 */ + -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 */ + 1.3511157227e+02, /* 0x43071c90 */ + 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 */ + 5.6751113281e+04, /* 0x475daf1d */ + 3.5976753906e+04, /* 0x470c88c1 */ + -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 */ + 4.2621845245e+01, /* 0x422a7cc5 */ + 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 */ + 6.4604252930e+03, /* 0x45c9e367 */ + 2.5163337402e+03, /* 0x451d4557 */ + -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 */ + 1.4495602608e+01, /* 0x4167edfd */ + 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 */ + 8.8293585205e+02, /* 0x445cbbe5 */ + 2.1266638184e+02, /* 0x4354aa98 */ + -5.3109550476e+00, /* 0xc0a9f358 */ +}; + +#ifdef __STDC__ + static float qzerof(float x) +#else + static float qzerof(x) + float x; +#endif +{ +#ifdef __STDC__ + const float *p,*q; +#else + float *p,*q; +#endif + float s,r,z; + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + if(ix>=0x41000000) {p = qR8; q= qS8;} + else if(ix>=0x40f71c58){p = qR5; q= qS5;} + else if(ix>=0x4036db68){p = qR3; q= qS3;} + else if(ix>=0x40000000){p = qR2; q= qS2;} + 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]+z*q[5]))))); + return (-(float).125 + r/s)/x; +} diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c new file mode 100644 index 0000000000..e6f14a16ac --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_j1f.c @@ -0,0 +1,444 @@ +/* e_j1f.c -- float version of e_j1.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 */ +tpi = 6.3661974669e-01, /* 0x3f22f983 */ + /* R0/S0 on [0,2] */ +r00 = -6.2500000000e-02, /* 0xbd800000 */ +r01 = 1.4070566976e-03, /* 0x3ab86cfd */ +r02 = -1.5995563444e-05, /* 0xb7862e36 */ +r03 = 4.9672799207e-08, /* 0x335557d2 */ +s01 = 1.9153760746e-02, /* 0x3c9ce859 */ +s02 = 1.8594678841e-04, /* 0x3942fab6 */ +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 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; + y = fabsf(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = __sinf(y); + c = __cosf(y); + ss = -s-c; + cc = s-c; + if(ix<0x7f000000) { /* make sure y+y not overflow */ + z = __cosf(y+y); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* + * 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>0x48000000) z = (invsqrtpi*cc)/__sqrtf(y); + else { + u = ponef(y); v = qonef(y); + z = invsqrtpi*(u*cc-v*ss)/__sqrtf(y); + } + if(hx<0) return -z; + else return z; + } + if(ix<0x32000000) { /* |x|<2**-27 */ + if(huge+x>one) return (float)0.5*x;/* inexact if x!=0 necessary */ + } + z = x*x; + r = z*(r00+z*(r01+z*(r02+z*r03))); + s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); + r *= x; + return(x*(float)0.5+r/s); +} + +#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 */ + 6.2274145840e-09, /* 0x31d5f8eb */ + 1.6655924903e-11, /* 0x2d9281cf */ +}; + +#ifdef __STDC__ + float __ieee754_y1f(float x) +#else + float __ieee754_y1f(x) + float x; +#endif +{ + float z, s,c,ss,cc,u,v; + int32_t hx,ix; + + GET_FLOAT_WORD(hx,x); + 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 -one/zero; + if(hx<0) return zero/zero; + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + s = __sinf(x); + c = __cosf(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)/__sqrtf(x); + else { + u = ponef(x); v = qonef(x); + z = invsqrtpi*(u*ss+v*cc)/__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)); +} + +/* 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) + * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*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 */ + 4.1205184937e+02, /* 0x43ce06a3 */ + 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 */ + 9.7602796875e+04, /* 0x47bea166 */ + 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 */ + 1.0830818176e+02, /* 0x42d89dca */ + 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 */ + 7.8446904297e+03, /* 0x45f52586 */ + 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 */ + 3.5119403839e+01, /* 0x420c7a45 */ + 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 */ + 8.9081134033e+02, /* 0x445eb3ed */ + 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 */ + 1.2242610931e+01, /* 0x4143e1bc */ + 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 */ + 1.1767937469e+02, /* 0x42eb5bd7 */ + 8.3646392822e+00, /* 0x4105d590 */ +}; + +#ifdef __STDC__ + static float ponef(float x) +#else + static float ponef(x) + float x; +#endif +{ +#ifdef __STDC__ + const float *p,*q; +#else + float *p,*q; +#endif + float z,r,s; + 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; +} + + +/* 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)) + * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 + * 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 */ + -7.5960174561e+02, /* 0xc43de683 */ + -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 */ + 7.1965775000e+05, /* 0x492fb29c */ + 6.6660125000e+05, /* 0x4922be94 */ + -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 */ + -1.8366960144e+02, /* 0xc337ab6b */ + -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 */ + 4.9851425781e+04, /* 0x4742bb6d */ + 2.7948074219e+04, /* 0x46da5826 */ + -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 */ + -5.7847221375e+01, /* 0xc267638e */ + -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 */ + 5.5477290039e+03, /* 0x45ad5dd5 */ + 1.9031191406e+03, /* 0x44ede3d0 */ + -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 */ + -1.9663616180e+01, /* 0xc19d4f16 */ + -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 */ + 7.3939318848e+02, /* 0x4438d92a */ + 1.5594900513e+02, /* 0x431bf2f2 */ + -4.9594988823e+00, /* 0xc09eb437 */ +}; + +#ifdef __STDC__ + static float qonef(float x) +#else + static float qonef(x) + float x; +#endif +{ +#ifdef __STDC__ + const float *p,*q; +#else + float *p,*q; +#endif + float s,r,z; + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = qr8; q= qs8;} + else if(ix>=0x40f71c58){p = qr5; q= qs5;} + else if(ix>=0x4036db68){p = qr3; q= qs3;} + else if(ix>=0x40000000){p = qr2; q= qs2;} + 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]+z*q[5]))))); + return ((float).375 + r/s)/x; +} diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c new file mode 100644 index 0000000000..9e5279c30a --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_jnf.c @@ -0,0 +1,213 @@ +/* e_jnf.c -- float version of e_jn.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 +invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ +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 +{ + int32_t i,hx,ix, sgn; + float a, b, temp, di; + float z, w; + + /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) + * Thus, J(-n,x) = J(n,-x) + */ + GET_FLOAT_WORD(hx,x); + ix = 0x7fffffff&hx; + /* if J(n,NaN) is NaN */ + if(ix>0x7f800000) return x+x; + if(n<0){ + n = -n; + x = -x; + hx ^= 0x80000000; + } + if(n==0) return(__ieee754_j0f(x)); + 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 */ + b = zero; + else if((float)n<=x) { + /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ + a = __ieee754_j0f(x); + b = __ieee754_j1f(x); + for(i=1;i33) /* underflow */ + b = zero; + else { + temp = x*(float)0.5; b = temp; + for (a=one,i=2;i<=n;i++) { + a *= (float)i; /* a = n! */ + b *= temp; /* b = (x/2)^n */ + } + b = b/a; + } + } else { + /* use backward recurrence */ + /* x x^2 x^2 + * J(n,x)/J(n-1,x) = ---- ------ ------ ..... + * 2n - 2(n+1) - 2(n+2) + * + * 1 1 1 + * (for large x) = ---- ------ ------ ..... + * 2n 2(n+1) 2(n+2) + * -- - ------ - ------ - + * x x x + * + * Let w = 2n/x and h=2/x, then the above quotient + * is equal to the continued fraction: + * 1 + * = ----------------------- + * 1 + * w - ----------------- + * 1 + * w+h - --------- + * w+2h - ... + * + * To determine how many terms needed, let + * Q(0) = w, Q(1) = w(w+h) - 1, + * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple + */ + /* determine k */ + float t,v; + float q0,q1,h,tmp; int32_t k,m; + w = (n+n)/(float)x; h = (float)2.0/(float)x; + q0 = w; z = w+h; q1 = w*z - (float)1.0; k=1; + while(q1<(float)1.0e9) { + k += 1; z += h; + tmp = z*q1 - q0; + q0 = q1; + q1 = tmp; + } + m = n+n; + for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t); + a = t; + b = one; + /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) + * Hence, if n*(log(2n/x)) > ... + * single 8.8722839355e+01 + * double 7.09782712893383973096e+02 + * long double 1.1356523406294143949491931077970765006170e+04 + * then recurrent value may overflow and the result is + * likely underflow to zero + */ + tmp = n; + v = two/x; + 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; + b *= di; + b = b/x - a; + a = temp; + di -= two; + } + } else { + for(i=n-1,di=(float)(i+i);i>0;i--){ + temp = b; + b *= di; + b = b/x - a; + a = temp; + di -= two; + /* scale b to avoid spurious overflow */ + if(b>(float)1e10) { + a /= b; + t /= b; + b = one; + } + } + } + b = (t*__ieee754_j0f(x)/b); + } + } + if(sgn==1) return -b; else return b; +} + +#ifdef __STDC__ + float __ieee754_ynf(int n, float x) +#else + float __ieee754_ynf(n,x) + int n; float x; +#endif +{ + int32_t i,hx,ix; + u_int32_t ib; + int32_t sign; + float a, b, temp; + + GET_FLOAT_WORD(hx,x); + ix = 0x7fffffff&hx; + /* if Y(n,NaN) is NaN */ + if(ix>0x7f800000) return x+x; + if(ix==0) return -one/zero; + if(hx<0) return zero/zero; + sign = 1; + if(n<0){ + n = -n; + sign = 1 - ((n&1)<<1); + } + if(n==0) return(__ieee754_y0f(x)); + if(n==1) return(sign*__ieee754_y1f(x)); + if(ix==0x7f800000) return zero; + + a = __ieee754_y0f(x); + b = __ieee754_y1f(x); + /* quit if b is -inf */ + GET_FLOAT_WORD(ib,b); + for(i=1;i0) return b; else return -b; +} diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c new file mode 100644 index 0000000000..f744d5320e --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c @@ -0,0 +1,250 @@ +/* e_lgammaf_r.c -- float version of e_lgamma_r.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 */ +pi = 3.1415927410e+00, /* 0x40490fdb */ +a0 = 7.7215664089e-02, /* 0x3d9e233f */ +a1 = 3.2246702909e-01, /* 0x3ea51a66 */ +a2 = 6.7352302372e-02, /* 0x3d89f001 */ +a3 = 2.0580807701e-02, /* 0x3ca89915 */ +a4 = 7.3855509982e-03, /* 0x3bf2027e */ +a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */ +a6 = 1.1927076848e-03, /* 0x3a9c54a1 */ +a7 = 5.1006977446e-04, /* 0x3a05b634 */ +a8 = 2.2086278477e-04, /* 0x39679767 */ +a9 = 1.0801156895e-04, /* 0x38e28445 */ +a10 = 2.5214456400e-05, /* 0x37d383a2 */ +a11 = 4.4864096708e-05, /* 0x383c2c75 */ +tc = 1.4616321325e+00, /* 0x3fbb16c3 */ +tf = -1.2148628384e-01, /* 0xbdf8cdcd */ +/* tt = -(tail of tf) */ +tt = 6.6971006518e-09, /* 0x31e61c52 */ +t0 = 4.8383611441e-01, /* 0x3ef7b95e */ +t1 = -1.4758771658e-01, /* 0xbe17213c */ +t2 = 6.4624942839e-02, /* 0x3d845a15 */ +t3 = -3.2788541168e-02, /* 0xbd064d47 */ +t4 = 1.7970675603e-02, /* 0x3c93373d */ +t5 = -1.0314224288e-02, /* 0xbc28fcfe */ +t6 = 6.1005386524e-03, /* 0x3bc7e707 */ +t7 = -3.6845202558e-03, /* 0xbb7177fe */ +t8 = 2.2596477065e-03, /* 0x3b141699 */ +t9 = -1.4034647029e-03, /* 0xbab7f476 */ +t10 = 8.8108185446e-04, /* 0x3a66f867 */ +t11 = -5.3859531181e-04, /* 0xba0d3085 */ +t12 = 3.1563205994e-04, /* 0x39a57b6b */ +t13 = -3.1275415677e-04, /* 0xb9a3f927 */ +t14 = 3.3552918467e-04, /* 0x39afe9f7 */ +u0 = -7.7215664089e-02, /* 0xbd9e233f */ +u1 = 6.3282704353e-01, /* 0x3f2200f4 */ +u2 = 1.4549225569e+00, /* 0x3fba3ae7 */ +u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */ +u4 = 2.2896373272e-01, /* 0x3e6a7578 */ +u5 = 1.3381091878e-02, /* 0x3c5b3c5e */ +v1 = 2.4559779167e+00, /* 0x401d2ebe */ +v2 = 2.1284897327e+00, /* 0x4008392d */ +v3 = 7.6928514242e-01, /* 0x3f44efdf */ +v4 = 1.0422264785e-01, /* 0x3dd572af */ +v5 = 3.2170924824e-03, /* 0x3b52d5db */ +s0 = -7.7215664089e-02, /* 0xbd9e233f */ +s1 = 2.1498242021e-01, /* 0x3e5c245a */ +s2 = 3.2577878237e-01, /* 0x3ea6cc7a */ +s3 = 1.4635047317e-01, /* 0x3e15dce6 */ +s4 = 2.6642270386e-02, /* 0x3cda40e4 */ +s5 = 1.8402845599e-03, /* 0x3af135b4 */ +s6 = 3.1947532989e-05, /* 0x3805ff67 */ +r1 = 1.3920053244e+00, /* 0x3fb22d3b */ +r2 = 7.2193557024e-01, /* 0x3f38d0c5 */ +r3 = 1.7193385959e-01, /* 0x3e300f6e */ +r4 = 1.8645919859e-02, /* 0x3c98bf54 */ +r5 = 7.7794247773e-04, /* 0x3a4beed6 */ +r6 = 7.3266842264e-06, /* 0x36f5d7bd */ +w0 = 4.1893854737e-01, /* 0x3ed67f1d */ +w1 = 8.3333335817e-02, /* 0x3daaaaab */ +w2 = -2.7777778450e-03, /* 0xbb360b61 */ +w3 = 7.9365057172e-04, /* 0x3a500cfd */ +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 +{ + float y,z; + int n,ix; + + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + + if(ix<0x3e800000) return __kernel_sinf(pi*x,zero,0); + y = -x; /* x is assume negative */ + + /* + * argument reduction, make sure inexact flag not raised if input + * is an integer + */ + z = __floorf(y); + if(z!=y) { /* inexact anyway */ + y *= (float)0.5; + 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 */ + GET_FLOAT_WORD(n,z); + n &= 1; + y = n; + n<<= 2; + } + } + switch (n) { + case 0: y = __kernel_sinf(pi*y,zero,0); break; + case 1: + case 2: y = __kernel_cosf(pi*((float)0.5-y),zero); break; + case 3: + case 4: y = __kernel_sinf(pi*(one-y),zero,0); break; + case 5: + case 6: y = -__kernel_cosf(pi*(y-(float)1.5),zero); break; + default: y = __kernel_sinf(pi*(y-(float)2.0),zero,0); break; + } + return -y; +} + + +#ifdef __STDC__ + float __ieee754_lgammaf_r(float x, int *signgamp) +#else + float __ieee754_lgammaf_r(x,signgamp) + float x; int *signgamp; +#endif +{ + float t,y,z,nadj,p,p1,p2,p3,q,r,w; + int i,hx,ix; + + GET_FLOAT_WORD(hx,x); + + /* purge off +-inf, NaN, +-0, and negative arguments */ + *signgamp = 1; + if ((unsigned int)hx==0xff800000) + return x-x; + ix = hx&0x7fffffff; + if(ix>=0x7f800000) return x*x; + if(ix==0) return one/fabsf(x); + if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */ + if(hx<0) { + *signgamp = -1; + return -__ieee754_logf(-x); + } else return -__ieee754_logf(x); + } + if(hx<0) { + if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ + return x/zero; + t = sin_pif(x); + if(t==zero) return one/fabsf(t); /* -integer */ + nadj = __ieee754_logf(pi/fabsf(t*x)); + if(t=0x3f3b4a20) {y = one-x; i= 0;} + else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;} + 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] */ + else {y=x-one;i=2;} + } + switch(i) { + case 0: + z = y*y; + p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); + p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); + p = y*p1+p2; + r += (p-(float)0.5*y); break; + case 1: + z = y*y; + w = z*y; + p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ + p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); + p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); + p = z*p1-(tt-w*(p2+y*p3)); + r += (tf + p); break; + case 2: + p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); + p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); + r += (-(float)0.5*y + p1/p2); + } + } + else if(ix<0x41000000) { /* x < 8.0 */ + i = (int)x; + t = zero; + y = x-(float)i; + p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); + q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); + r = half*y+p/q; + z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ + switch(i) { + case 7: z *= (y+(float)6.0); /* FALLTHRU */ + case 6: z *= (y+(float)5.0); /* FALLTHRU */ + case 5: z *= (y+(float)4.0); /* FALLTHRU */ + case 4: z *= (y+(float)3.0); /* FALLTHRU */ + case 3: z *= (y+(float)2.0); /* FALLTHRU */ + r += __ieee754_logf(z); break; + } + /* 8.0 <= x < 2**58 */ + } else if (ix < 0x5c800000) { + t = __ieee754_logf(x); + z = one/x; + y = z*z; + w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); + r = (x-half)*(t-one)+w; + } else + /* 2**58 <= x <= inf */ + r = x*(__ieee754_logf(x)-one); + if(hx<0) r = nadj - r; + return r; +} diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c new file mode 100644 index 0000000000..cea3d9156b --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_log10f.c @@ -0,0 +1,67 @@ +/* e_log10f.c -- float version of e_log10.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 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 */ + GET_FLOAT_WORD(hx,x); + } + if (hx >= 0x7f800000) return x+x; + k += (hx>>23)-127; + i = ((u_int32_t)k&0x80000000)>>31; + 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; +} diff --git a/sysdeps/ieee754/flt-32/e_logf.c b/sysdeps/ieee754/flt-32/e_logf.c new file mode 100644 index 0000000000..de8f869df4 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_logf.c @@ -0,0 +1,99 @@ +/* e_logf.c -- float version of e_log.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 */ +Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ +Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ +Lg3 = 2.8571429849e-01, /* 3E924925 */ +Lg4 = 2.2222198546e-01, /* 3E638E29 */ +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 hfsq,f,s,z,R,w,t1,t2,dk; + int32_t k,ix,i,j; + + GET_FLOAT_WORD(ix,x); + + k=0; + if (ix < 0x00800000) { /* x < 2**-126 */ + if ((ix&0x7fffffff)==0) + return -two25/(x-x); /* log(+-0)=-inf */ + if (ix<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; + k += (ix>>23)-127; + ix &= 0x007fffff; + i = (ix+(0x95f64<<3))&0x800000; + SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ + k += (i>>23); + f = x-(float)1.0; + if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ + if(f==zero) { + if(k==0) return zero; else {dk=(float)k; + return dk*ln2_hi+dk*ln2_lo;} + } + 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);} + } + s = f/((float)2.0+f); + dk = (float)k; + z = s*s; + i = ix-(0x6147a<<3); + w = z*z; + j = (0x6b851<<3)-ix; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=(float)0.5*f*f; + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); + } else { + if(k==0) return f-s*(f-R); else + return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); + } +} diff --git a/sysdeps/ieee754/flt-32/e_powf.c b/sysdeps/ieee754/flt-32/e_powf.c new file mode 100644 index 0000000000..4798340c84 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_powf.c @@ -0,0 +1,253 @@ +/* e_powf.c -- float version of e_pow.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 */ +zero = 0.0, +one = 1.0, +two = 2.0, +two24 = 16777216.0, /* 0x4b800000 */ + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 6.0000002384e-01, /* 0x3f19999a */ +L2 = 4.2857143283e-01, /* 0x3edb6db7 */ +L3 = 3.3333334327e-01, /* 0x3eaaaaab */ +L4 = 2.7272811532e-01, /* 0x3e8ba305 */ +L5 = 2.3066075146e-01, /* 0x3e6c3255 */ +L6 = 2.0697501302e-01, /* 0x3e53f142 */ +P1 = 1.6666667163e-01, /* 0x3e2aaaab */ +P2 = -2.7777778450e-03, /* 0xbb360b61 */ +P3 = 6.6137559770e-05, /* 0x388ab355 */ +P4 = -1.6533901999e-06, /* 0xb5ddea0e */ +P5 = 4.1381369442e-08, /* 0x3331bb4c */ +lg2 = 6.9314718246e-01, /* 0x3f317218 */ +lg2_h = 6.93145752e-01, /* 0x3f317200 */ +lg2_l = 1.42860654e-06, /* 0x35bfbe8c */ +ovt = 4.2995665694e-08, /* -(128-log2(ovfl+.5ulp)) */ +cp = 9.6179670095e-01, /* 0x3f76384f =2/(3ln2) */ +cp_h = 9.6179199219e-01, /* 0x3f763800 =head of cp */ +cp_l = 4.7017383622e-06, /* 0x369dc3a0 =tail of cp_h */ +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 z,ax,z_h,z_l,p_h,p_l; + float y1,t1,t2,r,s,t,u,v,w; + int32_t i,j,k,yisint,n; + int32_t hx,hy,ix,iy,is; + + GET_FLOAT_WORD(hx,x); + GET_FLOAT_WORD(hy,y); + ix = hx&0x7fffffff; iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if(iy==0) return one; + + /* +-NaN return x+y */ + if(ix > 0x7f800000 || + iy > 0x7f800000) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x4b800000) yisint = 2; /* even integer y */ + else if(iy>=0x3f800000) { + k = (iy>>23)-0x7f; /* exponent */ + j = iy>>(23-k); + if((j<<(23-k))==iy) yisint = 2-(j&1); + } + } + + /* special value of y */ + if (iy==0x7f800000) { /* y is +-inf */ + if (ix==0x3f800000) + return y - y; /* inf**+-1 is NaN */ + else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ + return (hy>=0)? y: zero; + else /* (|x|<1)**-,+inf = inf,0 */ + 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 */ + return __ieee754_sqrtf(x); + } + + ax = fabsf(x); + /* special value of x */ + if(ix==0x7f800000||ix==0||ix==0x3f800000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3f800000)|yisint)==0) { + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + + /* (x<0)**(non-int) is NaN */ + if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + + /* |y| is huge */ + if(iy>0x4d000000) { /* 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; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-1; /* t has 20 trailing zeros */ + w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); + u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ + v = t*ivln2_l-w*ivln2; + t1 = u+v; + GET_FLOAT_WORD(is,t1); + SET_FLOAT_WORD(t1,is&0xfffff000); + t2 = v-(t1-u); + } else { + float s2,s_h,s_l,t_h,t_l; + n = 0; + /* take care subnormal number */ + if(ix<0x00800000) + {ax *= two24; n -= 24; GET_FLOAT_WORD(ix,ax); } + n += ((ix)>>23)-0x7f; + j = ix&0x007fffff; + /* determine interval */ + ix = j|0x3f800000; /* normalize ix */ + if(j<=0x1cc471) k=0; /* |x|>1)|0x20000000)+0x0040000+(k<<21)); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = s*s; + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); + r += s_l*(s_h+s); + s2 = s_h*s_h; + t_h = (float)3.0+s2+r; + GET_FLOAT_WORD(is,t_h); + SET_FLOAT_WORD(t_h,is&0xfffff000); + t_l = r-((t_h-(float)3.0)-s2); + /* u+v = s*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*s; + /* 2/(3log2)*(s+...) */ + p_h = u+v; + GET_FLOAT_WORD(is,p_h); + SET_FLOAT_WORD(p_h,is&0xfffff000); + p_l = v-(p_h-u); + z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l*p_h+p_l*cp+dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (float)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + GET_FLOAT_WORD(is,t1); + SET_FLOAT_WORD(t1,is&0xfffff000); + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) + s = -one; /* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + GET_FLOAT_WORD(is,y); + SET_FLOAT_WORD(y1,is&0xfffff000); + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + GET_FLOAT_WORD(j,z); + if (j>0x43000000) /* if z > 128 */ + return s*huge*huge; /* overflow */ + else if (j==0x43000000) { /* if z == 128 */ + if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ + } + else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */ + return s*tiny*tiny; /* underflow */ + else if ((u_int32_t) j==0xc3160000){ /* z == -150 */ + if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>23)-0x7f; + n = 0; + if(i>0x3f000000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00800000>>(k+1)); + k = ((n&0x7fffffff)>>23)-0x7f; /* new k for n */ + SET_FLOAT_WORD(t,n&~(0x007fffff>>k)); + n = ((n&0x007fffff)|0x00800000)>>(23-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + GET_FLOAT_WORD(is,t); + SET_FLOAT_WORD(t,is&0xfffff000); + u = t*lg2_h; + v = (p_l-(t-p_h))*lg2+t*lg2_l; + z = u+v; + w = v-(z-u); + t = z*z; + t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + r = (z*t1)/(t1-two)-(w+z*w); + z = one-(r-z); + GET_FLOAT_WORD(j,z); + j += (n<<23); + if((j>>23)<=0) z = __scalbnf(z,n); /* subnormal output */ + else SET_FLOAT_WORD(z,j); + return s*z; +} diff --git a/sysdeps/ieee754/flt-32/e_rem_pio2f.c b/sysdeps/ieee754/flt-32/e_rem_pio2f.c new file mode 100644 index 0000000000..4b8c4466bd --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_rem_pio2f.c @@ -0,0 +1,196 @@ +/* e_rem_pio2f.c -- float version of e_rem_pio2.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_rem_pio2f.c,v 1.5 1995/05/10 20:46:03 jtc Exp $"; +#endif + +/* __ieee754_rem_pio2f(x,y) + * + * return the remainder of x rem pi/2 in y[0]+y[1] + * use __kernel_rem_pio2f() + */ + +#include "math.h" +#include "math_private.h" + +/* + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + */ +#ifdef __STDC__ +static const int32_t two_over_pi[] = { +#else +static int32_t two_over_pi[] = { +#endif +0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, +0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, +0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, +0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, +0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, +0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, +0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, +0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, +0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, +0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, +0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, +0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, +0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, +0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, +0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, +0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, +0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, +0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, +0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, +0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, +0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, +0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, +}; + +/* This array is like the one in e_rem_pio2.c, but the numbers are + single precision and the last 8 bits are forced to 0. */ +#ifdef __STDC__ +static const int32_t npio2_hw[] = { +#else +static int32_t npio2_hw[] = { +#endif +0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, +0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, +0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, +0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, +0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, +0x4242c700, 0x42490f00 +}; + +/* + * invpio2: 24 bits of 2/pi + * pio2_1: first 17 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 17 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 17 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +#ifdef __STDC__ +static const float +#else +static float +#endif +zero = 0.0000000000e+00, /* 0x00000000 */ +half = 5.0000000000e-01, /* 0x3f000000 */ +two8 = 2.5600000000e+02, /* 0x43800000 */ +invpio2 = 6.3661980629e-01, /* 0x3f22f984 */ +pio2_1 = 1.5707855225e+00, /* 0x3fc90f80 */ +pio2_1t = 1.0804334124e-05, /* 0x37354443 */ +pio2_2 = 1.0804273188e-05, /* 0x37354400 */ +pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */ +pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */ +pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ + +#ifdef __STDC__ + int32_t __ieee754_rem_pio2f(float x, float *y) +#else + int32_t __ieee754_rem_pio2f(x,y) + float x,y[]; +#endif +{ + float z,w,t,r,fn; + float tx[3]; + int32_t e0,i,j,nx,n,ix,hx; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 24+24+24 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 24+24+24 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ + t = fabsf(x); + n = (int32_t) (t*invpio2+half); + fn = (float)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 40 bit */ + if(n<32&&(int32_t)(ix&0xffffff00)!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + u_int32_t high; + j = ix>>23; + y[0] = r-w; + GET_FLOAT_WORD(high,y[0]); + i = j-((high>>23)&0xff); + if(i>8) { /* 2nd iteration needed, good to 57 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + GET_FLOAT_WORD(high,y[0]); + i = j-((high>>23)&0xff); + if(i>25) { /* 3rd iteration need, 74 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } + /* + * all other (large) arguments + */ + if(ix>=0x7f800000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } + /* set z = scalbn(|x|,ilogb(x)-7) */ + e0 = (ix>>23)-134; /* e0 = ilogb(z)-7; */ + SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23))); + for(i=0;i<2;i++) { + tx[i] = (float)((int32_t)(z)); + z = (z-tx[i])*two8; + } + tx[2] = z; + nx = 3; + while(tx[nx-1]==zero) nx--; /* skip zero term */ + n = __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; +} diff --git a/sysdeps/ieee754/flt-32/e_remainderf.c b/sysdeps/ieee754/flt-32/e_remainderf.c new file mode 100644 index 0000000000..90d0d366d4 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_remainderf.c @@ -0,0 +1,73 @@ +/* e_remainderf.c -- float version of e_remainder.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 +{ + int32_t hx,hp; + u_int32_t sx; + float p_half; + + GET_FLOAT_WORD(hx,x); + GET_FLOAT_WORD(hp,p); + sx = hx&0x80000000; + hp &= 0x7fffffff; + hx &= 0x7fffffff; + + /* purge off exception values */ + 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); + + + if (hp<=0x7effffff) x = __ieee754_fmodf(x,p+p); /* now x < 2p */ + if ((hx-hp)==0) return zero*x; + x = fabsf(x); + p = fabsf(p); + if (hp<0x01000000) { + if(x+x>p) { + x-=p; + if(x+x>=p) x -= p; + } + } else { + p_half = (float)0.5*p; + if(x>p_half) { + x-=p; + if(x>=p_half) x -= p; + } + } + GET_FLOAT_WORD(hx,x); + SET_FLOAT_WORD(x,hx^sx); + return x; +} diff --git a/sysdeps/ieee754/flt-32/e_sinhf.c b/sysdeps/ieee754/flt-32/e_sinhf.c new file mode 100644 index 0000000000..045f6f121e --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_sinhf.c @@ -0,0 +1,68 @@ +/* e_sinhf.c -- float version of e_sinh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 t,w,h; + int32_t ix,jx; + + GET_FLOAT_WORD(jx,x); + ix = jx&0x7fffffff; + + /* x is INF or NaN */ + if(ix>=0x7f800000) 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(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)); + return h*(t+t/(t+one)); + } + + /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ + if (ix < 0x42b17180) return h*__ieee754_expf(fabsf(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + if (ix<=0x42b2d4fc) { + w = __ieee754_expf((float)0.5*fabsf(x)); + t = h*w; + return t*w; + } + + /* |x| > overflowthresold, sinh(x) overflow */ + return x*shuge; +} diff --git a/sysdeps/ieee754/flt-32/e_sqrtf.c b/sysdeps/ieee754/flt-32/e_sqrtf.c new file mode 100644 index 0000000000..7648ef4bca --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_sqrtf.c @@ -0,0 +1,97 @@ +/* e_sqrtf.c -- float version of e_sqrt.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 z; + 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) { + 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 */ + else if(ix<0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } + /* normalize x */ + m = (ix>>23); + if(m==0) { /* subnormal x */ + for(i=0;(ix&0x00800000)==0;i++) ix<<=1; + m -= i-1; + } + m -= 127; /* unbias exponent */ + ix = (ix&0x007fffff)|0x00800000; + if(m&1) /* odd m, double x to make it even */ + ix += ix; + m >>= 1; /* m = [m/2] */ + + /* generate sqrt(x) bit by bit */ + ix += ix; + q = s = 0; /* q = sqrt(x) */ + 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; + } + ix += ix; + r>>=1; + } + + /* use floating add to find out rounding direction */ + if(ix!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (z>one) + q += 2; + else + q += (q&1); + } + } + ix = (q>>1)+0x3f000000; + ix += (m <<23); + SET_FLOAT_WORD(z,ix); + return z; +} diff --git a/sysdeps/ieee754/flt-32/k_cosf.c b/sysdeps/ieee754/flt-32/k_cosf.c new file mode 100644 index 0000000000..b232cab11f --- /dev/null +++ b/sysdeps/ieee754/flt-32/k_cosf.c @@ -0,0 +1,64 @@ +/* k_cosf.c -- float version of k_cos.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_cosf.c,v 1.4 1995/05/10 20:46:23 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +one = 1.0000000000e+00, /* 0x3f800000 */ +C1 = 4.1666667908e-02, /* 0x3d2aaaab */ +C2 = -1.3888889225e-03, /* 0xbab60b61 */ +C3 = 2.4801587642e-05, /* 0x37d00d01 */ +C4 = -2.7557314297e-07, /* 0xb493f27c */ +C5 = 2.0875723372e-09, /* 0x310f74f6 */ +C6 = -1.1359647598e-11; /* 0xad47d74e */ + +#ifdef __STDC__ + float __kernel_cosf(float x, float y) +#else + float __kernel_cosf(x, y) + float x,y; +#endif +{ + float a,hz,z,r,qx; + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x32000000) { /* if x < 2**27 */ + if(((int)x)==0) return one; /* generate inexact */ + } + z = x*x; + r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); + if(ix < 0x3e99999a) /* if |x| < 0.3 */ + return one - ((float)0.5*z - (z*r - x*y)); + else { + if(ix > 0x3f480000) { /* x > 0.78125 */ + qx = (float)0.28125; + } else { + SET_FLOAT_WORD(qx,ix-0x01000000); /* x/4 */ + } + hz = (float)0.5*z-qx; + a = one-qx; + return a - (hz - (z*r-x*y)); + } +} diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c new file mode 100644 index 0000000000..2783480fcb --- /dev/null +++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c @@ -0,0 +1,213 @@ +/* k_rem_pio2f.c -- float version of k_rem_pio2.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_rem_pio2f.c,v 1.4 1995/05/10 20:46:28 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +/* In the float version, the input parameter x contains 8 bit + integers, not 24 bit integers. 113 bit precision is not supported. */ + +#ifdef __STDC__ +static const int init_jk[] = {4,7,9}; /* initial value for jk */ +#else +static int init_jk[] = {4,7,9}; +#endif + +#ifdef __STDC__ +static const float PIo2[] = { +#else +static float PIo2[] = { +#endif + 1.5703125000e+00, /* 0x3fc90000 */ + 4.5776367188e-04, /* 0x39f00000 */ + 2.5987625122e-05, /* 0x37da0000 */ + 7.5437128544e-08, /* 0x33a20000 */ + 6.0026650317e-11, /* 0x2e840000 */ + 7.3896444519e-13, /* 0x2b500000 */ + 5.3845816694e-15, /* 0x27c20000 */ + 5.6378512969e-18, /* 0x22d00000 */ + 8.3009228831e-20, /* 0x1fc40000 */ + 3.2756352257e-22, /* 0x1bc60000 */ + 6.3331015649e-25, /* 0x17440000 */ +}; + +#ifdef __STDC__ +static const float +#else +static float +#endif +zero = 0.0, +one = 1.0, +two8 = 2.5600000000e+02, /* 0x43800000 */ +twon8 = 3.9062500000e-03; /* 0x3b800000 */ + +#ifdef __STDC__ + int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2) +#else + int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) + float x[], y[]; int e0,nx,prec; int32_t ipio2[]; +#endif +{ + int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + float z,fw,f[20],fq[20],q[20]; + + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; + + /* determine jx,jv,q0, note that 3>q0 */ + jx = nx-1; + jv = (e0-3)/8; if(jv<0) jv=0; + q0 = e0-8*(jv+1); + + /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; + + /* compute q[0],q[1],...q[jk] */ + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + } + + jz = jk; +recompute: + /* distill q[] into iq[] reversingly */ + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (float)((int32_t)(twon8* z)); + iq[i] = (int32_t)(z-two8*fw); + z = q[j-1]+fw; + } + + /* compute n */ + z = __scalbnf(z,q0); /* actual value of z */ + z -= (float)8.0*__floorf(z*(float)0.125); /* trim off integer >= 8 */ + n = (int32_t) z; + z -= (float)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(8-q0)); n += i; + iq[jz-1] -= i<<(8-q0); + ih = iq[jz-1]>>(7-q0); + } + else if(q0==0) ih = iq[jz-1]>>8; + else if(z>=(float)0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7f; break; + case 2: + iq[jz-1] &= 0x3f; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= __scalbnf(one,q0); + } + } + + /* check if recomputation is needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ + + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (float) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } + + /* chop off zero terms */ + if(z==(float)0.0) { + jz -= 1; q0 -= 8; + while(iq[jz]==0) { jz--; q0-=8;} + } else { /* break z into 8-bit if necessary */ + z = __scalbnf(z,-q0); + if(z>=two8) { + fw = (float)((int32_t)(twon8*z)); + iq[jz] = (int32_t)(z-two8*fw); + jz += 1; q0 += 8; + iq[jz] = (int32_t) fw; + } else iq[jz] = (int32_t) z ; + } + + /* convert integer "bit" chunk to floating-point value */ + fw = __scalbnf(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(float)iq[i]; fw*=twon8; + } + + /* compute PIo2[0,...,jp]*q[jz,...,0] */ + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } + + /* compress fq[] into y[] */ + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; +} diff --git a/sysdeps/ieee754/flt-32/k_sinf.c b/sysdeps/ieee754/flt-32/k_sinf.c new file mode 100644 index 0000000000..4fec15e830 --- /dev/null +++ b/sysdeps/ieee754/flt-32/k_sinf.c @@ -0,0 +1,54 @@ +/* k_sinf.c -- float version of k_sin.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_sinf.c,v 1.4 1995/05/10 20:46:33 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +half = 5.0000000000e-01,/* 0x3f000000 */ +S1 = -1.6666667163e-01, /* 0xbe2aaaab */ +S2 = 8.3333337680e-03, /* 0x3c088889 */ +S3 = -1.9841270114e-04, /* 0xb9500d01 */ +S4 = 2.7557314297e-06, /* 0x3638ef1b */ +S5 = -2.5050759689e-08, /* 0xb2d72f34 */ +S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */ + +#ifdef __STDC__ + float __kernel_sinf(float x, float y, int iy) +#else + float __kernel_sinf(x, y, iy) + float x,y; int iy; /* iy=0 if y is zero */ +#endif +{ + float z,r,v; + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; /* high word of x */ + if(ix<0x32000000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; + r = S2+z*(S3+z*(S4+z*(S5+z*S6))); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); +} diff --git a/sysdeps/ieee754/flt-32/k_tanf.c b/sysdeps/ieee754/flt-32/k_tanf.c new file mode 100644 index 0000000000..eb1a670939 --- /dev/null +++ b/sysdeps/ieee754/flt-32/k_tanf.c @@ -0,0 +1,101 @@ +/* k_tanf.c -- float version of k_tan.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_tanf.c,v 1.4 1995/05/10 20:46: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 */ +pio4 = 7.8539812565e-01, /* 0x3f490fda */ +pio4lo= 3.7748947079e-08, /* 0x33222168 */ +T[] = { + 3.3333334327e-01, /* 0x3eaaaaab */ + 1.3333334029e-01, /* 0x3e088889 */ + 5.3968254477e-02, /* 0x3d5d0dd1 */ + 2.1869488060e-02, /* 0x3cb327a4 */ + 8.8632395491e-03, /* 0x3c11371f */ + 3.5920790397e-03, /* 0x3b6b6916 */ + 1.4562094584e-03, /* 0x3abede48 */ + 5.8804126456e-04, /* 0x3a1a26c8 */ + 2.4646313977e-04, /* 0x398137b9 */ + 7.8179444245e-05, /* 0x38a3f445 */ + 7.1407252108e-05, /* 0x3895c07a */ + -1.8558637748e-05, /* 0xb79bae5f */ + 2.5907305826e-05, /* 0x37d95384 */ +}; + +#ifdef __STDC__ + float __kernel_tanf(float x, float y, int iy) +#else + float __kernel_tanf(x, y, iy) + float x,y; int iy; +#endif +{ + float z,r,v,w,s; + int32_t ix,hx; + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; /* high word of |x| */ + if(ix<0x31800000) /* x < 2**-28 */ + {if((int)x==0) { /* generate inexact */ + if((ix|(iy+1))==0) return one/fabsf(x); + else return (iy==1)? x: -one/x; + } + } + if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ + if(hx<0) {x = -x; y = -y;} + z = pio4-x; + w = pio4lo-y; + x = z+w; y = 0.0; + } + z = x*x; + w = z*z; + /* Break x^5*(T[1]+x^2*T[2]+...) into + * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + + * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) + */ + r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); + v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); + s = z*x; + r = y + z*(s*(r+v)+y); + r += T[0]*s; + w = x+r; + if(ix>=0x3f2ca140) { + v = (float)iy; + return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r))); + } + if(iy==1) return w; + else { /* if allow error up to 2 ulp, + simply return -1.0/(x+r) here */ + /* compute -1.0/(x+r) accurately */ + float a,t; + int32_t i; + z = w; + GET_FLOAT_WORD(i,z); + SET_FLOAT_WORD(z,i&0xfffff000); + v = r-(z - x); /* z+v = r+x */ + t = a = -(float)1.0/w; /* a = -1.0/w */ + GET_FLOAT_WORD(i,t); + SET_FLOAT_WORD(t,i&0xfffff000); + s = (float)1.0+t*z; + return t+a*(s+t*v); + } +} diff --git a/sysdeps/ieee754/flt-32/mpn2flt.c b/sysdeps/ieee754/flt-32/mpn2flt.c new file mode 100644 index 0000000000..a409b456b0 --- /dev/null +++ b/sysdeps/ieee754/flt-32/mpn2flt.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1995, 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include +#include + +/* Convert a multi-precision integer of the needed number of bits (24 for + float) and an integral power of two to a `float' in IEEE754 single- + precision format. */ + +float +__mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign) +{ + union ieee754_float u; + + u.ieee.negative = sign; + u.ieee.exponent = expt + IEEE754_FLOAT_BIAS; +#if BITS_PER_MP_LIMB > FLT_MANT_DIG + u.ieee.mantissa = frac_ptr[0] & ((1 << FLT_MANT_DIG) - 1); +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif + + return u.f; +} diff --git a/sysdeps/ieee754/flt-32/s_asinhf.c b/sysdeps/ieee754/flt-32/s_asinhf.c new file mode 100644 index 0000000000..fac256d37a --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_asinhf.c @@ -0,0 +1,58 @@ +/* s_asinhf.c -- float version of s_asinh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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 t,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(huge+x>one) return x; /* return x inexact except 0 */ + } + if(ix>0x47000000) { /* |x| > 2**14 */ + 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))); + } + if(hx>0) return w; else return -w; +} +weak_alias (__asinhf, asinhf) diff --git a/sysdeps/ieee754/flt-32/s_atanf.c b/sysdeps/ieee754/flt-32/s_atanf.c new file mode 100644 index 0000000000..a68933fa6a --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_atanf.c @@ -0,0 +1,120 @@ +/* s_atanf.c -- float version of s_atan.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_atanf.c,v 1.4 1995/05/10 20:46:47 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float atanhi[] = { +#else +static float atanhi[] = { +#endif + 4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */ + 7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */ + 9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */ + 1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */ +}; + +#ifdef __STDC__ +static const float atanlo[] = { +#else +static float atanlo[] = { +#endif + 5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */ + 3.7748947079e-08, /* atan(1.0)lo 0x33222168 */ + 3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */ + 7.5497894159e-08, /* atan(inf)lo 0x33a22168 */ +}; + +#ifdef __STDC__ +static const float aT[] = { +#else +static float aT[] = { +#endif + 3.3333334327e-01, /* 0x3eaaaaaa */ + -2.0000000298e-01, /* 0xbe4ccccd */ + 1.4285714924e-01, /* 0x3e124925 */ + -1.1111110449e-01, /* 0xbde38e38 */ + 9.0908870101e-02, /* 0x3dba2e6e */ + -7.6918758452e-02, /* 0xbd9d8795 */ + 6.6610731184e-02, /* 0x3d886b35 */ + -5.8335702866e-02, /* 0xbd6ef16b */ + 4.9768779427e-02, /* 0x3d4bda59 */ + -3.6531571299e-02, /* 0xbd15a221 */ + 1.6285819933e-02, /* 0x3c8569d7 */ +}; + +#ifdef __STDC__ + static const float +#else + static float +#endif +one = 1.0, +huge = 1.0e30; + +#ifdef __STDC__ + float __atanf(float x) +#else + float __atanf(x) + float x; +#endif +{ + float w,s1,s2,z; + int32_t ix,hx,id; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x50800000) { /* if |x| >= 2^34 */ + if(ix>0x7f800000) + return x+x; /* NaN */ + if(hx>0) return atanhi[3]+atanlo[3]; + else return -atanhi[3]-atanlo[3]; + } if (ix < 0x3ee00000) { /* |x| < 0.4375 */ + if (ix < 0x31000000) { /* |x| < 2^-29 */ + if(huge+x>one) return x; /* raise inexact */ + } + id = -1; + } else { + x = fabsf(x); + if (ix < 0x3f980000) { /* |x| < 1.1875 */ + if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ + id = 0; x = ((float)2.0*x-one)/((float)2.0+x); + } else { /* 11/16<=|x|< 19/16 */ + id = 1; x = (x-one)/(x+one); + } + } else { + if (ix < 0x401c0000) { /* |x| < 2.4375 */ + id = 2; x = (x-(float)1.5)/(one+(float)1.5*x); + } else { /* 2.4375 <= |x| < 2^66 */ + id = 3; x = -(float)1.0/x; + } + }} + /* end of argument reduction */ + z = x*x; + w = z*z; + /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ + s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); + s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); + if (id<0) return x - x*(s1+s2); + else { + z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); + return (hx<0)? -z:z; + } +} +weak_alias (__atanf, atanf) diff --git a/sysdeps/ieee754/flt-32/s_cbrtf.c b/sysdeps/ieee754/flt-32/s_cbrtf.c new file mode 100644 index 0000000000..fa0fef9987 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_cbrtf.c @@ -0,0 +1,64 @@ +/* Compute cubic root of float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Dirk Alboth and + Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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" + + +#define CBRT2 1.2599210498948731648 /* 2^(1/3) */ +#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */ + +static const double factor[5] = +{ + 1.0 / SQR_CBRT2, + 1.0 / CBRT2, + 1.0, + CBRT2, + SQR_CBRT2 +}; + + +float +__cbrtf (float x) +{ + float xm, ym, u, t2; + int xe; + + /* Reduce X. XM now is an range 1.0 to 0.5. */ + xm = __frexpf (fabsf (x), &xe); + + /* If X is not finite or is null return it (with raising exceptions + if necessary. + Note: *Our* version of `frexp' sets XE to zero if the argument is + Inf or NaN. This is not portable but faster. */ + if (xe == 0 && fpclassify (x) <= FP_ZERO) + return x + x; + + u = (0.492659620528969547 + (0.697570460207922770 + - 0.191502161678719066 * xm) * xm); + + t2 = u * u * u; + + ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3]; + + return __ldexpf (x > 0.0 ? ym : -ym, xe / 3); +} +weak_alias (__cbrtf, cbrtf) diff --git a/sysdeps/ieee754/flt-32/s_ceilf.c b/sysdeps/ieee754/flt-32/s_ceilf.c new file mode 100644 index 0000000000..29ccadb049 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_ceilf.c @@ -0,0 +1,62 @@ +/* s_ceilf.c -- float version of s_ceil.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_ceilf.c,v 1.4 1995/05/10 20:46:55 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float huge = 1.0e30; +#else +static float huge = 1.0e30; +#endif + +#ifdef __STDC__ + float __ceilf(float x) +#else + float __ceilf(x) + float x; +#endif +{ + int32_t i0,j0; + u_int32_t i; + + GET_FLOAT_WORD(i0,x); + j0 = ((i0>>23)&0xff)-0x7f; + if(j0<23) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0<0) {i0=0x80000000;} + else if(i0!=0) { i0=0x3f800000;} + } + } else { + i = (0x007fffff)>>j0; + if((i0&i)==0) return x; /* x is integral */ + if(huge+x>(float)0.0) { /* raise inexact flag */ + if(i0>0) i0 += (0x00800000)>>j0; + i0 &= (~i); + } + } + } else { + if(j0==0x80) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } + SET_FLOAT_WORD(x,i0); + return x; +} +weak_alias (__ceilf, ceilf) diff --git a/sysdeps/ieee754/flt-32/s_copysignf.c b/sysdeps/ieee754/flt-32/s_copysignf.c new file mode 100644 index 0000000000..a4e84e5397 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_copysignf.c @@ -0,0 +1,42 @@ +/* s_copysignf.c -- float version of s_copysign.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_copysignf.c,v 1.4 1995/05/10 20:46:59 jtc Exp $"; +#endif + +/* + * copysignf(float x, float y) + * copysignf(x,y) returns a value with the magnitude of x and + * with the sign bit of y. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __copysignf(float x, float y) +#else + float __copysignf(x,y) + float x,y; +#endif +{ + u_int32_t ix,iy; + GET_FLOAT_WORD(ix,x); + GET_FLOAT_WORD(iy,y); + SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000)); + return x; +} +weak_alias (__copysignf, copysignf) diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c new file mode 100644 index 0000000000..86c59d440c --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_cosf.c @@ -0,0 +1,60 @@ +/* s_cosf.c -- float version of s_cos.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float one=1.0; +#else +static float one=1.0; +#endif + +#ifdef __STDC__ + float __cosf(float x) +#else + float __cosf(x) + float x; +#endif +{ + float y[2],z=0.0; + int32_t n,ix; + + GET_FLOAT_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3f490fd8) return __kernel_cosf(x,z); + + /* cos(Inf or NaN) is NaN */ + else if (ix>=0x7f800000) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2f(x,y); + switch(n&3) { + case 0: return __kernel_cosf(y[0],y[1]); + case 1: return -__kernel_sinf(y[0],y[1],1); + case 2: return -__kernel_cosf(y[0],y[1]); + default: + return __kernel_sinf(y[0],y[1],1); + } + } +} +weak_alias (__cosf, cosf) diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c new file mode 100644 index 0000000000..774714cfd1 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_erff.c @@ -0,0 +1,225 @@ +/* s_erff.c -- float version of s_erf.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +tiny = 1e-30, +half= 5.0000000000e-01, /* 0x3F000000 */ +one = 1.0000000000e+00, /* 0x3F800000 */ +two = 2.0000000000e+00, /* 0x40000000 */ + /* c = (subfloat)0.84506291151 */ +erx = 8.4506291151e-01, /* 0x3f58560b */ +/* + * Coefficients for approximation to erf on [0,0.84375] + */ +efx = 1.2837916613e-01, /* 0x3e0375d4 */ +efx8= 1.0270333290e+00, /* 0x3f8375d4 */ +pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ +pp1 = -3.2504209876e-01, /* 0xbea66beb */ +pp2 = -2.8481749818e-02, /* 0xbce9528f */ +pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ +pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ +qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ +qq2 = 6.5022252500e-02, /* 0x3d852a63 */ +qq3 = 5.0813062117e-03, /* 0x3ba68116 */ +qq4 = 1.3249473704e-04, /* 0x390aee49 */ +qq5 = -3.9602282413e-06, /* 0xb684e21a */ +/* + * Coefficients for approximation to erf in [0.84375,1.25] + */ +pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ +pa1 = 4.1485610604e-01, /* 0x3ed46805 */ +pa2 = -3.7220788002e-01, /* 0xbebe9208 */ +pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ +pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ +pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ +pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ +qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ +qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ +qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ +qa4 = 1.2617121637e-01, /* 0x3e013307 */ +qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ +qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ +/* + * Coefficients for approximation to erfc in [1.25,1/0.35] + */ +ra0 = -9.8649440333e-03, /* 0xbc21a093 */ +ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ +ra2 = -1.0558626175e+01, /* 0xc128f022 */ +ra3 = -6.2375331879e+01, /* 0xc2798057 */ +ra4 = -1.6239666748e+02, /* 0xc322658c */ +ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ +ra6 = -8.1287437439e+01, /* 0xc2a2932b */ +ra7 = -9.8143291473e+00, /* 0xc11d077e */ +sa1 = 1.9651271820e+01, /* 0x419d35ce */ +sa2 = 1.3765776062e+02, /* 0x4309a863 */ +sa3 = 4.3456588745e+02, /* 0x43d9486f */ +sa4 = 6.4538726807e+02, /* 0x442158c9 */ +sa5 = 4.2900814819e+02, /* 0x43d6810b */ +sa6 = 1.0863500214e+02, /* 0x42d9451f */ +sa7 = 6.5702495575e+00, /* 0x40d23f7c */ +sa8 = -6.0424413532e-02, /* 0xbd777f97 */ +/* + * Coefficients for approximation to erfc in [1/.35,28] + */ +rb0 = -9.8649431020e-03, /* 0xbc21a092 */ +rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ +rb2 = -1.7757955551e+01, /* 0xc18e104b */ +rb3 = -1.6063638306e+02, /* 0xc320a2ea */ +rb4 = -6.3756646729e+02, /* 0xc41f6441 */ +rb5 = -1.0250950928e+03, /* 0xc480230b */ +rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ +sb1 = 3.0338060379e+01, /* 0x41f2b459 */ +sb2 = 3.2579251099e+02, /* 0x43a2e571 */ +sb3 = 1.5367296143e+03, /* 0x44c01759 */ +sb4 = 3.1998581543e+03, /* 0x4547fdbb */ +sb5 = 2.5530502930e+03, /* 0x451f90ce */ +sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ +sb7 = -2.2440952301e+01; /* 0xc1b38712 */ + +#ifdef __STDC__ + float __erff(float x) +#else + float __erff(x) + float x; +#endif +{ + int32_t hx,ix,i; + float R,S,P,Q,s,y,z,r; + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7f800000) { /* erf(nan)=nan */ + i = ((u_int32_t)hx>>31)<<1; + return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */ + } + + if(ix < 0x3f580000) { /* |x|<0.84375 */ + if(ix < 0x31800000) { /* |x|<2**-28 */ + if (ix < 0x04000000) + /*avoid underflow */ + return (float)0.125*((float)8.0*x+efx8*x); + return x + efx*x; + } + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); + y = r/s; + return x + x*y; + } + if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ + s = fabsf(x)-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); + if(hx>=0) return erx + P/Q; else return -erx - P/Q; + } + if (ix >= 0x40c00000) { /* inf>|x|>=6 */ + if(hx>=0) return one-tiny; else return tiny-one; + } + x = fabsf(x); + s = one/(x*x); + if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( + ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( + sa5+s*(sa6+s*(sa7+s*sa8))))))); + } else { /* |x| >= 1/0.35 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( + rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( + sb5+s*(sb6+s*sb7)))))); + } + GET_FLOAT_WORD(ix,x); + SET_FLOAT_WORD(z,ix&0xfffff000); + r = __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S); + if(hx>=0) return one-r/x; else return r/x-one; +} +weak_alias (__erff, erff) + +#ifdef __STDC__ + float __erfcf(float x) +#else + float __erfcf(x) + float x; +#endif +{ + int32_t hx,ix; + float R,S,P,Q,s,y,z,r; + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7f800000) { /* erfc(nan)=nan */ + /* erfc(+-inf)=0,2 */ + return (float)(((u_int32_t)hx>>31)<<1)+one/x; + } + + if(ix < 0x3f580000) { /* |x|<0.84375 */ + if(ix < 0x23800000) /* |x|<2**-56 */ + return one-x; + z = x*x; + r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); + s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); + y = r/s; + if(hx < 0x3e800000) { /* x<1/4 */ + return one-(x+x*y); + } else { + r = x*y; + r += (x-half); + return half - r ; + } + } + if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ + s = fabsf(x)-one; + P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); + if(hx>=0) { + z = one-erx; return z - P/Q; + } else { + z = erx+P/Q; return one+z; + } + } + if (ix < 0x41e00000) { /* |x|<28 */ + x = fabsf(x); + s = one/(x*x); + if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/ + R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( + ra5+s*(ra6+s*ra7)))))); + S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( + sa5+s*(sa6+s*(sa7+s*sa8))))))); + } else { /* |x| >= 1/.35 ~ 2.857143 */ + if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( + rb5+s*rb6))))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( + sb5+s*(sb6+s*sb7)))))); + } + GET_FLOAT_WORD(ix,x); + SET_FLOAT_WORD(z,ix&0xfffff000); + r = __ieee754_expf(-z*z-(float)0.5625)* + __ieee754_expf((z-x)*(z+x)+R/S); + if(hx>0) return r/x; else return two-r/x; + } else { + if(hx>0) return tiny*tiny; else return two-tiny; + } +} +weak_alias (__erfcf, erfcf) diff --git a/sysdeps/ieee754/flt-32/s_exp2f.c b/sysdeps/ieee754/flt-32/s_exp2f.c new file mode 100644 index 0000000000..8229885453 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_exp2f.c @@ -0,0 +1,127 @@ +/* Single-precision floating point 2^x. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* The basic design here is from + Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical + Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., + 17 (1), March 1991, pp. 26-45. + It has been slightly modified to compute 2^x instead of e^x, and for + single-precision. + */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include + +#include "t_exp2f.h" + +static const volatile float TWOM100 = 7.88860905e-31; +static const volatile float TWO127 = 1.7014118346e+38; + +float +__ieee754_exp2f (float x) +{ + static const float himark = (float) FLT_MAX_EXP; + static const float lomark = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1) - 1.0; + + /* Check for usual case. */ + if (isless (x, himark) && isgreater (x, lomark)) + { + static const float THREEp14 = 49152.0; + int tval, unsafe; + float rx, x22, result; + union ieee754_float ex2_u, scale_u; + fenv_t oldenv; + + feholdexcept (&oldenv); +#ifdef FE_TONEAREST + /* If we don't have this, it's too bad. */ + fesetround (FE_TONEAREST); +#endif + + /* 1. Argument reduction. + Choose integers ex, -128 <= t < 128, and some real + -1/512 <= x1 <= 1/512 so that + x = ex + t/512 + x1. + + First, calculate rx = ex + t/256. */ + rx = x + THREEp14; + rx -= THREEp14; + x -= rx; /* Compute x=x1. */ + /* Compute tval = (ex*256 + t)+128. + Now, t = (tval mod 256)-128 and ex=tval/256 [that's mod, NOT %; and + /-round-to-nearest not the usual c integer /]. */ + tval = (int) (rx * 256.0f + 128.0f); + + /* 2. Adjust for accurate table entry. + Find e so that + x = ex + t/256 + e + x2 + where -7e-4 < e < 7e-4, and + (float)(2^(t/256+e)) + is accurate to one part in 2^-64. */ + + /* 'tval & 255' is the same as 'tval%256' except that it's always + positive. + Compute x = x2. */ + x -= __exp2f_deltatable[tval & 255]; + + /* 3. Compute ex2 = 2^(t/255+e+ex). */ + ex2_u.f = __exp2f_atable[tval & 255]; + tval >>= 8; + unsafe = abs(tval) >= -FLT_MIN_EXP - 1; + ex2_u.ieee.exponent += tval >> unsafe; + scale_u.f = 1.0; + scale_u.ieee.exponent += tval - (tval >> unsafe); + + /* 4. Approximate 2^x2 - 1, using a second-degree polynomial, + with maximum error in [-2^-9 - 2^-14, 2^-9 + 2^-14] + less than 1.3e-10. */ + + x22 = (.24022656679f * x + .69314736128f) * ex2_u.f; + + /* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */ + fesetenv (&oldenv); + + result = x22 * x + ex2_u.f; + + if (!unsafe) + return result; + else + return result * scale_u.f; + } + /* Exceptional cases: */ + else if (isless (x, himark)) + { + if (__isinff (x)) + /* e^-inf == 0, with no error. */ + return 0; + else + /* Underflow */ + return TWOM100 * TWOM100; + } + else + /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ + return TWO127*x; +} diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c new file mode 100644 index 0000000000..375e334c38 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_expm1f.c @@ -0,0 +1,135 @@ +/* s_expm1f.c -- float version of s_expm1.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +static const volatile float huge = 1.0e+30, tiny = 1.0e-30; + +#ifdef __STDC__ +static const float +#else +static float +#endif +one = 1.0, +o_threshold = 8.8721679688e+01,/* 0x42b17180 */ +ln2_hi = 6.9313812256e-01,/* 0x3f317180 */ +ln2_lo = 9.0580006145e-06,/* 0x3717f7d1 */ +invln2 = 1.4426950216e+00,/* 0x3fb8aa3b */ + /* scaled coefficients related to expm1 */ +Q1 = -3.3333335072e-02, /* 0xbd088889 */ +Q2 = 1.5873016091e-03, /* 0x3ad00d01 */ +Q3 = -7.9365076090e-05, /* 0xb8a670cd */ +Q4 = 4.0082177293e-06, /* 0x36867e54 */ +Q5 = -2.0109921195e-07; /* 0xb457edbb */ + +#ifdef __STDC__ + float __expm1f(float x) +#else + float __expm1f(x) + float x; +#endif +{ + float y,hi,lo,c,t,e,hxs,hfx,r1; + int32_t k,xsb; + u_int32_t hx; + + GET_FLOAT_WORD(hx,x); + xsb = hx&0x80000000; /* sign bit of x */ + if(xsb==0) y=x; else y= -x; /* y = |x| */ + hx &= 0x7fffffff; /* high word of |x| */ + + /* filter out huge and non-finite argument */ + if(hx >= 0x4195b844) { /* if |x|>=27*ln2 */ + if(hx >= 0x42b17218) { /* if |x|>=88.721... */ + if(hx>0x7f800000) + return x+x; /* NaN */ + if(hx==0x7f800000) + return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ + if(x > o_threshold) return huge*huge; /* overflow */ + } + if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */ + if(x+tiny<(float)0.0) /* raise inexact */ + return tiny-one; /* return -1 */ + } + } + + /* argument reduction */ + if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ + if(xsb==0) + {hi = x - ln2_hi; lo = ln2_lo; k = 1;} + else + {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} + } else { + k = invln2*x+((xsb==0)?(float)0.5:(float)-0.5); + t = k; + hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ + lo = t*ln2_lo; + } + x = hi - lo; + c = (hi-x)-lo; + } + else if(hx < 0x33000000) { /* when |x|<2**-25, return x */ + t = huge+x; /* return x with inexact flags when x!=0 */ + return x - (t-(huge+x)); + } + else k = 0; + + /* x is now in primary range */ + hfx = (float)0.5*x; + hxs = x*hfx; + r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); + t = (float)3.0-r1*hfx; + e = hxs*((r1-t)/((float)6.0 - x*t)); + if(k==0) return x - (x*e-hxs); /* c is 0 */ + else { + e = (x*(e-c)-c); + e -= hxs; + if(k== -1) return (float)0.5*(x-e)-(float)0.5; + if(k==1) { + if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5)); + else return one+(float)2.0*(x-e); + } + if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ + int32_t i; + y = one-(e-x); + GET_FLOAT_WORD(i,y); + SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ + return y-one; + } + t = one; + if(k<23) { + int32_t i; + SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */ + y = t-(e-x); + GET_FLOAT_WORD(i,y); + SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ + } else { + int32_t i; + SET_FLOAT_WORD(t,((0x7f-k)<<23)); /* 2^-k */ + y = x-(e+t); + y += one; + GET_FLOAT_WORD(i,y); + SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ + } + } + return y; +} +weak_alias (__expm1f, expm1f) diff --git a/sysdeps/ieee754/flt-32/s_fabsf.c b/sysdeps/ieee754/flt-32/s_fabsf.c new file mode 100644 index 0000000000..6b1451379f --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_fabsf.c @@ -0,0 +1,39 @@ +/* s_fabsf.c -- float version of s_fabs.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_fabsf.c,v 1.4 1995/05/10 20:47:15 jtc Exp $"; +#endif + +/* + * fabsf(x) returns the absolute value of x. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __fabsf(float x) +#else + float __fabsf(x) + float x; +#endif +{ + u_int32_t ix; + GET_FLOAT_WORD(ix,x); + SET_FLOAT_WORD(x,ix&0x7fffffff); + return x; +} +weak_alias (__fabsf, fabsf) diff --git a/sysdeps/ieee754/flt-32/s_finitef.c b/sysdeps/ieee754/flt-32/s_finitef.c new file mode 100644 index 0000000000..baafc31aec --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_finitef.c @@ -0,0 +1,39 @@ +/* s_finitef.c -- float version of s_finite.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_finitef.c,v 1.4 1995/05/10 20:47:18 jtc Exp $"; +#endif + +/* + * finitef(x) returns 1 is x is finite, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __finitef(float x) +#else + int __finitef(x) + float x; +#endif +{ + int32_t ix; + GET_FLOAT_WORD(ix,x); + return (int)((u_int32_t)((ix&0x7fffffff)-0x7f800000)>>31); +} +weak_alias (__finitef, finitef) diff --git a/sysdeps/ieee754/flt-32/s_floorf.c b/sysdeps/ieee754/flt-32/s_floorf.c new file mode 100644 index 0000000000..e8822b0884 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_floorf.c @@ -0,0 +1,71 @@ +/* s_floorf.c -- float version of s_floor.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_floorf.c,v 1.4 1995/05/10 20:47:22 jtc Exp $"; +#endif + +/* + * floorf(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floorf(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float huge = 1.0e30; +#else +static float huge = 1.0e30; +#endif + +#ifdef __STDC__ + float __floorf(float x) +#else + float __floorf(x) + float x; +#endif +{ + int32_t i0,j0; + u_int32_t i; + GET_FLOAT_WORD(i0,x); + j0 = ((i0>>23)&0xff)-0x7f; + if(j0<23) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=0;} + else if((i0&0x7fffffff)!=0) + { i0=0xbf800000;} + } + } else { + i = (0x007fffff)>>j0; + if((i0&i)==0) return x; /* x is integral */ + if(huge+x>(float)0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00800000)>>j0; + i0 &= (~i); + } + } + } else { + if(j0==0x80) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } + SET_FLOAT_WORD(x,i0); + return x; +} +weak_alias (__floorf, floorf) diff --git a/sysdeps/ieee754/flt-32/s_fpclassifyf.c b/sysdeps/ieee754/flt-32/s_fpclassifyf.c new file mode 100644 index 0000000000..a6b35cfe1b --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_fpclassifyf.c @@ -0,0 +1,42 @@ +/* Return classification value corresponding to argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +int +__fpclassifyf (float x) +{ + u_int32_t wx; + int retval = FP_NORMAL; + + GET_FLOAT_WORD (wx, x); + wx &= 0x7fffffff; + if (wx == 0) + retval = FP_ZERO; + else if (wx < 0x1000000) + retval = FP_SUBNORMAL; + else if (wx >= 0x7f800000) + retval = wx > 0x7f800000 ? FP_NAN : FP_INFINITE; + + return retval; +} diff --git a/sysdeps/ieee754/flt-32/s_frexpf.c b/sysdeps/ieee754/flt-32/s_frexpf.c new file mode 100644 index 0000000000..a984457a87 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_frexpf.c @@ -0,0 +1,53 @@ +/* s_frexpf.c -- float version of s_frexp.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_frexpf.c,v 1.5 1995/05/10 20:47:26 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +two25 = 3.3554432000e+07; /* 0x4c000000 */ + +#ifdef __STDC__ + float __frexpf(float x, int *eptr) +#else + float __frexpf(x, eptr) + float x; int *eptr; +#endif +{ + int32_t hx,ix; + GET_FLOAT_WORD(hx,x); + ix = 0x7fffffff&hx; + *eptr = 0; + if(ix>=0x7f800000||(ix==0)) return x; /* 0,inf,nan */ + if (ix<0x00800000) { /* subnormal */ + x *= two25; + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + *eptr = -25; + } + *eptr += (ix>>23)-126; + hx = (hx&0x807fffff)|0x3f000000; + *(int*)&x = hx; + return x; +} +weak_alias (__frexpf, frexpf) diff --git a/sysdeps/ieee754/flt-32/s_ilogbf.c b/sysdeps/ieee754/flt-32/s_ilogbf.c new file mode 100644 index 0000000000..e652b93619 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_ilogbf.c @@ -0,0 +1,44 @@ +/* s_ilogbf.c -- float version of s_ilogb.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_ilogbf.c,v 1.4 1995/05/10 20:47:31 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __ilogbf(float x) +#else + int __ilogbf(x) + float x; +#endif +{ + int32_t hx,ix; + + GET_FLOAT_WORD(hx,x); + hx &= 0x7fffffff; + if(hx<0x00800000) { + if(hx==0) + return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ + else /* subnormal x */ + for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; + return ix; + } + else if (hx<0x7f800000) return (hx>>23)-127; + else return FP_ILOGBNAN; +} +weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/ieee754/flt-32/s_isinff.c b/sysdeps/ieee754/flt-32/s_isinff.c new file mode 100644 index 0000000000..efc0935251 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_isinff.c @@ -0,0 +1,28 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $"; +#endif + +/* + * isinff(x) returns 1 if x is inf, -1 if x is -inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +int +__isinff (float x) +{ + int32_t ix,t; + GET_FLOAT_WORD(ix,x); + t = ix & 0x7fffffff; + t ^= 0x7f800000; + t |= -t; + return ~(t >> 31) & (ix >> 30); +} +weak_alias (__isinff, isinff) diff --git a/sysdeps/ieee754/flt-32/s_isnanf.c b/sysdeps/ieee754/flt-32/s_isnanf.c new file mode 100644 index 0000000000..9ec412fd66 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_isnanf.c @@ -0,0 +1,41 @@ +/* s_isnanf.c -- float version of s_isnan.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_isnanf.c,v 1.4 1995/05/10 20:47:38 jtc Exp $"; +#endif + +/* + * isnanf(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanf(float x) +#else + int __isnanf(x) + float x; +#endif +{ + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + ix = 0x7f800000 - ix; + return (int)(((u_int32_t)(ix))>>31); +} +weak_alias (__isnanf, isnanf) diff --git a/sysdeps/ieee754/flt-32/s_llrintf.c b/sysdeps/ieee754/flt-32/s_llrintf.c new file mode 100644 index 0000000000..a812377d19 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_llrintf.c @@ -0,0 +1,78 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const double two23[2] = +{ + 8.3886080000e+06, /* 0x4B000000 */ + -8.3886080000e+06, /* 0xCB000000 */ +}; + + +long long int +__llrintf (float x) +{ + int32_t j0; + u_int32_t i0; + volatile float w; + float t; + long long int result; + int sx; + + GET_FLOAT_WORD (i0, x); + + sx = i0 >> 31; + j0 = ((i0 >> 23) & 0xff) - 0x7f; + i0 &= 0x7fffff; + i0 |= 0x800000; + + if (j0 < (int32_t) (sizeof (long long int) * 8) - 1) + { + if (j0 < -1) + return 0; + else if (j0 >= 23) + result = (long long int) i0 << (j0 - 23); + else + { + w = two23[sx] + x; + t = w - two23[sx]; + GET_FLOAT_WORD (i0, t); + j0 = ((i0 >> 23) & 0xff) - 0x7f; + i0 &= 0x7fffff; + i0 |= 0x800000; + + result = i0 >> (23 - j0); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__llrintf, llrintf) diff --git a/sysdeps/ieee754/flt-32/s_llroundf.c b/sysdeps/ieee754/flt-32/s_llroundf.c new file mode 100644 index 0000000000..9aad81fd45 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_llroundf.c @@ -0,0 +1,63 @@ +/* Round float value to long long int. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long long int +__llroundf (float x) +{ + int32_t j0; + u_int32_t i; + long long int result; + int sign; + + GET_FLOAT_WORD (i, x); + j0 = ((i >> 23) & 0xff) - 0x7f; + sign = (i & 0x80000000) != 0 ? -1 : 1; + i &= 0x7fffff; + i |= 0x800000; + + if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else if (j0 >= 23) + result = (long long int) i << (j0 - 23); + else + { + i += 0x400000 >> j0; + + result = i >> (23 - j0); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sign * result; +} + +weak_alias (__llroundf, llroundf) diff --git a/sysdeps/ieee754/flt-32/s_log1pf.c b/sysdeps/ieee754/flt-32/s_log1pf.c new file mode 100644 index 0000000000..bd3d57635c --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_log1pf.c @@ -0,0 +1,115 @@ +/* s_log1pf.c -- float version of s_log1p.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_log1pf.c,v 1.4 1995/05/10 20:47:48 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 */ +Lp1 = 6.6666668653e-01, /* 3F2AAAAB */ +Lp2 = 4.0000000596e-01, /* 3ECCCCCD */ +Lp3 = 2.8571429849e-01, /* 3E924925 */ +Lp4 = 2.2222198546e-01, /* 3E638E29 */ +Lp5 = 1.8183572590e-01, /* 3E3A3325 */ +Lp6 = 1.5313838422e-01, /* 3E1CD04F */ +Lp7 = 1.4798198640e-01; /* 3E178897 */ + +#ifdef __STDC__ +static const float zero = 0.0; +#else +static float zero = 0.0; +#endif + +#ifdef __STDC__ + float __log1pf(float x) +#else + float __log1pf(x) + float x; +#endif +{ + float hfsq,f,c,s,z,R,u; + int32_t k,hx,hu,ax; + + GET_FLOAT_WORD(hx,x); + ax = hx&0x7fffffff; + + k = 1; + if (hx < 0x3ed413d7) { /* x < 0.41422 */ + if(ax>=0x3f800000) { /* x <= -1.0 */ + if(x==(float)-1.0) return -two25/(x-x); /* log1p(-1)=+inf */ + else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ + } + if(ax<0x31000000) { /* |x| < 2**-29 */ + if(two25+x>zero /* raise inexact */ + &&ax<0x24800000) /* |x| < 2**-54 */ + return x; + else + return x - x*x*(float)0.5; + } + if(hx>0||hx<=((int32_t)0xbe95f61f)) { + k=0;f=x;hu=1;} /* -0.2929= 0x7f800000) return x+x; + if(k!=0) { + if(hx<0x5a000000) { + u = (float)1.0+x; + GET_FLOAT_WORD(hu,u); + k = (hu>>23)-127; + /* correction term */ + c = (k>0)? (float)1.0-(u-x):x-(u-(float)1.0); + c /= u; + } else { + u = x; + GET_FLOAT_WORD(hu,u); + k = (hu>>23)-127; + c = 0; + } + hu &= 0x007fffff; + if(hu<0x3504f7) { + SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */ + } else { + k += 1; + SET_FLOAT_WORD(u,hu|0x3f000000); /* normalize u/2 */ + hu = (0x00800000-hu)>>2; + } + f = u-(float)1.0; + } + hfsq=(float)0.5*f*f; + if(hu==0) { /* |f| < 2**-20 */ + if(f==zero) { + if(k==0) return zero; + else {c += k*ln2_lo; return k*ln2_hi+c;} + } + R = hfsq*((float)1.0-(float)0.66666666666666666*f); + if(k==0) return f-R; else + return k*ln2_hi-((R-(k*ln2_lo+c))-f); + } + s = f/((float)2.0+f); + z = s*s; + R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); +} +weak_alias (__log1pf, log1pf) diff --git a/sysdeps/ieee754/flt-32/s_log2f.c b/sysdeps/ieee754/flt-32/s_log2f.c new file mode 100644 index 0000000000..2377acd36a --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_log2f.c @@ -0,0 +1,91 @@ +/* e_logf.c -- float version of e_log.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + * adapted for log2 by Ulrich Drepper + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + + +#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 */ +Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ +Lg3 = 2.8571429849e-01, /* 3E924925 */ +Lg4 = 2.2222198546e-01, /* 3E638E29 */ +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 __log2f(float x) +#else + float __log2f(x) + float x; +#endif +{ + float hfsq,f,s,z,R,w,t1,t2,dk; + int32_t k,ix,i,j; + + GET_FLOAT_WORD(ix,x); + + k=0; + if (ix < 0x00800000) { /* x < 2**-126 */ + if ((ix&0x7fffffff)==0) + return -two25/(x-x); /* log(+-0)=-inf */ + if (ix<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; + k += (ix>>23)-127; + ix &= 0x007fffff; + i = (ix+(0x95f64<<3))&0x800000; + SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ + k += (i>>23); + dk = (float)k; + f = x-(float)1.0; + if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ + if(f==zero) return dk; + R = f*f*((float)0.5-(float)0.33333333333333333*f); + return dk-(R-f)/ln2; + } + s = f/((float)2.0+f); + z = s*s; + i = ix-(0x6147a<<3); + w = z*z; + j = (0x6b851<<3)-ix; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=(float)0.5*f*f; + return dk-((hfsq-(s*(hfsq+R)))-f)/ln2; + } else { + return dk-((s*(f-R))-f)/ln2; + } +} +weak_alias (__log2f, log2f) diff --git a/sysdeps/ieee754/flt-32/s_logbf.c b/sysdeps/ieee754/flt-32/s_logbf.c new file mode 100644 index 0000000000..ade892a8f9 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_logbf.c @@ -0,0 +1,40 @@ +/* s_logbf.c -- float version of s_logb.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_logbf.c,v 1.4 1995/05/10 20:47:51 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __logbf(float x) +#else + float __logbf(x) + float x; +#endif +{ + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; /* high |x| */ + if(ix==0) return (float)-1.0/fabsf(x); + if(ix>=0x7f800000) return x*x; + if((ix>>=23)==0) /* IEEE 754 logb */ + return -126.0; + else + return (float) (ix-127); +} +weak_alias (__logbf, logbf) diff --git a/sysdeps/ieee754/flt-32/s_lrintf.c b/sysdeps/ieee754/flt-32/s_lrintf.c new file mode 100644 index 0000000000..210ffec501 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_lrintf.c @@ -0,0 +1,78 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const double two23[2] = +{ + 8.3886080000e+06, /* 0x4B000000 */ + -8.3886080000e+06, /* 0xCB000000 */ +}; + + +long int +__lrintf (float x) +{ + int32_t j0; + u_int32_t i0; + volatile float w; + float t; + long int result; + int sx; + + GET_FLOAT_WORD (i0, x); + + sx = i0 >> 31; + j0 = ((i0 >> 23) & 0xff) - 0x7f; + i0 &= 0x7fffff; + i0 |= 0x800000; + + if (j0 < (int32_t) (sizeof (long int) * 8) - 1) + { + if (j0 < -1) + return 0; + else if (j0 >= 23) + result = (long int) i0 << (j0 - 23); + else + { + w = two23[sx] + x; + t = w - two23[sx]; + GET_FLOAT_WORD (i0, t); + j0 = ((i0 >> 23) & 0xff) - 0x7f; + i0 &= 0x7fffff; + i0 |= 0x800000; + + result = i0 >> (23 - j0); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__lrintf, lrintf) diff --git a/sysdeps/ieee754/flt-32/s_lroundf.c b/sysdeps/ieee754/flt-32/s_lroundf.c new file mode 100644 index 0000000000..df1d242e2a --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_lroundf.c @@ -0,0 +1,63 @@ +/* Round float value to long int. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long int +__lroundf (float x) +{ + int32_t j0; + u_int32_t i; + long int result; + int sign; + + GET_FLOAT_WORD (i, x); + j0 = ((i >> 23) & 0xff) - 0x7f; + sign = (i & 0x80000000) != 0 ? -1 : 1; + i &= 0x7fffff; + i |= 0x800000; + + if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else if (j0 >= 23) + result = (long int) i << (j0 - 23); + else + { + i += 0x400000 >> j0; + + result = i >> (23 - j0); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sign * result; +} + +weak_alias (__lroundf, lroundf) diff --git a/sysdeps/ieee754/flt-32/s_modff.c b/sysdeps/ieee754/flt-32/s_modff.c new file mode 100644 index 0000000000..e6c22b2add --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_modff.c @@ -0,0 +1,66 @@ +/* s_modff.c -- float version of s_modf.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_modff.c,v 1.4 1995/05/10 20:47:56 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float one = 1.0; +#else +static float one = 1.0; +#endif + +#ifdef __STDC__ + float __modff(float x, float *iptr) +#else + float __modff(x, iptr) + float x,*iptr; +#endif +{ + int32_t i0,j0; + u_int32_t i; + GET_FLOAT_WORD(i0,x); + j0 = ((i0>>23)&0xff)-0x7f; /* exponent of x */ + if(j0<23) { /* integer part in x */ + if(j0<0) { /* |x|<1 */ + SET_FLOAT_WORD(*iptr,i0&0x80000000); /* *iptr = +-0 */ + return x; + } else { + i = (0x007fffff)>>j0; + if((i0&i)==0) { /* x is integral */ + u_int32_t ix; + *iptr = x; + GET_FLOAT_WORD(ix,x); + SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */ + return x; + } else { + SET_FLOAT_WORD(*iptr,i0&(~i)); + return x - *iptr; + } + } + } else { /* no fraction part */ + *iptr = x*one; + /* We must handle NaNs separately. */ + if (j0 == 0x80 && (i0 & 0x7fffff)) + return x*one; + SET_FLOAT_WORD(x,i0&0x80000000); /* return +-0 */ + return x; + } +} +weak_alias (__modff, modff) diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c new file mode 100644 index 0000000000..7d6f262f51 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c @@ -0,0 +1,77 @@ +/* s_rintf.c -- float version of s_rint.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ +/* Adapted for use as nearbyint by Ulrich Drepper . */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + + +#include +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +TWO23[2]={ + 8.3886080000e+06, /* 0x4b000000 */ + -8.3886080000e+06, /* 0xcb000000 */ +}; + +#ifdef __STDC__ + float __nearbyintf(float x) +#else + float __nearbyintf(x) + float x; +#endif +{ + fenv_t env; + int32_t i0,j0,sx; + u_int32_t i,i1; + float w,t; + GET_FLOAT_WORD(i0,x); + sx = (i0>>31)&1; + j0 = ((i0>>23)&0xff)-0x7f; + if(j0<23) { + if(j0<0) { + if((i0&0x7fffffff)==0) return x; + i1 = (i0&0x07fffff); + i0 &= 0xfff00000; + i0 |= ((i1|-i1)>>9)&0x400000; + SET_FLOAT_WORD(x,i0); + feholdexcept (&env); + w = TWO23[sx]+x; + t = w-TWO23[sx]; + fesetenv (&env); + GET_FLOAT_WORD(i0,t); + SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); + return t; + } else { + i = (0x007fffff)>>j0; + if((i0&i)==0) return x; /* x is integral */ + i>>=1; + if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); + } + } else { + if(j0==0x80) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } + SET_FLOAT_WORD(x,i0); + feholdexcept (&env); + w = TWO23[sx]+x; + t = w-TWO23[sx]; + fesetenv (&env); + return t; +} +weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/ieee754/flt-32/s_nextafterf.c b/sysdeps/ieee754/flt-32/s_nextafterf.c new file mode 100644 index 0000000000..611742bdf4 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_nextafterf.c @@ -0,0 +1,71 @@ +/* s_nextafterf.c -- float version of s_nextafter.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __nextafterf(float x, float y) +#else + float __nextafterf(x,y) + float x,y; +#endif +{ + int32_t hx,hy,ix,iy; + + GET_FLOAT_WORD(hx,x); + GET_FLOAT_WORD(hy,y); + ix = hx&0x7fffffff; /* |x| */ + iy = hy&0x7fffffff; /* |y| */ + + if((ix>0x7f800000) || /* x is nan */ + (iy>0x7f800000)) /* y is nan */ + return x+y; + if(x==y) return y; /* x=y, return y */ + if(ix==0) { /* x == 0 */ + SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(hx>hy) { /* x > y, x -= ulp */ + hx -= 1; + } else { /* x < y, x += ulp */ + hx += 1; + } + } else { /* x < 0 */ + if(hy>=0||hx>hy){ /* x < y, x -= ulp */ + hx -= 1; + } else { /* x > y, x += ulp */ + hx += 1; + } + } + hy = hx&0x7f800000; + if(hy>=0x7f800000) return x+x; /* overflow */ + if(hy<0x00800000) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_FLOAT_WORD(y,hx); + return y; + } + } + SET_FLOAT_WORD(x,hx); + return x; +} +weak_alias (__nextafterf, nextafterf) diff --git a/sysdeps/ieee754/flt-32/s_remquof.c b/sysdeps/ieee754/flt-32/s_remquof.c new file mode 100644 index 0000000000..2ffd16c903 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_remquof.c @@ -0,0 +1,108 @@ +/* Compute remainder and a congruent to the quotient. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const float zero = 0.0; + + +float +__remquof (float x, float y, int *quo) +{ + int32_t hx,hy; + u_int32_t sx; + int cquo, qs; + + GET_FLOAT_WORD (hx, x); + GET_FLOAT_WORD (hy, y); + sx = hx & 0x80000000; + qs = sx ^ (hy & 0x80000000); + hy &= 0x7fffffff; + hx &= 0x7fffffff; + + /* Purge off exception values. */ + if (hy == 0) + return (x * y) / (x * y); /* y = 0 */ + if ((hx >= 0x7f800000) /* x not finite */ + || (hy > 0x7f800000)) /* y is NaN */ + return (x * y) / (x * y); + + if (hy <= 0x7dffffff) + x = __ieee754_fmodf (x, 8 * y); /* now x < 8y */ + + if ((hx - hy) == 0) + { + *quo = qs ? -1 : 1; + return zero * x; + } + + x = fabsf (x); + y = fabsf (y); + cquo = 0; + + if (x >= 4 * y) + { + x -= 4 * y; + cquo += 4; + } + if (x >= 2 * y) + { + x -= 2 * y; + cquo += 2; + } + + if (hy < 0x01000000) + { + if (x + x > y) + { + x -= y; + ++cquo; + if (x + x >= y) + { + x -= y; + ++cquo; + } + } + } + else + { + float y_half = 0.5 * y; + if (x > y_half) + { + x -= y; + ++cquo; + if (x >= y_half) + { + x -= y; + ++cquo; + } + } + } + + *quo = qs ? -cquo : cquo; + + if (sx) + x = -x; + return x; +} +weak_alias (__remquof, remquof) diff --git a/sysdeps/ieee754/flt-32/s_rintf.c b/sysdeps/ieee754/flt-32/s_rintf.c new file mode 100644 index 0000000000..4e5b409b29 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_rintf.c @@ -0,0 +1,72 @@ +/* s_rintf.c -- float version of s_rint.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_rintf.c,v 1.4 1995/05/10 20:48:06 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +TWO23[2]={ + 8.3886080000e+06, /* 0x4b000000 */ + -8.3886080000e+06, /* 0xcb000000 */ +}; + +#ifdef __STDC__ + float __rintf(float x) +#else + float __rintf(x) + float x; +#endif +{ + int32_t i0,j0,sx; + u_int32_t i,i1; + float w,t; + GET_FLOAT_WORD(i0,x); + sx = (i0>>31)&1; + j0 = ((i0>>23)&0xff)-0x7f; + if(j0<23) { + if(j0<0) { + if((i0&0x7fffffff)==0) return x; + i1 = (i0&0x07fffff); + i0 &= 0xfff00000; + i0 |= ((i1|-i1)>>9)&0x400000; + SET_FLOAT_WORD(x,i0); + w = TWO23[sx]+x; + t = w-TWO23[sx]; + GET_FLOAT_WORD(i0,t); + SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); + return t; + } else { + i = (0x007fffff)>>j0; + if((i0&i)==0) return x; /* x is integral */ + i>>=1; + if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); + } + } else { + if(j0==0x80) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } + SET_FLOAT_WORD(x,i0); + w = TWO23[sx]+x; + return w-TWO23[sx]; +} +weak_alias (__rintf, rintf) diff --git a/sysdeps/ieee754/flt-32/s_roundf.c b/sysdeps/ieee754/flt-32/s_roundf.c new file mode 100644 index 0000000000..5dc0e368ff --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_roundf.c @@ -0,0 +1,73 @@ +/* Round float to integer away from zero. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const float huge = 1.0e30; + + +float +__roundf (float x) +{ + int32_t i0, j0; + + GET_FLOAT_WORD (i0, x); + j0 = ((i0 >> 23) & 0xff) - 0x7f; + if (j0 < 23) + { + if (j0 < 0) + { + if (huge + x > 0.0F) + { + i0 &= 0x80000000; + if (j0 == -1) + i0 |= 0x3f800000; + } + } + else + { + u_int32_t i = 0x007fffff >> j0; + if ((i0 & i) == 0) + /* X is integral. */ + return x; + if (huge + x > 0.0F) + { + /* Raise inexact if x != 0. */ + i0 += 0x00400000 >> j0; + i0 &= ~i; + } + } + } + else + { + if (j0 == 0x80) + /* Inf or NaN. */ + return x + x; + else + return x; + } + + SET_FLOAT_WORD (x, i0); + return x; +} +weak_alias (__roundf, roundf) diff --git a/sysdeps/ieee754/flt-32/s_scalblnf.c b/sysdeps/ieee754/flt-32/s_scalblnf.c new file mode 100644 index 0000000000..4ed48733cf --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_scalblnf.c @@ -0,0 +1,63 @@ +/* s_scalbnf.c -- float version of s_scalbn.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +two25 = 3.355443200e+07, /* 0x4c000000 */ +twom25 = 2.9802322388e-08, /* 0x33000000 */ +huge = 1.0e+30, +tiny = 1.0e-30; + +#ifdef __STDC__ + float __scalblnf (float x, long int n) +#else + float __scalblnf (x,n) + float x; long int n; +#endif +{ + int32_t k,ix; + GET_FLOAT_WORD(ix,x); + k = (ix&0x7f800000)>>23; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((ix&0x7fffffff)==0) return x; /* +-0 */ + x *= two25; + GET_FLOAT_WORD(ix,x); + k = ((ix&0x7f800000)>>23) - 25; + } + if (k==0xff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0xfe) + return huge*copysignf(huge,x); /* overflow */ + if (n< -50000) + return tiny*copysignf(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} + if (k <= -25) + return tiny*copysignf(tiny,x); /*underflow*/ + k += 25; /* subnormal result */ + SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); + return x*twom25; +} +weak_alias (__scalblnf, scalblnf) diff --git a/sysdeps/ieee754/flt-32/s_scalbnf.c b/sysdeps/ieee754/flt-32/s_scalbnf.c new file mode 100644 index 0000000000..11b77bd6c2 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_scalbnf.c @@ -0,0 +1,63 @@ +/* s_scalbnf.c -- float version of s_scalbn.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +two25 = 3.355443200e+07, /* 0x4c000000 */ +twom25 = 2.9802322388e-08, /* 0x33000000 */ +huge = 1.0e+30, +tiny = 1.0e-30; + +#ifdef __STDC__ + float __scalbnf (float x, int n) +#else + float __scalbnf (x,n) + float x; int n; +#endif +{ + int32_t k,ix; + GET_FLOAT_WORD(ix,x); + k = (ix&0x7f800000)>>23; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((ix&0x7fffffff)==0) return x; /* +-0 */ + x *= two25; + GET_FLOAT_WORD(ix,x); + k = ((ix&0x7f800000)>>23) - 25; + } + if (k==0xff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0xfe) + return huge*copysignf(huge,x); /* overflow */ + if (n< -50000) + return tiny*copysignf(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} + if (k <= -25) + return tiny*copysignf(tiny,x); /*underflow*/ + k += 25; /* subnormal result */ + SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); + return x*twom25; +} +weak_alias (__scalbnf, scalbnf) diff --git a/sysdeps/ieee754/flt-32/s_signbitf.c b/sysdeps/ieee754/flt-32/s_signbitf.c new file mode 100644 index 0000000000..85418ea73f --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_signbitf.c @@ -0,0 +1,32 @@ +/* Return nonzero value if number is negative. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +int +__signbitf (float x) +{ + int32_t hx; + + GET_FLOAT_WORD (hx, x); + return hx & 0x80000000; +} diff --git a/sysdeps/ieee754/flt-32/s_sincosf.c b/sysdeps/ieee754/flt-32/s_sincosf.c new file mode 100644 index 0000000000..0fd7b0ca8b --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_sincosf.c @@ -0,0 +1,74 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +void +__sincosf (float x, float *sinx, float *cosx) +{ + int32_t ix; + + /* High word of x. */ + GET_FLOAT_WORD (ix, x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if (ix <= 0x3f490fd8) + { + *sinx = __kernel_sinf (x, 0.0, 0); + *cosx = __kernel_cosf (x, 0.0); + } + else if (ix>=0x7ff00000) + { + /* sin(Inf or NaN) is NaN */ + *sinx = *cosx = x - x; + } + else + { + /* Argument reduction needed. */ + float y[2]; + int n; + + n = __ieee754_rem_pio2f (x, y); + switch (n & 3) + { + case 0: + *sinx = __kernel_sinf (y[0], y[1], 1); + *cosx = __kernel_cosf (y[0], y[1]); + break; + case 1: + *sinx = __kernel_cosf (y[0], y[1]); + *cosx = -__kernel_sinf (y[0], y[1], 1); + break; + case 2: + *sinx = -__kernel_sinf (y[0], y[1], 1); + *cosx = -__kernel_cosf (y[0], y[1]); + break; + default: + *sinx = -__kernel_cosf (y[0], y[1]); + *cosx = __kernel_sinf (y[0], y[1], 1); + break; + } + } +} +weak_alias (__sincosf, sincosf) diff --git a/sysdeps/ieee754/flt-32/s_sinf.c b/sysdeps/ieee754/flt-32/s_sinf.c new file mode 100644 index 0000000000..76a7c21fcb --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_sinf.c @@ -0,0 +1,54 @@ +/* s_sinf.c -- float version of s_sin.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __sinf(float x) +#else + float __sinf(x) + float x; +#endif +{ + float y[2],z=0.0; + int32_t n, ix; + + GET_FLOAT_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0); + + /* sin(Inf or NaN) is NaN */ + else if (ix>=0x7f800000) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2f(x,y); + switch(n&3) { + case 0: return __kernel_sinf(y[0],y[1],1); + case 1: return __kernel_cosf(y[0],y[1]); + case 2: return -__kernel_sinf(y[0],y[1],1); + default: + return -__kernel_cosf(y[0],y[1]); + } + } +} +weak_alias (__sinf, sinf) diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c new file mode 100644 index 0000000000..e8f6016c32 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_tanf.c @@ -0,0 +1,49 @@ +/* s_tanf.c -- float version of s_tan.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __tanf(float x) +#else + float __tanf(x) + float x; +#endif +{ + float y[2],z=0.0; + int32_t n, ix; + + GET_FLOAT_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1); + + /* tan(Inf or NaN) is NaN */ + else if (ix>=0x7f800000) return x-x; /* NaN */ + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2f(x,y); + return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even + -1 -- n odd */ + } +} +weak_alias (__tanf, tanf) diff --git a/sysdeps/ieee754/flt-32/s_tanhf.c b/sysdeps/ieee754/flt-32/s_tanhf.c new file mode 100644 index 0000000000..2a0ca9f3df --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_tanhf.c @@ -0,0 +1,67 @@ +/* s_tanhf.c -- float version of s_tanh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_tanhf.c,v 1.4 1995/05/10 20:48:24 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float one=1.0, two=2.0, tiny = 1.0e-30; +#else +static float one=1.0, two=2.0, tiny = 1.0e-30; +#endif + +#ifdef __STDC__ + float __tanhf(float x) +#else + float __tanhf(x) + float x; +#endif +{ + float t,z; + int32_t jx,ix; + + GET_FLOAT_WORD(jx,x); + ix = jx&0x7fffffff; + + /* x is INF or NaN */ + if(ix>=0x7f800000) { + if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ + else return one/x-one; /* tanh(NaN) = NaN */ + } + + /* |x| < 22 */ + if (ix < 0x41b00000) { /* |x|<22 */ + if (ix == 0) + return x; /* x == +-0 */ + if (ix<0x24000000) /* |x|<2**-55 */ + return x*(one+x); /* tanh(small) = small */ + if (ix>=0x3f800000) { /* |x|>=1 */ + t = __expm1f(two*fabsf(x)); + z = one - two/(t+two); + } else { + t = __expm1f(-two*fabsf(x)); + z= -t/(t+two); + } + /* |x| > 22, return +-1 */ + } else { + z = one - tiny; /* raised inexact flag */ + } + return (jx>=0)? z: -z; +} +weak_alias (__tanhf, tanhf) diff --git a/sysdeps/ieee754/flt-32/s_truncf.c b/sysdeps/ieee754/flt-32/s_truncf.c new file mode 100644 index 0000000000..feb6b6f23a --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_truncf.c @@ -0,0 +1,52 @@ +/* Truncate argument to nearest integral value not larger than the argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +float +__truncf (float x) +{ + int32_t i0, j0; + int sx; + + GET_FLOAT_WORD (i0, x); + sx = i0 & 0x80000000; + j0 = ((i0 >> 23) & 0xff) - 0x7f; + if (j0 < 23) + { + if (j0 < 0) + /* The magnitude of the number is < 1 so the result is +-0. */ + SET_FLOAT_WORD (x, sx); + else + SET_FLOAT_WORD (x, sx | (i0 & ~(0x007fffff >> j0))); + } + else + { + if (j0 == 0x80) + /* x is inf or NaN. */ + return x + x; + } + + return x; +} +weak_alias (__truncf, truncf) diff --git a/sysdeps/ieee754/flt-32/t_exp2f.h b/sysdeps/ieee754/flt-32/t_exp2f.h new file mode 100644 index 0000000000..e15d15787c --- /dev/null +++ b/sysdeps/ieee754/flt-32/t_exp2f.h @@ -0,0 +1,352 @@ +/* Accurate tables for exp2f(). + Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Geoffrey Keating + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This table has the property that, for all integers -128 <= i <= 127, + exp(i/256.0 + __exp2f_deltatable[i-128]) == __exp2f_atable[i+128] + r + for some -2^-35 < r < 2^-35 (abs(r) < 2^-36 if i <= 0); and that + __exp2f_deltatable[i+128] == t * 2^-30 + for integer t so that abs(t) <= 43447 * 2^0. */ + +#define W30 (9.31322575e-10) +static const float __exp2f_deltatable[256] = { + -810*W30, 283*W30, -1514*W30, 1304*W30, + -1148*W30, -98*W30, -744*W30, -156*W30, + -419*W30, -155*W30, 474*W30, 167*W30, + -1984*W30, -826*W30, 692*W30, 781*W30, + -578*W30, -411*W30, -129*W30, -1500*W30, + 654*W30, -141*W30, -816*W30, -53*W30, + 148*W30, 493*W30, -2214*W30, 760*W30, + 260*W30, 750*W30, -1300*W30, 1424*W30, + -1445*W30, -339*W30, -680*W30, -349*W30, + -922*W30, 531*W30, 193*W30, -2892*W30, + 290*W30, -2145*W30, -276*W30, 485*W30, + -695*W30, 215*W30, -7093*W30, 412*W30, + -4596*W30, 367*W30, 592*W30, -615*W30, + -97*W30, -1066*W30, 972*W30, -226*W30, + -625*W30, -374*W30, -5647*W30, -180*W30, + 20349*W30, -447*W30, 111*W30, -4164*W30, + -87*W30, -21*W30, -251*W30, 66*W30, + -517*W30, 2093*W30, -263*W30, 182*W30, + -601*W30, 475*W30, -483*W30, -1251*W30, + -373*W30, 1471*W30, -92*W30, -215*W30, + -97*W30, -190*W30, 0*W30, -290*W30, + -2647*W30, 1940*W30, -582*W30, 28*W30, + 833*W30, 1493*W30, 34*W30, 321*W30, + 3327*W30, -35*W30, 177*W30, -135*W30, + -796*W30, -428*W30, 129*W30, 9332*W30, + -12*W30, -69*W30, -1743*W30, 6508*W30, + -60*W30, 359*W30, 43447*W30, 15*W30, + -23*W30, -305*W30, -375*W30, -652*W30, + 667*W30, 269*W30, -1575*W30, 185*W30, + -329*W30, 200*W30, 6002*W30, 163*W30, + -647*W30, 19*W30, -603*W30, -755*W30, + 742*W30, -438*W30, 3587*W30, 2560*W30, + 0*W30, -520*W30, -241*W30, -299*W30, + -1270*W30, -991*W30, -1138*W30, 255*W30, + -1192*W30, 1722*W30, 1023*W30, 3700*W30, + -1388*W30, -1551*W30, -2549*W30, 27*W30, + 282*W30, 673*W30, 113*W30, 1561*W30, + 72*W30, 873*W30, 87*W30, -395*W30, + -433*W30, 629*W30, 3440*W30, -284*W30, + -592*W30, -103*W30, -46*W30, -3844*W30, + 1712*W30, 303*W30, 1555*W30, -631*W30, + -1400*W30, -961*W30, -854*W30, -276*W30, + 407*W30, 833*W30, -345*W30, -1501*W30, + 121*W30, -1581*W30, 400*W30, 150*W30, + 1224*W30, -139*W30, -563*W30, 879*W30, + 933*W30, 2939*W30, 788*W30, 211*W30, + 530*W30, -192*W30, 706*W30, -13347*W30, + 1065*W30, 3*W30, 111*W30, -208*W30, + -360*W30, -532*W30, -291*W30, 483*W30, + 987*W30, -33*W30, -1373*W30, -166*W30, + -1174*W30, -3955*W30, 1601*W30, -280*W30, + 1405*W30, 600*W30, -1659*W30, -23*W30, + 390*W30, 449*W30, 570*W30, -13143*W30, + -9*W30, -1646*W30, 1201*W30, 294*W30, + 2181*W30, -1173*W30, 1388*W30, -4504*W30, + 190*W30, -2304*W30, 211*W30, 239*W30, + 48*W30, -817*W30, 1018*W30, 1828*W30, + -663*W30, 1408*W30, 408*W30, -36*W30, + 1295*W30, -230*W30, 1341*W30, 9*W30, + 40*W30, 705*W30, 186*W30, 376*W30, + 557*W30, 5866*W30, 363*W30, -1558*W30, + 718*W30, 669*W30, 1369*W30, -2972*W30, + -468*W30, -121*W30, -219*W30, 667*W30, + 29954*W30, 366*W30, 48*W30, -203*W30 +}; + +static const float __exp2f_atable[256] /* __attribute__((mode(SF))) */ = { + 0.707106411447, /* 0x0.b504ecfff */ + 0.709024071690, /* 0x0.b58299fff */ + 0.710945606239, /* 0x0.b60088000 */ + 0.712874472142, /* 0x0.b67ef1000 */ + 0.714806139464, /* 0x0.b6fd88fff */ + 0.716744661340, /* 0x0.b77c94000 */ + 0.718687653549, /* 0x0.b7fbea000 */ + 0.720636486992, /* 0x0.b87ba1fff */ + 0.722590208040, /* 0x0.b8fbabfff */ + 0.724549472323, /* 0x0.b97c12fff */ + 0.726514220228, /* 0x0.b9fcd5fff */ + 0.728483855735, /* 0x0.ba7deb000 */ + 0.730457961549, /* 0x0.baff4afff */ + 0.732438981522, /* 0x0.bb811efff */ + 0.734425544748, /* 0x0.bc0350000 */ + 0.736416816713, /* 0x0.bc85d0000 */ + 0.738412797450, /* 0x0.bd089efff */ + 0.740414917465, /* 0x0.bd8bd4fff */ + 0.742422521111, /* 0x0.be0f66fff */ + 0.744434773914, /* 0x0.be9346fff */ + 0.746454179287, /* 0x0.bf179f000 */ + 0.748477637755, /* 0x0.bf9c3afff */ + 0.750506639473, /* 0x0.c02133fff */ + 0.752541840064, /* 0x0.c0a694fff */ + 0.754582285889, /* 0x0.c12c4e000 */ + 0.756628334525, /* 0x0.c1b265000 */ + 0.758678436269, /* 0x0.c238bffff */ + 0.760736882681, /* 0x0.c2bfa6fff */ + 0.762799203401, /* 0x0.c346cf000 */ + 0.764867603790, /* 0x0.c3ce5d000 */ + 0.766940355298, /* 0x0.c45633fff */ + 0.769021093841, /* 0x0.c4de90fff */ + 0.771104693409, /* 0x0.c5671dfff */ + 0.773195922364, /* 0x0.c5f02afff */ + 0.775292098512, /* 0x0.c6798afff */ + 0.777394294745, /* 0x0.c70350000 */ + 0.779501736166, /* 0x0.c78d6d000 */ + 0.781615912910, /* 0x0.c817fafff */ + 0.783734917628, /* 0x0.c8a2d9fff */ + 0.785858273516, /* 0x0.c92e02000 */ + 0.787990570071, /* 0x0.c9b9c0000 */ + 0.790125787245, /* 0x0.ca45aefff */ + 0.792268991467, /* 0x0.cad223fff */ + 0.794417440881, /* 0x0.cb5ef0fff */ + 0.796570718287, /* 0x0.cbec0efff */ + 0.798730909811, /* 0x0.cc79a0fff */ + 0.800892710672, /* 0x0.cd074dfff */ + 0.803068041795, /* 0x0.cd95ddfff */ + 0.805242776881, /* 0x0.ce2464000 */ + 0.807428598393, /* 0x0.ceb3a3fff */ + 0.809617877002, /* 0x0.cf431dfff */ + 0.811812341211, /* 0x0.cfd2eefff */ + 0.814013659956, /* 0x0.d06333000 */ + 0.816220164311, /* 0x0.d0f3ce000 */ + 0.818434238424, /* 0x0.d184e7fff */ + 0.820652604094, /* 0x0.d21649fff */ + 0.822877407074, /* 0x0.d2a818000 */ + 0.825108587751, /* 0x0.d33a51000 */ + 0.827342867839, /* 0x0.d3ccbdfff */ + 0.829588949684, /* 0x0.d45ff1000 */ + 0.831849217401, /* 0x0.d4f411fff */ + 0.834093391880, /* 0x0.d58724fff */ + 0.836355149750, /* 0x0.d61b5f000 */ + 0.838620424257, /* 0x0.d6afd3fff */ + 0.840896368027, /* 0x0.d744fc000 */ + 0.843176305293, /* 0x0.d7da66fff */ + 0.845462262643, /* 0x0.d87037000 */ + 0.847754716864, /* 0x0.d90673fff */ + 0.850052893157, /* 0x0.d99d10fff */ + 0.852359056469, /* 0x0.da3433fff */ + 0.854668736446, /* 0x0.dacb91fff */ + 0.856986224651, /* 0x0.db6373000 */ + 0.859309315673, /* 0x0.dbfbb1fff */ + 0.861639738080, /* 0x0.dc946bfff */ + 0.863975346095, /* 0x0.dd2d7d000 */ + 0.866317391394, /* 0x0.ddc6f9fff */ + 0.868666708472, /* 0x0.de60f1000 */ + 0.871022939695, /* 0x0.defb5c000 */ + 0.873383641229, /* 0x0.df9611fff */ + 0.875751554968, /* 0x0.e03141000 */ + 0.878126025200, /* 0x0.e0ccde000 */ + 0.880506813521, /* 0x0.e168e4fff */ + 0.882894217966, /* 0x0.e2055afff */ + 0.885287821299, /* 0x0.e2a239000 */ + 0.887686729423, /* 0x0.e33f6ffff */ + 0.890096127973, /* 0x0.e3dd56fff */ + 0.892507970338, /* 0x0.e47b67000 */ + 0.894928157336, /* 0x0.e51a03000 */ + 0.897355020043, /* 0x0.e5b90efff */ + 0.899788379682, /* 0x0.e65888000 */ + 0.902227103705, /* 0x0.e6f85afff */ + 0.904673457151, /* 0x0.e798ae000 */ + 0.907128036008, /* 0x0.e8398afff */ + 0.909585535528, /* 0x0.e8da99000 */ + 0.912051796915, /* 0x0.e97c3a000 */ + 0.914524436003, /* 0x0.ea1e46000 */ + 0.917003571999, /* 0x0.eac0bf000 */ + 0.919490039339, /* 0x0.eb63b2fff */ + 0.921983361257, /* 0x0.ec071a000 */ + 0.924488604054, /* 0x0.ecab48fff */ + 0.926989555360, /* 0x0.ed4f30000 */ + 0.929502844812, /* 0x0.edf3e6000 */ + 0.932021975503, /* 0x0.ee98fdfff */ + 0.934553921208, /* 0x0.ef3eecfff */ + 0.937083780759, /* 0x0.efe4b8fff */ + 0.939624726786, /* 0x0.f08b3f000 */ + 0.942198514924, /* 0x0.f133ebfff */ + 0.944726586343, /* 0x0.f1d99a000 */ + 0.947287976728, /* 0x0.f28176fff */ + 0.949856162070, /* 0x0.f329c5fff */ + 0.952431440345, /* 0x0.f3d28bfff */ + 0.955013573175, /* 0x0.f47bc5000 */ + 0.957603693021, /* 0x0.f52584000 */ + 0.960199773321, /* 0x0.f5cfa7000 */ + 0.962801992906, /* 0x0.f67a31000 */ + 0.965413510788, /* 0x0.f72556fff */ + 0.968030691152, /* 0x0.f7d0dc000 */ + 0.970655620084, /* 0x0.f87ce2fff */ + 0.973290979849, /* 0x0.f92998fff */ + 0.975926160805, /* 0x0.f9d64bfff */ + 0.978571653370, /* 0x0.fa83ac000 */ + 0.981225252139, /* 0x0.fb3193fff */ + 0.983885228626, /* 0x0.fbdfe6fff */ + 0.986552715296, /* 0x0.fc8eb7fff */ + 0.989228487027, /* 0x0.fd3e14000 */ + 0.991909801964, /* 0x0.fdedcd000 */ + 0.994601726545, /* 0x0.fe9e38000 */ + 0.997297704209, /* 0x0.ff4ee6fff */ + 1.000000000000, /* 0x1.000000000 */ + 1.002710938457, /* 0x1.00b1aa000 */ + 1.005429744692, /* 0x1.0163d7ffe */ + 1.008155703526, /* 0x1.02167dffe */ + 1.010888457284, /* 0x1.02c995fff */ + 1.013629436498, /* 0x1.037d38000 */ + 1.016377568250, /* 0x1.043152000 */ + 1.019134163841, /* 0x1.04e5f9ffe */ + 1.021896362316, /* 0x1.059b00000 */ + 1.024668931945, /* 0x1.0650b3ffe */ + 1.027446627635, /* 0x1.0706be001 */ + 1.030234098408, /* 0x1.07bd6bffe */ + 1.033023953416, /* 0x1.087441ffe */ + 1.035824656494, /* 0x1.092bce000 */ + 1.038632392900, /* 0x1.09e3d0001 */ + 1.041450142840, /* 0x1.0a9c79ffe */ + 1.044273972530, /* 0x1.0b558a001 */ + 1.047105550795, /* 0x1.0c0f1c001 */ + 1.049944162390, /* 0x1.0cc924001 */ + 1.052791833895, /* 0x1.0d83c4001 */ + 1.055645227426, /* 0x1.0e3ec3fff */ + 1.058507919326, /* 0x1.0efa60001 */ + 1.061377286898, /* 0x1.0fb66bfff */ + 1.064254641510, /* 0x1.1072fdffe */ + 1.067140102389, /* 0x1.113018000 */ + 1.070034146304, /* 0x1.11edc1fff */ + 1.072937250162, /* 0x1.12ac04001 */ + 1.075843691823, /* 0x1.136a7dfff */ + 1.078760385496, /* 0x1.1429a3ffe */ + 1.081685543070, /* 0x1.14e958000 */ + 1.084618330005, /* 0x1.15a98c000 */ + 1.087556362176, /* 0x1.166a18001 */ + 1.090508937863, /* 0x1.172b98001 */ + 1.093464612954, /* 0x1.17ed4bfff */ + 1.096430182434, /* 0x1.18afa5ffe */ + 1.099401354802, /* 0x1.19725e000 */ + 1.102381587017, /* 0x1.1a35adfff */ + 1.105370759965, /* 0x1.1af994000 */ + 1.108367800686, /* 0x1.1bbdfdffe */ + 1.111373305331, /* 0x1.1c82f6000 */ + 1.114387035385, /* 0x1.1d4878001 */ + 1.117408752440, /* 0x1.1e0e7ffff */ + 1.120437502874, /* 0x1.1ed4fe000 */ + 1.123474478729, /* 0x1.1f9c06000 */ + 1.126521706601, /* 0x1.2063ba001 */ + 1.129574775716, /* 0x1.212bd0001 */ + 1.132638812065, /* 0x1.21f49e000 */ + 1.135709524130, /* 0x1.22bddbffe */ + 1.138789534565, /* 0x1.2387b5fff */ + 1.141876101508, /* 0x1.2451fe000 */ + 1.144971728301, /* 0x1.251cddffe */ + 1.148077130296, /* 0x1.25e861ffe */ + 1.151189923305, /* 0x1.26b462001 */ + 1.154312610610, /* 0x1.278107ffe */ + 1.157440662410, /* 0x1.284e08001 */ + 1.160578370109, /* 0x1.291baa001 */ + 1.163725256932, /* 0x1.29e9e6000 */ + 1.166879892324, /* 0x1.2ab8a3ffe */ + 1.170044302935, /* 0x1.2b8805fff */ + 1.173205971694, /* 0x1.2c5739ffe */ + 1.176397800428, /* 0x1.2d2867ffe */ + 1.179586529747, /* 0x1.2df962001 */ + 1.182784795737, /* 0x1.2ecafbffe */ + 1.185991406414, /* 0x1.2f9d21ffe */ + 1.189206838636, /* 0x1.306fdc001 */ + 1.192430973067, /* 0x1.314328000 */ + 1.195664167430, /* 0x1.32170c001 */ + 1.198906540890, /* 0x1.32eb8a001 */ + 1.202157497408, /* 0x1.33c098000 */ + 1.205416083326, /* 0x1.349625fff */ + 1.208683252332, /* 0x1.356c43fff */ + 1.211961269402, /* 0x1.364318001 */ + 1.215246438983, /* 0x1.371a64000 */ + 1.218539118740, /* 0x1.37f22dffe */ + 1.221847295770, /* 0x1.38cafc000 */ + 1.225158572187, /* 0x1.39a3fdfff */ + 1.228481650325, /* 0x1.3a7dc5ffe */ + 1.231811761846, /* 0x1.3b5803fff */ + 1.235149741144, /* 0x1.3c32c5ffe */ + 1.238499879811, /* 0x1.3d0e53ffe */ + 1.241858124726, /* 0x1.3dea69fff */ + 1.245225191102, /* 0x1.3ec713fff */ + 1.248601436624, /* 0x1.3fa458000 */ + 1.251975655584, /* 0x1.40817a001 */ + 1.255380749731, /* 0x1.4160a2001 */ + 1.258783102010, /* 0x1.423f9bffe */ + 1.262198328973, /* 0x1.431f6e000 */ + 1.265619754780, /* 0x1.43ffa7fff */ + 1.269052743928, /* 0x1.44e0a4001 */ + 1.272490739830, /* 0x1.45c1f4000 */ + 1.275942921659, /* 0x1.46a432001 */ + 1.279397487615, /* 0x1.478697ffe */ + 1.282870173427, /* 0x1.486a2dffe */ + 1.286346316319, /* 0x1.494dfdffe */ + 1.289836049094, /* 0x1.4a32b2001 */ + 1.293333172770, /* 0x1.4b17e1ffe */ + 1.296839594835, /* 0x1.4bfdadfff */ + 1.300354957560, /* 0x1.4ce40fffe */ + 1.303882122055, /* 0x1.4dcb38001 */ + 1.307417988757, /* 0x1.4eb2f1ffe */ + 1.310960650439, /* 0x1.4f9b1dfff */ + 1.314516782746, /* 0x1.50842bfff */ + 1.318079948424, /* 0x1.516daffff */ + 1.321653246888, /* 0x1.5257de000 */ + 1.325237751030, /* 0x1.5342c8001 */ + 1.328829526907, /* 0x1.542e2c000 */ + 1.332433700535, /* 0x1.551a5fffe */ + 1.336045145966, /* 0x1.56070dffe */ + 1.339667558645, /* 0x1.56f473ffe */ + 1.343300342533, /* 0x1.57e287ffe */ + 1.346941947961, /* 0x1.58d130001 */ + 1.350594043714, /* 0x1.59c087ffe */ + 1.354256033883, /* 0x1.5ab085fff */ + 1.357932448365, /* 0x1.5ba175ffe */ + 1.361609339707, /* 0x1.5c926dfff */ + 1.365299344044, /* 0x1.5d8441ffe */ + 1.369003057507, /* 0x1.5e76fc001 */ + 1.372714757920, /* 0x1.5f6a3c000 */ + 1.376437187179, /* 0x1.605e2fffe */ + 1.380165219333, /* 0x1.615282001 */ + 1.383909463864, /* 0x1.6247e3ffe */ + 1.387661933907, /* 0x1.633dd0000 */ + 1.391424179060, /* 0x1.64345fffe */ + 1.395197510706, /* 0x1.652ba9fff */ + 1.399006724329, /* 0x1.66254dffe */ + 1.402773022651, /* 0x1.671c22000 */ + 1.406576037403, /* 0x1.68155dfff */ + 1.410389423392, /* 0x1.690f48001 */ +}; diff --git a/sysdeps/ieee754/flt-32/w_expf.c b/sysdeps/ieee754/flt-32/w_expf.c new file mode 100644 index 0000000000..ad38fac0f3 --- /dev/null +++ b/sysdeps/ieee754/flt-32/w_expf.c @@ -0,0 +1,59 @@ +/* w_expf.c -- float version of w_exp.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: w_expf.c,v 1.3 1995/05/10 20:48:53 jtc Exp $"; +#endif + +/* + * wrapper expf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +o_threshold= 8.8721679688e+01, /* 0x42b17180 */ +u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ + +#ifdef __STDC__ + float __expf(float x) /* wrapper expf */ +#else + float __expf(x) /* wrapper expf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_expf(x); +#else + float z; + z = __ieee754_expf(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitef(x)) { + if(x>o_threshold) + /* exp overflow */ + return (float)__kernel_standard((double)x,(double)x,106); + else if(x + +#include + +#ifndef _USE_WRITE +#include /* fputs(), stderr */ +#define WRITE2(u,v) fputs(u, stderr) +#else /* !defined(_USE_WRITE) */ +#include /* write */ +#define WRITE2(u,v) write(2, u, v) +#undef fflush +#endif /* !defined(_USE_WRITE) */ + +/* XXX gcc versions until now don't delay the 0.0/0.0 division until + runtime but produce NaN at copile time. This is wrong since the + exceptions are not set correctly. */ +#if 0 && defined __STDC__ +static const double zero = 0.0; /* used as const */ +#else +static double zero = 0.0; /* used as const */ +#endif + +/* + * Standard conformance (non-IEEE) on exception cases. + * Mapping: + * 1 -- acos(|x|>1) + * 2 -- asin(|x|>1) + * 3 -- atan2(+-0,+-0) + * 4 -- hypot overflow + * 5 -- cosh overflow + * 6 -- exp overflow + * 7 -- exp underflow + * 8 -- y0(0) + * 9 -- y0(-ve) + * 10-- y1(0) + * 11-- y1(-ve) + * 12-- yn(0) + * 13-- yn(-ve) + * 14-- lgamma(finite) overflow + * 15-- lgamma(-integer) + * 16-- log(0) + * 17-- log(x<0) + * 18-- log10(0) + * 19-- log10(x<0) + * 20-- pow(0.0,0.0) + * 21-- pow(x,y) overflow + * 22-- pow(x,y) underflow + * 23-- pow(0,negative) + * 24-- pow(neg,non-integral) + * 25-- sinh(finite) overflow + * 26-- sqrt(negative) + * 27-- fmod(x,0) + * 28-- remainder(x,0) + * 29-- acosh(x<1) + * 30-- atanh(|x|>1) + * 31-- atanh(|x|=1) + * 32-- scalb overflow + * 33-- scalb underflow + * 34-- j0(|x|>X_TLOSS) + * 35-- y0(x>X_TLOSS) + * 36-- j1(|x|>X_TLOSS) + * 37-- y1(x>X_TLOSS) + * 38-- jn(|x|>X_TLOSS, n) + * 39-- yn(x>X_TLOSS, n) + * 40-- tgamma(finite) overflow + * 41-- tgamma(-integer) + * 42-- pow(NaN,0.0) + * 43-- +0**neg + * 44-- exp2 overflow + * 45-- exp2 underflow + * 46-- exp10 overflow + * 47-- exp10 underflow + */ + + +#ifdef __STDC__ + double __kernel_standard(double x, double y, int type) +#else + double __kernel_standard(x,y,type) + double x,y; int type; +#endif +{ + struct exception exc; +#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ +#define HUGE_VAL inf + double inf = 0.0; + + SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */ +#endif + +#ifdef _USE_WRITE + (void) fflush(stdout); +#endif + exc.arg1 = x; + exc.arg2 = y; + switch(type) { + case 1: + case 101: + case 201: + /* acos(|x|>1) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "acos" : (type < 200 + ? "acosf" : "acosl");; + if (_LIB_VERSION == _SVID_) + exc.retval = HUGE; + else + exc.retval = NAN; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if(_LIB_VERSION == _SVID_) { + (void) WRITE2("acos: DOMAIN error\n", 19); + } + __set_errno (EDOM); + } + break; + case 2: + case 102: + case 202: + /* asin(|x|>1) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "asin" : (type < 200 + ? "asinf" : "asinl"); + if (_LIB_VERSION == _SVID_) + exc.retval = HUGE; + else + exc.retval = NAN; + if(_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if(_LIB_VERSION == _SVID_) { + (void) WRITE2("asin: DOMAIN error\n", 19); + } + __set_errno (EDOM); + } + break; + case 3: + case 103: + case 203: + /* atan2(+-0,+-0) */ + exc.arg1 = y; + exc.arg2 = x; + exc.type = DOMAIN; + exc.name = type < 100 ? "atan2" : (type < 200 + ? "atan2f" : "atan2l"); + assert (_LIB_VERSION == _SVID_); + exc.retval = HUGE; + if(_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if(_LIB_VERSION == _SVID_) { + (void) WRITE2("atan2: DOMAIN error\n", 20); + } + __set_errno (EDOM); + } + break; + case 4: + case 104: + case 204: + /* hypot(finite,finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "hypot" : (type < 200 + ? "hypotf" : "hypotl"); + 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); + } + break; + case 5: + case 105: + case 205: + /* cosh(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "cosh" : (type < 200 + ? "coshf" : "coshl"); + 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); + } + break; + case 6: + case 106: + case 206: + /* exp(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "exp" : (type < 200 + ? "expf" : "expl"); + 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); + } + break; + case 7: + case 107: + case 207: + /* exp(finite) underflow */ + exc.type = UNDERFLOW; + exc.name = type < 100 ? "exp" : (type < 200 + ? "expf" : "expl"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 8: + case 108: + case 208: + /* y0(0) = -inf */ + exc.type = DOMAIN; /* should be SING for IEEE */ + exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("y0: DOMAIN error\n", 17); + } + __set_errno (EDOM); + } + break; + case 9: + case 109: + case 209: + /* y0(x<0) = NaN */ + exc.type = DOMAIN; + exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("y0: DOMAIN error\n", 17); + } + __set_errno (EDOM); + } + break; + case 10: + case 110: + case 210: + /* y1(0) = -inf */ + exc.type = DOMAIN; /* should be SING for IEEE */ + exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("y1: DOMAIN error\n", 17); + } + __set_errno (EDOM); + } + break; + case 11: + case 111: + case 211: + /* y1(x<0) = NaN */ + exc.type = DOMAIN; + exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("y1: DOMAIN error\n", 17); + } + __set_errno (EDOM); + } + break; + case 12: + case 112: + case 212: + /* yn(n,0) = -inf */ + exc.type = DOMAIN; /* should be SING for IEEE */ + exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("yn: DOMAIN error\n", 17); + } + __set_errno (EDOM); + } + break; + case 13: + case 113: + case 213: + /* yn(x<0) = NaN */ + exc.type = DOMAIN; + exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("yn: DOMAIN error\n", 17); + } + __set_errno (EDOM); + } + break; + case 14: + case 114: + case 214: + /* lgamma(finite) overflow */ + 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_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 15: + case 115: + case 215: + /* lgamma(-integer) or lgamma(0) */ + 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 == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("lgamma: SING error\n", 19); + } + __set_errno (EDOM); + } + break; + case 16: + case 116: + case 216: + /* log(0) */ + exc.type = SING; + exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("log: SING error\n", 16); + } + __set_errno (EDOM); + } + break; + case 17: + case 117: + case 217: + /* log(x<0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = NAN; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("log: DOMAIN error\n", 18); + } + __set_errno (EDOM); + } + break; + case 18: + case 118: + case 218: + /* log10(0) */ + exc.type = SING; + exc.name = type < 100 ? "log10" : (type < 200 + ? "log10f" : "log10l"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("log10: SING error\n", 18); + } + __set_errno (EDOM); + } + break; + case 19: + case 119: + case 219: + /* log10(x<0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "log10" : (type < 200 + ? "log10f" : "log10l"); + if (_LIB_VERSION == _SVID_) + exc.retval = -HUGE; + else + exc.retval = NAN; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("log10: DOMAIN error\n", 20); + } + __set_errno (EDOM); + } + break; + case 20: + case 120: + case 220: + /* pow(0.0,0.0) */ + /* error only if _LIB_VERSION == _SVID_ */ + exc.type = DOMAIN; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); + exc.retval = zero; + if (_LIB_VERSION != _SVID_) exc.retval = 1.0; + else if (!matherr(&exc)) { + (void) WRITE2("pow(0,0): DOMAIN error\n", 23); + __set_errno (EDOM); + } + break; + case 21: + case 121: + case 221: + /* pow(x,y) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); + if (_LIB_VERSION == _SVID_) { + exc.retval = HUGE; + y *= 0.5; + if(xzero) ? HUGE : -HUGE); + else + exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL); + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 26: + case 126: + case 226: + /* sqrt(x<0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "sqrt" : (type < 200 + ? "sqrtf" : "sqrtl"); + if (_LIB_VERSION == _SVID_) + exc.retval = zero; + else + exc.retval = zero/zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("sqrt: DOMAIN error\n", 19); + } + __set_errno (EDOM); + } + break; + case 27: + case 127: + case 227: + /* fmod(x,0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "fmod" : (type < 200 + ? "fmodf" : "fmodl"); + 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: + case 128: + case 228: + /* 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: + case 129: + case 229: + /* 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: + case 130: + case 230: + /* 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: + case 131: + case 231: + /* 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 (EDOM); + 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: + /* scalb overflow; SVID also returns +-HUGE_VAL */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "scalb" : (type < 200 + ? "scalbf" : "scalbl"); + exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 33: + case 133: + case 233: + /* scalb underflow */ + exc.type = UNDERFLOW; + exc.name = type < 100 ? "scalb" : (type < 200 + ? "scalbf" : "scalbl"); + exc.retval = __copysign(zero,x); + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 34: + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + break; + case 40: + case 140: + case 240: + /* gamma(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "tgamma" : (type < 200 + ? "tgammaf" : "tgammal"); + exc.retval = HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 41: + case 141: + case 241: + /* gamma(-integer) or gamma(0) */ + exc.type = SING; + exc.name = type < 100 ? "tgamma" : (type < 200 + ? "tgammaf" : "tgammal"); + exc.retval = NAN; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("tgamma: SING error\n", 18); + exc.retval = HUGE_VAL; + } + __set_errno (EDOM); + } + break; + case 42: + case 142: + case 242: + /* pow(NaN,0.0) */ + /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */ + exc.type = DOMAIN; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); + exc.retval = x; + if (_LIB_VERSION == _IEEE_ || + _LIB_VERSION == _POSIX_) exc.retval = 1.0; + else if (!matherr(&exc)) { + __set_errno (EDOM); + } + break; + + case 44: + case 144: + case 244: + /* exp(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "exp2" : (type < 200 + ? "exp2f" : "exp2l"); + 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); + } + break; + case 45: + case 145: + case 245: + /* exp(finite) underflow */ + exc.type = UNDERFLOW; + exc.name = type < 100 ? "exp2" : (type < 200 + ? "exp2f" : "exp2l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + + case 46: + case 146: + case 246: + /* exp(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "exp10" : (type < 200 + ? "exp10f" : "exp10l"); + 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); + } + break; + case 47: + case 147: + case 247: + /* exp(finite) underflow */ + exc.type = UNDERFLOW; + exc.name = type < 100 ? "exp10" : (type < 200 + ? "exp10f" : "exp10l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + /* #### Last used is 47/147/247 ### */ + } + return exc.retval; +} diff --git a/sysdeps/ieee754/ldbl-128/e_acoshl.c b/sysdeps/ieee754/ldbl-128/e_acoshl.c new file mode 100644 index 0000000000..7f7934025a --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/e_acoshl.c @@ -0,0 +1,68 @@ +/* e_acoshl.c -- long double version of e_acosh.c. + * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* __ieee754_acoshl(x) + * Method : + * Based on + * acoshl(x) = logl [ x + sqrtl(x*x-1) ] + * we have + * acoshl(x) := logl(x)+ln2, if x is large; else + * acoshl(x) := logl(2x-1/(sqrtl(x*x-1)+x)) if x>2; else + * acoshl(x) := log1pl(t+sqrtl(2.0*t+t*t)); where t=x-1. + * + * Special cases: + * acoshl(x) is NaN with signal if x<1. + * acoshl(NaN) is NaN without signal. + */ + +#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 t; + u_int64_t lx; + int64_t hx; + GET_LDOUBLE_WORDS64(hx,lx,x); + if(hx<0x3fff000000000000LL) { /* x < 1 */ + return (x-x)/(x-x); + } else if(hx >=0x401b000000000000LL) { /* x > 2**28 */ + if(hx >=0x7fff000000000000LL) { /* x is inf of NaN */ + return x+x; + } else + return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */ + } else if(((hx-0x3fff000000000000LL)|lx)==0) { + return 0.0L; /* acosh(1) = 0 */ + } else if (hx > 0x4000000000000000LL) { /* 2**28 > x > 2 */ + t=x*x; + return __ieee754_logl(2.0L*x-one/(x+__ieee754_sqrtl(t-one))); + } else { /* 1 0, + * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, + * + * Special cases: + * + * ATAN2((anything), NaN ) is NaN; + * ATAN2(NAN , (anything) ) is NaN; + * ATAN2(+-0, +(anything but NaN)) is +-0 ; + * ATAN2(+-0, -(anything but NaN)) is +-pi ; + * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; + * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; + * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; + * ATAN2(+-INF,+INF ) is +-pi/4 ; + * ATAN2(+-INF,-INF ) is +-3pi/4; + * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#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 */ +pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898cc51701b8 */ +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 z; + int64_t k,m,hx,hy,ix,iy; + u_int64_t lx,ly; + + GET_LDOUBLE_WORDS64(hx,lx,x); + ix = hx&0x7fffffffffffffffLL; + GET_LDOUBLE_WORDS64(hy,ly,y); + iy = hy&0x7fffffffffffffffLL; + if(((ix|((lx|-lx)>>63))>0x7fff000000000000LL)|| + ((iy|((ly|-ly)>>63))>0x7fff000000000000LL)) /* x or y is NaN */ + return x+y; + if((hx-0x3fff000000000000LL|lx)==0) return __atanl(y); /* x=1.0L */ + m = ((hy>>63)&1)|((hx>>62)&2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if((iy|ly)==0) { + switch(m) { + case 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 */ + } + } + /* when x = 0 */ + if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* when x is INF */ + if(ix==0x7fff000000000000LL) { + if(iy==0x7fff000000000000LL) { + switch(m) { + case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ + case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ + case 2: return 3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/ + } + } else { + switch(m) { + case 0: return zero ; /* atan(+...,+INF) */ + case 1: return -zero ; /* atan(-...,+INF) */ + case 2: return pi+tiny ; /* atan(+...,-INF) */ + case 3: return -pi-tiny ; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if(iy==0x7fff000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* 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 */ + else z=__atanl(fabsl(y/x)); /* safe to do y/x */ + switch (m) { + case 0: return z ; /* atan(+,+) */ + case 1: { + 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(-,-) */ + } +} diff --git a/sysdeps/ieee754/ldbl-128/e_fmodl.c b/sysdeps/ieee754/ldbl-128/e_fmodl.c new file mode 100644 index 0000000000..1043f69cb3 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/e_fmodl.c @@ -0,0 +1,138 @@ +/* e_fmodl.c -- long double version of e_fmod.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* + * __ieee754_fmodl(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#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 +{ + int64_t n,hx,hy,hz,ix,iy,sx,i; + u_int64_t lx,ly,lz; + + GET_LDOUBLE_WORDS64(hx,lx,x); + GET_LDOUBLE_WORDS64(hy,ly,y); + sx = hx&0x8000000000000000ULL; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffffffffffffLL; /* |y| */ + + /* purge off exception values */ + if((hy|ly)==0||(hx>=0x7fff000000000000LL)|| /* y=0,or x not finite */ + ((hy|((ly|-ly)>>63))>0x7fff000000000000LL)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx<=hy) { + if((hx>63]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(hx<0x0001000000000000LL) { /* subnormal x */ + if(hx==0) { + for (ix = -16431, i=lx; i>0; i<<=1) ix -=1; + } else { + for (ix = -16382, i=hx<<15; i>0; i<<=1) ix -=1; + } + } else ix = (hx>>48)-0x3fff; + + /* determine iy = ilogb(y) */ + if(hy<0x0001000000000000LL) { /* subnormal y */ + if(hy==0) { + for (iy = -16431, i=ly; i>0; i<<=1) iy -=1; + } else { + for (iy = -16382, i=hy<<15; i>0; i<<=1) iy -=1; + } + } else iy = (hy>>48)-0x3fff; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -16382) + hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx); + else { /* subnormal x, shift x to normal */ + n = -16382-ix; + if(n<=63) { + hx = (hx<>(64-n)); + lx <<= n; + } else { + hx = lx<<(n-64); + lx = 0; + } + } + if(iy >= -16382) + hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy); + else { /* subnormal y, shift y to normal */ + n = -16382-iy; + if(n<=63) { + hy = (hy<>(64-n)); + ly <<= n; + } else { + hy = ly<<(n-64); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy;lz=lx-ly; if(lx>63); lx = lx+lx;} + else { + if((hz|lz)==0) /* return sign(x)*0 */ + return Zero[(u_int64_t)sx>>63]; + hx = hz+hz+(lz>>63); lx = lz+lz; + } + } + hz=hx-hy;lz=lx-ly; if(lx=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]; + while(hx<0x0001000000000000LL) { /* normalize x */ + hx = hx+hx+(lx>>63); lx = lx+lx; + iy -= 1; + } + if(iy>= -16382) { /* normalize output */ + hx = ((hx-0x0001000000000000LL)|((iy+16383)<<48)); + SET_LDOUBLE_WORDS64(x,hx|sx,lx); + } else { /* subnormal output */ + n = -16382 - iy; + if(n<=48) { + lx = (lx>>n)|((u_int64_t)hx<<(64-n)); + hx >>= n; + } else if (n<=63) { + lx = (hx<<(64-n))|(lx>>n); hx = sx; + } else { + lx = hx>>(n-64); hx = sx; + } + SET_LDOUBLE_WORDS64(x,hx|sx,lx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} diff --git a/sysdeps/ieee754/ldbl-128/e_gammal_r.c b/sysdeps/ieee754/ldbl-128/e_gammal_r.c new file mode 100644 index 0000000000..f77350fa5c --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/e_gammal_r.c @@ -0,0 +1,52 @@ +/* Implementation of gamma function according to ISO C. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek +#include + + +long double +__ieee754_gammal_r (long double x, int *signgamp) +{ + /* We don't have a real gamma implementation now. We'll use lgamma + and the exp function. But due to the required boundary + conditions we must check some values separately. */ + int64_t hx; + u_int64_t lx; + + GET_LDOUBLE_WORDS64 (hx, lx, x); + + if (((hx & 0x7fffffffffffffffLL) | lx) == 0) + { + /* Return value for x == 0 is NaN with invalid exception. */ + *signgamp = 0; + return x / x; + } + if (hx < 0 && (u_int64_t) hx < 0xffff000000000000ULL && __rintl (x) == x) + { + /* Return value for integer x < 0 is NaN with invalid exception. */ + *signgamp = 0; + return (x - x) / (x - x); + } + + /* XXX FIXME. */ + return __ieee754_expl (__ieee754_lgammal_r (x, signgamp)); +} diff --git a/sysdeps/ieee754/ldbl-128/e_remainderl.c b/sysdeps/ieee754/ldbl-128/e_remainderl.c new file mode 100644 index 0000000000..81af247b33 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/e_remainderl.c @@ -0,0 +1,78 @@ +/* e_fmodl.c -- long double version of e_fmod.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* __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) + * integer nearest x/p (in half way case choose the even one). + * 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 +{ + int64_t hx,hp; + u_int64_t sx,lx,lp; + long double p_half; + + GET_LDOUBLE_WORDS64(hx,lx,x); + GET_LDOUBLE_WORDS64(hp,lp,p); + sx = hx&0x8000000000000000ULL; + hp &= 0x7fffffffffffffffLL; + hx &= 0x7fffffffffffffffLL; + + /* purge off exception values */ + 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))) + return (x*p)/(x*p); + + + if (hp<=0x7ffdffffffffffffLL) x = __ieee754_fmodl(x,p+p); /* now x < 2p */ + if (((hx-hp)|(lx-lp))==0) return zero*x; + x = fabsl(x); + p = fabsl(p); + if (hp<0x0002000000000000LL) { + if(x+x>p) { + x-=p; + if(x+x>=p) x -= p; + } + } else { + p_half = 0.5L*p; + if(x>p_half) { + x-=p; + if(x>=p_half) x -= p; + } + } + GET_LDOUBLE_MSW64(hx,x); + SET_LDOUBLE_MSW64(x,hx^sx); + return x; +} diff --git a/sysdeps/ieee754/ldbl-128/ieee754.h b/sysdeps/ieee754/ldbl-128/ieee754.h new file mode 100644 index 0000000000..c3b2f38916 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/ieee754.h @@ -0,0 +1,171 @@ +/* Copyright (C) 1992, 1995, 1996, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _IEEE754_H + +#define _IEEE754_H 1 +#include + +#include + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 quad-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:16; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:16; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:15; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#else + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:15; + unsigned int quiet_nan:1; + unsigned int exponent:15; + unsigned int negative:1; +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ + +__END_DECLS + +#endif /* ieee754.h */ diff --git a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c new file mode 100644 index 0000000000..68ecea8753 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c @@ -0,0 +1,137 @@ +/* Copyright (C) 1995, 1996, 1997, 1998, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" +#include +#include +#include +#include + +/* Convert a `long double' in IEEE854 quad-precision format to a + multi-precision integer representing the significand scaled up by its + number of bits (113 for long double) and an integral power of two + (MPN frexpl). */ + +mp_size_t +__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, + int *expt, int *is_neg, + long double value) +{ + union ieee854_long_double u; + u.d = value; + + *is_neg = u.ieee.negative; + *expt = (int) u.ieee.exponent - IEEE854_LONG_DOUBLE_BIAS; + +#if BITS_PER_MP_LIMB == 32 + res_ptr[0] = u.ieee.mantissa3; /* Low-order 32 bits of fraction. */ + res_ptr[1] = u.ieee.mantissa2; + res_ptr[2] = u.ieee.mantissa1; + res_ptr[3] = u.ieee.mantissa0; /* High-order 32 bits. */ + #define N 4 +#elif BITS_PER_MP_LIMB == 64 + /* Hopefully the compiler will combine the two bitfield extracts + and this composition into just the original quadword extract. */ + res_ptr[0] = ((unsigned long int) u.ieee.mantissa2 << 32) | u.ieee.mantissa3; + res_ptr[1] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; + #define N 2 +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif +/* The format does not fill the last limb. There are some zeros. */ +#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \ + - (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB))) + + if (u.ieee.exponent == 0) + { + /* A biased exponent of zero is a special case. + Either it is a zero or it is a denormal number. */ + if (res_ptr[0] == 0 && res_ptr[1] == 0 + && res_ptr[N - 2] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=4. */ + /* It's zero. */ + *expt = 0; + else + { + /* It is a denormal number, meaning it has no implicit leading + one bit, and its exponent is in fact the format minimum. */ + int cnt; + +#if N == 2 + if (res_ptr[N - 1] != 0) + { + count_leading_zeros (cnt, res_ptr[N - 1]); + cnt -= NUM_LEADING_ZEROS; + res_ptr[N - 1] = res_ptr[N - 1] << cnt + | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt)); + res_ptr[0] <<= cnt; + *expt = LDBL_MIN_EXP - 1 - cnt; + } + else + { + count_leading_zeros (cnt, res_ptr[0]); + if (cnt >= NUM_LEADING_ZEROS) + { + res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS); + res_ptr[0] = 0; + } + else + { + res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt); + res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt); + } + *expt = LDBL_MIN_EXP - 1 + - (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt; + } +#else + int j, k, l; + + for (j = N - 1; j > 0; j++) + if (res_ptr[j] != 0) + break; + + count_leading_zeros (cnt, res_ptr[j]); + cnt -= NUM_LEADING_ZEROS; + l = N - 1 - j; + if (cnt < 0) + { + cnt += BITS_PER_MP_LIMB; + l++; + } + if (!cnt) + for (k = N - 1; k >= l; k--) + res_ptr[k] = res_ptr[k-l]; + else + for (k = N - 1; k >= l; k--) + res_ptr[k] = res_ptr[k-l] << cnt + | res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt); + res_ptr[k--] = res_ptr[0] << cnt; + + for (; k >= 0; k--) + res_ptr[k] = 0; + *expt = LDBL_MIN_EXP - 1 - 3 * BITS_PER_MP_LIMB - cnt; +#endif + } + } + else + /* Add the implicit leading one bit for a normalized number. */ + res_ptr[N - 1] |= 1L << (LDBL_MANT_DIG - 1 - ((N - 1) * BITS_PER_MP_LIMB)); + + return N; +} diff --git a/sysdeps/ieee754/ldbl-128/math_ldbl.h b/sysdeps/ieee754/ldbl-128/math_ldbl.h new file mode 100644 index 0000000000..aecb20a972 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/math_ldbl.h @@ -0,0 +1,82 @@ +#ifndef _MATH_PRIVATE_H_ +#error "Never use directly; include instead." +#endif + +/* A union which permits us to convert between a long double and + four 32 bit ints or two 64 bit ints. */ + +#if __FLOAT_WORD_ORDER == BIG_ENDIAN + +typedef union +{ + long double value; + struct + { + u_int64_t msw; + u_int64_t lsw; + } parts64; + struct + { + u_int32_t w0, w1, w2, w3; + } parts32; +} ieee854_long_double_shape_type; + +#endif + +#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN + +typedef union +{ + long double value; + struct + { + u_int64_t lsw; + u_int64_t msw; + } parts64; + struct + { + u_int32_t w3, w2, w1, w0; + } parts32; +} ieee854_long_double_shape_type; + +#endif + +/* Get two 64 bit ints from a long double. */ + +#define GET_LDOUBLE_WORDS64(ix0,ix1,d) \ +do { \ + ieee854_long_double_shape_type qw_u; \ + qw_u.value = (d); \ + (ix0) = qw_u.parts64.msw; \ + (ix1) = qw_u.parts64.lsw; \ +} while (0) + +/* Set a long double from two 64 bit ints. */ + +#define SET_LDOUBLE_WORDS64(d,ix0,ix1) \ +do { \ + ieee854_long_double_shape_type qw_u; \ + qw_u.parts64.msw = (ix0); \ + qw_u.parts64.lsw = (ix1); \ + (d) = qw_u.value; \ +} while (0) + +/* Get the more significant 64 bits of a long double mantissa. */ + +#define GET_LDOUBLE_MSW64(v,d) \ +do { \ + ieee854_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + (v) = sh_u.parts64.msw; \ +} while (0) + +/* Set the more significant 64 bits of a long double mantissa from an int. */ + +#define SET_LDOUBLE_MSW64(d,v) \ +do { \ + ieee854_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + sh_u.parts64.msw = (v); \ + (d) = sh_u.value; \ +} while (0) + diff --git a/sysdeps/ieee754/ldbl-128/mpn2ldbl.c b/sysdeps/ieee754/ldbl-128/mpn2ldbl.c new file mode 100644 index 0000000000..d9cc4521c8 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/mpn2ldbl.c @@ -0,0 +1,51 @@ +/* Copyright (C) 1995, 1996, 1997, 1998, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include +#include +#include + +/* Convert a multi-precision integer of the needed number of bits (113 for + long double) and an integral power of two to a `long double' in IEEE854 + quad-precision format. */ + +long double +__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign) +{ + union ieee854_long_double u; + + u.ieee.negative = sign; + u.ieee.exponent = expt + IEEE854_LONG_DOUBLE_BIAS; +#if BITS_PER_MP_LIMB == 32 + u.ieee.mantissa3 = frac_ptr[0]; + u.ieee.mantissa2 = frac_ptr[1]; + u.ieee.mantissa1 = frac_ptr[2]; + u.ieee.mantissa0 = frac_ptr[3] & ((1 << (LDBL_MANT_DIG - 96)) - 1); +#elif BITS_PER_MP_LIMB == 64 + u.ieee.mantissa3 = frac_ptr[0] & ((1L << 32) - 1); + u.ieee.mantissa2 = frac_ptr[0] >> 32; + u.ieee.mantissa1 = frac_ptr[1] & ((1L << 32) - 1); + u.ieee.mantissa0 = (frac_ptr[1] >> 32) & ((1 << (LDBL_MANT_DIG - 96)) - 1); +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif + + return u.d; +} diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c new file mode 100644 index 0000000000..e25d668d9a --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c @@ -0,0 +1,84 @@ +/* Print floating point number in hexadecimal notation according to + ISO C 9X. + Copyright (C) 1997, 1998, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define PRINT_FPHEX_LONG_DOUBLE \ +do { \ + /* We have 112 bits of mantissa plus one implicit digit. Since \ + 112 bits are representable without rest using hexadecimal \ + digits we use only the implicit digits for the number before \ + the decimal point. */ \ + unsigned long long int num0, num1; \ + \ + assert (sizeof (long double) == 16); \ + \ + num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \ + | fpnum.ldbl.ieee.mantissa1); \ + num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32 \ + | fpnum.ldbl.ieee.mantissa3); \ + \ + zero_mantissa = (num0|num1) == 0; \ + \ + if (sizeof (unsigned long int) > 6) \ + numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16, \ + info->spec == 'A'); \ + else \ + numstr = _itoa (num1, numbuf + sizeof numbuf, 16, \ + info->spec == 'A'); \ + \ + while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \ + *--numstr = '0'; \ + \ + if (sizeof (unsigned long int) > 6) \ + numstr = _itoa_word (num0, numstr, 16, info->spec == 'A'); \ + else \ + numstr = _itoa (num0, numstr, 16, info->spec == 'A'); \ + \ + /* Fill with zeroes. */ \ + while (numstr > numbuf + (sizeof numbuf - 112 / 4)) \ + *--numstr = '0'; \ + \ + leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1'; \ + \ + exponent = fpnum.ldbl.ieee.exponent; \ + \ + if (exponent == 0) \ + { \ + if (zero_mantissa) \ + expnegative = 0; \ + else \ + { \ + /* This is a denormalized number. */ \ + expnegative = 1; \ + exponent = IEEE854_LONG_DOUBLE_BIAS - 1; \ + } \ + } \ + else if (exponent >= IEEE854_LONG_DOUBLE_BIAS) \ + { \ + expnegative = 0; \ + exponent -= IEEE854_LONG_DOUBLE_BIAS; \ + } \ + else \ + { \ + expnegative = 1; \ + exponent = -(exponent - IEEE854_LONG_DOUBLE_BIAS); \ + } \ +} while (0) + +#include diff --git a/sysdeps/ieee754/ldbl-128/s_ceill.c b/sysdeps/ieee754/ldbl-128/s_ceill.c new file mode 100644 index 0000000000..f241554042 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_ceill.c @@ -0,0 +1,84 @@ +/* s_ceill.c -- long double version of s_ceil.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * ceill(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to ceil(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double huge = 1.0e4930; +#else +static long double huge = 1.0e4930; +#endif + +#ifdef __STDC__ + long double __ceill(long double x) +#else + long double __ceill(x) + long double x; +#endif +{ + int64_t i0,i1,j0; + u_int64_t i,j; + GET_LDOUBLE_WORDS64(i0,i1,x); + j0 = ((i0>>48)&0x7fff)-0x3fff; + if(j0<48) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0<0) {i0=0x8000000000000000ULL;i1=0;} + else if((i0|i1)!=0) { i0=0x3fff000000000000ULL;i1=0;} + } + } else { + i = (0x7fffffffffffffffULL)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0>0) i0 += (0x0001000000000000LL)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>111) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = -1ULL>>(j0-48); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0>0) { + if(j0==48) i0+=1; + else { + j = i1+(1LL<<(112-j0)); + if(j=0x7fff000000000000LL) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2l(x,y); + switch(n&3) { + case 0: return __kernel_cosl(y[0],y[1]); + case 1: return -__kernel_sinl(y[0],y[1],1); + case 2: return -__kernel_cosl(y[0],y[1]); + default: + return __kernel_sinl(y[0],y[1],1); + } + } +} +weak_alias (__cosl, cosl) diff --git a/sysdeps/ieee754/ldbl-128/s_fabsl.c b/sysdeps/ieee754/ldbl-128/s_fabsl.c new file mode 100644 index 0000000000..c0fd05af63 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_fabsl.c @@ -0,0 +1,39 @@ +/* s_fabsl.c -- long double version of s_fabs.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * fabsl(x) returns the absolute value of x. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __fabsl(long double x) +#else + long double __fabsl(x) + long double x; +#endif +{ + u_int64_t hx; + GET_LDOUBLE_MSW64(hx,x); + SET_LDOUBLE_MSW64(x,hx&0x7fffffffffffffffLL); + return x; +} +weak_alias (__fabsl, fabsl) diff --git a/sysdeps/ieee754/ldbl-128/s_finitel.c b/sysdeps/ieee754/ldbl-128/s_finitel.c new file mode 100644 index 0000000000..dd176c1e7a --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_finitel.c @@ -0,0 +1,40 @@ +/* s_finitel.c -- long double version of s_finite.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * finitel(x) returns 1 is x is finite, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __finitel(long double x) +#else + int __finitel(x) + long double x; +#endif +{ + int64_t hx; + GET_LDOUBLE_MSW64(hx,x); + return (int)((u_int64_t)((hx&0x7fffffffffffffffLL) + -0x7fff000000000000LL)>>63); +} +weak_alias (__finitel, finitel) diff --git a/sysdeps/ieee754/ldbl-128/s_floorl.c b/sysdeps/ieee754/ldbl-128/s_floorl.c new file mode 100644 index 0000000000..c9b8b70dbf --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_floorl.c @@ -0,0 +1,85 @@ +/* s_floorl.c -- long double version of s_floor.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * floorl(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double huge = 1.0e4930; +#else +static long double huge = 1.0e4930; +#endif + +#ifdef __STDC__ + long double __floorl(long double x) +#else + long double __floorl(x) + long double x; +#endif +{ + int64_t i0,i1,j0; + u_int64_t i,j; + GET_LDOUBLE_WORDS64(i0,i1,x); + j0 = ((i0>>48)&0x7fff)-0x3fff; + if(j0<48) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffffffffffffLL)|i1)!=0) + { i0=0xbfff000000000000ULL;i1=0;} + } + } else { + i = (0x7fffffffffffffffULL)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x0001000000000000LL)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>111) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = -1ULL>>(j0-48); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) { + if(j0==48) i0+=1; + else { + j = i1+(1LL<<(112-j0)); + if(j, 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +int +__fpclassifyl (long double x) +{ + u_int64_t hx, lx; + int retval = FP_NORMAL; + + GET_LDOUBLE_WORDS64 (hx, lx, x); + lx |= (hx & 0x0000ffffffffffffLL); + hx &= 0x7fff000000000000LL; + if ((hx | lx) == 0) + retval = FP_ZERO; + else if (hx == 0) + retval = FP_SUBNORMAL; + else if (hx == 0x7fff000000000000LL) + retval = lx != 0 ? FP_NAN : FP_INFINITE; + + return retval; +} diff --git a/sysdeps/ieee754/ldbl-128/s_frexpl.c b/sysdeps/ieee754/ldbl-128/s_frexpl.c new file mode 100644 index 0000000000..6dbb60ece0 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_frexpl.c @@ -0,0 +1,63 @@ +/* s_frexpl.c -- long double version of s_frexp.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * for non-zero x + * x = frexpl(arg,&exp); + * return a long double fp quantity x such that 0.5 <= |x| <1.0 + * and the corresponding binary exponent "exp". That is + * arg = x*2^exp. + * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg + * with *exp=0. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +two114 = 2.0769187434139310514121985316880384E+34L; /* 0x4071000000000000, 0 */ + +#ifdef __STDC__ + long double __frexpl(long double x, int *eptr) +#else + long double __frexpl(x, eptr) + long double x; int *eptr; +#endif +{ + u_int64_t hx, lx, ix; + GET_LDOUBLE_WORDS64(hx,lx,x); + ix = 0x7fffffffffffffffULL&hx; + *eptr = 0; + if(ix>=0x7fff000000000000ULL||((ix|lx)==0)) return x; /* 0,inf,nan */ + if (ix<0x0001000000000000ULL) { /* subnormal */ + x *= two114; + GET_LDOUBLE_MSW64(hx,x); + ix = hx&0x7fffffffffffffffULL; + *eptr = -114; + } + *eptr += (ix>>48)-16382; + hx = (hx&0x8000ffffffffffffULL) | 0x3ffe000000000000ULL; + SET_LDOUBLE_MSW64(x,hx); + return x; +} +weak_alias (__frexpl, frexpl) diff --git a/sysdeps/ieee754/ldbl-128/s_ilogbl.c b/sysdeps/ieee754/ldbl-128/s_ilogbl.c new file mode 100644 index 0000000000..d2acfd3105 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_ilogbl.c @@ -0,0 +1,55 @@ +/* s_ilogbl.c -- long double version of s_ilogb.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* ilogbl(long double x) + * return the binary exponent of non-zero x + * ilogbl(0) = 0x80000001 + * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __ilogbl(long double x) +#else + int __ilogbl(x) + long double x; +#endif +{ + int64_t hx,lx; + int ix; + + GET_LDOUBLE_WORDS64(hx,lx,x); + hx &= 0x7fffffffffffffffLL; + if(hx <= 0x0001000000000000LL) { + if((hx|lx)==0) + return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */ + else /* subnormal x */ + if(hx==0) { + for (ix = -16431; lx>0; lx<<=1) ix -=1; + } else { + for (ix = -16382, hx<<=15; hx>0; hx<<=1) ix -=1; + } + return ix; + } + else if (hx<0x7fff000000000000LL) return (hx>>48)-0x3fff; + else return FP_ILOGBNAN; +} +weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/ieee754/ldbl-128/s_isinfl.c b/sysdeps/ieee754/ldbl-128/s_isinfl.c new file mode 100644 index 0000000000..038c294c79 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_isinfl.c @@ -0,0 +1,28 @@ +/* + * Written by J.T. Conklin . + * Change for long double by Jakub Jelinek + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +int +__isinfl (long double x) +{ + int64_t hx,lx; + GET_LDOUBLE_WORDS64(hx,lx,x); + lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL; + lx |= -lx; + return ~(lx >> 63) & (hx >> 62); +} +weak_alias (__isinfl, isinfl) diff --git a/sysdeps/ieee754/ldbl-128/s_isnanl.c b/sysdeps/ieee754/ldbl-128/s_isnanl.c new file mode 100644 index 0000000000..d2fb4038ce --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_isnanl.c @@ -0,0 +1,42 @@ +/* s_isnanl.c -- long double version of s_isnan.c. + * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isnanl(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanl(long double x) +#else + int __isnanl(x) + long double x; +#endif +{ + int64_t hx,lx; + GET_LDOUBLE_WORDS64(hx,lx,x); + hx &= 0x7fffffffffffffffLL; + hx |= (u_int64_t)(lx|(-lx))>>63; + hx = 0x7fff000000000000LL - hx; + return (int)((u_int64_t)hx>>63); +} +weak_alias (__isnanl, isnanl) diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c new file mode 100644 index 0000000000..389a65dc0e --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c @@ -0,0 +1,75 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const long double two112[2] = +{ + 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ + -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ +}; + +long long int +__llrintl (long double x) +{ + int32_t j0; + u_int64_t i0,i1; + volatile long double w; + long double t; + long long int result; + int sx; + + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + sx = i0 >> 63; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 < -1) + return 0; + w = two112[sx] + x; + t = w - two112[sx]; + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + if (j0 <= 48) + result = i0 >> (48 - j0); + else + result = ((long long int) i0 << (j0 - 48)) | (i1 >> (112 - j0)); + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__llrintl, llrintl) diff --git a/sysdeps/ieee754/ldbl-128/s_llroundl.c b/sysdeps/ieee754/ldbl-128/s_llroundl.c new file mode 100644 index 0000000000..82395a7b5a --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_llroundl.c @@ -0,0 +1,74 @@ +/* Round long double value to long long int. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long long int +__llroundl (long double x) +{ + int64_t j0; + u_int64_t i1, i0; + long long int result; + int sign; + + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + sign = (i0 & 0x8000000000000000ULL) != 0 ? -1 : 1; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + if (j0 < 48) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else + { + i0 += 0x0000800000000000LL >> j0; + result = i0 >> (48 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 >= 112) + result = ((long long int) i0 << (j0 - 48)) | (i1 << (j0 - 112)); + else + { + u_int64_t j = i1 + (0x8000000000000000ULL >> (j0 - 48)); + if (j < i1) + ++i0; + + result = ((long long int) i0 << (j0 - 48)) | (j >> (112 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sign * result; +} + +weak_alias (__llroundl, llroundl) diff --git a/sysdeps/ieee754/ldbl-128/s_logbl.c b/sysdeps/ieee754/ldbl-128/s_logbl.c new file mode 100644 index 0000000000..1fda289312 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_logbl.c @@ -0,0 +1,46 @@ +/* s_logbl.c -- long double version of s_logb.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * long double logbl(x) + * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. + * Use ilogb instead. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __logbl(long double x) +#else + long double __logbl(x) + long double x; +#endif +{ + int64_t lx,hx; + GET_LDOUBLE_WORDS64(hx,lx,x); + hx &= 0x7fffffffffffffffLL; /* high |x| */ + if((hx|lx)==0) return -1.0/fabs(x); + if(hx>=0x7fff000000000000LL) return x*x; + if((hx>>=48)==0) /* IEEE 754 logb */ + return -16382.0; + else + return (long double) (hx-0x3fff); +} +weak_alias (__logbl, logbl) diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c new file mode 100644 index 0000000000..434aa315a7 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c @@ -0,0 +1,91 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const long double two112[2] = +{ + 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ + -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ +}; + +long int +__lrintl (long double x) +{ + int32_t j0; + u_int64_t i0,i1; + volatile long double w; + long double t; + long int result; + int sx; + + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + sx = i0 >> 63; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + if (j0 < 48) + { + if (j0 < -1) + return 0; + else + { + w = two112[sx] + x; + t = w - two112[sx]; + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + result = i0 >> (48 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 >= 112) + result = ((long int) i0 << (j0 - 48)) | (i1 << (j0 - 112)); + else + { + w = two112[sx] + x; + t = w - two112[sx]; + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + result = ((long int) i0 << (j0 - 48)) | (i1 >> (112 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__lrintl, lrintl) diff --git a/sysdeps/ieee754/ldbl-128/s_lroundl.c b/sysdeps/ieee754/ldbl-128/s_lroundl.c new file mode 100644 index 0000000000..ea82f4c3f8 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_lroundl.c @@ -0,0 +1,74 @@ +/* Round long double value to long int. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long int +__lroundl (long double x) +{ + int64_t j0; + u_int64_t i1, i0; + long int result; + int sign; + + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + sign = (i0 & 0x8000000000000000ULL) != 0 ? -1 : 1; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; + + if (j0 < 48) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else + { + i0 += 0x0000800000000000LL >> j0; + result = i0 >> (48 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 >= 112) + result = ((long int) i0 << (j0 - 48)) | (i1 << (j0 - 112)); + else + { + u_int64_t j = i1 + (0x8000000000000000ULL >> (j0 - 48)); + if (j < i1) + ++i0; + + result = ((long int) i0 << (j0 - 48)) | (j >> (112 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sign * result; +} + +weak_alias (__lroundl, lroundl) diff --git a/sysdeps/ieee754/ldbl-128/s_modfl.c b/sysdeps/ieee754/ldbl-128/s_modfl.c new file mode 100644 index 0000000000..63d66e7114 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_modfl.c @@ -0,0 +1,88 @@ +/* s_modfl.c -- long double version of s_modf.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * modfl(long double x, long double *iptr) + * return fraction part of x, and return x's integral part in *iptr. + * Method: + * Bit twiddling. + * + * Exception: + * No exception. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double one = 1.0; +#else +static long double one = 1.0; +#endif + +#ifdef __STDC__ + long double __modfl(long double x, long double *iptr) +#else + long double __modfl(x, iptr) + long double x,*iptr; +#endif +{ + int64_t i0,i1,j0; + u_int64_t i; + GET_LDOUBLE_WORDS64(i0,i1,x); + j0 = ((i0>>48)&0x7fff)-0x3fff; /* exponent of x */ + if(j0<48) { /* integer part in high x */ + if(j0<0) { /* |x|<1 */ + /* *iptr = +-0 */ + SET_LDOUBLE_WORDS64(*iptr,i0&0x8000000000000000ULL,0); + return x; + } else { + i = (0x0000ffffffffffffLL)>>j0; + if(((i0&i)|i1)==0) { /* x is integral */ + *iptr = x; + /* return +-0 */ + SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0); + return x; + } else { + SET_LDOUBLE_WORDS64(*iptr,i0&(~i),0); + return x - *iptr; + } + } + } else if (j0>111) { /* no fraction part */ + *iptr = x*one; + /* We must handle NaNs separately. */ + if (j0 == 0x4000 && ((i0 & 0x0000ffffffffffffLL) | i1)) + return x*one; + /* return +-0 */ + SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0); + return x; + } else { /* fraction part in low x */ + i = -1ULL>>(j0-48); + if((i1&i)==0) { /* x is integral */ + *iptr = x; + /* return +-0 */ + SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0); + return x; + } else { + SET_LDOUBLE_WORDS64(*iptr,i0,i1&(~i)); + return x - *iptr; + } + } +} +weak_alias (__modfl, modfl) diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c new file mode 100644 index 0000000000..bea3183d39 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c @@ -0,0 +1,93 @@ +/* s_nearbyintl.c -- long double version of s_nearbyint.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* + * nearbyintl(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rintl(x). + */ + +#include +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +TWO112[2]={ + 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ + -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ +}; + +#ifdef __STDC__ + long double __nearbyintl(long double x) +#else + long double __nearbyintl(x) + long double x; +#endif +{ + fenv_t env; + int64_t i0,j0,sx; + u_int64_t i,i1; + long double w,t; + GET_LDOUBLE_WORDS64(i0,i1,x); + sx = (((u_int64_t)i0)>>63); + j0 = ((i0>>48)&0x7fff)-0x3fff; + if(j0<48) { + if(j0<0) { + if(((i0&0x7fffffffffffffffLL)|i1)==0) return x; + i1 |= (i0&0x0000ffffffffffffLL); + i0 &= 0xffffe00000000000ULL; + i0 |= ((i1|-i1)>>16)&0x0000800000000000LL; + SET_LDOUBLE_MSW64(x,i0); + feholdexcept (&env); + w = TWO112[sx]+x; + t = w-TWO112[sx]; + fesetenv (&env); + GET_LDOUBLE_MSW64(i0,t); + SET_LDOUBLE_MSW64(t,(i0&0x7fffffffffffffffLL)|(sx<<63)); + return t; + } else { + i = (0x0000ffffffffffffLL)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if(j0==47) i1 = 0x4000000000000000ULL; else + i0 = (i0&(~i))|((0x0000200000000000LL)>>j0); + } + } + } else if (j0>111) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = -1ULL>>(j0-48); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x4000000000000000LL)>>(j0-48)); + } + SET_LDOUBLE_WORDS64(x,i0,i1); + feholdexcept (&env); + w = TWO112[sx]+x; + t = w-TWO112[sx]; + fesetenv (&env); + return t; +} +weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/ieee754/ldbl-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-128/s_nextafterl.c new file mode 100644 index 0000000000..d3df668178 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_nextafterl.c @@ -0,0 +1,85 @@ +/* s_nextafterl.c -- long double version of s_nextafter.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterl(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __nextafterl(long double x, long double y) +#else + long double __nextafterl(x,y) + long double x,y; +#endif +{ + int64_t hx,hy,ix,iy; + u_int64_t lx,ly; + + GET_LDOUBLE_WORDS64(hx,lx,x); + GET_LDOUBLE_WORDS64(hy,ly,y); + ix = hx&0x7fffffffffffffffLL; /* |x| */ + iy = hy&0x7fffffffffffffffLL; /* |y| */ + + if(((ix>=0x7fff000000000000LL)&&((ix-0x7fff000000000000LL)|lx)!=0) || /* x is nan */ + ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0)) /* y is nan */ + return x+y; + if(x==y) return y; /* x=y, return y */ + if((ix|lx)==0) { /* x == 0 */ + SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ + if(lx==0) hx--; + lx--; + } else { /* x < y, x += ulp */ + lx++; + if(lx==0) hx++; + } + } else { /* x < 0 */ + if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */ + if(lx==0) hx--; + lx--; + } else { /* x > y, x += ulp */ + lx++; + if(lx==0) hx++; + } + } + hy = hx&0x7fff000000000000LL; + if(hy==0x7fff000000000000LL) return x+x;/* overflow */ + if(hy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS64(y,hx,lx); + return y; + } + } + SET_LDOUBLE_WORDS64(x,hx,lx); + return x; +} +weak_alias (__nextafterl, nextafterl) +strong_alias (__nextafterl, __nexttowardl) +weak_alias (__nextafterl, nexttowardl) diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c new file mode 100644 index 0000000000..f121be2fac --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c @@ -0,0 +1,97 @@ +/* s_nexttoward.c + * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support, + * drepper@cygnus.com and Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nexttoward(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __nexttoward(double x, long double y) +#else + double __nexttoward(x,y) + double x; + long double y; +#endif +{ + int32_t hx,ix; + int64_t hy,iy; + u_int32_t lx; + u_int64_t ly; + + EXTRACT_WORDS(hx,lx,x); + GET_LDOUBLE_WORDS64(hy,ly,y); + ix = hx&0x7fffffff; /* |x| */ + iy = hy&0x7fffffffffffffffLL; /* |y| */ + + if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ + ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0)) + /* y is nan */ + return x+y; + if((long double) x==y) return x; /* x=y, return x */ + if((ix|lx)==0) { /* x == 0 */ + double x2; + INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ + x2 = x*x; + if(x2==x) return x2; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if (hy<0||(ix>>20)>(iy>>48)-0x3c00 + || ((ix>>20)==(iy>>48)-0x3c00 + && (((((int64_t)hx)<<28)|(lx>>4))>(hy&0x0000ffffffffffffLL) + || (((((int64_t)hx)<<28)|(lx>>4))==(hy&0x0000ffffffffffffLL) + && (lx&0xf)>(ly>>60))))) { /* x > y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } else { /* x < 0 */ + if (hy>=0||(ix>>20)>(iy>>48)-0x3c00 + || ((ix>>20)==(iy>>48)-0x3c00 + && (((((int64_t)hx)<<28)|(lx>>4))>(hy&0x0000ffffffffffffLL) + || (((((int64_t)hx)<<28)|(lx>>4))==(hy&0x0000ffffffffffffLL) + && (lx&0xf)>(ly>>60))))) { /* x < y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } + hy = hx&0x7ff00000; + if(hy>=0x7ff00000) return x+x; /* overflow */ + if(hy<0x00100000) { /* underflow */ + double x2 = x*x; + if(x2!=x) { /* raise underflow flag */ + INSERT_WORDS(x2,hx,lx); + return x2; + } + } + INSERT_WORDS(x,hx,lx); + return x; +} +weak_alias (__nexttoward, nexttoward) diff --git a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c new file mode 100644 index 0000000000..1a22e0102c --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c @@ -0,0 +1,81 @@ +/* s_nexttowardf.c -- float version of s_nextafter.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com + * and Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __nexttowardf(float x, long double y) +#else + float __nexttowardf(x,y) + float x; + long double y; +#endif +{ + int32_t hx,ix; + int64_t hy,iy; + u_int64_t ly; + + GET_FLOAT_WORD(hx,x); + GET_LDOUBLE_WORDS64(hy,ly,y); + ix = hx&0x7fffffff; /* |x| */ + iy = hy&0x7fffffffffffffffLL; /* |y| */ + + if((ix>0x7f800000) || /* x is nan */ + ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0)) + /* y is nan */ + return x+y; + if((long double) x==y) return y; /* x=y, return y */ + if(ix==0) { /* x == 0 */ + float x2; + SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/ + x2 = x*x; + if(x2==x) return x2; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(hy<0||(ix>>23)>(iy>>48)-0x3f80 + || ((ix>>23)==(iy>>48)-0x3f80 + && (ix&0x7fffff)>((hy>>25)&0x7fffff))) {/* x > y, x -= ulp */ + hx -= 1; + } else { /* x < y, x += ulp */ + hx += 1; + } + } else { /* x < 0 */ + if(hy>=0||(ix>>23)>(iy>>48)-0x3f80 + || ((ix>>23)==(iy>>48)-0x3f80 + && (ix&0x7fffff)>((hy>>25)&0x7fffff))) {/* x < y, x -= ulp */ + hx -= 1; + } else { /* x > y, x += ulp */ + hx += 1; + } + } + hy = hx&0x7f800000; + if(hy>=0x7f800000) return x+x; /* overflow */ + if(hy<0x00800000) { /* underflow */ + float x2 = x*x; + if(x2!=x) { /* raise underflow flag */ + SET_FLOAT_WORD(x2,hx); + return x2; + } + } + SET_FLOAT_WORD(x,hx); + return x; +} +weak_alias (__nexttowardf, nexttowardf) diff --git a/sysdeps/ieee754/ldbl-128/s_remquol.c b/sysdeps/ieee754/ldbl-128/s_remquol.c new file mode 100644 index 0000000000..0d2695844b --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_remquol.c @@ -0,0 +1,110 @@ +/* Compute remainder and a congruent to the quotient. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const long double zero = 0.0; + + +long double +__remquol (long double x, long double y, int *quo) +{ + int64_t hx,hy; + u_int64_t sx,lx,ly; + int cquo,qs; + + GET_LDOUBLE_WORDS64 (hx, lx, x); + GET_LDOUBLE_WORDS64 (hy, ly, y); + sx = hx & 0x8000000000000000ULL; + qs = sx ^ (hy & 0x8000000000000000ULL); + hy &= 0x7fffffffffffffffLL; + hx &= 0x7fffffffffffffffLL; + + /* Purge off exception values. */ + if ((hy | ly) == 0) + return (x * y) / (x * y); /* y = 0 */ + if ((hx >= 0x7fff000000000000LL) /* x not finite */ + || ((hy >= 0x7fff000000000000LL) /* y is NaN */ + && (((hy - 0x7fff000000000000LL) | ly) != 0))) + return (x * y) / (x * y); + + if (hy <= 0x7ffbffffffffffffLL) + x = __ieee754_fmodl (x, 8 * y); /* now x < 8y */ + + if (((hx - hy) | (lx - ly)) == 0) + { + *quo = qs ? -1 : 1; + return zero * x; + } + + x = fabsl (x); + y = fabsl (y); + cquo = 0; + + if (x >= 4 * y) + { + x -= 4 * y; + cquo += 4; + } + if (x >= 2 * y) + { + x -= 2 * y; + cquo += 2; + } + + if (hy < 0x0002000000000000LL) + { + if (x + x > y) + { + x -= y; + ++cquo; + if (x + x >= y) + { + x -= y; + ++cquo; + } + } + } + else + { + long double y_half = 0.5L * y; + if (x > y_half) + { + x -= y; + ++cquo; + if (x >= y_half) + { + x -= y; + ++cquo; + } + } + } + + *quo = qs ? -cquo : cquo; + + if (sx) + x = -x; + return x; +} +weak_alias (__remquol, remquol) diff --git a/sysdeps/ieee754/ldbl-128/s_rintl.c b/sysdeps/ieee754/ldbl-128/s_rintl.c new file mode 100644 index 0000000000..c3fc3ba193 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_rintl.c @@ -0,0 +1,90 @@ +/* s_rintl.c -- long double version of s_rint.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * rintl(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rintl(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +TWO112[2]={ + 5.19229685853482762853049632922009600E+33L, /* 0x406F000000000000, 0 */ + -5.19229685853482762853049632922009600E+33L /* 0xC06F000000000000, 0 */ +}; + +#ifdef __STDC__ + long double __rintl(long double x) +#else + long double __rintl(x) + long double x; +#endif +{ + int64_t i0,j0,sx; + u_int64_t i,i1; + long double w,t; + GET_LDOUBLE_WORDS64(i0,i1,x); + sx = (((u_int64_t)i0)>>63); + j0 = ((i0>>48)&0x7fff)-0x3fff; + if(j0<48) { + if(j0<0) { + if(((i0&0x7fffffffffffffffLL)|i1)==0) return x; + i1 |= (i0&0x0000ffffffffffffLL); + i0 &= 0xffffe00000000000ULL; + i0 |= ((i1|-i1)>>16)&0x0000800000000000LL; + SET_LDOUBLE_MSW64(x,i0); + w = TWO112[sx]+x; + t = w-TWO112[sx]; + GET_LDOUBLE_MSW64(i0,t); + SET_LDOUBLE_MSW64(t,(i0&0x7fffffffffffffffLL)|(sx<<63)); + return t; + } else { + i = (0x0000ffffffffffffLL)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if(j0==47) i1 = 0x4000000000000000ULL; else + i0 = (i0&(~i))|((0x0000200000000000LL)>>j0); + } + } + } else if (j0>111) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = -1ULL>>(j0-48); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x4000000000000000LL)>>(j0-48)); + } + SET_LDOUBLE_WORDS64(x,i0,i1); + w = TWO112[sx]+x; + return w-TWO112[sx]; +} +weak_alias (__rintl, rintl) diff --git a/sysdeps/ieee754/ldbl-128/s_roundl.c b/sysdeps/ieee754/ldbl-128/s_roundl.c new file mode 100644 index 0000000000..f9fff48f6c --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_roundl.c @@ -0,0 +1,94 @@ +/* Round long double to integer away from zero. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const long double huge = 1.0E4930L; + + +long double +__roundl (long double x) +{ + int32_t j0; + u_int64_t se, i1, i0; + + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + if (j0 < 31) + { + if (j0 < 0) + { + if (huge + x > 0.0) + { + i0 &= 0x8000000000000000ULL; + if (j0 == -1) + i0 |= 0x3fff000000000000LL; + i1 = 0; + } + } + else + { + u_int64_t i = 0x0000ffffffffffffLL >> j0; + if (((i0 & i) | i1) == 0) + /* X is integral. */ + return x; + if (huge + x > 0.0) + { + /* Raise inexact if x != 0. */ + i0 += 0x0000800000000000LL >> j0; + i0 &= ~i; + i1 = 0; + } + } + } + else if (j0 > 111) + { + if (j0 == 0x4000) + /* Inf or NaN. */ + return x + x; + else + return x; + } + else + { + u_int64_t i = -1ULL >> (j0 - 48); + if ((i1 & i) == 0) + /* X is integral. */ + return x; + + if (huge + x > 0.0) + { + /* Raise inexact if x != 0. */ + u_int64_t j = i1 + (1LL << (111 - j0)); + if (j < i1) + i0 += 1; + i1 = j; + } + i1 &= ~i; + } + + SET_LDOUBLE_WORDS64 (x, i0, i1); + return x; +} +weak_alias (__roundl, roundl) diff --git a/sysdeps/ieee754/ldbl-128/s_scalblnl.c b/sysdeps/ieee754/ldbl-128/s_scalblnl.c new file mode 100644 index 0000000000..5e8b58b733 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_scalblnl.c @@ -0,0 +1,70 @@ +/* s_scalblnl.c -- long double version of s_scalbn.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* @(#)s_scalbn.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * scalblnl (long double x, long int n) + * scalblnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +two114 = 2.0769187434139310514121985316880384E+34L, /* 0x4071000000000000, 0 */ +twom114 = 4.8148248609680896326399448564623183E-35L, /* 0x3F8D000000000000, 0 */ +huge = 1.0E+4900L, +tiny = 1.0E-4900L; + +#ifdef __STDC__ + long double __scalblnl (long double x, long int n) +#else + long double __scalblnl (x,n) + long double x; long int n; +#endif +{ + int64_t k,hx,lx; + GET_LDOUBLE_WORDS64(hx,lx,x); + k = (hx>>48)&0x7fff; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffffffffffffULL))==0) return x; /* +-0 */ + x *= two114; + GET_LDOUBLE_MSW64(hx,x); + k = ((hx>>48)&0x7fff) - 114; + } + if (k==0x7fff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0x7ffe) + return huge*__copysignl(huge,x); /* overflow */ + if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_LDOUBLE_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); return x;} + if (k <= -114) + return tiny*__copysignl(tiny,x); /*underflow*/ + k += 114; /* subnormal result */ + SET_LDOUBLE_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); + return x*twom114; +} +weak_alias (__scalblnl, scalblnl) diff --git a/sysdeps/ieee754/ldbl-128/s_scalbnl.c b/sysdeps/ieee754/ldbl-128/s_scalbnl.c new file mode 100644 index 0000000000..c54f064c0c --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_scalbnl.c @@ -0,0 +1,70 @@ +/* s_scalbnl.c -- long double version of s_scalbn.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* @(#)s_scalbn.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * scalbnl (long double x, int n) + * scalbnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +two114 = 2.0769187434139310514121985316880384E+34L, /* 0x4071000000000000, 0 */ +twom114 = 4.8148248609680896326399448564623183E-35L, /* 0x3F8D000000000000, 0 */ +huge = 1.0E+4900L, +tiny = 1.0E-4900L; + +#ifdef __STDC__ + long double __scalbnl (long double x, int n) +#else + long double __scalbnl (x,n) + long double x; int n; +#endif +{ + int64_t k,hx,lx; + GET_LDOUBLE_WORDS64(hx,lx,x); + k = (hx>>48)&0x7fff; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffffffffffffULL))==0) return x; /* +-0 */ + x *= two114; + GET_LDOUBLE_MSW64(hx,x); + k = ((hx>>48)&0x7fff) - 114; + } + if (k==0x7fff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0x7ffe) + return huge*__copysignl(huge,x); /* overflow */ + if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_LDOUBLE_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); return x;} + if (k <= -114) + return tiny*__copysignl(tiny,x); /*underflow*/ + k += 114; /* subnormal result */ + SET_LDOUBLE_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); + return x*twom114; +} +weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/ieee754/ldbl-128/s_signbitl.c b/sysdeps/ieee754/ldbl-128/s_signbitl.c new file mode 100644 index 0000000000..52a0afbe6a --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_signbitl.c @@ -0,0 +1,32 @@ +/* Return nonzero value if number is negative. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +int +__signbitl (long double x) +{ + int64_t e; + + GET_LDOUBLE_MSW64 (e, x); + return e < 0; +} diff --git a/sysdeps/ieee754/ldbl-128/s_sincosl.c b/sysdeps/ieee754/ldbl-128/s_sincosl.c new file mode 100644 index 0000000000..2d74e72a50 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_sincosl.c @@ -0,0 +1,77 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +/* Note: We should probably introduce __kernel_sincosl to speed things up, + because __kernel_{cos,sin}l sometimes compute both sine and cosine. */ + +void +__sincosl (long double x, long double *sinx, long double *cosx) +{ + int64_t ix; + + /* High word of x. */ + GET_LDOUBLE_MSW64 (ix, x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffffffffffffLL; + if (ix <= 0x3ffe921fb54442d1LL) + { + *sinx = __kernel_sinl (x, 0.0, 0); + *cosx = __kernel_cosl (x, 0.0); + } + else if (ix >= 0x7fff000000000000LL) + { + /* sin(Inf or NaN) is NaN */ + *sinx = *cosx = x - x; + } + else + { + /* Argument reduction needed. */ + long double y[2]; + int n; + + n = __ieee754_rem_pio2l (x, y); + switch (n & 3) + { + case 0: + *sinx = __kernel_sinl (y[0], y[1], 1); + *cosx = __kernel_cosl (y[0], y[1]); + break; + case 1: + *sinx = __kernel_cosl (y[0], y[1]); + *cosx = -__kernel_sinl (y[0], y[1], 1); + break; + case 2: + *sinx = -__kernel_sinl (y[0], y[1], 1); + *cosx = -__kernel_cosl (y[0], y[1]); + break; + default: + *sinx = -__kernel_cosl (y[0], y[1]); + *cosx = __kernel_sinl (y[0], y[1], 1); + break; + } + } +} +weak_alias (__sincosl, sincosl) diff --git a/sysdeps/ieee754/ldbl-128/s_sinl.c b/sysdeps/ieee754/ldbl-128/s_sinl.c new file mode 100644 index 0000000000..446a75f126 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_sinl.c @@ -0,0 +1,83 @@ +/* s_sinl.c -- long double version of s_sin.c. + * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* sinl(x) + * Return sine function of x. + * + * kernel function: + * __kernel_sinl ... sine function on [-pi/4,pi/4] + * __kernel_cosl ... cose function on [-pi/4,pi/4] + * __ieee754_rem_pio2l ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __sinl(long double x) +#else + long double __sinl(x) + long double x; +#endif +{ + long double y[2],z=0.0L; + int64_t n, ix; + + /* High word of x. */ + GET_LDOUBLE_MSW64(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffffffffffffLL; + if(ix <= 0x3ffe921fb54442d1LL) + return __kernel_sinl(x,z,0); + + /* sin(Inf or NaN) is NaN */ + else if (ix>=0x7fff000000000000LL) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2l(x,y); + switch(n&3) { + case 0: return __kernel_sinl(y[0],y[1],1); + case 1: return __kernel_cosl(y[0],y[1]); + case 2: return -__kernel_sinl(y[0],y[1],1); + default: + return -__kernel_cosl(y[0],y[1]); + } + } +} +weak_alias (__sinl, sinl) diff --git a/sysdeps/ieee754/ldbl-128/s_tanl.c b/sysdeps/ieee754/ldbl-128/s_tanl.c new file mode 100644 index 0000000000..ea9d053d9b --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_tanl.c @@ -0,0 +1,77 @@ +/* s_tanl.c -- long double version of s_tan.c. + * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. + */ + +/* @(#)s_tan.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. + * ==================================================== + */ + +/* tanl(x) + * Return tangent function of x. + * + * kernel function: + * __kernel_tanl ... tangent function on [-pi/4,pi/4] + * __ieee754_rem_pio2l ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __tanl(long double x) +#else + long double __tanl(x) + long double x; +#endif +{ + long double y[2],z=0.0L; + int64_t n, ix; + + /* High word of x. */ + GET_LDOUBLE_MSW64(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffffffffffffLL; + if(ix <= 0x3ffe921fb54442d1LL) return __kernel_tanl(x,z,1); + + /* tanl(Inf or NaN) is NaN */ + else if (ix>=0x7fff000000000000LL) return x-x; /* NaN */ + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2l(x,y); + return __kernel_tanl(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even + -1 -- n odd */ + } +} +weak_alias (__tanl, tanl) diff --git a/sysdeps/ieee754/ldbl-128/s_truncl.c b/sysdeps/ieee754/ldbl-128/s_truncl.c new file mode 100644 index 0000000000..bbff5a42cf --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_truncl.c @@ -0,0 +1,57 @@ +/* Truncate argument to nearest integral value not larger than the argument. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997 and + Jakub Jelinek , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long double +__truncl (long double x) +{ + int32_t j0; + u_int64_t i0, i1, sx; + + GET_LDOUBLE_WORDS64 (i0, i1, x); + sx = i0 & 0x8000000000000000ULL; + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + if (j0 < 48) + { + if (j0 < 0) + /* The magnitude of the number is < 1 so the result is +-0. */ + SET_LDOUBLE_WORDS64 (x, sx, 0); + else + SET_LDOUBLE_WORDS64 (x, i0 & ~(0x0000ffffffffffffLL >> j0), 0); + } + else if (j0 > 111) + { + if (j0 == 0x4000) + /* x is inf or NaN. */ + return x + x; + } + else + { + SET_LDOUBLE_WORDS64 (x, i0, i1 & ~(0xffffffffffffffffULL >> (j0 - 48))); + } + + return x; +} +weak_alias (__truncl, truncl) diff --git a/sysdeps/ieee754/ldbl-128/strtold.c b/sysdeps/ieee754/ldbl-128/strtold.c new file mode 100644 index 0000000000..32049fc83d --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/strtold.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* The actual implementation for all floating point sizes is in strtod.c. + These macros tell it to produce the `long double' version, `strtold'. */ + +# define FLOAT long double +# define FLT LDBL +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define STRTOF __strtold_l +# else +# define STRTOF strtold +# endif +# define MPN2FLOAT __mpn_construct_long_double +# define FLOAT_HUGE_VAL HUGE_VALL +# define SET_MANTISSA(flt, mant) \ + do { union ieee854_long_double u; \ + u.d = (flt); \ + u.ieee.mantissa0 = 0x8000; \ + u.ieee.mantissa1 = 0; \ + u.ieee.mantissa2 = ((mant) >> 32); \ + u.ieee.mantissa3 = (mant) & 0xffffffff; \ + (flt) = u.d; \ + } while (0) + +# include "strtod.c" diff --git a/sysdeps/ieee754/ldbl-96/e_acoshl.c b/sysdeps/ieee754/ldbl-96/e_acoshl.c new file mode 100644 index 0000000000..a60704aa29 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_acoshl.c @@ -0,0 +1,72 @@ +/* e_acoshl.c -- long double version of e_acosh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* __ieee754_acoshl(x) + * Method : + * Based on + * acoshl(x) = logl [ x + sqrtl(x*x-1) ] + * we have + * acoshl(x) := logl(x)+ln2, if x is large; else + * acoshl(x) := logl(2x-1/(sqrtl(x*x-1)+x)) if x>2; else + * acoshl(x) := log1pl(t+sqrtl(2.0*t+t*t)); where t=x-1. + * + * Special cases: + * acoshl(x) is NaN with signal if x<1. + * acoshl(NaN) is NaN without signal. + */ + +#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 t; + u_int32_t se,i0,i1; + GET_LDOUBLE_WORDS(se,i0,i1,x); + if(se<0x3fff || se & 0x8000) { /* x < 1 */ + return (x-x)/(x-x); + } else if(se >=0x401b) { /* x > 2**28 */ + if(se >=0x7fff) { /* x is inf of NaN */ + return x+x; + } else + return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */ + } else if(((se-0x3fff)|i0|i1)==0) { + return 0.0; /* acosh(1) = 0 */ + } else if (se > 0x4000) { /* 2**28 > x > 2 */ + t=x*x; + return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one))); + } else { /* 1 0, + * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, + * + * Special cases: + * + * ATAN2((anything), NaN ) is NaN; + * ATAN2(NAN , (anything) ) is NaN; + * ATAN2(+-0, +(anything but NaN)) is +-0 ; + * ATAN2(+-0, -(anything but NaN)) is +-pi ; + * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; + * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; + * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; + * ATAN2(+-INF,+INF ) is +-pi/4 ; + * ATAN2(+-INF,-INF ) is +-3pi/4; + * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#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 */ +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 z; + int32_t k,m,hx,hy,ix,iy; + u_int32_t sx,sy,lx,ly; + + GET_LDOUBLE_WORDS(sx,hx,lx,x); + ix = sx&0x7fff; + lx |= hx & 0x7fffffff; + GET_LDOUBLE_WORDS(sy,hy,ly,y); + iy = sy&0x7fff; + ly |= hy & 0x7fffffff; + if(((2*ix|((lx|-lx)>>31))>0xfffe)|| + ((2*iy|((ly|-ly)>>31))>0xfffe)) /* x or y is NaN */ + return x+y; + if((sx-0x3fff|lx)==0) return __atanl(y); /* x=1.0 */ + m = ((sy>>15)&1)|((sx>>14)&2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if((iy|ly)==0) { + switch(m) { + case 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 */ + } + } + /* when x = 0 */ + if((ix|lx)==0) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny; + + /* when x is INF */ + if(ix==0x7fff) { + if(iy==0x7fff) { + switch(m) { + case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ + case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ + case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ + } + } else { + switch(m) { + case 0: return zero ; /* atan(+...,+INF) */ + case 1: return -zero ; /* atan(-...,+INF) */ + case 2: return pi+tiny ; /* atan(+...,-INF) */ + case 3: return -pi-tiny ; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if(iy==0x7fff) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny; + + /* 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 */ + else z=__atanl(fabsl(y/x)); /* safe to do y/x */ + switch (m) { + case 0: return z ; /* atan(+,+) */ + case 1: { + 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(-,-) */ + } +} diff --git a/sysdeps/ieee754/ldbl-96/e_atanhl.c b/sysdeps/ieee754/ldbl-96/e_atanhl.c new file mode 100644 index 0000000000..fdcd1e9fe8 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_atanhl.c @@ -0,0 +1,79 @@ +/* s_atanhl.c -- long double version of s_atan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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) + * 2.For x>=0.5 + * 1 2x x + * atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) + * 2 1 - x 1 - x + * + * For x<0.5 + * atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x)) + * + * Special cases: + * atanhl(x) is NaN if |x| > 1 with signal; + * atanhl(NaN) is that NaN with no signal; + * atanhl(+-1) is +-INF with signal. + * + */ + +#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 t; + int32_t ix; + u_int32_t se,i0,i1; + GET_LDOUBLE_WORDS(se,i0,i1,x); + ix = se&0x7fff; + if ((ix+((((i0&0x7fffffff)|i1)|(-((i0&0x7fffffff)|i1)))>>31))>0x3fff) + /* |x|>1 */ + return (x-x)/(x-x); + if(ix==0x3fff) + return x/zero; + if(ix<0x3fe3&&(huge+x)>zero) return x; /* x<2**-28 */ + SET_LDOUBLE_EXP(x,ix); + if(ix<0x3ffe) { /* x < 0.5 */ + t = x+x; + t = 0.5*__log1pl(t+t*x/(one-x)); + } else + t = 0.5*__log1pl((x+x)/(one-x)); + if(se<=0x7fff) return t; else return -t; +} diff --git a/sysdeps/ieee754/ldbl-96/e_coshl.c b/sysdeps/ieee754/ldbl-96/e_coshl.c new file mode 100644 index 0000000000..6af846cb2d --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_coshl.c @@ -0,0 +1,94 @@ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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_coshl(x) + * Method : + * 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 + * 0 <= x <= ln2/2 : coshl(x) := 1 + ------------------- + * 2*exp(x) + * + * exp(x) + 1/exp(x) + * ln2/2 <= x <= 22 : coshl(x) := ------------------- + * 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) + * + * Special cases: + * coshl(x) is |x| if x is +INF, -INF, or NaN. + * only coshl(0)=1 is exact for finite x. + */ + +#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 t,w; + int32_t ex; + u_int32_t mx,lx; + + /* High word of |x|. */ + 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; */ + if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) { + t = __ieee754_expl(fabsl(x)); + return half*t+half/t; + } + + /* |x| in [22, ln(maxdouble)] return half*exp(|x|) */ + if (ex < 0x400c || (ex == 0x400c && mx < 0xb1700000u)) + return half*__ieee754_expl(fabsl(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + if (ex < 0x400d + || (ex == 0x400d && (mx < 0xb170b513u + || (mx == 0xb170b513u && lx < 0xa1dfd60cu)))) + { + w = __ieee754_expl(half*fabsl(x)); + t = half*w; + return t*w; + } + + /* |x| > overflowthresold, cosh(x) overflow */ + return huge*huge; +} diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c new file mode 100644 index 0000000000..104992450b --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c @@ -0,0 +1,50 @@ +/* Implementation of gamma function according to ISO C. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +long double +__ieee754_gammal_r (long double x, int *signgamp) +{ + /* We don't have a real gamma implementation now. We'll use lgamma + and the exp function. But due to the required boundary + conditions we must check some values separately. */ + u_int32_t es, hx, lx; + + GET_LDOUBLE_WORDS (es, hx, lx, x); + + if (((es & 0x7fff) | hx | lx) == 0) + { + /* Return value for x == 0 is NaN with invalid exception. */ + *signgamp = 0; + return x / x; + } + if ((hx & 0x8000) != 0 && (hx & 0x7fff) != 0x7fff && __rintl (x) == x) + { + /* Return value for integer x < 0 is NaN with invalid exception. */ + *signgamp = 0; + return (x - x) / (x - x); + } + + /* XXX FIXME. */ + return __ieee754_expl (__ieee754_lgammal_r (x, signgamp)); +} diff --git a/sysdeps/ieee754/ldbl-96/e_hypotl.c b/sysdeps/ieee754/ldbl-96/e_hypotl.c new file mode 100644 index 0000000000..1a40c556dc --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_hypotl.c @@ -0,0 +1,133 @@ +/* e_hypotl.c -- long double version of e_hypot.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* __ieee754_hypotl(x,y) + * + * Method : + * If (assume round-to-nearest) z=x*x+y*y + * has error less than sqrt(2)/2 ulp, than + * sqrt(z) has error less than 1 ulp (exercise). + * + * So, compute sqrt(x*x+y*y) with some care as + * follows to get the error below 1 ulp: + * + * Assume x>y>0; + * (if possible, set rounding to round-to-nearest) + * 1. if x > 2y use + * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y + * where x1 = x with lower 32 bits cleared, x2 = x-x1; else + * 2. if x <= 2y use + * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) + * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, + * y1= y with lower 32 bits chopped, y2 = y-y1. + * + * NOTE: scaling may be necessary if some argument is too + * large or too tiny + * + * Special cases: + * hypot(x,y) is INF if x or y is +INF or -INF; else + * 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) + */ + +#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 a,b,t1,t2,y1,y2,w; + u_int32_t j,k,ea,eb; + + GET_LDOUBLE_EXP(ea,x); + ea &= 0x7fff; + GET_LDOUBLE_EXP(eb,y); + eb &= 0x7fff; + if(eb > ea) {a=y;b=x;j=ea; ea=eb;eb=j;} else {a=x;b=y;} + SET_LDOUBLE_EXP(a,ea); /* a <- |a| */ + 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(ea == 0x7fff) { /* Inf or NaN */ + u_int32_t exp,high,low; + w = a+b; /* for sNaN */ + GET_LDOUBLE_WORDS(exp,high,low,a); + if(((high&0x7fffffff)|low)==0) w = a; + GET_LDOUBLE_WORDS(exp,high,low,b); + if(((eb^0x7fff)|(high&0x7fffffff)|low)==0) w = b; + return w; + } + /* scale a and b by 2**-9600 */ + ea -= 0x2580; eb -= 0x2580; k += 9600; + SET_LDOUBLE_EXP(a,ea); + SET_LDOUBLE_EXP(b,eb); + } + if(eb < 0x20bf) { /* b < 2**-8000 */ + if(eb == 0) { /* subnormal b or 0 */ + 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 */ + b *= t1; + a *= t1; + k -= 16382; + } else { /* scale a and b by 2^9600 */ + ea += 0x2580; /* a *= 2^9600 */ + eb += 0x2580; /* b *= 2^9600 */ + k -= 9600; + SET_LDOUBLE_EXP(a,ea); + SET_LDOUBLE_EXP(b,eb); + } + } + /* medium size a and b */ + w = a-b; + if (w>b) { + u_int32_t high; + GET_LDOUBLE_MSW(high,a); + SET_LDOUBLE_WORDS(t1,ea,high,0); + t2 = a-t1; + w = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1))); + } else { + u_int32_t high; + GET_LDOUBLE_MSW(high,b); + a = a+a; + SET_LDOUBLE_WORDS(y1,eb,high,0); + y2 = b - y1; + GET_LDOUBLE_MSW(high,a); + SET_LDOUBLE_WORDS(t1,ea+1,high,0); + t2 = a - t1; + w = __ieee754_sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b))); + } + if(k!=0) { + u_int32_t exp; + t1 = 1.0; + GET_LDOUBLE_EXP(exp,t1); + SET_LDOUBLE_EXP(t1,exp+k); + return t1*w; + } else return w; +} diff --git a/sysdeps/ieee754/ldbl-96/e_remainderl.c b/sysdeps/ieee754/ldbl-96/e_remainderl.c new file mode 100644 index 0000000000..e721a6e8cd --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_remainderl.c @@ -0,0 +1,83 @@ +/* e_remainderl.c -- long double version of e_remainder.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#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) + * integer nearest x/p (in half way case choose the even one). + * Method : + * Based on fmod() return x-[x/p]chopped*p exactlp. + */ + +#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 +{ + u_int32_t sx,sex,sep,x0,x1,p0,p1; + long double p_half; + + GET_LDOUBLE_WORDS(sex,x0,x1,x); + GET_LDOUBLE_WORDS(sep,p0,p1,p); + sx = sex&0x8000; + sep &= 0x7fff; + sex &= 0x7fff; + + /* purge off exception values */ + 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))) + return (x*p)/(x*p); + + + if (sep<0x7ffe) x = __ieee754_fmodl(x,p+p); /* now x < 2p */ + if (((sex-sep)|(x0-p0)|(x1-p1))==0) return zero*x; + x = fabsl(x); + p = fabsl(p); + if (sep<0x0002) { + if(x+x>p) { + x-=p; + if(x+x>=p) x -= p; + } + } else { + p_half = 0.5*p; + if(x>p_half) { + x-=p; + if(x>=p_half) x -= p; + } + } + GET_LDOUBLE_EXP(sex,x); + SET_LDOUBLE_EXP(x,sex^sx); + return x; +} diff --git a/sysdeps/ieee754/ldbl-96/e_sinhl.c b/sysdeps/ieee754/ldbl-96/e_sinhl.c new file mode 100644 index 0000000000..4f9cfe2c38 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/e_sinhl.c @@ -0,0 +1,91 @@ +/* e_asinhl.c -- long double version of e_asinh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* __ieee754_sinhl(x) + * Method : + * 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) + * 0 <= x <= 25 : sinhl(x) := --------------, E=expm1l(x) + * 2 + * + * 25 <= x <= lnovft : sinhl(x) := expl(x)/2 + * lnovft <= x <= ln2ovft: sinhl(x) := expl(x/2)/2 * expl(x/2) + * ln2ovft < x : sinhl(x) := x*shuge (overflow) + * + * Special cases: + * sinhl(x) is |x| if x is +INF, -INF, or NaN. + * only sinhl(0)=0 is exact for finite x. + */ + +#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 t,w,h; + u_int32_t jx,ix,i0,i1; + + /* Words of |x|. */ + GET_LDOUBLE_WORDS(jx,i0,i1,x); + ix = jx&0x7fff; + + /* x is INF or NaN */ + if(ix==0x7fff) 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<0x3fe3) /* |x|<2**-28 */ + 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)); + return h*(t+t/(t+one)); + } + + /* |x| in [25, log(maxdouble)] return 0.5*exp(|x|) */ + if (ix < 0x400c || (ix == 0x400c && i0 < 0xb17217f7)) + return h*__ieee754_expl(fabsl(x)); + + /* |x| in [log(maxdouble), overflowthreshold] */ + if (ix<0x400c || (ix == 0x400c && (i0 < 0xb174ddc0 + || (i0 == 0xb174ddc0 + && i1 <= 0x31aec0ea)))) { + w = __ieee754_expl(0.5*fabsl(x)); + t = h*w; + return t*w; + } + + /* |x| > overflowthreshold, sinhl(x) overflow */ + return x*shuge; +} diff --git a/sysdeps/ieee754/ldbl-96/ldbl2mpn.c b/sysdeps/ieee754/ldbl-96/ldbl2mpn.c new file mode 100644 index 0000000000..78e0b7097f --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/ldbl2mpn.c @@ -0,0 +1,95 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" +#include +#include +#include +#include + +/* Convert a `long double' in IEEE854 standard double-precision format to a + multi-precision integer representing the significand scaled up by its + number of bits (64 for long double) and an integral power of two + (MPN frexpl). */ + +mp_size_t +__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, + int *expt, int *is_neg, + long double value) +{ + union ieee854_long_double u; + u.d = value; + + *is_neg = u.ieee.negative; + *expt = (int) u.ieee.exponent - IEEE854_LONG_DOUBLE_BIAS; + +#if BITS_PER_MP_LIMB == 32 + res_ptr[0] = u.ieee.mantissa1; /* Low-order 32 bits of fraction. */ + res_ptr[1] = u.ieee.mantissa0; /* High-order 32 bits. */ + #define N 2 +#elif BITS_PER_MP_LIMB == 64 + /* Hopefully the compiler will combine the two bitfield extracts + and this composition into just the original quadword extract. */ + res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; + #define N 1 +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif + + if (u.ieee.exponent == 0) + { + /* A biased exponent of zero is a special case. + Either it is a zero or it is a denormal number. */ + if (res_ptr[0] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=2. */ + /* It's zero. */ + *expt = 0; + else + { + /* It is a denormal number, meaning it has no implicit leading + one bit, and its exponent is in fact the format minimum. */ + int cnt; + + if (res_ptr[N - 1] != 0) + { + count_leading_zeros (cnt, res_ptr[N - 1]); + if (cnt != 0) + { +#if N == 2 + res_ptr[N - 1] = res_ptr[N - 1] << cnt + | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt)); + res_ptr[0] <<= cnt; +#else + res_ptr[N - 1] <<= cnt; +#endif + } + *expt = LDBL_MIN_EXP - 1 - cnt; + } + else + { + count_leading_zeros (cnt, res_ptr[0]); + res_ptr[N - 1] = res_ptr[0] << cnt; + res_ptr[0] = 0; + *expt = LDBL_MIN_EXP - 1 - BITS_PER_MP_LIMB - cnt; + } + } + } + + return N; +} diff --git a/sysdeps/ieee754/ldbl-96/math_ldbl.h b/sysdeps/ieee754/ldbl-96/math_ldbl.h new file mode 100644 index 0000000000..dccc4a1240 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/math_ldbl.h @@ -0,0 +1,98 @@ +#ifndef _MATH_PRIVATE_H_ +#error "Never use directly; include instead." +#endif + +/* A union which permits us to convert between a long double and + three 32 bit ints. */ + +#if __FLOAT_WORD_ORDER == BIG_ENDIAN + +typedef union +{ + long double value; + struct + { + unsigned int sign_exponent:16; + unsigned int empty:16; + u_int32_t msw; + u_int32_t lsw; + } parts; +} ieee_long_double_shape_type; + +#endif + +#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN + +typedef union +{ + long double value; + struct + { + u_int32_t lsw; + u_int32_t msw; + unsigned int sign_exponent:16; + unsigned int empty:16; + } parts; +} ieee_long_double_shape_type; + +#endif + +/* Get three 32 bit ints from a double. */ + +#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \ +do { \ + ieee_long_double_shape_type ew_u; \ + ew_u.value = (d); \ + (exp) = ew_u.parts.sign_exponent; \ + (ix0) = ew_u.parts.msw; \ + (ix1) = ew_u.parts.lsw; \ +} while (0) + +/* Set a double from two 32 bit ints. */ + +#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \ +do { \ + ieee_long_double_shape_type iw_u; \ + iw_u.parts.sign_exponent = (exp); \ + iw_u.parts.msw = (ix0); \ + iw_u.parts.lsw = (ix1); \ + (d) = iw_u.value; \ +} while (0) + +/* Get the more significant 32 bits of a long double mantissa. */ + +#define GET_LDOUBLE_MSW(v,d) \ +do { \ + ieee_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + (v) = sh_u.parts.msw; \ +} while (0) + +/* Set the more significant 32 bits of a long double mantissa from an int. */ + +#define SET_LDOUBLE_MSW(d,v) \ +do { \ + ieee_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + sh_u.parts.msw = (v); \ + (d) = sh_u.value; \ +} while (0) + +/* Get int from the exponent of a long double. */ + +#define GET_LDOUBLE_EXP(exp,d) \ +do { \ + ieee_long_double_shape_type ge_u; \ + ge_u.value = (d); \ + (exp) = ge_u.parts.sign_exponent; \ +} while (0) + +/* Set exponent of a long double from an int. */ + +#define SET_LDOUBLE_EXP(d,exp) \ +do { \ + ieee_long_double_shape_type se_u; \ + se_u.value = (d); \ + se_u.parts.sign_exponent = (exp); \ + (d) = se_u.value; \ +} while (0) diff --git a/sysdeps/ieee754/ldbl-96/mpn2ldbl.c b/sysdeps/ieee754/ldbl-96/mpn2ldbl.c new file mode 100644 index 0000000000..1f049ba12e --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/mpn2ldbl.c @@ -0,0 +1,47 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include +#include +#include + +/* Convert a multi-precision integer of the needed number of bits (64 for + long double) and an integral power of two to a `long double' in IEEE854 + extended-precision format. */ + +long double +__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign) +{ + union ieee854_long_double u; + + u.ieee.negative = sign; + u.ieee.exponent = expt + IEEE854_LONG_DOUBLE_BIAS; +#if BITS_PER_MP_LIMB == 32 + u.ieee.mantissa1 = frac_ptr[0]; + u.ieee.mantissa0 = frac_ptr[1]; +#elif BITS_PER_MP_LIMB == 64 + u.ieee.mantissa1 = frac_ptr[0] & ((1L << 32) - 1); + u.ieee.mantissa0 = frac_ptr[0] >> 32; +#else + #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" +#endif + + return u.d; +} diff --git a/sysdeps/ieee754/ldbl-96/printf_fphex.c b/sysdeps/ieee754/ldbl-96/printf_fphex.c new file mode 100644 index 0000000000..8dfa387df5 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/printf_fphex.c @@ -0,0 +1,61 @@ +#ifndef LONG_DOUBLE_DENORM_BIAS +# define LONG_DOUBLE_DENORM_BIAS (IEEE854_LONG_DOUBLE_BIAS - 1) +#endif + +#define PRINT_FPHEX_LONG_DOUBLE \ +do { \ + /* The "strange" 80 bit format on ix86 and m68k has an explicit \ + leading digit in the 64 bit mantissa. */ \ + unsigned long long int num; \ + \ + assert (sizeof (long double) == 12); \ + \ + num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \ + | fpnum.ldbl.ieee.mantissa1); \ + \ + zero_mantissa = num == 0; \ + \ + if (sizeof (unsigned long int) > 6) \ + numstr = _itoa_word (num, numbuf + sizeof numbuf, 16, \ + info->spec == 'A'); \ + else \ + numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A'); \ + \ + /* Fill with zeroes. */ \ + while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \ + *--numstr = '0'; \ + \ + /* We use a full nibble for the leading digit. */ \ + leading = *numstr++; \ + \ + /* We have 3 bits from the mantissa in the leading nibble. \ + Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \ + exponent = fpnum.ldbl.ieee.exponent; \ + \ + if (exponent == 0) \ + { \ + if (zero_mantissa) \ + expnegative = 0; \ + else \ + { \ + /* This is a denormalized number. */ \ + expnegative = 1; \ + /* This is a hook for the m68k long double format, where the \ + exponent bias is the same for normalized and denormalized \ + numbers. */ \ + exponent = LONG_DOUBLE_DENORM_BIAS + 3; \ + } \ + } \ + else if (exponent >= IEEE854_LONG_DOUBLE_BIAS + 3) \ + { \ + expnegative = 0; \ + exponent -= IEEE854_LONG_DOUBLE_BIAS + 3; \ + } \ + else \ + { \ + expnegative = 1; \ + exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3)); \ + } \ +} while (0) + +#include diff --git a/sysdeps/ieee754/ldbl-96/s_asinhl.c b/sysdeps/ieee754/ldbl-96/s_asinhl.c new file mode 100644 index 0000000000..6eb434c44b --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_asinhl.c @@ -0,0 +1,70 @@ +/* s_asinhl.c -- long double version of s_asinh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* asinhl(x) + * Method : + * Based on + * asinhl(x) = signl(x) * logl [ |x| + sqrtl(x*x+1) ] + * we have + * asinhl(x) := x if 1+x*x=1, + * := signl(x)*(logl(x)+ln2)) for large |x|, else + * := signl(x)*logl(2|x|+1/(|x|+sqrtl(x*x+1))) if|x|>2, else + * := signl(x)*log1pl(|x| + x^2/(1 + sqrtl(1+x^2))) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +one = 1.000000000000000000000e+00L, /* 0x3FFF, 0x00000000, 0x00000000 */ +ln2 = 6.931471805599453094287e-01L, /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */ +huge= 1.000000000000000000e+4900L; + +#ifdef __STDC__ + long double __asinhl(long double x) +#else + long double __asinhl(x) + long double x; +#endif +{ + long double t,w; + 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(huge+x>one) return x; /* return x inexact except 0 */ + } + if(ix>0x4020) { /* |x| > 2**34 */ + 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))); + } + if(hx&0x8000) return -w; else return w; +} +weak_alias (__asinhl, asinhl) diff --git a/sysdeps/ieee754/ldbl-96/s_cbrtl.c b/sysdeps/ieee754/ldbl-96/s_cbrtl.c new file mode 100644 index 0000000000..1d021b7c3c --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_cbrtl.c @@ -0,0 +1,78 @@ +/* Compute cubic root of double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Dirk Alboth and + Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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" + + +#define CBRT2 1.2599210498948731648 /* 2^(1/3) */ +#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */ + +/* We don't use long double values here since U need not be computed + with full precision. */ +static const double factor[5] = +{ + 1.0 / SQR_CBRT2, + 1.0 / CBRT2, + 1.0, + CBRT2, + SQR_CBRT2 +}; + + +long double +__cbrtl (long double x) +{ + long double xm, ym, u, t2; + int xe; + + /* Reduce X. XM now is an range 1.0 to 0.5. */ + xm = __frexpl (fabs (x), &xe); + + /* If X is not finite or is null return it (with raising exceptions + if necessary. + Note: *Our* version of `frexp' sets XE to zero if the argument is + Inf or NaN. This is not portable but faster. */ + if (xe == 0 && fpclassify (x) <= FP_ZERO) + return x + x; + + u = (0.338058687610520237 + + (1.67595307700780102 + + (-2.82414939754975962 + + (4.09559907378707839 + + (-4.11151425200350531 + + (2.65298938441952296 + + (-0.988553671195413709 + + 0.161617097923756032 * xm) + * xm) + * xm) + * xm) + * xm) + * xm) + *xm); + + t2 = u * u * u; + + ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3]; + + return __ldexpl (x > 0.0 ? ym : -ym, xe / 3); +} +weak_alias (__cbrtl, cbrtl) diff --git a/sysdeps/ieee754/ldbl-96/s_ceill.c b/sysdeps/ieee754/ldbl-96/s_ceill.c new file mode 100644 index 0000000000..d53f3954ba --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_ceill.c @@ -0,0 +1,89 @@ +/* s_ceill.c -- long double version of s_ceil.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * ceill(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to ceil(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double huge = 1.0e4930; +#else +static long double huge = 1.0e4930; +#endif + +#ifdef __STDC__ + long double __ceill(long double x) +#else + long double __ceill(x) + long double x; +#endif +{ + int32_t i1,j0; + u_int32_t i,j,se,i0,sx; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<31) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(sx) {se=0x8000;i0=0;i1=0;} + else if((i0|i1)!=0) { se=0x3fff;i0=0;i1=0;} + } + } else { + i = (0x7fffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx==0) { + if (j0>0) i0 += (0x80000000)>>j0; + else ++se; + } + i0 &= (~i); i1=0; + } + } + } else if (j0>62) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-31); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx==0) { + if(j0==31) i0+=1; + else { + j = i1 + (1<<(63-j0)); + if(j>31); +} +weak_alias (__finitel, finitel) diff --git a/sysdeps/ieee754/ldbl-96/s_floorl.c b/sysdeps/ieee754/ldbl-96/s_floorl.c new file mode 100644 index 0000000000..fb0c37e801 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_floorl.c @@ -0,0 +1,90 @@ +/* s_floorl.c -- long double version of s_floor.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * floorl(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double huge = 1.0e4930; +#else +static long double huge = 1.0e4930; +#endif + +#ifdef __STDC__ + long double __floorl(long double x) +#else + long double __floorl(x) + long double x; +#endif +{ + int32_t i1,j0; + u_int32_t i,j,se,i0,sx; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<31) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(sx==0) {se=0;i0=i1=0;} + else if(((se&0x7fff)|i0|i1)!=0) + { se=0xbfff;i0=i1=0;} + } + } else { + i = (0x7fffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx) { + if (j0>0) i0 += (0x80000000)>>j0; + else ++se; + } + i0 &= (~i); i1=0; + } + } + } else if (j0>62) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-31); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(sx) { + if(j0==31) i0+=1; + else { + j = i1+(1<<(63-j0)); + if(j, 1997. + Fixed by Andreas Schwab . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +int +__fpclassifyl (long double x) +{ + u_int32_t ex, hx, lx, m; + int retval = FP_NORMAL; + + GET_LDOUBLE_WORDS (ex, hx, lx, x); + m = (hx & 0x7fffffff) | lx; + ex &= 0x7fff; + if ((ex | m) == 0) + retval = FP_ZERO; + else if (ex == 0 && (hx & 0x80000000) == 0) + retval = FP_SUBNORMAL; + else if (ex == 0x7fff) + retval = m != 0 ? FP_NAN : FP_INFINITE; + + return retval; +} diff --git a/sysdeps/ieee754/ldbl-96/s_frexpl.c b/sysdeps/ieee754/ldbl-96/s_frexpl.c new file mode 100644 index 0000000000..7a49bc37c8 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_frexpl.c @@ -0,0 +1,69 @@ +/* s_frexpl.c -- long double version of s_frexp.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * for non-zero x + * x = frexpl(arg,&exp); + * return a long double fp quantity x such that 0.5 <= |x| <1.0 + * and the corresponding binary exponent "exp". That is + * arg = x*2^exp. + * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg + * with *exp=0. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +#if LDBL_MANT_DIG == 64 +two65 = 3.68934881474191032320e+19L; /* 0x4040, 0x80000000, 0x00000000 */ +#else +# error "Cannot handle this MANT_DIG" +#endif + + +#ifdef __STDC__ + long double __frexpl(long double x, int *eptr) +#else + long double __frexpl(x, eptr) + long double x; int *eptr; +#endif +{ + u_int32_t se, hx, ix, lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + ix = 0x7fff&se; + *eptr = 0; + if(ix==0x7fff||((ix|hx|lx)==0)) return x; /* 0,inf,nan */ + if (ix==0x0000) { /* subnormal */ + x *= two65; + GET_LDOUBLE_EXP(se,x); + ix = se&0x7fff; + *eptr = -65; + } + *eptr += ix-16382; + se = (se & 0x8000) | 0x3ffe; + SET_LDOUBLE_EXP(x,se); + return x; +} +weak_alias (__frexpl, frexpl) diff --git a/sysdeps/ieee754/ldbl-96/s_ilogbl.c b/sysdeps/ieee754/ldbl-96/s_ilogbl.c new file mode 100644 index 0000000000..d44229dcda --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_ilogbl.c @@ -0,0 +1,56 @@ +/* s_ilogbl.c -- long double version of s_ilogb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* ilogbl(long double x) + * return the binary exponent of non-zero x + * ilogbl(0) = 0x80000001 + * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __ilogbl(long double x) +#else + int __ilogbl(x) + long double x; +#endif +{ + int32_t es,hx,lx,ix; + + GET_LDOUBLE_EXP(es,x); + es &= 0x7fff; + if(es==0) { + GET_LDOUBLE_WORDS(es,hx,lx,x); + if((hx|lx)==0) + return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */ + else /* subnormal x */ + if(hx==0) { + for (ix = -16415; lx>0; lx<<=1) ix -=1; + } else { + for (ix = -16383; hx>0; hx<<=1) ix -=1; + } + return ix; + } + else if (es<0x7fff) return es-0x3fff; + else return FP_ILOGBNAN; +} +weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/ieee754/ldbl-96/s_isinfl.c b/sysdeps/ieee754/ldbl-96/s_isinfl.c new file mode 100644 index 0000000000..6f7c07c5af --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_isinfl.c @@ -0,0 +1,29 @@ +/* + * Written by J.T. Conklin . + * Change for long double by Ulrich Drepper . + * Public domain. + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +int +__isinfl (long double x) +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + lx |= (hx & 0x7fffffff) | ((se & 0x7fff) ^ 0x7fff); + lx |= -lx; + se &= 0x8000; + return ~(lx >> 31) & (1 - (se >> 14)); +} +weak_alias (__isinfl, isinfl) diff --git a/sysdeps/ieee754/ldbl-96/s_isnanl.c b/sysdeps/ieee754/ldbl-96/s_isnanl.c new file mode 100644 index 0000000000..0a7ff38433 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_isnanl.c @@ -0,0 +1,44 @@ +/* s_isnanl.c -- long double version of s_isnan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * isnanl(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __isnanl(long double x) +#else + int __isnanl(x) + long double x; +#endif +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + se = (se & 0x7fff) << 1; + lx |= hx & 0x7fffffff; + se |= (u_int32_t)(lx|(-lx))>>31; + se = 0xfffe - se; + return (int)(((u_int32_t)(se))>>31); +} +weak_alias (__isnanl, isnanl) diff --git a/sysdeps/ieee754/ldbl-96/s_llrintl.c b/sysdeps/ieee754/ldbl-96/s_llrintl.c new file mode 100644 index 0000000000..2aeaa1e102 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_llrintl.c @@ -0,0 +1,77 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const long double two63[2] = +{ + 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ + -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ +}; + + +long long int +__llrintl (long double x) +{ + int32_t se,j0; + u_int32_t i0, i1; + long long int result; + volatile long double w; + long double t; + int sx; + + GET_LDOUBLE_WORDS (se, i0, i1, x); + + sx = (se >> 15) & 1; + j0 = (se & 0x7fff) - 0x3fff; + + if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 < -1) + return 0; + else if (j0 >= 63) + result = (((long long int) i0 << 32) | i1) << (j0 - 63); + else + { + w = two63[sx] + x; + t = w - two63[sx]; + GET_LDOUBLE_WORDS (se, i0, i1, t); + j0 = (se & 0x7fff) - 0x3fff; + + if (j0 < 31) + result = i0 >> (31 - j0); + else + result = ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__llrintl, llrintl) diff --git a/sysdeps/ieee754/ldbl-96/s_llroundl.c b/sysdeps/ieee754/ldbl-96/s_llroundl.c new file mode 100644 index 0000000000..4a537c871e --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_llroundl.c @@ -0,0 +1,81 @@ +/* Round long double value to long long int. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long long int +__llroundl (long double x) +{ + int32_t j0; + u_int32_t se, i1, i0; + long long int result; + int sign; + + GET_LDOUBLE_WORDS (se, i0, i1, x); + j0 = (se & 0x7fff) - 0x3fff; + sign = (se & 0x8000) != 0 ? -1 : 1; + + if (j0 < 31) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else + { + u_int32_t j = i0 + (0x40000000 >> j0); + if (j < i0) + { + j >>= 1; + j |= 0x80000000; + ++j0; + } + + result = j >> (31 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + { + if (j0 >= 63) + result = (((long long int) i0 << 32) | i1) << (j0 - 63); + else + { + u_int32_t j = i1 + (0x80000000 >> (j0 - 31)); + if (j < i1) + ++i0; + + if (j0 == 31) + result = (long long int) i0; + else + result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long long int) x; + } + + return sign * result; +} + +weak_alias (__llroundl, llroundl) diff --git a/sysdeps/ieee754/ldbl-96/s_logbl.c b/sysdeps/ieee754/ldbl-96/s_logbl.c new file mode 100644 index 0000000000..2cd9d105f8 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_logbl.c @@ -0,0 +1,47 @@ +/* s_logbl.c -- long double version of s_logb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * long double logbl(x) + * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. + * Use ilogb instead. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __logbl(long double x) +#else + long double __logbl(x) + long double x; +#endif +{ + int32_t es,lx,ix; + GET_LDOUBLE_WORDS(es,ix,lx,x); + es &= 0x7fff; /* exponent */ + if((es|ix|lx)==0) return -1.0/fabs(x); + if(es==0x7fff) return x*x; + if(es==0) /* IEEE 754 logb */ + return -16382.0; + else + return (long double) (es-0x3fff); +} +weak_alias (__logbl, logbl) diff --git a/sysdeps/ieee754/ldbl-96/s_lrintl.c b/sysdeps/ieee754/ldbl-96/s_lrintl.c new file mode 100644 index 0000000000..673cf3d9db --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_lrintl.c @@ -0,0 +1,86 @@ +/* Round argument to nearest integral value according to current rounding + direction. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +static const long double two63[2] = +{ + 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ + -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ +}; + + +long int +__lrintl (long double x) +{ + int32_t se,j0; + u_int32_t i0, i1; + long int result; + volatile long double w; + long double t; + int sx; + + GET_LDOUBLE_WORDS (se, i0, i1, x); + + sx = (se >> 15) & 1; + j0 = (se & 0x7fff) - 0x3fff; + + if (j0 < 31) + { + if (j0 < -1) + return 0; + else + { + w = two63[sx] + x; + t = w - two63[sx]; + GET_LDOUBLE_WORDS (se, i0, i1, t); + j0 = (se & 0x7fff) - 0x3fff; + + result = i0 >> (31 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 >= 63) + result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63)); + else + { + w = two63[sx] + x; + t = w - two63[sx]; + GET_LDOUBLE_WORDS (se, i0, i1, t); + j0 = (se & 0x7fff) - 0x3fff; + + result = ((long int) i0 << (j0 - 31)) | (i1 >> (63 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sx ? -result : result; +} + +weak_alias (__lrintl, lrintl) diff --git a/sysdeps/ieee754/ldbl-96/s_lroundl.c b/sysdeps/ieee754/ldbl-96/s_lroundl.c new file mode 100644 index 0000000000..3bdac830b4 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_lroundl.c @@ -0,0 +1,78 @@ +/* Round long double value to long int. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long int +__lroundl (long double x) +{ + int32_t j0; + u_int32_t se, i1, i0; + long int result; + int sign; + + GET_LDOUBLE_WORDS (se, i0, i1, x); + j0 = (se & 0x7fff) - 0x3fff; + sign = (se & 0x8000) != 0 ? -1 : 1; + + if (j0 < 31) + { + if (j0 < 0) + return j0 < -1 ? 0 : sign; + else + { + u_int32_t j = i0 + (0x40000000 >> j0); + if (j < i0) + { + j >>= 1; + j |= 0x80000000; + ++j0; + } + + result = j >> (31 - j0); + } + } + else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + { + if (j0 >= 63) + result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63)); + else + { + u_int32_t j = i1 + (0x80000000 >> (j0 - 31)); + if (j < i1) + ++i0; + + result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0)); + } + } + else + { + /* The number is too large. It is left implementation defined + what happens. */ + return (long int) x; + } + + return sign * result; +} + +weak_alias (__lroundl, lroundl) diff --git a/sysdeps/ieee754/ldbl-96/s_modfl.c b/sysdeps/ieee754/ldbl-96/s_modfl.c new file mode 100644 index 0000000000..fb1b3acf30 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_modfl.c @@ -0,0 +1,85 @@ +/* s_modfl.c -- long double version of s_modf.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * modfl(long double x, long double *iptr) + * return fraction part of x, and return x's integral part in *iptr. + * Method: + * Bit twiddling. + * + * Exception: + * No exception. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double one = 1.0; +#else +static long double one = 1.0; +#endif + +#ifdef __STDC__ + long double __modfl(long double x, long double *iptr) +#else + long double __modfl(x, iptr) + long double x,*iptr; +#endif +{ + int32_t i0,i1,j0; + u_int32_t i,se; + GET_LDOUBLE_WORDS(se,i0,i1,x); + j0 = (se&0x7fff)-0x3fff; /* exponent of x */ + if(j0<32) { /* integer part in high x */ + if(j0<0) { /* |x|<1 */ + SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */ + return x; + } else { + i = (0x7fffffff)>>j0; + if(((i0&i)|i1)==0) { /* x is integral */ + *iptr = x; + SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ + return x; + } else { + SET_LDOUBLE_WORDS(*iptr,se,i0&(~i),0); + return x - *iptr; + } + } + } else if (j0>63) { /* no fraction part */ + *iptr = x*one; + /* We must handle NaNs separately. */ + if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1)) + return x*one; + SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ + return x; + } else { /* fraction part in low x */ + i = ((u_int32_t)(0xffffffff))>>(j0-32); + if((i1&i)==0) { /* x is integral */ + *iptr = x; + SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ + return x; + } else { + SET_LDOUBLE_WORDS(*iptr,se,i0,i1&(~i)); + return x - *iptr; + } + } +} +weak_alias (__modfl, modfl) diff --git a/sysdeps/ieee754/ldbl-96/s_nearbyintl.c b/sysdeps/ieee754/ldbl-96/s_nearbyintl.c new file mode 100644 index 0000000000..92c3ebf368 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_nearbyintl.c @@ -0,0 +1,95 @@ +/* s_rintl.c -- long double version of s_rint.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ +/* Adapted for use as nearbyint by Ulrich Drepper . */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* + * rintl(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rintl(x). + */ + +#include +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +TWO63[2]={ + 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ + -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ +}; + +#ifdef __STDC__ + long double __nearbyintl(long double x) +#else + long double __nearbyintl(x) + long double x; +#endif +{ + fenv_t env; + int32_t se,j0,sx; + u_int32_t i,i0,i1; + long double w,t; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<31) { + if(j0<0) { + if(((se&0x7fff)|i0|i1)==0) return x; + i1 |= i0; + i0 &= 0xe0000000; + i0 |= (i1|-i1)&0x80000000; + SET_LDOUBLE_MSW(x,i0); + feholdexcept (&env); + w = TWO63[sx]+x; + t = w-TWO63[sx]; + fesetenv (&env); + GET_LDOUBLE_EXP(i0,t); + SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15)); + return t; + } else { + i = (0x7fffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if (j0==30) i1 = 0x40000000; else + i0 = (i0&(~i))|((0x20000000)>>j0); + } + } + } else if (j0>62) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-31); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31)); + } + SET_LDOUBLE_WORDS(x,se,i0,i1); + feholdexcept (&env); + w = TWO63[sx]+x; + t = w-TWO63[sx]; + fesetenv (&env); + return t; +} +weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/ieee754/ldbl-96/s_nextafterl.c b/sysdeps/ieee754/ldbl-96/s_nextafterl.c new file mode 100644 index 0000000000..aea57e3086 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_nextafterl.c @@ -0,0 +1,101 @@ +/* s_nextafterl.c -- long double version of s_nextafter.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterl(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __nextafterl(long double x, long double y) +#else + long double __nextafterl(x,y) + long double x,y; +#endif +{ + int32_t hx,hy,ix,iy; + u_int32_t lx,ly,esx,esy; + + GET_LDOUBLE_WORDS(esx,hx,lx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = esx&0x7fff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + if(((ix==0x7fff)&&((hx|lx)|-(hx|lx))!=0) || /* x is nan */ + ((iy==0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ + return x+y; + if(x==y) return y; /* x=y, return y */ + if((ix|hx|lx)==0) { /* x == 0 */ + SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ + } + if(esx<0x8000) { /* x > 0 */ + if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { + /* x > y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) + esx += 1; + } + } + } else { /* x < 0 */ + if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ + /* x < y, x -= ulp */ + if(lx==0) { + if (hx==0) esx -= 1; + hx -= 1; + } + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) { + hx += 1; + if (hx==0) esx += 1; + } + } + } + esy = esx&0x7fff; + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS(y,esx,hx,lx); + return y; + } + } + SET_LDOUBLE_WORDS(x,esx,hx,lx); + return x; +} +weak_alias (__nextafterl, nextafterl) +strong_alias (__nextafterl, __nexttowardl) +weak_alias (__nextafterl, nexttowardl) diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c new file mode 100644 index 0000000000..debbb86a3c --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c @@ -0,0 +1,98 @@ +/* s_nexttoward.c + * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support, + * drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* IEEE functions + * nextafterx(x,y) + * return the next machine floating-point number of x in the + * direction toward y. + * Special cases: + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __nexttoward(double x, long double y) +#else + double __nexttoward(x,y) + double x; + long double y; +#endif +{ + int32_t hx,ix,iy; + u_int32_t lx,hy,ly,esy; + + EXTRACT_WORDS(hx,lx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = hx&0x7fffffff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ + ((iy>=0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ + return x+y; + if((long double) x==y) return x; /* x=y, return x */ + if((ix|lx)==0) { /* x == 0 */ + double x2; + INSERT_WORDS(x,esy&0x8000?0x80000000:0,1);/* return +-minsub */ + x2 = x*x; + if(x2==x) return x2; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00 + || (((ix>>20)&0x7ff)==iy-0x3c00 + && (((hx<<11)|(lx>>21))>(hy&0x7fffffff) + || (((hx<<11)|(lx>>21))==(hy&0x7fffffff) + && (lx<<11)>ly)))) { /* x > y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x < y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } else { /* x < 0 */ + if (esy<0x8000||((ix>>20)&0x7ff)>iy-0x3c00 + || (((ix>>20)&0x7ff)==iy-0x3c00 + && (((hx<<11)|(lx>>21))>(hy&0x7fffffff) + || (((hx<<11)|(lx>>21))==(hy&0x7fffffff) + && (lx<<11)>ly)))) {/* x < y, x -= ulp */ + if(lx==0) hx -= 1; + lx -= 1; + } else { /* x > y, x += ulp */ + lx += 1; + if(lx==0) hx += 1; + } + } + hy = hx&0x7ff00000; + if(hy>=0x7ff00000) return x+x; /* overflow */ + if(hy<0x00100000) { /* underflow */ + double x2 = x*x; + if(x2!=x) { /* raise underflow flag */ + INSERT_WORDS(x2,hx,lx); + return x2; + } + } + INSERT_WORDS(x,hx,lx); + return x; +} +weak_alias (__nexttoward, nexttoward) +#ifdef NO_LONG_DOUBLE +strong_alias (__nexttoward, __nexttowardl) +weak_alias (__nexttoward, nexttowardl) +#endif diff --git a/sysdeps/ieee754/ldbl-96/s_nexttowardf.c b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c new file mode 100644 index 0000000000..b7e9f00185 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c @@ -0,0 +1,78 @@ +/* s_nexttowardf.c -- float version of s_nextafter.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __nexttowardf(float x, long double y) +#else + float __nexttowardf(x,y) + float x; + long double y; +#endif +{ + int32_t hx,ix,iy; + u_int32_t hy,ly,esy; + + GET_FLOAT_WORD(hx,x); + GET_LDOUBLE_WORDS(esy,hy,ly,y); + ix = hx&0x7fffffff; /* |x| */ + iy = esy&0x7fff; /* |y| */ + + if((ix>0x7f800000) || /* x is nan */ + (iy>=0x7fff&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ + return x+y; + if((long double) x==y) return y; /* x=y, return y */ + if(ix==0) { /* x == 0 */ + float x2; + SET_FLOAT_WORD(x,(esy&0x8000?0x80000000:0)|1);/* return +-minsub*/ + x2 = x*x; + if(x2==x) return x2; else return x; /* raise underflow flag */ + } + if(hx>=0) { /* x > 0 */ + if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80 + || (((ix>>23)&0xff)==iy-0x3f80 + && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x > y, x -= ulp */ + hx -= 1; + } else { /* x < y, x += ulp */ + hx += 1; + } + } else { /* x < 0 */ + if(esy<0x8000||((ix>>23)&0xff)>iy-0x3f80 + || (((ix>>23)&0xff)==iy-0x3f80 + && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x < y, x -= ulp */ + hx -= 1; + } else { /* x > y, x += ulp */ + hx += 1; + } + } + hy = hx&0x7f800000; + if(hy>=0x7f800000) return x+x; /* overflow */ + if(hy<0x00800000) { /* underflow */ + float x2 = x*x; + if(x2!=x) { /* raise underflow flag */ + SET_FLOAT_WORD(x2,hx); + return x2; + } + } + SET_FLOAT_WORD(x,hx); + return x; +} +weak_alias (__nexttowardf, nexttowardf) diff --git a/sysdeps/ieee754/ldbl-96/s_remquol.c b/sysdeps/ieee754/ldbl-96/s_remquol.c new file mode 100644 index 0000000000..88ff298eb6 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_remquol.c @@ -0,0 +1,109 @@ +/* Compute remainder and a congruent to the quotient. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const long double zero = 0.0; + + +long double +__remquol (long double x, long double p, int *quo) +{ + int32_t ex,ep,hx,hp; + u_int32_t sx,lx,lp; + int cquo,qs; + + GET_LDOUBLE_WORDS (ex, hx, lx, x); + GET_LDOUBLE_WORDS (ep, hp, lp, p); + sx = ex & 0x8000; + qs = (sx ^ (ep & 0x8000)) >> 15; + ep &= 0x7fff; + ex &= 0x7fff; + + /* Purge off exception values. */ + if ((ep | hp | lp) == 0) + return (x * p) / (x * p); /* p = 0 */ + if ((ex == 0x7fff) /* x not finite */ + || ((ep == 0x7fff) /* p is NaN */ + && ((hp | lp) != 0))) + return (x * p) / (x * p); + + if (ep <= 0x7ffb) + x = __ieee754_fmodl (x, 8 * p); /* now x < 8p */ + + if (((ex - ep) | (hx - hp) | (lx - lp)) == 0) + { + *quo = qs ? -1 : 1; + return zero * x; + } + + x = fabsl (x); + p = fabsl (p); + cquo = 0; + + if (x >= 4 * p) + { + x -= 4 * p; + cquo += 4; + } + if (x >= 2 * p) + { + x -= 2 * p; + cquo += 2; + } + + if (ep < 0x0002) + { + if (x + x > p) + { + x -= p; + ++cquo; + if (x + x >= p) + { + x -= p; + ++cquo; + } + } + } + else + { + long double p_half = 0.5 * p; + if (x > p_half) + { + x -= p; + ++cquo; + if (x >= p_half) + { + x -= p; + ++cquo; + } + } + } + + *quo = qs ? -cquo : cquo; + + if (sx) + x = -x; + return x; +} +weak_alias (__remquol, remquol) diff --git a/sysdeps/ieee754/ldbl-96/s_rintl.c b/sysdeps/ieee754/ldbl-96/s_rintl.c new file mode 100644 index 0000000000..9d4777dcc4 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_rintl.c @@ -0,0 +1,91 @@ +/* s_rintl.c -- long double version of s_rint.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * rintl(x) + * Return x rounded to integral value according to the prevailing + * rounding mode. + * Method: + * Using floating addition. + * Exception: + * Inexact flag raised if x not equal to rintl(x). + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +TWO63[2]={ + 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ + -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ +}; + +#ifdef __STDC__ + long double __rintl(long double x) +#else + long double __rintl(x) + long double x; +#endif +{ + int32_t se,j0,sx; + u_int32_t i,i0,i1; + long double w,t; + GET_LDOUBLE_WORDS(se,i0,i1,x); + sx = (se>>15)&1; + j0 = (se&0x7fff)-0x3fff; + if(j0<31) { + if(j0<0) { + if(((se&0x7fff)|i0|i1)==0) return x; + i1 |= i0; + i0 &= 0xe0000000; + i0 |= (i1|-i1)&0x80000000; + SET_LDOUBLE_MSW(x,i0); + w = TWO63[sx]+x; + t = w-TWO63[sx]; + GET_LDOUBLE_EXP(i0,t); + SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15)); + return t; + } else { + i = (0x7fffffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + i>>=1; + if(((i0&i)|i1)!=0) { + if(j0==30) i1 = 0x40000000; else + i0 = (i0&(~i))|((0x20000000)>>j0); + } + } + } else if (j0>62) { + if(j0==0x4000) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-31); + if((i1&i)==0) return x; /* x is integral */ + i>>=1; + if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31)); + } + SET_LDOUBLE_WORDS(x,se,i0,i1); + w = TWO63[sx]+x; + return w-TWO63[sx]; +} +weak_alias (__rintl, rintl) diff --git a/sysdeps/ieee754/ldbl-96/s_roundl.c b/sysdeps/ieee754/ldbl-96/s_roundl.c new file mode 100644 index 0000000000..d7482b9b7c --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_roundl.c @@ -0,0 +1,106 @@ +/* Round long double to integer away from zero. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +static const long double huge = 1.0e4930; + + +long double +__roundl (long double x) +{ + int32_t j0; + u_int32_t se, i1, i0; + + GET_LDOUBLE_WORDS (se, i0, i1, x); + j0 = (se & 0x7fff) - 0x3fff; + if (j0 < 31) + { + if (j0 < 0) + { + if (huge + x > 0.0) + { + se &= 0x8000; + i0 = i1 = 0; + if (j0 == -1) + { + se |= 0x3fff; + i0 = 0x80000000; + } + } + } + else + { + u_int32_t i = 0x7fffffff >> j0; + if (((i0 & i) | i1) == 0) + /* X is integral. */ + return x; + if (huge + x > 0.0) + { + /* Raise inexact if x != 0. */ + u_int32_t j = i0 + (0x40000000 >> j0); + if (j < i0) + se += 1; + i0 = (j & ~i) | 0x80000000; + i1 = 0; + } + } + } + else if (j0 > 62) + { + if (j0 == 0x4000) + /* Inf or NaN. */ + return x + x; + else + return x; + } + else + { + u_int32_t i = 0xffffffff >> (j0 - 31); + if ((i1 & i) == 0) + /* X is integral. */ + return x; + + if (huge + x > 0.0) + { + /* Raise inexact if x != 0. */ + u_int32_t j = i1 + (1 << (62 - j0)); + if (j < i1) + { + u_int32_t k = i0 + 1; + if (k < i0) + { + se += 1; + k |= 0x80000000; + } + i0 = k; + } + i1 = j; + } + i1 &= ~i; + } + + SET_LDOUBLE_WORDS (x, se, i0, i1); + return x; +} +weak_alias (__roundl, roundl) diff --git a/sysdeps/ieee754/ldbl-96/s_scalblnl.c b/sysdeps/ieee754/ldbl-96/s_scalblnl.c new file mode 100644 index 0000000000..8e556fabe1 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_scalblnl.c @@ -0,0 +1,71 @@ +/* s_scalbnl.c -- long double version of s_scalbn.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * scalbnl (long double x, int n) + * scalbnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +two63 = 4.50359962737049600000e+15, +twom63 = 1.08420217248550443400e-19, +huge = 1.0e+4900L, +tiny = 1.0e-4900L; + +#ifdef __STDC__ + long double __scalblnl (long double x, long int n) +#else + long double __scalblnl (x,n) + long double x; long int n; +#endif +{ + int32_t k,es,hx,lx; + GET_LDOUBLE_WORDS(es,hx,lx,x); + k = es&0x7fff; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ + x *= two63; + GET_LDOUBLE_EXP(es,x); + k = (hx&0x7fff) - 63; + } + if (k==0x7fff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0x7ffe) + return huge*__copysignl(huge,x); /* overflow */ + if (n< -50000) + return tiny*__copysignl(tiny,x); + if (k > 0) /* normal result */ + {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;} + if (k <= -63) + return tiny*__copysignl(tiny,x); /*underflow*/ + k += 63; /* subnormal result */ + SET_LDOUBLE_EXP(x,(es&0x8000)|k); + return x*twom63; +} +weak_alias (__scalblnl, scalblnl) diff --git a/sysdeps/ieee754/ldbl-96/s_scalbnl.c b/sysdeps/ieee754/ldbl-96/s_scalbnl.c new file mode 100644 index 0000000000..34c52e773a --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_scalbnl.c @@ -0,0 +1,71 @@ +/* s_scalbnl.c -- long double version of s_scalbn.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * scalbnl (long double x, int n) + * scalbnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +two63 = 4.50359962737049600000e+15, +twom63 = 1.08420217248550443400e-19, +huge = 1.0e+4900L, +tiny = 1.0e-4900L; + +#ifdef __STDC__ + long double __scalbnl (long double x, int n) +#else + long double __scalbnl (x,n) + long double x; int n; +#endif +{ + int32_t k,es,hx,lx; + GET_LDOUBLE_WORDS(es,hx,lx,x); + k = es&0x7fff; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ + x *= two63; + GET_LDOUBLE_EXP(es,x); + k = (hx&0x7fff) - 63; + } + if (k==0x7fff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0x7ffe) + return huge*__copysignl(huge,x); /* overflow */ + if (n< -50000) + return tiny*__copysignl(tiny,x); + if (k > 0) /* normal result */ + {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;} + if (k <= -63) + return tiny*__copysignl(tiny,x); /*underflow*/ + k += 63; /* subnormal result */ + SET_LDOUBLE_EXP(x,(es&0x8000)|k); + return x*twom63; +} +weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/ieee754/ldbl-96/s_signbitl.c b/sysdeps/ieee754/ldbl-96/s_signbitl.c new file mode 100644 index 0000000000..b12fdefff4 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_signbitl.c @@ -0,0 +1,32 @@ +/* Return nonzero value if number is negative. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + +int +__signbitl (long double x) +{ + int32_t e; + + GET_LDOUBLE_EXP (e, x); + return e & 0x8000; +} diff --git a/sysdeps/ieee754/ldbl-96/s_sincosl.c b/sysdeps/ieee754/ldbl-96/s_sincosl.c new file mode 100644 index 0000000000..78c78d5619 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_sincosl.c @@ -0,0 +1,74 @@ +/* Compute sine and cosine of argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +void +__sincosl (long double x, long double *sinx, long double *cosx) +{ + int32_t se, i0, i1; + + /* High word of x. */ + GET_LDOUBLE_WORDS (se, i0, i1, x); + + /* |x| ~< pi/4 */ + se &= 0x7fff; + if (se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2)) + { + *sinx = __kernel_sinl (x, 0.0, 0); + *cosx = __kernel_cosl (x, 0.0); + } + else if (se == 0x7fff) + { + /* sin(Inf or NaN) is NaN */ + *sinx = *cosx = x - x; + } + else + { + /* Argument reduction needed. */ + long double y[2]; + int n; + + n = __ieee754_rem_pio2l (x, y); + switch (n & 3) + { + case 0: + *sinx = __kernel_sinl (y[0], y[1], 1); + *cosx = __kernel_cosl (y[0], y[1]); + break; + case 1: + *sinx = __kernel_cosl (y[0], y[1]); + *cosx = -__kernel_sinl (y[0], y[1], 1); + break; + case 2: + *sinx = -__kernel_sinl (y[0], y[1], 1); + *cosx = -__kernel_cosl (y[0], y[1]); + break; + default: + *sinx = -__kernel_cosl (y[0], y[1]); + *cosx = __kernel_sinl (y[0], y[1], 1); + break; + } + } +} +weak_alias (__sincosl, sincosl) diff --git a/sysdeps/ieee754/ldbl-96/s_sinl.c b/sysdeps/ieee754/ldbl-96/s_sinl.c new file mode 100644 index 0000000000..4fd48805b4 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_sinl.c @@ -0,0 +1,88 @@ +/* s_sinl.c -- long double version of s_sin.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* sinl(x) + * Return sine function of x. + * + * kernel function: + * __kernel_sinl ... sine function on [-pi/4,pi/4] + * __kernel_cosl ... cose function on [-pi/4,pi/4] + * __ieee754_rem_pio2l ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __sinl(long double x) +#else + long double __sinl(x) + long double x; +#endif +{ + long double y[2],z=0.0; + int32_t n, se, i0, i1; + + /* High word of x. */ + GET_LDOUBLE_WORDS(se,i0,i1,x); + + /* |x| ~< pi/4 */ + se &= 0x7fff; + if(se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2)) + return __kernel_sinl(x,z,0); + + /* sin(Inf or NaN) is NaN */ + else if (se==0x7fff) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2l(x,y); + switch(n&3) { + case 0: return __kernel_sinl(y[0],y[1],1); + case 1: return __kernel_cosl(y[0],y[1]); + case 2: return -__kernel_sinl(y[0],y[1],1); + default: + return -__kernel_cosl(y[0],y[1]); + } + } +} +weak_alias (__sinl, sinl) diff --git a/sysdeps/ieee754/ldbl-96/s_tanhl.c b/sysdeps/ieee754/ldbl-96/s_tanhl.c new file mode 100644 index 0000000000..1e3dc3b613 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_tanhl.c @@ -0,0 +1,95 @@ +/* s_tanhl.c -- long double version of s_tanh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* tanhl(x) + * Return the Hyperbolic Tangent of x + * + * Method : + * x -x + * e - e + * 0. tanhl(x) is defined to be ----------- + * x -x + * e + e + * 1. reduce x to non-negative by tanhl(-x) = -tanhl(x). + * 2. 0 <= x <= 2**-55 : tanhl(x) := x*(one+x) + * -t + * 2**-55 < x <= 1 : tanhl(x) := -----; t = expm1l(-2x) + * t + 2 + * 2 + * 1 <= x <= 23.0 : tanhl(x) := 1- ----- ; t=expm1l(2x) + * t + 2 + * 23.0 < x <= INF : tanhl(x) := 1. + * + * Special cases: + * tanhl(NaN) is NaN; + * only tanhl(0)=0 is exact for finite argument. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double one=1.0, two=2.0, tiny = 1.0e-4900L; +#else +static long double one=1.0, two=2.0, tiny = 1.0e-4900L; +#endif + +#ifdef __STDC__ + long double __tanhl(long double x) +#else + long double __tanhl(x) + long double x; +#endif +{ + long double t,z; + int32_t se; + u_int32_t j0,j1,ix; + + /* High word of |x|. */ + GET_LDOUBLE_WORDS(se,j0,j1,x); + ix = se&0x7fff; + + /* x is INF or NaN */ + if(ix==0x7fff) { + /* for NaN it's not important which branch: tanhl(NaN) = NaN */ + if (se&0x8000) return one/x-one; /* tanhl(-inf)= -1; */ + else return one/x+one; /* tanhl(+inf)=+1 */ + } + + /* |x| < 23 */ + if (ix < 0x4003 || (ix == 0x4003 && j0 < 0xb8000000u)) {/* |x|<23 */ + if ((ix|j0|j1) == 0) + return x; /* x == +- 0 */ + if (ix<0x3fc8) /* |x|<2**-55 */ + return x*(one+x); /* tanh(small) = small */ + if (ix>=0x3fff) { /* |x|>=1 */ + t = __expm1l(two*fabsl(x)); + z = one - two/(t+two); + } else { + t = __expm1l(-two*fabsl(x)); + z= -t/(t+two); + } + /* |x| > 23, return +-1 */ + } else { + z = one - tiny; /* raised inexact flag */ + } + return (se>0x7fff)? -z: z; +} +weak_alias (__tanhl, tanhl) diff --git a/sysdeps/ieee754/ldbl-96/s_tanl.c b/sysdeps/ieee754/ldbl-96/s_tanl.c new file mode 100644 index 0000000000..97a0b27f32 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_tanl.c @@ -0,0 +1,81 @@ +/* s_tanl.c -- long double version of s_tan.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* tanl(x) + * Return tangent function of x. + * + * kernel function: + * __kernel_tanl ... tangent function on [-pi/4,pi/4] + * __ieee754_rem_pio2l ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __tanl(long double x) +#else + long double __tanl(x) + long double x; +#endif +{ + long double y[2],z=0.0; + int32_t n, se; + + /* High word of x. */ + GET_LDOUBLE_EXP(se,x); + + /* |x| ~< pi/4 */ + se &= 0x7fff; + if(se <= 0x3ffe) return __kernel_tanl(x,z,1); + + /* tan(Inf or NaN) is NaN */ + else if (se==0x7fff) return x-x; /* NaN */ + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2l(x,y); + return __kernel_tanl(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even + -1 -- n odd */ + } +} +weak_alias (__tanl, tanl) diff --git a/sysdeps/ieee754/ldbl-96/s_truncl.c b/sysdeps/ieee754/ldbl-96/s_truncl.c new file mode 100644 index 0000000000..59c3b9c173 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_truncl.c @@ -0,0 +1,57 @@ +/* Truncate argument to nearest integral value not larger than the argument. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include "math_private.h" + + +long double +__truncl (long double x) +{ + int32_t i0, j0; + u_int32_t se, i1; + int sx; + + GET_LDOUBLE_WORDS (se, i0, i1, x); + sx = se & 0x8000; + j0 = (se & 0x7fff) - 0x3fff; + if (j0 < 31) + { + if (j0 < 0) + /* The magnitude of the number is < 1 so the result is +-0. */ + SET_LDOUBLE_WORDS (x, sx, 0, 0); + else + SET_LDOUBLE_WORDS (x, se, i0 & ~(0x7fffffff >> j0), 0); + } + else if (j0 > 63) + { + if (j0 == 0x4000) + /* x is inf or NaN. */ + return x + x; + } + else + { + SET_LDOUBLE_WORDS (x, se, i0, i1 & ~(0xffffffffu >> (j0 - 31))); + } + + return x; +} +weak_alias (__truncl, truncl) diff --git a/sysdeps/ieee754/ldbl-96/strtold.c b/sysdeps/ieee754/ldbl-96/strtold.c new file mode 100644 index 0000000000..cabb787d4e --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/strtold.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* The actual implementation for all floating point sizes is in strtod.c. + These macros tell it to produce the `long double' version, `strtold'. */ + +# define FLOAT long double +# define FLT LDBL +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define STRTOF __strtold_l +# else +# define STRTOF strtold +# endif +# define MPN2FLOAT __mpn_construct_long_double +# define FLOAT_HUGE_VAL HUGE_VALL +# define SET_MANTISSA(flt, mant) \ + do { union ieee854_long_double u; \ + u.d = (flt); \ + if ((mant & 0x7fffffffffffffffULL) == 0) \ + mant = 0x4000000000000000ULL; \ + u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000; \ + u.ieee.mantissa1 = (mant) & 0xffffffff; \ + (flt) = u.d; \ + } while (0) + +# include "strtod.c" diff --git a/sysdeps/ieee754/ldbl-96/w_expl.c b/sysdeps/ieee754/ldbl-96/w_expl.c new file mode 100644 index 0000000000..b8152cea65 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/w_expl.c @@ -0,0 +1,60 @@ +/* w_expl.c -- long double version of w_exp.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper expl(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +o_threshold= 1.135652340629414394949193107797076489134e4, + /* 0x400C, 0xB17217F7, 0xD1CF79AC */ +u_threshold= -1.140019167866942050398521670162263001513e4; + /* 0x400C, 0xB220C447, 0x69C201E8 */ + +#ifdef __STDC__ + long double __expl(long double x) /* wrapper exp */ +#else + long double __expl(x) /* wrapper exp */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_expl(x); +#else + long double z; + z = __ieee754_expl(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitel(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,206); /* exp overflow */ + else if(x -#include -#include -#include - -#ifndef __NO_LONG_DOUBLE_MATH - -/* Convert a `long double' in IEEE854 standard double-precision format to a - multi-precision integer representing the significand scaled up by its - number of bits (64 for long double) and an integral power of two - (MPN frexpl). */ - -mp_size_t -__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, - int *expt, int *is_neg, - long double value) -{ - union ieee854_long_double u; - u.d = value; - - *is_neg = u.ieee.negative; - *expt = (int) u.ieee.exponent - IEEE854_LONG_DOUBLE_BIAS; - -#if BITS_PER_MP_LIMB == 32 - res_ptr[0] = u.ieee.mantissa1; /* Low-order 32 bits of fraction. */ - res_ptr[1] = u.ieee.mantissa0; /* High-order 32 bits. */ - #define N 2 -#elif BITS_PER_MP_LIMB == 64 - /* Hopefully the compiler will combine the two bitfield extracts - and this composition into just the original quadword extract. */ - res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; - #define N 1 -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif - - if (u.ieee.exponent == 0) - { - /* A biased exponent of zero is a special case. - Either it is a zero or it is a denormal number. */ - if (res_ptr[0] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=2. */ - /* It's zero. */ - *expt = 0; - else - { - /* It is a denormal number, meaning it has no implicit leading - one bit, and its exponent is in fact the format minimum. */ - int cnt; - - if (res_ptr[N - 1] != 0) - { - count_leading_zeros (cnt, res_ptr[N - 1]); - if (cnt != 0) - { -#if N == 2 - res_ptr[N - 1] = res_ptr[N - 1] << cnt - | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt)); - res_ptr[0] <<= cnt; -#else - res_ptr[N - 1] <<= cnt; -#endif - } - *expt = LDBL_MIN_EXP - 1 - cnt; - } - else - { - count_leading_zeros (cnt, res_ptr[0]); - res_ptr[N - 1] = res_ptr[0] << cnt; - res_ptr[0] = 0; - *expt = LDBL_MIN_EXP - 1 - BITS_PER_MP_LIMB - cnt; - } - } - } - - return N; -} - -#endif /* __NO_LONG_DOUBLE_MATH */ diff --git a/sysdeps/ieee754/mpn2dbl.c b/sysdeps/ieee754/mpn2dbl.c deleted file mode 100644 index 8145eb9c3d..0000000000 --- a/sysdeps/ieee754/mpn2dbl.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include -#include - -/* Convert a multi-precision integer of the needed number of bits (53 for - double) and an integral power of two to a `double' in IEEE754 double- - precision format. */ - -double -__mpn_construct_double (mp_srcptr frac_ptr, int expt, int negative) -{ - union ieee754_double u; - - u.ieee.negative = negative; - u.ieee.exponent = expt + IEEE754_DOUBLE_BIAS; -#if BITS_PER_MP_LIMB == 32 - u.ieee.mantissa1 = frac_ptr[0]; - u.ieee.mantissa0 = frac_ptr[1] & ((1 << (DBL_MANT_DIG - 32)) - 1); -#elif BITS_PER_MP_LIMB == 64 - u.ieee.mantissa1 = frac_ptr[0] & ((1L << 32) - 1); - u.ieee.mantissa0 = (frac_ptr[0] >> 32) & ((1 << (DBL_MANT_DIG - 32)) - 1); -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif - - return u.d; -} diff --git a/sysdeps/ieee754/mpn2flt.c b/sysdeps/ieee754/mpn2flt.c deleted file mode 100644 index a409b456b0..0000000000 --- a/sysdeps/ieee754/mpn2flt.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1995, 1997 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include -#include - -/* Convert a multi-precision integer of the needed number of bits (24 for - float) and an integral power of two to a `float' in IEEE754 single- - precision format. */ - -float -__mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign) -{ - union ieee754_float u; - - u.ieee.negative = sign; - u.ieee.exponent = expt + IEEE754_FLOAT_BIAS; -#if BITS_PER_MP_LIMB > FLT_MANT_DIG - u.ieee.mantissa = frac_ptr[0] & ((1 << FLT_MANT_DIG) - 1); -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif - - return u.f; -} diff --git a/sysdeps/ieee754/mpn2ldbl.c b/sysdeps/ieee754/mpn2ldbl.c deleted file mode 100644 index 7802355eba..0000000000 --- a/sysdeps/ieee754/mpn2ldbl.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include -#include -#include - -#ifndef __NO_LONG_DOUBLE_MATH - -/* Convert a multi-precision integer of the needed number of bits (64 for - long double) and an integral power of two to a `long double' in IEEE854 - extended-precision format. */ - -long double -__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign) -{ - union ieee854_long_double u; - - u.ieee.negative = sign; - u.ieee.exponent = expt + IEEE854_LONG_DOUBLE_BIAS; -#if BITS_PER_MP_LIMB == 32 - u.ieee.mantissa1 = frac_ptr[0]; - u.ieee.mantissa0 = frac_ptr[1]; -#elif BITS_PER_MP_LIMB == 64 - u.ieee.mantissa1 = frac_ptr[0] & ((1L << 32) - 1); - u.ieee.mantissa0 = frac_ptr[0] >> 32; -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif - - return u.d; -} - -#endif /* __NO_LONG_DOUBLE_MATH */ diff --git a/sysdeps/ieee754/s_lib_version.c b/sysdeps/ieee754/s_lib_version.c new file mode 100644 index 0000000000..121bdaa540 --- /dev/null +++ b/sysdeps/ieee754/s_lib_version.c @@ -0,0 +1,40 @@ +/* @(#)s_lib_ver.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_lib_version.c,v 1.6 1995/05/10 20:47:44 jtc Exp $"; +#endif + +/* + * MACRO for standards + */ + +#include "math.h" +#include "math_private.h" + +/* + * define and initialize _LIB_VERSION + */ +#ifdef _POSIX_MODE +_LIB_VERSION_TYPE _LIB_VERSION = _POSIX_; +#else +#ifdef _XOPEN_MODE +_LIB_VERSION_TYPE _LIB_VERSION = _XOPEN_; +#else +#ifdef _SVID3_MODE +_LIB_VERSION_TYPE _LIB_VERSION = _SVID_; +#else /* default _IEEE_MODE */ +_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; +#endif +#endif +#endif + diff --git a/sysdeps/ieee754/s_matherr.c b/sysdeps/ieee754/s_matherr.c new file mode 100644 index 0000000000..1ad3eb3334 --- /dev/null +++ b/sysdeps/ieee754/s_matherr.c @@ -0,0 +1,35 @@ +/* @(#)s_matherr.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_matherr.c,v 1.6 1995/05/10 20:47:53 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int + weak_function + __matherr(struct exception *x) +#else + int + weak_function + __matherr(x) + struct exception *x; +#endif +{ + int n=0; + if(x->arg1!=x->arg1) return 0; + return n; +} +weak_alias (__matherr, matherr) diff --git a/sysdeps/ieee754/s_signgam.c b/sysdeps/ieee754/s_signgam.c new file mode 100644 index 0000000000..021b0ffca1 --- /dev/null +++ b/sysdeps/ieee754/s_signgam.c @@ -0,0 +1,3 @@ +#include "math.h" +#include "math_private.h" +int signgam; diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S deleted file mode 100644 index b9d07b1091..0000000000 --- a/sysdeps/libm-i387/e_acos.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: e_acos.S,v 1.4 1995/05/08 23:44:37 jtc Exp $") - -/* acos = atan (sqrt(1 - x^2) / x) */ -ENTRY(__ieee754_acos) - fldl 4(%esp) /* x */ - fld %st /* x : x */ - fmul %st(0) /* x^2 : x */ - fld1 /* 1 : x^2 : x */ - fsubp /* 1 - x^2 : x */ - fsqrt /* sqrt (1 - x^2) : x */ - fxch %st(1) /* x : sqrt (1 - x^2) */ - fpatan /* atan (sqrt(1 - x^2) / x) */ - ret -END (__ieee754_acos) diff --git a/sysdeps/libm-i387/e_acosf.S b/sysdeps/libm-i387/e_acosf.S deleted file mode 100644 index 50b13fd1bd..0000000000 --- a/sysdeps/libm-i387/e_acosf.S +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float type by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -/* acos = atan (sqrt(1 - x^2) / x) */ -ENTRY(__ieee754_acosf) - flds 4(%esp) /* x */ - fld %st - fmul %st(0) /* x^2 */ - fld1 - fsubp /* 1 - x^2 */ - fsqrt /* sqrt (1 - x^2) */ - fxch %st(1) - fpatan - ret -END (__ieee754_acosf) diff --git a/sysdeps/libm-i387/e_acosh.S b/sysdeps/libm-i387/e_acosh.S deleted file mode 100644 index a3397b365c..0000000000 --- a/sysdeps/libm-i387/e_acosh.S +++ /dev/null @@ -1,105 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - 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) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_acosh) - movl 8(%esp), %ecx - cmpl $0x3ff00000, %ecx - jl 5f // < 1 => invalid - fldln2 // log(2) - fldl 4(%esp) // x : log(2) - cmpl $0x41b00000, %ecx - ja 3f // x > 2^28 -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpl $0x40000000, %ecx - ja 4f // x > 2 - - // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - fsubl MO(one) // x-1 : log(2) - fld %st // x-1 : x-1 : log(2) - fmul %st(1) // (x-1)^2 : x-1 : log(2) - fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) - fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) - fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) - faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 2f - fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - ret - -2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) - fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) - ret - - // x > 2^28 => y = log(x) + log(2) - .align ALIGNARG(4) -3: fyl2x // log(x) - fldln2 // log(2) : log(x) - faddp // log(x)+log(2) - ret - - // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) - .align ALIGNARG(4) -4: fld %st // x : x : log(2) - fadd %st, %st(1) // x : 2*x : log(2) - fld %st // x : x : 2*x : log(2) - fmul %st(1) // x^2 : x : 2*x : log(2) - fsubl MO(one) // x^2-1 : x : 2*x : log(2) - fsqrt // sqrt(x^2-1) : x : 2*x : log(2) - faddp // x+sqrt(x^2-1) : 2*x : log(2) - fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) - fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) - fyl2x // log(2*x+1/(x+sqrt(x^2-1))) - ret - - // x < 1 => NaN - .align ALIGNARG(4) -5: fldz - fdiv %st, %st(0) - ret -END(__ieee754_acosh) diff --git a/sysdeps/libm-i387/e_acoshf.S b/sysdeps/libm-i387/e_acoshf.S deleted file mode 100644 index 8aa78957e2..0000000000 --- a/sysdeps/libm-i387/e_acoshf.S +++ /dev/null @@ -1,105 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - 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) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_acoshf) - movl 4(%esp), %ecx - cmpl $0x3f800000, %ecx - jl 5f // < 1 => invalid - fldln2 // log(2) - flds 4(%esp) // x : log(2) - cmpl $0x47000000, %ecx - ja 3f // x > 2^14 -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpl $0x40000000, %ecx - ja 4f // x > 2 - - // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - fsubl MO(one) // x-1 : log(2) - fld %st // x-1 : x-1 : log(2) - fmul %st(1) // (x-1)^2 : x-1 : log(2) - fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) - fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) - fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) - faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 2f - fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - ret - -2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) - fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) - ret - - // x > 2^14 => y = log(x) + log(2) - .align ALIGNARG(4) -3: fyl2x // log(x) - fldln2 // log(2) : log(x) - faddp // log(x)+log(2) - ret - - // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) - .align ALIGNARG(4) -4: fld %st // x : x : log(2) - fadd %st, %st(1) // x : 2*x : log(2) - fld %st // x : x : 2*x : log(2) - fmul %st(1) // x^2 : x : 2*x : log(2) - fsubl MO(one) // x^2-1 : x : 2*x : log(2) - fsqrt // sqrt(x^2-1) : x : 2*x : log(2) - faddp // x+sqrt(x^2-1) : 2*x : log(2) - fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) - fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) - fyl2x // log(2*x+1/(x+sqrt(x^2-1))) - ret - - // x < 1 => NaN - .align ALIGNARG(4) -5: fldz - fdiv %st, %st(0) - ret -END(__ieee754_acoshf) diff --git a/sysdeps/libm-i387/e_acoshl.S b/sysdeps/libm-i387/e_acoshl.S deleted file mode 100644 index 0c81daaebe..0000000000 --- a/sysdeps/libm-i387/e_acoshl.S +++ /dev/null @@ -1,112 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - /* 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. */ - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_acoshl) - movl 12(%esp), %ecx - andl $0xffff, %ecx - cmpl $0x3fff, %ecx - jl 5f // < 1 => invalid - fldln2 // log(2) - fldt 4(%esp) // x : log(2) - cmpl $0x4020, %ecx - ja 3f // x > 2^34 -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpl $0x4000, %ecx - ja 4f // x > 2 - - // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - fsubl MO(one) // x-1 : log(2) - fld %st // x-1 : x-1 : log(2) - fmul %st(1) // (x-1)^2 : x-1 : log(2) - fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) - fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) - fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) - faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 2f - fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) - ret - -2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) - fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) - ret - - // x > 2^34 => y = log(x) + log(2) - .align ALIGNARG(4) -3: fyl2x // log(x) - fldln2 // log(2) : log(x) - faddp // log(x)+log(2) - ret - - // 2^34 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) - .align ALIGNARG(4) -4: fld %st // x : x : log(2) - fadd %st, %st(1) // x : 2*x : log(2) - fld %st // x : x : 2*x : log(2) - fmul %st(1) // x^2 : x : 2*x : log(2) - fsubl MO(one) // x^2-1 : x : 2*x : log(2) - fsqrt // sqrt(x^2-1) : x : 2*x : log(2) - faddp // x+sqrt(x^2-1) : 2*x : log(2) - fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) - fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) - fyl2x // log(2*x+1/(x+sqrt(x^2-1))) - ret - - // x < 1 => NaN - .align ALIGNARG(4) -5: fldz - fdiv %st, %st(0) - ret -END(__ieee754_acoshl) diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S deleted file mode 100644 index d69f056556..0000000000 --- a/sysdeps/libm-i387/e_acosl.S +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - - -/* acosl = atanl (sqrtl(1 - x^2) / x) */ -ENTRY(__ieee754_acosl) - fldt 4(%esp) /* x */ - fld %st - fmul %st(0) /* x^2 */ - fld1 - fsubp /* 1 - x^2 */ - fsqrt /* sqrtl (1 - x^2) */ - fxch %st(1) - fpatan - ret -END (__ieee754_acosl) diff --git a/sysdeps/libm-i387/e_asin.S b/sysdeps/libm-i387/e_asin.S deleted file mode 100644 index 945e308245..0000000000 --- a/sysdeps/libm-i387/e_asin.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: e_asin.S,v 1.4 1995/05/08 23:45:40 jtc Exp $") - -/* asin = atan (x / sqrt(1 - x^2)) */ -ENTRY(__ieee754_asin) - fldl 4(%esp) /* x */ - fld %st - fmul %st(0) /* x^2 */ - fld1 - fsubp /* 1 - x^2 */ - fsqrt /* sqrt (1 - x^2) */ - fpatan - ret -END (__ieee754_asin) diff --git a/sysdeps/libm-i387/e_asinf.S b/sysdeps/libm-i387/e_asinf.S deleted file mode 100644 index d450e9a740..0000000000 --- a/sysdeps/libm-i387/e_asinf.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float type by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -/* asin = atan (x / sqrt(1 - x^2)) */ -ENTRY(__ieee754_asinf) - flds 4(%esp) /* x */ - fld %st - fmul %st(0) /* x^2 */ - fld1 - fsubp /* 1 - x^2 */ - fsqrt /* sqrt (1 - x^2) */ - fpatan - ret -END (__ieee754_asinf) diff --git a/sysdeps/libm-i387/e_asinl.S b/sysdeps/libm-i387/e_asinl.S deleted file mode 100644 index 3919fbcf58..0000000000 --- a/sysdeps/libm-i387/e_asinl.S +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -/* asinl = atanl (x / sqrtl(1 - x^2)) */ -ENTRY(__ieee754_asinl) - fldt 4(%esp) /* x */ - fld %st - fmul %st(0) /* x^2 */ - fld1 - fsubp /* 1 - x^2 */ - fsqrt /* sqrt (1 - x^2) */ - fpatan - ret -END (__ieee754_asinl) diff --git a/sysdeps/libm-i387/e_atan2.S b/sysdeps/libm-i387/e_atan2.S deleted file mode 100644 index 8df04e485e..0000000000 --- a/sysdeps/libm-i387/e_atan2.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: e_atan2.S,v 1.4 1995/05/08 23:46:28 jtc Exp $") - -ENTRY(__ieee754_atan2) - fldl 4(%esp) - fldl 12(%esp) - fpatan - ret -END (__ieee754_atan2) diff --git a/sysdeps/libm-i387/e_atan2f.S b/sysdeps/libm-i387/e_atan2f.S deleted file mode 100644 index fc6621f183..0000000000 --- a/sysdeps/libm-i387/e_atan2f.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: e_atan2f.S,v 1.1 1995/05/08 23:35:10 jtc Exp $") - -ENTRY(__ieee754_atan2f) - flds 4(%esp) - flds 8(%esp) - fpatan - ret -END (__ieee754_atan2f) diff --git a/sysdeps/libm-i387/e_atan2l.S b/sysdeps/libm-i387/e_atan2l.S deleted file mode 100644 index f58eaa94a9..0000000000 --- a/sysdeps/libm-i387/e_atan2l.S +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_atan2l) - fldt 4(%esp) - fldt 16(%esp) - fpatan - ret -END (__ieee754_atan2l) diff --git a/sysdeps/libm-i387/e_atanh.S b/sysdeps/libm-i387/e_atanh.S deleted file mode 100644 index 231e96f57f..0000000000 --- a/sysdeps/libm-i387/e_atanh.S +++ /dev/null @@ -1,101 +0,0 @@ -/* ix87 specific implementation of arctanh function. - Copyright (C) 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(half,@object) -half: .double 0.5 - ASM_SIZE_DIRECTIVE(half) - 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(ln2_2,@object) -ln2_2: .tfloat 0.3465735902799726547086160 - ASM_SIZE_DIRECTIVE(ln2_2) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_atanh) - movl 8(%esp), %ecx - -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - - andl $0x80000000, %ecx // ECX == 0 iff X >= 0 - - fldt MO(ln2_2) // 0.5*ln2 - xorl %ecx, 8(%esp) - fldl 4(%esp) // |x| : 0.5*ln2 - fcoml MO(half) // |x| : 0.5*ln2 - fld %st // |x| : |x| : 0.5*ln2 - fnstsw // |x| : |x| : 0.5*ln2 - sahf - jae 2f - fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 - fld %st // |x| : |x| : 2*|x| : 0.5*ln2 - fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 - fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 - fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 - fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 - faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - sahf - jae 4f - fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) -3: ret - - .align ALIGNARG(4) -4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) -3: ret - - .align ALIGNARG(4) -2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 - fxch // |x| : 1+|x| : 0.5*ln2 - fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 - fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 - fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld((1+x)/(1-x)) -3: ret -END(__ieee754_atanh) diff --git a/sysdeps/libm-i387/e_atanhf.S b/sysdeps/libm-i387/e_atanhf.S deleted file mode 100644 index 687d4c97fb..0000000000 --- a/sysdeps/libm-i387/e_atanhf.S +++ /dev/null @@ -1,102 +0,0 @@ -/* ix87 specific implementation of arctanh function. - Copyright (C) 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(half,@object) -half: .double 0.5 - ASM_SIZE_DIRECTIVE(half) - 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) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(ln2_2,@object) -ln2_2: .tfloat 0.3465735902799726547086160 - ASM_SIZE_DIRECTIVE(ln2_2) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_atanhf) - movl 4(%esp), %ecx - -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - - andl $0x80000000, %ecx // ECX == 0 iff X >= 0 - - fldt MO(ln2_2) // 0.5*ln2 - xorl %ecx, 4(%esp) - flds 4(%esp) // |x| : 0.5*ln2 - fcoml MO(half) // |x| : 0.5*ln2 - fld %st(0) // |x| : |x| : 0.5*ln2 - fnstsw // |x| : |x| : 0.5*ln2 - sahf - jae 2f - fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 - fld %st // |x| : |x| : 2*|x| : 0.5*ln2 - fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 - fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 - fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 - fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 - faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - sahf - jae 4f - fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) -3: ret - - .align ALIGNARG(4) -4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) -3: ret - - .align ALIGNARG(4) -2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 - fxch // |x| : 1+|x| : 0.5*ln2 - fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 - fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 - fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld((1+x)/(1-x)) -3: ret -END(__ieee754_atanhf) diff --git a/sysdeps/libm-i387/e_atanhl.S b/sysdeps/libm-i387/e_atanhl.S deleted file mode 100644 index 8a2bd11ce4..0000000000 --- a/sysdeps/libm-i387/e_atanhl.S +++ /dev/null @@ -1,108 +0,0 @@ -/* ix87 specific implementation of arctanh function. - Copyright (C) 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - /* Please note that we use double values for 0.5 and 1.0. These - numbers have exact representations and so we don't get accuracy - problems. The advantage is that the code is simpler. */ - ASM_TYPE_DIRECTIVE(half,@object) -half: .double 0.5 - ASM_SIZE_DIRECTIVE(half) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(ln2_2,@object) -ln2_2: .tfloat 0.3465735902799726547086160 - ASM_SIZE_DIRECTIVE(ln2_2) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_atanhl) - movl 12(%esp), %ecx - -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - - andl $0x8000, %ecx // ECX == 0 iff X >= 0 - - fldt MO(ln2_2) // 0.5*ln2 - xorl %ecx, 12(%esp) - fldt 4(%esp) // |x| : 0.5*ln2 - fcoml MO(half) // |x| : 0.5*ln2 - fld %st(0) // |x| : |x| : 0.5*ln2 - fnstsw // |x| : |x| : 0.5*ln2 - sahf - jae 2f - fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 - fld %st // |x| : |x| : 2*|x| : 0.5*ln2 - fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 - fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 - fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 - fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 - faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - sahf - jae 4f - fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) -3: ret - - .align ALIGNARG(4) -4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 - fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) -3: ret - - .align ALIGNARG(4) -2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 - fxch // |x| : 1+|x| : 0.5*ln2 - fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 - fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 - fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) - jecxz 3f - fchs // 0.5*ln2*ld((1+x)/(1-x)) -3: ret -END(__ieee754_atanhl) diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S deleted file mode 100644 index 4a75fa1d1c..0000000000 --- a/sysdeps/libm-i387/e_exp.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: e_exp.S,v 1.7 1996/07/03 17:31:28 jtc Exp $") - -/* e^x = 2^(x * log2(e)) */ -ENTRY(__ieee754_exp) - fldl 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2e - fmulp /* x * log2(e) */ - fld %st - frndint /* int(x * log2(e)) */ - fsubr %st,%st(1) /* fract(x * log2(e)) */ - fxch - f2xm1 /* 2^(fract(x * log2(e))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(e))) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp) diff --git a/sysdeps/libm-i387/e_exp10.S b/sysdeps/libm-i387/e_exp10.S deleted file mode 100644 index 6bfcdbb723..0000000000 --- a/sysdeps/libm-i387/e_exp10.S +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Written by Ulrich Drepper . - */ - -#include - -/* 10^x = 2^(x * log2(10)) */ -ENTRY(__ieee754_exp10) - fldl 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2t - fmulp /* x * log2(10) */ - fld %st - frndint /* int(x * log2(10)) */ - fsubr %st,%st(1) /* fract(x * log2(10)) */ - fxch - f2xm1 /* 2^(fract(x * log2(10))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(10))) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp10) diff --git a/sysdeps/libm-i387/e_exp10f.S b/sysdeps/libm-i387/e_exp10f.S deleted file mode 100644 index 4791b99afa..0000000000 --- a/sysdeps/libm-i387/e_exp10f.S +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Written by Ulrich Drepper. - */ - -#include - -/* e^x = 2^(x * log2(10)) */ -ENTRY(__ieee754_exp10f) - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2t - fmulp /* x * log2(10) */ - fld %st - frndint /* int(x * log2(10)) */ - fsubr %st,%st(1) /* fract(x * log2(10)) */ - fxch - f2xm1 /* 2^(fract(x * log2(10))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(10))) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp10f) diff --git a/sysdeps/libm-i387/e_exp10l.S b/sysdeps/libm-i387/e_exp10l.S deleted file mode 100644 index 71f0da792d..0000000000 --- a/sysdeps/libm-i387/e_exp10l.S +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Written by Ulrich Drepper . - */ - -#include - -/* e^x = 2^(x * log2l(10)) */ -ENTRY(__ieee754_exp10l) - fldt 4(%esp) -/* I added the following ugly construct because expl(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2t - fmulp /* x * log2(10) */ - fld %st - frndint /* int(x * log2(10)) */ - fsubr %st,%st(1) /* fract(x * log2(10)) */ - fxch - f2xm1 /* 2^(fract(x * log2(10))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(10))) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp10l) diff --git a/sysdeps/libm-i387/e_expf.S b/sysdeps/libm-i387/e_expf.S deleted file mode 100644 index 5fd49b89fd..0000000000 --- a/sysdeps/libm-i387/e_expf.S +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float type by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -/* e^x = 2^(x * log2(e)) */ -ENTRY(__ieee754_expf) - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2e - fmulp /* x * log2(e) */ - fld %st - frndint /* int(x * log2(e)) */ - fsubr %st,%st(1) /* fract(x * log2(e)) */ - fxch - f2xm1 /* 2^(fract(x * log2(e))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(e))) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_expf) diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S deleted file mode 100644 index 2bcdf58c58..0000000000 --- a/sysdeps/libm-i387/e_expl.S +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -/* e^x = 2^(x * log2l(e)) */ -ENTRY(__ieee754_expl) - fldt 4(%esp) -/* I added the following ugly construct because expl(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2e - fmulp /* x * log2(e) */ - fld %st - frndint /* int(x * log2(e)) */ - fsubr %st,%st(1) /* fract(x * log2(e)) */ - fxch - f2xm1 /* 2^(fract(x * log2(e))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(e))) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_expl) diff --git a/sysdeps/libm-i387/e_fmod.S b/sysdeps/libm-i387/e_fmod.S deleted file mode 100644 index 4cf6e92054..0000000000 --- a/sysdeps/libm-i387/e_fmod.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -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) -1: fprem - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_fmod) diff --git a/sysdeps/libm-i387/e_fmodf.S b/sysdeps/libm-i387/e_fmodf.S deleted file mode 100644 index bbce40976d..0000000000 --- a/sysdeps/libm-i387/e_fmodf.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float type by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_fmodf) - flds 8(%esp) - flds 4(%esp) -1: fprem - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END(__ieee754_fmodf) diff --git a/sysdeps/libm-i387/e_fmodl.S b/sysdeps/libm-i387/e_fmodl.S deleted file mode 100644 index 7ae63a40ab..0000000000 --- a/sysdeps/libm-i387/e_fmodl.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_fmodl) - fldt 16(%esp) - fldt 4(%esp) -1: fprem - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_fmodl) diff --git a/sysdeps/libm-i387/e_hypot.S b/sysdeps/libm-i387/e_hypot.S deleted file mode 100644 index 07a32878a0..0000000000 --- a/sysdeps/libm-i387/e_hypot.S +++ /dev/null @@ -1,62 +0,0 @@ -/* Compute the hypothenuse of X and Y. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__ieee754_hypot) - fldl 4(%esp) // x - fxam - fnstsw - fldl 12(%esp) // y : x - movb %ah, %ch - fxam - fnstsw - movb %ah, %al - orb %ch, %ah - sahf - jc 1f - fmul %st(0) // y * y : x - fxch // x : y * y - fmul %st(0) // x * x : y * y - faddp // x * x + y * y - fsqrt -2: ret - - // We have to test whether any of the parameters is Inf. - // In this case the result is infinity. -1: andb $0x45, %al - cmpb $5, %al - je 3f // jump if y is Inf - andb $0x45, %ch - cmpb $5, %ch - jne 4f // jump if x is not Inf - fxch -3: fstp %st(1) - fabs - jmp 2b - -4: testb $1, %al - jnz 5f // y is NaN - fxch -5: fstp %st(1) - jmp 2b - -END(__ieee754_hypot) diff --git a/sysdeps/libm-i387/e_hypotf.S b/sysdeps/libm-i387/e_hypotf.S deleted file mode 100644 index bf5416b664..0000000000 --- a/sysdeps/libm-i387/e_hypotf.S +++ /dev/null @@ -1,62 +0,0 @@ -/* Compute the hypothenuse of X and Y. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__ieee754_hypotf) - flds 4(%esp) // x - fxam - fnstsw - flds 8(%esp) // y : x - movb %ah, %ch - fxam - fnstsw - movb %ah, %al - orb %ch, %ah - sahf - jc 1f - fmul %st(0) // y * y : x - fxch // x : y * y - fmul %st(0) // x * x : y * y - faddp // x * x + y * y - fsqrt -2: ret - - // We have to test whether any of the parameters is Inf. - // In this case the result is infinity. -1: andb $0x45, %al - cmpb $5, %al - je 3f // jump if y is Inf - andb $0x45, %ch - cmpb $5, %ch - jne 4f // jump if x is not Inf - fxch -3: fstp %st(1) - fabs - jmp 2b - -4: testb $1, %al - jnz 5f // y is NaN - fxch -5: fstp %st(1) - jmp 2b - -END(__ieee754_hypotf) diff --git a/sysdeps/libm-i387/e_log.S b/sysdeps/libm-i387/e_log.S deleted file mode 100644 index c7cacdfb0a..0000000000 --- a/sysdeps/libm-i387/e_log.S +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_log) - fldln2 // log(2) - fldl 4(%esp) // x : log(2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - 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 2f - fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : log(2) - fyl2x // log(x) - ret -END (__ieee754_log) diff --git a/sysdeps/libm-i387/e_log10.S b/sysdeps/libm-i387/e_log10.S deleted file mode 100644 index 2c8488c3a9..0000000000 --- a/sysdeps/libm-i387/e_log10.S +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_log10) - fldlg2 // log10(2) - fldl 4(%esp) // x : log10(2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - fld %st // x : x : log10(2) - 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 2f - fstp %st(1) // x-1 : log10(2) - fyl2xp1 // log10(x) - ret - -2: fstp %st(0) // x : log10(2) - fyl2x // log10(x) - ret -END (__ieee754_log10) diff --git a/sysdeps/libm-i387/e_log10f.S b/sysdeps/libm-i387/e_log10f.S deleted file mode 100644 index 2c07161085..0000000000 --- a/sysdeps/libm-i387/e_log10f.S +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float type by Ulrich Drepper . - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -RCSID("$NetBSD: $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_log10f) - fldlg2 // log10(2) - flds 4(%esp) // x : log10(2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - fld %st // x : x : log10(2) - 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 2f - fstp %st(1) // x-1 : log10(2) - fyl2xp1 // log10(x) - ret - -2: fstp %st(0) // x : log10(2) - fyl2x // log10(x) - ret -END (__ieee754_log10f) diff --git a/sysdeps/libm-i387/e_log10l.S b/sysdeps/libm-i387/e_log10l.S deleted file mode 100644 index 6fe7c5a6f7..0000000000 --- a/sysdeps/libm-i387/e_log10l.S +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -RCSID("$NetBSD: $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_log10l) - fldlg2 // log10(2) - fldt 4(%esp) // x : log10(2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - fld %st // x : x : log10(2) - 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 2f - fstp %st(1) // x-1 : log10(2) - fyl2xp1 // log10(x) - ret - -2: fstp %st(0) // x : log10(2) - fyl2x // log10(x) - ret -END(__ieee754_log10l) diff --git a/sysdeps/libm-i387/e_logf.S b/sysdeps/libm-i387/e_logf.S deleted file mode 100644 index bdba1d3225..0000000000 --- a/sysdeps/libm-i387/e_logf.S +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float by Ulrich Drepper . - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_logf) - fldln2 // log(2) - flds 4(%esp) // x : log(2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - 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 2f - fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : log(2) - fyl2x // log(x) - ret -END (__ieee754_logf) diff --git a/sysdeps/libm-i387/e_logl.S b/sysdeps/libm-i387/e_logl.S deleted file mode 100644 index bda3ea508e..0000000000 --- a/sysdeps/libm-i387/e_logl.S +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__ieee754_logl) - fldln2 // log(2) - fldt 4(%esp) // x : log(2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - 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 2f - fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : log(2) - fyl2x // log(x) - ret -END (__ieee754_logl) diff --git a/sysdeps/libm-i387/e_pow.S b/sysdeps/libm-i387/e_pow.S deleted file mode 100644 index 75ad211872..0000000000 --- a/sysdeps/libm-i387/e_pow.S +++ /dev/null @@ -1,320 +0,0 @@ -/* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(infinity,@object) -inf_zero: -infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - ASM_SIZE_DIRECTIVE(infinity) - ASM_TYPE_DIRECTIVE(zero,@object) -zero: .double 0.0 - ASM_SIZE_DIRECTIVE(zero) - ASM_TYPE_DIRECTIVE(minf_mzero,@object) -minf_mzero: -minfinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff -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) - -#ifdef PIC -#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) -#endif - - .text -ENTRY(__ieee754_pow) - fldl 12(%esp) // y - fxam - -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - - fnstsw - movb %ah, %dl - andb $0x45, %ah - cmpb $0x40, %ah // is y == 0 ? - je 11f - - cmpb $0x05, %ah // is y == ±inf ? - je 12f - - cmpb $0x01, %ah // is y == NaN ? - je 30f - - fldl 4(%esp) // x : y - - subl $8,%esp - - fxam - fnstsw - movb %ah, %dh - andb $0x45, %ah - cmpb $0x40, %ah - je 20f // x is ±0 - - cmpb $0x05, %ah - je 15f // x is ±inf - - fxch // y : x - - /* First see whether `y' is a natural number. In this case we - can use a more precise algorithm. */ - fld %st // y : y : x - fistpll (%esp) // y : x - fildll (%esp) // int(y) : y : x - fucomp %st(1) // y : x - fnstsw - sahf - jne 2f - - /* OK, we have an integer value for y. */ - popl %eax - popl %edx - orl $0, %edx - fstp %st(0) // x - jns 4f // y >= 0, jump - fdivrl MO(one) // 1/x (now referred to as x) - negl %eax - adcl $0, %edx - negl %edx -4: fldl MO(one) // 1 : x - fxch - -6: shrdl $1, %edx, %eax - jnc 5f - fxch - fmul %st(1) // x : ST*x - fxch -5: fmul %st(0), %st // x*x : ST*x - shrl $1, %edx - movl %eax, %ecx - orl %edx, %ecx - jnz 6b - fstp %st(0) // ST*x -30: ret - - .align ALIGNARG(4) -2: /* y is a real number. */ - fxch // x : y - fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y - fnstsw - fxch // x : 1.0 : y - sahf - ja 7f - fsub %st(1) // x-1 : 1.0 : y - fyl2xp1 // log2(x) : y - jmp 8f - -7: fyl2x // log2(x) : y -8: fmul %st(1) // y*log2(x) : y - fst %st(1) // y*log2(x) : y*log2(x) - frndint // int(y*log2(x)) : y*log2(x) - fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) - fxch // fract(y*log2(x)) : int(y*log2(x)) - f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) - faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) - fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) - addl $8, %esp - fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) - ret - - - // pow(x,±0) = 1 - .align ALIGNARG(4) -11: fstp %st(0) // pop y - fldl MO(one) - ret - - // y == ±inf - .align ALIGNARG(4) -12: fstp %st(0) // pop y - fldl 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 - fnstsw - andb $0x45, %ah - cmpb $0x45, %ah - je 13f // jump if x is NaN - - cmpb $0x40, %ah - je 14f // jump if |x| == 1 - - shlb $1, %ah - xorb %ah, %dl - andl $2, %edx - fldl MOX(inf_zero, %edx, 4) - ret - - .align ALIGNARG(4) -14: fldl MO(infinity) - fmull MO(zero) // raise invalid exception - ret - - .align ALIGNARG(4) -13: fldl 4(%esp) // load x == NaN - ret - - .align ALIGNARG(4) - // x is ±inf -15: fstp %st(0) // y - testb $2, %dh - jz 16f // jump if x == +inf - - // We must find out whether y is an odd integer. - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 17f - - // OK, the value is an integer, but is the number of bits small - // enough so that all are coming from the mantissa? - popl %eax - popl %edx - andb $1, %al - jz 18f // jump if not odd - movl %edx, %eax - orl %edx, %edx - jns 155f - negl %eax -155: cmpl $0x00200000, %eax - ja 18f // does not fit in mantissa bits - // It's an odd integer. - shrl $31, %edx - fldl MOX(minf_mzero, %edx, 8) - ret - - .align ALIGNARG(4) -16: fcompl MO(zero) - addl $8, %esp - fnstsw - shrl $5, %eax - andl $8, %eax - fldl MOX(inf_zero, %eax, 1) - ret - - .align ALIGNARG(4) -17: shll $30, %edx // sign bit for y in right position - addl $8, %esp -18: shrl $31, %edx - fldl MOX(inf_zero, %edx, 8) - ret - - .align ALIGNARG(4) - // x is ±0 -20: fstp %st(0) // y - testb $2, %dl - jz 21f // y > 0 - - // x is ±0 and y is < 0. We must find out whether y is an odd integer. - testb $2, %dh - jz 25f - - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 26f - - // OK, the value is an integer, but is the number of bits small - // enough so that all are coming from the mantissa? - popl %eax - popl %edx - andb $1, %al - jz 27f // jump if not odd - cmpl $0xffe00000, %edx - jbe 27f // does not fit in mantissa bits - // It's an odd integer. - // Raise divide-by-zero exception and get minus infinity value. - fldl MO(one) - fdivl MO(zero) - fchs - ret - -25: fstp %st(0) -26: popl %eax - popl %edx -27: // Raise divide-by-zero exception and get infinity value. - fldl MO(one) - fdivl MO(zero) - ret - - .align ALIGNARG(4) - // x is ±0 and y is > 0. We must find out whether y is an odd integer. -21: testb $2, %dh - jz 22f - - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 23f - - // OK, the value is an integer, but is the number of bits small - // enough so that all are coming from the mantissa? - popl %eax - popl %edx - andb $1, %al - jz 24f // jump if not odd - cmpl $0xffe00000, %edx - jae 24f // does not fit in mantissa bits - // It's an odd integer. - fldl MO(mzero) - ret - -22: fstp %st(0) -23: popl %eax - popl %edx -24: fldl MO(zero) - ret - -END(__ieee754_pow) diff --git a/sysdeps/libm-i387/e_powf.S b/sysdeps/libm-i387/e_powf.S deleted file mode 100644 index d7342bf56f..0000000000 --- a/sysdeps/libm-i387/e_powf.S +++ /dev/null @@ -1,310 +0,0 @@ -/* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(infinity,@object) -inf_zero: -infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - ASM_SIZE_DIRECTIVE(infinity) - ASM_TYPE_DIRECTIVE(zero,@object) -zero: .double 0.0 - ASM_SIZE_DIRECTIVE(zero) - ASM_TYPE_DIRECTIVE(minf_mzero,@object) -minf_mzero: -minfinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff -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) - -#ifdef PIC -#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) -#endif - - .text -ENTRY(__ieee754_powf) - flds 8(%esp) // y - fxam - -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - - fnstsw - movb %ah, %dl - andb $0x45, %ah - cmpb $0x40, %ah // is y == 0 ? - je 11f - - cmpb $0x05, %ah // is y == ±inf ? - je 12f - - cmpb $0x01, %ah // is y == NaN ? - je 30f - - flds 4(%esp) // x : y - - subl $4, %esp - - fxam - fnstsw - movb %ah, %dh - andb $0x45, %ah - cmpb $0x40, %ah - je 20f // x is ±0 - - cmpb $0x05, %ah - je 15f // x is ±inf - - fxch // y : x - - /* First see whether `y' is a natural number. In this case we - can use a more precise algorithm. */ - fld %st // y : y : x - fistpl (%esp) // y : x - fildl (%esp) // int(y) : y : x - fucomp %st(1) // y : x - fnstsw - sahf - jne 2f - - /* OK, we have an integer value for y. */ - popl %edx - orl $0, %edx - fstp %st(0) // x - jns 4f // y >= 0, jump - fdivrl MO(one) // 1/x (now referred to as x) - negl %edx -4: fldl MO(one) // 1 : x - fxch - -6: shrl $1, %edx - jnc 5f - fxch - fmul %st(1) // x : ST*x - fxch -5: fmul %st(0), %st // x*x : ST*x - testl %edx, %edx - jnz 6b - fstp %st(0) // ST*x -30: ret - - .align ALIGNARG(4) -2: /* y is a real number. */ - fxch // x : y - fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y - fnstsw - fxch // x : 1.0 : y - sahf - ja 7f - fsub %st(1) // x-1 : 1.0 : y - fyl2xp1 // log2(x) : y - jmp 8f - -7: fyl2x // log2(x) : y -8: fmul %st(1) // y*log2(x) : y - fst %st(1) // y*log2(x) : y*log2(x) - frndint // int(y*log2(x)) : y*log2(x) - fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) - fxch // fract(y*log2(x)) : int(y*log2(x)) - f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) - faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) - fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) - addl $4, %esp - fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) - ret - - - // pow(x,±0) = 1 - .align ALIGNARG(4) -11: fstp %st(0) // pop y - fldl MO(one) - ret - - // y == ±inf - .align ALIGNARG(4) -12: fstp %st(0) // pop y - flds 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 - fnstsw - andb $0x45, %ah - cmpb $0x45, %ah - je 13f // jump if x is NaN - - cmpb $0x40, %ah - je 14f // jump if |x| == 1 - - shlb $1, %ah - xorb %ah, %dl - andl $2, %edx - fldl MOX(inf_zero, %edx, 4) - ret - - .align ALIGNARG(4) -14: fldl MO(infinity) - fmull MO(zero) // raise invalid exception - ret - - .align ALIGNARG(4) -13: flds 4(%esp) // load x == NaN - ret - - .align ALIGNARG(4) - // x is ±inf -15: fstp %st(0) // y - testb $2, %dh - jz 16f // jump if x == +inf - - // We must find out whether y is an odd integer. - fld %st // y : y - fistpl (%esp) // y - fildl (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 17f - - // OK, the value is an integer, but is the number of bits small - // enough so that all are coming from the mantissa? - popl %edx - testb $1, %dl - jz 18f // jump if not odd - movl %edx, %eax - orl %edx, %edx - jns 155f - negl %eax -155: cmpl $0x01000000, %eax - ja 18f // does not fit in mantissa bits - // It's an odd integer. - shrl $31, %edx - fldl MOX(minf_mzero, %edx, 8) - ret - - .align ALIGNARG(4) -16: fcompl MO(zero) - addl $4, %esp - fnstsw - shrl $5, %eax - andl $8, %eax - fldl MOX(inf_zero, %eax, 1) - ret - - .align ALIGNARG(4) -17: shll $30, %edx // sign bit for y in right position - addl $4, %esp -18: shrl $31, %edx - fldl MOX(inf_zero, %edx, 8) - ret - - .align ALIGNARG(4) - // x is ±0 -20: fstp %st(0) // y - testb $2, %dl - jz 21f // y > 0 - - // x is ±0 and y is < 0. We must find out whether y is an odd integer. - testb $2, %dh - jz 25f - - fld %st // y : y - fistpl (%esp) // y - fildl (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 26f - - // OK, the value is an integer, but is the number of bits small - // enough so that all are coming from the mantissa? - popl %edx - testb $1, %dl - jz 27f // jump if not odd - cmpl $0xff000000, %edx - jbe 27f // does not fit in mantissa bits - // It's an odd integer. - // Raise divide-by-zero exception and get minus infinity value. - fldl MO(one) - fdivl MO(zero) - fchs - ret - -25: fstp %st(0) -26: popl %eax -27: // Raise divide-by-zero exception and get infinity value. - fldl MO(one) - fdivl MO(zero) - ret - - .align ALIGNARG(4) - // x is ±0 and y is > 0. We must find out whether y is an odd integer. -21: testb $2, %dh - jz 22f - - fld %st // y : y - fistpl (%esp) // y - fildl (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 23f - - // OK, the value is an integer, but is the number of bits small - // enough so that all are coming from the mantissa? - popl %edx - testb $1, %dl - jz 24f // jump if not odd - cmpl $0xff000000, %edx - jae 24f // does not fit in mantissa bits - // It's an odd integer. - fldl MO(mzero) - ret - -22: fstp %st(0) -23: popl %eax -24: fldl MO(zero) - ret - -END(__ieee754_powf) diff --git a/sysdeps/libm-i387/e_powl.S b/sysdeps/libm-i387/e_powl.S deleted file mode 100644 index 2e09dcc820..0000000000 --- a/sysdeps/libm-i387/e_powl.S +++ /dev/null @@ -1,307 +0,0 @@ -/* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(infinity,@object) -inf_zero: -infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - ASM_SIZE_DIRECTIVE(infinity) - ASM_TYPE_DIRECTIVE(zero,@object) -zero: .double 0.0 - ASM_SIZE_DIRECTIVE(zero) - ASM_TYPE_DIRECTIVE(minf_mzero,@object) -minf_mzero: -minfinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff -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) - -#ifdef PIC -#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) -#endif - - .text -ENTRY(__ieee754_powl) - fldt 16(%esp) // y - fxam - -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - - fnstsw - movb %ah, %dl - andb $0x45, %ah - cmpb $0x40, %ah // is y == 0 ? - je 11f - - cmpb $0x05, %ah // is y == ±inf ? - je 12f - - cmpb $0x01, %ah // is y == NaN ? - je 30f - - fldt 4(%esp) // x : y - - subl $8,%esp - - fxam - fnstsw - movb %ah, %dh - andb $0x45, %ah - cmpb $0x40, %ah - je 20f // x is ±0 - - cmpb $0x05, %ah - je 15f // x is ±inf - - fxch // y : x - - /* First see whether `y' is a natural number. In this case we - can use a more precise algorithm. */ - fld %st // y : y : x - fistpll (%esp) // y : x - fildll (%esp) // int(y) : y : x - fucomp %st(1) // y : x - fnstsw - sahf - jne 2f - - /* OK, we have an integer value for y. */ - popl %eax - popl %edx - orl $0, %edx - fstp %st(0) // x - jns 4f // y >= 0, jump - fdivrl MO(one) // 1/x (now referred to as x) - negl %eax - adcl $0, %edx - negl %edx -4: fldl MO(one) // 1 : x - fxch - -6: shrdl $1, %edx, %eax - jnc 5f - fxch - fmul %st(1) // x : ST*x - fxch -5: fmul %st(0), %st // x*x : ST*x - shrl $1, %edx - movl %eax, %ecx - orl %edx, %ecx - jnz 6b - fstp %st(0) // ST*x -30: ret - - .align ALIGNARG(4) -2: /* y is a real number. */ - fxch // x : y - fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y - fnstsw - fxch // x : 1.0 : y - sahf - ja 7f - fsub %st(1) // x-1 : 1.0 : y - fyl2xp1 // log2(x) : y - jmp 8f - -7: fyl2x // log2(x) : y -8: fmul %st(1) // y*log2(x) : y - fst %st(1) // y*log2(x) : y*log2(x) - frndint // int(y*log2(x)) : y*log2(x) - fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x)) - fxch // fract(y*log2(x)) : int(y*log2(x)) - f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x)) - faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) - fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) - addl $8, %esp - fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) - ret - - - // pow(x,±0) = 1 - .align ALIGNARG(4) -11: fstp %st(0) // pop y - fldl MO(one) - ret - - // y == ±inf - .align ALIGNARG(4) -12: fstp %st(0) // pop y - fldt 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 - fnstsw - andb $0x45, %ah - cmpb $0x45, %ah - je 13f // jump if x is NaN - - cmpb $0x40, %ah - je 14f // jump if |x| == 1 - - shlb $1, %ah - xorb %ah, %dl - andl $2, %edx - fldl MOX(inf_zero, %edx, 4) - ret - - .align ALIGNARG(4) -14: fldl MO(infinity) - fmull MO(zero) // raise invalid exception - ret - - .align ALIGNARG(4) -13: fldt 4(%esp) // load x == NaN - ret - - .align ALIGNARG(4) - // x is ±inf -15: fstp %st(0) // y - testb $2, %dh - jz 16f // jump if x == +inf - - // We must find out whether y is an odd integer. - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 17f - - // OK, the value is an integer, but is it odd? - popl %eax - popl %edx - andb $1, %al - jz 18f // jump if not odd - // It's an odd integer. - shrl $31, %edx - fldl MOX(minf_mzero, %edx, 8) - ret - - .align ALIGNARG(4) -16: fcompl MO(zero) - addl $8, %esp - fnstsw - shrl $5, %eax - andl $8, %eax - fldl MOX(inf_zero, %eax, 1) - ret - - .align ALIGNARG(4) -17: shll $30, %edx // sign bit for y in right position - addl $8, %esp -18: shrl $31, %edx - fldl MOX(inf_zero, %edx, 8) - ret - - .align ALIGNARG(4) - // x is ±0 -20: fstp %st(0) // y - testb $2, %dl - jz 21f // y > 0 - - // x is ±0 and y is < 0. We must find out whether y is an odd integer. - testb $2, %dh - jz 25f - - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 26f - - // OK, the value is an integer, but is it odd? - popl %eax - popl %edx - andb $1, %al - jz 27f // jump if not odd - // It's an odd integer. - // Raise divide-by-zero exception and get minus infinity value. - fldl MO(one) - fdivl MO(zero) - fchs - ret - -25: fstp %st(0) -26: popl %eax - popl %edx -27: // Raise divide-by-zero exception and get infinity value. - fldl MO(one) - fdivl MO(zero) - ret - - .align ALIGNARG(4) - // x is ±0 and y is > 0. We must find out whether y is an odd integer. -21: testb $2, %dh - jz 22f - - fld %st // y : y - fistpll (%esp) // y - fildll (%esp) // int(y) : y - fucompp // - fnstsw - sahf - jne 23f - - // OK, the value is an integer, but is it odd? - popl %eax - popl %edx - andb $1, %al - jz 24f // jump if not odd - // It's an odd integer. - fldl MO(mzero) - ret - -22: fstp %st(0) -23: popl %eax - popl %edx -24: fldl MO(zero) - ret - -END(__ieee754_powl) diff --git a/sysdeps/libm-i387/e_rem_pio2.c b/sysdeps/libm-i387/e_rem_pio2.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/libm-i387/e_rem_pio2.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/libm-i387/e_rem_pio2f.c b/sysdeps/libm-i387/e_rem_pio2f.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/libm-i387/e_rem_pio2f.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/libm-i387/e_rem_pio2l.c b/sysdeps/libm-i387/e_rem_pio2l.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/libm-i387/e_rem_pio2l.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/libm-i387/e_remainder.S b/sysdeps/libm-i387/e_remainder.S deleted file mode 100644 index 2f43cb894c..0000000000 --- a/sysdeps/libm-i387/e_remainder.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -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) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_remainder) diff --git a/sysdeps/libm-i387/e_remainderf.S b/sysdeps/libm-i387/e_remainderf.S deleted file mode 100644 index 79f821993b..0000000000 --- a/sysdeps/libm-i387/e_remainderf.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -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) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_remainderf) diff --git a/sysdeps/libm-i387/e_remainderl.S b/sysdeps/libm-i387/e_remainderl.S deleted file mode 100644 index 5f50b626a2..0000000000 --- a/sysdeps/libm-i387/e_remainderl.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_remainderl) - fldt 16(%esp) - fldt 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_remainderl) diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S deleted file mode 100644 index 7ff5541e2f..0000000000 --- a/sysdeps/libm-i387/e_scalb.S +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Correct handling of y==-inf - */ - -#include - -RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(zero_nan,@object) -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) -#else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) -#endif - - .text -ENTRY(__ieee754_scalb) - fldl 12(%esp) - fxam - fnstsw - fldl 4(%esp) - andl $0x4700, %eax - cmpl $0x0700, %eax - je 1f - andl $0x4500, %eax - cmpl $0x0100, %eax - je 2f - fxam - fnstsw - andl $0x4500, %eax - cmpl $0x0100, %eax - je 2f - fld %st(1) - frndint - fcomp %st(2) - fnstsw - sahf - jne 2f - fscale - fstp %st(1) - ret - - /* y is -inf */ -1: fxam -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - fnstsw - movl 8(%esp), %edx - shrl $5, %eax - fstp %st - fstp %st - andl $0x80000000, %edx - andl $8, %eax - shrl $27, %edx - addl %edx, %eax - fldl MOX(zero_nan, %eax, 1) - ret - - /* The result is NaN, but we must not raise an exception. - So use a variable. */ -2: fstp %st - fstp %st -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - fldl MO(nan) - ret -END(__ieee754_scalb) diff --git a/sysdeps/libm-i387/e_scalbf.S b/sysdeps/libm-i387/e_scalbf.S deleted file mode 100644 index 4222eecc97..0000000000 --- a/sysdeps/libm-i387/e_scalbf.S +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for float type by Ulrich Drepper . - * - * Correct handling of y==-inf - */ - -#include - -RCSID("$NetBSD: $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(zero_nan,@object) -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) -#else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) -#endif - - - .text -ENTRY(__ieee754_scalbf) - flds 8(%esp) - fxam - fnstsw - flds 4(%esp) - andl $0x4700, %eax - cmpl $0x0700, %eax - je 1f - andl $0x4500, %eax - cmpl $0x0100, %eax - je 2f - fxam - fnstsw - andl $0x4500, %eax - cmpl $0x0100, %eax - je 2f - fld %st(1) - frndint - fcomp %st(2) - fnstsw - sahf - jne 2f - fscale - fstp %st(1) - ret - - /* y is -inf */ -1: fxam -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - fnstsw - movl 4(%esp), %edx - shrl $5, %eax - fstp %st - fstp %st - andl $0x80000000, %edx - andl $8, %eax - shrl $27, %edx - addl %edx, %eax - fldl MOX(zero_nan, %eax, 1) - ret - - /* The result is NaN, but we must not raise an exception. - So use a variable. */ -2: fstp %st - fstp %st -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - fldl MO(nan) - ret -END(__ieee754_scalbf) diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S deleted file mode 100644 index 56cc833a56..0000000000 --- a/sysdeps/libm-i387/e_scalbl.S +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - * - * Correct handling of y==-inf - */ - -#include - -RCSID("$NetBSD: $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(zero_nan,@object) -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) -#else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) -#endif - - .text -ENTRY(__ieee754_scalbl) - fldt 16(%esp) - fxam - fnstsw - fldt 4(%esp) - andl $0x4700, %eax - cmpl $0x0700, %eax - je 1f - andl $0x4500, %eax - cmpl $0x0100, %eax - je 2f - fxam - fnstsw - andl $0x4500, %eax - cmpl $0x0100, %eax - je 2f - fld %st(1) - frndint - fcomp %st(2) - fnstsw - sahf - jne 2f - fscale - fstp %st(1) - ret - - /* y is -inf */ -1: fxam -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - fnstsw - movl 12(%esp), %edx - shrl $5, %eax - fstp %st - fstp %st - andl $0x8000, %edx - andl $8, %eax - shrl $11, %edx - addl %edx, %eax - fldl MOX(zero_nan, %eax, 1) - ret - - /* The result is NaN, but we must not raise an exception. - So use a variable. */ -2: fstp %st - fstp %st -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - fldl MO(nan) - ret -END(__ieee754_scalbl) diff --git a/sysdeps/libm-i387/e_sqrt.S b/sysdeps/libm-i387/e_sqrt.S deleted file mode 100644 index 6f253d51aa..0000000000 --- a/sysdeps/libm-i387/e_sqrt.S +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -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) diff --git a/sysdeps/libm-i387/e_sqrtf.S b/sysdeps/libm-i387/e_sqrtf.S deleted file mode 100644 index 5ce1ad0544..0000000000 --- a/sysdeps/libm-i387/e_sqrtf.S +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -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) diff --git a/sysdeps/libm-i387/e_sqrtl.S b/sysdeps/libm-i387/e_sqrtl.S deleted file mode 100644 index d47aae5cb5..0000000000 --- a/sysdeps/libm-i387/e_sqrtl.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_sqrtl) - fldt 4(%esp) - fsqrt - ret -END (__ieee754_sqrtl) diff --git a/sysdeps/libm-i387/i686/s_fdim.S b/sysdeps/libm-i387/i686/s_fdim.S deleted file mode 100644 index 6f722c5b07..0000000000 --- a/sysdeps/libm-i387/i686/s_fdim.S +++ /dev/null @@ -1,42 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fdim) - fldl 4(%esp) // x - fldl 12(%esp) // x : y - - fucomi %st(1), %st - jp 1f - - fsubrp %st, %st(1) - fldz - fcomi %st(1), %st - fcmovb %st(1), %st - jmp 2f - -1: fucomi %st(0), %st - fcmovnu %st(1), %st -2: fstp %st(1) - ret -END(__fdim) -weak_alias (__fdim, fdim) diff --git a/sysdeps/libm-i387/i686/s_fdimf.S b/sysdeps/libm-i387/i686/s_fdimf.S deleted file mode 100644 index 1bcaf0012e..0000000000 --- a/sysdeps/libm-i387/i686/s_fdimf.S +++ /dev/null @@ -1,42 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fdimf) - flds 4(%esp) // x - flds 8(%esp) // x : y - - fucomi %st(1), %st - jp 1f - - fsubrp %st, %st(1) - fldz - fcomi %st(1), %st - fcmovb %st(1), %st - jmp 2f - -1: fucomi %st(0), %st - fcmovnu %st(1), %st -2: fstp %st(1) - ret -END(__fdimf) -weak_alias (__fdimf, fdimf) diff --git a/sysdeps/libm-i387/i686/s_fdiml.S b/sysdeps/libm-i387/i686/s_fdiml.S deleted file mode 100644 index 9e909ba60e..0000000000 --- a/sysdeps/libm-i387/i686/s_fdiml.S +++ /dev/null @@ -1,42 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fdiml) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - - fucomi %st(1), %st - jp 1f - - fsubrp %st, %st(1) - fldz - fcomi %st(1), %st - fcmovb %st(1), %st - jmp 2f - -1: fucomi %st(0), %st - fcmovnu %st(1), %st -2: fstp %st(1) - ret -END(__fdiml) -weak_alias (__fdiml, fdiml) diff --git a/sysdeps/libm-i387/i686/s_fmax.S b/sysdeps/libm-i387/i686/s_fmax.S deleted file mode 100644 index 3639ba7470..0000000000 --- a/sysdeps/libm-i387/i686/s_fmax.S +++ /dev/null @@ -1,40 +0,0 @@ -/* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmax) - fldl 4(%esp) // x - fldl 12(%esp) // x : y - - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fxch - - fucomi %st(1), %st - fcmovb %st(1), %st - - fstp %st(1) - - ret -END(__fmax) -weak_alias (__fmax, fmax) diff --git a/sysdeps/libm-i387/i686/s_fmaxf.S b/sysdeps/libm-i387/i686/s_fmaxf.S deleted file mode 100644 index ad948d0b62..0000000000 --- a/sysdeps/libm-i387/i686/s_fmaxf.S +++ /dev/null @@ -1,40 +0,0 @@ -/* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmaxf) - flds 4(%esp) // x - flds 8(%esp) // x : y - - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fxch - - fucomi %st(1), %st - fcmovb %st(1), %st - - fstp %st(1) - - ret -END(__fmaxf) -weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/libm-i387/i686/s_fmaxl.S b/sysdeps/libm-i387/i686/s_fmaxl.S deleted file mode 100644 index 14859b0a6d..0000000000 --- a/sysdeps/libm-i387/i686/s_fmaxl.S +++ /dev/null @@ -1,40 +0,0 @@ -/* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmaxl) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fxch - - fucomi %st(1), %st - fcmovb %st(1), %st - - fstp %st(1) - - ret -END(__fmaxl) -weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/libm-i387/i686/s_fmin.S b/sysdeps/libm-i387/i686/s_fmin.S deleted file mode 100644 index 383e9579f6..0000000000 --- a/sysdeps/libm-i387/i686/s_fmin.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmin) - fldl 4(%esp) // x - fldl 12(%esp) // x : y - - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fucomi %st(1), %st - fcmovnb %st(1), %st - - fstp %st(1) - - ret -END(__fmin) -weak_alias (__fmin, fmin) diff --git a/sysdeps/libm-i387/i686/s_fminf.S b/sysdeps/libm-i387/i686/s_fminf.S deleted file mode 100644 index f3dae00377..0000000000 --- a/sysdeps/libm-i387/i686/s_fminf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fminf) - flds 4(%esp) // x - flds 8(%esp) // x : y - - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fucomi %st(1), %st - fcmovnb %st(1), %st - - fstp %st(1) - - ret -END(__fminf) -weak_alias (__fminf, fminf) diff --git a/sysdeps/libm-i387/i686/s_fminl.S b/sysdeps/libm-i387/i686/s_fminl.S deleted file mode 100644 index f125531112..0000000000 --- a/sysdeps/libm-i387/i686/s_fminl.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fminl) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - - fucomi %st(0), %st - fcmovu %st(1), %st // now %st contains y if not NaN, x otherwise - - fucomi %st(1), %st - fcmovnb %st(1), %st - - fstp %st(1) - - ret -END(__fminl) -weak_alias (__fminl, fminl) diff --git a/sysdeps/libm-i387/k_rem_pio2.c b/sysdeps/libm-i387/k_rem_pio2.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/libm-i387/k_rem_pio2.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/libm-i387/k_rem_pio2f.c b/sysdeps/libm-i387/k_rem_pio2f.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/libm-i387/k_rem_pio2f.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/libm-i387/k_rem_pio2l.c b/sysdeps/libm-i387/k_rem_pio2l.c deleted file mode 100644 index 1347b0468c..0000000000 --- a/sysdeps/libm-i387/k_rem_pio2l.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Empty. This file is only meant to avoid compiling the file with the - same name in the libm-ieee754 directory. The code is not used since - there is an assembler version for all users of this file. */ diff --git a/sysdeps/libm-i387/s_asinh.S b/sysdeps/libm-i387/s_asinh.S deleted file mode 100644 index a4c52cb67c..0000000000 --- a/sysdeps/libm-i387/s_asinh.S +++ /dev/null @@ -1,139 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(huge,@object) -huge: .double 1e+300 - ASM_SIZE_DIRECTIVE(huge) - 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) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__asinh) - movl 8(%esp), %ecx - movl $0x7fffffff, %eax - andl %ecx, %eax - andl $0x80000000, %ecx - movl %eax, %edx - orl $0x800fffff, %edx - incl %edx - jz 7f // x in ±Inf or NaN - xorl %ecx, 8(%esp) - fldl 4(%esp) // |x| - cmpl $0x3e300000, %eax - jb 2f // |x| < 2^-28 - fldln2 // log(2) : |x| - cmpl $0x41b00000, %eax - fxch // |x| : log(2) - ja 3f // |x| > 2^28 -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpl $0x40000000, %eax - ja 5f // |x| > 2 - - // 2^-28 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) - fld %st // |x| : |x| : log(2) - fmul %st(1) // |x|^2 : |x| : log(2) - fld %st // |x|^2 : |x|^2 : |x| : log(2) - faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) - fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) - faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) - fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) - faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 6f - fyl2xp1 - jecxz 4f - fchs -4: ret - -7: fldl 4(%esp) - ret - -6: faddl MO(one) - fyl2x - jecxz 4f - fchs -4: ret - - // |x| < 2^-28 => y = x (inexact iff |x| != 0.0) - .align ALIGNARG(4) -2: -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - jecxz 4f - fchs // x -4: fld %st // x : x - faddl MO(huge) // huge+x : x - fstp %st(0) // x - ret - - // |x| > 2^28 => y = sign(x) * (log(|x|) + log(2)) - .align ALIGNARG(4) -3: fyl2x // log(|x|) - fldln2 // log(2) : log(|x|) - faddp // log(|x|)+log(2) - jecxz 4f - fchs -4: ret - - // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) - .align ALIGNARG(4) -5: fld %st // |x| : |x| : log(2) - fadd %st, %st(1) // |x| : 2*|x| : log(2) - fld %st // |x| : |x| : 2*|x| : log(2) - fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) - faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) - fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) - faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) - fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) - faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) - fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) - jecxz 4f - fchs -4: ret -END(__asinh) -weak_alias (__asinh, asinh) diff --git a/sysdeps/libm-i387/s_asinhf.S b/sysdeps/libm-i387/s_asinhf.S deleted file mode 100644 index a6925c7b4c..0000000000 --- a/sysdeps/libm-i387/s_asinhf.S +++ /dev/null @@ -1,139 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(huge,@object) -huge: .double 1e+36 - ASM_SIZE_DIRECTIVE(huge) - 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) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__asinhf) - movl 4(%esp), %ecx - movl $0x7fffffff, %eax - andl %ecx, %eax - andl $0x80000000, %ecx - movl %eax, %edx - orl $0x807fffff, %edx - incl %edx - jz 7f // x in ±Inf or NaN - xorl %ecx, 4(%esp) - flds 4(%esp) // |x| - cmpl $0x38000000, %eax - jb 2f // |x| < 2^-14 - fldln2 // log(2) : |x| - cmpl $0x47000000, %eax - fxch // |x| : log(2) - ja 3f // |x| > 2^14 -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpl $0x40000000, %eax - ja 5f // |x| > 2 - - // 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) - fld %st // |x| : |x| : log(2) - fmul %st(1) // |x|^2 : |x| : log(2) - fld %st // |x|^2 : |x|^2 : |x| : log(2) - faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) - fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) - faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) - fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) - faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 6f - fyl2xp1 - jecxz 4f - fchs -4: ret - -7: flds 4(%esp) - ret - -6: faddl MO(one) - fyl2x - jecxz 4f - fchs -4: ret - - // |x| < 2^-14 => y = x (inexact iff |x| != 0.0) - .align ALIGNARG(4) -2: -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - jecxz 4f - fchs // x -4: fld %st // x : x - faddl MO(huge) // huge+x : x - fstp %st(0) // x - ret - - // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2)) - .align ALIGNARG(4) -3: fyl2x // log(|x|) - fldln2 // log(2) : log(|x|) - faddp // log(|x|)+log(2) - jecxz 4f - fchs -4: ret - - // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) - .align ALIGNARG(4) -5: fld %st // |x| : |x| : log(2) - fadd %st, %st(1) // |x| : 2*|x| : log(2) - fld %st // |x| : |x| : 2*|x| : log(2) - fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) - faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) - fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) - faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) - fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) - faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) - fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) - jecxz 4f - fchs -4: ret -END(__asinhf) -weak_alias (__asinhf, asinhf) diff --git a/sysdeps/libm-i387/s_asinhl.S b/sysdeps/libm-i387/s_asinhl.S deleted file mode 100644 index 62e29bc58e..0000000000 --- a/sysdeps/libm-i387/s_asinhl.S +++ /dev/null @@ -1,147 +0,0 @@ -/* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(huge,@object) -huge: .tfloat 1e+4930 - ASM_SIZE_DIRECTIVE(huge) - .align ALIGNARG(4) - /* 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. */ - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__asinhl) - movl 12(%esp), %ecx - movl $0x7fff, %eax - andl %ecx, %eax - andl $0x8000, %ecx - movl %eax, %edx - orl $0xffff8000, %edx - incl %edx - jz 7f // x in ±Inf or NaN - xorl %ecx, 12(%esp) - fldt 4(%esp) // |x| - cmpl $0x3fde, %eax - jb 2f // |x| < 2^-34 - fldln2 // log(2) : |x| - cmpl $0x4020, %eax - fxch // |x| : log(2) - ja 3f // |x| > 2^34 -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpl $0x4000, %eax - ja 5f // |x| > 2 - - // 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) - fld %st // |x| : |x| : log(2) - fmul %st(1) // |x|^2 : |x| : log(2) - fld %st // |x|^2 : |x|^2 : |x| : log(2) - faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) - fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) - faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) - fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) - faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) - fcoml MO(limit) - fnstsw - sahf - ja 6f - fyl2xp1 - jecxz 4f - fchs -4: ret - -7: fldt 4(%esp) - ret - -6: faddl MO(one) - fyl2x - jecxz 4f - fchs -4: ret - - // |x| < 2^-34 => y = x (inexact iff |x| != 0.0) - .align ALIGNARG(4) -2: -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - jecxz 4f - fchs // x -4: fld %st // x : x - fldt MO(huge) // huge : x : x - faddp // huge+x : x - fstp %st(0) // x - ret - - // |x| > 2^34 => y = sign(x) * (log(|x|) + log(2)) - .align ALIGNARG(4) -3: fyl2x // log(|x|) - fldln2 // log(2) : log(|x|) - faddp // log(|x|)+log(2) - jecxz 4f - fchs -4: ret - - // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) - .align ALIGNARG(4) -5: fld %st // |x| : |x| : log(2) - fadd %st, %st(1) // |x| : 2*|x| : log(2) - fld %st // |x| : |x| : 2*|x| : log(2) - fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) - faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) - fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) - faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) - fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) - faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) - fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) - jecxz 4f - fchs -4: ret -END(__asinhl) -weak_alias (__asinhl, asinhl) diff --git a/sysdeps/libm-i387/s_atan.S b/sysdeps/libm-i387/s_atan.S deleted file mode 100644 index 7502f6d828..0000000000 --- a/sysdeps/libm-i387/s_atan.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_atan.S,v 1.4 1995/05/08 23:50:41 jtc Exp $") - -ENTRY(__atan) - fldl 4(%esp) - fld1 - fpatan - ret -END (__atan) -weak_alias (__atan, atan) diff --git a/sysdeps/libm-i387/s_atanf.S b/sysdeps/libm-i387/s_atanf.S deleted file mode 100644 index 70232c8240..0000000000 --- a/sysdeps/libm-i387/s_atanf.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_atanf.S,v 1.3 1995/05/08 23:51:33 jtc Exp $") - -ENTRY(__atanf) - flds 4(%esp) - fld1 - fpatan - ret -END (__atanf) -weak_alias (__atanf, atanf) diff --git a/sysdeps/libm-i387/s_atanl.S b/sysdeps/libm-i387/s_atanl.S deleted file mode 100644 index 8b07272764..0000000000 --- a/sysdeps/libm-i387/s_atanl.S +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__atanl) - fldt 4(%esp) - fld1 - fpatan - ret -END (__atanl) -weak_alias (__atanl, atanl) diff --git a/sysdeps/libm-i387/s_cbrt.S b/sysdeps/libm-i387/s_cbrt.S deleted file mode 100644 index 3f6a0174f2..0000000000 --- a/sysdeps/libm-i387/s_cbrt.S +++ /dev/null @@ -1,201 +0,0 @@ -/* Compute cubic root of double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Dirk Alboth and - Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f7,@object) -f7: .double -0.145263899385486377 - ASM_SIZE_DIRECTIVE(f7) - ASM_TYPE_DIRECTIVE(f6,@object) -f6: .double 0.784932344976639262 - ASM_SIZE_DIRECTIVE(f6) - ASM_TYPE_DIRECTIVE(f5,@object) -f5: .double -1.83469277483613086 - ASM_SIZE_DIRECTIVE(f5) - ASM_TYPE_DIRECTIVE(f4,@object) -f4: .double 2.44693122563534430 - ASM_SIZE_DIRECTIVE(f4) - ASM_TYPE_DIRECTIVE(f3,@object) -f3: .double -2.11499494167371287 - ASM_SIZE_DIRECTIVE(f3) - ASM_TYPE_DIRECTIVE(f2,@object) -f2: .double 1.50819193781584896 - ASM_SIZE_DIRECTIVE(f2) - ASM_TYPE_DIRECTIVE(f1,@object) -f1: .double 0.354895765043919860 - ASM_SIZE_DIRECTIVE(f1) - -#define CBRT2 1.2599210498948731648 -#define ONE_CBRT2 0.793700525984099737355196796584 -#define SQR_CBRT2 1.5874010519681994748 -#define ONE_SQR_CBRT2 0.629960524947436582364439673883 - - ASM_TYPE_DIRECTIVE(factor,@object) -factor: .double ONE_SQR_CBRT2 - .double ONE_CBRT2 - .double 1.0 - .double CBRT2 - .double SQR_CBRT2 - ASM_SIZE_DIRECTIVE(factor) - - ASM_TYPE_DIRECTIVE(two54,@object) -two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43 - ASM_SIZE_DIRECTIVE(two54) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%ebx) -#define MOX(op,x) op##@GOTOFF(%ebx,x,1) -#else -#define MO(op) op -#define MOX(op,x) op(x) -#endif - - .text -ENTRY(__cbrt) - movl 4(%esp), %ecx - movl 8(%esp), %eax - movl %eax, %edx - andl $0x7fffffff, %eax - orl %eax, %ecx - jz 1f - xorl %ecx, %ecx - cmpl $0x7ff00000, %eax - jae 1f - -#ifdef PIC - pushl %ebx - call 3f -3: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx -#endif - - cmpl $0x00100000, %eax - jae 2f - -#ifdef PIC - fldl 8(%esp) -#else - fldl 4(%esp) -#endif - fmull MO(two54) - movl $-54, %ecx -#ifdef PIC - fstpl 8(%esp) - movl 12(%esp), %eax -#else - fstpl 4(%esp) - movl 8(%esp), %eax -#endif - movl %eax, %edx - andl $0x7fffffff, %eax - -2: shrl $20, %eax - andl $0x800fffff, %edx - subl $1022, %eax - orl $0x3fe00000, %edx - addl %eax, %ecx -#ifdef PIC - movl %edx, 12(%esp) - - fldl 8(%esp) /* xm */ -#else - movl %edx, 8(%esp) - - fldl 4(%esp) /* xm */ -#endif - fabs - - /* The following code has two tracks: - a) compute the normalized cbrt value - b) compute xe/3 and xe%3 - The right track computes the value for b) and this is done - in an optimized way by avoiding division. - - But why two tracks at all? Very easy: efficiency. Some FP - instruction can overlap with a certain amount of integer (and - FP) instructions. So we get (except for the imull) all - instructions for free. */ - - fld %st(0) /* xm : xm */ - - fmull MO(f7) /* f7*xm : xm */ - movl $1431655766, %eax - faddl MO(f6) /* f6+f7*xm : xm */ - imull %ecx - fmul %st(1) /* (f6+f7*xm)*xm : xm */ - movl %ecx, %eax - faddl MO(f5) /* f5+(f6+f7*xm)*xm : xm */ - sarl $31, %eax - fmul %st(1) /* (f5+(f6+f7*xm)*xm)*xm : xm */ - subl %eax, %edx - faddl MO(f4) /* f4+(f5+(f6+f7*xm)*xm)*xm : xm */ - fmul %st(1) /* (f4+(f5+(f6+f7*xm)*xm)*xm)*xm : xm */ - faddl MO(f3) /* f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm : xm */ - fmul %st(1) /* (f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm : xm */ - faddl MO(f2) /* f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm : xm */ - fmul %st(1) /* (f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm)*xm : xm */ - faddl MO(f1) /* u:=f1+(f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm)*xm : xm */ - - fld %st /* u : u : xm */ - fmul %st(1) /* u*u : u : xm */ - fld %st(2) /* xm : u*u : u : xm */ - fadd %st /* 2*xm : u*u : u : xm */ - fxch %st(1) /* u*u : 2*xm : u : xm */ - fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */ - movl %edx, %eax - fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */ - leal (%edx,%edx,2),%edx - fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */ - subl %edx, %ecx - faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */ - shll $3, %ecx - fmulp /* u*(t2+2*xm) : 2*t2+xm */ - fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ - fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */ - pushl %eax - fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ - fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ - fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ - popl %edx -#ifdef PIC - movl 12(%esp), %eax - popl %ebx -#else - movl 8(%esp), %eax -#endif - testl %eax, %eax - fstp %st(1) - jns 4f - fchs -4: ret - - /* Return the argument. */ -1: fldl 4(%esp) - ret -END(__cbrt) -weak_alias (__cbrt, cbrt) diff --git a/sysdeps/libm-i387/s_cbrtf.S b/sysdeps/libm-i387/s_cbrtf.S deleted file mode 100644 index a14e04ed2f..0000000000 --- a/sysdeps/libm-i387/s_cbrtf.S +++ /dev/null @@ -1,178 +0,0 @@ -/* Compute cubic root of float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Dirk Alboth and - Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f3,@object) -f3: .double 0.191502161678719066 - ASM_SIZE_DIRECTIVE(f3) - ASM_TYPE_DIRECTIVE(f2,@object) -f2: .double 0.697570460207922770 - ASM_SIZE_DIRECTIVE(f2) - ASM_TYPE_DIRECTIVE(f1,@object) -f1: .double 0.492659620528969547 - ASM_SIZE_DIRECTIVE(f1) - -#define CBRT2 1.2599210498948731648 -#define ONE_CBRT2 0.793700525984099737355196796584 -#define SQR_CBRT2 1.5874010519681994748 -#define ONE_SQR_CBRT2 0.629960524947436582364439673883 - - ASM_TYPE_DIRECTIVE(factor,@object) - .align ALIGNARG(4) -factor: .double ONE_SQR_CBRT2 - .double ONE_CBRT2 - .double 1.0 - .double CBRT2 - .double SQR_CBRT2 - ASM_SIZE_DIRECTIVE(factor) - - ASM_TYPE_DIRECTIVE(two25,@object) -two25: .byte 0, 0, 0, 0x4c - ASM_SIZE_DIRECTIVE(two25) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%ebx) -#define MOX(op,x) op##@GOTOFF(%ebx,x,1) -#else -#define MO(op) op -#define MOX(op,x) op(x) -#endif - - .text -ENTRY(__cbrtf) - movl 4(%esp), %eax - xorl %ecx, %ecx - movl %eax, %edx - andl $0x7fffffff, %eax - jz 1f - cmpl $0x7f800000, %eax - jae 1f - -#ifdef PIC - pushl %ebx - call 3f -3: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx -#endif - - cmpl $0x00800000, %eax - jae 2f - -#ifdef PIC - flds 8(%esp) -#else - flds 4(%esp) -#endif - fmuls MO(two25) - movl $-25, %ecx -#ifdef PIC - fstps 8(%esp) - movl 8(%esp), %eax -#else - fstps 4(%esp) - movl 4(%esp), %eax -#endif - movl %eax, %edx - andl $0x7fffffff, %eax - -2: shrl $23, %eax - andl $0x807fffff, %edx - subl $126, %eax - orl $0x3f000000, %edx - addl %eax, %ecx -#ifdef PIC - movl %edx, 8(%esp) - - flds 8(%esp) /* xm */ -#else - movl %edx, 4(%esp) - - flds 4(%esp) /* xm */ -#endif - fabs - - /* The following code has two tracks: - a) compute the normalized cbrt value - b) compute xe/3 and xe%3 - The right track computes the value for b) and this is done - in an optimized way by avoiding division. - - But why two tracks at all? Very easy: efficiency. Some FP - instruction can overlap with a certain amount of integer (and - FP) instructions. So we get (except for the imull) all - instructions for free. */ - - fld %st(0) /* xm : xm */ - fmull MO(f3) /* f3*xm : xm */ - movl $1431655766, %eax - fsubrl MO(f2) /* f2-f3*xm : xm */ - imull %ecx - fmul %st(1) /* (f2-f3*xm)*xm : xm */ - movl %ecx, %eax - faddl MO(f1) /* u:=f1+(f2-f3*xm)*xm : xm */ - sarl $31, %eax - fld %st /* u : u : xm */ - subl %eax, %edx - fmul %st(1) /* u*u : u : xm */ - fld %st(2) /* xm : u*u : u : xm */ - fadd %st /* 2*xm : u*u : u : xm */ - fxch %st(1) /* u*u : 2*xm : u : xm */ - fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */ - movl %edx, %eax - fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */ - leal (%edx,%edx,2),%edx - fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */ - subl %edx, %ecx - faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */ - shll $3, %ecx - fmulp /* u*(t2+2*xm) : 2*t2+xm */ - fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ - fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */ - pushl %eax - fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ - fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ - fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ - popl %edx -#ifdef PIC - movl 8(%esp), %eax - popl %ebx -#else - movl 4(%esp), %eax -#endif - testl %eax, %eax - fstp %st(1) - jns 4f - fchs -4: ret - - /* Return the argument. */ -1: flds 4(%esp) - ret -END(__cbrtf) -weak_alias (__cbrtf, cbrtf) diff --git a/sysdeps/libm-i387/s_cbrtl.S b/sysdeps/libm-i387/s_cbrtl.S deleted file mode 100644 index 6a3b9a8dc5..0000000000 --- a/sysdeps/libm-i387/s_cbrtl.S +++ /dev/null @@ -1,229 +0,0 @@ -/* Compute cubic root of long double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Dirk Alboth and - Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f8,@object) -f8: .tfloat 0.161617097923756032 - ASM_SIZE_DIRECTIVE(f8) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f7,@object) -f7: .tfloat -0.988553671195413709 - ASM_SIZE_DIRECTIVE(f7) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f6,@object) -f6: .tfloat 2.65298938441952296 - ASM_SIZE_DIRECTIVE(f6) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f5,@object) -f5: .tfloat -4.11151425200350531 - ASM_SIZE_DIRECTIVE(f5) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f4,@object) -f4: .tfloat 4.09559907378707839 - ASM_SIZE_DIRECTIVE(f4) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f3,@object) -f3: .tfloat -2.82414939754975962 - ASM_SIZE_DIRECTIVE(f3) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f2,@object) -f2: .tfloat 1.67595307700780102 - ASM_SIZE_DIRECTIVE(f2) - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(f1,@object) -f1: .tfloat 0.338058687610520237 - ASM_SIZE_DIRECTIVE(f1) - -#define CBRT2 1.2599210498948731648 -#define ONE_CBRT2 0.793700525984099737355196796584 -#define SQR_CBRT2 1.5874010519681994748 -#define ONE_SQR_CBRT2 0.629960524947436582364439673883 - - /* We make the entries in the following table all 16 bytes - wide to avoid having to implement a multiplication by 10. */ - ASM_TYPE_DIRECTIVE(factor,@object) - .align ALIGNARG(4) -factor: .tfloat ONE_SQR_CBRT2 - .byte 0, 0, 0, 0, 0, 0 - .tfloat ONE_CBRT2 - .byte 0, 0, 0, 0, 0, 0 - .tfloat 1.0 - .byte 0, 0, 0, 0, 0, 0 - .tfloat CBRT2 - .byte 0, 0, 0, 0, 0, 0 - .tfloat SQR_CBRT2 - ASM_SIZE_DIRECTIVE(factor) - - ASM_TYPE_DIRECTIVE(two64,@object) - .align ALIGNARG(4) -two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43 - ASM_SIZE_DIRECTIVE(two64) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%ebx) -#define MOX(op,x) op##@GOTOFF(%ebx,x,1) -#else -#define MO(op) op -#define MOX(op,x) op(x) -#endif - - .text -ENTRY(__cbrtl) - movl 4(%esp), %ecx - movl 12(%esp), %eax - orl 8(%esp), %ecx - movl %eax, %edx - andl $0x7fff, %eax - orl %eax, %ecx - jz 1f - xorl %ecx, %ecx - cmpl $0x7fff, %eax - je 1f - -#ifdef PIC - pushl %ebx - call 3f -3: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx -#endif - - cmpl $0, %eax - jne 2f - -#ifdef PIC - fldt 8(%esp) -#else - fldt 4(%esp) -#endif - fmull MO(two64) - movl $-64, %ecx -#ifdef PIC - fstpt 8(%esp) - movl 16(%esp), %eax -#else - fstpt 4(%esp) - movl 12(%esp), %eax -#endif - movl %eax, %edx - andl $0x7fff, %eax - -2: andl $0x8000, %edx - subl $16382, %eax - orl $0x3ffe, %edx - addl %eax, %ecx -#ifdef PIC - movl %edx, 16(%esp) - - fldt 8(%esp) /* xm */ -#else - movl %edx, 12(%esp) - - fldt 4(%esp) /* xm */ -#endif - fabs - - /* The following code has two tracks: - a) compute the normalized cbrt value - b) compute xe/3 and xe%3 - The right track computes the value for b) and this is done - in an optimized way by avoiding division. - - But why two tracks at all? Very easy: efficiency. Some FP - instruction can overlap with a certain amount of integer (and - FP) instructions. So we get (except for the imull) all - instructions for free. */ - - fldt MO(f8) /* f8 : xm */ - fmul %st(1) /* f8*xm : xm */ - - fldt MO(f7) - faddp /* f7+f8*xm : xm */ - fmul %st(1) /* (f7+f8*xm)*xm : xm */ - movl $1431655766, %eax - fldt MO(f6) - faddp /* f6+(f7+f8*xm)*xm : xm */ - imull %ecx - fmul %st(1) /* (f6+(f7+f8*xm)*xm)*xm : xm */ - movl %ecx, %eax - fldt MO(f5) - faddp /* f5+(f6+(f7+f8*xm)*xm)*xm : xm */ - sarl $31, %eax - fmul %st(1) /* (f5+(f6+(f7+f8*xm)*xm)*xm)*xm : xm */ - subl %eax, %edx - fldt MO(f4) - faddp /* f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm : xm */ - fmul %st(1) /* (f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm : xm */ - fldt MO(f3) - faddp /* f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm : xm */ - fmul %st(1) /* (f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm : xm */ - fldt MO(f2) - faddp /* f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm : xm */ - fmul %st(1) /* (f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm)*xm : xm */ - fldt MO(f1) - faddp /* u:=f1+(f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm)*xm : xm */ - - fld %st /* u : u : xm */ - fmul %st(1) /* u*u : u : xm */ - fld %st(2) /* xm : u*u : u : xm */ - fadd %st /* 2*xm : u*u : u : xm */ - fxch %st(1) /* u*u : 2*xm : u : xm */ - fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */ - movl %edx, %eax - fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */ - leal (%edx,%edx,2),%edx - fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */ - subl %edx, %ecx - faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */ - shll $4, %ecx - fmulp /* u*(t2+2*xm) : 2*t2+xm */ - fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ - fldt MOX(32+factor,%ecx) - fmulp /* u*(t2+2*xm)/(2*t2+xm)*FACT */ - pushl %eax - fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ - fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ - fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ - popl %edx -#ifdef PIC - movl 16(%esp), %eax - popl %ebx -#else - movl 12(%esp), %eax -#endif - testl $0x8000, %eax - fstp %st(1) - jz 4f - fchs -4: ret - - /* Return the argument. */ -1: fldt 4(%esp) - ret -END(__cbrtl) -weak_alias (__cbrtl, cbrtl) diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S deleted file mode 100644 index b0159128aa..0000000000 --- a/sysdeps/libm-i387/s_ceil.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $") - -ENTRY(__ceil) - fldl 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -END (__ceil) -weak_alias (__ceil, ceil) diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S deleted file mode 100644 index 352d40d7ce..0000000000 --- a/sysdeps/libm-i387/s_ceilf.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") - -ENTRY(__ceilf) - flds 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -END (__ceilf) -weak_alias (__ceilf, ceilf) diff --git a/sysdeps/libm-i387/s_ceill.S b/sysdeps/libm-i387/s_ceill.S deleted file mode 100644 index 0128966ebe..0000000000 --- a/sysdeps/libm-i387/s_ceill.S +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ceill) - fldt 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -END (__ceill) -weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-i387/s_cexp.S b/sysdeps/libm-i387/s_cexp.S deleted file mode 100644 index 61158d9540..0000000000 --- a/sysdeps/libm-i387/s_cexp.S +++ /dev/null @@ -1,259 +0,0 @@ -/* ix87 specific implementation of complex exponential function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object) -huge_nan_null_null: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - .double 0.0 -zero: .double 0.0 -infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - .double 0.0 - .byte 0, 0, 0, 0, 0, 0, 0, 0x80 - ASM_SIZE_DIRECTIVE(huge_nan_null_null) - - ASM_TYPE_DIRECTIVE(twopi,@object) -twopi: - .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40 - .byte 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(twopi) - - ASM_TYPE_DIRECTIVE(l2e,@object) -l2e: - .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f - .byte 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(l2e) - - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - - -#ifdef PIC -#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) -#endif - - .text -ENTRY(__cexp) - fldl 8(%esp) /* x */ - fxam - fnstsw - fldl 16(%esp) /* y : x */ -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - movb %ah, %dh - andb $0x45, %ah - cmpb $0x05, %ah - je 1f /* Jump if real part is +-Inf */ - cmpb $0x01, %ah - je 2f /* Jump if real part is NaN */ - - fxam /* y : x */ - fnstsw - /* If the imaginary part is not finite we return NaN+i NaN, as - for the case when the real part is NaN. A test for +-Inf and - NaN would be necessary. But since we know the stack register - we applied `fxam' to is not empty we can simply use one test. - Check your FPU manual for more information. */ - andb $0x01, %ah - cmpb $0x01, %ah - je 20f - - /* We have finite numbers in the real and imaginary part. Do - the real work now. */ - fxch /* x : y */ - fldt MO(l2e) /* log2(e) : x : y */ - fmulp /* x * log2(e) : y */ - fld %st /* x * log2(e) : x * log2(e) : y */ - frndint /* int(x * log2(e)) : x * log2(e) : y */ - fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */ - fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */ - f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */ - faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */ - fscale /* e^x : int(x * log2(e)) : y */ - fst %st(1) /* e^x : e^x : y */ - fxch %st(2) /* y : e^x : e^x */ - fsincos /* cos(y) : sin(y) : e^x : e^x */ - fnstsw - testl $0x400, %eax - jnz 7f - fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ - fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ - movl 4(%esp), %eax /* Pointer to memory for result. */ - fstpl 8(%eax) - fstpl (%eax) - ret $4 - - /* We have to reduce the argument to fsincos. */ - .align ALIGNARG(4) -7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */ - fxch /* y : 2*pi : e^x : e^x */ -8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */ - fnstsw - testl $0x400, %eax - jnz 8b - fstp %st(1) /* y%(2*pi) : e^x : e^x */ - fsincos /* cos(y) : sin(y) : e^x : e^x */ - fmulp %st, %st(3) - fmulp %st, %st(1) - movl 4(%esp), %eax /* Pointer to memory for result. */ - fstpl 8(%eax) - fstpl (%eax) - ret $4 - - /* The real part is +-inf. We must make further differences. */ - .align ALIGNARG(4) -1: fxam /* y : x */ - fnstsw - movb %ah, %dl - testb $0x01, %ah /* See above why 0x01 is usable here. */ - jne 3f - - - /* The real part is +-Inf and the imaginary part is finite. */ - andl $0x245, %edx - cmpb $0x40, %dl /* Imaginary part == 0? */ - je 4f /* Yes -> */ - - fxch /* x : y */ - shrl $5, %edx - fstp %st(0) /* y */ /* Drop the real part. */ - andl $16, %edx /* This puts the sign bit of the real part - in bit 4. So we can use it to index a - small array to select 0 or Inf. */ - fsincos /* cos(y) : sin(y) */ - fnstsw - testl $0x0400, %eax - jnz 5f - fldl MOX(huge_nan_null_null,%edx,1) - movl 4(%esp), %edx /* Pointer to memory for result. */ - fstl 8(%edx) - fstpl (%edx) - ftst - fnstsw - shll $23, %eax - andl $0x80000000, %eax - orl %eax, 4(%edx) - fstp %st(0) - ftst - fnstsw - shll $23, %eax - andl $0x80000000, %eax - orl %eax, 12(%edx) - fstp %st(0) - ret $4 - /* We must reduce the argument to fsincos. */ - .align ALIGNARG(4) -5: fldt MO(twopi) - fxch -6: fprem1 - fnstsw - testl $0x400, %eax - jnz 6b - fstp %st(1) - fsincos - fldl MOX(huge_nan_null_null,%edx,1) - movl 4(%esp), %edx /* Pointer to memory for result. */ - fstl 8(%edx) - fstpl (%edx) - ftst - fnstsw - shll $23, %eax - andl $0x80000000, %eax - orl %eax, 4(%edx) - fstp %st(0) - ftst - fnstsw - shll $23, %eax - andl $0x80000000, %eax - orl %eax, 12(%edx) - fstp %st(0) - ret $4 - - /* The real part is +-Inf and the imaginary part is +-0. So return - +-Inf+-0i. */ - .align ALIGNARG(4) -4: movl 4(%esp), %eax /* Pointer to memory for result. */ - fstpl 8(%eax) - shrl $5, %edx - fstp %st(0) - andl $16, %edx - fldl MOX(huge_nan_null_null,%edx,1) - fstpl (%eax) - ret $4 - - /* The real part is +-Inf, the imaginary is also is not finite. */ - .align ALIGNARG(4) -3: fstp %st(0) - fstp %st(0) /* */ - andb $0x45, %ah - andb $0x47, %dh - xorb %dh, %ah - jnz 30f - fldl MO(infinity) /* Raise invalid exception. */ - fmull MO(zero) - fstp %st(0) -30: movl %edx, %eax - shrl $5, %edx - shll $4, %eax - andl $16, %edx - andl $32, %eax - orl %eax, %edx - movl 4(%esp), %eax /* Pointer to memory for result. */ - - fldl MOX(huge_nan_null_null,%edx,1) - fldl MOX(huge_nan_null_null+8,%edx,1) - fxch - fstpl (%eax) - fstpl 8(%eax) - ret $4 - - /* The real part is NaN. */ - .align ALIGNARG(4) -20: fldl MO(infinity) /* Raise invalid exception. */ - fmull MO(zero) - fstp %st(0) -2: fstp %st(0) - fstp %st(0) - movl 4(%esp), %eax /* Pointer to memory for result. */ - fldl MO(huge_nan_null_null+8) - fstl (%eax) - fstpl 8(%eax) - ret $4 - -END(__cexp) -weak_alias (__cexp, cexp) diff --git a/sysdeps/libm-i387/s_cexpf.S b/sysdeps/libm-i387/s_cexpf.S deleted file mode 100644 index d6dcebcb23..0000000000 --- a/sysdeps/libm-i387/s_cexpf.S +++ /dev/null @@ -1,255 +0,0 @@ -/* ix87 specific implementation of complex exponential function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object) -huge_nan_null_null: - .byte 0, 0, 0x80, 0x7f - .byte 0, 0, 0xc0, 0x7f - .float 0.0 -zero: .float 0.0 -infinity: - .byte 0, 0, 0x80, 0x7f - .byte 0, 0, 0xc0, 0x7f - .float 0.0 - .byte 0, 0, 0, 0x80 - ASM_SIZE_DIRECTIVE(huge_nan_null_null) - - ASM_TYPE_DIRECTIVE(twopi,@object) -twopi: - .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40 - .byte 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(twopi) - - ASM_TYPE_DIRECTIVE(l2e,@object) -l2e: - .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f - .byte 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(l2e) - - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - - -#ifdef PIC -#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) -#endif - - .text -ENTRY(__cexpf) - flds 4(%esp) /* x */ - fxam - fnstsw - flds 8(%esp) /* y : x */ -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - movb %ah, %dh - andb $0x45, %ah - cmpb $0x05, %ah - je 1f /* Jump if real part is +-Inf */ - cmpb $0x01, %ah - je 2f /* Jump if real part is NaN */ - - fxam /* y : x */ - fnstsw - /* If the imaginary part is not finite we return NaN+i NaN, as - for the case when the real part is NaN. A test for +-Inf and - NaN would be necessary. But since we know the stack register - we applied `fxam' to is not empty we can simply use one test. - Check your FPU manual for more information. */ - andb $0x01, %ah - cmpb $0x01, %ah - je 20f - - /* We have finite numbers in the real and imaginary part. Do - the real work now. */ - fxch /* x : y */ - fldt MO(l2e) /* log2(e) : x : y */ - fmulp /* x * log2(e) : y */ - fld %st /* x * log2(e) : x * log2(e) : y */ - frndint /* int(x * log2(e)) : x * log2(e) : y */ - fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */ - fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */ - f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */ - faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */ - fscale /* e^x : int(x * log2(e)) : y */ - fst %st(1) /* e^x : e^x : y */ - fxch %st(2) /* y : e^x : e^x */ - fsincos /* cos(y) : sin(y) : e^x : e^x */ - fnstsw - testl $0x400, %eax - jnz 7f - fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ - fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ - subl $8, %esp - fstps 4(%esp) - fstps (%esp) - popl %eax - popl %edx - ret - - /* We have to reduce the argument to fsincos. */ - .align ALIGNARG(4) -7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */ - fxch /* y : 2*pi : e^x : e^x */ -8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */ - fnstsw - testl $0x400, %eax - jnz 8b - fstp %st(1) /* y%(2*pi) : e^x : e^x */ - fsincos /* cos(y) : sin(y) : e^x : e^x */ - fmulp %st, %st(3) - fmulp %st, %st(1) - subl $8, %esp - fstps 4(%esp) - fstps (%esp) - popl %eax - popl %edx - ret - - /* The real part is +-inf. We must make further differences. */ - .align ALIGNARG(4) -1: fxam /* y : x */ - fnstsw - movb %ah, %dl - testb $0x01, %ah /* See above why 0x01 is usable here. */ - jne 3f - - - /* The real part is +-Inf and the imaginary part is finite. */ - andl $0x245, %edx - cmpb $0x40, %dl /* Imaginary part == 0? */ - je 4f /* Yes -> */ - - fxch /* x : y */ - shrl $6, %edx - fstp %st(0) /* y */ /* Drop the real part. */ - andl $8, %edx /* This puts the sign bit of the real part - in bit 3. So we can use it to index a - small array to select 0 or Inf. */ - fsincos /* cos(y) : sin(y) */ - fnstsw - testl $0x0400, %eax - jnz 5f - fxch - ftst - fnstsw - fstp %st(0) - shll $23, %eax - andl $0x80000000, %eax - orl MOX(huge_nan_null_null,%edx,1), %eax - movl MOX(huge_nan_null_null,%edx,1), %ecx - movl %eax, %edx - ftst - fnstsw - fstp %st(0) - shll $23, %eax - andl $0x80000000, %eax - orl %ecx, %eax - ret - /* We must reduce the argument to fsincos. */ - .align ALIGNARG(4) -5: fldt MO(twopi) - fxch -6: fprem1 - fnstsw - testl $0x400, %eax - jnz 6b - fstp %st(1) - fsincos - fxch - ftst - fnstsw - fstp %st(0) - shll $23, %eax - andl $0x80000000, %eax - orl MOX(huge_nan_null_null,%edx,1), %eax - movl MOX(huge_nan_null_null,%edx,1), %ecx - movl %eax, %edx - ftst - fnstsw - fstp %st(0) - shll $23, %eax - andl $0x80000000, %eax - orl %ecx, %eax - ret - - /* The real part is +-Inf and the imaginary part is +-0. So return - +-Inf+-0i. */ - .align ALIGNARG(4) -4: subl $4, %esp - fstps (%esp) - shrl $6, %edx - fstp %st(0) - andl $8, %edx - movl MOX(huge_nan_null_null,%edx,1), %eax - popl %edx - ret - - /* The real part is +-Inf, the imaginary is also is not finite. */ - .align ALIGNARG(4) -3: fstp %st(0) - fstp %st(0) /* */ - andb $0x45, %ah - andb $0x47, %dh - xorb %dh, %ah - jnz 30f - flds MO(infinity) /* Raise invalid exception. */ - fmuls MO(zero) - fstp %st(0) -30: movl %edx, %eax - shrl $6, %edx - shll $3, %eax - andl $8, %edx - andl $16, %eax - orl %eax, %edx - - movl MOX(huge_nan_null_null,%edx,1), %eax - movl MOX(huge_nan_null_null+4,%edx,1), %edx - ret - - /* The real part is NaN. */ - .align ALIGNARG(4) -20: flds MO(infinity) /* Raise invalid exception. */ - fmuls MO(zero) - fstp %st(0) -2: fstp %st(0) - fstp %st(0) - movl MO(huge_nan_null_null+4), %eax - movl %eax, %edx - ret - -END(__cexpf) -weak_alias (__cexpf, cexpf) diff --git a/sysdeps/libm-i387/s_cexpl.S b/sysdeps/libm-i387/s_cexpl.S deleted file mode 100644 index 203a7ee779..0000000000 --- a/sysdeps/libm-i387/s_cexpl.S +++ /dev/null @@ -1,262 +0,0 @@ -/* ix87 specific implementation of complex exponential function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object) -huge_nan_null_null: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - .double 0.0 -zero: .double 0.0 -infinity: - .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f - .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f - .double 0.0 - .byte 0, 0, 0, 0, 0, 0, 0, 0x80 - ASM_SIZE_DIRECTIVE(huge_nan_null_null) - - ASM_TYPE_DIRECTIVE(twopi,@object) -twopi: - .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40 - .byte 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(twopi) - - ASM_TYPE_DIRECTIVE(l2e,@object) -l2e: - .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f - .byte 0, 0, 0, 0, 0, 0 - ASM_SIZE_DIRECTIVE(l2e) - - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - - -#ifdef PIC -#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) -#endif - - .text -ENTRY(__cexpl) - fldt 8(%esp) /* x */ - fxam - fnstsw - fldt 20(%esp) /* y : x */ -#ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx -#endif - movb %ah, %dh - andb $0x45, %ah - cmpb $0x05, %ah - je 1f /* Jump if real part is +-Inf */ - cmpb $0x01, %ah - je 2f /* Jump if real part is NaN */ - - fxam /* y : x */ - fnstsw - /* If the imaginary part is not finite we return NaN+i NaN, as - for the case when the real part is NaN. A test for +-Inf and - NaN would be necessary. But since we know the stack register - we applied `fxam' to is not empty we can simply use one test. - Check your FPU manual for more information. */ - andb $0x01, %ah - cmpb $0x01, %ah - je 20f - - /* We have finite numbers in the real and imaginary part. Do - the real work now. */ - fxch /* x : y */ - fldt MO(l2e) /* log2(e) : x : y */ - fmulp /* x * log2(e) : y */ - fld %st /* x * log2(e) : x * log2(e) : y */ - frndint /* int(x * log2(e)) : x * log2(e) : y */ - fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */ - fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */ - f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */ - faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */ - fscale /* e^x : int(x * log2(e)) : y */ - fst %st(1) /* e^x : e^x : y */ - fxch %st(2) /* y : e^x : e^x */ - fsincos /* cos(y) : sin(y) : e^x : e^x */ - fnstsw - testl $0x400, %eax - jnz 7f - fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ - fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ - movl 4(%esp), %eax /* Pointer to memory for result. */ - fstpt 12(%eax) - fstpt (%eax) - ret $4 - - /* We have to reduce the argument to fsincos. */ - .align ALIGNARG(4) -7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */ - fxch /* y : 2*pi : e^x : e^x */ -8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */ - fnstsw - testl $0x400, %eax - jnz 8b - fstp %st(1) /* y%(2*pi) : e^x : e^x */ - fsincos /* cos(y) : sin(y) : e^x : e^x */ - fmulp %st, %st(3) - fmulp %st, %st(1) - movl 4(%esp), %eax /* Pointer to memory for result. */ - fstpt 12(%eax) - fstpt (%eax) - ret $4 - - /* The real part is +-inf. We must make further differences. */ - .align ALIGNARG(4) -1: fxam /* y : x */ - fnstsw - movb %ah, %dl - testb $0x01, %ah /* See above why 0x01 is usable here. */ - jne 3f - - - /* The real part is +-Inf and the imaginary part is finite. */ - andl $0x245, %edx - cmpb $0x40, %dl /* Imaginary part == 0? */ - je 4f /* Yes -> */ - - fxch /* x : y */ - shrl $5, %edx - fstp %st(0) /* y */ /* Drop the real part. */ - andl $16, %edx /* This puts the sign bit of the real part - in bit 4. So we can use it to index a - small array to select 0 or Inf. */ - fsincos /* cos(y) : sin(y) */ - fnstsw - testl $0x0400, %eax - jnz 5f - fldl MOX(huge_nan_null_null,%edx,1) - movl 4(%esp), %edx /* Pointer to memory for result. */ - fld %st - fstpt 12(%edx) - fstpt (%edx) - ftst - fnstsw - shll $7, %eax - andl $0x8000, %eax - orl %eax, 8(%edx) - fstp %st(0) - ftst - fnstsw - shll $7, %eax - andl $0x8000, %eax - orl %eax, 20(%edx) - fstp %st(0) - ret $4 - /* We must reduce the argument to fsincos. */ - .align ALIGNARG(4) -5: fldt MO(twopi) - fxch -6: fprem1 - fnstsw - testl $0x400, %eax - jnz 6b - fstp %st(1) - fsincos - fldl MOX(huge_nan_null_null,%edx,1) - movl 4(%esp), %edx /* Pointer to memory for result. */ - fld %st - fstpt 12(%edx) - fstpt (%edx) - ftst - fnstsw - shll $7, %eax - andl $0x8000, %eax - orl %eax, 8(%edx) - fstp %st(0) - ftst - fnstsw - shll $7, %eax - andl $0x8000, %eax - orl %eax, 20(%edx) - fstp %st(0) - ret $4 - - /* The real part is +-Inf and the imaginary part is +-0. So return - +-Inf+-0i. */ - .align ALIGNARG(4) -4: movl 4(%esp), %eax /* Pointer to memory for result. */ - fstpt 12(%eax) - shrl $5, %edx - fstp %st(0) - andl $16, %edx - fldl MOX(huge_nan_null_null,%edx,1) - fstpt (%eax) - ret $4 - - /* The real part is +-Inf, the imaginary is also is not finite. */ - .align ALIGNARG(4) -3: fstp %st(0) - fstp %st(0) /* */ - andb $0x45, %ah - andb $0x47, %dh - xorb %dh, %ah - jnz 30f - fldl MO(infinity) /* Raise invalid exception. */ - fmull MO(zero) - fstp %st(0) -30: movl %edx, %eax - shrl $5, %edx - shll $4, %eax - andl $16, %edx - andl $32, %eax - orl %eax, %edx - movl 4(%esp), %eax /* Pointer to memory for result. */ - - fldl MOX(huge_nan_null_null,%edx,1) - fldl MOX(huge_nan_null_null+8,%edx,1) - fxch - fstpt (%eax) - fstpt 12(%eax) - ret $4 - - /* The real part is NaN. */ - .align ALIGNARG(4) -20: fldl MO(infinity) /* Raise invalid exception. */ - fmull MO(zero) - fstp %st(0) -2: fstp %st(0) - fstp %st(0) - movl 4(%esp), %eax /* Pointer to memory for result. */ - fldl MO(huge_nan_null_null+8) - fld %st(0) - fstpt (%eax) - fstpt 12(%eax) - ret $4 - -END(__cexpl) -weak_alias (__cexpl, cexpl) diff --git a/sysdeps/libm-i387/s_copysign.S b/sysdeps/libm-i387/s_copysign.S deleted file mode 100644 index 2520a94427..0000000000 --- a/sysdeps/libm-i387/s_copysign.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_copysign.S,v 1.4 1995/05/08 23:53:02 jtc Exp $") - -ENTRY(__copysign) - movl 16(%esp),%edx - movl 8(%esp),%eax - andl $0x80000000,%edx - andl $0x7fffffff,%eax - orl %edx,%eax - movl %eax,8(%esp) - fldl 4(%esp) - ret -END (__copysign) -weak_alias (__copysign, copysign) diff --git a/sysdeps/libm-i387/s_copysignf.S b/sysdeps/libm-i387/s_copysignf.S deleted file mode 100644 index 57b1a6f119..0000000000 --- a/sysdeps/libm-i387/s_copysignf.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $") - -ENTRY(__copysignf) - movl 8(%esp),%edx - movl 4(%esp),%eax - andl $0x80000000,%edx - andl $0x7fffffff,%eax - orl %edx,%eax - movl %eax,4(%esp) - flds 4(%esp) - ret -END (__copysignf) -weak_alias (__copysignf, copysignf) diff --git a/sysdeps/libm-i387/s_copysignl.S b/sysdeps/libm-i387/s_copysignl.S deleted file mode 100644 index 2163e7b014..0000000000 --- a/sysdeps/libm-i387/s_copysignl.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__copysignl) - movl 24(%esp),%edx - movl 12(%esp),%eax - andl $0x8000,%edx - andl $0x7fff,%eax - orl %edx,%eax - movl %eax,12(%esp) - fldt 4(%esp) - ret -END (__copysignl) -weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-i387/s_cos.S b/sysdeps/libm-i387/s_cos.S deleted file mode 100644 index ac8b1459d9..0000000000 --- a/sysdeps/libm-i387/s_cos.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_cos.S,v 1.5 1995/05/08 23:54:00 jtc Exp $") - -ENTRY(__cos) - fldl 4(%esp) - fcos - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fcos - ret -END (__cos) -weak_alias (__cos, cos) diff --git a/sysdeps/libm-i387/s_cosf.S b/sysdeps/libm-i387/s_cosf.S deleted file mode 100644 index d8e8090639..0000000000 --- a/sysdeps/libm-i387/s_cosf.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $") - -/* A float's domain isn't large enough to require argument reduction. */ -ENTRY(__cosf) - flds 4(%esp) - fcos - ret -END (__cosf) -weak_alias (__cosf, cosf) diff --git a/sysdeps/libm-i387/s_cosl.S b/sysdeps/libm-i387/s_cosl.S deleted file mode 100644 index 61c9010c99..0000000000 --- a/sysdeps/libm-i387/s_cosl.S +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__cosl) - fldt 4(%esp) - fcos - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fcos - ret -END (__cosl) -weak_alias (__cosl, cosl) diff --git a/sysdeps/libm-i387/s_exp2.S b/sysdeps/libm-i387/s_exp2.S deleted file mode 100644 index 778c0c0eb6..0000000000 --- a/sysdeps/libm-i387/s_exp2.S +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Written by J.T. Conklin . - * Adapted for exp2 by Ulrich Drepper . - * Public domain. - */ - -#include - -ENTRY(__ieee754_exp2) - fldl 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - frndint /* int(x) */ - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp2) diff --git a/sysdeps/libm-i387/s_exp2f.S b/sysdeps/libm-i387/s_exp2f.S deleted file mode 100644 index c2d1af1af1..0000000000 --- a/sysdeps/libm-i387/s_exp2f.S +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Written by J.T. Conklin . - * Adapted for exp2 by Ulrich Drepper . - * Public domain. - */ - -#include - -ENTRY(__ieee754_exp2f) - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - frndint /* int(x) */ - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp2f) diff --git a/sysdeps/libm-i387/s_exp2l.S b/sysdeps/libm-i387/s_exp2l.S deleted file mode 100644 index fa1fdc9236..0000000000 --- a/sysdeps/libm-i387/s_exp2l.S +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Written by J.T. Conklin . - * Adapted for exp2 by Ulrich Drepper . - * Public domain. - */ - -#include - -ENTRY(__ieee754_exp2l) - fldt 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fld %st - frndint /* int(x) */ - fsubr %st,%st(1) /* fract(x) */ - fxch - f2xm1 /* 2^(fract(x)) - 1 */ - fld1 - faddp /* 2^(fract(x)) */ - fscale /* e^x */ - fstp %st(1) - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp2l) diff --git a/sysdeps/libm-i387/s_expm1.S b/sysdeps/libm-i387/s_expm1.S deleted file mode 100644 index 92beaf0776..0000000000 --- a/sysdeps/libm-i387/s_expm1.S +++ /dev/null @@ -1,88 +0,0 @@ -/* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - Based on code by John C. Bowman . - Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(minus1,@object) -minus1: .double -1.0 - ASM_SIZE_DIRECTIVE(minus1) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(l2e,@object) -l2e: .tfloat 1.442695040888963407359924681002 - ASM_SIZE_DIRECTIVE(l2e) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__expm1) - fldl 4(%esp) // x - fxam // Is NaN or +-Inf? - fstsw %ax - movb $0x45, %ch - andb %ah, %ch - cmpb $0x40, %ch - je 3f // If +-0, jump. -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpb $0x05, %ch - je 2f // If +-Inf, jump. - - fldt MO(l2e) // log2(e) : x - fmulp // log2(e)*x - fld %st // log2(e)*x : log2(e)*x - frndint // int(log2(e)*x) : log2(e)*x - fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x) - fxch // fract(log2(e)*x) : int(log2(e)*x) - f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x) - fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x) - fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fsubrp %st, %st(1) // 2^(log2(e)*x) - ret - -2: testl $0x200, %eax // Test sign. - jz 3f // If positive, jump. - fstp %st - fldl MO(minus1) // Set result to -1.0. -3: ret -END(__expm1) -weak_alias (__expm1, expm1) diff --git a/sysdeps/libm-i387/s_expm1f.S b/sysdeps/libm-i387/s_expm1f.S deleted file mode 100644 index 45a60fe010..0000000000 --- a/sysdeps/libm-i387/s_expm1f.S +++ /dev/null @@ -1,88 +0,0 @@ -/* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - Based on code by John C. Bowman . - Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(minus1,@object) -minus1: .double -1.0 - ASM_SIZE_DIRECTIVE(minus1) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(l2e,@object) -l2e: .tfloat 1.442695040888963407359924681002 - ASM_SIZE_DIRECTIVE(l2e) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__expm1f) - flds 4(%esp) // x - fxam // Is NaN or +-Inf? - fstsw %ax - movb $0x45, %ch - andb %ah, %ch - cmpb $0x40, %ch - je 3f // If +-0, jump. -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpb $0x05, %ch - je 2f // If +-Inf, jump. - - fldt MO(l2e) // log2(e) : x - fmulp // log2(e)*x - fld %st // log2(e)*x : log2(e)*x - frndint // int(log2(e)*x) : log2(e)*x - fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x) - fxch // fract(log2(e)*x) : int(log2(e)*x) - f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x) - fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x) - fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fsubrp %st, %st(1) // 2^(log2(e)*x) - ret - -2: testl $0x200, %eax // Test sign. - jz 3f // If positive, jump. - fstp %st - fldl MO(minus1) // Set result to -1.0. -3: ret -END(__expm1f) -weak_alias (__expm1f, expm1f) diff --git a/sysdeps/libm-i387/s_expm1l.S b/sysdeps/libm-i387/s_expm1l.S deleted file mode 100644 index 13fa698cc7..0000000000 --- a/sysdeps/libm-i387/s_expm1l.S +++ /dev/null @@ -1,88 +0,0 @@ -/* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1996. - Based on code by John C. Bowman . - Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(minus1,@object) -minus1: .double -1.0 - ASM_SIZE_DIRECTIVE(minus1) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(l2e,@object) -l2e: .tfloat 1.442695040888963407359924681002 - ASM_SIZE_DIRECTIVE(l2e) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__expm1l) - fldt 4(%esp) // x - fxam // Is NaN or +-Inf? - fstsw %ax - movb $0x45, %ch - andb %ah, %ch - cmpb $0x40, %ch - je 3f // If +-0, jump. -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - cmpb $0x05, %ch - je 2f // If +-Inf, jump. - - fldt MO(l2e) // log2(e) : x - fmulp // log2(e)*x - fld %st // log2(e)*x : log2(e)*x - frndint // int(log2(e)*x) : log2(e)*x - fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x) - fxch // fract(log2(e)*x) : int(log2(e)*x) - f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x) - fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x) - fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x) - fsubrp %st, %st(1) // 2^(log2(e)*x) - ret - -2: testl $0x200, %eax // Test sign. - jz 3f // If positive, jump. - fstp %st - fldl MO(minus1) // Set result to -1.0. -3: ret -END(__expm1l) -weak_alias (__expm1l, expm1l) diff --git a/sysdeps/libm-i387/s_fdim.S b/sysdeps/libm-i387/s_fdim.S deleted file mode 100644 index 7a1e2ffa49..0000000000 --- a/sysdeps/libm-i387/s_fdim.S +++ /dev/null @@ -1,51 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fdim) - fldl 4(%esp) // x - fldl 12(%esp) // x : y - - fucom %st(1) - fnstsw - sahf - jp 1f - - fsubrp %st, %st(1) - jc 2f - - fstp %st(0) - fldz - jmp 2f - -1: fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 3f - - fxch -3: fstp %st(1) - -2: ret -END(__fdim) -weak_alias (__fdim, fdim) diff --git a/sysdeps/libm-i387/s_fdimf.S b/sysdeps/libm-i387/s_fdimf.S deleted file mode 100644 index 7e58f6752b..0000000000 --- a/sysdeps/libm-i387/s_fdimf.S +++ /dev/null @@ -1,51 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fdimf) - flds 4(%esp) // x - flds 8(%esp) // x : y - - fucom %st(1) - fnstsw - sahf - jp 1f - - fsubrp %st, %st(1) - jc 2f - - fstp %st(0) - fldz - jmp 2f - -1: fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 3f - - fxch -3: fstp %st(1) - -2: ret -END(__fdimf) -weak_alias (__fdimf, fdimf) diff --git a/sysdeps/libm-i387/s_fdiml.S b/sysdeps/libm-i387/s_fdiml.S deleted file mode 100644 index 7a8c18a5d3..0000000000 --- a/sysdeps/libm-i387/s_fdiml.S +++ /dev/null @@ -1,51 +0,0 @@ -/* Compute positive difference. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fdiml) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - - fucom %st(1) - fnstsw - sahf - jp 1f - - fsubrp %st, %st(1) - jc 2f - - fstp %st(0) - fldz - jmp 2f - -1: fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 3f - - fxch -3: fstp %st(1) - -2: ret -END(__fdiml) -weak_alias (__fdiml, fdiml) diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S deleted file mode 100644 index 63c766a950..0000000000 --- a/sysdeps/libm-i387/s_finite.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Written by Joe Keane . - */ - -#include - -ENTRY(__finite) - movl 8(%esp),%eax - movl $0xFFEFFFFF,%ecx - subl %eax,%ecx - xorl %ecx,%eax - shrl $31, %eax - ret -END (__finite) -weak_alias (__finite, finite) diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S deleted file mode 100644 index dabb71a115..0000000000 --- a/sysdeps/libm-i387/s_finitef.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Written by Joe Keane . - */ - -#include - -ENTRY(__finitef) - movl 4(%esp),%eax - movl $0xFF7FFFFF,%ecx - subl %eax,%ecx - xorl %ecx,%eax - shrl $31,%eax - ret -END (__finitef) -weak_alias (__finitef, finitef) diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S deleted file mode 100644 index acc5ad4cd0..0000000000 --- a/sysdeps/libm-i387/s_finitel.S +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Written by Joe Keane . - */ - -#include - -ENTRY(__finitel) - movl 12(%esp),%eax - orl $0xffff8000, %eax - incl %eax - shrl $31, %eax - ret -END (__finitel) -weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S deleted file mode 100644 index 20a8660424..0000000000 --- a/sysdeps/libm-i387/s_floor.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $") - -ENTRY(__floor) - fldl 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -END (__floor) -weak_alias (__floor, floor) diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S deleted file mode 100644 index eca93a2aa3..0000000000 --- a/sysdeps/libm-i387/s_floorf.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") - -ENTRY(__floorf) - flds 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -END (__floorf) -weak_alias (__floorf, floorf) diff --git a/sysdeps/libm-i387/s_floorl.S b/sysdeps/libm-i387/s_floorl.S deleted file mode 100644 index c2bf091d73..0000000000 --- a/sysdeps/libm-i387/s_floorl.S +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__floorl) - fldt 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -END (__floorl) -weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-i387/s_fma.S b/sysdeps/libm-i387/s_fma.S deleted file mode 100644 index 2affafcbf5..0000000000 --- a/sysdeps/libm-i387/s_fma.S +++ /dev/null @@ -1,31 +0,0 @@ -/* Compute (X * Y) + Z as ternary operation. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fma) - fldl 4(%esp) // x - fmull 12(%esp) // x * y - fldl 20(%esp) // z : x * y - faddp // (x * y) + z - ret -END(__fma) -weak_alias (__fma, fma) diff --git a/sysdeps/libm-i387/s_fmaf.S b/sysdeps/libm-i387/s_fmaf.S deleted file mode 100644 index 03c6cc0f9e..0000000000 --- a/sysdeps/libm-i387/s_fmaf.S +++ /dev/null @@ -1,31 +0,0 @@ -/* Compute (X * Y) + Z as ternary operation. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmaf) - flds 4(%esp) // x - fmuls 8(%esp) // x * y - flds 12(%esp) // z : x * y - faddp // (x * y) + z - ret -END(__fmaf) -weak_alias (__fmaf, fmaf) diff --git a/sysdeps/libm-i387/s_fmal.S b/sysdeps/libm-i387/s_fmal.S deleted file mode 100644 index c15fca8dab..0000000000 --- a/sysdeps/libm-i387/s_fmal.S +++ /dev/null @@ -1,32 +0,0 @@ -/* Compute (X * Y) + Z as ternary operation. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmal) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - fmulp // x * y - fldt 28(%esp) // z : x * y - faddp // (x * y) + z - ret -END(__fmal) -weak_alias (__fmal, fmal) diff --git a/sysdeps/libm-i387/s_fmax.S b/sysdeps/libm-i387/s_fmax.S deleted file mode 100644 index 3dbaa139ad..0000000000 --- a/sysdeps/libm-i387/s_fmax.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmax) - fldl 12(%esp) // y - fxam - fnstsw - fldl 4(%esp) // y : x - - andb $0x45, %ah - cmpb $0x01, %ah - je 1f // y == NaN - - fucom %st(1) - fnstsw - sahf - jnc 1f - - fxch %st(1) -1: fstp %st(1) - - ret -END(__fmax) -weak_alias (__fmax, fmax) diff --git a/sysdeps/libm-i387/s_fmaxf.S b/sysdeps/libm-i387/s_fmaxf.S deleted file mode 100644 index 5dd94a43c4..0000000000 --- a/sysdeps/libm-i387/s_fmaxf.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmaxf) - flds 8(%esp) // y - fxam - fnstsw - flds 4(%esp) // y : x - - andb $0x45, %ah - cmpb $0x01, %ah - je 1f // y == NaN - - fucom %st(1) - fnstsw - sahf - jnc 1f - - fxch %st(1) -1: fstp %st(1) - - ret -END(__fmaxf) -weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/libm-i387/s_fmaxl.S b/sysdeps/libm-i387/s_fmaxl.S deleted file mode 100644 index d833bd1985..0000000000 --- a/sysdeps/libm-i387/s_fmaxl.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute maximum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmaxl) - fldt 16(%esp) // y - fxam - fnstsw - fldt 4(%esp) // y : x - - andb $0x45, %ah - cmpb $0x01, %ah - je 1f // y == NaN - - fucom %st(1) - fnstsw - sahf - jnc 1f - - fxch %st(1) -1: fstp %st(1) - - ret -END(__fmaxl) -weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/libm-i387/s_fmin.S b/sysdeps/libm-i387/s_fmin.S deleted file mode 100644 index 1ac46c7d21..0000000000 --- a/sysdeps/libm-i387/s_fmin.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fmin) - fldl 4(%esp) // x - fldl 12(%esp) // x : y - - fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 1f // y == NaN - - fucom %st(1) - fnstsw - sahf - jc 2f - -1: fxch %st(1) -2: fstp %st(1) - - ret -END(__fmin) -weak_alias (__fmin, fmin) diff --git a/sysdeps/libm-i387/s_fminf.S b/sysdeps/libm-i387/s_fminf.S deleted file mode 100644 index 7dd346d2bc..0000000000 --- a/sysdeps/libm-i387/s_fminf.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fminf) - flds 4(%esp) // x - flds 8(%esp) // x : y - - fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 1f // y == NaN - - fucom %st(1) - fnstsw - sahf - jc 2f - -1: fxch %st(1) -2: fstp %st(1) - - ret -END(__fminf) -weak_alias (__fminf, fminf) diff --git a/sysdeps/libm-i387/s_fminl.S b/sysdeps/libm-i387/s_fminl.S deleted file mode 100644 index 883735d32c..0000000000 --- a/sysdeps/libm-i387/s_fminl.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute minimum of two numbers, regarding NaN as missing argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__fminl) - fldt 4(%esp) // x - fldt 16(%esp) // x : y - - fxam - fnstsw - andb $0x45, %ah - cmpb $0x01, %ah - je 1f // y == NaN - - fucom %st(1) - fnstsw - sahf - jc 2f - -1: fxch %st(1) -2: fstp %st(1) - - ret -END(__fminl) -weak_alias (__fminl, fminl) diff --git a/sysdeps/libm-i387/s_frexp.S b/sysdeps/libm-i387/s_frexp.S deleted file mode 100644 index 6a05f26720..0000000000 --- a/sysdeps/libm-i387/s_frexp.S +++ /dev/null @@ -1,82 +0,0 @@ -/* ix87 specific frexp implementation for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(two54,@object) -two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43 - ASM_SIZE_DIRECTIVE(two54) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__frexp) - movl 4(%esp), %ecx - movl 8(%esp), %eax - movl %eax, %edx - andl $0x7fffffff, %eax - orl %eax, %ecx - jz 1f - xorl %ecx, %ecx - cmpl $0x7ff00000, %eax - jae 1f - - cmpl $0x00100000, %eax - jae 2f - - fldl 4(%esp) -#ifdef PIC - call 3f -3: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx -#endif - fmull MO(two54) - movl $-54, %ecx - fstpl 4(%esp) - movl 8(%esp), %eax - movl %eax, %edx - andl $0x7fffffff, %eax - -2: shrl $20, %eax - andl $0x800fffff, %edx - subl $1022, %eax - orl $0x3fe00000, %edx - addl %eax, %ecx - movl %edx, 8(%esp) - - /* Store %ecx in the variable pointed to by the second argument, - get the factor from the stack and return. */ -1: movl 12(%esp), %eax - fldl 4(%esp) - movl %ecx, (%eax) - ret -END(__frexp) -weak_alias (__frexp, frexp) diff --git a/sysdeps/libm-i387/s_frexpf.S b/sysdeps/libm-i387/s_frexpf.S deleted file mode 100644 index 1021b97aee..0000000000 --- a/sysdeps/libm-i387/s_frexpf.S +++ /dev/null @@ -1,80 +0,0 @@ -/* ix87 specific frexp implementation for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(two25,@object) -two25: .byte 0, 0, 0, 0x4c - ASM_SIZE_DIRECTIVE(two25) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__frexpf) - movl 4(%esp), %eax - xorl %ecx, %ecx - movl %eax, %edx - andl $0x7fffffff, %eax - jz 1f - cmpl $0x7f800000, %eax - jae 1f - - cmpl $0x00800000, %eax - jae 2f - - flds 4(%esp) -#ifdef PIC - call 3f -3: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx -#endif - fmuls MO(two25) - movl $-25, %ecx - fstps 4(%esp) - movl 4(%esp), %eax - movl %eax, %edx - andl $0x7fffffff, %eax - -2: shrl $23, %eax - andl $0x807fffff, %edx - subl $126, %eax - orl $0x3f000000, %edx - addl %eax, %ecx - movl %edx, 4(%esp) - - /* Store %ecx in the variable pointed to by the second argument, - get the factor from the stack and return. */ -1: movl 8(%esp), %eax - flds 4(%esp) - movl %ecx, (%eax) - ret -END(__frexpf) -weak_alias (__frexpf, frexpf) diff --git a/sysdeps/libm-i387/s_frexpl.S b/sysdeps/libm-i387/s_frexpl.S deleted file mode 100644 index e3019ced6d..0000000000 --- a/sysdeps/libm-i387/s_frexpl.S +++ /dev/null @@ -1,82 +0,0 @@ -/* ix87 specific frexp implementation for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(two64,@object) -two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43 - ASM_SIZE_DIRECTIVE(two64) - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__frexpl) - movl 4(%esp), %ecx - movl 12(%esp), %eax - orl 8(%esp), %ecx - movl %eax, %edx - andl $0x7fff, %eax - orl %eax, %ecx - jz 1f - xorl %ecx, %ecx - cmpl $0x7fff, %eax - je 1f - - cmpl $0, %eax - je 2f - - fldt 4(%esp) -#ifdef PIC - call 3f -3: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx -#endif - fmull MO(two64) /* It's not necessary to use a 80bit factor */ - movl $-64, %ecx - fstpt 4(%esp) - movl 12(%esp), %eax - movl %eax, %edx - andl $0x7fff, %eax - -2: andl $0x8000, %edx - subl $16382, %eax - orl $0x3ffe, %edx - addl %eax, %ecx - movl %edx, 12(%esp) - - /* Store %ecx in the variable pointed to by the second argument, - get the factor from the stack and return. */ -1: movl 16(%esp), %eax - fldt 4(%esp) - movl %ecx, (%eax) - ret -END(__frexpl) -weak_alias (__frexpl, frexpl) diff --git a/sysdeps/libm-i387/s_ilogb.S b/sysdeps/libm-i387/s_ilogb.S deleted file mode 100644 index 36fb000c02..0000000000 --- a/sysdeps/libm-i387/s_ilogb.S +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_ilogb.S,v 1.5 1995/10/12 15:53:09 jtc Exp $") - -ENTRY(__ilogb) - fldl 4(%esp) - fxtract - pushl %eax - fstp %st - - fistpl (%esp) - fwait - popl %eax - - ret -END (__ilogb) -weak_alias (__ilogb, ilogb) diff --git a/sysdeps/libm-i387/s_ilogbf.S b/sysdeps/libm-i387/s_ilogbf.S deleted file mode 100644 index 54f9d4647e..0000000000 --- a/sysdeps/libm-i387/s_ilogbf.S +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_ilogbf.S,v 1.4 1995/10/22 20:32:43 pk Exp $") - -ENTRY(__ilogbf) - flds 4(%esp) - fxtract - pushl %eax - fstp %st - - fistpl (%esp) - fwait - popl %eax - - ret -END (__ilogbf) -weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/libm-i387/s_ilogbl.S b/sysdeps/libm-i387/s_ilogbl.S deleted file mode 100644 index 1dad93abeb..0000000000 --- a/sysdeps/libm-i387/s_ilogbl.S +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ilogbl) - fldt 4(%esp) - fxtract - pushl %eax - fstp %st - - fistpl (%esp) - fwait - popl %eax - - ret -END (__ilogbl) -weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/libm-i387/s_isinfl.c b/sysdeps/libm-i387/s_isinfl.c deleted file mode 100644 index f07898fd1b..0000000000 --- a/sysdeps/libm-i387/s_isinfl.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Written by J.T. Conklin . - * Change for long double by Ulrich Drepper . - * Intel i387 specific version. - * Public domain. - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __isinfl(long double x) -#else - int __isinfl(x) - long double x; -#endif -{ - int32_t se,hx,lx; - GET_LDOUBLE_WORDS(se,hx,lx,x); - /* This additional ^ 0x80000000 is necessary because in Intel's - internal representation of the implicit one is explicit. */ - lx |= (hx ^ 0x80000000) | ((se & 0x7fff) ^ 0x7fff); - lx |= -lx; - se &= 0x8000; - return ~(lx >> 31) & (1 - (se >> 14)); -} -weak_alias (__isinfl, isinfl) diff --git a/sysdeps/libm-i387/s_isnanl.c b/sysdeps/libm-i387/s_isnanl.c deleted file mode 100644 index 6a74b956cc..0000000000 --- a/sysdeps/libm-i387/s_isnanl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* s_isnanl.c -- long double version for i387 of s_isnan.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * isnanl(x) returns 1 is x is nan, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __isnanl(long double x) -#else - int __isnanl(x) - long double x; -#endif -{ - int32_t se,hx,lx; - GET_LDOUBLE_WORDS(se,hx,lx,x); - se = (se & 0x7fff) << 1; - /* The additional & 0x7fffffff is required because Intel's - extended format has the normally implicit 1 explicit - present. Sigh! */ - lx |= hx & 0x7fffffff; - se |= (u_int32_t)(lx|(-lx))>>31; - se = 0xfffe - se; - return (int)((u_int32_t)(se))>>16; -} -weak_alias (__isnanl, isnanl) diff --git a/sysdeps/libm-i387/s_llrint.S b/sysdeps/libm-i387/s_llrint.S deleted file mode 100644 index 6109ec45c3..0000000000 --- a/sysdeps/libm-i387/s_llrint.S +++ /dev/null @@ -1,34 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__llrint) - fldl 4(%esp) - subl $8, %esp - fistpll (%esp) - fwait - popl %eax - popl %edx - ret -END(__llrint) -weak_alias (__llrint, llrint) diff --git a/sysdeps/libm-i387/s_llrintf.S b/sysdeps/libm-i387/s_llrintf.S deleted file mode 100644 index c1e1c225c0..0000000000 --- a/sysdeps/libm-i387/s_llrintf.S +++ /dev/null @@ -1,34 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__llrintf) - flds 4(%esp) - subl $8, %esp - fistpll (%esp) - fwait - popl %eax - popl %edx - ret -END(__llrintf) -weak_alias (__llrintf, llrintf) diff --git a/sysdeps/libm-i387/s_llrintl.S b/sysdeps/libm-i387/s_llrintl.S deleted file mode 100644 index d894897d5e..0000000000 --- a/sysdeps/libm-i387/s_llrintl.S +++ /dev/null @@ -1,34 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__llrintl) - fldt 4(%esp) - subl $8, %esp - fistpll (%esp) - fwait - popl %eax - popl %edx - ret -END(__llrintl) -weak_alias (__llrintl, llrintl) diff --git a/sysdeps/libm-i387/s_log1p.S b/sysdeps/libm-i387/s_log1p.S deleted file mode 100644 index 10e8a36369..0000000000 --- a/sysdeps/libm-i387/s_log1p.S +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - /* The fyl2xp1 can only be used for values in - -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 - 0.29 is a safe value. - */ -limit: .double 0.29 -one: .double 1.0 - -/* - * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, - * otherwise fyl2x with the needed extra computation. - */ - .text -ENTRY(__log1p) - fldln2 - - fldl 4(%esp) - -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - - fld %st - fabs -#ifdef PIC - fcompl limit@GOTOFF(%edx) -#else - fcompl limit -#endif - fnstsw - sahf - jc 2f - -#ifdef PIC - faddl one@GOTOFF(%edx) -#else - faddl one -#endif - fyl2x - ret - -2: fyl2xp1 - ret - -END (__log1p) -weak_alias (__log1p, log1p) diff --git a/sysdeps/libm-i387/s_log1pf.S b/sysdeps/libm-i387/s_log1pf.S deleted file mode 100644 index df9fdcbcfc..0000000000 --- a/sysdeps/libm-i387/s_log1pf.S +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - /* The fyl2xp1 can only be used for values in - -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 - 0.29 is a safe value. - */ -limit: .float 0.29 -one: .float 1.0 - -/* - * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, - * otherwise fyl2x with the needed extra computation. - */ - .text -ENTRY(__log1pf) - fldln2 - - flds 4(%esp) - -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - - fld %st - fabs -#ifdef PIC - fcomps limit@GOTOFF(%edx) -#else - fcomps limit -#endif - fnstsw - sahf - jc 2f - -#ifdef PIC - fadds one@GOTOFF(%edx) -#else - fadds one -#endif - fyl2x - ret - -2: fyl2xp1 - ret - -END (__log1pf) -weak_alias (__log1pf, log1pf) diff --git a/sysdeps/libm-i387/s_log1pl.S b/sysdeps/libm-i387/s_log1pl.S deleted file mode 100644 index 05a17b2831..0000000000 --- a/sysdeps/libm-i387/s_log1pl.S +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - /* The fyl2xp1 can only be used for values in - -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 - 0.29 is a safe value. - */ -limit: .tfloat 0.29 - /* Please note: we use a double value here. Since 1.0 has - an exact representation this does not effect the accuracy - but it helps to optimize the code. */ -one: .double 1.0 - -/* - * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, - * otherwise fyl2x with the needed extra computation. - */ - .text -ENTRY(__log1pl) - fldln2 - - fldt 4(%esp) - -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - - fld %st - fabs -#ifdef PIC - fldt limit@GOTOFF(%edx) -#else - fldt limit -#endif - fcompp - fnstsw - sahf - jnc 2f - -#ifdef PIC - faddl one@GOTOFF(%edx) -#else - faddl one -#endif - fyl2x - ret - -2: fyl2xp1 - ret - -END (__log1pl) -weak_alias (__log1pl, log1pl) diff --git a/sysdeps/libm-i387/s_log2.S b/sysdeps/libm-i387/s_log2.S deleted file mode 100644 index 4632c96f67..0000000000 --- a/sysdeps/libm-i387/s_log2.S +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Written by J.T. Conklin . - * Adapted for use as log2 by Ulrich Drepper . - * Public domain. - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__log2) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - fldl MO(one) - fldl 4(%esp) // 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 2f - fstp %st(1) // x-1 : 1 - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : 1 - fyl2x // log(x) - ret -END (__log2) -weak_alias (__log2, log2) diff --git a/sysdeps/libm-i387/s_log2f.S b/sysdeps/libm-i387/s_log2f.S deleted file mode 100644 index bfdd0ef88e..0000000000 --- a/sysdeps/libm-i387/s_log2f.S +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Written by J.T. Conklin . - * Adapted for use as log2 by Ulrich Drepper . - * Public domain. - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__log2f) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - fldl MO(one) - flds 4(%esp) // 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 2f - fstp %st(1) // x-1 : 1 - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : 1 - fyl2x // log(x) - ret -END (__log2f) -weak_alias (__log2f, log2f) diff --git a/sysdeps/libm-i387/s_log2l.S b/sysdeps/libm-i387/s_log2l.S deleted file mode 100644 index 184981c4bb..0000000000 --- a/sysdeps/libm-i387/s_log2l.S +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Written by J.T. Conklin . - * Adapted for use as log2 by Ulrich Drepper . - * Public domain. - * - * Changed to use fyl2xp1 for values near 1, . - */ - -#include - -#ifdef __ELF__ - .section .rodata -#else - .text -#endif - .align ALIGNARG(4) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - - -#ifdef PIC -#define MO(op) op##@GOTOFF(%edx) -#else -#define MO(op) op -#endif - - .text -ENTRY(__log2l) -#ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx -#endif - fldl MO(one) - fldt 4(%esp) // 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 2f - fstp %st(1) // x-1 : 1 - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : 1 - fyl2x // log(x) - ret -END (__log2l) -weak_alias (__log2l, log2l) diff --git a/sysdeps/libm-i387/s_logb.S b/sysdeps/libm-i387/s_logb.S deleted file mode 100644 index f78c091c8a..0000000000 --- a/sysdeps/libm-i387/s_logb.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_logb.S,v 1.4 1995/05/09 00:14:30 jtc Exp $") - -ENTRY(__logb) - fldl 4(%esp) - fxtract - fstp %st - ret -END (__logb) -weak_alias (__logb, logb) diff --git a/sysdeps/libm-i387/s_logbf.S b/sysdeps/libm-i387/s_logbf.S deleted file mode 100644 index 91eb3d2925..0000000000 --- a/sysdeps/libm-i387/s_logbf.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $") - -ENTRY(__logbf) - flds 4(%esp) - fxtract - fstp %st - ret -END (__logbf) -weak_alias (__logbf, logbf) diff --git a/sysdeps/libm-i387/s_logbl.S b/sysdeps/libm-i387/s_logbl.S deleted file mode 100644 index 5c9a9c1c9d..0000000000 --- a/sysdeps/libm-i387/s_logbl.S +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__logbl) - fldt 4(%esp) - fxtract - fstp %st - ret -END (__logbl) -weak_alias (__logbl, logbl) diff --git a/sysdeps/libm-i387/s_lrint.S b/sysdeps/libm-i387/s_lrint.S deleted file mode 100644 index 40956ab0d0..0000000000 --- a/sysdeps/libm-i387/s_lrint.S +++ /dev/null @@ -1,33 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__lrint) - fldl 4(%esp) - subl $4, %esp - fistpl (%esp) - fwait - popl %eax - ret -END(__lrint) -weak_alias (__lrint, lrint) diff --git a/sysdeps/libm-i387/s_lrintf.S b/sysdeps/libm-i387/s_lrintf.S deleted file mode 100644 index 2f49bdbabe..0000000000 --- a/sysdeps/libm-i387/s_lrintf.S +++ /dev/null @@ -1,33 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__lrintf) - flds 4(%esp) - subl $4, %esp - fistpl (%esp) - fwait - popl %eax - ret -END(__lrintf) -weak_alias (__lrintf, lrintf) diff --git a/sysdeps/libm-i387/s_lrintl.S b/sysdeps/libm-i387/s_lrintl.S deleted file mode 100644 index 3a06c91b29..0000000000 --- a/sysdeps/libm-i387/s_lrintl.S +++ /dev/null @@ -1,33 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - .text -ENTRY(__lrintl) - fldt 4(%esp) - subl $4, %esp - fistpl (%esp) - fwait - popl %eax - ret -END(__lrintl) -weak_alias (__lrintl, lrintl) diff --git a/sysdeps/libm-i387/s_nearbyint.S b/sysdeps/libm-i387/s_nearbyint.S deleted file mode 100644 index 65ce4f76a1..0000000000 --- a/sysdeps/libm-i387/s_nearbyint.S +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ -/* Adapted for use as nearbyint by Ulrich Drepper . */ - -#include - -ENTRY(__nearbyint) - fldl 4(%esp) - pushl %eax - pushl %ecx - fnstcw (%esp) - movl (%esp), %eax - andl $~0x20, %eax - movl %eax, 4(%esp) - fldcw 4(%esp) - frndint - fclex - fldcw (%esp) - popl %ecx - popl %eax - ret -END (__nearbyint) -weak_alias (__nearbyint, nearbyint) diff --git a/sysdeps/libm-i387/s_nearbyintf.S b/sysdeps/libm-i387/s_nearbyintf.S deleted file mode 100644 index 090c631607..0000000000 --- a/sysdeps/libm-i387/s_nearbyintf.S +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ -/* Adapted for use as nearbyint by Ulrich Drepper . */ - -#include - -ENTRY(__nearbyintf) - flds 4(%esp) - pushl %eax - pushl %ecx - fnstcw (%esp) - movl (%esp), %eax - andl $~0x20, %eax - movl %eax, 4(%esp) - fldcw 4(%esp) - frndint - fclex - fldcw (%esp) - popl %ecx - popl %eax - ret -END (__nearbyintf) -weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/libm-i387/s_nearbyintl.S b/sysdeps/libm-i387/s_nearbyintl.S deleted file mode 100644 index 2f60af8f18..0000000000 --- a/sysdeps/libm-i387/s_nearbyintl.S +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ -/* Adapted for use as nearbyint by Ulrich Drepper . */ - -#include - -ENTRY(__nearbyintl) - fldt 4(%esp) - pushl %eax - pushl %ecx - fnstcw (%esp) - movl (%esp), %eax - andl $~0x20, %eax - movl %eax, 4(%esp) - fldcw 4(%esp) - frndint - fclex - fldcw (%esp) - popl %ecx - popl %eax - ret -END (__nearbyintl) -weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/libm-i387/s_nextafterl.c b/sysdeps/libm-i387/s_nextafterl.c deleted file mode 100644 index 4596c6b93c..0000000000 --- a/sysdeps/libm-i387/s_nextafterl.c +++ /dev/null @@ -1,102 +0,0 @@ -/* s_nextafterl.c -- long double version of s_nextafter.c. - * Special version for i387. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* IEEE functions - * nextafterl(x,y) - * return the next machine floating-point number of x in the - * direction toward y. - * Special cases: - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __nextafterl(long double x, long double y) -#else - long double __nextafterl(x,y) - long double x,y; -#endif -{ - int32_t hx,hy,ix,iy; - u_int32_t lx,ly,esx,esy; - - GET_LDOUBLE_WORDS(esx,hx,lx,x); - GET_LDOUBLE_WORDS(esy,hy,ly,y); - ix = esx&0x7fff; /* |x| */ - iy = esy&0x7fff; /* |y| */ - - /* The additional &hx/&hy is required because Intel's extended format - has the normally implicit 1 explicit present. Sigh! */ - if(((ix==0x7fff)&&(((hx|lx)|-(hx|lx))&hx)>>31!=0) || /* x is nan */ - ((iy==0x7fff)&&(((hy|ly)|-(hy|ly))&hy)>>31!=0)) /* y is nan */ - return x+y; - if(x==y) return y; /* x=y, return y */ - if((ix|hx|lx)==0) { /* x == 0 */ - SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ - } - if(esx<0x8000) { /* x > 0 */ - if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { - /* x > y, x -= ulp */ - if(lx==0) { - if (hx==0) esx -= 1; - hx -= 1; - } - lx -= 1; - } else { /* x < y, x += ulp */ - lx += 1; - if(lx==0) { - hx += 1; - if (hx==0) - esx += 1; - } - } - } else { /* x < 0 */ - if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ - /* x < y, x -= ulp */ - if(lx==0) { - if (hx==0) esx -= 1; - hx -= 1; - } - lx -= 1; - } else { /* x > y, x += ulp */ - lx += 1; - if(lx==0) { - hx += 1; - if (hx==0) esx += 1; - } - } - } - esy = esx&0x7fff; - if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } - } - SET_LDOUBLE_WORDS(x,esx,hx,lx); - return x; -} -weak_alias (__nextafterl, nextafterl) diff --git a/sysdeps/libm-i387/s_remquo.S b/sysdeps/libm-i387/s_remquo.S deleted file mode 100644 index 8ada191771..0000000000 --- a/sysdeps/libm-i387/s_remquo.S +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Written by Ulrich Drepper . - * Based on e_remainder by J.T. Conklin . - * Public domain. - */ - -#include - -ENTRY(__remquo) - fldl 12(%esp) - fldl 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - /* Compute the congruent of the quotient. */ - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - movl $0xef2960, %eax - shrl %cl, %eax - andl $3, %eax - movl 20(%esp), %ecx - movl 8(%esp), %edx - xorl 16(%esp), %edx - testl $0x80000000, %edx - jz 1f - negl %eax -1: movl %eax, (%ecx) - ret -END (__remquo) -weak_alias (__remquo, remquo) diff --git a/sysdeps/libm-i387/s_remquof.S b/sysdeps/libm-i387/s_remquof.S deleted file mode 100644 index f60aec9c46..0000000000 --- a/sysdeps/libm-i387/s_remquof.S +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Written by Ulrich Drepper . - * Based on e_remainder by J.T. Conklin . - * Public domain. - */ - -#include - -ENTRY(__remquof) - flds 8(%esp) - flds 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - /* Compute the congruent of the quotient. */ - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - movl $0xef2960, %eax - shrl %cl, %eax - andl $3, %eax - movl 12(%esp), %ecx - movl 4(%esp), %edx - xorl 8(%esp), %edx - testl $0x80000000, %edx - jz 1f - negl %eax -1: movl %eax, (%ecx) - ret -END (__remquof) -weak_alias (__remquof, remquof) diff --git a/sysdeps/libm-i387/s_remquol.S b/sysdeps/libm-i387/s_remquol.S deleted file mode 100644 index 115d6e874b..0000000000 --- a/sysdeps/libm-i387/s_remquol.S +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Written by Ulrich Drepper . - * Based on e_remainder by J.T. Conklin . - * Public domain. - */ - -#include - -ENTRY(__remquol) - fldt 16(%esp) - fldt 4(%esp) -1: fprem1 - fstsw %ax - sahf - jp 1b - fstp %st(1) - /* Compute the congruent of the quotient. */ - movl %eax, %ecx - shrl $8, %eax - shrl $12, %ecx - andl $4, %ecx - andl $3, %eax - orl %eax, %ecx - movl $0xef2960, %eax - shrl %cl, %eax - andl $3, %eax - movl 28(%esp), %ecx - movl 12(%esp), %edx - xorl 24(%esp), %edx - testl $0x8000, %edx - jz 1f - negl %eax -1: movl %eax, (%ecx) - ret -END (__remquol) -weak_alias (__remquol, remquol) diff --git a/sysdeps/libm-i387/s_rint.S b/sysdeps/libm-i387/s_rint.S deleted file mode 100644 index be36c5f0ca..0000000000 --- a/sysdeps/libm-i387/s_rint.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_rint.S,v 1.4 1995/05/09 00:16:08 jtc Exp $") - -ENTRY(__rint) - fldl 4(%esp) - frndint - ret -END (__rint) -weak_alias (__rint, rint) diff --git a/sysdeps/libm-i387/s_rintf.S b/sysdeps/libm-i387/s_rintf.S deleted file mode 100644 index 2b358c1cf1..0000000000 --- a/sysdeps/libm-i387/s_rintf.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $") - -ENTRY(__rintf) - flds 4(%esp) - frndint - ret -END (__rintf) -weak_alias (__rintf, rintf) diff --git a/sysdeps/libm-i387/s_rintl.S b/sysdeps/libm-i387/s_rintl.S deleted file mode 100644 index fd1ae6324e..0000000000 --- a/sysdeps/libm-i387/s_rintl.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__rintl) - fldt 4(%esp) - frndint - ret -END (__rintl) -weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-i387/s_scalbln.c b/sysdeps/libm-i387/s_scalbln.c deleted file mode 100644 index 1009713fbc..0000000000 --- a/sysdeps/libm-i387/s_scalbln.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Nothing to do. This function is the same as scalbn. So we define an - alias. */ diff --git a/sysdeps/libm-i387/s_scalblnf.c b/sysdeps/libm-i387/s_scalblnf.c deleted file mode 100644 index 5e558c3540..0000000000 --- a/sysdeps/libm-i387/s_scalblnf.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Nothing to do. This function is the same as scalbnf. So we define an - alias. */ diff --git a/sysdeps/libm-i387/s_scalblnl.c b/sysdeps/libm-i387/s_scalblnl.c deleted file mode 100644 index cda2ec11c8..0000000000 --- a/sysdeps/libm-i387/s_scalblnl.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Nothing to do. This function is the same as scalbnl. So we define an - alias. */ diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S deleted file mode 100644 index ea9e25f094..0000000000 --- a/sysdeps/libm-i387/s_scalbn.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_scalbn.S,v 1.4 1995/05/09 00:19:06 jtc Exp $") - -ENTRY(__scalbn) - fildl 12(%esp) - fldl 4(%esp) - fscale - fstp %st(1) - ret -END (__scalbn) -weak_alias (__scalbn, scalbn) -strong_alias (__scalbn, __scalbln) -weak_alias (__scalbn, scalbln) diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S deleted file mode 100644 index dc8cfb4296..0000000000 --- a/sysdeps/libm-i387/s_scalbnf.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_scalbnf.S,v 1.3 1995/05/09 00:19:59 jtc Exp $") - -ENTRY(__scalbnf) - fildl 8(%esp) - flds 4(%esp) - fscale - fstp %st(1) - ret -END (__scalbnf) -weak_alias (__scalbnf, scalbnf) -strong_alias (__scalbnf, __scalblnf) -weak_alias (__scalbnf, scalblnf) diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S deleted file mode 100644 index 295494b3d2..0000000000 --- a/sysdeps/libm-i387/s_scalbnl.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__scalbnl) - fildl 16(%esp) - fldt 4(%esp) - fscale - fstp %st(1) - ret -END (__scalbnl) -weak_alias (__scalbnl, scalbnl) -strong_alias (__scalbnl, __scalblnl) -weak_alias (__scalbnl, scalblnl) diff --git a/sysdeps/libm-i387/s_significand.S b/sysdeps/libm-i387/s_significand.S deleted file mode 100644 index 4859b7ed71..0000000000 --- a/sysdeps/libm-i387/s_significand.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_significand.S,v 1.4 1995/05/09 00:21:47 jtc Exp $") - -ENTRY(__significand) - fldl 4(%esp) - fxtract - fstp %st(1) - ret -END (__significand) -weak_alias (__significand, significand) diff --git a/sysdeps/libm-i387/s_significandf.S b/sysdeps/libm-i387/s_significandf.S deleted file mode 100644 index 3a2de97759..0000000000 --- a/sysdeps/libm-i387/s_significandf.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_significandf.S,v 1.3 1995/05/09 00:24:07 jtc Exp $") - -ENTRY(__significandf) - flds 4(%esp) - fxtract - fstp %st(1) - ret -END (__significandf) -weak_alias (__significandf, significandf) diff --git a/sysdeps/libm-i387/s_significandl.S b/sysdeps/libm-i387/s_significandl.S deleted file mode 100644 index e3a69cba73..0000000000 --- a/sysdeps/libm-i387/s_significandl.S +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__significandl) - fldt 4(%esp) - fxtract - fstp %st(0) - ret -END (__significandl) -weak_alias (__significandl, significandl) diff --git a/sysdeps/libm-i387/s_sin.S b/sysdeps/libm-i387/s_sin.S deleted file mode 100644 index eb22d7e98b..0000000000 --- a/sysdeps/libm-i387/s_sin.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $") - -ENTRY(__sin) - fldl 4(%esp) - fsin - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsin - ret -END (__sin) -weak_alias (__sin, sin) diff --git a/sysdeps/libm-i387/s_sincos.S b/sysdeps/libm-i387/s_sincos.S deleted file mode 100644 index fe99f42d18..0000000000 --- a/sysdeps/libm-i387/s_sincos.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__sincos) - fldl 4(%esp) - fsincos - movl 12(%esp), %ecx - movl 16(%esp), %edx - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstpl (%edx) - fstpl (%ecx) - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstpl (%edx) - fstpl (%ecx) - ret -END(__sincos) -weak_alias(__sincos, sincos) diff --git a/sysdeps/libm-i387/s_sincosf.S b/sysdeps/libm-i387/s_sincosf.S deleted file mode 100644 index 5bb13f3c33..0000000000 --- a/sysdeps/libm-i387/s_sincosf.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__sincosf) - flds 4(%esp) - fsincos - movl 8(%esp), %ecx - movl 12(%esp), %edx - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstps (%edx) - fstps (%ecx) - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstps (%edx) - fstps (%ecx) - ret -END(__sincosf) -weak_alias(__sincosf, sincosf) diff --git a/sysdeps/libm-i387/s_sincosl.S b/sysdeps/libm-i387/s_sincosl.S deleted file mode 100644 index 8b6694f09f..0000000000 --- a/sysdeps/libm-i387/s_sincosl.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__sincosl) - fldt 4(%esp) - fsincos - movl 16(%esp), %ecx - movl 20(%esp), %edx - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstpt (%edx) - fstpt (%ecx) - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstpt (%edx) - fstpt (%ecx) - ret -END(__sincosl) -weak_alias(__sincosl, sincosl) diff --git a/sysdeps/libm-i387/s_sinf.S b/sysdeps/libm-i387/s_sinf.S deleted file mode 100644 index a010d60f5e..0000000000 --- a/sysdeps/libm-i387/s_sinf.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $") - -/* A float's domain isn't large enough to require argument reduction. */ -ENTRY(__sinf) - flds 4(%esp) - fsin - ret -END (__sinf) -weak_alias (__sinf, sinf) diff --git a/sysdeps/libm-i387/s_sinl.S b/sysdeps/libm-i387/s_sinl.S deleted file mode 100644 index 3e215de5e1..0000000000 --- a/sysdeps/libm-i387/s_sinl.S +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__sinl) - fldt 4(%esp) - fsin - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsin - ret -END (__sinl) -weak_alias (__sinl, sinl) diff --git a/sysdeps/libm-i387/s_tan.S b/sysdeps/libm-i387/s_tan.S deleted file mode 100644 index 7b3547af4c..0000000000 --- a/sysdeps/libm-i387/s_tan.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_tan.S,v 1.5 1995/05/09 00:30:00 jtc Exp $") - -ENTRY(__tan) - fldl 4(%esp) - fptan - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstp %st(0) - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fptan - fstp %st(0) - ret -END (__tan) -weak_alias (__tan, tan) diff --git a/sysdeps/libm-i387/s_tanf.S b/sysdeps/libm-i387/s_tanf.S deleted file mode 100644 index 7a7509119b..0000000000 --- a/sysdeps/libm-i387/s_tanf.S +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $") - -/* A float's domain isn't large enough to require argument reduction. */ -ENTRY(__tanf) - flds 4(%esp) - fptan - fstp %st(0) - ret -END (__tanf) -weak_alias (__tanf, tanf) diff --git a/sysdeps/libm-i387/s_tanl.S b/sysdeps/libm-i387/s_tanl.S deleted file mode 100644 index f2bdd6a605..0000000000 --- a/sysdeps/libm-i387/s_tanl.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__tanl) - fldt 4(%esp) - fptan - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstp %st(0) - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fptan - fstp %st(0) - ret -END (__tanl) -weak_alias (__tanl, tanl) diff --git a/sysdeps/libm-i387/s_trunc.S b/sysdeps/libm-i387/s_trunc.S deleted file mode 100644 index 3100d716a9..0000000000 --- a/sysdeps/libm-i387/s_trunc.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Truncate double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__trunc) - fldl 4(%esp) - subl $8, %esp - fstcw 4(%esp) - movl $0xc00, %edx - orl 4(%esp), %edx - movl %edx, (%esp) - fldcw (%esp) - frndint - fldcw 4(%esp) - addl $8, %esp - ret -END(__trunc) -weak_alias (__trunc, trunc) diff --git a/sysdeps/libm-i387/s_truncf.S b/sysdeps/libm-i387/s_truncf.S deleted file mode 100644 index 275e5f714c..0000000000 --- a/sysdeps/libm-i387/s_truncf.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Truncate float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__truncf) - flds 4(%esp) - subl $8, %esp - fstcw 4(%esp) - movl $0xc00, %edx - orl 4(%esp), %edx - movl %edx, (%esp) - fldcw (%esp) - frndint - fldcw 4(%esp) - addl $8, %esp - ret -END(__truncf) -weak_alias (__truncf, truncf) diff --git a/sysdeps/libm-i387/s_truncl.S b/sysdeps/libm-i387/s_truncl.S deleted file mode 100644 index 4c0bb0ce53..0000000000 --- a/sysdeps/libm-i387/s_truncl.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Truncate long double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -ENTRY(__truncl) - fldt 4(%esp) - subl $8, %esp - fstcw 4(%esp) - movl $0xc00, %edx - orl 4(%esp), %edx - movl %edx, (%esp) - fldcw (%esp) - frndint - fldcw 4(%esp) - addl $8, %esp - ret -END(__truncl) -weak_alias (__truncl, truncl) diff --git a/sysdeps/libm-i387/t_exp.c b/sysdeps/libm-i387/t_exp.c deleted file mode 100644 index fd37963b05..0000000000 --- a/sysdeps/libm-i387/t_exp.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. Not needed. */ diff --git a/sysdeps/libm-ieee754/Dist b/sysdeps/libm-ieee754/Dist deleted file mode 100644 index 4b085470f5..0000000000 --- a/sysdeps/libm-ieee754/Dist +++ /dev/null @@ -1,2 +0,0 @@ -t_exp2.h -t_exp2f.h diff --git a/sysdeps/libm-ieee754/e_acos.c b/sysdeps/libm-ieee754/e_acos.c deleted file mode 100644 index eb4080a8b8..0000000000 --- a/sysdeps/libm-ieee754/e_acos.c +++ /dev/null @@ -1,144 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_acos.c,v 1.9 1995/05/12 04:57:13 jtc Exp $"; -#endif - -/* __ieee754_acos(x) - * Method : - * acos(x) = pi/2 - asin(x) - * acos(-x) = pi/2 + asin(x) - * For |x|<=0.5 - * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) - * For x>0.5 - * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) - * = 2asin(sqrt((1-x)/2)) - * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) - * = 2f + (2c + 2s*z*R(z)) - * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term - * for f so that f+c ~ sqrt(z). - * For x<-0.5 - * acos(x) = pi - 2asin(sqrt((1-|x|)/2)) - * = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z) - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN with invalid signal. - * - * Function needed: __ieee754_sqrt - */ - -#include "math.h" -#include "math_private.h" -#define one qS[0] - -#ifdef __STDC__ -static const double -#else -static double -#endif -pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ -pS[] = {1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ - -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ - 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ - -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ - 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ - 3.47933107596021167570e-05}, /* 0x3F023DE1, 0x0DFDF709 */ -qS[] ={1.0, -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ - 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ - -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ - 7.70381505559019352791e-02}; /* 0x3FB3B8C5, 0xB12E9282 */ - -#ifdef __STDC__ - double __ieee754_acos(double x) -#else - double __ieee754_acos(x) - double x; -#endif -{ - double z,p,q,r,w,s,c,df,p1,p2,p3,q1,q2,z2,z4,z6; - int32_t hx,ix; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x3ff00000) { /* |x| >= 1 */ - u_int32_t lx; - GET_LOW_WORD(lx,x); - if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */ - if(hx>0) return 0.0; /* acos(1) = 0 */ - else return pi+2.0*pio2_lo; /* acos(-1)= pi */ - } - return (x-x)/(x-x); /* acos(|x|>1) is NaN */ - } - if(ix<0x3fe00000) { /* |x| < 0.5 */ - if(ix<=0x3c600000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ - z = x*x; -#ifdef DO_NOT_USE_THIS - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); -#else - p1 = z*pS[0]; z2=z*z; - p2 = pS[1]+z*pS[2]; z4=z2*z2; - p3 = pS[3]+z*pS[4]; z6=z4*z2; - q1 = one+z*qS[1]; - q2 = qS[2]+z*qS[3]; - p = p1 + z2*p2 + z4*p3 + z6*pS[5]; - q = q1 + z2*q2 + z4*qS[4]; -#endif - r = p/q; - return pio2_hi - (x - (pio2_lo-x*r)); - } else if (hx<0) { /* x < -0.5 */ - z = (one+x)*0.5; -#ifdef DO_NOT_USE_THIS - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); -#else - p1 = z*pS[0]; z2=z*z; - p2 = pS[1]+z*pS[2]; z4=z2*z2; - p3 = pS[3]+z*pS[4]; z6=z4*z2; - q1 = one+z*qS[1]; - q2 = qS[2]+z*qS[3]; - p = p1 + z2*p2 + z4*p3 + z6*pS[5]; - q = q1 + z2*q2 + z4*qS[4]; -#endif - s = __ieee754_sqrt(z); - r = p/q; - w = r*s-pio2_lo; - return pi - 2.0*(s+w); - } else { /* x > 0.5 */ - z = (one-x)*0.5; - s = __ieee754_sqrt(z); - df = s; - SET_LOW_WORD(df,0); - c = (z-df*df)/(s+df); -#ifdef DO_NOT_USE_THIS - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); -#else - p1 = z*pS[0]; z2=z*z; - p2 = pS[1]+z*pS[2]; z4=z2*z2; - p3 = pS[3]+z*pS[4]; z6=z4*z2; - q1 = one+z*qS[1]; - q2 = qS[2]+z*qS[3]; - p = p1 + z2*p2 + z4*p3 + z6*pS[5]; - q = q1 + z2*q2 + z4*qS[4]; -#endif - r = p/q; - w = r*s+c; - return 2.0*(df+w); - } -} diff --git a/sysdeps/libm-ieee754/e_acosf.c b/sysdeps/libm-ieee754/e_acosf.c deleted file mode 100644 index 0d85c4210d..0000000000 --- a/sysdeps/libm-ieee754/e_acosf.c +++ /dev/null @@ -1,89 +0,0 @@ -/* e_acosf.c -- float version of e_acos.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 -one = 1.0000000000e+00, /* 0x3F800000 */ -pi = 3.1415925026e+00, /* 0x40490fda */ -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ -pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ -pS1 = -3.2556581497e-01, /* 0xbea6b090 */ -pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ -pS3 = -4.0055535734e-02, /* 0xbd241146 */ -pS4 = 7.9153501429e-04, /* 0x3a4f7f04 */ -pS5 = 3.4793309169e-05, /* 0x3811ef08 */ -qS1 = -2.4033949375e+00, /* 0xc019d139 */ -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 z,p,q,r,w,s,c,df; - int32_t hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix==0x3f800000) { /* |x|==1 */ - if(hx>0) return 0.0; /* acos(1) = 0 */ - else return pi+(float)2.0*pio2_lo; /* acos(-1)= pi */ - } else if(ix>0x3f800000) { /* |x| >= 1 */ - return (x-x)/(x-x); /* acos(|x|>1) is NaN */ - } - if(ix<0x3f000000) { /* |x| < 0.5 */ - if(ix<=0x23000000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ - z = x*x; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - return pio2_hi - (x - (pio2_lo-x*r)); - } else if (hx<0) { /* x < -0.5 */ - z = (one+x)*(float)0.5; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - s = __ieee754_sqrtf(z); - r = p/q; - w = r*s-pio2_lo; - return pi - (float)2.0*(s+w); - } else { /* x > 0.5 */ - int32_t idf; - z = (one-x)*(float)0.5; - s = __ieee754_sqrtf(z); - df = s; - GET_FLOAT_WORD(idf,df); - SET_FLOAT_WORD(df,idf&0xfffff000); - c = (z-df*df)/(s+df); - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - w = r*s+c; - return (float)2.0*(df+w); - } -} diff --git a/sysdeps/libm-ieee754/e_acosh.c b/sysdeps/libm-ieee754/e_acosh.c deleted file mode 100644 index 27c29cd8c9..0000000000 --- a/sysdeps/libm-ieee754/e_acosh.c +++ /dev/null @@ -1,69 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#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 - * acosh(x) = log [ x + sqrt(x*x-1) ] - * we have - * acosh(x) := log(x)+ln2, if x is large; else - * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else - * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. - * - * Special cases: - * acosh(x) is NaN with signal if x<1. - * acosh(NaN) is NaN without signal. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -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 t; - int32_t hx; - u_int32_t lx; - EXTRACT_WORDS(hx,lx,x); - if(hx<0x3ff00000) { /* x < 1 */ - 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 __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */ - } else if(((hx-0x3ff00000)|lx)==0) { - return 0.0; /* acosh(1) = 0 */ - } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ - t=x*x; - return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one))); - } else { /* 1=0x4d800000) { /* x > 2**28 */ - if(hx >=0x7f800000) { /* x is inf of NaN */ - return x+x; - } else - return __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */ - } else if (hx==0x3f800000) { - return 0.0; /* acosh(1) = 0 */ - } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ - t=x*x; - return __ieee754_logf((float)2.0*x-one/(x+__ieee754_sqrtf(t-one))); - } else { /* 12; else - * acoshl(x) := log1pl(t+sqrtl(2.0*t+t*t)); where t=x-1. - * - * Special cases: - * acoshl(x) is NaN with signal if x<1. - * acoshl(NaN) is NaN without signal. - */ - -#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 t; - u_int32_t se,i0,i1; - GET_LDOUBLE_WORDS(se,i0,i1,x); - if(se<0x3fff || se & 0x8000) { /* x < 1 */ - return (x-x)/(x-x); - } else if(se >=0x401b) { /* x > 2**28 */ - if(se >=0x7fff) { /* x is inf of NaN */ - return x+x; - } else - return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */ - } else if(((se-0x3fff)|i0|i1)==0) { - return 0.0; /* acosh(1) = 0 */ - } else if (se > 0x4000) { /* 2**28 > x > 2 */ - t=x*x; - return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one))); - } else { /* 10.98 - * asin(x) = pi/2 - 2*(s+s*z*R(z)) - * = 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) - * and - * asin(x) = pi/2 - 2*(s+s*z*R(z)) - * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) - * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN with invalid signal. - * - */ - - -#include "math.h" -#include "math_private.h" -#define one qS[0] -#ifdef __STDC__ -static const double -#else -static double -#endif -huge = 1.000e+300, -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ -pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ - /* coefficient for R(x^2) */ -pS[] = {1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ - -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ - 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ - -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ - 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ - 3.47933107596021167570e-05}, /* 0x3F023DE1, 0x0DFDF709 */ -qS[] = {1.0, -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ - 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ - -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ - 7.70381505559019352791e-02}; /* 0x3FB3B8C5, 0xB12E9282 */ - -#ifdef __STDC__ - double __ieee754_asin(double x) -#else - double __ieee754_asin(x) - double x; -#endif -{ - double t,w,p,q,c,r,s,p1,p2,p3,q1,q2,z2,z4,z6; - int32_t hx,ix; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>= 0x3ff00000) { /* |x|>= 1 */ - u_int32_t lx; - GET_LOW_WORD(lx,x); - if(((ix-0x3ff00000)|lx)==0) - /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ - } else if (ix<0x3fe00000) { /* |x|<0.5 */ - if(ix<0x3e400000) { /* if |x| < 2**-27 */ - if(huge+x>one) return x;/* return x with inexact if x!=0*/ - } else { - t = x*x; -#ifdef DO_NOT_USE_THIS - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); -#else - p1 = t*pS[0]; z2=t*t; - p2 = pS[1]+t*pS[2]; z4=z2*z2; - p3 = pS[3]+t*pS[4]; z6=z4*z2; - q1 = one+t*qS[1]; - q2 = qS[2]+t*qS[3]; - p = p1 + z2*p2 + z4*p3 + z6*pS[5]; - q = q1 + z2*q2 + z4*qS[4]; -#endif - w = p/q; - return x+x*w; - } - } - /* 1> |x|>= 0.5 */ - w = one-fabs(x); - t = w*0.5; -#ifdef DO_NOT_USE_THIS - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); -#else - p1 = t*pS[0]; z2=t*t; - p2 = pS[1]+t*pS[2]; z4=z2*z2; - p3 = pS[3]+t*pS[4]; z6=z4*z2; - q1 = one+t*qS[1]; - q2 = qS[2]+t*qS[3]; - p = p1 + z2*p2 + z4*p3 + z6*pS[5]; - q = q1 + z2*q2 + z4*qS[4]; -#endif - s = __ieee754_sqrt(t); - if(ix>=0x3FEF3333) { /* if |x| > 0.975 */ - w = p/q; - t = pio2_hi-(2.0*(s+s*w)-pio2_lo); - } else { - w = s; - SET_LOW_WORD(w,0); - c = (t-w*w)/(s+w); - r = p/q; - p = 2.0*s*r-(pio2_lo-2.0*c); - q = pio4_hi-2.0*w; - t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; -} diff --git a/sysdeps/libm-ieee754/e_asinf.c b/sysdeps/libm-ieee754/e_asinf.c deleted file mode 100644 index 5270f31144..0000000000 --- a/sysdeps/libm-ieee754/e_asinf.c +++ /dev/null @@ -1,93 +0,0 @@ -/* e_asinf.c -- float version of e_asin.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_asinf.c,v 1.5 1995/05/12 04:57:25 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -one = 1.0000000000e+00, /* 0x3F800000 */ -huge = 1.000e+30, -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ -pio4_hi = 7.8539818525e-01, /* 0x3f490fdb */ - /* coefficient for R(x^2) */ -pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ -pS1 = -3.2556581497e-01, /* 0xbea6b090 */ -pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ -pS3 = -4.0055535734e-02, /* 0xbd241146 */ -pS4 = 7.9153501429e-04, /* 0x3a4f7f04 */ -pS5 = 3.4793309169e-05, /* 0x3811ef08 */ -qS1 = -2.4033949375e+00, /* 0xc019d139 */ -qS2 = 2.0209457874e+00, /* 0x4001572d */ -qS3 = -6.8828397989e-01, /* 0xbf303361 */ -qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ - -#ifdef __STDC__ - float __ieee754_asinf(float x) -#else - float __ieee754_asinf(x) - float x; -#endif -{ - float t,w,p,q,c,r,s; - int32_t hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix==0x3f800000) { - /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - } else if(ix> 0x3f800000) { /* |x|>= 1 */ - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ - } else if (ix<0x3f000000) { /* |x|<0.5 */ - if(ix<0x32000000) { /* if |x| < 2**-27 */ - if(huge+x>one) return x;/* return x with inexact if x!=0*/ - } else { - t = x*x; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - w = p/q; - return x+x*w; - } - } - /* 1> |x|>= 0.5 */ - w = one-fabsf(x); - t = w*(float)0.5; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - s = __ieee754_sqrtf(t); - if(ix>=0x3F79999A) { /* if |x| > 0.975 */ - w = p/q; - t = pio2_hi-((float)2.0*(s+s*w)-pio2_lo); - } else { - int32_t iw; - w = s; - GET_FLOAT_WORD(iw,w); - SET_FLOAT_WORD(w,iw&0xfffff000); - c = (t-w*w)/(s+w); - r = p/q; - p = (float)2.0*s*r-(pio2_lo-(float)2.0*c); - q = pio4_hi-(float)2.0*w; - t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; -} diff --git a/sysdeps/libm-ieee754/e_atan2.c b/sysdeps/libm-ieee754/e_atan2.c deleted file mode 100644 index ae7d759a9f..0000000000 --- a/sysdeps/libm-ieee754/e_atan2.c +++ /dev/null @@ -1,130 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_atan2.c,v 1.8 1995/05/10 20:44:51 jtc Exp $"; -#endif - -/* __ieee754_atan2(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) = pi - arctan[y/(-x)] ... if x < 0, - * - * Special cases: - * - * ATAN2((anything), NaN ) is NaN; - * ATAN2(NAN , (anything) ) is NaN; - * ATAN2(+-0, +(anything but NaN)) is +-0 ; - * ATAN2(+-0, -(anything but NaN)) is +-pi ; - * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; - * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; - * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; - * ATAN2(+-INF,+INF ) is +-pi/4 ; - * ATAN2(+-INF,-INF ) is +-3pi/4; - * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -tiny = 1.0e-300, -zero = 0.0, -pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ -pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */ -pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ -pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ - -#ifdef __STDC__ - double __ieee754_atan2(double y, double x) -#else - double __ieee754_atan2(y,x) - double y,x; -#endif -{ - double z; - int32_t k,m,hx,hy,ix,iy; - u_int32_t lx,ly; - - EXTRACT_WORDS(hx,lx,x); - ix = hx&0x7fffffff; - EXTRACT_WORDS(hy,ly,y); - iy = hy&0x7fffffff; - if(((ix|((lx|-lx)>>31))>0x7ff00000)|| - ((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */ - return x+y; - if(((hx-0x3ff00000)|lx)==0) return __atan(y); /* x=1.0 */ - m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ - - /* when y = 0 */ - if((iy|ly)==0) { - switch(m) { - case 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 */ - } - } - /* when x = 0 */ - if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* when x is INF */ - if(ix==0x7ff00000) { - if(iy==0x7ff00000) { - switch(m) { - case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ - case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ - case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ - } - } else { - switch(m) { - case 0: return zero ; /* atan(+...,+INF) */ - case 1: return -zero ; /* atan(-...,+INF) */ - case 2: return pi+tiny ; /* atan(+...,-INF) */ - case 3: return -pi-tiny ; /* atan(-...,-INF) */ - } - } - } - /* when y is INF */ - if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* compute y/x */ - k = (iy-ix)>>20; - if(k > 60) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**60 */ - else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */ - else z=__atan(fabs(y/x)); /* safe to do y/x */ - switch (m) { - case 0: return z ; /* atan(+,+) */ - case 1: { - u_int32_t zh; - GET_HIGH_WORD(zh,z); - SET_HIGH_WORD(z,zh ^ 0x80000000); - } - return z ; /* atan(-,+) */ - case 2: return pi-(z-pi_lo);/* atan(+,-) */ - default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ - } -} diff --git a/sysdeps/libm-ieee754/e_atan2f.c b/sysdeps/libm-ieee754/e_atan2f.c deleted file mode 100644 index 8b3398c0a3..0000000000 --- a/sysdeps/libm-ieee754/e_atan2f.c +++ /dev/null @@ -1,105 +0,0 @@ -/* e_atan2f.c -- float version of e_atan2.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 */ -pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ -pi = 3.1415927410e+00, /* 0x40490fdb */ -pi_lo = -8.7422776573e-07; /* 0xb3bbbd2e */ - -#ifdef __STDC__ - float __ieee754_atan2f(float y, float x) -#else - float __ieee754_atan2f(y,x) - float y,x; -#endif -{ - float z; - int32_t k,m,hx,hy,ix,iy; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - GET_FLOAT_WORD(hy,y); - iy = hy&0x7fffffff; - if((ix>0x7f800000)|| - (iy>0x7f800000)) /* x or y is NaN */ - return x+y; - if(hx==0x3f800000) return __atanf(y); /* x=1.0 */ - m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ - - /* when y = 0 */ - if(iy==0) { - switch(m) { - case 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 */ - } - } - /* when x = 0 */ - if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* when x is INF */ - if(ix==0x7f800000) { - if(iy==0x7f800000) { - switch(m) { - case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ - case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return (float)3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ - case 3: return (float)-3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ - } - } else { - switch(m) { - case 0: return zero ; /* atan(+...,+INF) */ - case 1: return -zero ; /* atan(-...,+INF) */ - case 2: return pi+tiny ; /* atan(+...,-INF) */ - case 3: return -pi-tiny ; /* atan(-...,-INF) */ - } - } - } - /* when y is INF */ - if(iy==0x7f800000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* 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 */ - else z=__atanf(fabsf(y/x)); /* safe to do y/x */ - switch (m) { - case 0: return z ; /* atan(+,+) */ - case 1: { - 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(-,-) */ - } -} diff --git a/sysdeps/libm-ieee754/e_atan2l.c b/sysdeps/libm-ieee754/e_atan2l.c deleted file mode 100644 index aff7a3d976..0000000000 --- a/sysdeps/libm-ieee754/e_atan2l.c +++ /dev/null @@ -1,136 +0,0 @@ -/* e_atan2l.c -- long double version of e_atan2.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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) = pi - arctan[y/(-x)] ... if x < 0, - * - * Special cases: - * - * ATAN2((anything), NaN ) is NaN; - * ATAN2(NAN , (anything) ) is NaN; - * ATAN2(+-0, +(anything but NaN)) is +-0 ; - * ATAN2(+-0, -(anything but NaN)) is +-pi ; - * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; - * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; - * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; - * ATAN2(+-INF,+INF ) is +-pi/4 ; - * ATAN2(+-INF,-INF ) is +-3pi/4; - * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#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 */ -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 z; - int32_t k,m,hx,hy,ix,iy; - u_int32_t sx,sy,lx,ly; - - GET_LDOUBLE_WORDS(sx,hx,lx,x); - ix = sx&0x7fff; - lx |= hx & 0x7fffffff; - GET_LDOUBLE_WORDS(sy,hy,ly,y); - iy = sy&0x7fff; - ly |= hy & 0x7fffffff; - if(((2*ix|((lx|-lx)>>31))>0xfffe)|| - ((2*iy|((ly|-ly)>>31))>0xfffe)) /* x or y is NaN */ - return x+y; - if((sx-0x3fff|lx)==0) return __atanl(y); /* x=1.0 */ - m = ((sy>>15)&1)|((sx>>14)&2); /* 2*sign(x)+sign(y) */ - - /* when y = 0 */ - if((iy|ly)==0) { - switch(m) { - case 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 */ - } - } - /* when x = 0 */ - if((ix|lx)==0) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny; - - /* when x is INF */ - if(ix==0x7fff) { - if(iy==0x7fff) { - switch(m) { - case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ - case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ - case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ - } - } else { - switch(m) { - case 0: return zero ; /* atan(+...,+INF) */ - case 1: return -zero ; /* atan(-...,+INF) */ - case 2: return pi+tiny ; /* atan(+...,-INF) */ - case 3: return -pi-tiny ; /* atan(-...,-INF) */ - } - } - } - /* when y is INF */ - if(iy==0x7fff) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny; - - /* 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 */ - else z=__atanl(fabsl(y/x)); /* safe to do y/x */ - switch (m) { - case 0: return z ; /* atan(+,+) */ - case 1: { - 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(-,-) */ - } -} diff --git a/sysdeps/libm-ieee754/e_atanh.c b/sysdeps/libm-ieee754/e_atanh.c deleted file mode 100644 index fa4fe675c9..0000000000 --- a/sysdeps/libm-ieee754/e_atanh.c +++ /dev/null @@ -1,74 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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. - * - */ - -#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 - -#ifdef __STDC__ - double __ieee754_atanh(double x) -#else - double __ieee754_atanh(x) - double x; -#endif -{ - 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; -} diff --git a/sysdeps/libm-ieee754/e_atanhf.c b/sysdeps/libm-ieee754/e_atanhf.c deleted file mode 100644 index f26a15bbc1..0000000000 --- a/sysdeps/libm-ieee754/e_atanhf.c +++ /dev/null @@ -1,58 +0,0 @@ -/* e_atanhf.c -- float version of e_atanh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -#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 -{ - 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; -} diff --git a/sysdeps/libm-ieee754/e_atanhl.c b/sysdeps/libm-ieee754/e_atanhl.c deleted file mode 100644 index fdcd1e9fe8..0000000000 --- a/sysdeps/libm-ieee754/e_atanhl.c +++ /dev/null @@ -1,79 +0,0 @@ -/* s_atanhl.c -- long double version of s_atan.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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) - * 2.For x>=0.5 - * 1 2x x - * atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) - * 2 1 - x 1 - x - * - * For x<0.5 - * atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x)) - * - * Special cases: - * atanhl(x) is NaN if |x| > 1 with signal; - * atanhl(NaN) is that NaN with no signal; - * atanhl(+-1) is +-INF with signal. - * - */ - -#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 t; - int32_t ix; - u_int32_t se,i0,i1; - GET_LDOUBLE_WORDS(se,i0,i1,x); - ix = se&0x7fff; - if ((ix+((((i0&0x7fffffff)|i1)|(-((i0&0x7fffffff)|i1)))>>31))>0x3fff) - /* |x|>1 */ - return (x-x)/(x-x); - if(ix==0x3fff) - return x/zero; - if(ix<0x3fe3&&(huge+x)>zero) return x; /* x<2**-28 */ - SET_LDOUBLE_EXP(x,ix); - if(ix<0x3ffe) { /* x < 0.5 */ - t = x+x; - t = 0.5*__log1pl(t+t*x/(one-x)); - } else - t = 0.5*__log1pl((x+x)/(one-x)); - if(se<=0x7fff) return t; else return -t; -} diff --git a/sysdeps/libm-ieee754/e_cosh.c b/sysdeps/libm-ieee754/e_cosh.c deleted file mode 100644 index 65106b9989..0000000000 --- a/sysdeps/libm-ieee754/e_cosh.c +++ /dev/null @@ -1,92 +0,0 @@ -/* @(#)e_cosh.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. - * ==================================================== - */ - -#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 - * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- - * 2*exp(x) - * - * exp(x) + 1/exp(x) - * ln2/2 <= x <= 22 : cosh(x) := ------------------- - * 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) - * - * Special cases: - * cosh(x) is |x| if x is +INF, -INF, or NaN. - * only cosh(0)=1 is exact for finite x. - */ - -#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 t,w; - int32_t ix; - u_int32_t lx; - - /* High word of |x|. */ - 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; */ - if (ix < 0x40360000) { - t = __ieee754_exp(fabs(x)); - return half*t+half/t; - } - - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x40862e42) return half*__ieee754_exp(fabs(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - GET_LOW_WORD(lx,x); - if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { - w = __ieee754_exp(half*fabs(x)); - t = half*w; - return t*w; - } - - /* |x| > overflowthresold, cosh(x) overflow */ - return huge*huge; -} diff --git a/sysdeps/libm-ieee754/e_coshf.c b/sysdeps/libm-ieee754/e_coshf.c deleted file mode 100644 index 223fbeea20..0000000000 --- a/sysdeps/libm-ieee754/e_coshf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* e_coshf.c -- float version of e_cosh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 t,w; - int32_t ix; - - 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; */ - if (ix < 0x41b00000) { - t = __ieee754_expf(fabsf(x)); - return half*t+half/t; - } - - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x42b17180) return half*__ieee754_expf(fabsf(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ix<=0x42b2d4fc) { - w = __ieee754_expf(half*fabsf(x)); - t = half*w; - return t*w; - } - - /* |x| > overflowthresold, cosh(x) overflow */ - return huge*huge; -} diff --git a/sysdeps/libm-ieee754/e_coshl.c b/sysdeps/libm-ieee754/e_coshl.c deleted file mode 100644 index 6af846cb2d..0000000000 --- a/sysdeps/libm-ieee754/e_coshl.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#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_coshl(x) - * Method : - * 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 - * 0 <= x <= ln2/2 : coshl(x) := 1 + ------------------- - * 2*exp(x) - * - * exp(x) + 1/exp(x) - * ln2/2 <= x <= 22 : coshl(x) := ------------------- - * 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) - * - * Special cases: - * coshl(x) is |x| if x is +INF, -INF, or NaN. - * only coshl(0)=1 is exact for finite x. - */ - -#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 t,w; - int32_t ex; - u_int32_t mx,lx; - - /* High word of |x|. */ - 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; */ - if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) { - t = __ieee754_expl(fabsl(x)); - return half*t+half/t; - } - - /* |x| in [22, ln(maxdouble)] return half*exp(|x|) */ - if (ex < 0x400c || (ex == 0x400c && mx < 0xb1700000u)) - return half*__ieee754_expl(fabsl(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ex < 0x400d - || (ex == 0x400d && (mx < 0xb170b513u - || (mx == 0xb170b513u && lx < 0xa1dfd60cu)))) - { - w = __ieee754_expl(half*fabsl(x)); - t = half*w; - return t*w; - } - - /* |x| > overflowthresold, cosh(x) overflow */ - return huge*huge; -} diff --git a/sysdeps/libm-ieee754/e_exp.c b/sysdeps/libm-ieee754/e_exp.c deleted file mode 100644 index ee0b22f6ae..0000000000 --- a/sysdeps/libm-ieee754/e_exp.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Double-precision floating point e^x. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Geoffrey Keating - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* How this works: - The basic design here is from - Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical - Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., - 17 (1), March 1991, pp. 26-45. - - The input value, x, is written as - - x = n * ln(2)_0 + t/512 + delta[t] + x + n * ln(2)_1 - - where: - - n is an integer, 1024 >= n >= -1075; - - ln(2)_0 is the first 43 bits of ln(2), and ln(2)_1 is the remainder, so - that |ln(2)_1| < 2^-32; - - t is an integer, 177 >= t >= -177 - - delta is based on a table entry, delta[t] < 2^-28 - - x is whatever is left, |x| < 2^-10 - - Then e^x is approximated as - - e^x = 2^n_1 ( 2^n_0 e^(t/512 + delta[t]) - + ( 2^n_0 e^(t/512 + delta[t]) - * ( p(x + n * ln(2)_1) - - n*ln(2)_1 - - n*ln(2)_1 * p(x + n * ln(2)_1) ) ) ) - - where - - p(x) is a polynomial approximating e(x)-1; - - e^(t/512 + delta[t]) is obtained from a table; - - n_1 + n_0 = n, so that |n_0| < DBL_MIN_EXP-1. - - If it happens that n_1 == 0 (this is the usual case), that multiplication - is omitted. - */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include - -extern const float __exp_deltatable[178]; -extern const double __exp_atable[355] /* __attribute__((mode(DF))) */; - -static const volatile double TWO1023 = 8.988465674311579539e+307; -static const volatile double TWOM1000 = 9.3326361850321887899e-302; - -double -__ieee754_exp (double x) -{ - static const double himark = 709.7827128933840868; - static const double lomark = -745.1332191019412221; - /* Check for usual case. */ - if (isless (x, himark) && isgreater (x, lomark)) - { - static const double THREEp42 = 13194139533312.0; - static const double THREEp51 = 6755399441055744.0; - /* 1/ln(2). */ - static const double M_1_LN2 = 1.442695040888963387; - /* ln(2), part 1 */ - static const double M_LN2_0 = .6931471805598903302; - /* ln(2), part 2 */ - static const double M_LN2_1 = 5.497923018708371155e-14; - - int tval, unsafe, n_i; - double x22, n, t, dely, result; - union ieee754_double ex2_u, scale_u; - fenv_t oldenv; - - feholdexcept (&oldenv); -#ifdef FE_TONEAREST - fesetround (FE_TONEAREST); -#endif - - /* Calculate n. */ - n = x * M_1_LN2 + THREEp51; - n -= THREEp51; - x = x - n*M_LN2_0; - - /* Calculate t/512. */ - t = x + THREEp42; - t -= THREEp42; - x -= t; - - /* Compute tval = t. */ - tval = (int) (t * 512.0); - - if (t >= 0) - x -= __exp_deltatable[tval]; - else - x += __exp_deltatable[-tval]; - - /* Now, the variable x contains x + n*ln(2)_1. */ - dely = n*M_LN2_1; - - /* Compute ex2 = 2^n_0 e^(t/512+delta[t]). */ - ex2_u.d = __exp_atable[tval+177]; - n_i = (int)n; - /* 'unsafe' is 1 iff n_1 != 0. */ - unsafe = abs(n_i) >= -DBL_MIN_EXP - 1; - ex2_u.ieee.exponent += n_i >> unsafe; - - /* Compute scale = 2^n_1. */ - scale_u.d = 1.0; - scale_u.ieee.exponent += n_i - (n_i >> unsafe); - - /* Approximate e^x2 - 1, using a fourth-degree polynomial, - with maximum error in [-2^-10-2^-28,2^-10+2^-28] - less than 4.9e-19. */ - x22 = (((0.04166666898464281565 - * x + 0.1666666766008501610) - * x + 0.499999999999990008) - * x + 0.9999999999999976685) * x; - /* Allow for impact of dely. */ - x22 -= dely + dely*x22; - - /* Return result. */ - fesetenv (&oldenv); - - result = x22 * ex2_u.d + ex2_u.d; - if (!unsafe) - return result; - else - return result * scale_u.d; - } - /* Exceptional cases: */ - else if (isless (x, himark)) - { - if (__isinf (x)) - /* e^-inf == 0, with no error. */ - return 0; - else - /* Underflow */ - return TWOM1000 * TWOM1000; - } - else - /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ - return TWO1023*x; -} diff --git a/sysdeps/libm-ieee754/e_exp10.c b/sysdeps/libm-ieee754/e_exp10.c deleted file mode 100644 index 55d676ec09..0000000000 --- a/sysdeps/libm-ieee754/e_exp10.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include "math_private.h" - - -double -__ieee754_exp10 (double arg) -{ - /* This is a very stupid and inprecise implementation. It'll get - replaced sometime (soon?). */ - return __ieee754_exp (M_LN10 * arg); -} diff --git a/sysdeps/libm-ieee754/e_exp10f.c b/sysdeps/libm-ieee754/e_exp10f.c deleted file mode 100644 index d6cc9dc03d..0000000000 --- a/sysdeps/libm-ieee754/e_exp10f.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include "math_private.h" - - -float -__ieee754_exp10f (float arg) -{ - /* This is a very stupid and inprecise implementation. It'll get - replaced sometime (soon?). */ - return __ieee754_expf (M_LN10 * arg); -} diff --git a/sysdeps/libm-ieee754/e_exp10l.c b/sysdeps/libm-ieee754/e_exp10l.c deleted file mode 100644 index cf8658b747..0000000000 --- a/sysdeps/libm-ieee754/e_exp10l.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include "math_private.h" - - -long double -__ieee754_exp10l (long double arg) -{ - /* This is a very stupid and inprecise implementation. It'll get - replaced sometime (soon?). */ - return __ieee754_expl (M_LN10l * arg); -} diff --git a/sysdeps/libm-ieee754/e_expf.c b/sysdeps/libm-ieee754/e_expf.c deleted file mode 100644 index e8a9c9d874..0000000000 --- a/sysdeps/libm-ieee754/e_expf.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Single-precision floating point e^x. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Geoffrey Keating - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* How this works: - - The input value, x, is written as - - x = n * ln(2) + t/512 + delta[t] + x; - - where: - - n is an integer, 127 >= n >= -150; - - t is an integer, 177 >= t >= -177 - - delta is based on a table entry, delta[t] < 2^-28 - - x is whatever is left, |x| < 2^-10 - - Then e^x is approximated as - - e^x = 2^n ( e^(t/512 + delta[t]) - + ( e^(t/512 + delta[t]) - * ( p(x + delta[t] + n * ln(2)) - delta ) ) ) - - where - - p(x) is a polynomial approximating e(x)-1; - - e^(t/512 + delta[t]) is obtained from a table. - - The table used is the same one as for the double precision version; - since we have the table, we might as well use it. - - It turns out to be faster to do calculations in double precision than - to perform an 'accurate table method' expf, because of the range reduction - overhead (compare exp2f). - */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include - -extern const float __exp_deltatable[178]; -extern const double __exp_atable[355] /* __attribute__((mode(DF))) */; - -static const volatile float TWOM100 = 7.88860905e-31; -static const volatile float TWO127 = 1.7014118346e+38; - -float -__ieee754_expf (float x) -{ - static const float himark = 88.72283935546875; - static const float lomark = -103.972084045410; - /* Check for usual case. */ - if (isless (x, himark) && isgreater (x, lomark)) - { - static const float THREEp42 = 13194139533312.0; - static const float THREEp22 = 12582912.0; - /* 1/ln(2). */ -#undef M_1_LN2 - static const float M_1_LN2 = 1.44269502163f; - /* ln(2) */ -#undef M_LN2 - static const double M_LN2 = .6931471805599452862; - - int tval; - double x22, t, result, dx; - float n, delta; - union ieee754_double ex2_u; - fenv_t oldenv; - - feholdexcept (&oldenv); -#ifdef FE_TONEAREST - fesetround (FE_TONEAREST); -#endif - - /* Calculate n. */ - n = x * M_1_LN2 + THREEp22; - n -= THREEp22; - dx = x - n*M_LN2; - - /* Calculate t/512. */ - t = dx + THREEp42; - t -= THREEp42; - dx -= t; - - /* Compute tval = t. */ - tval = (int) (t * 512.0); - - if (t >= 0) - delta = - __exp_deltatable[tval]; - else - delta = __exp_deltatable[-tval]; - - /* Compute ex2 = 2^n e^(t/512+delta[t]). */ - ex2_u.d = __exp_atable[tval+177]; - ex2_u.ieee.exponent += (int) n; - - /* Approximate e^(dx+delta) - 1, using a second-degree polynomial, - with maximum error in [-2^-10-2^-28,2^-10+2^-28] - less than 5e-11. */ - x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; - - /* Return result. */ - fesetenv (&oldenv); - - result = x22 * ex2_u.d + ex2_u.d; - return (float) result; - } - /* Exceptional cases: */ - else if (isless (x, himark)) - { - if (__isinff (x)) - /* e^-inf == 0, with no error. */ - return 0; - else - /* Underflow */ - return TWOM100 * TWOM100; - } - else - /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ - return TWO127*x; -} diff --git a/sysdeps/libm-ieee754/e_fmod.c b/sysdeps/libm-ieee754/e_fmod.c deleted file mode 100644 index 2ce613574a..0000000000 --- a/sysdeps/libm-ieee754/e_fmod.c +++ /dev/null @@ -1,140 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#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 - */ - -#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 -{ - int32_t n,hx,hy,hz,ix,iy,sx,i; - u_int32_t lx,ly,lz; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - sx = hx&0x80000000; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ - - /* purge off exception values */ - if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ - ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */ - return (x*y)/(x*y); - if(hx<=hy) { - if((hx>31]; /* |x|=|y| return x*0*/ - } - - /* determine ix = ilogb(x) */ - if(hx<0x00100000) { /* subnormal x */ - if(hx==0) { - for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; - } else { - for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; - } - } else ix = (hx>>20)-1023; - - /* determine iy = ilogb(y) */ - if(hy<0x00100000) { /* subnormal y */ - if(hy==0) { - for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; - } else { - for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; - } - } else iy = (hy>>20)-1023; - - /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) - hx = 0x00100000|(0x000fffff&hx); - else { /* subnormal x, shift x to normal */ - n = -1022-ix; - if(n<=31) { - hx = (hx<>(32-n)); - lx <<= n; - } else { - hx = lx<<(n-32); - lx = 0; - } - } - if(iy >= -1022) - hy = 0x00100000|(0x000fffff&hy); - else { /* subnormal y, shift y to normal */ - n = -1022-iy; - if(n<=31) { - hy = (hy<>(32-n)); - ly <<= n; - } else { - hy = ly<<(n-32); - ly = 0; - } - } - - /* fix point fmod */ - n = ix - iy; - while(n--) { - hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} - else { - if((hz|lz)==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; - hx = hz+hz+(lz>>31); lx = lz+lz; - } - } - hz=hx-hy;lz=lx-ly; if(lx=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]; - while(hx<0x00100000) { /* normalize x */ - hx = hx+hx+(lx>>31); lx = lx+lx; - iy -= 1; - } - if(iy>= -1022) { /* normalize output */ - hx = ((hx-0x00100000)|((iy+1023)<<20)); - INSERT_WORDS(x,hx|sx,lx); - } else { /* subnormal output */ - n = -1022 - iy; - if(n<=20) { - lx = (lx>>n)|((u_int32_t)hx<<(32-n)); - hx >>= n; - } else if (n<=31) { - lx = (hx<<(32-n))|(lx>>n); hx = sx; - } else { - lx = hx>>(n-32); hx = sx; - } - INSERT_WORDS(x,hx|sx,lx); - x *= one; /* create necessary signal */ - } - return x; /* exact output */ -} diff --git a/sysdeps/libm-ieee754/e_fmodf.c b/sysdeps/libm-ieee754/e_fmodf.c deleted file mode 100644 index 47b312392c..0000000000 --- a/sysdeps/libm-ieee754/e_fmodf.c +++ /dev/null @@ -1,113 +0,0 @@ -/* e_fmodf.c -- float version of e_fmod.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - */ - -#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 -{ - int32_t n,hx,hy,hz,ix,iy,sx,i; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - sx = hx&0x80000000; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ - - /* purge off exception values */ - if(hy==0||(hx>=0x7f800000)|| /* y=0,or x not finite */ - (hy>0x7f800000)) /* or y is NaN */ - return (x*y)/(x*y); - if(hx>31]; /* |x|=|y| return x*0*/ - - /* determine ix = ilogb(x) */ - if(hx<0x00800000) { /* subnormal x */ - for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1; - } else ix = (hx>>23)-127; - - /* determine iy = ilogb(y) */ - if(hy<0x00800000) { /* subnormal y */ - for (iy = -126,i=(hy<<8); i>=0; i<<=1) iy -=1; - } else iy = (hy>>23)-127; - - /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -126) - hx = 0x00800000|(0x007fffff&hx); - else { /* subnormal x, shift x to normal */ - n = -126-ix; - hx = hx<= -126) - hy = 0x00800000|(0x007fffff&hy); - else { /* subnormal y, shift y to normal */ - n = -126-iy; - hy = hy<>31]; - 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]; - while(hx<0x00800000) { /* normalize x */ - hx = hx+hx; - iy -= 1; - } - if(iy>= -126) { /* normalize output */ - hx = ((hx-0x00800000)|((iy+127)<<23)); - SET_FLOAT_WORD(x,hx|sx); - } else { /* subnormal output */ - n = -126 - iy; - hx >>= n; - SET_FLOAT_WORD(x,hx|sx); - x *= one; /* create necessary signal */ - } - return x; /* exact output */ -} diff --git a/sysdeps/libm-ieee754/e_gamma_r.c b/sysdeps/libm-ieee754/e_gamma_r.c deleted file mode 100644 index bd802c24f1..0000000000 --- a/sysdeps/libm-ieee754/e_gamma_r.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -double -__ieee754_gamma_r (double x, int *signgamp) -{ - /* We don't have a real gamma implementation now. We'll use lgamma - and the exp function. But due to the required boundary - conditions we must check some values separately. */ - int32_t hx; - u_int32_t lx; - - EXTRACT_WORDS (hx, lx, x); - - if (((hx & 0x7fffffff) | lx) == 0) - { - /* Return value for x == 0 is NaN with invalid exception. */ - *signgamp = 0; - return x / x; - } - if (hx < 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); - } - - /* XXX FIXME. */ - return __ieee754_exp (__ieee754_lgamma_r (x, signgamp)); -} diff --git a/sysdeps/libm-ieee754/e_gammaf_r.c b/sysdeps/libm-ieee754/e_gammaf_r.c deleted file mode 100644 index 926905e7cd..0000000000 --- a/sysdeps/libm-ieee754/e_gammaf_r.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -float -__ieee754_gammaf_r (float x, int *signgamp) -{ - /* We don't have a real gamma implementation now. We'll use lgamma - and the exp function. But due to the required boundary - conditions we must check some values separately. */ - int32_t hx; - - GET_FLOAT_WORD (hx, x); - - if ((hx & 0x7fffffff) == 0) - { - /* Return value for x == 0 is NaN with invalid exception. */ - *signgamp = 0; - return x / x; - } - if (hx < 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); - } - - /* XXX FIXME. */ - return __ieee754_expf (__ieee754_lgammaf_r (x, signgamp)); -} diff --git a/sysdeps/libm-ieee754/e_gammal_r.c b/sysdeps/libm-ieee754/e_gammal_r.c deleted file mode 100644 index 104992450b..0000000000 --- a/sysdeps/libm-ieee754/e_gammal_r.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -long double -__ieee754_gammal_r (long double x, int *signgamp) -{ - /* We don't have a real gamma implementation now. We'll use lgamma - and the exp function. But due to the required boundary - conditions we must check some values separately. */ - u_int32_t es, hx, lx; - - GET_LDOUBLE_WORDS (es, hx, lx, x); - - if (((es & 0x7fff) | hx | lx) == 0) - { - /* Return value for x == 0 is NaN with invalid exception. */ - *signgamp = 0; - return x / x; - } - if ((hx & 0x8000) != 0 && (hx & 0x7fff) != 0x7fff && __rintl (x) == x) - { - /* Return value for integer x < 0 is NaN with invalid exception. */ - *signgamp = 0; - return (x - x) / (x - x); - } - - /* XXX FIXME. */ - return __ieee754_expl (__ieee754_lgammal_r (x, signgamp)); -} diff --git a/sysdeps/libm-ieee754/e_hypot.c b/sysdeps/libm-ieee754/e_hypot.c deleted file mode 100644 index 76a77ec33a..0000000000 --- a/sysdeps/libm-ieee754/e_hypot.c +++ /dev/null @@ -1,128 +0,0 @@ -/* @(#)e_hypot.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. - * ==================================================== - */ - -#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 : - * If (assume round-to-nearest) z=x*x+y*y - * has error less than sqrt(2)/2 ulp, than - * sqrt(z) has error less than 1 ulp (exercise). - * - * So, compute sqrt(x*x+y*y) with some care as - * follows to get the error below 1 ulp: - * - * Assume x>y>0; - * (if possible, set rounding to round-to-nearest) - * 1. if x > 2y use - * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y - * where x1 = x with lower 32 bits cleared, x2 = x-x1; else - * 2. if x <= 2y use - * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) - * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, - * y1= y with lower 32 bits chopped, y2 = y-y1. - * - * NOTE: scaling may be necessary if some argument is too - * large or too tiny - * - * Special cases: - * hypot(x,y) is INF if x or y is +INF or -INF; else - * 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) - */ - -#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 a,b,t1,t2,y1,y2,w; - int32_t j,k,ha,hb; - - GET_HIGH_WORD(ha,x); - ha &= 0x7fffffff; - GET_HIGH_WORD(hb,y); - hb &= 0x7fffffff; - if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} - SET_HIGH_WORD(a,ha); /* a <- |a| */ - 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(ha >= 0x7ff00000) { /* Inf or NaN */ - u_int32_t low; - w = a+b; /* for sNaN */ - GET_LOW_WORD(low,a); - if(((ha&0xfffff)|low)==0) w = a; - GET_LOW_WORD(low,b); - if(((hb^0x7ff00000)|low)==0) w = b; - return w; - } - /* scale a and b by 2**-600 */ - ha -= 0x25800000; hb -= 0x25800000; k += 600; - SET_HIGH_WORD(a,ha); - SET_HIGH_WORD(b,hb); - } - if(hb < 0x20b00000) { /* b < 2**-500 */ - if(hb <= 0x000fffff) { /* subnormal b or 0 */ - u_int32_t low; - GET_LOW_WORD(low,b); - if((hb|low)==0) return a; - t1=0; - SET_HIGH_WORD(t1,0x7fd00000); /* t1=2^1022 */ - b *= t1; - a *= t1; - k -= 1022; - } else { /* scale a and b by 2^600 */ - ha += 0x25800000; /* a *= 2^600 */ - hb += 0x25800000; /* b *= 2^600 */ - k -= 600; - SET_HIGH_WORD(a,ha); - SET_HIGH_WORD(b,hb); - } - } - /* medium size a and b */ - w = a-b; - if (w>b) { - t1 = 0; - SET_HIGH_WORD(t1,ha); - t2 = a-t1; - w = __ieee754_sqrt(t1*t1-(b*(-b)-t2*(a+t1))); - } else { - a = a+a; - y1 = 0; - SET_HIGH_WORD(y1,hb); - y2 = b - y1; - t1 = 0; - SET_HIGH_WORD(t1,ha+0x00100000); - t2 = a - t1; - w = __ieee754_sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); - } - if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); - return t1*w; - } else return w; -} diff --git a/sysdeps/libm-ieee754/e_hypotf.c b/sysdeps/libm-ieee754/e_hypotf.c deleted file mode 100644 index d6b1520cb8..0000000000 --- a/sysdeps/libm-ieee754/e_hypotf.c +++ /dev/null @@ -1,87 +0,0 @@ -/* e_hypotf.c -- float version of e_hypot.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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_hypot(x,y) - float x, y; -#endif -{ - float a,b,t1,t2,y1,y2,w; - int32_t j,k,ha,hb; - - GET_FLOAT_WORD(ha,x); - ha &= 0x7fffffff; - GET_FLOAT_WORD(hb,y); - hb &= 0x7fffffff; - if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} - SET_FLOAT_WORD(a,ha); /* a <- |a| */ - 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(ha >= 0x7f800000) { /* Inf or NaN */ - w = a+b; /* for sNaN */ - if(ha == 0x7f800000) w = a; - if(hb == 0x7f800000) w = b; - return w; - } - /* scale a and b by 2**-60 */ - ha -= 0x5d800000; hb -= 0x5d800000; k += 60; - SET_FLOAT_WORD(a,ha); - SET_FLOAT_WORD(b,hb); - } - if(hb < 0x26800000) { /* b < 2**-50 */ - if(hb <= 0x007fffff) { /* subnormal b or 0 */ - if(hb==0) return a; - SET_FLOAT_WORD(t1,0x3f000000); /* t1=2^126 */ - b *= t1; - a *= t1; - k -= 126; - } else { /* scale a and b by 2^60 */ - ha += 0x5d800000; /* a *= 2^60 */ - hb += 0x5d800000; /* b *= 2^60 */ - k -= 60; - SET_FLOAT_WORD(a,ha); - SET_FLOAT_WORD(b,hb); - } - } - /* medium size a and b */ - w = a-b; - if (w>b) { - SET_FLOAT_WORD(t1,ha&0xfffff000); - t2 = a-t1; - w = __ieee754_sqrtf(t1*t1-(b*(-b)-t2*(a+t1))); - } else { - a = a+a; - SET_FLOAT_WORD(y1,hb&0xfffff000); - y2 = b - y1; - SET_FLOAT_WORD(t1,ha+0x00800000); - t2 = a - t1; - w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); - } - if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); - return t1*w; - } else return w; -} diff --git a/sysdeps/libm-ieee754/e_hypotl.c b/sysdeps/libm-ieee754/e_hypotl.c deleted file mode 100644 index 1a40c556dc..0000000000 --- a/sysdeps/libm-ieee754/e_hypotl.c +++ /dev/null @@ -1,133 +0,0 @@ -/* e_hypotl.c -- long double version of e_hypot.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* __ieee754_hypotl(x,y) - * - * Method : - * If (assume round-to-nearest) z=x*x+y*y - * has error less than sqrt(2)/2 ulp, than - * sqrt(z) has error less than 1 ulp (exercise). - * - * So, compute sqrt(x*x+y*y) with some care as - * follows to get the error below 1 ulp: - * - * Assume x>y>0; - * (if possible, set rounding to round-to-nearest) - * 1. if x > 2y use - * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y - * where x1 = x with lower 32 bits cleared, x2 = x-x1; else - * 2. if x <= 2y use - * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) - * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, - * y1= y with lower 32 bits chopped, y2 = y-y1. - * - * NOTE: scaling may be necessary if some argument is too - * large or too tiny - * - * Special cases: - * hypot(x,y) is INF if x or y is +INF or -INF; else - * 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) - */ - -#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 a,b,t1,t2,y1,y2,w; - u_int32_t j,k,ea,eb; - - GET_LDOUBLE_EXP(ea,x); - ea &= 0x7fff; - GET_LDOUBLE_EXP(eb,y); - eb &= 0x7fff; - if(eb > ea) {a=y;b=x;j=ea; ea=eb;eb=j;} else {a=x;b=y;} - SET_LDOUBLE_EXP(a,ea); /* a <- |a| */ - 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(ea == 0x7fff) { /* Inf or NaN */ - u_int32_t exp,high,low; - w = a+b; /* for sNaN */ - GET_LDOUBLE_WORDS(exp,high,low,a); - if(((high&0x7fffffff)|low)==0) w = a; - GET_LDOUBLE_WORDS(exp,high,low,b); - if(((eb^0x7fff)|(high&0x7fffffff)|low)==0) w = b; - return w; - } - /* scale a and b by 2**-9600 */ - ea -= 0x2580; eb -= 0x2580; k += 9600; - SET_LDOUBLE_EXP(a,ea); - SET_LDOUBLE_EXP(b,eb); - } - if(eb < 0x20bf) { /* b < 2**-8000 */ - if(eb == 0) { /* subnormal b or 0 */ - 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 */ - b *= t1; - a *= t1; - k -= 16382; - } else { /* scale a and b by 2^9600 */ - ea += 0x2580; /* a *= 2^9600 */ - eb += 0x2580; /* b *= 2^9600 */ - k -= 9600; - SET_LDOUBLE_EXP(a,ea); - SET_LDOUBLE_EXP(b,eb); - } - } - /* medium size a and b */ - w = a-b; - if (w>b) { - u_int32_t high; - GET_LDOUBLE_MSW(high,a); - SET_LDOUBLE_WORDS(t1,ea,high,0); - t2 = a-t1; - w = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1))); - } else { - u_int32_t high; - GET_LDOUBLE_MSW(high,b); - a = a+a; - SET_LDOUBLE_WORDS(y1,eb,high,0); - y2 = b - y1; - GET_LDOUBLE_MSW(high,a); - SET_LDOUBLE_WORDS(t1,ea+1,high,0); - t2 = a - t1; - w = __ieee754_sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b))); - } - if(k!=0) { - u_int32_t exp; - t1 = 1.0; - GET_LDOUBLE_EXP(exp,t1); - SET_LDOUBLE_EXP(t1,exp+k); - return t1*w; - } else return w; -} diff --git a/sysdeps/libm-ieee754/e_j0.c b/sysdeps/libm-ieee754/e_j0.c deleted file mode 100644 index 55e8294bb9..0000000000 --- a/sysdeps/libm-ieee754/e_j0.c +++ /dev/null @@ -1,531 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26, - 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): - * 1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ... - * 2. Reduce x to |x| since j0(x)=j0(-x), and - * for x in (0,2) - * 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) - * 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 - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) - * - * 3 Special cases - * j0(nan)= nan - * j0(0) = 1 - * j0(inf) = 0 - * - * Method -- y0(x): - * 1. For x<2. - * Since - * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) - * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. - * We use the following function to approximate y0, - * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 - * where - * U(z) = u00 + u01*z + ... + u06*z^6 - * V(z) = 1 + v01*z + ... + v04*z^4 - * with absolute approximation error bounded by 2**-72. - * 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) - * by the method mentioned above. - * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. - */ - -#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, -one = 1.0, -invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ -tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - /* 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 */ - -4.61832688532103189199e-09}, /* 0xBE33D5E7, 0x73D63FCE */ -S[] = {0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */ - 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */ - 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 z, s,c,ss,cc,r,u,v,r1,r2,s1,s2,z2,z4; - int32_t hx,ix; - - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return one/(x*x); - x = fabs(x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sin(x); - c = __cos(x); - ss = s-c; - cc = s+c; - if(ix<0x7fe00000) { /* make sure x+x not overflow */ - z = -__cos(x+x); - if ((s*c)0x48000000) z = (invsqrtpi*cc)/__sqrt(x); - else { - u = pzero(x); v = qzero(x); - z = invsqrtpi*(u*cc-v*ss)/__sqrt(x); - } - return z; - } - 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; - } - } - z = x*x; -#ifdef DO_NOT_USE_THIS - r = z*(R02+z*(R03+z*(R04+z*R05))); - s = one+z*(S01+z*(S02+z*(S03+z*S04))); -#else - r1 = z*R[2]; z2=z*z; - r2 = R[3]+z*R[4]; z4=z2*z2; - r = r1 + z2*r2 + z4*R[5]; - s1 = one+z*S[1]; - s2 = S[2]+z*S[3]; - s = s1 + z2*s2 + z4*S[4]; -#endif - if(ix < 0x3FF00000) { /* |x| < 1.00 */ - return one + z*(-0.25+(r/s)); - } else { - u = 0.5*x; - return((one+u)*(one-u)+z*(r/s)); - } -} - -#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 */ - 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */ - -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */ - 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */ - -3.98205194132103398453e-11}, /* 0xBDC5E43D, 0x693FB3C8 */ -V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ - 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */ - 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 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; - /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if(ix>=0x7ff00000) return one/(x+x*x); - if((ix|lx)==0) return -one/zero; - if(hx<0) return zero/zero; - 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. - */ - s = __sin(x); - c = __cos(x); - 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)0x48000000) z = (invsqrtpi*ss)/__sqrt(x); - else { - u = pzero(x); v = qzero(x); - z = invsqrtpi*(u*ss+v*cc)/__sqrt(x); - } - return z; - } - if(ix<=0x3e400000) { /* x < 2**-27 */ - return(U[0] + tpi*__ieee754_log(x)); - } - z = x*x; -#ifdef DO_NOT_USE_THIS - u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); - v = one+z*(v01+z*(v02+z*(v03+z*v04))); -#else - u1 = U[0]+z*U[1]; z2=z*z; - u2 = U[2]+z*U[3]; z4=z2*z2; - u3 = U[4]+z*U[5]; z6=z4*z2; - u = u1 + z2*u2 + z4*u3 + z6*U[6]; - v1 = one+z*V[0]; - v2 = V[1]+z*V[2]; - v = v1 + z2*v2 + z4*V[3]; -#endif - return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x))); -} - -/* 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) - * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*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 */ - -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */ - -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 */ - 1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */ - 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 */ - -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */ - -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 */ - 9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */ - 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 */ - -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */ - -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 */ - 1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */ - 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 */ - -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */ - -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 */ - 1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */ - 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ -}; - -#ifdef __STDC__ - static double pzero(double x) -#else - static double pzero(x) - double x; -#endif -{ -#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); - 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); -#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])))); -#else - r1 = p[0]+z*p[1]; z2=z*z; - r2 = p[2]+z*p[3]; z4=z2*z2; - r3 = p[4]+z*p[5]; - r = r1 + z2*r2 + z4*r3; - s1 = one+z*q[0]; - s2 = q[1]+z*q[2]; - s3 = q[3]+z*q[4]; - s = s1 + z2*s2 + z4*s3; -#endif - return one+ r/s; -} - - -/* 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)) - * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 - * 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 */ - 5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */ - 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 */ - 8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */ - 8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */ - -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 */ - 1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */ - 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 */ - 5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */ - 3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */ - -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 */ - 4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */ - 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 */ - 6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */ - 2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */ - -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 */ - 1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */ - 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 */ - 8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */ - 2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */ - -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ -}; - -#ifdef __STDC__ - static double qzero(double x) -#else - static double qzero(x) - double x; -#endif -{ -#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); - ix &= 0x7fffffff; - if(ix>=0x40200000) {p = qR8; q= qS8;} - else if(ix>=0x40122E8B){p = qR5; q= qS5;} - else if(ix>=0x4006DB6D){p = qR3; q= qS3;} - else if(ix>=0x40000000){p = qR2; q= qS2;} - 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]+z*q[5]))))); -#else - r1 = p[0]+z*p[1]; z2=z*z; - r2 = p[2]+z*p[3]; z4=z2*z2; - r3 = p[4]+z*p[5]; z6=z4*z2; - r= r1 + z2*r2 + z4*r3; - s1 = one+z*q[0]; - s2 = q[1]+z*q[2]; - s3 = q[3]+z*q[4]; - s = s1 + z2*s2 + z4*s3 +z6*q[5]; -#endif - return (-.125 + r/s)/x; -} diff --git a/sysdeps/libm-ieee754/e_j0f.c b/sysdeps/libm-ieee754/e_j0f.c deleted file mode 100644 index eed171cc90..0000000000 --- a/sysdeps/libm-ieee754/e_j0f.c +++ /dev/null @@ -1,444 +0,0 @@ -/* e_j0f.c -- float version of e_j0.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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, -one = 1.0, -invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ -tpi = 6.3661974669e-01, /* 0x3f22f983 */ - /* R0/S0 on [0, 2.00] */ -R02 = 1.5625000000e-02, /* 0x3c800000 */ -R03 = -1.8997929874e-04, /* 0xb947352e */ -R04 = 1.8295404516e-06, /* 0x35f58e88 */ -R05 = -4.6183270541e-09, /* 0xb19eaf3c */ -S01 = 1.5619102865e-02, /* 0x3c7fe744 */ -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 z, s,c,ss,cc,r,u,v; - int32_t hx,ix; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7f800000) return one/(x*x); - x = fabsf(x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sinf(x); - c = __cosf(x); - ss = s-c; - cc = s+c; - if(ix<0x7f000000) { /* make sure x+x not overflow */ - z = -__cosf(x+x); - if ((s*c)0x48000000) z = (invsqrtpi*cc)/__sqrtf(x); - else { - u = pzerof(x); v = qzerof(x); - z = invsqrtpi*(u*cc-v*ss)/__sqrtf(x); - } - return z; - } - 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; - } - } - z = x*x; - r = z*(R02+z*(R03+z*(R04+z*R05))); - s = one+z*(S01+z*(S02+z*(S03+z*S04))); - if(ix < 0x3F800000) { /* |x| < 1.00 */ - return one + z*((float)-0.25+(r/s)); - } else { - u = (float)0.5*x; - return((one+u)*(one-u)+z*(r/s)); - } -} - -#ifdef __STDC__ -static const float -#else -static float -#endif -u00 = -7.3804296553e-02, /* 0xbd9726b5 */ -u01 = 1.7666645348e-01, /* 0x3e34e80d */ -u02 = -1.3818567619e-02, /* 0xbc626746 */ -u03 = 3.4745343146e-04, /* 0x39b62a69 */ -u04 = -3.8140706238e-06, /* 0xb67ff53c */ -u05 = 1.9559013964e-08, /* 0x32a802ba */ -u06 = -3.9820518410e-11, /* 0xae2f21eb */ -v01 = 1.2730483897e-02, /* 0x3c509385 */ -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 z, s,c,ss,cc,u,v; - int32_t hx,ix; - - GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; - /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if(ix>=0x7f800000) return one/(x+x*x); - if(ix==0) return -one/zero; - if(hx<0) return zero/zero; - 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. - */ - s = __sinf(x); - c = __cosf(x); - 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)0x48000000) z = (invsqrtpi*ss)/__sqrtf(x); - else { - u = pzerof(x); v = qzerof(x); - z = invsqrtpi*(u*ss+v*cc)/__sqrtf(x); - } - return z; - } - if(ix<=0x32000000) { /* x < 2**-27 */ - return(u00 + tpi*__ieee754_logf(x)); - } - z = x*x; - u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); - v = one+z*(v01+z*(v02+z*(v03+z*v04))); - return(u/v + tpi*(__ieee754_j0f(x)*__ieee754_logf(x))); -} - -/* 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) - * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*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 */ - -2.5706311035e+02, /* 0xc3808814 */ - -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 */ - -6.7674766541e+01, /* 0xc287597b */ - -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 */ - 9.6254453125e+03, /* 0x461665c8 */ - 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 */ - -2.1965976715e+01, /* 0xc1afba52 */ - -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 */ - 1.1279968262e+03, /* 0x448cffe6 */ - 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 */ - -7.6356959343e+00, /* 0xc0f4579f */ - -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 */ - 1.5387539673e+02, /* 0x4319e01a */ - 1.4657617569e+01, /* 0x416a859a */ -}; - -#ifdef __STDC__ - static float pzerof(float x) -#else - static float pzerof(x) - float x; -#endif -{ -#ifdef __STDC__ - const float *p,*q; -#else - float *p,*q; -#endif - float z,r,s; - 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; -} - - -/* 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)) - * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 - * 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 */ - 5.5767340088e+02, /* 0x440b6b19 */ - 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 */ - 8.0330925000e+05, /* 0x49441ed4 */ - 8.4050156250e+05, /* 0x494d3359 */ - -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 */ - 1.3511157227e+02, /* 0x43071c90 */ - 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 */ - 5.6751113281e+04, /* 0x475daf1d */ - 3.5976753906e+04, /* 0x470c88c1 */ - -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 */ - 4.2621845245e+01, /* 0x422a7cc5 */ - 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 */ - 6.4604252930e+03, /* 0x45c9e367 */ - 2.5163337402e+03, /* 0x451d4557 */ - -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 */ - 1.4495602608e+01, /* 0x4167edfd */ - 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 */ - 8.8293585205e+02, /* 0x445cbbe5 */ - 2.1266638184e+02, /* 0x4354aa98 */ - -5.3109550476e+00, /* 0xc0a9f358 */ -}; - -#ifdef __STDC__ - static float qzerof(float x) -#else - static float qzerof(x) - float x; -#endif -{ -#ifdef __STDC__ - const float *p,*q; -#else - float *p,*q; -#endif - float s,r,z; - int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; - if(ix>=0x41000000) {p = qR8; q= qS8;} - else if(ix>=0x40f71c58){p = qR5; q= qS5;} - else if(ix>=0x4036db68){p = qR3; q= qS3;} - else if(ix>=0x40000000){p = qR2; q= qS2;} - 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]+z*q[5]))))); - return (-(float).125 + r/s)/x; -} diff --git a/sysdeps/libm-ieee754/e_j1.c b/sysdeps/libm-ieee754/e_j1.c deleted file mode 100644 index daf025fdb7..0000000000 --- a/sysdeps/libm-ieee754/e_j1.c +++ /dev/null @@ -1,532 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26, - 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): - * 1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ... - * 2. Reduce x to |x| since j1(x)=-j1(-x), and - * for x in (0,2) - * 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) - * 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 - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) - * - * 3 Special cases - * j1(nan)= nan - * j1(0) = 0 - * j1(inf) = 0 - * - * Method -- y1(x): - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN - * 2. For x<2. - * Since - * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) - * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. - * We use the following function to approximate y1, - * y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2 - * where for x in [0,2] (abs err less than 2**-65.89) - * U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4 - * V(z) = 1 + v0[0]*z + ... + v0[4]*z^5 - * 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) - * 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 */ -tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - /* R0/S0 on [0,2] */ -R[] = {-6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */ - 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */ - -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */ - 4.96727999609584448412e-08}, /* 0x3E6AAAFA, 0x46CA0BD9 */ -S[] = {0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */ - 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */ - 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */ - 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 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; - y = fabs(x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sin(y); - c = __cos(y); - ss = -s-c; - cc = s-c; - if(ix<0x7fe00000) { /* make sure y+y not overflow */ - z = __cos(y+y); - if ((s*c)>zero) cc = z/ss; - else ss = z/cc; - } - /* - * 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>0x48000000) z = (invsqrtpi*cc)/__sqrt(y); - else { - u = pone(y); v = qone(y); - z = invsqrtpi*(u*cc-v*ss)/__sqrt(y); - } - if(hx<0) return -z; - else return z; - } - if(ix<0x3e400000) { /* |x|<2**-27 */ - if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */ - } - z = x*x; -#ifdef DO_NOT_USE_THIS - r = z*(r00+z*(r01+z*(r02+z*r03))); - s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); - r *= x; -#else - 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; - s1 = one+z*S[1]; - s2 = S[2]+z*S[3]; - s3 = S[4]+z*S[5]; - s = s1 + z2*s2 + z4*s3; -#endif - return(x*0.5+r/s); -} - -#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 */ - 6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */ - 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ -}; - -#ifdef __STDC__ - double __ieee754_y1(double x) -#else - double __ieee754_y1(x) - double x; -#endif -{ - 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; - /* 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 -one/zero; - if(hx<0) return zero/zero; - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sin(x); - c = __cos(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)/__sqrt(x); - else { - u = pone(x); v = qone(x); - z = invsqrtpi*(u*ss+v*cc)/__sqrt(x); - } - return z; - } - if(ix<=0x3c900000) { /* 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])))); -#else - u1 = U0[0]+z*U0[1];z2=z*z; - u2 = U0[2]+z*U0[3];z4=z2*z2; - u = u1 + z2*u2 + z4*U0[4]; - v1 = one+z*V0[0]; - v2 = V0[1]+z*V0[2]; - 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)); -} - -/* 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) - * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*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 */ - 4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */ - 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 */ - 9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */ - 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 */ - 1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */ - 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 */ - 7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */ - 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 */ - 3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */ - 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 */ - 8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */ - 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 */ - 1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */ - 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 */ - 1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */ - 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */ -}; - -#ifdef __STDC__ - static double pone(double x) -#else - static double pone(x) - double x; -#endif -{ -#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; - 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); -#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])))); -#else - r1 = p[0]+z*p[1]; z2=z*z; - r2 = p[2]+z*p[3]; z4=z2*z2; - r3 = p[4]+z*p[5]; - r = r1 + z2*r2 + z4*r3; - s1 = one+z*q[0]; - s2 = q[1]+z*q[2]; - s3 = q[3]+z*q[4]; - s = s1 + z2*s2 + z4*s3; -#endif - 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)) - * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 - * 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 */ - -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */ - -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 */ - 7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */ - 6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */ - -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 */ - -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */ - -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 */ - 4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */ - 2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */ - -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 */ - -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */ - -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 */ - 5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */ - 1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */ - -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 */ - -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */ - -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 */ - 7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */ - 1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */ - -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */ -}; - -#ifdef __STDC__ - static double qone(double x) -#else - static double qone(x) - double x; -#endif -{ -#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); - ix &= 0x7fffffff; - if(ix>=0x40200000) {p = qr8; q= qs8;} - else if(ix>=0x40122E8B){p = qr5; q= qs5;} - else if(ix>=0x4006DB6D){p = qr3; q= qs3;} - else if(ix>=0x40000000){p = qr2; q= qs2;} - 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]+z*q[5]))))); -#else - r1 = p[0]+z*p[1]; z2=z*z; - r2 = p[2]+z*p[3]; z4=z2*z2; - r3 = p[4]+z*p[5]; z6=z4*z2; - r = r1 + z2*r2 + z4*r3; - s1 = one+z*q[0]; - s2 = q[1]+z*q[2]; - s3 = q[3]+z*q[4]; - s = s1 + z2*s2 + z4*s3 + z6*q[5]; -#endif - return (.375 + r/s)/x; -} diff --git a/sysdeps/libm-ieee754/e_j1f.c b/sysdeps/libm-ieee754/e_j1f.c deleted file mode 100644 index e6f14a16ac..0000000000 --- a/sysdeps/libm-ieee754/e_j1f.c +++ /dev/null @@ -1,444 +0,0 @@ -/* e_j1f.c -- float version of e_j1.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 */ -tpi = 6.3661974669e-01, /* 0x3f22f983 */ - /* R0/S0 on [0,2] */ -r00 = -6.2500000000e-02, /* 0xbd800000 */ -r01 = 1.4070566976e-03, /* 0x3ab86cfd */ -r02 = -1.5995563444e-05, /* 0xb7862e36 */ -r03 = 4.9672799207e-08, /* 0x335557d2 */ -s01 = 1.9153760746e-02, /* 0x3c9ce859 */ -s02 = 1.8594678841e-04, /* 0x3942fab6 */ -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 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; - y = fabsf(x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sinf(y); - c = __cosf(y); - ss = -s-c; - cc = s-c; - if(ix<0x7f000000) { /* make sure y+y not overflow */ - z = __cosf(y+y); - if ((s*c)>zero) cc = z/ss; - else ss = z/cc; - } - /* - * 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>0x48000000) z = (invsqrtpi*cc)/__sqrtf(y); - else { - u = ponef(y); v = qonef(y); - z = invsqrtpi*(u*cc-v*ss)/__sqrtf(y); - } - if(hx<0) return -z; - else return z; - } - if(ix<0x32000000) { /* |x|<2**-27 */ - if(huge+x>one) return (float)0.5*x;/* inexact if x!=0 necessary */ - } - z = x*x; - r = z*(r00+z*(r01+z*(r02+z*r03))); - s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); - r *= x; - return(x*(float)0.5+r/s); -} - -#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 */ - 6.2274145840e-09, /* 0x31d5f8eb */ - 1.6655924903e-11, /* 0x2d9281cf */ -}; - -#ifdef __STDC__ - float __ieee754_y1f(float x) -#else - float __ieee754_y1f(x) - float x; -#endif -{ - float z, s,c,ss,cc,u,v; - int32_t hx,ix; - - GET_FLOAT_WORD(hx,x); - 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 -one/zero; - if(hx<0) return zero/zero; - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sinf(x); - c = __cosf(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)/__sqrtf(x); - else { - u = ponef(x); v = qonef(x); - z = invsqrtpi*(u*ss+v*cc)/__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)); -} - -/* 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) - * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*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 */ - 4.1205184937e+02, /* 0x43ce06a3 */ - 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 */ - 9.7602796875e+04, /* 0x47bea166 */ - 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 */ - 1.0830818176e+02, /* 0x42d89dca */ - 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 */ - 7.8446904297e+03, /* 0x45f52586 */ - 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 */ - 3.5119403839e+01, /* 0x420c7a45 */ - 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 */ - 8.9081134033e+02, /* 0x445eb3ed */ - 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 */ - 1.2242610931e+01, /* 0x4143e1bc */ - 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 */ - 1.1767937469e+02, /* 0x42eb5bd7 */ - 8.3646392822e+00, /* 0x4105d590 */ -}; - -#ifdef __STDC__ - static float ponef(float x) -#else - static float ponef(x) - float x; -#endif -{ -#ifdef __STDC__ - const float *p,*q; -#else - float *p,*q; -#endif - float z,r,s; - 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; -} - - -/* 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)) - * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 - * 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 */ - -7.5960174561e+02, /* 0xc43de683 */ - -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 */ - 7.1965775000e+05, /* 0x492fb29c */ - 6.6660125000e+05, /* 0x4922be94 */ - -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 */ - -1.8366960144e+02, /* 0xc337ab6b */ - -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 */ - 4.9851425781e+04, /* 0x4742bb6d */ - 2.7948074219e+04, /* 0x46da5826 */ - -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 */ - -5.7847221375e+01, /* 0xc267638e */ - -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 */ - 5.5477290039e+03, /* 0x45ad5dd5 */ - 1.9031191406e+03, /* 0x44ede3d0 */ - -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 */ - -1.9663616180e+01, /* 0xc19d4f16 */ - -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 */ - 7.3939318848e+02, /* 0x4438d92a */ - 1.5594900513e+02, /* 0x431bf2f2 */ - -4.9594988823e+00, /* 0xc09eb437 */ -}; - -#ifdef __STDC__ - static float qonef(float x) -#else - static float qonef(x) - float x; -#endif -{ -#ifdef __STDC__ - const float *p,*q; -#else - float *p,*q; -#endif - float s,r,z; - int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; - if(ix>=0x40200000) {p = qr8; q= qs8;} - else if(ix>=0x40f71c58){p = qr5; q= qs5;} - else if(ix>=0x4036db68){p = qr3; q= qs3;} - else if(ix>=0x40000000){p = qr2; q= qs2;} - 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]+z*q[5]))))); - return ((float).375 + r/s)/x; -} diff --git a/sysdeps/libm-ieee754/e_jn.c b/sysdeps/libm-ieee754/e_jn.c deleted file mode 100644 index d63d7688a3..0000000000 --- a/sysdeps/libm-ieee754/e_jn.c +++ /dev/null @@ -1,281 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#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 - * 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 nx, a continued fraction approximation to - * j(n,x)/j(n-1,x) is evaluated and then backward - * recursion is used starting from a supposed value - * for j(n,x). The resulting value of j(0,x) is - * compared with the actual value to correct the - * supposed value of j(n,x). - * - * yn(n,x) is similar in all respects, except - * that forward recursion is used for all - * values of n>1. - * - */ - -#include "math.h" -#include "math_private.h" - -#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 -{ - int32_t i,hx,ix,lx, sgn; - double a, b, temp, di; - double z, w; - - /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) - * Thus, J(-n,x) = J(n,-x) - */ - 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(n<0){ - n = -n; - x = -x; - hx ^= 0x80000000; - } - if(n==0) return(__ieee754_j0(x)); - 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; - 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 */ - /* (x >> n**2) - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then - * - * n sin(xn)*sqt2 cos(xn)*sqt2 - * ---------------------------------- - * 0 s-c c+s - * 1 -s-c -c+s - * 2 -s+c -c-s - * 3 s+c c-s - */ - switch(n&3) { - case 0: temp = __cos(x)+__sin(x); break; - case 1: temp = -__cos(x)+__sin(x); break; - case 2: temp = -__cos(x)-__sin(x); break; - case 3: temp = __cos(x)-__sin(x); break; - } - b = invsqrtpi*temp/__sqrt(x); - } else { - a = __ieee754_j0(x); - b = __ieee754_j1(x); - for(i=1;i33) /* underflow */ - b = zero; - else { - temp = x*0.5; b = temp; - for (a=one,i=2;i<=n;i++) { - a *= (double)i; /* a = n! */ - b *= temp; /* b = (x/2)^n */ - } - b = b/a; - } - } else { - /* use backward recurrence */ - /* x x^2 x^2 - * J(n,x)/J(n-1,x) = ---- ------ ------ ..... - * 2n - 2(n+1) - 2(n+2) - * - * 1 1 1 - * (for large x) = ---- ------ ------ ..... - * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - - * x x x - * - * Let w = 2n/x and h=2/x, then the above quotient - * is equal to the continued fraction: - * 1 - * = ----------------------- - * 1 - * w - ----------------- - * 1 - * w+h - --------- - * w+2h - ... - * - * To determine how many terms needed, let - * Q(0) = w, Q(1) = w(w+h) - 1, - * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple - */ - /* determine k */ - double t,v; - double q0,q1,h,tmp; int32_t k,m; - w = (n+n)/(double)x; h = 2.0/(double)x; - q0 = w; z = w+h; q1 = w*z - 1.0; k=1; - while(q1<1.0e9) { - k += 1; z += h; - tmp = z*q1 - q0; - q0 = q1; - q1 = tmp; - } - m = n+n; - for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t); - a = t; - b = one; - /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) - * Hence, if n*(log(2n/x)) > ... - * single 8.8722839355e+01 - * double 7.09782712893383973096e+02 - * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is - * likely underflow to zero - */ - tmp = n; - 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; - b *= di; - b = b/x - a; - a = temp; - di -= two; - } - } else { - for(i=n-1,di=(double)(i+i);i>0;i--){ - temp = b; - b *= di; - b = b/x - a; - a = temp; - di -= two; - /* scale b to avoid spurious overflow */ - if(b>1e100) { - a /= b; - t /= b; - b = one; - } - } - } - b = (t*__ieee754_j0(x)/b); - } - } - if(sgn==1) return -b; else return b; -} - -#ifdef __STDC__ - double __ieee754_yn(int n, double x) -#else - double __ieee754_yn(n,x) - int n; double x; -#endif -{ - int32_t i,hx,ix,lx; - int32_t sign; - double a, b, temp; - - 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 -one/zero; - if(hx<0) return zero/zero; - sign = 1; - if(n<0){ - n = -n; - sign = 1 - ((n&1)<<1); - } - if(n==0) return(__ieee754_y0(x)); - if(n==1) return(sign*__ieee754_y1(x)); - if(ix==0x7ff00000) return zero; - if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then - * - * n sin(xn)*sqt2 cos(xn)*sqt2 - * ---------------------------------- - * 0 s-c c+s - * 1 -s-c -c+s - * 2 -s+c -c-s - * 3 s+c c-s - */ - switch(n&3) { - case 0: temp = __sin(x)-__cos(x); break; - case 1: temp = -__sin(x)-__cos(x); break; - case 2: temp = -__sin(x)+__cos(x); break; - case 3: temp = __sin(x)+__cos(x); break; - } - b = invsqrtpi*temp/__sqrt(x); - } else { - u_int32_t high; - a = __ieee754_y0(x); - b = __ieee754_y1(x); - /* quit if b is -inf */ - GET_HIGH_WORD(high,b); - for(i=1;i0) return b; else return -b; -} diff --git a/sysdeps/libm-ieee754/e_jnf.c b/sysdeps/libm-ieee754/e_jnf.c deleted file mode 100644 index 9e5279c30a..0000000000 --- a/sysdeps/libm-ieee754/e_jnf.c +++ /dev/null @@ -1,213 +0,0 @@ -/* e_jnf.c -- float version of e_jn.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 -invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ -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 -{ - int32_t i,hx,ix, sgn; - float a, b, temp, di; - float z, w; - - /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) - * Thus, J(-n,x) = J(n,-x) - */ - GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; - /* if J(n,NaN) is NaN */ - if(ix>0x7f800000) return x+x; - if(n<0){ - n = -n; - x = -x; - hx ^= 0x80000000; - } - if(n==0) return(__ieee754_j0f(x)); - 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 */ - b = zero; - else if((float)n<=x) { - /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ - a = __ieee754_j0f(x); - b = __ieee754_j1f(x); - for(i=1;i33) /* underflow */ - b = zero; - else { - temp = x*(float)0.5; b = temp; - for (a=one,i=2;i<=n;i++) { - a *= (float)i; /* a = n! */ - b *= temp; /* b = (x/2)^n */ - } - b = b/a; - } - } else { - /* use backward recurrence */ - /* x x^2 x^2 - * J(n,x)/J(n-1,x) = ---- ------ ------ ..... - * 2n - 2(n+1) - 2(n+2) - * - * 1 1 1 - * (for large x) = ---- ------ ------ ..... - * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - - * x x x - * - * Let w = 2n/x and h=2/x, then the above quotient - * is equal to the continued fraction: - * 1 - * = ----------------------- - * 1 - * w - ----------------- - * 1 - * w+h - --------- - * w+2h - ... - * - * To determine how many terms needed, let - * Q(0) = w, Q(1) = w(w+h) - 1, - * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple - */ - /* determine k */ - float t,v; - float q0,q1,h,tmp; int32_t k,m; - w = (n+n)/(float)x; h = (float)2.0/(float)x; - q0 = w; z = w+h; q1 = w*z - (float)1.0; k=1; - while(q1<(float)1.0e9) { - k += 1; z += h; - tmp = z*q1 - q0; - q0 = q1; - q1 = tmp; - } - m = n+n; - for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t); - a = t; - b = one; - /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) - * Hence, if n*(log(2n/x)) > ... - * single 8.8722839355e+01 - * double 7.09782712893383973096e+02 - * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is - * likely underflow to zero - */ - tmp = n; - v = two/x; - 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; - b *= di; - b = b/x - a; - a = temp; - di -= two; - } - } else { - for(i=n-1,di=(float)(i+i);i>0;i--){ - temp = b; - b *= di; - b = b/x - a; - a = temp; - di -= two; - /* scale b to avoid spurious overflow */ - if(b>(float)1e10) { - a /= b; - t /= b; - b = one; - } - } - } - b = (t*__ieee754_j0f(x)/b); - } - } - if(sgn==1) return -b; else return b; -} - -#ifdef __STDC__ - float __ieee754_ynf(int n, float x) -#else - float __ieee754_ynf(n,x) - int n; float x; -#endif -{ - int32_t i,hx,ix; - u_int32_t ib; - int32_t sign; - float a, b, temp; - - GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; - /* if Y(n,NaN) is NaN */ - if(ix>0x7f800000) return x+x; - if(ix==0) return -one/zero; - if(hx<0) return zero/zero; - sign = 1; - if(n<0){ - n = -n; - sign = 1 - ((n&1)<<1); - } - if(n==0) return(__ieee754_y0f(x)); - if(n==1) return(sign*__ieee754_y1f(x)); - if(ix==0x7f800000) return zero; - - a = __ieee754_y0f(x); - b = __ieee754_y1f(x); - /* quit if b is -inf */ - GET_FLOAT_WORD(ib,b); - for(i=1;i0) return b; else return -b; -} diff --git a/sysdeps/libm-ieee754/e_lgamma_r.c b/sysdeps/libm-ieee754/e_lgamma_r.c deleted file mode 100644 index 92e9556568..0000000000 --- a/sysdeps/libm-ieee754/e_lgamma_r.c +++ /dev/null @@ -1,314 +0,0 @@ -/* @(#)er_lgamma.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. - * ==================================================== - */ - -#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) - * for example, - * lgamma(7.3) = log(6.3) + lgamma(6.3) - * = log(6.3*5.3) + lgamma(5.3) - * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) - * 2. Polynomial approximation of lgamma around its - * minimun ymin=1.461632144968362245 to maintain monotonicity. - * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use - * Let z = x-ymin; - * lgamma(x) = -1.214862905358496078218 + z^2*poly(z) - * where - * poly(z) is a 14 degree polynomial. - * 2. Rational approximation in the primary interval [2,3] - * We use the following approximation: - * s = x-2.0; - * lgamma(x) = 0.5*s + s*P(s)/Q(s) - * with accuracy - * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71 - * Our algorithms are based on the following observation - * - * zeta(2)-1 2 zeta(3)-1 3 - * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... - * 2 3 - * - * where Euler = 0.5771... is the Euler constant, which is very - * close to 0.5. - * - * 3. For x>=8, we have - * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... - * (better formula: - * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) - * Let z = 1/x, then we approximation - * f(z) = lgamma(x) - (x-0.5)(log(x)-1) - * by - * 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)) - * 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)|) - * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); - * Note: one should avoid compute pi*(-x) directly in the - * computation of sin(pi*(-x)). - * - * 5. Special Cases - * lgamma(2+s) ~ s*(1-Euler) for tiny s - * lgamma(1)=lgamma(2)=0 - * lgamma(x) ~ -log(x) for tiny x - * lgamma(0) = lgamma(inf) = 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 */ -pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ -a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */ -a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */ -a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */ -a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */ -a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */ -a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */ -a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */ -a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */ -a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */ -a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */ -a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */ -a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */ -tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */ -tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */ -/* tt = -(tail of tf) */ -tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */ -t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */ -t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */ -t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */ -t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */ -t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */ -t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */ -t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */ -t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */ -t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */ -t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */ -t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */ -t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */ -t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */ -t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */ -t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */ -u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ -u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */ -u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */ -u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */ -u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */ -u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */ -v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */ -v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */ -v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */ -v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */ -v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */ -s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ -s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */ -s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */ -s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */ -s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ -s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ -s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ -r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ -r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */ -r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */ -r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */ -r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */ -r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */ -w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */ -w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */ -w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */ -w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */ -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 -{ - double y,z; - int n,ix; - - GET_HIGH_WORD(ix,x); - ix &= 0x7fffffff; - - if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0); - y = -x; /* x is assume negative */ - - /* - * argument reduction, make sure inexact flag not raised if input - * is an integer - */ - z = __floor(y); - if(z!=y) { /* inexact anyway */ - y *= 0.5; - 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 */ - GET_LOW_WORD(n,z); - n &= 1; - y = n; - n<<= 2; - } - } - switch (n) { - case 0: y = __kernel_sin(pi*y,zero,0); break; - case 1: - case 2: y = __kernel_cos(pi*(0.5-y),zero); break; - case 3: - case 4: y = __kernel_sin(pi*(one-y),zero,0); break; - case 5: - case 6: y = -__kernel_cos(pi*(y-1.5),zero); break; - default: y = __kernel_sin(pi*(y-2.0),zero,0); break; - } - return -y; -} - - -#ifdef __STDC__ - double __ieee754_lgamma_r(double x, int *signgamp) -#else - double __ieee754_lgamma_r(x,signgamp) - double x; int *signgamp; -#endif -{ - double t,y,z,nadj,p,p1,p2,p3,q,r,w; - int i,hx,lx,ix; - - EXTRACT_WORDS(hx,lx,x); - - /* purge off +-inf, NaN, +-0, and negative arguments */ - *signgamp = 1; - if ((unsigned int) hx==0xfff00000&&lx==0) - return x-x; - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return x*x; - if((ix|lx)==0) return one/fabs(x); - if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ - if(hx<0) { - *signgamp = -1; - return -__ieee754_log(-x); - } else return -__ieee754_log(x); - } - if(hx<0) { - if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ - return x/zero; - t = sin_pi(x); - if(t==zero) return one/fabsf(t); /* -integer */ - nadj = __ieee754_log(pi/fabs(t*x)); - if(t=0x3FE76944) {y = one-x; i= 0;} - else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} - 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] */ - else {y=x-one;i=2;} - } - switch(i) { - case 0: - z = y*y; - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); - p = y*p1+p2; - r += (p-0.5*y); break; - case 1: - z = y*y; - w = z*y; - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); - p = z*p1-(tt-w*(p2+y*p3)); - r += (tf + p); break; - case 2: - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); - p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += (-0.5*y + p1/p2); - } - } - else if(ix<0x40200000) { /* x < 8.0 */ - i = (int)x; - t = zero; - y = x-(double)i; - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); - q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = half*y+p/q; - z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ - switch(i) { - case 7: z *= (y+6.0); /* FALLTHRU */ - case 6: z *= (y+5.0); /* FALLTHRU */ - case 5: z *= (y+4.0); /* FALLTHRU */ - case 4: z *= (y+3.0); /* FALLTHRU */ - case 3: z *= (y+2.0); /* FALLTHRU */ - r += __ieee754_log(z); break; - } - /* 8.0 <= x < 2**58 */ - } else if (ix < 0x43900000) { - t = __ieee754_log(x); - z = one/x; - y = z*z; - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); - r = (x-half)*(t-one)+w; - } else - /* 2**58 <= x <= inf */ - r = x*(__ieee754_log(x)-one); - if(hx<0) r = nadj - r; - return r; -} diff --git a/sysdeps/libm-ieee754/e_lgammaf_r.c b/sysdeps/libm-ieee754/e_lgammaf_r.c deleted file mode 100644 index f744d5320e..0000000000 --- a/sysdeps/libm-ieee754/e_lgammaf_r.c +++ /dev/null @@ -1,250 +0,0 @@ -/* e_lgammaf_r.c -- float version of e_lgamma_r.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 */ -pi = 3.1415927410e+00, /* 0x40490fdb */ -a0 = 7.7215664089e-02, /* 0x3d9e233f */ -a1 = 3.2246702909e-01, /* 0x3ea51a66 */ -a2 = 6.7352302372e-02, /* 0x3d89f001 */ -a3 = 2.0580807701e-02, /* 0x3ca89915 */ -a4 = 7.3855509982e-03, /* 0x3bf2027e */ -a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */ -a6 = 1.1927076848e-03, /* 0x3a9c54a1 */ -a7 = 5.1006977446e-04, /* 0x3a05b634 */ -a8 = 2.2086278477e-04, /* 0x39679767 */ -a9 = 1.0801156895e-04, /* 0x38e28445 */ -a10 = 2.5214456400e-05, /* 0x37d383a2 */ -a11 = 4.4864096708e-05, /* 0x383c2c75 */ -tc = 1.4616321325e+00, /* 0x3fbb16c3 */ -tf = -1.2148628384e-01, /* 0xbdf8cdcd */ -/* tt = -(tail of tf) */ -tt = 6.6971006518e-09, /* 0x31e61c52 */ -t0 = 4.8383611441e-01, /* 0x3ef7b95e */ -t1 = -1.4758771658e-01, /* 0xbe17213c */ -t2 = 6.4624942839e-02, /* 0x3d845a15 */ -t3 = -3.2788541168e-02, /* 0xbd064d47 */ -t4 = 1.7970675603e-02, /* 0x3c93373d */ -t5 = -1.0314224288e-02, /* 0xbc28fcfe */ -t6 = 6.1005386524e-03, /* 0x3bc7e707 */ -t7 = -3.6845202558e-03, /* 0xbb7177fe */ -t8 = 2.2596477065e-03, /* 0x3b141699 */ -t9 = -1.4034647029e-03, /* 0xbab7f476 */ -t10 = 8.8108185446e-04, /* 0x3a66f867 */ -t11 = -5.3859531181e-04, /* 0xba0d3085 */ -t12 = 3.1563205994e-04, /* 0x39a57b6b */ -t13 = -3.1275415677e-04, /* 0xb9a3f927 */ -t14 = 3.3552918467e-04, /* 0x39afe9f7 */ -u0 = -7.7215664089e-02, /* 0xbd9e233f */ -u1 = 6.3282704353e-01, /* 0x3f2200f4 */ -u2 = 1.4549225569e+00, /* 0x3fba3ae7 */ -u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */ -u4 = 2.2896373272e-01, /* 0x3e6a7578 */ -u5 = 1.3381091878e-02, /* 0x3c5b3c5e */ -v1 = 2.4559779167e+00, /* 0x401d2ebe */ -v2 = 2.1284897327e+00, /* 0x4008392d */ -v3 = 7.6928514242e-01, /* 0x3f44efdf */ -v4 = 1.0422264785e-01, /* 0x3dd572af */ -v5 = 3.2170924824e-03, /* 0x3b52d5db */ -s0 = -7.7215664089e-02, /* 0xbd9e233f */ -s1 = 2.1498242021e-01, /* 0x3e5c245a */ -s2 = 3.2577878237e-01, /* 0x3ea6cc7a */ -s3 = 1.4635047317e-01, /* 0x3e15dce6 */ -s4 = 2.6642270386e-02, /* 0x3cda40e4 */ -s5 = 1.8402845599e-03, /* 0x3af135b4 */ -s6 = 3.1947532989e-05, /* 0x3805ff67 */ -r1 = 1.3920053244e+00, /* 0x3fb22d3b */ -r2 = 7.2193557024e-01, /* 0x3f38d0c5 */ -r3 = 1.7193385959e-01, /* 0x3e300f6e */ -r4 = 1.8645919859e-02, /* 0x3c98bf54 */ -r5 = 7.7794247773e-04, /* 0x3a4beed6 */ -r6 = 7.3266842264e-06, /* 0x36f5d7bd */ -w0 = 4.1893854737e-01, /* 0x3ed67f1d */ -w1 = 8.3333335817e-02, /* 0x3daaaaab */ -w2 = -2.7777778450e-03, /* 0xbb360b61 */ -w3 = 7.9365057172e-04, /* 0x3a500cfd */ -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 -{ - float y,z; - int n,ix; - - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; - - if(ix<0x3e800000) return __kernel_sinf(pi*x,zero,0); - y = -x; /* x is assume negative */ - - /* - * argument reduction, make sure inexact flag not raised if input - * is an integer - */ - z = __floorf(y); - if(z!=y) { /* inexact anyway */ - y *= (float)0.5; - 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 */ - GET_FLOAT_WORD(n,z); - n &= 1; - y = n; - n<<= 2; - } - } - switch (n) { - case 0: y = __kernel_sinf(pi*y,zero,0); break; - case 1: - case 2: y = __kernel_cosf(pi*((float)0.5-y),zero); break; - case 3: - case 4: y = __kernel_sinf(pi*(one-y),zero,0); break; - case 5: - case 6: y = -__kernel_cosf(pi*(y-(float)1.5),zero); break; - default: y = __kernel_sinf(pi*(y-(float)2.0),zero,0); break; - } - return -y; -} - - -#ifdef __STDC__ - float __ieee754_lgammaf_r(float x, int *signgamp) -#else - float __ieee754_lgammaf_r(x,signgamp) - float x; int *signgamp; -#endif -{ - float t,y,z,nadj,p,p1,p2,p3,q,r,w; - int i,hx,ix; - - GET_FLOAT_WORD(hx,x); - - /* purge off +-inf, NaN, +-0, and negative arguments */ - *signgamp = 1; - if ((unsigned int)hx==0xff800000) - return x-x; - ix = hx&0x7fffffff; - if(ix>=0x7f800000) return x*x; - if(ix==0) return one/fabsf(x); - if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */ - if(hx<0) { - *signgamp = -1; - return -__ieee754_logf(-x); - } else return -__ieee754_logf(x); - } - if(hx<0) { - if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ - return x/zero; - t = sin_pif(x); - if(t==zero) return one/fabsf(t); /* -integer */ - nadj = __ieee754_logf(pi/fabsf(t*x)); - if(t=0x3f3b4a20) {y = one-x; i= 0;} - else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;} - 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] */ - else {y=x-one;i=2;} - } - switch(i) { - case 0: - z = y*y; - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); - p = y*p1+p2; - r += (p-(float)0.5*y); break; - case 1: - z = y*y; - w = z*y; - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); - p = z*p1-(tt-w*(p2+y*p3)); - r += (tf + p); break; - case 2: - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); - p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += (-(float)0.5*y + p1/p2); - } - } - else if(ix<0x41000000) { /* x < 8.0 */ - i = (int)x; - t = zero; - y = x-(float)i; - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); - q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = half*y+p/q; - z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ - switch(i) { - case 7: z *= (y+(float)6.0); /* FALLTHRU */ - case 6: z *= (y+(float)5.0); /* FALLTHRU */ - case 5: z *= (y+(float)4.0); /* FALLTHRU */ - case 4: z *= (y+(float)3.0); /* FALLTHRU */ - case 3: z *= (y+(float)2.0); /* FALLTHRU */ - r += __ieee754_logf(z); break; - } - /* 8.0 <= x < 2**58 */ - } else if (ix < 0x5c800000) { - t = __ieee754_logf(x); - z = one/x; - y = z*z; - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); - r = (x-half)*(t-one)+w; - } else - /* 2**58 <= x <= inf */ - r = x*(__ieee754_logf(x)-one); - if(hx<0) r = nadj - r; - return r; -} diff --git a/sysdeps/libm-ieee754/e_log.c b/sysdeps/libm-ieee754/e_log.c deleted file mode 100644 index 851bd30198..0000000000 --- a/sysdeps/libm-ieee754/e_log.c +++ /dev/null @@ -1,165 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_log.c,v 1.8 1995/05/10 20:45:49 jtc Exp $"; -#endif - -/* __ieee754_log(x) - * Return the logarithm of x - * - * Method : - * 1. Argument Reduction: find k and f such that - * x = 2^k * (1+f), - * where sqrt(2)/2 < 1+f < sqrt(2) . - * - * 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 - * We use a special Reme algorithm on [0,0.1716] to generate - * 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 - * 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) - * and - * | 2 14 | -58.45 - * | Lg1*s +...+Lg7*s - R(z) | <= 2 - * | | - * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. - * In order to guarantee error in log below 1ulp, we compute log - * by - * log(1+f) = f - s*(f - R) (if f is not too large) - * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) - * - * 3. Finally, log(x) = k*ln2 + log(1+f). - * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: - * ln2_hi + ln2_lo, - * where n*ln2_hi is always exact for |n| < 2000. - * - * Special cases: - * log(x) is NaN with signal if x < 0 (including -INF) ; - * log(+INF) is +INF; log(0) is -INF with signal; - * log(NaN) is that NaN with no signal. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" -#define half Lg[8] -#define two Lg[9] -#ifdef __STDC__ -static const double -#else -static double -#endif -ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ -ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ -two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ - Lg[] = {0.0, - 6.666666666666735130e-01, /* 3FE55555 55555593 */ - 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ - 2.857142874366239149e-01, /* 3FD24924 94229359 */ - 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ - 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ - 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ - 1.479819860511658591e-01, /* 3FC2F112 DF3E5244 */ - 0.5, - 2.0}; -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif - -#ifdef __STDC__ - double __ieee754_log(double x) -#else - double __ieee754_log(x) - double x; -#endif -{ - double hfsq,f,s,z,R,w,dk,t11,t12,t21,t22,w2,zw2; -#ifdef DO_NOT_USE_THIS - double t1,t2; -#endif - int32_t k,hx,i,j; - u_int32_t lx; - - 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 */ - GET_HIGH_WORD(hx,x); - } - if (hx >= 0x7ff00000) return x+x; - k += (hx>>20)-1023; - hx &= 0x000fffff; - i = (hx+0x95f64)&0x100000; - SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ - k += (i>>20); - f = x-1.0; - if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ - if(f==zero) { - if(k==0) return zero; else {dk=(double)k; - return dk*ln2_hi+dk*ln2_lo;} - } - R = f*f*(half-0.33333333333333333*f); - if(k==0) return f-R; else {dk=(double)k; - return dk*ln2_hi-((R-dk*ln2_lo)-f);} - } - s = f/(two+f); - dk = (double)k; - z = s*s; - i = hx-0x6147a; - w = z*z; - j = 0x6b851-hx; -#ifdef DO_NOT_USE_THIS - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - R = t2+t1; -#else - t21 = Lg[5]+w*Lg[7]; w2=w*w; - t22 = Lg[1]+w*Lg[3]; zw2=z*w2; - t11 = Lg[4]+w*Lg[6]; - t12 = w*Lg[2]; - R = t12 + w2*t11 + z*t22 + zw2*t21; -#endif - i |= j; - if(i>0) { - hfsq=0.5*f*f; - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); - } else { - if(k==0) return f-s*(f-R); else - return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); - } -} diff --git a/sysdeps/libm-ieee754/e_log10.c b/sysdeps/libm-ieee754/e_log10.c deleted file mode 100644 index e8a3278eaf..0000000000 --- a/sysdeps/libm-ieee754/e_log10.c +++ /dev/null @@ -1,98 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#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 - * - * Method : - * Let log10_2hi = leading 40 bits of log10(2) and - * log10_2lo = log10(2) - log10_2hi, - * ivln10 = 1/log(10) rounded. - * Then - * n = ilogb(x), - * if(n<0) n = n+1; - * x = scalbn(x,-n); - * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) - * - * Note 1: - * To guarantee log10(10**n)=n, where 10**n is normal, the rounding - * mode must set to Round-to-Nearest. - * Note 2: - * [1/log(10)] rounded to 53 bits has error .198 ulps; - * log10 is monotonic at all binary break points. - * - * Special cases: - * log10(x) is NaN with signal if x < 0; - * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; - * log10(NaN) is that NaN with no signal; - * log10(10**N) = N for N=0,1,...,22. - * - * Constants: - * The hexadecimal values are the intended ones for the following constants. - * The decimal values may be used, provided that the compiler will convert - * from decimal to binary accurately enough to produce the hexadecimal values - * shown. - */ - -#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 y,z; - int32_t i,k,hx; - u_int32_t lx; - - 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 */ - GET_HIGH_WORD(hx,x); - } - if (hx >= 0x7ff00000) return x+x; - k += (hx>>20)-1023; - i = ((u_int32_t)k&0x80000000)>>31; - 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; -} diff --git a/sysdeps/libm-ieee754/e_log10f.c b/sysdeps/libm-ieee754/e_log10f.c deleted file mode 100644 index cea3d9156b..0000000000 --- a/sysdeps/libm-ieee754/e_log10f.c +++ /dev/null @@ -1,67 +0,0 @@ -/* e_log10f.c -- float version of e_log10.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 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 */ - GET_FLOAT_WORD(hx,x); - } - if (hx >= 0x7f800000) return x+x; - k += (hx>>23)-127; - i = ((u_int32_t)k&0x80000000)>>31; - 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; -} diff --git a/sysdeps/libm-ieee754/e_logf.c b/sysdeps/libm-ieee754/e_logf.c deleted file mode 100644 index de8f869df4..0000000000 --- a/sysdeps/libm-ieee754/e_logf.c +++ /dev/null @@ -1,99 +0,0 @@ -/* e_logf.c -- float version of e_log.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 */ -Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ -Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ -Lg3 = 2.8571429849e-01, /* 3E924925 */ -Lg4 = 2.2222198546e-01, /* 3E638E29 */ -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 hfsq,f,s,z,R,w,t1,t2,dk; - int32_t k,ix,i,j; - - GET_FLOAT_WORD(ix,x); - - k=0; - if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) - return -two25/(x-x); /* log(+-0)=-inf */ - if (ix<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; - k += (ix>>23)-127; - ix &= 0x007fffff; - i = (ix+(0x95f64<<3))&0x800000; - SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ - k += (i>>23); - f = x-(float)1.0; - if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ - if(f==zero) { - if(k==0) return zero; else {dk=(float)k; - return dk*ln2_hi+dk*ln2_lo;} - } - 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);} - } - s = f/((float)2.0+f); - dk = (float)k; - z = s*s; - i = ix-(0x6147a<<3); - w = z*z; - j = (0x6b851<<3)-ix; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - i |= j; - R = t2+t1; - if(i>0) { - hfsq=(float)0.5*f*f; - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); - } else { - if(k==0) return f-s*(f-R); else - return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); - } -} diff --git a/sysdeps/libm-ieee754/e_pow.c b/sysdeps/libm-ieee754/e_pow.c deleted file mode 100644 index 1e1496f00d..0000000000 --- a/sysdeps/libm-ieee754/e_pow.c +++ /dev/null @@ -1,352 +0,0 @@ -/* @(#)e_pow.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; -#endif - -/* __ieee754_pow(x,y) return x**y - * - * n - * Method: Let x = 2 * (1+f) - * 1. Compute and return log2(x) in two pieces: - * log2(x) = w1 + w2, - * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision - * arithmetic, where |y'|<=0.5. - * 3. Return x**y = 2**n*exp(y'*log2) - * - * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN - * - * Accuracy: - * pow(x,y) returns x**y nearly rounded. In particular - * pow(integer,integer) - * always returns the correct integer provided it is - * representable. - * - * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" -#define zero C[0] -#define one C[1] -#define two C[2] -#define two53 C[3] -#define huge C[4] -#define tiny C[5] -#define L1 C[6] -#define L2 C[7] -#define L3 C[8] -#define L4 C[9] -#define L5 C[10] -#define L6 C[11] -#define P1 C[12] -#define P2 C[13] -#define P3 C[14] -#define P4 C[15] -#define P5 C[16] -#define lg2 C[17] -#define lg2_h C[18] -#define lg2_l C[19] -#define ovt C[20] -#define cp C[21] -#define cp_h C[22] -#define cp_l C[23] -#define ivln2 C[24] -#define ivln2_h C[25] -#define ivln2_l C[26] - -#ifdef __STDC__ -static const double -#else -static double -#endif -bp[] = {1.0, 1.5,}, -dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ -dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ -C[] = { -0.0, -1.0, -2.0, -9007199254740992.0 , -1.0e300, -1.0e-300, -5.99999999999994648725e-01 , -4.28571428578550184252e-01 , -3.33333329818377432918e-01 , -2.72728123808534006489e-01 , -2.30660745775561754067e-01 , -2.06975017800338417784e-01 , -1.66666666666666019037e-01 , --2.77777777770155933842e-03 , -6.61375632143793436117e-05 , --1.65339022054652515390e-06 , -4.13813679705723846039e-08 , -6.93147180559945286227e-01 , -6.93147182464599609375e-01 , --1.90465429995776804525e-09 , -8.0085662595372944372e-0017 , -9.61796693925975554329e-01 , -9.61796700954437255859e-01 , --7.02846165095275826516e-09 , -1.44269504088896338700e+00 , -1.44269502162933349609e+00 , -1.92596299112661746887e-08 }; - -#ifdef __STDC__ - double __ieee754_pow(double x, double y) -#else - double __ieee754_pow(x,y) - double x, y; -#endif -{ - double z,ax,z_h,z_l,p_h,p_l; - double y1,t1,t2,r,s,t,u,v,w, t12,t14,r_1,r_2,r_3; - int32_t i,j,k,yisint,n; - int32_t hx,hy,ix,iy; - u_int32_t lx,ly; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - ix = hx&0x7fffffff; iy = hy&0x7fffffff; - - /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return C[1]; - - /* +-NaN return x+y */ - if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) - return x+y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if(hx<0) { - if(iy>=0x43400000) yisint = 2; /* even integer y */ - else if(iy>=0x3ff00000) { - k = (iy>>20)-0x3ff; /* exponent */ - if(k>20) { - j = ly>>(52-k); - if((u_int32_t)(j<<(52-k))==ly) yisint = 2-(j&1); - } else if(ly==0) { - j = iy>>(20-k); - if((int32_t)(j<<(20-k))==iy) yisint = 2-(j&1); - } - } - } - - /* special value of y */ - if(ly==0) { - if (iy==0x7ff00000) { /* y is +-inf */ - if(((ix-0x3ff00000)|lx)==0) - return y - y; /* inf**+-1 is NaN */ - else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ - return (hy>=0)? y: C[0]; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy<0)?-y: C[0]; - } - if(iy==0x3ff00000) { /* y is +-1 */ - if(hy<0) return C[1]/x; else return x; - } - if(hy==0x40000000) return x*x; /* y is 2 */ - if(hy==0x3fe00000) { /* y is 0.5 */ - if(hx>=0) /* x >= +0 */ - return __ieee754_sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if(lx==0) { - if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ - z = ax; /*x is +-0,+-inf,+-1*/ - if(hy<0) z = C[1]/z; /* z = (1/|x|) */ - if(hx<0) { - if(((ix-0x3ff00000)|yisint)==0) { - z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* (x<0)**(non-int) is NaN */ - if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); - - /* |y| is huge */ - if(iy>0x41e00000) { /* if |y| > 2**31 */ - if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ - if(ix<=0x3fefffff) return (hy<0)? C[4]*C[4]:C[5]*C[5]; - if(ix>=0x3ff00000) return (hy>0)? C[4]*C[4]:C[5]*C[5]; - } - /* over/underflow if x is not close to one */ - if(ix<0x3fefffff) return (hy<0)? C[4]*C[4]:C[5]*C[5]; - if(ix>0x3ff00000) return (hy>0)? C[4]*C[4]:C[5]*C[5]; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x-1; /* t has 20 trailing zeros */ - w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); - u = C[25]*t; /* ivln2_h has 21 sig. bits */ - v = t*C[26]-w*C[24]; - t1 = u+v; - SET_LOW_WORD(t1,0); - t2 = v-(t1-u); - } else { - double s2,s_h,s_l,t_h,t_l,s22,s24,s26,r1,r2,r3; - n = 0; - /* take care subnormal number */ - if(ix<0x00100000) - {ax *= C[3]; n -= 53; GET_HIGH_WORD(ix,ax); } - n += ((ix)>>20)-0x3ff; - j = ix&0x000fffff; - /* determine interval */ - ix = j|0x3ff00000; /* normalize ix */ - if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); - t_l = ax - (t_h-bp[k]); - s_l = v*((u-s_h*t_h)-s_h*t_l); - /* compute log(ax) */ - s2 = s*s; -#ifdef DO_NOT_USE_THIS - r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); -#else - r1 = C[10]+s2*C[11]; s22=s2*s2; - r2 = C[8]+s2*C[9]; s24=s22*s22; - r3 = C[6]+s2*C[7]; s26=s24*s22; - r = r3*s22 + r2*s24 + r1*s26; -#endif - r += s_l*(s_h+s); - s2 = s_h*s_h; - t_h = 3.0+s2+r; - SET_LOW_WORD(t_h,0); - t_l = r-((t_h-3.0)-s2); - /* u+v = s*(1+...) */ - u = s_h*t_h; - v = s_l*t_h+t_l*s; - /* 2/(3log2)*(s+...) */ - p_h = u+v; - SET_LOW_WORD(p_h,0); - p_l = v-(p_h-u); - z_h = C[22]*p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = C[23]*p_h+p_l*C[21]+dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double)n; - t1 = (((z_h+z_l)+dp_h[k])+t); - SET_LOW_WORD(t1,0); - t2 = z_l-(((t1-t)-dp_h[k])-z_h); - } - - s = C[1]; /* s (sign of result -ve**odd) = -1 else = 1 */ - if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) - s = -C[1];/* (-ve)**(odd int) */ - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1,0); - p_l = (y-y1)*t1+y*t2; - p_h = y1*t1; - z = p_l+p_h; - EXTRACT_WORDS(j,i,z); - if (j>=0x40900000) { /* z >= 1024 */ - if(((j-0x40900000)|i)!=0) /* if z > 1024 */ - return s*C[4]*C[4]; /* overflow */ - else { - if(p_l+C[20]>z-p_h) return s*C[4]*C[4]; /* overflow */ - } - } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ - if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ - return s*C[5]*C[5]; /* underflow */ - else { - if(p_l<=z-p_h) return s*C[5]*C[5]; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j&0x7fffffff; - k = (i>>20)-0x3ff; - n = 0; - if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j+(0x00100000>>(k+1)); - k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ - t = C[0]; - SET_HIGH_WORD(t,n&~(0x000fffff>>k)); - n = ((n&0x000fffff)|0x00100000)>>(20-k); - if(j<0) n = -n; - p_h -= t; - } - t = p_l+p_h; - SET_LOW_WORD(t,0); - u = t*C[18]; - v = (p_l-(t-p_h))*C[17]+t*C[19]; - z = u+v; - w = v-(z-u); - t = z*z; -#ifdef DO_NOT_USE_THIS - t1 = z - t*(C[12]+t*(C[13]+t*(C[14]+t*(C[15]+t*C[16])))); -#else - r_1 = C[15]+t*C[16]; t12 = t*t; - r_2 = C[13]+t*C[14]; t14 = t12*t12; - r_3 = t*C[12]; - t1 = z - r_3 - t12*r_2 - t14*r_1; -#endif - r = (z*t1)/(t1-C[2])-(w+z*w); - z = C[1]-(r-z); - GET_HIGH_WORD(j,z); - j += (n<<20); - if((j>>20)<=0) z = __scalbn(z,n); /* subnormal output */ - else SET_HIGH_WORD(z,j); - return s*z; -} diff --git a/sysdeps/libm-ieee754/e_powf.c b/sysdeps/libm-ieee754/e_powf.c deleted file mode 100644 index 4798340c84..0000000000 --- a/sysdeps/libm-ieee754/e_powf.c +++ /dev/null @@ -1,253 +0,0 @@ -/* e_powf.c -- float version of e_pow.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 */ -zero = 0.0, -one = 1.0, -two = 2.0, -two24 = 16777216.0, /* 0x4b800000 */ - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ -L1 = 6.0000002384e-01, /* 0x3f19999a */ -L2 = 4.2857143283e-01, /* 0x3edb6db7 */ -L3 = 3.3333334327e-01, /* 0x3eaaaaab */ -L4 = 2.7272811532e-01, /* 0x3e8ba305 */ -L5 = 2.3066075146e-01, /* 0x3e6c3255 */ -L6 = 2.0697501302e-01, /* 0x3e53f142 */ -P1 = 1.6666667163e-01, /* 0x3e2aaaab */ -P2 = -2.7777778450e-03, /* 0xbb360b61 */ -P3 = 6.6137559770e-05, /* 0x388ab355 */ -P4 = -1.6533901999e-06, /* 0xb5ddea0e */ -P5 = 4.1381369442e-08, /* 0x3331bb4c */ -lg2 = 6.9314718246e-01, /* 0x3f317218 */ -lg2_h = 6.93145752e-01, /* 0x3f317200 */ -lg2_l = 1.42860654e-06, /* 0x35bfbe8c */ -ovt = 4.2995665694e-08, /* -(128-log2(ovfl+.5ulp)) */ -cp = 9.6179670095e-01, /* 0x3f76384f =2/(3ln2) */ -cp_h = 9.6179199219e-01, /* 0x3f763800 =head of cp */ -cp_l = 4.7017383622e-06, /* 0x369dc3a0 =tail of cp_h */ -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 z,ax,z_h,z_l,p_h,p_l; - float y1,t1,t2,r,s,t,u,v,w; - int32_t i,j,k,yisint,n; - int32_t hx,hy,ix,iy,is; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - ix = hx&0x7fffffff; iy = hy&0x7fffffff; - - /* y==zero: x**0 = 1 */ - if(iy==0) return one; - - /* +-NaN return x+y */ - if(ix > 0x7f800000 || - iy > 0x7f800000) - return x+y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if(hx<0) { - if(iy>=0x4b800000) yisint = 2; /* even integer y */ - else if(iy>=0x3f800000) { - k = (iy>>23)-0x7f; /* exponent */ - j = iy>>(23-k); - if((j<<(23-k))==iy) yisint = 2-(j&1); - } - } - - /* special value of y */ - if (iy==0x7f800000) { /* y is +-inf */ - if (ix==0x3f800000) - return y - y; /* inf**+-1 is NaN */ - else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ - return (hy>=0)? y: zero; - else /* (|x|<1)**-,+inf = inf,0 */ - 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 */ - return __ieee754_sqrtf(x); - } - - ax = fabsf(x); - /* special value of x */ - if(ix==0x7f800000||ix==0||ix==0x3f800000){ - z = ax; /*x is +-0,+-inf,+-1*/ - if(hy<0) z = one/z; /* z = (1/|x|) */ - if(hx<0) { - if(((ix-0x3f800000)|yisint)==0) { - z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - - /* (x<0)**(non-int) is NaN */ - if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); - - /* |y| is huge */ - if(iy>0x4d000000) { /* 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; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x-1; /* t has 20 trailing zeros */ - w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); - u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ - v = t*ivln2_l-w*ivln2; - t1 = u+v; - GET_FLOAT_WORD(is,t1); - SET_FLOAT_WORD(t1,is&0xfffff000); - t2 = v-(t1-u); - } else { - float s2,s_h,s_l,t_h,t_l; - n = 0; - /* take care subnormal number */ - if(ix<0x00800000) - {ax *= two24; n -= 24; GET_FLOAT_WORD(ix,ax); } - n += ((ix)>>23)-0x7f; - j = ix&0x007fffff; - /* determine interval */ - ix = j|0x3f800000; /* normalize ix */ - if(j<=0x1cc471) k=0; /* |x|>1)|0x20000000)+0x0040000+(k<<21)); - t_l = ax - (t_h-bp[k]); - s_l = v*((u-s_h*t_h)-s_h*t_l); - /* compute log(ax) */ - s2 = s*s; - r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); - r += s_l*(s_h+s); - s2 = s_h*s_h; - t_h = (float)3.0+s2+r; - GET_FLOAT_WORD(is,t_h); - SET_FLOAT_WORD(t_h,is&0xfffff000); - t_l = r-((t_h-(float)3.0)-s2); - /* u+v = s*(1+...) */ - u = s_h*t_h; - v = s_l*t_h+t_l*s; - /* 2/(3log2)*(s+...) */ - p_h = u+v; - GET_FLOAT_WORD(is,p_h); - SET_FLOAT_WORD(p_h,is&0xfffff000); - p_l = v-(p_h-u); - z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l*p_h+p_l*cp+dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (float)n; - t1 = (((z_h+z_l)+dp_h[k])+t); - GET_FLOAT_WORD(is,t1); - SET_FLOAT_WORD(t1,is&0xfffff000); - t2 = z_l-(((t1-t)-dp_h[k])-z_h); - } - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) - s = -one; /* (-ve)**(odd int) */ - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - GET_FLOAT_WORD(is,y); - SET_FLOAT_WORD(y1,is&0xfffff000); - p_l = (y-y1)*t1+y*t2; - p_h = y1*t1; - z = p_l+p_h; - GET_FLOAT_WORD(j,z); - if (j>0x43000000) /* if z > 128 */ - return s*huge*huge; /* overflow */ - else if (j==0x43000000) { /* if z == 128 */ - if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ - } - else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */ - return s*tiny*tiny; /* underflow */ - else if ((u_int32_t) j==0xc3160000){ /* z == -150 */ - if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ - } - /* - * compute 2**(p_h+p_l) - */ - i = j&0x7fffffff; - k = (i>>23)-0x7f; - n = 0; - if(i>0x3f000000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j+(0x00800000>>(k+1)); - k = ((n&0x7fffffff)>>23)-0x7f; /* new k for n */ - SET_FLOAT_WORD(t,n&~(0x007fffff>>k)); - n = ((n&0x007fffff)|0x00800000)>>(23-k); - if(j<0) n = -n; - p_h -= t; - } - t = p_l+p_h; - GET_FLOAT_WORD(is,t); - SET_FLOAT_WORD(t,is&0xfffff000); - u = t*lg2_h; - v = (p_l-(t-p_h))*lg2+t*lg2_l; - z = u+v; - w = v-(z-u); - t = z*z; - t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - r = (z*t1)/(t1-two)-(w+z*w); - z = one-(r-z); - GET_FLOAT_WORD(j,z); - j += (n<<23); - if((j>>23)<=0) z = __scalbnf(z,n); /* subnormal output */ - else SET_FLOAT_WORD(z,j); - return s*z; -} diff --git a/sysdeps/libm-ieee754/e_rem_pio2.c b/sysdeps/libm-ieee754/e_rem_pio2.c deleted file mode 100644 index a8a8cdb2b2..0000000000 --- a/sysdeps/libm-ieee754/e_rem_pio2.c +++ /dev/null @@ -1,183 +0,0 @@ -/* @(#)e_rem_pio2.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_rem_pio2.c,v 1.8 1995/05/10 20:46:02 jtc Exp $"; -#endif - -/* __ieee754_rem_pio2(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] - * use __kernel_rem_pio2() - */ - -#include "math.h" -#include "math_private.h" - -/* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi - */ -#ifdef __STDC__ -static const int32_t two_over_pi[] = { -#else -static int32_t two_over_pi[] = { -#endif -0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, -0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, -0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, -0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, -0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, -0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, -0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, -0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, -0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, -0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, -0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, -}; - -#ifdef __STDC__ -static const int32_t npio2_hw[] = { -#else -static int32_t npio2_hw[] = { -#endif -0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, -0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, -0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, -0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, -0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, -0x404858EB, 0x404921FB, -}; - -/* - * invpio2: 53 bits of 2/pi - * pio2_1: first 33 bit of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 33 bit of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 33 bit of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ - -#ifdef __STDC__ -static const double -#else -static double -#endif -zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ -half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ -invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ -pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ -pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ -pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ -pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ -pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ -pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ - -#ifdef __STDC__ - int32_t __ieee754_rem_pio2(double x, double *y) -#else - int32_t __ieee754_rem_pio2(x,y) - double x,y[]; -#endif -{ - double z,w,t,r,fn; - double tx[3]; - int32_t e0,i,j,nx,n,ix,hx; - u_int32_t low; - - GET_HIGH_WORD(hx,x); /* high word of x */ - ix = hx&0x7fffffff; - if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ - {y[0] = x; y[1] = 0; return 0;} - if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { - z = x - pio2_1; - if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z - pio2_1t; - y[1] = (z-y[0])-pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z-y[0])-pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z + pio2_1t; - y[1] = (z-y[0])+pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z-y[0])+pio2_2t; - } - return -1; - } - } - if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ - t = fabs(x); - n = (int32_t) (t*invpio2+half); - fn = (double)n; - r = t-fn*pio2_1; - w = fn*pio2_1t; /* 1st round good to 85 bit */ - if(n<32&&ix!=npio2_hw[n-1]) { - y[0] = r-w; /* quick check no cancellation */ - } else { - u_int32_t high; - j = ix>>20; - y[0] = r-w; - GET_HIGH_WORD(high,y[0]); - i = j-((high>>20)&0x7ff); - if(i>16) { /* 2nd iteration needed, good to 118 */ - t = r; - w = fn*pio2_2; - r = t-w; - w = fn*pio2_2t-((t-r)-w); - y[0] = r-w; - GET_HIGH_WORD(high,y[0]); - i = j-((high>>20)&0x7ff); - if(i>49) { /* 3rd iteration need, 151 bits acc */ - t = r; /* will cover all possible cases */ - w = fn*pio2_3; - r = t-w; - w = fn*pio2_3t-((t-r)-w); - y[0] = r-w; - } - } - } - y[1] = (r-y[0])-w; - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - else return n; - } - /* - * all other (large) arguments - */ - if(ix>=0x7ff00000) { /* x is inf or NaN */ - y[0]=y[1]=x-x; return 0; - } - /* set z = scalbn(|x|,ilogb(x)-23) */ - GET_LOW_WORD(low,x); - SET_LOW_WORD(z,low); - e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ - SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20))); - for(i=0;i<2;i++) { - tx[i] = (double)((int32_t)(z)); - z = (z-tx[i])*two24; - } - tx[2] = z; - nx = 3; - while(tx[nx-1]==zero) nx--; /* skip zero term */ - n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - return n; -} diff --git a/sysdeps/libm-ieee754/e_rem_pio2f.c b/sysdeps/libm-ieee754/e_rem_pio2f.c deleted file mode 100644 index 4b8c4466bd..0000000000 --- a/sysdeps/libm-ieee754/e_rem_pio2f.c +++ /dev/null @@ -1,196 +0,0 @@ -/* e_rem_pio2f.c -- float version of e_rem_pio2.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_rem_pio2f.c,v 1.5 1995/05/10 20:46:03 jtc Exp $"; -#endif - -/* __ieee754_rem_pio2f(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] - * use __kernel_rem_pio2f() - */ - -#include "math.h" -#include "math_private.h" - -/* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi - */ -#ifdef __STDC__ -static const int32_t two_over_pi[] = { -#else -static int32_t two_over_pi[] = { -#endif -0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, -0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, -0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, -0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, -0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, -0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, -0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, -0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, -0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, -0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, -0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, -0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, -0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, -0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, -0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, -0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, -0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, -0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, -0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, -0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, -0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, -0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, -}; - -/* This array is like the one in e_rem_pio2.c, but the numbers are - single precision and the last 8 bits are forced to 0. */ -#ifdef __STDC__ -static const int32_t npio2_hw[] = { -#else -static int32_t npio2_hw[] = { -#endif -0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, -0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, -0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, -0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, -0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, -0x4242c700, 0x42490f00 -}; - -/* - * invpio2: 24 bits of 2/pi - * pio2_1: first 17 bit of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 17 bit of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 17 bit of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ - -#ifdef __STDC__ -static const float -#else -static float -#endif -zero = 0.0000000000e+00, /* 0x00000000 */ -half = 5.0000000000e-01, /* 0x3f000000 */ -two8 = 2.5600000000e+02, /* 0x43800000 */ -invpio2 = 6.3661980629e-01, /* 0x3f22f984 */ -pio2_1 = 1.5707855225e+00, /* 0x3fc90f80 */ -pio2_1t = 1.0804334124e-05, /* 0x37354443 */ -pio2_2 = 1.0804273188e-05, /* 0x37354400 */ -pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */ -pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */ -pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ - -#ifdef __STDC__ - int32_t __ieee754_rem_pio2f(float x, float *y) -#else - int32_t __ieee754_rem_pio2f(x,y) - float x,y[]; -#endif -{ - float z,w,t,r,fn; - float tx[3]; - int32_t e0,i,j,nx,n,ix,hx; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ - {y[0] = x; y[1] = 0; return 0;} - if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { - z = x - pio2_1; - if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ - y[0] = z - pio2_1t; - y[1] = (z-y[0])-pio2_1t; - } else { /* near pi/2, use 24+24+24 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z-y[0])-pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ - y[0] = z + pio2_1t; - y[1] = (z-y[0])+pio2_1t; - } else { /* near pi/2, use 24+24+24 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z-y[0])+pio2_2t; - } - return -1; - } - } - if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ - t = fabsf(x); - n = (int32_t) (t*invpio2+half); - fn = (float)n; - r = t-fn*pio2_1; - w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&(int32_t)(ix&0xffffff00)!=npio2_hw[n-1]) { - y[0] = r-w; /* quick check no cancellation */ - } else { - u_int32_t high; - j = ix>>23; - y[0] = r-w; - GET_FLOAT_WORD(high,y[0]); - i = j-((high>>23)&0xff); - if(i>8) { /* 2nd iteration needed, good to 57 */ - t = r; - w = fn*pio2_2; - r = t-w; - w = fn*pio2_2t-((t-r)-w); - y[0] = r-w; - GET_FLOAT_WORD(high,y[0]); - i = j-((high>>23)&0xff); - if(i>25) { /* 3rd iteration need, 74 bits acc */ - t = r; /* will cover all possible cases */ - w = fn*pio2_3; - r = t-w; - w = fn*pio2_3t-((t-r)-w); - y[0] = r-w; - } - } - } - y[1] = (r-y[0])-w; - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - else return n; - } - /* - * all other (large) arguments - */ - if(ix>=0x7f800000) { /* x is inf or NaN */ - y[0]=y[1]=x-x; return 0; - } - /* set z = scalbn(|x|,ilogb(x)-7) */ - e0 = (ix>>23)-134; /* e0 = ilogb(z)-7; */ - SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23))); - for(i=0;i<2;i++) { - tx[i] = (float)((int32_t)(z)); - z = (z-tx[i])*two8; - } - tx[2] = z; - nx = 3; - while(tx[nx-1]==zero) nx--; /* skip zero term */ - n = __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi); - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - return n; -} diff --git a/sysdeps/libm-ieee754/e_remainder.c b/sysdeps/libm-ieee754/e_remainder.c deleted file mode 100644 index 6418081182..0000000000 --- a/sysdeps/libm-ieee754/e_remainder.c +++ /dev/null @@ -1,80 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_remainder.c,v 1.8 1995/05/10 20:46:05 jtc Exp $"; -#endif - -/* __ieee754_remainder(x,p) - * 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 : - * Based on fmod() return x-[x/p]chopped*p exactlp. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif - - -#ifdef __STDC__ - double __ieee754_remainder(double x, double p) -#else - double __ieee754_remainder(x,p) - double x,p; -#endif -{ - int32_t hx,hp; - u_int32_t sx,lx,lp; - double p_half; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hp,lp,p); - sx = hx&0x80000000; - hp &= 0x7fffffff; - hx &= 0x7fffffff; - - /* purge off exception values */ - if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */ - if((hx>=0x7ff00000)|| /* x not finite */ - ((hp>=0x7ff00000)&& /* p is NaN */ - (((hp-0x7ff00000)|lp)!=0))) - return (x*p)/(x*p); - - - if (hp<=0x7fdfffff) x = __ieee754_fmod(x,p+p); /* now x < 2p */ - if (((hx-hp)|(lx-lp))==0) return zero*x; - x = fabs(x); - p = fabs(p); - if (hp<0x00200000) { - if(x+x>p) { - x-=p; - if(x+x>=p) x -= p; - } - } else { - p_half = 0.5*p; - if(x>p_half) { - x-=p; - if(x>=p_half) x -= p; - } - } - GET_HIGH_WORD(hx,x); - SET_HIGH_WORD(x,hx^sx); - return x; -} diff --git a/sysdeps/libm-ieee754/e_remainderf.c b/sysdeps/libm-ieee754/e_remainderf.c deleted file mode 100644 index 90d0d366d4..0000000000 --- a/sysdeps/libm-ieee754/e_remainderf.c +++ /dev/null @@ -1,73 +0,0 @@ -/* e_remainderf.c -- float version of e_remainder.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 -{ - int32_t hx,hp; - u_int32_t sx; - float p_half; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hp,p); - sx = hx&0x80000000; - hp &= 0x7fffffff; - hx &= 0x7fffffff; - - /* purge off exception values */ - 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); - - - if (hp<=0x7effffff) x = __ieee754_fmodf(x,p+p); /* now x < 2p */ - if ((hx-hp)==0) return zero*x; - x = fabsf(x); - p = fabsf(p); - if (hp<0x01000000) { - if(x+x>p) { - x-=p; - if(x+x>=p) x -= p; - } - } else { - p_half = (float)0.5*p; - if(x>p_half) { - x-=p; - if(x>=p_half) x -= p; - } - } - GET_FLOAT_WORD(hx,x); - SET_FLOAT_WORD(x,hx^sx); - return x; -} diff --git a/sysdeps/libm-ieee754/e_remainderl.c b/sysdeps/libm-ieee754/e_remainderl.c deleted file mode 100644 index e721a6e8cd..0000000000 --- a/sysdeps/libm-ieee754/e_remainderl.c +++ /dev/null @@ -1,83 +0,0 @@ -/* e_remainderl.c -- long double version of e_remainder.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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) - * integer nearest x/p (in half way case choose the even one). - * Method : - * Based on fmod() return x-[x/p]chopped*p exactlp. - */ - -#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 -{ - u_int32_t sx,sex,sep,x0,x1,p0,p1; - long double p_half; - - GET_LDOUBLE_WORDS(sex,x0,x1,x); - GET_LDOUBLE_WORDS(sep,p0,p1,p); - sx = sex&0x8000; - sep &= 0x7fff; - sex &= 0x7fff; - - /* purge off exception values */ - 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))) - return (x*p)/(x*p); - - - if (sep<0x7ffe) x = __ieee754_fmodl(x,p+p); /* now x < 2p */ - if (((sex-sep)|(x0-p0)|(x1-p1))==0) return zero*x; - x = fabsl(x); - p = fabsl(p); - if (sep<0x0002) { - if(x+x>p) { - x-=p; - if(x+x>=p) x -= p; - } - } else { - p_half = 0.5*p; - if(x>p_half) { - x-=p; - if(x>=p_half) x -= p; - } - } - GET_LDOUBLE_EXP(sex,x); - SET_LDOUBLE_EXP(x,sex^sx); - return x; -} diff --git a/sysdeps/libm-ieee754/e_scalb.c b/sysdeps/libm-ieee754/e_scalb.c deleted file mode 100644 index d9a326b2b2..0000000000 --- a/sysdeps/libm-ieee754/e_scalb.c +++ /dev/null @@ -1,59 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * __ieee754_scalb(x, fn) is provide for - * passing various standard test suite. One - * should use scalbn() instead. - */ - -#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 -{ -#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)) - return __nan (""); - else return x/(-fn); - } - if (__rint(fn)!=fn) return __nan (""); - if ( fn > 65000.0) return __scalbn(x, 65000); - if (-fn > 65000.0) return __scalbn(x,-65000); - return __scalbn(x,(int)fn); -#endif -} diff --git a/sysdeps/libm-ieee754/e_scalbf.c b/sysdeps/libm-ieee754/e_scalbf.c deleted file mode 100644 index f51057e7b4..0000000000 --- a/sysdeps/libm-ieee754/e_scalbf.c +++ /dev/null @@ -1,56 +0,0 @@ -/* e_scalbf.c -- float version of e_scalb.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -#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 -{ -#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)) - return __nanf (""); - else return x/(-fn); - } - if (__rintf(fn)!=fn) 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 -} diff --git a/sysdeps/libm-ieee754/e_scalbl.c b/sysdeps/libm-ieee754/e_scalbl.c deleted file mode 100644 index dccc876c85..0000000000 --- a/sysdeps/libm-ieee754/e_scalbl.c +++ /dev/null @@ -1,63 +0,0 @@ -/* e_scalbl.c -- long double version of s_scalb.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * __ieee754_scalbl(x, fn) is provide for - * passing various standard test suite. One - * should use scalbnl() instead. - */ - -#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 -{ -#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)) - return __nanl (""); - else return x/(-fn); - } - if (__rintl(fn)!=fn) return __nanl (""); - if ( fn > 65000.0) return __scalbnl(x, 65000); - if (-fn > 65000.0) return __scalbnl(x,-65000); - return __scalbnl(x,(int)fn); -#endif -} diff --git a/sysdeps/libm-ieee754/e_sinh.c b/sysdeps/libm-ieee754/e_sinh.c deleted file mode 100644 index 1701b9bb67..0000000000 --- a/sysdeps/libm-ieee754/e_sinh.c +++ /dev/null @@ -1,86 +0,0 @@ -/* @(#)e_sinh.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. - * ==================================================== - */ - -#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) - * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(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) - * - * Special cases: - * sinh(x) is |x| if x is +INF, -INF, or NaN. - * only sinh(0)=0 is exact for finite x. - */ - -#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 t,w,h; - int32_t ix,jx; - u_int32_t lx; - - /* High word of |x|. */ - GET_HIGH_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7ff00000) 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 */ - t = __expm1(fabs(x)); - if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one)); - return h*(t+t/(t+one)); - } - - /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x40862e42) return h*__ieee754_exp(fabs(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - GET_LOW_WORD(lx,x); - if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { - w = __ieee754_exp(0.5*fabs(x)); - t = h*w; - return t*w; - } - - /* |x| > overflowthresold, sinh(x) overflow */ - return x*shuge; -} diff --git a/sysdeps/libm-ieee754/e_sinhf.c b/sysdeps/libm-ieee754/e_sinhf.c deleted file mode 100644 index 045f6f121e..0000000000 --- a/sysdeps/libm-ieee754/e_sinhf.c +++ /dev/null @@ -1,68 +0,0 @@ -/* e_sinhf.c -- float version of e_sinh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 t,w,h; - int32_t ix,jx; - - GET_FLOAT_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7f800000) 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(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)); - return h*(t+t/(t+one)); - } - - /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x42b17180) return h*__ieee754_expf(fabsf(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ix<=0x42b2d4fc) { - w = __ieee754_expf((float)0.5*fabsf(x)); - t = h*w; - return t*w; - } - - /* |x| > overflowthresold, sinh(x) overflow */ - return x*shuge; -} diff --git a/sysdeps/libm-ieee754/e_sinhl.c b/sysdeps/libm-ieee754/e_sinhl.c deleted file mode 100644 index 4f9cfe2c38..0000000000 --- a/sysdeps/libm-ieee754/e_sinhl.c +++ /dev/null @@ -1,91 +0,0 @@ -/* e_asinhl.c -- long double version of e_asinh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* __ieee754_sinhl(x) - * Method : - * 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) - * 0 <= x <= 25 : sinhl(x) := --------------, E=expm1l(x) - * 2 - * - * 25 <= x <= lnovft : sinhl(x) := expl(x)/2 - * lnovft <= x <= ln2ovft: sinhl(x) := expl(x/2)/2 * expl(x/2) - * ln2ovft < x : sinhl(x) := x*shuge (overflow) - * - * Special cases: - * sinhl(x) is |x| if x is +INF, -INF, or NaN. - * only sinhl(0)=0 is exact for finite x. - */ - -#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 t,w,h; - u_int32_t jx,ix,i0,i1; - - /* Words of |x|. */ - GET_LDOUBLE_WORDS(jx,i0,i1,x); - ix = jx&0x7fff; - - /* x is INF or NaN */ - if(ix==0x7fff) 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<0x3fe3) /* |x|<2**-28 */ - 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)); - return h*(t+t/(t+one)); - } - - /* |x| in [25, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x400c || (ix == 0x400c && i0 < 0xb17217f7)) - return h*__ieee754_expl(fabsl(x)); - - /* |x| in [log(maxdouble), overflowthreshold] */ - if (ix<0x400c || (ix == 0x400c && (i0 < 0xb174ddc0 - || (i0 == 0xb174ddc0 - && i1 <= 0x31aec0ea)))) { - w = __ieee754_expl(0.5*fabsl(x)); - t = h*w; - return t*w; - } - - /* |x| > overflowthreshold, sinhl(x) overflow */ - return x*shuge; -} diff --git a/sysdeps/libm-ieee754/e_sqrt.c b/sysdeps/libm-ieee754/e_sqrt.c deleted file mode 100644 index 67da5455f9..0000000000 --- a/sysdeps/libm-ieee754/e_sqrt.c +++ /dev/null @@ -1,452 +0,0 @@ -/* @(#)e_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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_sqrt.c,v 1.8 1995/05/10 20:46:17 jtc Exp $"; -#endif - -/* __ieee754_sqrt(x) - * Return correctly rounded sqrt. - * ------------------------------------------ - * | Use the hardware sqrt if you have one | - * ------------------------------------------ - * Method: - * Bit by bit method using integer arithmetic. (Slow, but portable) - * 1. Normalization - * Scale x to y in [1,4) with even powers of 2: - * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then - * sqrt(x) = 2^k * sqrt(y) - * 2. Bit by bit computation - * Let q = sqrt(y) truncated to i bit after binary point (q = 1), - * i 0 - * i+1 2 - * s = 2*q , and y = 2 * ( y - q ). (1) - * i i i i - * - * To compute q from q , one checks whether - * i+1 i - * - * -(i+1) 2 - * (q + 2 ) <= y. (2) - * i - * -(i+1) - * If (2) is false, then q = q ; otherwise q = q + 2 . - * i+1 i i+1 i - * - * With some algebraic manipulation, it is not difficult to see - * that (2) is equivalent to - * -(i+1) - * s + 2 <= y (3) - * i i - * - * The advantage of (3) is that s and y can be computed by - * i i - * the following recurrence formula: - * if (3) is false - * - * s = s , y = y ; (4) - * i+1 i i+1 i - * - * otherwise, - * -i -(i+1) - * s = s + 2 , y = y - s - 2 (5) - * i+1 i i+1 i i - * - * One may easily use induction to prove (4) and (5). - * Note. Since the left hand side of (3) contain only i+2 bits, - * it does not necessary to do a full (53-bit) comparison - * in (3). - * 3. Final rounding - * After generating the 53 bits result, we compute one more bit. - * Together with the remainder, we can decide whether the - * result is exact, bigger than 1/2ulp, or less than 1/2ulp - * (it will never equal to 1/2ulp). - * The rounding mode can be detected by checking whether - * huge + tiny is equal to huge, and whether huge - tiny is - * equal to huge for some floating point number "huge" and "tiny". - * - * Special cases: - * sqrt(+-0) = +-0 ... exact - * sqrt(inf) = inf - * sqrt(-ve) = NaN ... with invalid signal - * sqrt(NaN) = NaN ... with invalid signal for signaling NaN - * - * Other methods : see the appended file at the end of the program below. - *--------------- - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double one = 1.0, tiny=1.0e-300; -#else -static double one = 1.0, tiny=1.0e-300; -#endif - -#ifdef __STDC__ - double __ieee754_sqrt(double x) -#else - double __ieee754_sqrt(x) - double x; -#endif -{ - double z; - int32_t sign = (int)0x80000000; - int32_t ix0,s0,q,m,t,i; - u_int32_t r,t1,s1,ix1,q1; - - EXTRACT_WORDS(ix0,ix1,x); - - /* take care of Inf and NaN */ - if((ix0&0x7ff00000)==0x7ff00000) { - return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - } - /* take care of zero */ - if(ix0<=0) { - if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ - else if(ix0<0) - return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ - } - /* normalize x */ - m = (ix0>>20); - if(m==0) { /* subnormal x */ - while(ix0==0) { - m -= 21; - ix0 |= (ix1>>11); ix1 <<= 21; - } - for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; - m -= i-1; - ix0 |= (ix1>>(32-i)); - ix1 <<= i; - } - m -= 1023; /* unbias exponent */ - ix0 = (ix0&0x000fffff)|0x00100000; - if(m&1){ /* odd m, double x to make it even */ - ix0 += ix0 + ((ix1&sign)>>31); - ix1 += ix1; - } - m >>= 1; /* m = [m/2] */ - - /* generate sqrt(x) bit by bit */ - ix0 += ix0 + ((ix1&sign)>>31); - ix1 += ix1; - q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ - r = 0x00200000; /* r = moving bit from right to left */ - - while(r!=0) { - t = s0+r; - if(t<=ix0) { - s0 = t+r; - ix0 -= t; - q += r; - } - ix0 += ix0 + ((ix1&sign)>>31); - ix1 += ix1; - r>>=1; - } - - r = sign; - while(r!=0) { - t1 = s1+r; - t = s0; - if((t>31); - ix1 += ix1; - r>>=1; - } - - /* use floating add to find out rounding direction */ - if((ix0|ix1)!=0) { - z = one-tiny; /* trigger inexact flag */ - if (z>=one) { - z = one+tiny; - if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;} - else if (z>one) { - if (q1==(u_int32_t)0xfffffffe) q+=1; - q1+=2; - } else - q1 += (q1&1); - } - } - ix0 = (q>>1)+0x3fe00000; - ix1 = q1>>1; - if ((q&1)==1) ix1 |= sign; - ix0 += (m <<20); - INSERT_WORDS(z,ix0,ix1); - return z; -} - -/* -Other methods (use floating-point arithmetic) -------------- -(This is a copy of a drafted paper by Prof W. Kahan -and K.C. Ng, written in May, 1986) - - Two algorithms are given here to implement sqrt(x) - (IEEE double precision arithmetic) in software. - Both supply sqrt(x) correctly rounded. The first algorithm (in - Section A) uses newton iterations and involves four divisions. - The second one uses reciproot iterations to avoid division, but - requires more multiplications. Both algorithms need the ability - to chop results of arithmetic operations instead of round them, - and the INEXACT flag to indicate when an arithmetic operation - is executed exactly with no roundoff error, all part of the - standard (IEEE 754-1985). The ability to perform shift, add, - subtract and logical AND operations upon 32-bit words is needed - too, though not part of the standard. - -A. sqrt(x) by Newton Iteration - - (1) Initial approximation - - Let x0 and x1 be the leading and the trailing 32-bit words of - a floating point number x (in IEEE double format) respectively - - 1 11 52 ...widths - ------------------------------------------------------ - x: |s| e | f | - ------------------------------------------------------ - msb lsb msb lsb ...order - - - ------------------------ ------------------------ - x0: |s| e | f1 | x1: | f2 | - ------------------------ ------------------------ - - By performing shifts and subtracts on x0 and x1 (both regarded - as integers), we obtain an 8-bit approximation of sqrt(x) as - follows. - - k := (x0>>1) + 0x1ff80000; - y0 := k - T1[31&(k>>15)]. ... y ~ sqrt(x) to 8 bits - Here k is a 32-bit integer and T1[] is an integer array containing - correction terms. Now magically the floating value of y (y's - leading 32-bit word is y0, the value of its trailing word is 0) - approximates sqrt(x) to almost 8-bit. - - Value of T1: - static int T1[32]= { - 0, 1024, 3062, 5746, 9193, 13348, 18162, 23592, - 29598, 36145, 43202, 50740, 58733, 67158, 75992, 85215, - 83599, 71378, 60428, 50647, 41945, 34246, 27478, 21581, - 16499, 12183, 8588, 5674, 3403, 1742, 661, 130,}; - - (2) Iterative refinement - - Apply Heron's rule three times to y, we have y approximates - sqrt(x) to within 1 ulp (Unit in the Last Place): - - y := (y+x/y)/2 ... almost 17 sig. bits - y := (y+x/y)/2 ... almost 35 sig. bits - y := y-(y-x/y)/2 ... within 1 ulp - - - Remark 1. - Another way to improve y to within 1 ulp is: - - y := (y+x/y) ... almost 17 sig. bits to 2*sqrt(x) - y := y - 0x00100006 ... almost 18 sig. bits to sqrt(x) - - 2 - (x-y )*y - y := y + 2* ---------- ...within 1 ulp - 2 - 3y + x - - - This formula has one division fewer than the one above; however, - it requires more multiplications and additions. Also x must be - scaled in advance to avoid spurious overflow in evaluating the - expression 3y*y+x. Hence it is not recommended uless division - is slow. If division is very slow, then one should use the - reciproot algorithm given in section B. - - (3) Final adjustment - - By twiddling y's last bit it is possible to force y to be - correctly rounded according to the prevailing rounding mode - as follows. Let r and i be copies of the rounding mode and - inexact flag before entering the square root program. Also we - use the expression y+-ulp for the next representable floating - numbers (up and down) of y. Note that y+-ulp = either fixed - point y+-1, or multiply y by nextafter(1,+-inf) in chopped - mode. - - I := FALSE; ... reset INEXACT flag I - R := RZ; ... set rounding mode to round-toward-zero - z := x/y; ... chopped quotient, possibly inexact - If(not I) then { ... if the quotient is exact - if(z=y) { - I := i; ... restore inexact flag - R := r; ... restore rounded mode - return sqrt(x):=y. - } else { - z := z - ulp; ... special rounding - } - } - i := TRUE; ... sqrt(x) is inexact - If (r=RN) then z=z+ulp ... rounded-to-nearest - If (r=RP) then { ... round-toward-+inf - y = y+ulp; z=z+ulp; - } - y := y+z; ... chopped sum - y0:=y0-0x00100000; ... y := y/2 is correctly rounded. - I := i; ... restore inexact flag - R := r; ... restore rounded mode - return sqrt(x):=y. - - (4) Special cases - - Square root of +inf, +-0, or NaN is itself; - Square root of a negative number is NaN with invalid signal. - - -B. sqrt(x) by Reciproot Iteration - - (1) Initial approximation - - Let x0 and x1 be the leading and the trailing 32-bit words of - a floating point number x (in IEEE double format) respectively - (see section A). By performing shifs and subtracts on x0 and y0, - we obtain a 7.8-bit approximation of 1/sqrt(x) as follows. - - k := 0x5fe80000 - (x0>>1); - y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits - - Here k is a 32-bit integer and T2[] is an integer array - containing correction terms. Now magically the floating - value of y (y's leading 32-bit word is y0, the value of - its trailing word y1 is set to zero) approximates 1/sqrt(x) - to almost 7.8-bit. - - Value of T2: - static int T2[64]= { - 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866, - 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f, - 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d, - 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0, - 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989, - 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd, - 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e, - 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd,}; - - (2) Iterative refinement - - Apply Reciproot iteration three times to y and multiply the - result by x to get an approximation z that matches sqrt(x) - to about 1 ulp. To be exact, we will have - -1ulp < sqrt(x)-z<1.0625ulp. - - ... set rounding mode to Round-to-nearest - y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x) - y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x) - ... special arrangement for better accuracy - z := x*y ... 29 bits to sqrt(x), with z*y<1 - z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x) - - Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that - (a) the term z*y in the final iteration is always less than 1; - (b) the error in the final result is biased upward so that - -1 ulp < sqrt(x) - z < 1.0625 ulp - instead of |sqrt(x)-z|<1.03125ulp. - - (3) Final adjustment - - By twiddling y's last bit it is possible to force y to be - correctly rounded according to the prevailing rounding mode - as follows. Let r and i be copies of the rounding mode and - inexact flag before entering the square root program. Also we - use the expression y+-ulp for the next representable floating - numbers (up and down) of y. Note that y+-ulp = either fixed - point y+-1, or multiply y by nextafter(1,+-inf) in chopped - mode. - - R := RZ; ... set rounding mode to round-toward-zero - switch(r) { - case RN: ... round-to-nearest - if(x<= z*(z-ulp)...chopped) z = z - ulp; else - if(x<= z*(z+ulp)...chopped) z = z; else z = z+ulp; - break; - case RZ:case RM: ... round-to-zero or round-to--inf - R:=RP; ... reset rounding mod to round-to-+inf - if(x=(z+ulp)*(z+ulp) ...rounded up) z = z+ulp; - break; - case RP: ... round-to-+inf - if(x>(z+ulp)*(z+ulp)...chopped) z = z+2*ulp; else - if(x>z*z ...chopped) z = z+ulp; - break; - } - - Remark 3. The above comparisons can be done in fixed point. For - example, to compare x and w=z*z chopped, it suffices to compare - x1 and w1 (the trailing parts of x and w), regarding them as - two's complement integers. - - ...Is z an exact square root? - To determine whether z is an exact square root of x, let z1 be the - trailing part of z, and also let x0 and x1 be the leading and - trailing parts of x. - - If ((z1&0x03ffffff)!=0) ... not exact if trailing 26 bits of z!=0 - I := 1; ... Raise Inexact flag: z is not exact - else { - j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2 - k := z1 >> 26; ... get z's 25-th and 26-th - fraction bits - I := i or (k&j) or ((k&(j+j+1))!=(x1&3)); - } - R:= r ... restore rounded mode - return sqrt(x):=z. - - If multiplication is cheaper then the foregoing red tape, the - Inexact flag can be evaluated by - - I := i; - I := (z*z!=x) or I. - - Note that z*z can overwrite I; this value must be sensed if it is - True. - - Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be - zero. - - -------------------- - z1: | f2 | - -------------------- - bit 31 bit 0 - - Further more, bit 27 and 26 of z1, bit 0 and 1 of x1, and the odd - or even of logb(x) have the following relations: - - ------------------------------------------------- - bit 27,26 of z1 bit 1,0 of x1 logb(x) - ------------------------------------------------- - 00 00 odd and even - 01 01 even - 10 10 odd - 10 00 even - 11 01 even - ------------------------------------------------- - - (4) Special cases (see (4) of Section A). - - */ diff --git a/sysdeps/libm-ieee754/e_sqrtf.c b/sysdeps/libm-ieee754/e_sqrtf.c deleted file mode 100644 index 7648ef4bca..0000000000 --- a/sysdeps/libm-ieee754/e_sqrtf.c +++ /dev/null @@ -1,97 +0,0 @@ -/* e_sqrtf.c -- float version of e_sqrt.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 z; - 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) { - 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 */ - else if(ix<0) - return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ - } - /* normalize x */ - m = (ix>>23); - if(m==0) { /* subnormal x */ - for(i=0;(ix&0x00800000)==0;i++) ix<<=1; - m -= i-1; - } - m -= 127; /* unbias exponent */ - ix = (ix&0x007fffff)|0x00800000; - if(m&1) /* odd m, double x to make it even */ - ix += ix; - m >>= 1; /* m = [m/2] */ - - /* generate sqrt(x) bit by bit */ - ix += ix; - q = s = 0; /* q = sqrt(x) */ - 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; - } - ix += ix; - r>>=1; - } - - /* use floating add to find out rounding direction */ - if(ix!=0) { - z = one-tiny; /* trigger inexact flag */ - if (z>=one) { - z = one+tiny; - if (z>one) - q += 2; - else - q += (q&1); - } - } - ix = (q>>1)+0x3f000000; - ix += (m <<23); - SET_FLOAT_WORD(z,ix); - return z; -} diff --git a/sysdeps/libm-ieee754/k_cos.c b/sysdeps/libm-ieee754/k_cos.c deleted file mode 100644 index 7e38ef7915..0000000000 --- a/sysdeps/libm-ieee754/k_cos.c +++ /dev/null @@ -1,107 +0,0 @@ -/* @(#)k_cos.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_cos.c,v 1.8 1995/05/10 20:46:22 jtc Exp $"; -#endif - -/* - * __kernel_cos( x, y ) - * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * - * Algorithm - * 1. Since cos(-x) = cos(x), we need only to consider positive x. - * 2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0. - * 3. cos(x) is approximated by a polynomial of degree 14 on - * [0,pi/4] - * 4 14 - * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x - * where the remez error is - * - * | 2 4 6 8 10 12 14 | -58 - * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 - * | | - * - * 4 6 8 10 12 14 - * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then - * cos(x) = 1 - x*x/2 + r - * since cos(x+y) ~ cos(x) - sin(x)*y - * ~ cos(x) - x*y, - * a correction term is necessary in cos(x) and hence - * cos(x+y) = 1 - (x*x/2 - (r - x*y)) - * For better accuracy when x > 0.3, let qx = |x|/4 with - * the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125. - * Then - * cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)). - * Note that 1-qx and (x*x/2-qx) is EXACT here, and the - * magnitude of the latter is at least a quarter of x*x/2, - * thus, reducing the rounding error in the subtraction. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -C[] = { - 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ - 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ - -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ - 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ - -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ - 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ - -1.13596475577881948265e-11}; /* 0xBDA8FAE9, 0xBE8838D4 */ - -#ifdef __STDC__ - double __kernel_cos(double x, double y) -#else - double __kernel_cos(x, y) - double x,y; -#endif -{ - double a,hz,z,r,qx,r1,r2,r3,z1,z2,z3; - int32_t ix; - z = x*x; - GET_HIGH_WORD(ix,x); - ix &= 0x7fffffff; /* ix = |x|'s high word*/ - if(ix<0x3e400000) { /* if x < 2**27 */ - if(((int)x)==0) return C[0]; /* generate inexact */ - } -#ifdef DO_NOT_USE_THIS - r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); -#else - r1=z*C[6];r1=r1+C[5];z1=z*z; - r2=z*C[4];r2=r2+C[3];z2=z1*z; - r3=z*C[2];r3=r3+C[1];z3=z2*z1; - r=z3*r1+z2*r2+z*r3; -#endif - if(ix < 0x3FD33333) /* if |x| < 0.3 */ - return C[0] - (0.5*z - (z*r - x*y)); - else { - if(ix > 0x3fe90000) { /* x > 0.78125 */ - qx = 0.28125; - } else { - INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */ - } - hz = 0.5*z-qx; - a = C[0]-qx; - return a - (hz - (z*r-x*y)); - } -} diff --git a/sysdeps/libm-ieee754/k_cosf.c b/sysdeps/libm-ieee754/k_cosf.c deleted file mode 100644 index b232cab11f..0000000000 --- a/sysdeps/libm-ieee754/k_cosf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* k_cosf.c -- float version of k_cos.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_cosf.c,v 1.4 1995/05/10 20:46:23 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -one = 1.0000000000e+00, /* 0x3f800000 */ -C1 = 4.1666667908e-02, /* 0x3d2aaaab */ -C2 = -1.3888889225e-03, /* 0xbab60b61 */ -C3 = 2.4801587642e-05, /* 0x37d00d01 */ -C4 = -2.7557314297e-07, /* 0xb493f27c */ -C5 = 2.0875723372e-09, /* 0x310f74f6 */ -C6 = -1.1359647598e-11; /* 0xad47d74e */ - -#ifdef __STDC__ - float __kernel_cosf(float x, float y) -#else - float __kernel_cosf(x, y) - float x,y; -#endif -{ - float a,hz,z,r,qx; - int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* ix = |x|'s high word*/ - if(ix<0x32000000) { /* if x < 2**27 */ - if(((int)x)==0) return one; /* generate inexact */ - } - z = x*x; - r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3e99999a) /* if |x| < 0.3 */ - return one - ((float)0.5*z - (z*r - x*y)); - else { - if(ix > 0x3f480000) { /* x > 0.78125 */ - qx = (float)0.28125; - } else { - SET_FLOAT_WORD(qx,ix-0x01000000); /* x/4 */ - } - hz = (float)0.5*z-qx; - a = one-qx; - return a - (hz - (z*r-x*y)); - } -} diff --git a/sysdeps/libm-ieee754/k_rem_pio2.c b/sysdeps/libm-ieee754/k_rem_pio2.c deleted file mode 100644 index ccf1633bd4..0000000000 --- a/sysdeps/libm-ieee754/k_rem_pio2.c +++ /dev/null @@ -1,320 +0,0 @@ -/* @(#)k_rem_pio2.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $"; -#endif - -/* - * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) - * double x[],y[]; int e0,nx,prec; int ipio2[]; - * - * __kernel_rem_pio2 return the last three digits of N with - * y = x - N*pi/2 - * so that |y| < pi/2. - * - * The method is to compute the integer (mod 8) and fraction parts of - * (2/pi)*x without doing the full multiplication. In general we - * skip the part of the product that are known to be a huge integer ( - * more accurately, = 0 mod 8 ). Thus the number of operations are - * independent of the exponent of the input. - * - * (2/pi) is represented by an array of 24-bit integers in ipio2[]. - * - * Input parameters: - * x[] The input value (must be positive) is broken into nx - * pieces of 24-bit integers in double precision format. - * x[i] will be the i-th 24 bit of x. The scaled exponent - * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 - * match x's up to 24 bits. - * - * Example of breaking a double positive z into x[0]+x[1]+x[2]: - * e0 = ilogb(z)-23 - * z = scalbn(z,-e0) - * for i = 0,1,2 - * x[i] = floor(z) - * z = (z-x[i])*2**24 - * - * - * y[] ouput result in an array of double precision numbers. - * The dimension of y[] is: - * 24-bit precision 1 - * 53-bit precision 2 - * 64-bit precision 2 - * 113-bit precision 3 - * The actual value is the sum of them. Thus for 113-bit - * precision, one may have to do something like: - * - * long double t,w,r_head, r_tail; - * t = (long double)y[2] + (long double)y[1]; - * w = (long double)y[0]; - * r_head = t+w; - * r_tail = w - (r_head - t); - * - * e0 The exponent of x[0] - * - * nx dimension of x[] - * - * prec an integer indicating the precision: - * 0 24 bits (single) - * 1 53 bits (double) - * 2 64 bits (extended) - * 3 113 bits (quad) - * - * ipio2[] - * integer array, contains the (24*i)-th to (24*i+23)-th - * bit of 2/pi after binary point. The corresponding - * floating value is - * - * ipio2[i] * 2^(-24(i+1)). - * - * External function: - * double scalbn(), floor(); - * - * - * Here is the description of some local variables: - * - * jk jk+1 is the initial number of terms of ipio2[] needed - * in the computation. The recommended value is 2,3,4, - * 6 for single, double, extended,and quad. - * - * jz local integer variable indicating the number of - * terms of ipio2[] used. - * - * jx nx - 1 - * - * jv index for pointing to the suitable ipio2[] for the - * computation. In general, we want - * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 - * is an integer. Thus - * e0-3-24*jv >= 0 or (e0-3)/24 >= jv - * Hence jv = max(0,(e0-3)/24). - * - * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. - * - * q[] double array with integral value, representing the - * 24-bits chunk of the product of x and 2/pi. - * - * q0 the corresponding exponent of q[0]. Note that the - * exponent for q[i] would be q0-24*i. - * - * PIo2[] double precision array, obtained by cutting pi/2 - * into 24 bits chunks. - * - * f[] ipio2[] in floating point - * - * iq[] integer array by breaking up q[] in 24-bits chunk. - * - * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] - * - * ih integer. If >0 it indicates q[] is >= 0.5, hence - * it also indicates the *sign* of the result. - * - */ - - -/* - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ -#else -static int init_jk[] = {2,3,4,6}; -#endif - -#ifdef __STDC__ -static const double PIo2[] = { -#else -static double PIo2[] = { -#endif - 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ - 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ - 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ - 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ - 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ - 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ - 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ - 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ -}; - -#ifdef __STDC__ -static const double -#else -static double -#endif -zero = 0.0, -one = 1.0, -two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ -twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ - -#ifdef __STDC__ - int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) -#else - int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) - double x[], y[]; int e0,nx,prec; int32_t ipio2[]; -#endif -{ - int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - double z,fw,f[20],fq[20],q[20]; - - /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/24; if(jv<0) jv=0; - q0 = e0-24*(jv+1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; - } - - jz = jk; -recompute: - /* distill q[] into iq[] reversingly */ - for(i=0,j=jz,z=q[jz];j>0;i++,j--) { - fw = (double)((int32_t)(twon24* z)); - iq[i] = (int32_t)(z-two24*fw); - z = q[j-1]+fw; - } - - /* compute n */ - z = __scalbn(z,q0); /* actual value of z */ - z -= 8.0*__floor(z*0.125); /* trim off integer >= 8 */ - n = (int32_t) z; - z -= (double)n; - ih = 0; - if(q0>0) { /* need iq[jz-1] to determine n */ - i = (iq[jz-1]>>(24-q0)); n += i; - iq[jz-1] -= i<<(24-q0); - ih = iq[jz-1]>>(23-q0); - } - else if(q0==0) ih = iq[jz-1]>>23; - else if(z>=0.5) ih=2; - - if(ih>0) { /* q > 0.5 */ - n += 1; carry = 0; - for(i=0;i0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7fffff; break; - case 2: - iq[jz-1] &= 0x3fffff; break; - } - } - if(ih==2) { - z = one - z; - if(carry!=0) z -= __scalbn(one,q0); - } - } - - /* check if recomputation is needed */ - if(z==zero) { - j = 0; - for (i=jz-1;i>=jk;i--) j |= iq[i]; - if(j==0) { /* need recomputation */ - for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - - for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ - f[jx+i] = (double) ipio2[jv+i]; - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if(z==0.0) { - jz -= 1; q0 -= 24; - while(iq[jz]==0) { jz--; q0-=24;} - } else { /* break z into 24-bit if necessary */ - z = __scalbn(z,-q0); - if(z>=two24) { - fw = (double)((int32_t)(twon24*z)); - iq[jz] = (int32_t)(z-two24*fw); - jz += 1; q0 += 24; - iq[jz] = (int32_t) fw; - } else iq[jz] = (int32_t) z ; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = __scalbn(one,q0); - for(i=jz;i>=0;i--) { - q[i] = fw*(double)iq[i]; fw*=twon24; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz;i>=0;i--) { - for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } - - /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; - break; - case 3: /* painful */ - for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; - if(ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } - } - return n&7; -} diff --git a/sysdeps/libm-ieee754/k_rem_pio2f.c b/sysdeps/libm-ieee754/k_rem_pio2f.c deleted file mode 100644 index 2783480fcb..0000000000 --- a/sysdeps/libm-ieee754/k_rem_pio2f.c +++ /dev/null @@ -1,213 +0,0 @@ -/* k_rem_pio2f.c -- float version of k_rem_pio2.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_rem_pio2f.c,v 1.4 1995/05/10 20:46:28 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -/* In the float version, the input parameter x contains 8 bit - integers, not 24 bit integers. 113 bit precision is not supported. */ - -#ifdef __STDC__ -static const int init_jk[] = {4,7,9}; /* initial value for jk */ -#else -static int init_jk[] = {4,7,9}; -#endif - -#ifdef __STDC__ -static const float PIo2[] = { -#else -static float PIo2[] = { -#endif - 1.5703125000e+00, /* 0x3fc90000 */ - 4.5776367188e-04, /* 0x39f00000 */ - 2.5987625122e-05, /* 0x37da0000 */ - 7.5437128544e-08, /* 0x33a20000 */ - 6.0026650317e-11, /* 0x2e840000 */ - 7.3896444519e-13, /* 0x2b500000 */ - 5.3845816694e-15, /* 0x27c20000 */ - 5.6378512969e-18, /* 0x22d00000 */ - 8.3009228831e-20, /* 0x1fc40000 */ - 3.2756352257e-22, /* 0x1bc60000 */ - 6.3331015649e-25, /* 0x17440000 */ -}; - -#ifdef __STDC__ -static const float -#else -static float -#endif -zero = 0.0, -one = 1.0, -two8 = 2.5600000000e+02, /* 0x43800000 */ -twon8 = 3.9062500000e-03; /* 0x3b800000 */ - -#ifdef __STDC__ - int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2) -#else - int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) - float x[], y[]; int e0,nx,prec; int32_t ipio2[]; -#endif -{ - int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - float z,fw,f[20],fq[20],q[20]; - - /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/8; if(jv<0) jv=0; - q0 = e0-8*(jv+1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; - } - - jz = jk; -recompute: - /* distill q[] into iq[] reversingly */ - for(i=0,j=jz,z=q[jz];j>0;i++,j--) { - fw = (float)((int32_t)(twon8* z)); - iq[i] = (int32_t)(z-two8*fw); - z = q[j-1]+fw; - } - - /* compute n */ - z = __scalbnf(z,q0); /* actual value of z */ - z -= (float)8.0*__floorf(z*(float)0.125); /* trim off integer >= 8 */ - n = (int32_t) z; - z -= (float)n; - ih = 0; - if(q0>0) { /* need iq[jz-1] to determine n */ - i = (iq[jz-1]>>(8-q0)); n += i; - iq[jz-1] -= i<<(8-q0); - ih = iq[jz-1]>>(7-q0); - } - else if(q0==0) ih = iq[jz-1]>>8; - else if(z>=(float)0.5) ih=2; - - if(ih>0) { /* q > 0.5 */ - n += 1; carry = 0; - for(i=0;i0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7f; break; - case 2: - iq[jz-1] &= 0x3f; break; - } - } - if(ih==2) { - z = one - z; - if(carry!=0) z -= __scalbnf(one,q0); - } - } - - /* check if recomputation is needed */ - if(z==zero) { - j = 0; - for (i=jz-1;i>=jk;i--) j |= iq[i]; - if(j==0) { /* need recomputation */ - for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - - for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ - f[jx+i] = (float) ipio2[jv+i]; - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if(z==(float)0.0) { - jz -= 1; q0 -= 8; - while(iq[jz]==0) { jz--; q0-=8;} - } else { /* break z into 8-bit if necessary */ - z = __scalbnf(z,-q0); - if(z>=two8) { - fw = (float)((int32_t)(twon8*z)); - iq[jz] = (int32_t)(z-two8*fw); - jz += 1; q0 += 8; - iq[jz] = (int32_t) fw; - } else iq[jz] = (int32_t) z ; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = __scalbnf(one,q0); - for(i=jz;i>=0;i--) { - q[i] = fw*(float)iq[i]; fw*=twon8; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz;i>=0;i--) { - for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } - - /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; - break; - case 3: /* painful */ - for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; - if(ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } - } - return n&7; -} diff --git a/sysdeps/libm-ieee754/k_sin.c b/sysdeps/libm-ieee754/k_sin.c deleted file mode 100644 index 49c59228e0..0000000000 --- a/sysdeps/libm-ieee754/k_sin.c +++ /dev/null @@ -1,91 +0,0 @@ -/* @(#)k_sin.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_sin.c,v 1.8 1995/05/10 20:46:31 jtc Exp $"; -#endif - -/* __kernel_sin( x, y, iy) - * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). - * - * Algorithm - * 1. Since sin(-x) = -sin(x), we need only to consider positive x. - * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. - * 3. sin(x) is approximated by a polynomial of degree 13 on - * [0,pi/4] - * 3 13 - * sin(x) ~ x + S1*x + ... + S6*x - * where - * - * |sin(x) 2 4 6 8 10 12 | -58 - * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 - * | x | - * - * 4. sin(x+y) = sin(x) + sin'(x')*y - * ~ sin(x) + (1-x*x/2)*y - * For better accuracy, let - * 3 2 2 2 2 - * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) - * then 3 2 - * sin(x) = x + (S1*x + (x *(r-y/2)+y)) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -S[] = { - 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ - 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ - -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ - 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ - -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ - 1.58969099521155010221e-10}; /* 0x3DE5D93A, 0x5ACFD57C */ - -#ifdef __STDC__ - double __kernel_sin(double x, double y, int iy) -#else - double __kernel_sin(x, y, iy) - double x,y; int iy; /* iy=0 if y is zero */ -#endif -{ - double z,r,v,z1,r1,r2; - int32_t ix; - GET_HIGH_WORD(ix,x); - ix &= 0x7fffffff; /* high word of x */ - if(ix<0x3e400000) /* |x| < 2**-27 */ - {if((int)x==0) return x;} /* generate inexact */ - z = x*x; - v = z*x; -#ifdef DO_NOT_USE_THIS - r = S2+z*(S3+z*(S4+z*(S5+z*S6))); - if(iy==0) return x+v*(S1+z*r); - else return x-((z*(half*y-v*r)-y)-v*S1); -#else - r1 = S[5]+z*S[6]; z1 = z*z*z; - r2 = S[3]+z*S[4]; - r = S[2] + z*r2 + z1*r1; - if(iy==0) return x+v*(S[1]+z*r); - else return x-((z*(S[0]*y-v*r)-y)-v*S[1]); -#endif -} diff --git a/sysdeps/libm-ieee754/k_sinf.c b/sysdeps/libm-ieee754/k_sinf.c deleted file mode 100644 index 4fec15e830..0000000000 --- a/sysdeps/libm-ieee754/k_sinf.c +++ /dev/null @@ -1,54 +0,0 @@ -/* k_sinf.c -- float version of k_sin.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_sinf.c,v 1.4 1995/05/10 20:46:33 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -half = 5.0000000000e-01,/* 0x3f000000 */ -S1 = -1.6666667163e-01, /* 0xbe2aaaab */ -S2 = 8.3333337680e-03, /* 0x3c088889 */ -S3 = -1.9841270114e-04, /* 0xb9500d01 */ -S4 = 2.7557314297e-06, /* 0x3638ef1b */ -S5 = -2.5050759689e-08, /* 0xb2d72f34 */ -S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */ - -#ifdef __STDC__ - float __kernel_sinf(float x, float y, int iy) -#else - float __kernel_sinf(x, y, iy) - float x,y; int iy; /* iy=0 if y is zero */ -#endif -{ - float z,r,v; - int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* high word of x */ - if(ix<0x32000000) /* |x| < 2**-27 */ - {if((int)x==0) return x;} /* generate inexact */ - z = x*x; - v = z*x; - r = S2+z*(S3+z*(S4+z*(S5+z*S6))); - if(iy==0) return x+v*(S1+z*r); - else return x-((z*(half*y-v*r)-y)-v*S1); -} diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c deleted file mode 100644 index 22300652e9..0000000000 --- a/sysdeps/libm-ieee754/k_standard.c +++ /dev/null @@ -1,943 +0,0 @@ -/* @(#)k_standard.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" -#include - -#include - -#ifndef _USE_WRITE -#include /* fputs(), stderr */ -#define WRITE2(u,v) fputs(u, stderr) -#else /* !defined(_USE_WRITE) */ -#include /* write */ -#define WRITE2(u,v) write(2, u, v) -#undef fflush -#endif /* !defined(_USE_WRITE) */ - -/* XXX gcc versions until now don't delay the 0.0/0.0 division until - runtime but produce NaN at copile time. This is wrong since the - exceptions are not set correctly. */ -#if 0 && defined __STDC__ -static const double zero = 0.0; /* used as const */ -#else -static double zero = 0.0; /* used as const */ -#endif - -/* - * Standard conformance (non-IEEE) on exception cases. - * Mapping: - * 1 -- acos(|x|>1) - * 2 -- asin(|x|>1) - * 3 -- atan2(+-0,+-0) - * 4 -- hypot overflow - * 5 -- cosh overflow - * 6 -- exp overflow - * 7 -- exp underflow - * 8 -- y0(0) - * 9 -- y0(-ve) - * 10-- y1(0) - * 11-- y1(-ve) - * 12-- yn(0) - * 13-- yn(-ve) - * 14-- lgamma(finite) overflow - * 15-- lgamma(-integer) - * 16-- log(0) - * 17-- log(x<0) - * 18-- log10(0) - * 19-- log10(x<0) - * 20-- pow(0.0,0.0) - * 21-- pow(x,y) overflow - * 22-- pow(x,y) underflow - * 23-- pow(0,negative) - * 24-- pow(neg,non-integral) - * 25-- sinh(finite) overflow - * 26-- sqrt(negative) - * 27-- fmod(x,0) - * 28-- remainder(x,0) - * 29-- acosh(x<1) - * 30-- atanh(|x|>1) - * 31-- atanh(|x|=1) - * 32-- scalb overflow - * 33-- scalb underflow - * 34-- j0(|x|>X_TLOSS) - * 35-- y0(x>X_TLOSS) - * 36-- j1(|x|>X_TLOSS) - * 37-- y1(x>X_TLOSS) - * 38-- jn(|x|>X_TLOSS, n) - * 39-- yn(x>X_TLOSS, n) - * 40-- tgamma(finite) overflow - * 41-- tgamma(-integer) - * 42-- pow(NaN,0.0) - * 43-- +0**neg - * 44-- exp2 overflow - * 45-- exp2 underflow - * 46-- exp10 overflow - * 47-- exp10 underflow - */ - - -#ifdef __STDC__ - double __kernel_standard(double x, double y, int type) -#else - double __kernel_standard(x,y,type) - double x,y; int type; -#endif -{ - struct exception exc; -#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ -#define HUGE_VAL inf - double inf = 0.0; - - SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */ -#endif - -#ifdef _USE_WRITE - (void) fflush(stdout); -#endif - exc.arg1 = x; - exc.arg2 = y; - switch(type) { - case 1: - case 101: - case 201: - /* acos(|x|>1) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "acos" : (type < 200 - ? "acosf" : "acosl");; - if (_LIB_VERSION == _SVID_) - exc.retval = HUGE; - else - exc.retval = NAN; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if(_LIB_VERSION == _SVID_) { - (void) WRITE2("acos: DOMAIN error\n", 19); - } - __set_errno (EDOM); - } - break; - case 2: - case 102: - case 202: - /* asin(|x|>1) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "asin" : (type < 200 - ? "asinf" : "asinl"); - if (_LIB_VERSION == _SVID_) - exc.retval = HUGE; - else - exc.retval = NAN; - if(_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if(_LIB_VERSION == _SVID_) { - (void) WRITE2("asin: DOMAIN error\n", 19); - } - __set_errno (EDOM); - } - break; - case 3: - case 103: - case 203: - /* atan2(+-0,+-0) */ - exc.arg1 = y; - exc.arg2 = x; - exc.type = DOMAIN; - exc.name = type < 100 ? "atan2" : (type < 200 - ? "atan2f" : "atan2l"); - assert (_LIB_VERSION == _SVID_); - exc.retval = HUGE; - if(_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if(_LIB_VERSION == _SVID_) { - (void) WRITE2("atan2: DOMAIN error\n", 20); - } - __set_errno (EDOM); - } - break; - case 4: - case 104: - case 204: - /* hypot(finite,finite) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "hypot" : (type < 200 - ? "hypotf" : "hypotl"); - 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); - } - break; - case 5: - case 105: - case 205: - /* cosh(finite) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "cosh" : (type < 200 - ? "coshf" : "coshl"); - 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); - } - break; - case 6: - case 106: - case 206: - /* exp(finite) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "exp" : (type < 200 - ? "expf" : "expl"); - 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); - } - break; - case 7: - case 107: - case 207: - /* exp(finite) underflow */ - exc.type = UNDERFLOW; - exc.name = type < 100 ? "exp" : (type < 200 - ? "expf" : "expl"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - case 8: - case 108: - case 208: - /* y0(0) = -inf */ - exc.type = DOMAIN; /* should be SING for IEEE */ - exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("y0: DOMAIN error\n", 17); - } - __set_errno (EDOM); - } - break; - case 9: - case 109: - case 209: - /* y0(x<0) = NaN */ - exc.type = DOMAIN; - exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("y0: DOMAIN error\n", 17); - } - __set_errno (EDOM); - } - break; - case 10: - case 110: - case 210: - /* y1(0) = -inf */ - exc.type = DOMAIN; /* should be SING for IEEE */ - exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("y1: DOMAIN error\n", 17); - } - __set_errno (EDOM); - } - break; - case 11: - case 111: - case 211: - /* y1(x<0) = NaN */ - exc.type = DOMAIN; - exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("y1: DOMAIN error\n", 17); - } - __set_errno (EDOM); - } - break; - case 12: - case 112: - case 212: - /* yn(n,0) = -inf */ - exc.type = DOMAIN; /* should be SING for IEEE */ - exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("yn: DOMAIN error\n", 17); - } - __set_errno (EDOM); - } - break; - case 13: - case 113: - case 213: - /* yn(x<0) = NaN */ - exc.type = DOMAIN; - exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("yn: DOMAIN error\n", 17); - } - __set_errno (EDOM); - } - break; - case 14: - case 114: - case 214: - /* lgamma(finite) overflow */ - 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_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - case 15: - case 115: - case 215: - /* lgamma(-integer) or lgamma(0) */ - 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 == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("lgamma: SING error\n", 19); - } - __set_errno (EDOM); - } - break; - case 16: - case 116: - case 216: - /* log(0) */ - exc.type = SING; - exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("log: SING error\n", 16); - } - __set_errno (EDOM); - } - break; - case 17: - case 117: - case 217: - /* log(x<0) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = NAN; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("log: DOMAIN error\n", 18); - } - __set_errno (EDOM); - } - break; - case 18: - case 118: - case 218: - /* log10(0) */ - exc.type = SING; - exc.name = type < 100 ? "log10" : (type < 200 - ? "log10f" : "log10l"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("log10: SING error\n", 18); - } - __set_errno (EDOM); - } - break; - case 19: - case 119: - case 219: - /* log10(x<0) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "log10" : (type < 200 - ? "log10f" : "log10l"); - if (_LIB_VERSION == _SVID_) - exc.retval = -HUGE; - else - exc.retval = NAN; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("log10: DOMAIN error\n", 20); - } - __set_errno (EDOM); - } - break; - case 20: - case 120: - case 220: - /* pow(0.0,0.0) */ - /* error only if _LIB_VERSION == _SVID_ */ - exc.type = DOMAIN; - exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); - exc.retval = zero; - if (_LIB_VERSION != _SVID_) exc.retval = 1.0; - else if (!matherr(&exc)) { - (void) WRITE2("pow(0,0): DOMAIN error\n", 23); - __set_errno (EDOM); - } - break; - case 21: - case 121: - case 221: - /* pow(x,y) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); - if (_LIB_VERSION == _SVID_) { - exc.retval = HUGE; - y *= 0.5; - if(xzero) ? HUGE : -HUGE); - else - exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL); - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - case 26: - case 126: - case 226: - /* sqrt(x<0) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "sqrt" : (type < 200 - ? "sqrtf" : "sqrtl"); - if (_LIB_VERSION == _SVID_) - exc.retval = zero; - else - exc.retval = zero/zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("sqrt: DOMAIN error\n", 19); - } - __set_errno (EDOM); - } - break; - case 27: - case 127: - case 227: - /* fmod(x,0) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "fmod" : (type < 200 - ? "fmodf" : "fmodl"); - 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: - case 128: - case 228: - /* 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: - case 129: - case 229: - /* 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: - case 130: - case 230: - /* 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: - case 131: - case 231: - /* 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 (EDOM); - 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: - /* scalb overflow; SVID also returns +-HUGE_VAL */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "scalb" : (type < 200 - ? "scalbf" : "scalbl"); - exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - case 33: - case 133: - case 233: - /* scalb underflow */ - exc.type = UNDERFLOW; - exc.name = type < 100 ? "scalb" : (type < 200 - ? "scalbf" : "scalbl"); - exc.retval = __copysign(zero,x); - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - case 34: - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - break; - case 40: - case 140: - case 240: - /* gamma(finite) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "tgamma" : (type < 200 - ? "tgammaf" : "tgammal"); - exc.retval = HUGE_VAL; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - case 41: - case 141: - case 241: - /* gamma(-integer) or gamma(0) */ - exc.type = SING; - exc.name = type < 100 ? "tgamma" : (type < 200 - ? "tgammaf" : "tgammal"); - exc.retval = NAN; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("tgamma: SING error\n", 18); - exc.retval = HUGE_VAL; - } - __set_errno (EDOM); - } - break; - case 42: - case 142: - case 242: - /* pow(NaN,0.0) */ - /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */ - exc.type = DOMAIN; - exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); - exc.retval = x; - if (_LIB_VERSION == _IEEE_ || - _LIB_VERSION == _POSIX_) exc.retval = 1.0; - else if (!matherr(&exc)) { - __set_errno (EDOM); - } - break; - - case 44: - case 144: - case 244: - /* exp(finite) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "exp2" : (type < 200 - ? "exp2f" : "exp2l"); - 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); - } - break; - case 45: - case 145: - case 245: - /* exp(finite) underflow */ - exc.type = UNDERFLOW; - exc.name = type < 100 ? "exp2" : (type < 200 - ? "exp2f" : "exp2l"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - - case 46: - case 146: - case 246: - /* exp(finite) overflow */ - exc.type = OVERFLOW; - exc.name = type < 100 ? "exp10" : (type < 200 - ? "exp10f" : "exp10l"); - 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); - } - break; - case 47: - case 147: - case 247: - /* exp(finite) underflow */ - exc.type = UNDERFLOW; - exc.name = type < 100 ? "exp10" : (type < 200 - ? "exp10f" : "exp10l"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } - break; - /* #### Last used is 47/147/247 ### */ - } - return exc.retval; -} diff --git a/sysdeps/libm-ieee754/k_tan.c b/sysdeps/libm-ieee754/k_tan.c deleted file mode 100644 index 55dafb8ebc..0000000000 --- a/sysdeps/libm-ieee754/k_tan.c +++ /dev/null @@ -1,145 +0,0 @@ -/* @(#)k_tan.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_tan.c,v 1.8 1995/05/10 20:46:37 jtc Exp $"; -#endif - -/* __kernel_tan( x, y, k ) - * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * Input k indicates whether tan (if k=1) or - * -1/tan (if k= -1) is returned. - * - * Algorithm - * 1. Since tan(-x) = -tan(x), we need only to consider positive x. - * 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0. - * 3. tan(x) is approximated by a odd polynomial of degree 27 on - * [0,0.67434] - * 3 27 - * tan(x) ~ x + T1*x + ... + T13*x - * where - * - * |tan(x) 2 4 26 | -59.2 - * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2 - * | x | - * - * Note: tan(x+y) = tan(x) + tan'(x)*y - * ~ tan(x) + (1+x*x)*y - * Therefore, for better accuracy in computing tan(x+y), let - * 3 2 2 2 2 - * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13)))) - * then - * 3 2 - * tan(x+y) = x + (T1*x + (x *(r+y)+y)) - * - * 4. For x in [0.67434,pi/4], let y = pi/4 - x, then - * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y)) - * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y))) - */ - -#include "math.h" -#include "math_private.h" -#ifdef __STDC__ -static const double -#else -static double -#endif -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ -pio4lo= 3.06161699786838301793e-17, /* 0x3C81A626, 0x33145C07 */ -T[] = { - 3.33333333333334091986e-01, /* 0x3FD55555, 0x55555563 */ - 1.33333333333201242699e-01, /* 0x3FC11111, 0x1110FE7A */ - 5.39682539762260521377e-02, /* 0x3FABA1BA, 0x1BB341FE */ - 2.18694882948595424599e-02, /* 0x3F9664F4, 0x8406D637 */ - 8.86323982359930005737e-03, /* 0x3F8226E3, 0xE96E8493 */ - 3.59207910759131235356e-03, /* 0x3F6D6D22, 0xC9560328 */ - 1.45620945432529025516e-03, /* 0x3F57DBC8, 0xFEE08315 */ - 5.88041240820264096874e-04, /* 0x3F4344D8, 0xF2F26501 */ - 2.46463134818469906812e-04, /* 0x3F3026F7, 0x1A8D1068 */ - 7.81794442939557092300e-05, /* 0x3F147E88, 0xA03792A6 */ - 7.14072491382608190305e-05, /* 0x3F12B80F, 0x32F0A7E9 */ - -1.85586374855275456654e-05, /* 0xBEF375CB, 0xDB605373 */ - 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ -}; - -#ifdef __STDC__ - double __kernel_tan(double x, double y, int iy) -#else - double __kernel_tan(x, y, iy) - double x,y; int iy; -#endif -{ - double z,r,v,w,s,r1,r2,r3,v1,v2,v3,w2,w4; - int32_t ix,hx; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; /* high word of |x| */ - if(ix<0x3e300000) /* x < 2**-28 */ - {if((int)x==0) { /* generate inexact */ - u_int32_t low; - GET_LOW_WORD(low,x); - if(((ix|low)|(iy+1))==0) return one/fabs(x); - else return (iy==1)? x: -one/x; - } - } - if(ix>=0x3FE59428) { /* |x|>=0.6744 */ - if(hx<0) {x = -x; y = -y;} - z = pio4-x; - w = pio4lo-y; - x = z+w; y = 0.0; - } - z = x*x; - w = z*z; - /* Break x^5*(T[1]+x^2*T[2]+...) into - * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + - * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) - */ -#ifdef DO_NOT_USE_THIS - r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); - v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); -#else - v1 = T[10]+w*T[12]; w2=w*w; - v2 = T[6]+w*T[8]; w4=w2*w2; - v3 = T[2]+w*T[4]; v1=z*v1; - r1 = T[9]+w*T[11]; v2=z*v2; - r2 = T[5]+w*T[7]; v3=z*v3; - r3 = T[1]+w*T[3]; - v = v3 + w2*v2 + w4*v1; - r = r3 + w2*r2 + w4*r1; -#endif - s = z*x; - r = y + z*(s*(r+v)+y); - r += T[0]*s; - w = x+r; - if(ix>=0x3FE59428) { - v = (double)iy; - return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r))); - } - if(iy==1) return w; - else { /* if allow error up to 2 ulp, - simply return -1.0/(x+r) here */ - /* compute -1.0/(x+r) accurately */ - double a,t; - z = w; - SET_LOW_WORD(z,0); - v = r-(z - x); /* z+v = r+x */ - t = a = -1.0/w; /* a = -1.0/w */ - SET_LOW_WORD(t,0); - s = 1.0+t*z; - return t+a*(s+t*v); - } -} diff --git a/sysdeps/libm-ieee754/k_tanf.c b/sysdeps/libm-ieee754/k_tanf.c deleted file mode 100644 index eb1a670939..0000000000 --- a/sysdeps/libm-ieee754/k_tanf.c +++ /dev/null @@ -1,101 +0,0 @@ -/* k_tanf.c -- float version of k_tan.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: k_tanf.c,v 1.4 1995/05/10 20:46: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 */ -pio4 = 7.8539812565e-01, /* 0x3f490fda */ -pio4lo= 3.7748947079e-08, /* 0x33222168 */ -T[] = { - 3.3333334327e-01, /* 0x3eaaaaab */ - 1.3333334029e-01, /* 0x3e088889 */ - 5.3968254477e-02, /* 0x3d5d0dd1 */ - 2.1869488060e-02, /* 0x3cb327a4 */ - 8.8632395491e-03, /* 0x3c11371f */ - 3.5920790397e-03, /* 0x3b6b6916 */ - 1.4562094584e-03, /* 0x3abede48 */ - 5.8804126456e-04, /* 0x3a1a26c8 */ - 2.4646313977e-04, /* 0x398137b9 */ - 7.8179444245e-05, /* 0x38a3f445 */ - 7.1407252108e-05, /* 0x3895c07a */ - -1.8558637748e-05, /* 0xb79bae5f */ - 2.5907305826e-05, /* 0x37d95384 */ -}; - -#ifdef __STDC__ - float __kernel_tanf(float x, float y, int iy) -#else - float __kernel_tanf(x, y, iy) - float x,y; int iy; -#endif -{ - float z,r,v,w,s; - int32_t ix,hx; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; /* high word of |x| */ - if(ix<0x31800000) /* x < 2**-28 */ - {if((int)x==0) { /* generate inexact */ - if((ix|(iy+1))==0) return one/fabsf(x); - else return (iy==1)? x: -one/x; - } - } - if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ - if(hx<0) {x = -x; y = -y;} - z = pio4-x; - w = pio4lo-y; - x = z+w; y = 0.0; - } - z = x*x; - w = z*z; - /* Break x^5*(T[1]+x^2*T[2]+...) into - * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + - * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) - */ - r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); - v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); - s = z*x; - r = y + z*(s*(r+v)+y); - r += T[0]*s; - w = x+r; - if(ix>=0x3f2ca140) { - v = (float)iy; - return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r))); - } - if(iy==1) return w; - else { /* if allow error up to 2 ulp, - simply return -1.0/(x+r) here */ - /* compute -1.0/(x+r) accurately */ - float a,t; - int32_t i; - z = w; - GET_FLOAT_WORD(i,z); - SET_FLOAT_WORD(z,i&0xfffff000); - v = r-(z - x); /* z+v = r+x */ - t = a = -(float)1.0/w; /* a = -1.0/w */ - GET_FLOAT_WORD(i,t); - SET_FLOAT_WORD(t,i&0xfffff000); - s = (float)1.0+t*z; - return t+a*(s+t*v); - } -} diff --git a/sysdeps/libm-ieee754/s_asinh.c b/sysdeps/libm-ieee754/s_asinh.c deleted file mode 100644 index 985cfe32e1..0000000000 --- a/sysdeps/libm-ieee754/s_asinh.c +++ /dev/null @@ -1,70 +0,0 @@ -/* @(#)s_asinh.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. - * ==================================================== - */ - -#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 - * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] - * we have - * asinh(x) := x if 1+x*x=1, - * := sign(x)*(log(x)+ln2)) for large |x|, else - * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else - * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) - */ - -#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 t,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(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x41b00000) { /* |x| > 2**28 */ - 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))); - } - if(hx>0) return w; else return -w; -} -weak_alias (__asinh, asinh) -#ifdef NO_LONG_DOUBLE -strong_alias (__asinh, __asinhl) -weak_alias (__asinh, asinhl) -#endif diff --git a/sysdeps/libm-ieee754/s_asinhf.c b/sysdeps/libm-ieee754/s_asinhf.c deleted file mode 100644 index fac256d37a..0000000000 --- a/sysdeps/libm-ieee754/s_asinhf.c +++ /dev/null @@ -1,58 +0,0 @@ -/* s_asinhf.c -- float version of s_asinh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 t,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(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x47000000) { /* |x| > 2**14 */ - 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))); - } - if(hx>0) return w; else return -w; -} -weak_alias (__asinhf, asinhf) diff --git a/sysdeps/libm-ieee754/s_asinhl.c b/sysdeps/libm-ieee754/s_asinhl.c deleted file mode 100644 index 6eb434c44b..0000000000 --- a/sysdeps/libm-ieee754/s_asinhl.c +++ /dev/null @@ -1,70 +0,0 @@ -/* s_asinhl.c -- long double version of s_asinh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* asinhl(x) - * Method : - * Based on - * asinhl(x) = signl(x) * logl [ |x| + sqrtl(x*x+1) ] - * we have - * asinhl(x) := x if 1+x*x=1, - * := signl(x)*(logl(x)+ln2)) for large |x|, else - * := signl(x)*logl(2|x|+1/(|x|+sqrtl(x*x+1))) if|x|>2, else - * := signl(x)*log1pl(|x| + x^2/(1 + sqrtl(1+x^2))) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double -#else -static long double -#endif -one = 1.000000000000000000000e+00L, /* 0x3FFF, 0x00000000, 0x00000000 */ -ln2 = 6.931471805599453094287e-01L, /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */ -huge= 1.000000000000000000e+4900L; - -#ifdef __STDC__ - long double __asinhl(long double x) -#else - long double __asinhl(x) - long double x; -#endif -{ - long double t,w; - 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(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x4020) { /* |x| > 2**34 */ - 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))); - } - if(hx&0x8000) return -w; else return w; -} -weak_alias (__asinhl, asinhl) diff --git a/sysdeps/libm-ieee754/s_atan.c b/sysdeps/libm-ieee754/s_atan.c deleted file mode 100644 index cad3ba12a8..0000000000 --- a/sysdeps/libm-ieee754/s_atan.c +++ /dev/null @@ -1,163 +0,0 @@ -/* @(#)s_atan.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_atan.c,v 1.8 1995/05/10 20:46:45 jtc Exp $"; -#endif - -/* atan(x) - * Method - * 1. Reduce x to positive by atan(x) = -atan(-x). - * 2. According to the integer k=4t+0.25 chopped, t=x, the argument - * is further reduced to one of the following intervals and the - * arctangent of t is evaluated by the corresponding formula: - * - * [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) - * [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) ) - * [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) ) - * [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) ) - * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double atanhi[] = { -#else -static double atanhi[] = { -#endif - 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ - 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ - 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ - 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ -}; - -#ifdef __STDC__ -static const double atanlo[] = { -#else -static double atanlo[] = { -#endif - 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */ - 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */ - 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */ - 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */ -}; - -#ifdef __STDC__ -static const double aT[] = { -#else -static double aT[] = { -#endif - 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */ - -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */ - 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */ - -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */ - 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */ - -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */ - 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */ - -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */ - 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */ - -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */ - 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ -}; - -#ifdef __STDC__ - static const double -#else - static double -#endif -one = 1.0, -huge = 1.0e300; - -#ifdef __STDC__ - double __atan(double x) -#else - double __atan(x) - double x; -#endif -{ - double w,s1,z,s,w2,w4,s11,s12,s13,s21,s22,s23; - int32_t ix,hx,id; - - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x44100000) { /* if |x| >= 2^66 */ - u_int32_t low; - GET_LOW_WORD(low,x); - if(ix>0x7ff00000|| - (ix==0x7ff00000&&(low!=0))) - return x+x; /* NaN */ - if(hx>0) return atanhi[3]+atanlo[3]; - else return -atanhi[3]-atanlo[3]; - } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ - if (ix < 0x3e200000) { /* |x| < 2^-29 */ - if(huge+x>one) return x; /* raise inexact */ - } - id = -1; - } else { - x = fabs(x); - if (ix < 0x3ff30000) { /* |x| < 1.1875 */ - if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = (2.0*x-one)/(2.0+x); - } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); - } - } else { - if (ix < 0x40038000) { /* |x| < 2.4375 */ - id = 2; x = (x-1.5)/(one+1.5*x); - } else { /* 2.4375 <= |x| < 2^66 */ - id = 3; x = -1.0/x; - } - }} - /* end of argument reduction */ - z = x*x; - w = z*z; - /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ -#ifdef DO_NOT_USE_THIS - s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); - s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); - if (id<0) return x - x*(s1+s2); - else { - z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); - return (hx<0)? -z:z; - } -#else - s11 = aT[8]+w*aT[10]; w2=w*w; - s12 = aT[4]+w*aT[6]; w4=w2*w2; - s13 = aT[0]+w*aT[2]; - s21 = aT[7]+w*aT[9]; - s22 = aT[3]+w*aT[5]; - s23 = w*aT[1]; - s1 = s13 + w2*s12 + w4*s11; - s = s23 + w2*s22 + w4*s21 + z*s1; - if (id<0) return x - x*(s); - else { - z = atanhi[id] - ((x*(s) - atanlo[id]) - x); - return (hx<0)? -z:z; - } -#endif -} -weak_alias (__atan, atan) -#ifdef NO_LONG_DOUBLE -strong_alias (__atan, __atanl) -weak_alias (__atan, atanl) -#endif diff --git a/sysdeps/libm-ieee754/s_atanf.c b/sysdeps/libm-ieee754/s_atanf.c deleted file mode 100644 index a68933fa6a..0000000000 --- a/sysdeps/libm-ieee754/s_atanf.c +++ /dev/null @@ -1,120 +0,0 @@ -/* s_atanf.c -- float version of s_atan.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_atanf.c,v 1.4 1995/05/10 20:46:47 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float atanhi[] = { -#else -static float atanhi[] = { -#endif - 4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */ - 7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */ - 9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */ - 1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */ -}; - -#ifdef __STDC__ -static const float atanlo[] = { -#else -static float atanlo[] = { -#endif - 5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */ - 3.7748947079e-08, /* atan(1.0)lo 0x33222168 */ - 3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */ - 7.5497894159e-08, /* atan(inf)lo 0x33a22168 */ -}; - -#ifdef __STDC__ -static const float aT[] = { -#else -static float aT[] = { -#endif - 3.3333334327e-01, /* 0x3eaaaaaa */ - -2.0000000298e-01, /* 0xbe4ccccd */ - 1.4285714924e-01, /* 0x3e124925 */ - -1.1111110449e-01, /* 0xbde38e38 */ - 9.0908870101e-02, /* 0x3dba2e6e */ - -7.6918758452e-02, /* 0xbd9d8795 */ - 6.6610731184e-02, /* 0x3d886b35 */ - -5.8335702866e-02, /* 0xbd6ef16b */ - 4.9768779427e-02, /* 0x3d4bda59 */ - -3.6531571299e-02, /* 0xbd15a221 */ - 1.6285819933e-02, /* 0x3c8569d7 */ -}; - -#ifdef __STDC__ - static const float -#else - static float -#endif -one = 1.0, -huge = 1.0e30; - -#ifdef __STDC__ - float __atanf(float x) -#else - float __atanf(x) - float x; -#endif -{ - float w,s1,s2,z; - int32_t ix,hx,id; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x50800000) { /* if |x| >= 2^34 */ - if(ix>0x7f800000) - return x+x; /* NaN */ - if(hx>0) return atanhi[3]+atanlo[3]; - else return -atanhi[3]-atanlo[3]; - } if (ix < 0x3ee00000) { /* |x| < 0.4375 */ - if (ix < 0x31000000) { /* |x| < 2^-29 */ - if(huge+x>one) return x; /* raise inexact */ - } - id = -1; - } else { - x = fabsf(x); - if (ix < 0x3f980000) { /* |x| < 1.1875 */ - if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = ((float)2.0*x-one)/((float)2.0+x); - } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); - } - } else { - if (ix < 0x401c0000) { /* |x| < 2.4375 */ - id = 2; x = (x-(float)1.5)/(one+(float)1.5*x); - } else { /* 2.4375 <= |x| < 2^66 */ - id = 3; x = -(float)1.0/x; - } - }} - /* end of argument reduction */ - z = x*x; - w = z*z; - /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ - s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); - s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); - if (id<0) return x - x*(s1+s2); - else { - z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); - return (hx<0)? -z:z; - } -} -weak_alias (__atanf, atanf) diff --git a/sysdeps/libm-ieee754/s_cacos.c b/sysdeps/libm-ieee754/s_cacos.c deleted file mode 100644 index 9b007598f0..0000000000 --- a/sysdeps/libm-ieee754/s_cacos.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Return cosine of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -__complex__ double -__cacos (__complex__ double x) -{ - __complex__ double y; - __complex__ double res; - - y = __casin (x); - - __real__ res = (double) M_PI_2 - __real__ y; - __imag__ res = -__imag__ y; - - return res; -} -weak_alias (__cacos, cacos) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacos, __cacosl) -weak_alias (__cacos, cacosl) -#endif diff --git a/sysdeps/libm-ieee754/s_cacosf.c b/sysdeps/libm-ieee754/s_cacosf.c deleted file mode 100644 index 6fb132dc23..0000000000 --- a/sysdeps/libm-ieee754/s_cacosf.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Return cosine of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -__complex__ float -__cacosf (__complex__ float x) -{ - __complex__ float y; - __complex__ float res; - - y = __casinf (x); - - __real__ res = (float) M_PI_2 - __real__ y; - __imag__ res = -__imag__ y; - - return res; -} -weak_alias (__cacosf, cacosf) diff --git a/sysdeps/libm-ieee754/s_cacosh.c b/sysdeps/libm-ieee754/s_cacosh.c deleted file mode 100644 index d938c64473..0000000000 --- a/sysdeps/libm-ieee754/s_cacosh.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Return arc hyperbole cosine for double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ double -__cacosh (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - - if (rcls == FP_NAN) - __imag__ res = __nan (""); - else - __imag__ res = __copysign ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - - if (icls >= FP_ZERO) - __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysign (M_PI_2, __imag__ x); - } - else - { - __complex__ double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrt (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clog (y); - } - - return res; -} -weak_alias (__cacosh, cacosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__cacosh, __cacoshl) -weak_alias (__cacosh, cacoshl) -#endif diff --git a/sysdeps/libm-ieee754/s_cacoshf.c b/sysdeps/libm-ieee754/s_cacoshf.c deleted file mode 100644 index 6aa33e5a48..0000000000 --- a/sysdeps/libm-ieee754/s_cacoshf.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Return arc hyperbole cosine for float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - -__complex__ float -__cacoshf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - - if (rcls == FP_NAN) - __imag__ res = __nanf (""); - else - __imag__ res = __copysignf ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PI - M_PI_4 : M_PI_4) - : M_PI_2), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - - if (icls >= FP_ZERO) - __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0, - __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysignf (M_PI_2, __imag__ x); - } - else - { -#if 1 - __complex__ float y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtf (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogf (y); -#else - float re2 = __real__ x * __real__ x; - float im2 = __imag__ x * __imag__ x; - float sq = re2 - im2 - 1.0; - float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2); - float a = __ieee754_sqrtf ((sq + ro) / 2.0); - float b = __ieee754_sqrtf ((-sq + ro) / 2.0); - - __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a - + im2 + __imag__ x * 2 * b - + ro); - __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a); -#endif - } - - return res; -} -weak_alias (__cacoshf, cacoshf) diff --git a/sysdeps/libm-ieee754/s_cacoshl.c b/sysdeps/libm-ieee754/s_cacoshl.c deleted file mode 100644 index 1c91e93fab..0000000000 --- a/sysdeps/libm-ieee754/s_cacoshl.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return arc hyperbole cosine for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ long double -__cacoshl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - - if (rcls == FP_NAN) - __imag__ res = __nanl (""); - else - __imag__ res = __copysignl ((rcls == FP_INFINITE - ? (__real__ x < 0.0 - ? M_PIl - M_PI_4l : M_PI_4l) - : M_PI_2l), __imag__ x); - } - else if (rcls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - - if (icls >= FP_ZERO) - __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0, - __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - __real__ res = 0.0; - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - } - else - { - __complex__ long double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtl (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogl (y); - } - - return res; -} -weak_alias (__cacoshl, cacoshl) diff --git a/sysdeps/libm-ieee754/s_cacosl.c b/sysdeps/libm-ieee754/s_cacosl.c deleted file mode 100644 index 40ad812aa1..0000000000 --- a/sysdeps/libm-ieee754/s_cacosl.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Return cosine of complex long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -__complex__ long double -__cacosl (__complex__ long double x) -{ - __complex__ long double y; - __complex__ long double res; - - y = __casinl (x); - - __real__ res = M_PI_2l - __real__ y; - __imag__ res = -__imag__ y; - - return res; -} -weak_alias (__cacosl, cacosl) diff --git a/sysdeps/libm-ieee754/s_casin.c b/sysdeps/libm-ieee754/s_casin.c deleted file mode 100644 index 516aea0464..0000000000 --- a/sysdeps/libm-ieee754/s_casin.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Return arc sine of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ double -__casin (__complex__ double x) -{ - __complex__ double res; - - if (isnan (__real__ x) || isnan (__imag__ x)) - { - if (__real__ x == 0.0) - { - res = x; - } - else if (__isinf (__real__ x) || __isinf (__imag__ x)) - { - __real__ res = __nan (""); - __imag__ res = __copysign (HUGE_VAL, __imag__ x); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else - { - __complex__ double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __casinh (y); - - __real__ res = __imag__ y; - __imag__ res = -__real__ y; - } - - return res; -} -weak_alias (__casin, casin) -#ifdef NO_LONG_DOUBLE -strong_alias (__casin, __casinl) -weak_alias (__casin, casinl) -#endif diff --git a/sysdeps/libm-ieee754/s_casinf.c b/sysdeps/libm-ieee754/s_casinf.c deleted file mode 100644 index aaf0d66c28..0000000000 --- a/sysdeps/libm-ieee754/s_casinf.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Return arc sine of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ float -__casinf (__complex__ float x) -{ - __complex__ float res; - - if (isnan (__real__ x) || isnan (__imag__ x)) - { - if (__real__ x == 0.0) - { - res = x; - } - else if (__isinff (__real__ x) || __isinff (__imag__ x)) - { - __real__ res = __nanf (""); - __imag__ res = __copysignf (HUGE_VALF, __imag__ x); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else - { - __complex__ float y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __casinhf (y); - - __real__ res = __imag__ y; - __imag__ res = -__real__ y; - } - - return res; -} -weak_alias (__casinf, casinf) diff --git a/sysdeps/libm-ieee754/s_casinh.c b/sysdeps/libm-ieee754/s_casinh.c deleted file mode 100644 index da7d1ed429..0000000000 --- a/sysdeps/libm-ieee754/s_casinh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return arc hyperbole sine for double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ double -__casinh (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysign (HUGE_VAL, __real__ x); - - if (rcls == FP_NAN) - __imag__ res = __nan (""); - else - __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4, - __imag__ x); - } - else if (rcls <= FP_INFINITE) - { - __real__ res = __real__ x; - if ((rcls == FP_INFINITE && icls >= FP_ZERO) - || (rcls == FP_NAN && icls == FP_ZERO)) - __imag__ res = __copysign (0.0, __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - __complex__ double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrt (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clog (y); - } - - return res; -} -weak_alias (__casinh, casinh) -#ifdef NO_LONG_DOUBLE -strong_alias (__casinh, __casinhl) -weak_alias (__casinh, casinhl) -#endif diff --git a/sysdeps/libm-ieee754/s_casinhf.c b/sysdeps/libm-ieee754/s_casinhf.c deleted file mode 100644 index e8441f4fa0..0000000000 --- a/sysdeps/libm-ieee754/s_casinhf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole sine for float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ float -__casinhf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignf (HUGE_VALF, __real__ x); - - if (rcls == FP_NAN) - __imag__ res = __nanf (""); - else - __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4, - __imag__ x); - } - else if (rcls <= FP_INFINITE) - { - __real__ res = __real__ x; - if ((rcls == FP_INFINITE && icls >= FP_ZERO) - || (rcls == FP_NAN && icls == FP_ZERO)) - __imag__ res = __copysignf (0.0, __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - __complex__ float y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtf (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogf (y); - } - - return res; -} -weak_alias (__casinhf, casinhf) diff --git a/sysdeps/libm-ieee754/s_casinhl.c b/sysdeps/libm-ieee754/s_casinhl.c deleted file mode 100644 index 44e07f773f..0000000000 --- a/sysdeps/libm-ieee754/s_casinhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole sine for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ long double -__casinhl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignl (HUGE_VALL, __real__ x); - - if (rcls == FP_NAN) - __imag__ res = __nanl (""); - else - __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l, - __imag__ x); - } - else if (rcls <= FP_INFINITE) - { - __real__ res = __real__ x; - if ((rcls == FP_INFINITE && icls >= FP_ZERO) - || (rcls == FP_NAN && icls == FP_ZERO)) - __imag__ res = __copysignl (0.0, __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - __complex__ long double y; - - __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0; - __imag__ y = 2.0 * __real__ x * __imag__ x; - - y = __csqrtl (y); - - __real__ y += __real__ x; - __imag__ y += __imag__ x; - - res = __clogl (y); - } - - return res; -} -weak_alias (__casinhl, casinhl) diff --git a/sysdeps/libm-ieee754/s_casinl.c b/sysdeps/libm-ieee754/s_casinl.c deleted file mode 100644 index cc750d4a11..0000000000 --- a/sysdeps/libm-ieee754/s_casinl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Return arc sine of complex long double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ long double -__casinl (__complex__ long double x) -{ - __complex__ long double res; - - if (isnan (__real__ x) || isnan (__imag__ x)) - { - if (__real__ x == 0.0) - { - res = x; - } - else if (__isinfl (__real__ x) || __isinfl (__imag__ x)) - { - __real__ res = __nanl (""); - __imag__ res = __copysignl (HUGE_VALL, __imag__ x); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else - { - __complex__ long double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - y = __casinhl (y); - - __real__ res = __imag__ y; - __imag__ res = -__real__ y; - } - - return res; -} -weak_alias (__casinl, casinl) diff --git a/sysdeps/libm-ieee754/s_catan.c b/sysdeps/libm-ieee754/s_catan.c deleted file mode 100644 index a3fc9ad3e8..0000000000 --- a/sysdeps/libm-ieee754/s_catan.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Return arc tangent of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ double -__catan (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (rcls == FP_INFINITE) - { - __real__ res = __copysign (M_PI_2, __real__ x); - __imag__ res = __copysign (0.0, __imag__ x); - } - else if (icls == FP_INFINITE) - { - if (rcls >= FP_ZERO) - __real__ res = __copysign (M_PI_2, __real__ x); - else - __real__ res = __nan (""); - __imag__ res = __copysign (0.0, __imag__ x); - } - else if (icls == FP_ZERO || icls == FP_INFINITE) - { - __real__ res = __nan (""); - __imag__ res = __copysign (0.0, __imag__ x); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - double r2, num, den; - - r2 = __real__ x * __real__ x; - - den = 1 - r2 - __imag__ x * __imag__ x; - - __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den); - - num = __imag__ x + 1.0; - num = r2 + num * num; - - den = __imag__ x - 1.0; - den = r2 + den * den; - - __imag__ res = 0.25 * __ieee754_log (num / den); - } - - return res; -} -weak_alias (__catan, catan) -#ifdef NO_LONG_DOUBLE -strong_alias (__catan, __catanl) -weak_alias (__catan, catanl) -#endif diff --git a/sysdeps/libm-ieee754/s_catanf.c b/sysdeps/libm-ieee754/s_catanf.c deleted file mode 100644 index 18881cd6c9..0000000000 --- a/sysdeps/libm-ieee754/s_catanf.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Return arc tangent of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ float -__catanf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (rcls == FP_INFINITE) - { - __real__ res = __copysignf (M_PI_2, __real__ x); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else if (icls == FP_INFINITE) - { - if (rcls >= FP_ZERO) - __real__ res = __copysignf (M_PI_2, __real__ x); - else - __real__ res = __nanf (""); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else if (icls == FP_ZERO || icls == FP_INFINITE) - { - __real__ res = __nanf (""); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - float r2, num, den; - - r2 = __real__ x * __real__ x; - - den = 1 - r2 - __imag__ x * __imag__ x; - - __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den); - - num = __imag__ x + 1.0; - num = r2 + num * num; - - den = __imag__ x - 1.0; - den = r2 + den * den; - - __imag__ res = 0.25 * __ieee754_logf (num / den); - } - - return res; -} -weak_alias (__catanf, catanf) diff --git a/sysdeps/libm-ieee754/s_catanh.c b/sysdeps/libm-ieee754/s_catanh.c deleted file mode 100644 index 0cb852a069..0000000000 --- a/sysdeps/libm-ieee754/s_catanh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Return arc hyperbole tangent for double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ double -__catanh (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysign (0.0, __real__ x); - __imag__ res = __copysign (M_PI_2, __imag__ x); - } - else if (rcls == FP_INFINITE || rcls == FP_ZERO) - { - __real__ res = __copysign (0.0, __real__ x); - if (icls >= FP_ZERO) - __imag__ res = __copysign (M_PI_2, __imag__ x); - else - __imag__ res = __nan (""); - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - double i2, num, den; - - i2 = __imag__ x * __imag__ x; - - num = 1.0 + __real__ x; - num = i2 + num * num; - - den = 1.0 - __real__ x; - den = i2 + den * den; - - __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den)); - - den = 1 - __real__ x * __real__ x - i2; - - __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den); - } - - return res; -} -weak_alias (__catanh, catanh) -#ifdef NO_LONG_DOUBLE -strong_alias (__catanh, __catanhl) -weak_alias (__catanh, catanhl) -#endif diff --git a/sysdeps/libm-ieee754/s_catanhf.c b/sysdeps/libm-ieee754/s_catanhf.c deleted file mode 100644 index ac0ed17edb..0000000000 --- a/sysdeps/libm-ieee754/s_catanhf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole tangent for float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ float -__catanhf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignf (0.0, __real__ x); - __imag__ res = __copysignf (M_PI_2, __imag__ x); - } - else if (rcls == FP_INFINITE || rcls == FP_ZERO) - { - __real__ res = __copysignf (0.0, __real__ x); - if (icls >= FP_ZERO) - __imag__ res = __copysignf (M_PI_2, __imag__ x); - else - __imag__ res = __nanf (""); - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - float i2, num, den; - - i2 = __imag__ x * __imag__ x; - - num = 1.0 + __real__ x; - num = i2 + num * num; - - den = 1.0 - __real__ x; - den = i2 + den * den; - - __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den)); - - den = 1 - __real__ x * __real__ x - i2; - - __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den); - } - - return res; -} -weak_alias (__catanhf, catanhf) diff --git a/sysdeps/libm-ieee754/s_catanhl.c b/sysdeps/libm-ieee754/s_catanhl.c deleted file mode 100644 index 22f3d4b646..0000000000 --- a/sysdeps/libm-ieee754/s_catanhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return arc hyperbole tangent for long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ long double -__catanhl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = __copysignl (0.0, __real__ x); - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - } - else if (rcls == FP_INFINITE || rcls == FP_ZERO) - { - __real__ res = __copysignl (0.0, __real__ x); - if (icls >= FP_ZERO) - __imag__ res = __copysignl (M_PI_2l, __imag__ x); - else - __imag__ res = __nanl (""); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - long double i2, num, den; - - i2 = __imag__ x * __imag__ x; - - num = 1.0 + __real__ x; - num = i2 + num * num; - - den = 1.0 - __real__ x; - den = i2 + den * den; - - __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den)); - - den = 1 - __real__ x * __real__ x - i2; - - __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den); - } - - return res; -} -weak_alias (__catanhl, catanhl) diff --git a/sysdeps/libm-ieee754/s_catanl.c b/sysdeps/libm-ieee754/s_catanl.c deleted file mode 100644 index b7df5c39c2..0000000000 --- a/sysdeps/libm-ieee754/s_catanl.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Return arc tangent of complex long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ long double -__catanl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (rcls == FP_INFINITE) - { - __real__ res = __copysignl (M_PI_2l, __real__ x); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else if (icls == FP_INFINITE) - { - if (rcls >= FP_ZERO) - __real__ res = __copysignl (M_PI_2l, __real__ x); - else - __real__ res = __nanl (""); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else if (icls == FP_ZERO || icls == FP_INFINITE) - { - __real__ res = __nanl (""); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else if (rcls == FP_ZERO && icls == FP_ZERO) - { - res = x; - } - else - { - long double r2, num, den; - - r2 = __real__ x * __real__ x; - - den = 1 - r2 - __imag__ x * __imag__ x; - - __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den); - - num = __imag__ x + 1.0; - num = r2 + num * num; - - den = __imag__ x - 1.0; - den = r2 + den * den; - - __imag__ res = 0.25 * __ieee754_logl (num / den); - } - - return res; -} -weak_alias (__catanl, catanl) diff --git a/sysdeps/libm-ieee754/s_cbrt.c b/sysdeps/libm-ieee754/s_cbrt.c deleted file mode 100644 index 753049d375..0000000000 --- a/sysdeps/libm-ieee754/s_cbrt.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Compute cubic root of double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Dirk Alboth and - Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. 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" - - -#define CBRT2 1.2599210498948731648 /* 2^(1/3) */ -#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */ - -static const double factor[5] = -{ - 1.0 / SQR_CBRT2, - 1.0 / CBRT2, - 1.0, - CBRT2, - SQR_CBRT2 -}; - - -double -__cbrt (double x) -{ - double xm, ym, u, t2; - int xe; - - /* Reduce X. XM now is an range 1.0 to 0.5. */ - xm = __frexp (fabs (x), &xe); - - /* If X is not finite or is null return it (with raising exceptions - if necessary. - Note: *Our* version of `frexp' sets XE to zero if the argument is - Inf or NaN. This is not portable but faster. */ - if (xe == 0 && fpclassify (x) <= FP_ZERO) - return x + x; - - u = (0.354895765043919860 - + ((1.50819193781584896 - + ((-2.11499494167371287 - + ((2.44693122563534430 - + ((-1.83469277483613086 - + (0.784932344976639262 - 0.145263899385486377 * xm) * xm) - * xm)) - * xm)) - * xm)) - * xm)); - - t2 = u * u * u; - - ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3]; - - return __ldexp (x > 0.0 ? ym : -ym, xe / 3); -} -weak_alias (__cbrt, cbrt) -#ifdef NO_LONG_DOUBLE -strong_alias (__cbrt, __cbrtl) -weak_alias (__cbrt, cbrtl) -#endif diff --git a/sysdeps/libm-ieee754/s_cbrtf.c b/sysdeps/libm-ieee754/s_cbrtf.c deleted file mode 100644 index fa0fef9987..0000000000 --- a/sysdeps/libm-ieee754/s_cbrtf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Compute cubic root of float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Dirk Alboth and - Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. 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" - - -#define CBRT2 1.2599210498948731648 /* 2^(1/3) */ -#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */ - -static const double factor[5] = -{ - 1.0 / SQR_CBRT2, - 1.0 / CBRT2, - 1.0, - CBRT2, - SQR_CBRT2 -}; - - -float -__cbrtf (float x) -{ - float xm, ym, u, t2; - int xe; - - /* Reduce X. XM now is an range 1.0 to 0.5. */ - xm = __frexpf (fabsf (x), &xe); - - /* If X is not finite or is null return it (with raising exceptions - if necessary. - Note: *Our* version of `frexp' sets XE to zero if the argument is - Inf or NaN. This is not portable but faster. */ - if (xe == 0 && fpclassify (x) <= FP_ZERO) - return x + x; - - u = (0.492659620528969547 + (0.697570460207922770 - - 0.191502161678719066 * xm) * xm); - - t2 = u * u * u; - - ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3]; - - return __ldexpf (x > 0.0 ? ym : -ym, xe / 3); -} -weak_alias (__cbrtf, cbrtf) diff --git a/sysdeps/libm-ieee754/s_cbrtl.c b/sysdeps/libm-ieee754/s_cbrtl.c deleted file mode 100644 index 1d021b7c3c..0000000000 --- a/sysdeps/libm-ieee754/s_cbrtl.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Compute cubic root of double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Dirk Alboth and - Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. 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" - - -#define CBRT2 1.2599210498948731648 /* 2^(1/3) */ -#define SQR_CBRT2 1.5874010519681994748 /* 2^(2/3) */ - -/* We don't use long double values here since U need not be computed - with full precision. */ -static const double factor[5] = -{ - 1.0 / SQR_CBRT2, - 1.0 / CBRT2, - 1.0, - CBRT2, - SQR_CBRT2 -}; - - -long double -__cbrtl (long double x) -{ - long double xm, ym, u, t2; - int xe; - - /* Reduce X. XM now is an range 1.0 to 0.5. */ - xm = __frexpl (fabs (x), &xe); - - /* If X is not finite or is null return it (with raising exceptions - if necessary. - Note: *Our* version of `frexp' sets XE to zero if the argument is - Inf or NaN. This is not portable but faster. */ - if (xe == 0 && fpclassify (x) <= FP_ZERO) - return x + x; - - u = (0.338058687610520237 - + (1.67595307700780102 - + (-2.82414939754975962 - + (4.09559907378707839 + - (-4.11151425200350531 - + (2.65298938441952296 + - (-0.988553671195413709 - + 0.161617097923756032 * xm) - * xm) - * xm) - * xm) - * xm) - * xm) - *xm); - - t2 = u * u * u; - - ym = u * (t2 + 2.0 * xm) / (2.0 * t2 + xm) * factor[2 + xe % 3]; - - return __ldexpl (x > 0.0 ? ym : -ym, xe / 3); -} -weak_alias (__cbrtl, cbrtl) diff --git a/sysdeps/libm-ieee754/s_ccos.c b/sysdeps/libm-ieee754/s_ccos.c deleted file mode 100644 index f8dfcc8af6..0000000000 --- a/sysdeps/libm-ieee754/s_ccos.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Return cosine of complex double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - - -__complex__ double -__ccos (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || __isnan (__imag__ x)) - { - if (__real__ x == 0.0 || __imag__ x == 0.0) - { - __real__ res = __nan (""); - __imag__ res = 0.0; - -#ifdef FE_INVALID - if (__isinf (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else if (__isinf (__imag__ x)) - { - __real__ res = HUGE_VAL; - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (__isinf (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (isfinite (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __complex__ double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - res = __ccosh (y); - } - - return res; -} -weak_alias (__ccos, ccos) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccos, __ccosl) -weak_alias (__ccos, ccosl) -#endif diff --git a/sysdeps/libm-ieee754/s_ccosf.c b/sysdeps/libm-ieee754/s_ccosf.c deleted file mode 100644 index b090ae5747..0000000000 --- a/sysdeps/libm-ieee754/s_ccosf.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Return cosine of complex float value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - - -__complex__ float -__ccosf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || __isnanf (__imag__ x)) - { - if (__real__ x == 0.0 || __imag__ x == 0.0) - { - __real__ res = __nanf (""); - __imag__ res = 0.0; - -#ifdef FE_INVALID - if (__isinff (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else if (__isinff (__imag__ x)) - { - __real__ res = HUGE_VALF; - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (__isinff (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (isfinite (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __complex__ float y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - res = __ccoshf (y); - } - - return res; -} -weak_alias (__ccosf, ccosf) diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c deleted file mode 100644 index 394101f23a..0000000000 --- a/sysdeps/libm-ieee754/s_ccosh.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Complex cosine hyperbole function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ double -__ccosh (__complex__ double x) -{ - __complex__ double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double sinh_val = __ieee754_sinh (__real__ x); - double cosh_val = __ieee754_cosh (__real__ x); - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = cosh_val * cosix; - __imag__ retval = sinh_val * sinix; - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan (""); - __real__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __imag__ x * __copysign (1.0, __real__ x); - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysign (HUGE_VAL, cosix); - __imag__ retval = (__copysign (HUGE_VAL, sinix) - * __copysign (1.0, __real__ x)); - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan (""); - } - - return retval; -} -weak_alias (__ccosh, ccosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__ccosh, __ccoshl) -weak_alias (__ccosh, ccoshl) -#endif diff --git a/sysdeps/libm-ieee754/s_ccoshf.c b/sysdeps/libm-ieee754/s_ccoshf.c deleted file mode 100644 index a8043fdd39..0000000000 --- a/sysdeps/libm-ieee754/s_ccoshf.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Complex cosine hyperbole function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ float -__ccoshf (__complex__ float x) -{ - __complex__ float retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float sinh_val = __ieee754_sinhf (__real__ x); - float cosh_val = __ieee754_coshf (__real__ x); - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = cosh_val * cosix; - __imag__ retval = sinh_val * sinix; - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf (""); - __real__ retval = __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x); - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignf (HUGE_VALF, cosix); - __imag__ retval = (__copysignf (HUGE_VALF, sinix) - * __copysignf (1.0, __real__ x)); - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf ("") + __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf (""); - } - - return retval; -} -weak_alias (__ccoshf, ccoshf) diff --git a/sysdeps/libm-ieee754/s_ccoshl.c b/sysdeps/libm-ieee754/s_ccoshl.c deleted file mode 100644 index 9301a9e10d..0000000000 --- a/sysdeps/libm-ieee754/s_ccoshl.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Complex cosine hyperbole function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ long double -__ccoshl (__complex__ long double x) -{ - __complex__ long double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinh_val = __ieee754_sinhl (__real__ x); - long double cosh_val = __ieee754_coshl (__real__ x); - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = cosh_val * cosix; - __imag__ retval = sinh_val * sinix; - } - else - { - __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl (""); - __real__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x); - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignl (HUGE_VALL, cosix); - __imag__ retval = (__copysignl (HUGE_VALL, sinix) - * __copysignl (1.0, __real__ x)); - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl (""); - } - - return retval; -} -weak_alias (__ccoshl, ccoshl) diff --git a/sysdeps/libm-ieee754/s_ccosl.c b/sysdeps/libm-ieee754/s_ccosl.c deleted file mode 100644 index fdcc7a63dd..0000000000 --- a/sysdeps/libm-ieee754/s_ccosl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Return cosine of complex long double value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - - -__complex__ long double -__ccosl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || __isnanl (__imag__ x)) - { - if (__real__ x == 0.0 || __imag__ x == 0.0) - { - __real__ res = __nanl (""); - __imag__ res = 0.0; - -#ifdef FE_INVALID - if (__isinfl (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else if (__isinfl (__imag__ x)) - { - __real__ res = HUGE_VALL; - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (__isinfl (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (isfinite (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __complex__ long double y; - - __real__ y = -__imag__ x; - __imag__ y = __real__ x; - - res = __ccoshl (y); - } - - return res; -} -weak_alias (__ccosl, ccosl) diff --git a/sysdeps/libm-ieee754/s_ceil.c b/sysdeps/libm-ieee754/s_ceil.c deleted file mode 100644 index 1b352a679e..0000000000 --- a/sysdeps/libm-ieee754/s_ceil.c +++ /dev/null @@ -1,85 +0,0 @@ -/* @(#)s_ceil.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_ceil.c,v 1.8 1995/05/10 20:46:53 jtc Exp $"; -#endif - -/* - * ceil(x) - * Return x rounded toward -inf to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to ceil(x). - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double huge = 1.0e300; -#else -static double huge = 1.0e300; -#endif - -#ifdef __STDC__ - double __ceil(double x) -#else - double __ceil(x) - double x; -#endif -{ - int32_t i0,i1,j0; - u_int32_t i,j; - EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;i1=0;} - else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} - } - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0>0) i0 += (0x00100000)>>j0; - i0 &= (~i); i1=0; - } - } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); - if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0>0) { - if(j0==20) i0+=1; - else { - j = i1 + (1<<(52-j0)); - if(j>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;} - else if(i0!=0) { i0=0x3f800000;} - } - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0>0) i0 += (0x00800000)>>j0; - i0 &= (~i); - } - } - } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - return x; -} -weak_alias (__ceilf, ceilf) diff --git a/sysdeps/libm-ieee754/s_ceill.c b/sysdeps/libm-ieee754/s_ceill.c deleted file mode 100644 index d53f3954ba..0000000000 --- a/sysdeps/libm-ieee754/s_ceill.c +++ /dev/null @@ -1,89 +0,0 @@ -/* s_ceill.c -- long double version of s_ceil.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * ceill(x) - * Return x rounded toward -inf to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to ceil(x). - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double huge = 1.0e4930; -#else -static long double huge = 1.0e4930; -#endif - -#ifdef __STDC__ - long double __ceill(long double x) -#else - long double __ceill(x) - long double x; -#endif -{ - int32_t i1,j0; - u_int32_t i,j,se,i0,sx; - GET_LDOUBLE_WORDS(se,i0,i1,x); - sx = (se>>15)&1; - j0 = (se&0x7fff)-0x3fff; - if(j0<31) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(sx) {se=0x8000;i0=0;i1=0;} - else if((i0|i1)!=0) { se=0x3fff;i0=0;i1=0;} - } - } else { - i = (0x7fffffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(sx==0) { - if (j0>0) i0 += (0x80000000)>>j0; - else ++se; - } - i0 &= (~i); i1=0; - } - } - } else if (j0>62) { - if(j0==0x4000) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-31); - if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(sx==0) { - if(j0==31) i0+=1; - else { - j = i1 + (1<<(63-j0)); - if(j, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ double -__cexp (__complex__ double x) -{ - __complex__ double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double exp_val = __ieee754_exp (__real__ x); - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - if (isfinite (exp_val)) - { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - else - { - __real__ retval = __copysign (exp_val, cosix); - __imag__ retval = __copysign (exp_val, sinix); - } - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double value = signbit (__real__ x) ? 0.0 : HUGE_VAL; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysign (value, cosix); - __imag__ retval = __copysign (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VAL; - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysign (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); -#endif - } - - return retval; -} -weak_alias (__cexp, cexp) -#ifdef NO_LONG_DOUBLE -strong_alias (__cexp, __cexpl) -weak_alias (__cexp, cexpl) -#endif diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c deleted file mode 100644 index 603e78d716..0000000000 --- a/sysdeps/libm-ieee754/s_cexpf.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Return value of complex exponential function for float complex value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ float -__cexpf (__complex__ float x) -{ - __complex__ float retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float exp_val = __ieee754_expf (__real__ x); - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - if (isfinite (exp_val)) - { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - else - { - __real__ retval = __copysignf (exp_val, cosix); - __imag__ retval = __copysignf (exp_val, sinix); - } - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float value = signbit (__real__ x) ? 0.0 : HUGE_VALF; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignf (value, cosix); - __imag__ retval = __copysignf (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysignf (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); -#endif - } - - return retval; -} -weak_alias (__cexpf, cexpf) diff --git a/sysdeps/libm-ieee754/s_cexpl.c b/sysdeps/libm-ieee754/s_cexpl.c deleted file mode 100644 index 67fa7a08b9..0000000000 --- a/sysdeps/libm-ieee754/s_cexpl.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Return value of complex exponential function for long double complex value. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ long double -__cexpl (__complex__ long double x) -{ - __complex__ long double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double exp_val = __ieee754_expl (__real__ x); - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - if (isfinite (exp_val)) - { - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - else - { - __real__ retval = __copysignl (exp_val, cosix); - __imag__ retval = __copysignl (exp_val, sinix); - } - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignl (value, cosix); - __imag__ retval = __copysignl (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysignl (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN. */ - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); -#endif - } - - return retval; -} -weak_alias (__cexpl, cexpl) diff --git a/sysdeps/libm-ieee754/s_clog.c b/sysdeps/libm-ieee754/s_clog.c deleted file mode 100644 index c14a734759..0000000000 --- a/sysdeps/libm-ieee754/s_clog.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ double -__clog (__complex__ double x) -{ - __complex__ double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log (__ieee754_hypot (__real__ x, - __imag__ x)); - __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nan (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; - else - __real__ result = __nan (""); - } - - return result; -} -weak_alias (__clog, clog) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog, __clogl) -weak_alias (__clog, clogl) -#endif diff --git a/sysdeps/libm-ieee754/s_clog10.c b/sysdeps/libm-ieee754/s_clog10.c deleted file mode 100644 index 7b2e474b8f..0000000000 --- a/sysdeps/libm-ieee754/s_clog10.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ double -__clog10 (__complex__ double x) -{ - __complex__ double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x, - __imag__ x)); - __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nan (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; - else - __real__ result = __nan (""); - } - - return result; -} -weak_alias (__clog10, clog10) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog10, __clog10l) -weak_alias (__clog10, clog10l) -#endif diff --git a/sysdeps/libm-ieee754/s_clog10f.c b/sysdeps/libm-ieee754/s_clog10f.c deleted file mode 100644 index bc4094b8ba..0000000000 --- a/sysdeps/libm-ieee754/s_clog10f.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ float -__clog10f (__complex__ float x) -{ - __complex__ float result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysignf (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsf (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x, - __imag__ x)); - __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanf (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALF; - else - __real__ result = __nanf (""); - } - - return result; -} -weak_alias (__clog10f, clog10f) diff --git a/sysdeps/libm-ieee754/s_clog10l.c b/sysdeps/libm-ieee754/s_clog10l.c deleted file mode 100644 index 186eba25cd..0000000000 --- a/sysdeps/libm-ieee754/s_clog10l.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ long double -__clog10l (__complex__ long double x) -{ - __complex__ long double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; - __imag__ result = __copysignl (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsl (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x, - __imag__ x)); - __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanl (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALL; - else - __real__ result = __nanl (""); - } - - return result; -} -weak_alias (__clog10l, clog10l) diff --git a/sysdeps/libm-ieee754/s_clogf.c b/sysdeps/libm-ieee754/s_clogf.c deleted file mode 100644 index 9c9aa83e33..0000000000 --- a/sysdeps/libm-ieee754/s_clogf.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ float -__clogf (__complex__ float x) -{ - __complex__ float result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysignf (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsf (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x, - __imag__ x)); - __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanf (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALF; - else - __real__ result = __nanf (""); - } - - return result; -} -weak_alias (__clogf, clogf) diff --git a/sysdeps/libm-ieee754/s_clogl.c b/sysdeps/libm-ieee754/s_clogl.c deleted file mode 100644 index a297ec9628..0000000000 --- a/sysdeps/libm-ieee754/s_clogl.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ long double -__clogl (__complex__ long double x) -{ - __complex__ long double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls == FP_ZERO && icls == FP_ZERO) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; - __imag__ result = __copysignl (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsl (__real__ x); - } - else if (rcls != FP_NAN && icls != FP_NAN) - { - /* Neither real nor imaginary part is NaN. */ - __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x, - __imag__ x)); - __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanl (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALL; - else - __real__ result = __nanl (""); - } - - return result; -} -weak_alias (__clogl, clogl) diff --git a/sysdeps/libm-ieee754/s_copysign.c b/sysdeps/libm-ieee754/s_copysign.c deleted file mode 100644 index 5e35e6943c..0000000000 --- a/sysdeps/libm-ieee754/s_copysign.c +++ /dev/null @@ -1,43 +0,0 @@ -/* @(#)s_copysign.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $"; -#endif - -/* - * copysign(double x, double y) - * copysign(x,y) returns a value with the magnitude of x and - * with the sign bit of y. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __copysign(double x, double y) -#else - double __copysign(x,y) - double x,y; -#endif -{ - u_int32_t hx,hy; - GET_HIGH_WORD(hx,x); - GET_HIGH_WORD(hy,y); - SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000)); - return x; -} -weak_alias (__copysign, copysign) -#ifdef NO_LONG_DOUBLE -strong_alias (__copysign, __copysignl) -weak_alias (__copysign, copysignl) -#endif diff --git a/sysdeps/libm-ieee754/s_copysignf.c b/sysdeps/libm-ieee754/s_copysignf.c deleted file mode 100644 index a4e84e5397..0000000000 --- a/sysdeps/libm-ieee754/s_copysignf.c +++ /dev/null @@ -1,42 +0,0 @@ -/* s_copysignf.c -- float version of s_copysign.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_copysignf.c,v 1.4 1995/05/10 20:46:59 jtc Exp $"; -#endif - -/* - * copysignf(float x, float y) - * copysignf(x,y) returns a value with the magnitude of x and - * with the sign bit of y. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __copysignf(float x, float y) -#else - float __copysignf(x,y) - float x,y; -#endif -{ - u_int32_t ix,iy; - GET_FLOAT_WORD(ix,x); - GET_FLOAT_WORD(iy,y); - SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000)); - return x; -} -weak_alias (__copysignf, copysignf) diff --git a/sysdeps/libm-ieee754/s_copysignl.c b/sysdeps/libm-ieee754/s_copysignl.c deleted file mode 100644 index 9976575b3b..0000000000 --- a/sysdeps/libm-ieee754/s_copysignl.c +++ /dev/null @@ -1,43 +0,0 @@ -/* s_copysignl.c -- long double version of s_copysign.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * copysignl(long double x, long double y) - * copysignl(x,y) returns a value with the magnitude of x and - * with the sign bit of y. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __copysignl(long double x, long double y) -#else - long double __copysignl(x,y) - long double x,y; -#endif -{ - u_int32_t es1,es2; - GET_LDOUBLE_EXP(es1,x); - GET_LDOUBLE_EXP(es2,y); - SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000)); - return x; -} -weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-ieee754/s_cos.c b/sysdeps/libm-ieee754/s_cos.c deleted file mode 100644 index 7edb5deafe..0000000000 --- a/sysdeps/libm-ieee754/s_cos.c +++ /dev/null @@ -1,87 +0,0 @@ -/* @(#)s_cos.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; -#endif - -/* cos(x) - * Return cosine function of x. - * - * kernel function: - * __kernel_sin ... sine function on [-pi/4,pi/4] - * __kernel_cos ... cosine function on [-pi/4,pi/4] - * __ieee754_rem_pio2 ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __cos(double x) -#else - double __cos(x) - double x; -#endif -{ - double y[2],z=0.0; - int32_t n, ix; - - /* High word of x. */ - GET_HIGH_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3fe921fb) return __kernel_cos(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7ff00000) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x,y); - switch(n&3) { - case 0: return __kernel_cos(y[0],y[1]); - case 1: return -__kernel_sin(y[0],y[1],1); - case 2: return -__kernel_cos(y[0],y[1]); - default: - return __kernel_sin(y[0],y[1],1); - } - } -} -weak_alias (__cos, cos) -#ifdef NO_LONG_DOUBLE -strong_alias (__cos, __cosl) -weak_alias (__cos, cosl) -#endif diff --git a/sysdeps/libm-ieee754/s_cosf.c b/sysdeps/libm-ieee754/s_cosf.c deleted file mode 100644 index 86c59d440c..0000000000 --- a/sysdeps/libm-ieee754/s_cosf.c +++ /dev/null @@ -1,60 +0,0 @@ -/* s_cosf.c -- float version of s_cos.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float one=1.0; -#else -static float one=1.0; -#endif - -#ifdef __STDC__ - float __cosf(float x) -#else - float __cosf(x) - float x; -#endif -{ - float y[2],z=0.0; - int32_t n,ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fd8) return __kernel_cosf(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2f(x,y); - switch(n&3) { - case 0: return __kernel_cosf(y[0],y[1]); - case 1: return -__kernel_sinf(y[0],y[1],1); - case 2: return -__kernel_cosf(y[0],y[1]); - default: - return __kernel_sinf(y[0],y[1],1); - } - } -} -weak_alias (__cosf, cosf) diff --git a/sysdeps/libm-ieee754/s_cosl.c b/sysdeps/libm-ieee754/s_cosl.c deleted file mode 100644 index 9765f7fd4e..0000000000 --- a/sysdeps/libm-ieee754/s_cosl.c +++ /dev/null @@ -1,88 +0,0 @@ -/* s_cosl.c -- long double version of s_cos.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* cosl(x) - * Return cosine function of x. - * - * kernel function: - * __kernel_sinl ... sine function on [-pi/4,pi/4] - * __kernel_cosl ... cosine function on [-pi/4,pi/4] - * __ieee754_rem_pio2l ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __cosl(long double x) -#else - long double __cosl(x) - long double x; -#endif -{ - long double y[2],z=0.0; - int32_t n, se, i0, i1; - - /* High word of x. */ - GET_LDOUBLE_WORDS(se,i0,i1,x); - - /* |x| ~< pi/4 */ - se &= 0x7fff; - if(se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2)) - return __kernel_cosl(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (se==0x7fff) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2l(x,y); - switch(n&3) { - case 0: return __kernel_cosl(y[0],y[1]); - case 1: return -__kernel_sinl(y[0],y[1],1); - case 2: return -__kernel_cosl(y[0],y[1]); - default: - return __kernel_sinl(y[0],y[1],1); - } - } -} -weak_alias (__cosl, cosl) diff --git a/sysdeps/libm-ieee754/s_cpow.c b/sysdeps/libm-ieee754/s_cpow.c deleted file mode 100644 index 074b38bd2d..0000000000 --- a/sysdeps/libm-ieee754/s_cpow.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Complex power of double values. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ double -__cpow (__complex__ double x, __complex__ double c) -{ - return __cexp (c * __clog (x)); -} -weak_alias (__cpow, cpow) -#ifdef NO_LONG_DOUBLE -strong_alias (__cpow, __cpowl) -weak_alias (__cpow, cpowl) -#endif diff --git a/sysdeps/libm-ieee754/s_cpowf.c b/sysdeps/libm-ieee754/s_cpowf.c deleted file mode 100644 index fa4541ca2b..0000000000 --- a/sysdeps/libm-ieee754/s_cpowf.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Complex power of float values. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ float -__cpowf (__complex__ float x, __complex__ float c) -{ - return __cexpf (c * __clogf (x)); -} -weak_alias (__cpowf, cpowf) diff --git a/sysdeps/libm-ieee754/s_cpowl.c b/sysdeps/libm-ieee754/s_cpowl.c deleted file mode 100644 index 69097d5dcc..0000000000 --- a/sysdeps/libm-ieee754/s_cpowl.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Complex power of long double values. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ long double -__cpowl (__complex__ long double x, __complex__ long double c) -{ - return __cexpl (c * __clogl (x)); -} -weak_alias (__cpowl, cpowl) diff --git a/sysdeps/libm-ieee754/s_cproj.c b/sysdeps/libm-ieee754/s_cproj.c deleted file mode 100644 index fb50bb5a88..0000000000 --- a/sysdeps/libm-ieee754/s_cproj.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Compute projection of complex double value to Riemann sphere. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ double -__cproj (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - __real__ res = INFINITY; - __imag__ res = __copysign (0.0, __imag__ x); - } - else - { - double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0; - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__cproj, cproj) -#ifdef NO_LONG_DOUBLE -strong_alias (__cproj, __cprojl) -weak_alias (__cproj, cprojl) -#endif diff --git a/sysdeps/libm-ieee754/s_cprojf.c b/sysdeps/libm-ieee754/s_cprojf.c deleted file mode 100644 index b90590835c..0000000000 --- a/sysdeps/libm-ieee754/s_cprojf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Compute projection of complex float value to Riemann sphere. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ float -__cprojf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - __real__ res = INFINITY; - __imag__ res = __copysignf (0.0, __imag__ x); - } - else - { - float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0; - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__cprojf, cprojf) diff --git a/sysdeps/libm-ieee754/s_cprojl.c b/sysdeps/libm-ieee754/s_cprojl.c deleted file mode 100644 index 13da4b417d..0000000000 --- a/sysdeps/libm-ieee754/s_cprojl.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Compute projection of complex long double value to Riemann sphere. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - - -__complex__ long double -__cprojl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - __real__ res = INFINITY; - __imag__ res = __copysignl (0.0, __imag__ x); - } - else - { - long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x - + 1.0); - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__cprojl, cprojl) diff --git a/sysdeps/libm-ieee754/s_csin.c b/sysdeps/libm-ieee754/s_csin.c deleted file mode 100644 index 6627387d42..0000000000 --- a/sysdeps/libm-ieee754/s_csin.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Complex sine function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ double -__csin (__complex__ double x) -{ - __complex__ double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabs (__real__ x); - - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - double sinh_val = __ieee754_sinh (__imag__ x); - double cosh_val = __ieee754_cosh (__imag__ x); - double sinix, cosix; - - __sincos (__real__ x, &sinix, &cosix); - - __real__ retval = cosh_val * sinix; - __imag__ retval = sinh_val * cosix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = __nan (""); - __imag__ retval = __imag__ x; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (icls == FP_INFINITE) - { - /* Imaginary part is infinite. */ - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __imag__ x; - } - else if (rcls > FP_ZERO) - { - /* Real part is finite. */ - double sinix, cosix; - - __sincos (__real__ x, &sinix, &cosix); - - __real__ retval = __copysign (HUGE_VAL, sinix); - __imag__ retval = __copysign (HUGE_VAL, cosix); - - if (negate) - __real__ retval = -__real__ retval; - if (signbit (__imag__ x)) - __imag__ retval = -__imag__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = __nan (""); - __imag__ retval = HUGE_VAL; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - if (rcls == FP_ZERO) - __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); - else - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - } - - return retval; -} -weak_alias (__csin, csin) -#ifdef NO_LONG_DOUBLE -strong_alias (__csin, __csinl) -weak_alias (__csin, csinl) -#endif diff --git a/sysdeps/libm-ieee754/s_csinf.c b/sysdeps/libm-ieee754/s_csinf.c deleted file mode 100644 index 31d2f1fd54..0000000000 --- a/sysdeps/libm-ieee754/s_csinf.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Complex sine function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ float -__csinf (__complex__ float x) -{ - __complex__ float retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsf (__real__ x); - - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - float sinh_val = __ieee754_sinhf (__imag__ x); - float cosh_val = __ieee754_coshf (__imag__ x); - float sinix, cosix; - - __sincosf (__real__ x, &sinix, &cosix); - - __real__ retval = cosh_val * sinix; - __imag__ retval = sinh_val * cosix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = __nanf (""); - __imag__ retval = __imag__ x; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (icls == FP_INFINITE) - { - /* Imaginary part is infinite. */ - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __imag__ x; - } - else if (rcls > FP_ZERO) - { - /* Real part is finite. */ - float sinix, cosix; - - __sincosf (__real__ x, &sinix, &cosix); - - __real__ retval = __copysignf (HUGE_VALF, sinix); - __imag__ retval = __copysignf (HUGE_VALF, cosix); - - if (negate) - __real__ retval = -__real__ retval; - if (signbit (__imag__ x)) - __imag__ retval = -__imag__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = __nanf (""); - __imag__ retval = HUGE_VALF; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - if (rcls == FP_ZERO) - __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); - else - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - } - - return retval; -} -weak_alias (__csinf, csinf) diff --git a/sysdeps/libm-ieee754/s_csinh.c b/sysdeps/libm-ieee754/s_csinh.c deleted file mode 100644 index 29a271fec6..0000000000 --- a/sysdeps/libm-ieee754/s_csinh.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Complex sine hyperbole function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ double -__csinh (__complex__ double x) -{ - __complex__ double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabs (__real__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - double sinh_val = __ieee754_sinh (__real__ x); - double cosh_val = __ieee754_cosh (__real__ x); - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = sinh_val * cosix; - __imag__ retval = cosh_val * sinix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = negate ? -HUGE_VAL : HUGE_VAL; - __imag__ retval = __imag__ x; - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - double sinix, cosix; - - __sincos (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysign (HUGE_VAL, cosix); - __imag__ retval = __copysign (HUGE_VAL, sinix); - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VAL; - __imag__ retval = __nan ("") + __nan (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nan (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan (""); - } - - return retval; -} -weak_alias (__csinh, csinh) -#ifdef NO_LONG_DOUBLE -strong_alias (__csinh, __csinhl) -weak_alias (__csinh, csinhl) -#endif diff --git a/sysdeps/libm-ieee754/s_csinhf.c b/sysdeps/libm-ieee754/s_csinhf.c deleted file mode 100644 index 9c479bba95..0000000000 --- a/sysdeps/libm-ieee754/s_csinhf.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Complex sine hyperbole function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ float -__csinhf (__complex__ float x) -{ - __complex__ float retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsf (__real__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - float sinh_val = __ieee754_sinhf (__real__ x); - float cosh_val = __ieee754_coshf (__real__ x); - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = sinh_val * cosix; - __imag__ retval = cosh_val * sinix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __nanf ("") + __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = negate ? -HUGE_VALF : HUGE_VALF; - __imag__ retval = __imag__ x; - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - float sinix, cosix; - - __sincosf (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignf (HUGE_VALF, cosix); - __imag__ retval = __copysignf (HUGE_VALF, sinix); - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf ("") + __nanf (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanf (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf (""); - } - - return retval; -} -weak_alias (__csinhf, csinhf) diff --git a/sysdeps/libm-ieee754/s_csinhl.c b/sysdeps/libm-ieee754/s_csinhl.c deleted file mode 100644 index 471cc7e81e..0000000000 --- a/sysdeps/libm-ieee754/s_csinhl.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Complex sine hyperbole function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ long double -__csinhl (__complex__ long double x) -{ - __complex__ long double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsl (__real__ x); - - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinh_val = __ieee754_sinhl (__real__ x); - long double cosh_val = __ieee754_coshl (__real__ x); - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = sinh_val * cosix; - __imag__ retval = cosh_val * sinix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (rcls == FP_INFINITE) - { - /* Real part is infinite. */ - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = negate ? -HUGE_VALL : HUGE_VALL; - __imag__ retval = __imag__ x; - } - else if (icls > FP_ZERO) - { - /* Imaginary part is finite. */ - long double sinix, cosix; - - __sincosl (__imag__ x, &sinix, &cosix); - - __real__ retval = __copysignl (HUGE_VALL, cosix); - __imag__ retval = __copysignl (HUGE_VALL, sinix); - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl ("") + __nanl (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl (""); - } - - return retval; -} -weak_alias (__csinhl, csinhl) diff --git a/sysdeps/libm-ieee754/s_csinl.c b/sysdeps/libm-ieee754/s_csinl.c deleted file mode 100644 index bae8648c32..0000000000 --- a/sysdeps/libm-ieee754/s_csinl.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Complex sine function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ long double -__csinl (__complex__ long double x) -{ - __complex__ long double retval; - int negate = signbit (__real__ x); - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - __real__ x = fabsl (__real__ x); - - if (icls >= FP_ZERO) - { - /* Imaginary part is finite. */ - if (rcls >= FP_ZERO) - { - /* Real part is finite. */ - long double sinh_val = __ieee754_sinhl (__imag__ x); - long double cosh_val = __ieee754_coshl (__imag__ x); - long double sinix, cosix; - - __sincosl (__real__ x, &sinix, &cosix); - - __real__ retval = cosh_val * sinix; - __imag__ retval = sinh_val * cosix; - - if (negate) - __real__ retval = -__real__ retval; - } - else - { - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = __nanl (""); - __imag__ retval = __imag__ x; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - else - { - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - } - } - } - else if (icls == FP_INFINITE) - { - /* Imaginary part is infinite. */ - if (rcls == FP_ZERO) - { - /* Real part is 0.0. */ - __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); - __imag__ retval = __imag__ x; - } - else if (rcls > FP_ZERO) - { - /* Real part is finite. */ - long double sinix, cosix; - - __sincosl (__real__ x, &sinix, &cosix); - - __real__ retval = __copysignl (HUGE_VALL, sinix); - __imag__ retval = __copysignl (HUGE_VALL, cosix); - - if (negate) - __real__ retval = -__real__ retval; - if (signbit (__imag__ x)) - __imag__ retval = -__imag__ retval; - } - else - { - /* The addition raises the invalid exception. */ - __real__ retval = __nanl (""); - __imag__ retval = HUGE_VALL; - -#ifdef FE_INVALID - if (rcls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - if (rcls == FP_ZERO) - __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0); - else - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - } - - return retval; -} -weak_alias (__csinl, csinl) diff --git a/sysdeps/libm-ieee754/s_csqrt.c b/sysdeps/libm-ieee754/s_csqrt.c deleted file mode 100644 index a4dedf8806..0000000000 --- a/sysdeps/libm-ieee754/s_csqrt.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Complex square root of double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ double -__csqrt (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nan ("") : 0; - __imag__ res = __copysign (HUGE_VAL, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nan ("") : __copysign (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else - { - if (icls == FP_ZERO) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysign (__ieee754_sqrt (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabs (__ieee754_sqrt (__real__ x)); - __imag__ res = __copysign (0.0, __imag__ x); - } - } - else if (rcls == FP_ZERO) - { - double r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); - - __real__ res = __copysign (r, __imag__ x); - __imag__ res = r; - } - else - { - double d, r, s; - - d = __ieee754_hypot (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x); - s = (0.5 * __imag__ x) / r; - } - else - { - s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x); - r = fabs ((0.5 * __imag__ x) / s); - } - - __real__ res = r; - __imag__ res = __copysign (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrt, csqrt) -#ifdef NO_LONG_DOUBLE -strong_alias (__csqrt, __csqrtl) -weak_alias (__csqrt, csqrtl) -#endif diff --git a/sysdeps/libm-ieee754/s_csqrtf.c b/sysdeps/libm-ieee754/s_csqrtf.c deleted file mode 100644 index 3bc979f6e2..0000000000 --- a/sysdeps/libm-ieee754/s_csqrtf.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Complex square root of float value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ float -__csqrtf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nanf ("") : 0; - __imag__ res = __copysignf (HUGE_VALF, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nanf ("") : __copysignf (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else - { - if (icls == FP_ZERO) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabsf (__ieee754_sqrtf (__real__ x)); - __imag__ res = __copysignf (0.0, __imag__ x); - } - } - else if (rcls == FP_ZERO) - { - float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x)); - - __real__ res = __copysignf (r, __imag__ x); - __imag__ res = r; - } - else - { - float d, r, s; - - d = __ieee754_hypotf (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x); - s = (0.5f * __imag__ x) / r; - } - else - { - s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x); - r = fabsf ((0.5f * __imag__ x) / s); - } - - __real__ res = r; - __imag__ res = __copysignf (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrtf, csqrtf) diff --git a/sysdeps/libm-ieee754/s_csqrtl.c b/sysdeps/libm-ieee754/s_csqrtl.c deleted file mode 100644 index b806bc6785..0000000000 --- a/sysdeps/libm-ieee754/s_csqrtl.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Complex square root of long double value. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include "math_private.h" - - -__complex__ long double -__csqrtl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (rcls <= FP_INFINITE || icls <= FP_INFINITE) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nanl ("") : 0; - __imag__ res = __copysignl (HUGE_VALL, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nanl ("") : __copysignl (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else - { - if (icls == FP_ZERO) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabsl (__ieee754_sqrtl (__real__ x)); - __imag__ res = __copysignl (0.0, __imag__ x); - } - } - else if (rcls == FP_ZERO) - { - long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x)); - - __real__ res = __copysignl (r, __imag__ x); - __imag__ res = r; - } - else - { - long double d, r, s; - - d = __ieee754_hypotl (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x); - s = (0.5L * __imag__ x) / r; - } - else - { - s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x); - r = fabsl ((0.5L * __imag__ x) / s); - } - - __real__ res = r; - __imag__ res = __copysignl (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrtl, csqrtl) diff --git a/sysdeps/libm-ieee754/s_ctan.c b/sysdeps/libm-ieee754/s_ctan.c deleted file mode 100644 index f1ce9688bb..0000000000 --- a/sysdeps/libm-ieee754/s_ctan.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Complex tangent function for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ double -__ctan (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinf (__imag__ x)) - { - __real__ res = __copysign (0.0, __real__ x); - __imag__ res = __copysign (1.0, __imag__ x); - } - else if (__real__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (__isinf (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - double sin2rx, cos2rx; - double den; - - __sincos (2.0 * __real__ x, &sin2rx, &cos2rx); - - den = cos2rx + __ieee754_cosh (2.0 * __imag__ x); - - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__ctan, ctan) -#ifdef NO_LONG_DOUBLE -strong_alias (__ctan, __ctanl) -weak_alias (__ctan, ctanl) -#endif diff --git a/sysdeps/libm-ieee754/s_ctanf.c b/sysdeps/libm-ieee754/s_ctanf.c deleted file mode 100644 index 750d3511b9..0000000000 --- a/sysdeps/libm-ieee754/s_ctanf.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex tangent function for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ float -__ctanf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinff (__imag__ x)) - { - __real__ res = __copysignf (0.0, __real__ x); - __imag__ res = __copysignf (1.0, __imag__ x); - } - else if (__real__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (__isinff (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - float sin2rx, cos2rx; - float den; - - __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx); - - den = cos2rx + __ieee754_coshf (2.0 * __imag__ x); - - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__ctanf, ctanf) diff --git a/sysdeps/libm-ieee754/s_ctanh.c b/sysdeps/libm-ieee754/s_ctanh.c deleted file mode 100644 index d8825f35f9..0000000000 --- a/sysdeps/libm-ieee754/s_ctanh.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Complex hyperbole tangent for double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ double -__ctanh (__complex__ double x) -{ - __complex__ double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinf (__real__ x)) - { - __real__ res = __copysign (1.0, __real__ x); - __imag__ res = __copysign (0.0, __imag__ x); - } - else if (__imag__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - -#ifdef FE_INVALID - if (__isinf (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - double sin2ix, cos2ix; - double den; - - __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix); - - den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix); - - __real__ res = __ieee754_sinh (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; - } - - return res; -} -weak_alias (__ctanh, ctanh) -#ifdef NO_LONG_DOUBLE -strong_alias (__ctanh, __ctanhl) -weak_alias (__ctanh, ctanhl) -#endif diff --git a/sysdeps/libm-ieee754/s_ctanhf.c b/sysdeps/libm-ieee754/s_ctanhf.c deleted file mode 100644 index fd66648d79..0000000000 --- a/sysdeps/libm-ieee754/s_ctanhf.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex hyperbole tangent for float. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ float -__ctanhf (__complex__ float x) -{ - __complex__ float res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinff (__real__ x)) - { - __real__ res = __copysignf (1.0, __real__ x); - __imag__ res = __copysignf (0.0, __imag__ x); - } - else if (__imag__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - -#ifdef FE_INVALID - if (__isinff (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - float sin2ix, cos2ix; - float den; - - __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix); - - den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix); - - __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; - } - - return res; -} -weak_alias (__ctanhf, ctanhf) diff --git a/sysdeps/libm-ieee754/s_ctanhl.c b/sysdeps/libm-ieee754/s_ctanhl.c deleted file mode 100644 index 5ec06a6fa4..0000000000 --- a/sysdeps/libm-ieee754/s_ctanhl.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex hyperbole tangent for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ long double -__ctanhl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinfl (__real__ x)) - { - __real__ res = __copysignl (1.0, __real__ x); - __imag__ res = __copysignl (0.0, __imag__ x); - } - else if (__imag__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (__isinfl (__imag__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - long double sin2ix, cos2ix; - long double den; - - __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix); - - den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix); - - __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; - } - - return res; -} -weak_alias (__ctanhl, ctanhl) diff --git a/sysdeps/libm-ieee754/s_ctanl.c b/sysdeps/libm-ieee754/s_ctanl.c deleted file mode 100644 index 31ab3b48a6..0000000000 --- a/sysdeps/libm-ieee754/s_ctanl.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Complex tangent function for long double. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include "math_private.h" - - -__complex__ long double -__ctanl (__complex__ long double x) -{ - __complex__ long double res; - - if (!isfinite (__real__ x) || !isfinite (__imag__ x)) - { - if (__isinfl (__imag__ x)) - { - __real__ res = __copysignl (0.0, __real__ x); - __imag__ res = __copysignl (1.0, __imag__ x); - } - else if (__real__ x == 0.0) - { - res = x; - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - -#ifdef FE_INVALID - if (__isinfl (__real__ x)) - feraiseexcept (FE_INVALID); -#endif - } - } - else - { - long double sin2rx, cos2rx; - long double den; - - __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx); - - den = cos2rx + __ieee754_coshl (2.0 * __imag__ x); - - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den; - } - - return res; -} -weak_alias (__ctanl, ctanl) diff --git a/sysdeps/libm-ieee754/s_erf.c b/sysdeps/libm-ieee754/s_erf.c deleted file mode 100644 index d8b6629a72..0000000000 --- a/sysdeps/libm-ieee754/s_erf.c +++ /dev/null @@ -1,431 +0,0 @@ -/* @(#)s_erf.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; -#endif - -/* double erf(double x) - * double erfc(double x) - * x - * 2 |\ - * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| - * 0 - * - * erfc(x) = 1-erf(x) - * Note that - * erf(-x) = -erf(x) - * erfc(-x) = 2 - erfc(x) - * - * Method: - * 1. For |x| in [0, 0.84375] - * erf(x) = x + x*R(x^2) - * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] - * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] - * where R = P/Q where P is an odd poly of degree 8 and - * Q is an odd poly of degree 10. - * -57.90 - * | R - (erf(x)-x)/x | <= 2 - * - * - * Remark. The formula is derived by noting - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) - * and that - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 - * is close to one. The interval is chosen because the fix - * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is - * near 0.6174), and by some experiment, 0.84375 is chosen to - * guarantee the error is less than one ulp for erf. - * - * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and - * c = 0.84506291151 rounded to single (24 bits) - * erf(x) = sign(x) * (c + P1(s)/Q1(s)) - * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 - * 1+(c+P1(s)/Q1(s)) if x < 0 - * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 - * Remark: here we use the taylor series expansion at x=1. - * erf(1+s) = erf(1) + s*Poly(s) - * = 0.845.. + P1(s)/Q1(s) - * That is, we use rational approximation to approximate - * erf(1+s) - (c = (single)0.84506291151) - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where - * P1(s) = degree 6 poly in s - * Q1(s) = degree 6 poly in s - * - * 3. For x in [1.25,1/0.35(~2.857143)], - * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) - * erf(x) = 1 - erfc(x) - * where - * R1(z) = degree 7 poly in z, (z=1/x^2) - * S1(z) = degree 8 poly in z - * - * 4. For x in [1/0.35,28] - * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 - * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 - * erf(x) = sign(x) *(1 - tiny) (raise inexact) - * erfc(x) = tiny*tiny (raise underflow) if x > 0 - * = 2 - tiny if x<0 - * - * 7. Special case: - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, - * erfc/erf(NaN) is NaN - */ - - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -tiny = 1e-300, -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ - /* c = (float)0.84506291151 */ -erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ -efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ -pp[] = {1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ - -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ - -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ - -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ - -2.37630166566501626084e-05}, /* 0xBEF8EAD6, 0x120016AC */ -qq[] = {0.0, 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ - 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ - 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ - 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ - -3.96022827877536812320e-06}, /* 0xBED09C43, 0x42A26120 */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa[] = {-2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ - 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ - -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ - 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ - -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ - 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ - -2.16637559486879084300e-03}, /* 0xBF61BF38, 0x0A96073F */ -qa[] = {0.0, 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ - 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ - 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ - 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ - 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ - 1.19844998467991074170e-02}, /* 0x3F888B54, 0x5735151D */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra[] = {-9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ - -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ - -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ - -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ - -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ - -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ - -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ - -9.81432934416914548592e+00}, /* 0xC023A0EF, 0xC69AC25C */ -sa[] = {0.0,1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ - 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ - 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ - 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ - 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ - 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ - 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ - -6.04244152148580987438e-02}, /* 0xBFAEEFF2, 0xEE749A62 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb[] = {-9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ - -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ - -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ - -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ - -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ - -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ - -4.83519191608651397019e+02}, /* 0xC07E384E, 0x9BDC383F */ -sb[] = {0.0,3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ - 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ - 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ - 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ - 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ - 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ - -2.24409524465858183362e+01}; /* 0xC03670E2, 0x42712D62 */ - -#ifdef __STDC__ - double __erf(double x) -#else - double __erf(x) - double x; -#endif -{ - int32_t hx,ix,i; - double R,S,P,Q,s,y,z,r; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) { /* erf(nan)=nan */ - i = ((u_int32_t)hx>>31)<<1; - return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if(ix < 0x3feb0000) { /* |x|<0.84375 */ - double r1,r2,s1,s2,s3,z2,z4; - if(ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) - return 0.125*(8.0*x+efx8*x); /*avoid underflow */ - return x + efx*x; - } - z = x*x; -#ifdef DO_NOT_USE_THIS - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); -#else - r1 = pp[0]+z*pp[1]; z2=z*z; - r2 = pp[2]+z*pp[3]; z4=z2*z2; - s1 = one+z*qq[1]; - s2 = qq[2]+z*qq[3]; - s3 = qq[4]+z*qq[5]; - r = r1 + z2*r2 + z4*pp[4]; - s = s1 + z2*s2 + z4*s3; -#endif - y = r/s; - return x + x*y; - } - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - double s2,s4,s6,P1,P2,P3,P4,Q1,Q2,Q3,Q4; - s = fabs(x)-one; -#ifdef DO_NOT_USE_THIS - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); -#else - P1 = pa[0]+s*pa[1]; s2=s*s; - Q1 = one+s*qa[1]; s4=s2*s2; - P2 = pa[2]+s*pa[3]; s6=s4*s2; - Q2 = qa[2]+s*qa[3]; - P3 = pa[4]+s*pa[5]; - Q3 = qa[4]+s*qa[5]; - P4 = s6*pa[6]; - Q4 = s6*qa[6]; - P = P1 + s2*P2 + s4*P3 + s6*P4; - Q = Q1 + s2*Q2 + s4*Q3 + s6*Q4; -#endif - if(hx>=0) return erx + P/Q; else return -erx - P/Q; - } - if (ix >= 0x40180000) { /* inf>|x|>=6 */ - if(hx>=0) return one-tiny; else return tiny-one; - } - x = fabs(x); - s = one/(x*x); - if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ -#ifdef DO_NOT_USE_THIS - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); -#else - double R1,R2,R3,R4,S1,S2,S3,S4,s2,s4,s6,s8; - R1 = ra[0]+s*ra[1];s2 = s*s; - S1 = one+s*sa[1]; s4 = s2*s2; - R2 = ra[2]+s*ra[3];s6 = s4*s2; - S2 = sa[2]+s*sa[3];s8 = s4*s4; - R3 = ra[4]+s*ra[5]; - S3 = sa[4]+s*sa[5]; - R4 = ra[6]+s*ra[7]; - S4 = sa[6]+s*sa[7]; - R = R1 + s2*R2 + s4*R3 + s6*R4; - S = S1 + s2*S2 + s4*S3 + s6*S4 + s8*sa[8]; -#endif - } else { /* |x| >= 1/0.35 */ -#ifdef DO_NOT_USE_THIS - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); -#else - double R1,R2,R3,S1,S2,S3,S4,s2,s4,s6; - R1 = rb[0]+s*rb[1];s2 = s*s; - S1 = one+s*sb[1]; s4 = s2*s2; - R2 = rb[2]+s*rb[3];s6 = s4*s2; - S2 = sb[2]+s*sb[3]; - R3 = rb[4]+s*rb[5]; - S3 = sb[4]+s*sb[5]; - S4 = sb[6]+s*sb[7]; - R = R1 + s2*R2 + s4*R3 + s6*rb[6]; - S = S1 + s2*S2 + s4*S3 + s6*S4; -#endif - } - z = x; - SET_LOW_WORD(z,0); - r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); - if(hx>=0) return one-r/x; else return r/x-one; -} -weak_alias (__erf, erf) -#ifdef NO_LONG_DOUBLE -strong_alias (__erf, __erfl) -weak_alias (__erf, erfl) -#endif - -#ifdef __STDC__ - double __erfc(double x) -#else - double __erfc(x) - double x; -#endif -{ - int32_t hx,ix; - double R,S,P,Q,s,y,z,r; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (double)(((u_int32_t)hx>>31)<<1)+one/x; - } - - if(ix < 0x3feb0000) { /* |x|<0.84375 */ - double r1,r2,s1,s2,s3,z2,z4; - if(ix < 0x3c700000) /* |x|<2**-56 */ - return one-x; - z = x*x; -#ifdef DO_NOT_USE_THIS - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); -#else - r1 = pp[0]+z*pp[1]; z2=z*z; - r2 = pp[2]+z*pp[3]; z4=z2*z2; - s1 = one+z*qq[1]; - s2 = qq[2]+z*qq[3]; - s3 = qq[4]+z*qq[5]; - r = r1 + z2*r2 + z4*pp[4]; - s = s1 + z2*s2 + z4*s3; -#endif - y = r/s; - if(hx < 0x3fd00000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - double s2,s4,s6,P1,P2,P3,P4,Q1,Q2,Q3,Q4; - s = fabs(x)-one; -#ifdef DO_NOT_USE_THIS - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); -#else - P1 = pa[0]+s*pa[1]; s2=s*s; - Q1 = one+s*qa[1]; s4=s2*s2; - P2 = pa[2]+s*pa[3]; s6=s4*s2; - Q2 = qa[2]+s*qa[3]; - P3 = pa[4]+s*pa[5]; - Q3 = qa[4]+s*qa[5]; - P4 = s6*pa[6]; - Q4 = s6*qa[6]; - P = P1 + s2*P2 + s4*P3 + s6*P4; - Q = Q1 + s2*Q2 + s4*Q3 + s6*Q4; -#endif - if(hx>=0) { - z = one-erx; return z - P/Q; - } else { - z = erx+P/Q; return one+z; - } - } - if (ix < 0x403c0000) { /* |x|<28 */ - x = fabs(x); - s = one/(x*x); - if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ -#ifdef DO_NOT_USE_THIS - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); -#else - double R1,R2,R3,R4,S1,S2,S3,S4,s2,s4,s6,s8; - R1 = ra[0]+s*ra[1];s2 = s*s; - S1 = one+s*sa[1]; s4 = s2*s2; - R2 = ra[2]+s*ra[3];s6 = s4*s2; - S2 = sa[2]+s*sa[3];s8 = s4*s4; - R3 = ra[4]+s*ra[5]; - S3 = sa[4]+s*sa[5]; - R4 = ra[6]+s*ra[7]; - S4 = sa[6]+s*sa[7]; - R = R1 + s2*R2 + s4*R3 + s6*R4; - S = S1 + s2*S2 + s4*S3 + s6*S4 + s8*sa[8]; -#endif - } else { /* |x| >= 1/.35 ~ 2.857143 */ - double R1,R2,R3,S1,S2,S3,S4,s2,s4,s6; - if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */ -#ifdef DO_NOT_USE_THIS - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); -#else - R1 = rb[0]+s*rb[1];s2 = s*s; - S1 = one+s*sb[1]; s4 = s2*s2; - R2 = rb[2]+s*rb[3];s6 = s4*s2; - S2 = sb[2]+s*sb[3]; - R3 = rb[4]+s*rb[5]; - S3 = sb[4]+s*sb[5]; - S4 = sb[6]+s*sb[7]; - R = R1 + s2*R2 + s4*R3 + s6*rb[6]; - S = S1 + s2*S2 + s4*S3 + s6*S4; -#endif - } - z = x; - SET_LOW_WORD(z,0); - r = __ieee754_exp(-z*z-0.5625)* - __ieee754_exp((z-x)*(z+x)+R/S); - if(hx>0) return r/x; else return two-r/x; - } else { - if(hx>0) return tiny*tiny; else return two-tiny; - } -} -weak_alias (__erfc, erfc) -#ifdef NO_LONG_DOUBLE -strong_alias (__erfc, __erfcl) -weak_alias (__erfc, erfcl) -#endif diff --git a/sysdeps/libm-ieee754/s_erff.c b/sysdeps/libm-ieee754/s_erff.c deleted file mode 100644 index 774714cfd1..0000000000 --- a/sysdeps/libm-ieee754/s_erff.c +++ /dev/null @@ -1,225 +0,0 @@ -/* s_erff.c -- float version of s_erf.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -tiny = 1e-30, -half= 5.0000000000e-01, /* 0x3F000000 */ -one = 1.0000000000e+00, /* 0x3F800000 */ -two = 2.0000000000e+00, /* 0x40000000 */ - /* c = (subfloat)0.84506291151 */ -erx = 8.4506291151e-01, /* 0x3f58560b */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx = 1.2837916613e-01, /* 0x3e0375d4 */ -efx8= 1.0270333290e+00, /* 0x3f8375d4 */ -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ -pp1 = -3.2504209876e-01, /* 0xbea66beb */ -pp2 = -2.8481749818e-02, /* 0xbce9528f */ -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ -qq2 = 6.5022252500e-02, /* 0x3d852a63 */ -qq3 = 5.0813062117e-03, /* 0x3ba68116 */ -qq4 = 1.3249473704e-04, /* 0x390aee49 */ -qq5 = -3.9602282413e-06, /* 0xb684e21a */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ -pa1 = 4.1485610604e-01, /* 0x3ed46805 */ -pa2 = -3.7220788002e-01, /* 0xbebe9208 */ -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ -qa4 = 1.2617121637e-01, /* 0x3e013307 */ -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.8649440333e-03, /* 0xbc21a093 */ -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ -ra2 = -1.0558626175e+01, /* 0xc128f022 */ -ra3 = -6.2375331879e+01, /* 0xc2798057 */ -ra4 = -1.6239666748e+02, /* 0xc322658c */ -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ -ra6 = -8.1287437439e+01, /* 0xc2a2932b */ -ra7 = -9.8143291473e+00, /* 0xc11d077e */ -sa1 = 1.9651271820e+01, /* 0x419d35ce */ -sa2 = 1.3765776062e+02, /* 0x4309a863 */ -sa3 = 4.3456588745e+02, /* 0x43d9486f */ -sa4 = 6.4538726807e+02, /* 0x442158c9 */ -sa5 = 4.2900814819e+02, /* 0x43d6810b */ -sa6 = 1.0863500214e+02, /* 0x42d9451f */ -sa7 = 6.5702495575e+00, /* 0x40d23f7c */ -sa8 = -6.0424413532e-02, /* 0xbd777f97 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.8649431020e-03, /* 0xbc21a092 */ -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ -rb2 = -1.7757955551e+01, /* 0xc18e104b */ -rb3 = -1.6063638306e+02, /* 0xc320a2ea */ -rb4 = -6.3756646729e+02, /* 0xc41f6441 */ -rb5 = -1.0250950928e+03, /* 0xc480230b */ -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ -sb1 = 3.0338060379e+01, /* 0x41f2b459 */ -sb2 = 3.2579251099e+02, /* 0x43a2e571 */ -sb3 = 1.5367296143e+03, /* 0x44c01759 */ -sb4 = 3.1998581543e+03, /* 0x4547fdbb */ -sb5 = 2.5530502930e+03, /* 0x451f90ce */ -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ -sb7 = -2.2440952301e+01; /* 0xc1b38712 */ - -#ifdef __STDC__ - float __erff(float x) -#else - float __erff(x) - float x; -#endif -{ - int32_t hx,ix,i; - float R,S,P,Q,s,y,z,r; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7f800000) { /* erf(nan)=nan */ - i = ((u_int32_t)hx>>31)<<1; - return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if(ix < 0x3f580000) { /* |x|<0.84375 */ - if(ix < 0x31800000) { /* |x|<2**-28 */ - if (ix < 0x04000000) - /*avoid underflow */ - return (float)0.125*((float)8.0*x+efx8*x); - return x + efx*x; - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ - s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) return erx + P/Q; else return -erx - P/Q; - } - if (ix >= 0x40c00000) { /* inf>|x|>=6 */ - if(hx>=0) return one-tiny; else return tiny-one; - } - x = fabsf(x); - s = one/(x*x); - if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000); - r = __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S); - if(hx>=0) return one-r/x; else return r/x-one; -} -weak_alias (__erff, erff) - -#ifdef __STDC__ - float __erfcf(float x) -#else - float __erfcf(x) - float x; -#endif -{ - int32_t hx,ix; - float R,S,P,Q,s,y,z,r; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7f800000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (float)(((u_int32_t)hx>>31)<<1)+one/x; - } - - if(ix < 0x3f580000) { /* |x|<0.84375 */ - if(ix < 0x23800000) /* |x|<2**-56 */ - return one-x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if(hx < 0x3e800000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ - s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) { - z = one-erx; return z - P/Q; - } else { - z = erx+P/Q; return one+z; - } - } - if (ix < 0x41e00000) { /* |x|<28 */ - x = fabsf(x); - s = one/(x*x); - if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ - if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000); - r = __ieee754_expf(-z*z-(float)0.5625)* - __ieee754_expf((z-x)*(z+x)+R/S); - if(hx>0) return r/x; else return two-r/x; - } else { - if(hx>0) return tiny*tiny; else return two-tiny; - } -} -weak_alias (__erfcf, erfcf) diff --git a/sysdeps/libm-ieee754/s_exp2.c b/sysdeps/libm-ieee754/s_exp2.c deleted file mode 100644 index 875d4d6f2c..0000000000 --- a/sysdeps/libm-ieee754/s_exp2.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Double-precision floating point 2^x. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Geoffrey Keating - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* The basic design here is from - Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical - Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., - 17 (1), March 1991, pp. 26-45. - It has been slightly modified to compute 2^x instead of e^x. - */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include - -#include "t_exp2.h" - -static const volatile double TWO1023 = 8.988465674311579539e+307; -static const volatile double TWOM1000 = 9.3326361850321887899e-302; - -double -__ieee754_exp2 (double x) -{ - static const double himark = (double) DBL_MAX_EXP; - static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1) - 1.0; - - /* Check for usual case. */ - if (isless (x, himark) && isgreater (x, lomark)) - { - static const double THREEp42 = 13194139533312.0; - int tval, unsafe; - double rx, x22, result; - union ieee754_double ex2_u, scale_u; - fenv_t oldenv; - - feholdexcept (&oldenv); -#ifdef FE_TONEAREST - /* If we don't have this, it's too bad. */ - fesetround (FE_TONEAREST); -#endif - - /* 1. Argument reduction. - Choose integers ex, -256 <= t < 256, and some real - -1/1024 <= x1 <= 1024 so that - x = ex + t/512 + x1. - - First, calculate rx = ex + t/512. */ - rx = x + THREEp42; - rx -= THREEp42; - x -= rx; /* Compute x=x1. */ - /* Compute tval = (ex*512 + t)+256. - Now, t = (tval mod 512)-256 and ex=tval/512 [that's mod, NOT %; and - /-round-to-nearest not the usual c integer /]. */ - tval = (int) (rx * 512.0 + 256.0); - - /* 2. Adjust for accurate table entry. - Find e so that - x = ex + t/512 + e + x2 - where -1e6 < e < 1e6, and - (double)(2^(t/512+e)) - is accurate to one part in 2^-64. */ - - /* 'tval & 511' is the same as 'tval%512' except that it's always - positive. - Compute x = x2. */ - x -= exp2_deltatable[tval & 511]; - - /* 3. Compute ex2 = 2^(t/512+e+ex). */ - ex2_u.d = exp2_accuratetable[tval & 511]; - tval >>= 9; - unsafe = abs(tval) >= -DBL_MIN_EXP - 1; - ex2_u.ieee.exponent += tval >> unsafe; - scale_u.d = 1.0; - scale_u.ieee.exponent += tval - (tval >> unsafe); - - /* 4. Approximate 2^x2 - 1, using a fourth-degree polynomial, - with maximum error in [-2^-10-2^-30,2^-10+2^-30] - less than 10^-19. */ - - x22 = (((.0096181293647031180 - * x + .055504110254308625) - * x + .240226506959100583) - * x + .69314718055994495) * ex2_u.d; - - /* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */ - fesetenv (&oldenv); - - result = x22 * x + ex2_u.d; - - if (!unsafe) - return result; - else - return result * scale_u.d; - } - /* Exceptional cases: */ - else if (isless (x, himark)) - { - if (__isinf (x)) - /* e^-inf == 0, with no error. */ - return 0; - else - /* Underflow */ - return TWOM1000 * TWOM1000; - } - else - /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ - return TWO1023*x; -} diff --git a/sysdeps/libm-ieee754/s_exp2f.c b/sysdeps/libm-ieee754/s_exp2f.c deleted file mode 100644 index 8229885453..0000000000 --- a/sysdeps/libm-ieee754/s_exp2f.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Single-precision floating point 2^x. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Geoffrey Keating - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* The basic design here is from - Shmuel Gal and Boris Bachelis, "An Accurate Elementary Mathematical - Library for the IEEE Floating Point Standard", ACM Trans. Math. Soft., - 17 (1), March 1991, pp. 26-45. - It has been slightly modified to compute 2^x instead of e^x, and for - single-precision. - */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include - -#include "t_exp2f.h" - -static const volatile float TWOM100 = 7.88860905e-31; -static const volatile float TWO127 = 1.7014118346e+38; - -float -__ieee754_exp2f (float x) -{ - static const float himark = (float) FLT_MAX_EXP; - static const float lomark = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1) - 1.0; - - /* Check for usual case. */ - if (isless (x, himark) && isgreater (x, lomark)) - { - static const float THREEp14 = 49152.0; - int tval, unsafe; - float rx, x22, result; - union ieee754_float ex2_u, scale_u; - fenv_t oldenv; - - feholdexcept (&oldenv); -#ifdef FE_TONEAREST - /* If we don't have this, it's too bad. */ - fesetround (FE_TONEAREST); -#endif - - /* 1. Argument reduction. - Choose integers ex, -128 <= t < 128, and some real - -1/512 <= x1 <= 1/512 so that - x = ex + t/512 + x1. - - First, calculate rx = ex + t/256. */ - rx = x + THREEp14; - rx -= THREEp14; - x -= rx; /* Compute x=x1. */ - /* Compute tval = (ex*256 + t)+128. - Now, t = (tval mod 256)-128 and ex=tval/256 [that's mod, NOT %; and - /-round-to-nearest not the usual c integer /]. */ - tval = (int) (rx * 256.0f + 128.0f); - - /* 2. Adjust for accurate table entry. - Find e so that - x = ex + t/256 + e + x2 - where -7e-4 < e < 7e-4, and - (float)(2^(t/256+e)) - is accurate to one part in 2^-64. */ - - /* 'tval & 255' is the same as 'tval%256' except that it's always - positive. - Compute x = x2. */ - x -= __exp2f_deltatable[tval & 255]; - - /* 3. Compute ex2 = 2^(t/255+e+ex). */ - ex2_u.f = __exp2f_atable[tval & 255]; - tval >>= 8; - unsafe = abs(tval) >= -FLT_MIN_EXP - 1; - ex2_u.ieee.exponent += tval >> unsafe; - scale_u.f = 1.0; - scale_u.ieee.exponent += tval - (tval >> unsafe); - - /* 4. Approximate 2^x2 - 1, using a second-degree polynomial, - with maximum error in [-2^-9 - 2^-14, 2^-9 + 2^-14] - less than 1.3e-10. */ - - x22 = (.24022656679f * x + .69314736128f) * ex2_u.f; - - /* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */ - fesetenv (&oldenv); - - result = x22 * x + ex2_u.f; - - if (!unsafe) - return result; - else - return result * scale_u.f; - } - /* Exceptional cases: */ - else if (isless (x, himark)) - { - if (__isinff (x)) - /* e^-inf == 0, with no error. */ - return 0; - else - /* Underflow */ - return TWOM100 * TWOM100; - } - else - /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ - return TWO127*x; -} diff --git a/sysdeps/libm-ieee754/s_expm1.c b/sysdeps/libm-ieee754/s_expm1.c deleted file mode 100644 index bfd15b2e31..0000000000 --- a/sysdeps/libm-ieee754/s_expm1.c +++ /dev/null @@ -1,243 +0,0 @@ -/* @(#)s_expm1.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; -#endif - -/* expm1(x) - * Returns exp(x)-1, the exponential of x minus 1. - * - * Method - * 1. Argument reduction: - * Given x, find r and integer k such that - * - * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 - * - * Here a correction term c will be computed to compensate - * the error in r when rounded to a floating-point number. - * - * 2. Approximating expm1(r) by a special rational function on - * the interval [0,0.34658]: - * Since - * r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ... - * we define R1(r*r) by - * r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r) - * That is, - * R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r) - * = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r)) - * = 1 - r^2/60 + r^4/2520 - r^6/100800 + ... - * We use a special Reme algorithm on [0,0.347] to generate - * a polynomial of degree 5 in r*r to approximate R1. The - * maximum error of this polynomial approximation is bounded - * by 2**-61. In other words, - * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 - * where Q1 = -1.6666666666666567384E-2, - * Q2 = 3.9682539681370365873E-4, - * Q3 = -9.9206344733435987357E-6, - * Q4 = 2.5051361420808517002E-7, - * Q5 = -6.2843505682382617102E-9; - * (where z=r*r, and the values of Q1 to Q5 are listed below) - * with error bounded by - * | 5 | -61 - * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 - * | | - * - * expm1(r) = exp(r)-1 is then computed by the following - * specific way which minimize the accumulation rounding error: - * 2 3 - * r r [ 3 - (R1 + R1*r/2) ] - * expm1(r) = r + --- + --- * [--------------------] - * 2 2 [ 6 - r*(3 - R1*r/2) ] - * - * To compensate the error in the argument reduction, we use - * expm1(r+c) = expm1(r) + c + expm1(r)*c - * ~ expm1(r) + c + r*c - * Thus c+r*c will be added in as the correction terms for - * expm1(r+c). Now rearrange the term to avoid optimization - * screw up: - * ( 2 2 ) - * ({ ( r [ R1 - (3 - R1*r/2) ] ) } r ) - * expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- ) - * ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 ) - * ( ) - * - * = r - E - * 3. Scale back to obtain expm1(x): - * From step 1, we have - * expm1(x) = either 2^k*[expm1(r)+1] - 1 - * = or 2^k*[expm1(r) + (1-2^-k)] - * 4. Implementation notes: - * (A). To save one multiplication, we scale the coefficient Qi - * to Qi*2^i, and replace z by (x^2)/2. - * (B). To achieve maximum accuracy, we compute expm1(x) by - * (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf) - * (ii) if k=0, return r-E - * (iii) if k=-1, return 0.5*(r-E)-0.5 - * (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E) - * else return 1.0+2.0*(r-E); - * (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) - * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else - * (vii) return 2^k(1-((E+2^-k)-r)) - * - * Special cases: - * expm1(INF) is INF, expm1(NaN) is NaN; - * expm1(-INF) is -1, and - * for finite argument, only expm1(0)=0 is exact. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Misc. info. - * For IEEE double - * if x > 7.09782712893383973096e+02 then expm1(x) overflow - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math.h" -#include "math_private.h" -#define one Q[0] -#ifdef __STDC__ -static const double -#else -static double -#endif -huge = 1.0e+300, -tiny = 1.0e-300, -o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ -ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */ -ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */ -invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */ - /* scaled coefficients related to expm1 */ -Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */ - 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ - -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ - 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ - -2.01099218183624371326e-07}; /* BE8AFDB7 6E09C32D */ - -#ifdef __STDC__ - double __expm1(double x) -#else - double __expm1(x) - double x; -#endif -{ - double y,hi,lo,c,t,e,hxs,hfx,r1,h2,h4,R1,R2,R3; - int32_t k,xsb; - u_int32_t hx; - - GET_HIGH_WORD(hx,x); - xsb = hx&0x80000000; /* sign bit of x */ - if(xsb==0) y=x; else y= -x; /* y = |x| */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out huge and non-finite argument */ - if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ - if(hx >= 0x40862E42) { /* if |x|>=709.78... */ - if(hx>=0x7ff00000) { - u_int32_t low; - GET_LOW_WORD(low,x); - if(((hx&0xfffff)|low)!=0) - return x+x; /* NaN */ - else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - } - if(x > o_threshold) return huge*huge; /* overflow */ - } - if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */ - if(x+tiny<0.0) /* raise inexact */ - return tiny-one; /* return -1 */ - } - } - - /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ - if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ - if(xsb==0) - {hi = x - ln2_hi; lo = ln2_lo; k = 1;} - else - {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} - } else { - k = invln2*x+((xsb==0)?0.5:-0.5); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi - lo; - c = (hi-x)-lo; - } - else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ - t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); - } - else k = 0; - - /* x is now in primary range */ - hfx = 0.5*x; - hxs = x*hfx; -#ifdef DO_NOT_USE_THIS - r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); -#else - R1 = one+hxs*Q[1]; h2 = hxs*hxs; - R2 = Q[2]+hxs*Q[3]; h4 = h2*h2; - R3 = Q[4]+hxs*Q[5]; - r1 = R1 + h2*R2 + h4*R3; -#endif - t = 3.0-r1*hfx; - e = hxs*((r1-t)/(6.0 - x*t)); - if(k==0) return x - (x*e-hxs); /* c is 0 */ - else { - e = (x*(e-c)-c); - e -= hxs; - if(k== -1) return 0.5*(x-e)-0.5; - if(k==1) { - if(x < -0.25) return -2.0*(e-(x+0.5)); - else return one+2.0*(x-e); - } - if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ - u_int32_t high; - y = one-(e-x); - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - return y-one; - } - t = one; - if(k<20) { - u_int32_t high; - SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ - y = t-(e-x); - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - } else { - u_int32_t high; - SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */ - y = x-(e+t); - y += one; - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - } - } - return y; -} -weak_alias (__expm1, expm1) -#ifdef NO_LONG_DOUBLE -strong_alias (__expm1, __expm1l) -weak_alias (__expm1, expm1l) -#endif diff --git a/sysdeps/libm-ieee754/s_expm1f.c b/sysdeps/libm-ieee754/s_expm1f.c deleted file mode 100644 index 375e334c38..0000000000 --- a/sysdeps/libm-ieee754/s_expm1f.c +++ /dev/null @@ -1,135 +0,0 @@ -/* s_expm1f.c -- float version of s_expm1.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -static const volatile float huge = 1.0e+30, tiny = 1.0e-30; - -#ifdef __STDC__ -static const float -#else -static float -#endif -one = 1.0, -o_threshold = 8.8721679688e+01,/* 0x42b17180 */ -ln2_hi = 6.9313812256e-01,/* 0x3f317180 */ -ln2_lo = 9.0580006145e-06,/* 0x3717f7d1 */ -invln2 = 1.4426950216e+00,/* 0x3fb8aa3b */ - /* scaled coefficients related to expm1 */ -Q1 = -3.3333335072e-02, /* 0xbd088889 */ -Q2 = 1.5873016091e-03, /* 0x3ad00d01 */ -Q3 = -7.9365076090e-05, /* 0xb8a670cd */ -Q4 = 4.0082177293e-06, /* 0x36867e54 */ -Q5 = -2.0109921195e-07; /* 0xb457edbb */ - -#ifdef __STDC__ - float __expm1f(float x) -#else - float __expm1f(x) - float x; -#endif -{ - float y,hi,lo,c,t,e,hxs,hfx,r1; - int32_t k,xsb; - u_int32_t hx; - - GET_FLOAT_WORD(hx,x); - xsb = hx&0x80000000; /* sign bit of x */ - if(xsb==0) y=x; else y= -x; /* y = |x| */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out huge and non-finite argument */ - if(hx >= 0x4195b844) { /* if |x|>=27*ln2 */ - if(hx >= 0x42b17218) { /* if |x|>=88.721... */ - if(hx>0x7f800000) - return x+x; /* NaN */ - if(hx==0x7f800000) - return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - if(x > o_threshold) return huge*huge; /* overflow */ - } - if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */ - if(x+tiny<(float)0.0) /* raise inexact */ - return tiny-one; /* return -1 */ - } - } - - /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ - if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ - if(xsb==0) - {hi = x - ln2_hi; lo = ln2_lo; k = 1;} - else - {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} - } else { - k = invln2*x+((xsb==0)?(float)0.5:(float)-0.5); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi - lo; - c = (hi-x)-lo; - } - else if(hx < 0x33000000) { /* when |x|<2**-25, return x */ - t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); - } - else k = 0; - - /* x is now in primary range */ - hfx = (float)0.5*x; - hxs = x*hfx; - r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); - t = (float)3.0-r1*hfx; - e = hxs*((r1-t)/((float)6.0 - x*t)); - if(k==0) return x - (x*e-hxs); /* c is 0 */ - else { - e = (x*(e-c)-c); - e -= hxs; - if(k== -1) return (float)0.5*(x-e)-(float)0.5; - if(k==1) { - if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5)); - else return one+(float)2.0*(x-e); - } - if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ - int32_t i; - y = one-(e-x); - GET_FLOAT_WORD(i,y); - SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ - return y-one; - } - t = one; - if(k<23) { - int32_t i; - SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */ - y = t-(e-x); - GET_FLOAT_WORD(i,y); - SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ - } else { - int32_t i; - SET_FLOAT_WORD(t,((0x7f-k)<<23)); /* 2^-k */ - y = x-(e+t); - y += one; - GET_FLOAT_WORD(i,y); - SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ - } - } - return y; -} -weak_alias (__expm1f, expm1f) diff --git a/sysdeps/libm-ieee754/s_fabs.c b/sysdeps/libm-ieee754/s_fabs.c deleted file mode 100644 index 1abe9432a3..0000000000 --- a/sysdeps/libm-ieee754/s_fabs.c +++ /dev/null @@ -1,40 +0,0 @@ -/* @(#)s_fabs.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; -#endif - -/* - * fabs(x) returns the absolute value of x. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __fabs(double x) -#else - double __fabs(x) - double x; -#endif -{ - u_int32_t high; - GET_HIGH_WORD(high,x); - SET_HIGH_WORD(x,high&0x7fffffff); - return x; -} -weak_alias (__fabs, fabs) -#ifdef NO_LONG_DOUBLE -strong_alias (__fabs, __fabsl) -weak_alias (__fabs, fabsl) -#endif diff --git a/sysdeps/libm-ieee754/s_fabsf.c b/sysdeps/libm-ieee754/s_fabsf.c deleted file mode 100644 index 6b1451379f..0000000000 --- a/sysdeps/libm-ieee754/s_fabsf.c +++ /dev/null @@ -1,39 +0,0 @@ -/* s_fabsf.c -- float version of s_fabs.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_fabsf.c,v 1.4 1995/05/10 20:47:15 jtc Exp $"; -#endif - -/* - * fabsf(x) returns the absolute value of x. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __fabsf(float x) -#else - float __fabsf(x) - float x; -#endif -{ - u_int32_t ix; - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(x,ix&0x7fffffff); - return x; -} -weak_alias (__fabsf, fabsf) diff --git a/sysdeps/libm-ieee754/s_fabsl.c b/sysdeps/libm-ieee754/s_fabsl.c deleted file mode 100644 index f7170503fb..0000000000 --- a/sysdeps/libm-ieee754/s_fabsl.c +++ /dev/null @@ -1,40 +0,0 @@ -/* s_fabsl.c -- long double version of s_fabs.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * fabsl(x) returns the absolute value of x. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __fabsl(long double x) -#else - long double __fabsl(x) - long double x; -#endif -{ - u_int32_t exp; - GET_LDOUBLE_EXP(exp,x); - SET_LDOUBLE_EXP(x,exp&0x7fff); - return x; -} -weak_alias (__fabsl, fabsl) diff --git a/sysdeps/libm-ieee754/s_fdim.c b/sysdeps/libm-ieee754/s_fdim.c deleted file mode 100644 index b45c413cb8..0000000000 --- a/sysdeps/libm-ieee754/s_fdim.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Return positive difference between arguments. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double -__fdim (double x, double y) -{ - int clsx = fpclassify (x); - int clsy = fpclassify (y); - - if (clsx == FP_NAN || clsy == FP_NAN - || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) - /* Raise invalid flag. */ - return x - y; - - return x < y ? 0 : x - y; -} -weak_alias (__fdim, fdim) -#ifdef NO_LONG_DOUBLE -strong_alias (__fdim, __fdiml) -weak_alias (__fdim, fdiml) -#endif diff --git a/sysdeps/libm-ieee754/s_fdimf.c b/sysdeps/libm-ieee754/s_fdimf.c deleted file mode 100644 index a8d8192c0f..0000000000 --- a/sysdeps/libm-ieee754/s_fdimf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Return positive difference between arguments. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -float -__fdimf (float x, float y) -{ - int clsx = fpclassify (x); - int clsy = fpclassify (y); - - if (clsx == FP_NAN || clsy == FP_NAN - || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) - /* Raise invalid flag. */ - return x - y; - - return x < y ? 0 : x - y; -} -weak_alias (__fdimf, fdimf) diff --git a/sysdeps/libm-ieee754/s_fdiml.c b/sysdeps/libm-ieee754/s_fdiml.c deleted file mode 100644 index c97a668f10..0000000000 --- a/sysdeps/libm-ieee754/s_fdiml.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Return positive difference between arguments. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -long double -__fdiml (long double x, long double y) -{ - int clsx = fpclassify (x); - int clsy = fpclassify (y); - - if (clsx == FP_NAN || clsy == FP_NAN - || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE)) - /* Raise invalid flag. */ - return x - y; - - return x < y ? 0 : x - y; -} -weak_alias (__fdiml, fdiml) diff --git a/sysdeps/libm-ieee754/s_finite.c b/sysdeps/libm-ieee754/s_finite.c deleted file mode 100644 index b12ff42360..0000000000 --- a/sysdeps/libm-ieee754/s_finite.c +++ /dev/null @@ -1,40 +0,0 @@ -/* @(#)s_finite.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; -#endif - -/* - * finite(x) returns 1 is x is finite, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __finite(double x) -#else - int __finite(x) - double x; -#endif -{ - int32_t hx; - GET_HIGH_WORD(hx,x); - return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31); -} -weak_alias (__finite, finite) -#ifdef NO_LONG_DOUBLE -strong_alias (__finite, __finitel) -weak_alias (__finite, finitel) -#endif diff --git a/sysdeps/libm-ieee754/s_finitef.c b/sysdeps/libm-ieee754/s_finitef.c deleted file mode 100644 index baafc31aec..0000000000 --- a/sysdeps/libm-ieee754/s_finitef.c +++ /dev/null @@ -1,39 +0,0 @@ -/* s_finitef.c -- float version of s_finite.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_finitef.c,v 1.4 1995/05/10 20:47:18 jtc Exp $"; -#endif - -/* - * finitef(x) returns 1 is x is finite, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __finitef(float x) -#else - int __finitef(x) - float x; -#endif -{ - int32_t ix; - GET_FLOAT_WORD(ix,x); - return (int)((u_int32_t)((ix&0x7fffffff)-0x7f800000)>>31); -} -weak_alias (__finitef, finitef) diff --git a/sysdeps/libm-ieee754/s_finitel.c b/sysdeps/libm-ieee754/s_finitel.c deleted file mode 100644 index 6e444e90d0..0000000000 --- a/sysdeps/libm-ieee754/s_finitel.c +++ /dev/null @@ -1,40 +0,0 @@ -/* s_finitel.c -- long double version of s_finite.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * finitel(x) returns 1 is x is finite, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __finitel(long double x) -#else - int __finitel(x) - long double x; -#endif -{ - int32_t exp; - GET_LDOUBLE_EXP(exp,x); - return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>31); -} -weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-ieee754/s_floor.c b/sysdeps/libm-ieee754/s_floor.c deleted file mode 100644 index 77db9ef392..0000000000 --- a/sysdeps/libm-ieee754/s_floor.c +++ /dev/null @@ -1,86 +0,0 @@ -/* @(#)s_floor.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; -#endif - -/* - * floor(x) - * Return x rounded toward -inf to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to floor(x). - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double huge = 1.0e300; -#else -static double huge = 1.0e300; -#endif - -#ifdef __STDC__ - double __floor(double x) -#else - double __floor(x) - double x; -#endif -{ - int32_t i0,i1,j0; - u_int32_t i,j; - EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=i1=0;} - else if(((i0&0x7fffffff)|i1)!=0) - { i0=0xbff00000;i1=0;} - } - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00100000)>>j0; - i0 &= (~i); i1=0; - } - } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); - if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) { - if(j0==20) i0+=1; - else { - j = i1+(1<<(52-j0)); - if(j>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} - else if((i0&0x7fffffff)!=0) - { i0=0xbf800000;} - } - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00800000)>>j0; - i0 &= (~i); - } - } - } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - return x; -} -weak_alias (__floorf, floorf) diff --git a/sysdeps/libm-ieee754/s_floorl.c b/sysdeps/libm-ieee754/s_floorl.c deleted file mode 100644 index fb0c37e801..0000000000 --- a/sysdeps/libm-ieee754/s_floorl.c +++ /dev/null @@ -1,90 +0,0 @@ -/* s_floorl.c -- long double version of s_floor.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * floorl(x) - * Return x rounded toward -inf to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to floor(x). - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double huge = 1.0e4930; -#else -static long double huge = 1.0e4930; -#endif - -#ifdef __STDC__ - long double __floorl(long double x) -#else - long double __floorl(x) - long double x; -#endif -{ - int32_t i1,j0; - u_int32_t i,j,se,i0,sx; - GET_LDOUBLE_WORDS(se,i0,i1,x); - sx = (se>>15)&1; - j0 = (se&0x7fff)-0x3fff; - if(j0<31) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(sx==0) {se=0;i0=i1=0;} - else if(((se&0x7fff)|i0|i1)!=0) - { se=0xbfff;i0=i1=0;} - } - } else { - i = (0x7fffffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(sx) { - if (j0>0) i0 += (0x80000000)>>j0; - else ++se; - } - i0 &= (~i); i1=0; - } - } - } else if (j0>62) { - if(j0==0x4000) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-31); - if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(sx) { - if(j0==31) i0+=1; - else { - j = i1+(1<<(63-j0)); - if(j, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -double -__fma (double x, double y, double z) -{ - return (x * y) + z; -} -weak_alias (__fma, fma) diff --git a/sysdeps/libm-ieee754/s_fmaf.c b/sysdeps/libm-ieee754/s_fmaf.c deleted file mode 100644 index 44e5e15def..0000000000 --- a/sysdeps/libm-ieee754/s_fmaf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Compute x * y + z as ternary operation. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -float -__fmaf (float x, float y, float z) -{ - return (x * y) + z; -} -weak_alias (__fmaf, fmaf) diff --git a/sysdeps/libm-ieee754/s_fmal.c b/sysdeps/libm-ieee754/s_fmal.c deleted file mode 100644 index f73751f4db..0000000000 --- a/sysdeps/libm-ieee754/s_fmal.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Compute x * y + z as ternary operation. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -long double -__fmal (long double x, long double y, long double z) -{ - return (x * y) + z; -} -weak_alias (__fmal, fmal) diff --git a/sysdeps/libm-ieee754/s_fmax.c b/sysdeps/libm-ieee754/s_fmax.c deleted file mode 100644 index bc6af7286c..0000000000 --- a/sysdeps/libm-ieee754/s_fmax.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Return maximum numeric value of X and Y. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - -double -__fmax (double x, double y) -{ - return (isgreaterequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmax, fmax) -#ifdef NO_LONG_DOUBLE -strong_alias (__fmax, __fmaxl) -weak_alias (__fmax, fmaxl) -#endif diff --git a/sysdeps/libm-ieee754/s_fmaxf.c b/sysdeps/libm-ieee754/s_fmaxf.c deleted file mode 100644 index e56193fe7b..0000000000 --- a/sysdeps/libm-ieee754/s_fmaxf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return maximum numeric value of X and Y. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - -float -__fmaxf (float x, float y) -{ - return (isgreaterequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmaxf, fmaxf) diff --git a/sysdeps/libm-ieee754/s_fmaxl.c b/sysdeps/libm-ieee754/s_fmaxl.c deleted file mode 100644 index 6e1c7152ed..0000000000 --- a/sysdeps/libm-ieee754/s_fmaxl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return maximum numeric value of X and Y. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - -long double -__fmaxl (long double x, long double y) -{ - return (isgreaterequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/libm-ieee754/s_fmin.c b/sysdeps/libm-ieee754/s_fmin.c deleted file mode 100644 index b79e6eca5a..0000000000 --- a/sysdeps/libm-ieee754/s_fmin.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Return minimum numeric value of X and Y. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - -double -__fmin (double x, double y) -{ - return (islessequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmin, fmin) -#ifdef NO_LONG_DOUBLE -strong_alias (__fmin, __fminl) -weak_alias (__fmin, fminl) -#endif diff --git a/sysdeps/libm-ieee754/s_fminf.c b/sysdeps/libm-ieee754/s_fminf.c deleted file mode 100644 index 72c656e1ac..0000000000 --- a/sysdeps/libm-ieee754/s_fminf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return minimum numeric value of X and Y. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - -float -__fminf (float x, float y) -{ - return (islessequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fminf, fminf) diff --git a/sysdeps/libm-ieee754/s_fminl.c b/sysdeps/libm-ieee754/s_fminl.c deleted file mode 100644 index 0f06194b77..0000000000 --- a/sysdeps/libm-ieee754/s_fminl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return minimum numeric value of X and Y. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - - -long double -__fminl (long double x, long double y) -{ - return (islessequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fminl, fminl) diff --git a/sysdeps/libm-ieee754/s_fpclassify.c b/sysdeps/libm-ieee754/s_fpclassify.c deleted file mode 100644 index 72a15369b5..0000000000 --- a/sysdeps/libm-ieee754/s_fpclassify.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Return classification value corresponding to argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -int -__fpclassify (double x) -{ - u_int32_t hx, lx; - int retval = FP_NORMAL; - - EXTRACT_WORDS (hx, lx, x); - lx |= hx & 0xfffff; - hx &= 0x7ff00000; - if ((hx | lx) == 0) - retval = FP_ZERO; - else if (hx == 0) - retval = FP_SUBNORMAL; - else if (hx == 0x7ff00000) - retval = lx != 0 ? FP_NAN : FP_INFINITE; - - return retval; -} diff --git a/sysdeps/libm-ieee754/s_fpclassifyf.c b/sysdeps/libm-ieee754/s_fpclassifyf.c deleted file mode 100644 index a6b35cfe1b..0000000000 --- a/sysdeps/libm-ieee754/s_fpclassifyf.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Return classification value corresponding to argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -int -__fpclassifyf (float x) -{ - u_int32_t wx; - int retval = FP_NORMAL; - - GET_FLOAT_WORD (wx, x); - wx &= 0x7fffffff; - if (wx == 0) - retval = FP_ZERO; - else if (wx < 0x1000000) - retval = FP_SUBNORMAL; - else if (wx >= 0x7f800000) - retval = wx > 0x7f800000 ? FP_NAN : FP_INFINITE; - - return retval; -} diff --git a/sysdeps/libm-ieee754/s_fpclassifyl.c b/sysdeps/libm-ieee754/s_fpclassifyl.c deleted file mode 100644 index 4df0b44f75..0000000000 --- a/sysdeps/libm-ieee754/s_fpclassifyl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Return classification value corresponding to argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - Fixed by Andreas Schwab . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -int -__fpclassifyl (long double x) -{ - u_int32_t ex, hx, lx, m; - int retval = FP_NORMAL; - - GET_LDOUBLE_WORDS (ex, hx, lx, x); - m = (hx & 0x7fffffff) | lx; - ex &= 0x7fff; - if ((ex | m) == 0) - retval = FP_ZERO; - else if (ex == 0 && (hx & 0x80000000) == 0) - retval = FP_SUBNORMAL; - else if (ex == 0x7fff) - retval = m != 0 ? FP_NAN : FP_INFINITE; - - return retval; -} diff --git a/sysdeps/libm-ieee754/s_frexp.c b/sysdeps/libm-ieee754/s_frexp.c deleted file mode 100644 index 7dbddfde06..0000000000 --- a/sysdeps/libm-ieee754/s_frexp.c +++ /dev/null @@ -1,64 +0,0 @@ -/* @(#)s_frexp.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_frexp.c,v 1.9 1995/05/10 20:47:24 jtc Exp $"; -#endif - -/* - * for non-zero x - * x = frexp(arg,&exp); - * return a double fp quantity x such that 0.5 <= |x| <1.0 - * and the corresponding binary exponent "exp". That is - * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg - * with *exp=0. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ - -#ifdef __STDC__ - double __frexp(double x, int *eptr) -#else - double __frexp(x, eptr) - double x; int *eptr; -#endif -{ - int32_t hx, ix, lx; - EXTRACT_WORDS(hx,lx,x); - ix = 0x7fffffff&hx; - *eptr = 0; - if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ - if (ix<0x00100000) { /* subnormal */ - x *= two54; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - *eptr = -54; - } - *eptr += (ix>>20)-1022; - hx = (hx&0x800fffff)|0x3fe00000; - SET_HIGH_WORD(x,hx); - return x; -} -weak_alias (__frexp, frexp) -#ifdef NO_LONG_DOUBLE -strong_alias (__frexp, __frexpl) -weak_alias (__frexp, frexpl) -#endif diff --git a/sysdeps/libm-ieee754/s_frexpf.c b/sysdeps/libm-ieee754/s_frexpf.c deleted file mode 100644 index a984457a87..0000000000 --- a/sysdeps/libm-ieee754/s_frexpf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* s_frexpf.c -- float version of s_frexp.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_frexpf.c,v 1.5 1995/05/10 20:47:26 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -two25 = 3.3554432000e+07; /* 0x4c000000 */ - -#ifdef __STDC__ - float __frexpf(float x, int *eptr) -#else - float __frexpf(x, eptr) - float x; int *eptr; -#endif -{ - int32_t hx,ix; - GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; - *eptr = 0; - if(ix>=0x7f800000||(ix==0)) return x; /* 0,inf,nan */ - if (ix<0x00800000) { /* subnormal */ - x *= two25; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - *eptr = -25; - } - *eptr += (ix>>23)-126; - hx = (hx&0x807fffff)|0x3f000000; - *(int*)&x = hx; - return x; -} -weak_alias (__frexpf, frexpf) diff --git a/sysdeps/libm-ieee754/s_frexpl.c b/sysdeps/libm-ieee754/s_frexpl.c deleted file mode 100644 index 7a49bc37c8..0000000000 --- a/sysdeps/libm-ieee754/s_frexpl.c +++ /dev/null @@ -1,69 +0,0 @@ -/* s_frexpl.c -- long double version of s_frexp.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * for non-zero x - * x = frexpl(arg,&exp); - * return a long double fp quantity x such that 0.5 <= |x| <1.0 - * and the corresponding binary exponent "exp". That is - * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg - * with *exp=0. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double -#else -static long double -#endif -#if LDBL_MANT_DIG == 64 -two65 = 3.68934881474191032320e+19L; /* 0x4040, 0x80000000, 0x00000000 */ -#else -# error "Cannot handle this MANT_DIG" -#endif - - -#ifdef __STDC__ - long double __frexpl(long double x, int *eptr) -#else - long double __frexpl(x, eptr) - long double x; int *eptr; -#endif -{ - u_int32_t se, hx, ix, lx; - GET_LDOUBLE_WORDS(se,hx,lx,x); - ix = 0x7fff&se; - *eptr = 0; - if(ix==0x7fff||((ix|hx|lx)==0)) return x; /* 0,inf,nan */ - if (ix==0x0000) { /* subnormal */ - x *= two65; - GET_LDOUBLE_EXP(se,x); - ix = se&0x7fff; - *eptr = -65; - } - *eptr += ix-16382; - se = (se & 0x8000) | 0x3ffe; - SET_LDOUBLE_EXP(x,se); - return x; -} -weak_alias (__frexpl, frexpl) diff --git a/sysdeps/libm-ieee754/s_ilogb.c b/sysdeps/libm-ieee754/s_ilogb.c deleted file mode 100644 index 820f01c9b2..0000000000 --- a/sysdeps/libm-ieee754/s_ilogb.c +++ /dev/null @@ -1,56 +0,0 @@ -/* @(#)s_ilogb.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $"; -#endif - -/* ilogb(double x) - * return the binary exponent of non-zero x - * ilogb(0) = 0x80000001 - * ilogb(inf/NaN) = 0x7fffffff (no signal is raised) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __ilogb(double x) -#else - int __ilogb(x) - double x; -#endif -{ - int32_t hx,lx,ix; - - GET_HIGH_WORD(hx,x); - hx &= 0x7fffffff; - if(hx<0x00100000) { - GET_LOW_WORD(lx,x); - if((hx|lx)==0) - return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ - else /* subnormal x */ - if(hx==0) { - for (ix = -1043; lx>0; lx<<=1) ix -=1; - } else { - for (ix = -1022,hx<<=11; hx>0; hx<<=1) ix -=1; - } - return ix; - } - else if (hx<0x7ff00000) return (hx>>20)-1023; - else return FP_ILOGBNAN; -} -weak_alias (__ilogb, ilogb) -#ifdef NO_LONG_DOUBLE -strong_alias (__ilogb, __ilogbl) -weak_alias (__ilogb, ilogbl) -#endif diff --git a/sysdeps/libm-ieee754/s_ilogbf.c b/sysdeps/libm-ieee754/s_ilogbf.c deleted file mode 100644 index e652b93619..0000000000 --- a/sysdeps/libm-ieee754/s_ilogbf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* s_ilogbf.c -- float version of s_ilogb.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_ilogbf.c,v 1.4 1995/05/10 20:47:31 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __ilogbf(float x) -#else - int __ilogbf(x) - float x; -#endif -{ - int32_t hx,ix; - - GET_FLOAT_WORD(hx,x); - hx &= 0x7fffffff; - if(hx<0x00800000) { - if(hx==0) - return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ - else /* subnormal x */ - for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; - return ix; - } - else if (hx<0x7f800000) return (hx>>23)-127; - else return FP_ILOGBNAN; -} -weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/libm-ieee754/s_ilogbl.c b/sysdeps/libm-ieee754/s_ilogbl.c deleted file mode 100644 index d44229dcda..0000000000 --- a/sysdeps/libm-ieee754/s_ilogbl.c +++ /dev/null @@ -1,56 +0,0 @@ -/* s_ilogbl.c -- long double version of s_ilogb.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* ilogbl(long double x) - * return the binary exponent of non-zero x - * ilogbl(0) = 0x80000001 - * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __ilogbl(long double x) -#else - int __ilogbl(x) - long double x; -#endif -{ - int32_t es,hx,lx,ix; - - GET_LDOUBLE_EXP(es,x); - es &= 0x7fff; - if(es==0) { - GET_LDOUBLE_WORDS(es,hx,lx,x); - if((hx|lx)==0) - return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */ - else /* subnormal x */ - if(hx==0) { - for (ix = -16415; lx>0; lx<<=1) ix -=1; - } else { - for (ix = -16383; hx>0; hx<<=1) ix -=1; - } - return ix; - } - else if (es<0x7fff) return es-0x3fff; - else return FP_ILOGBNAN; -} -weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c deleted file mode 100644 index 4f063d09c5..0000000000 --- a/sysdeps/libm-ieee754/s_isinf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changed to return -1 for -Inf by Ulrich Drepper . - * Public domain. - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; -#endif - -/* - * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -int -__isinf (double x) -{ - int32_t hx,lx; - EXTRACT_WORDS(hx,lx,x); - lx |= (hx & 0x7fffffff) ^ 0x7ff00000; - lx |= -lx; - return ~(lx >> 31) & (hx >> 30); -} -weak_alias (__isinf, isinf) -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif diff --git a/sysdeps/libm-ieee754/s_isinff.c b/sysdeps/libm-ieee754/s_isinff.c deleted file mode 100644 index efc0935251..0000000000 --- a/sysdeps/libm-ieee754/s_isinff.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $"; -#endif - -/* - * isinff(x) returns 1 if x is inf, -1 if x is -inf, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -int -__isinff (float x) -{ - int32_t ix,t; - GET_FLOAT_WORD(ix,x); - t = ix & 0x7fffffff; - t ^= 0x7f800000; - t |= -t; - return ~(t >> 31) & (ix >> 30); -} -weak_alias (__isinff, isinff) diff --git a/sysdeps/libm-ieee754/s_isinfl.c b/sysdeps/libm-ieee754/s_isinfl.c deleted file mode 100644 index 6f7c07c5af..0000000000 --- a/sysdeps/libm-ieee754/s_isinfl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Written by J.T. Conklin . - * Change for long double by Ulrich Drepper . - * Public domain. - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -int -__isinfl (long double x) -{ - int32_t se,hx,lx; - GET_LDOUBLE_WORDS(se,hx,lx,x); - lx |= (hx & 0x7fffffff) | ((se & 0x7fff) ^ 0x7fff); - lx |= -lx; - se &= 0x8000; - return ~(lx >> 31) & (1 - (se >> 14)); -} -weak_alias (__isinfl, isinfl) diff --git a/sysdeps/libm-ieee754/s_isnan.c b/sysdeps/libm-ieee754/s_isnan.c deleted file mode 100644 index 1aed525af1..0000000000 --- a/sysdeps/libm-ieee754/s_isnan.c +++ /dev/null @@ -1,43 +0,0 @@ -/* @(#)s_isnan.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; -#endif - -/* - * isnan(x) returns 1 is x is nan, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __isnan(double x) -#else - int __isnan(x) - double x; -#endif -{ - int32_t hx,lx; - EXTRACT_WORDS(hx,lx,x); - hx &= 0x7fffffff; - hx |= (u_int32_t)(lx|(-lx))>>31; - hx = 0x7ff00000 - hx; - return (int)((u_int32_t)(hx))>>31; -} -weak_alias (__isnan, isnan) -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif diff --git a/sysdeps/libm-ieee754/s_isnanf.c b/sysdeps/libm-ieee754/s_isnanf.c deleted file mode 100644 index 9ec412fd66..0000000000 --- a/sysdeps/libm-ieee754/s_isnanf.c +++ /dev/null @@ -1,41 +0,0 @@ -/* s_isnanf.c -- float version of s_isnan.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_isnanf.c,v 1.4 1995/05/10 20:47:38 jtc Exp $"; -#endif - -/* - * isnanf(x) returns 1 is x is nan, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __isnanf(float x) -#else - int __isnanf(x) - float x; -#endif -{ - int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; - ix = 0x7f800000 - ix; - return (int)(((u_int32_t)(ix))>>31); -} -weak_alias (__isnanf, isnanf) diff --git a/sysdeps/libm-ieee754/s_isnanl.c b/sysdeps/libm-ieee754/s_isnanl.c deleted file mode 100644 index ba53faa1fd..0000000000 --- a/sysdeps/libm-ieee754/s_isnanl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* s_isnanl.c -- long double version of s_isnan.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * isnanl(x) returns 1 is x is nan, else 0; - * no branching! - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int __isnanl(long double x) -#else - int __isnanl(x) - long double x; -#endif -{ - int32_t se,hx,lx; - GET_LDOUBLE_WORDS(se,hx,lx,x); - se = (se & 0x7fff) << 1; - lx |= hx & 0x7fffffff; - se |= (u_int32_t)(lx|(-lx))>>31; - se = 0xfffe - se; - return (int)((u_int32_t)(se))>>16; -} -weak_alias (__isnanl, isnanl) diff --git a/sysdeps/libm-ieee754/s_ldexp.c b/sysdeps/libm-ieee754/s_ldexp.c deleted file mode 100644 index 12c336fad4..0000000000 --- a/sysdeps/libm-ieee754/s_ldexp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* @(#)s_ldexp.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" -#include - -#ifdef __STDC__ - double __ldexp(double value, int exp) -#else - double __ldexp(value, exp) - double value; int exp; -#endif -{ - if(!__finite(value)||value==0.0) return value; - value = __scalbn(value,exp); - if(!__finite(value)||value==0.0) __set_errno (ERANGE); - return value; -} -weak_alias (__ldexp, ldexp) -#ifdef NO_LONG_DOUBLE -strong_alias (__ldexp, __ldexpl) -weak_alias (__ldexp, ldexpl) -#endif diff --git a/sysdeps/libm-ieee754/s_ldexpf.c b/sysdeps/libm-ieee754/s_ldexpf.c deleted file mode 100644 index 1ecbe8346b..0000000000 --- a/sysdeps/libm-ieee754/s_ldexpf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* s_ldexpf.c -- float version of s_ldexp.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" -#include - -#ifdef __STDC__ - float __ldexpf(float value, int exp) -#else - float __ldexpf(value, exp) - float value; int exp; -#endif -{ - if(!__finitef(value)||value==(float)0.0) return value; - value = __scalbnf(value,exp); - if(!__finitef(value)||value==(float)0.0) __set_errno (ERANGE); - return value; -} -weak_alias (__ldexpf, ldexpf) diff --git a/sysdeps/libm-ieee754/s_ldexpl.c b/sysdeps/libm-ieee754/s_ldexpl.c deleted file mode 100644 index 123a6b3b58..0000000000 --- a/sysdeps/libm-ieee754/s_ldexpl.c +++ /dev/null @@ -1,37 +0,0 @@ -/* s_ldexpl.c -- long double version of s_ldexp.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -#include "math.h" -#include "math_private.h" -#include - -#ifdef __STDC__ - long double __ldexpl(long double value, int exp) -#else - long double __ldexpl(value, exp) - long double value; int exp; -#endif -{ - if(!__finitel(value)||value==0.0) return value; - value = __scalbnl(value,exp); - if(!__finitel(value)||value==0.0) __set_errno (ERANGE); - return value; -} -weak_alias (__ldexpl, ldexpl) diff --git a/sysdeps/libm-ieee754/s_lib_version.c b/sysdeps/libm-ieee754/s_lib_version.c deleted file mode 100644 index 121bdaa540..0000000000 --- a/sysdeps/libm-ieee754/s_lib_version.c +++ /dev/null @@ -1,40 +0,0 @@ -/* @(#)s_lib_ver.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_lib_version.c,v 1.6 1995/05/10 20:47:44 jtc Exp $"; -#endif - -/* - * MACRO for standards - */ - -#include "math.h" -#include "math_private.h" - -/* - * define and initialize _LIB_VERSION - */ -#ifdef _POSIX_MODE -_LIB_VERSION_TYPE _LIB_VERSION = _POSIX_; -#else -#ifdef _XOPEN_MODE -_LIB_VERSION_TYPE _LIB_VERSION = _XOPEN_; -#else -#ifdef _SVID3_MODE -_LIB_VERSION_TYPE _LIB_VERSION = _SVID_; -#else /* default _IEEE_MODE */ -_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; -#endif -#endif -#endif - diff --git a/sysdeps/libm-ieee754/s_llrint.c b/sysdeps/libm-ieee754/s_llrint.c deleted file mode 100644 index 8e70bcff36..0000000000 --- a/sysdeps/libm-ieee754/s_llrint.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -static const long double two52[2] = -{ - 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ - -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ -}; - - -long long int -__llrint (double x) -{ - int32_t j0; - u_int32_t i1, i0; - long long int result; - volatile double w; - double t; - int sx; - - EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - sx = i0 >> 31; - i0 &= 0xfffff; - i0 |= 0x100000; - - if (j0 < 20) - { - if (j0 < -1) - return 0; - else - { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - result = i0 >> (20 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) - { - if (j0 >= 52) - result = (((long long int) i0 << 32) | i1) << (j0 - 52); - else - { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long long int) x; - } - - return sx ? -result : result; -} - -weak_alias (__llrint, llrint) -#ifdef NO_LONG_DOUBLE -strong_alias (__llrint, __llrintl) -weak_alias (__llrint, llrintl) -#endif diff --git a/sysdeps/libm-ieee754/s_llrintf.c b/sysdeps/libm-ieee754/s_llrintf.c deleted file mode 100644 index a812377d19..0000000000 --- a/sysdeps/libm-ieee754/s_llrintf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -static const double two23[2] = -{ - 8.3886080000e+06, /* 0x4B000000 */ - -8.3886080000e+06, /* 0xCB000000 */ -}; - - -long long int -__llrintf (float x) -{ - int32_t j0; - u_int32_t i0; - volatile float w; - float t; - long long int result; - int sx; - - GET_FLOAT_WORD (i0, x); - - sx = i0 >> 31; - j0 = ((i0 >> 23) & 0xff) - 0x7f; - i0 &= 0x7fffff; - i0 |= 0x800000; - - if (j0 < (int32_t) (sizeof (long long int) * 8) - 1) - { - if (j0 < -1) - return 0; - else if (j0 >= 23) - result = (long long int) i0 << (j0 - 23); - else - { - w = two23[sx] + x; - t = w - two23[sx]; - GET_FLOAT_WORD (i0, t); - j0 = ((i0 >> 23) & 0xff) - 0x7f; - i0 &= 0x7fffff; - i0 |= 0x800000; - - result = i0 >> (23 - j0); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long long int) x; - } - - return sx ? -result : result; -} - -weak_alias (__llrintf, llrintf) diff --git a/sysdeps/libm-ieee754/s_llrintl.c b/sysdeps/libm-ieee754/s_llrintl.c deleted file mode 100644 index 2aeaa1e102..0000000000 --- a/sysdeps/libm-ieee754/s_llrintl.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -static const long double two63[2] = -{ - 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ - -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ -}; - - -long long int -__llrintl (long double x) -{ - int32_t se,j0; - u_int32_t i0, i1; - long long int result; - volatile long double w; - long double t; - int sx; - - GET_LDOUBLE_WORDS (se, i0, i1, x); - - sx = (se >> 15) & 1; - j0 = (se & 0x7fff) - 0x3fff; - - if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) - { - if (j0 < -1) - return 0; - else if (j0 >= 63) - result = (((long long int) i0 << 32) | i1) << (j0 - 63); - else - { - w = two63[sx] + x; - t = w - two63[sx]; - GET_LDOUBLE_WORDS (se, i0, i1, t); - j0 = (se & 0x7fff) - 0x3fff; - - if (j0 < 31) - result = i0 >> (31 - j0); - else - result = ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long long int) x; - } - - return sx ? -result : result; -} - -weak_alias (__llrintl, llrintl) diff --git a/sysdeps/libm-ieee754/s_llround.c b/sysdeps/libm-ieee754/s_llround.c deleted file mode 100644 index 92ce10fc42..0000000000 --- a/sysdeps/libm-ieee754/s_llround.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Round double value to long long int. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long long int -__llround (double x) -{ - int32_t j0; - u_int32_t i1, i0; - long long int result; - int sign; - - EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - sign = (i0 & 0x80000000) != 0 ? -1 : 1; - i0 &= 0xfffff; - i0 |= 0x100000; - - if (j0 < 20) - { - if (j0 < 0) - return j0 < -1 ? 0 : sign; - else - { - i0 += 0x80000 >> j0; - - result = i0 >> (20 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) - { - if (j0 >= 52) - result = (((long long int) i0 << 32) | i1) << (j0 - 52); - else - { - u_int32_t j = i1 + (0x80000000 >> (j0 - 20)); - if (j < i1) - ++i0; - - if (j0 == 20) - result = (long long int) i0; - else - result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long long int) x; - } - - return sign * result; -} - -weak_alias (__llround, llround) -#ifdef NO_LONG_DOUBLE -strong_alias (__llround, __llroundl) -weak_alias (__llround, llroundl) -#endif diff --git a/sysdeps/libm-ieee754/s_llroundf.c b/sysdeps/libm-ieee754/s_llroundf.c deleted file mode 100644 index 9aad81fd45..0000000000 --- a/sysdeps/libm-ieee754/s_llroundf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Round float value to long long int. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long long int -__llroundf (float x) -{ - int32_t j0; - u_int32_t i; - long long int result; - int sign; - - GET_FLOAT_WORD (i, x); - j0 = ((i >> 23) & 0xff) - 0x7f; - sign = (i & 0x80000000) != 0 ? -1 : 1; - i &= 0x7fffff; - i |= 0x800000; - - if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) - { - if (j0 < 0) - return j0 < -1 ? 0 : sign; - else if (j0 >= 23) - result = (long long int) i << (j0 - 23); - else - { - i += 0x400000 >> j0; - - result = i >> (23 - j0); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long long int) x; - } - - return sign * result; -} - -weak_alias (__llroundf, llroundf) diff --git a/sysdeps/libm-ieee754/s_llroundl.c b/sysdeps/libm-ieee754/s_llroundl.c deleted file mode 100644 index 4a537c871e..0000000000 --- a/sysdeps/libm-ieee754/s_llroundl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Round long double value to long long int. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long long int -__llroundl (long double x) -{ - int32_t j0; - u_int32_t se, i1, i0; - long long int result; - int sign; - - GET_LDOUBLE_WORDS (se, i0, i1, x); - j0 = (se & 0x7fff) - 0x3fff; - sign = (se & 0x8000) != 0 ? -1 : 1; - - if (j0 < 31) - { - if (j0 < 0) - return j0 < -1 ? 0 : sign; - else - { - u_int32_t j = i0 + (0x40000000 >> j0); - if (j < i0) - { - j >>= 1; - j |= 0x80000000; - ++j0; - } - - result = j >> (31 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) - { - if (j0 >= 63) - result = (((long long int) i0 << 32) | i1) << (j0 - 63); - else - { - u_int32_t j = i1 + (0x80000000 >> (j0 - 31)); - if (j < i1) - ++i0; - - if (j0 == 31) - result = (long long int) i0; - else - result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long long int) x; - } - - return sign * result; -} - -weak_alias (__llroundl, llroundl) diff --git a/sysdeps/libm-ieee754/s_log1p.c b/sysdeps/libm-ieee754/s_log1p.c deleted file mode 100644 index 0a9801a931..0000000000 --- a/sysdeps/libm-ieee754/s_log1p.c +++ /dev/null @@ -1,191 +0,0 @@ -/* @(#)s_log1p.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. - * ==================================================== - */ -/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, - for performance improvement on pipelined processors. -*/ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_log1p.c,v 1.8 1995/05/10 20:47:46 jtc Exp $"; -#endif - -/* double log1p(double x) - * - * Method : - * 1. Argument Reduction: find k and f such that - * 1+x = 2^k * (1+f), - * where sqrt(2)/2 < 1+f < sqrt(2) . - * - * Note. If k=0, then f=x is exact. However, if k!=0, then f - * may not be representable exactly. In that case, a correction - * term is need. Let u=1+x rounded. Let c = (1+x)-u, then - * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u), - * and add back the correction term c/u. - * (Note: when x > 2**53, one can simply return log(x)) - * - * 2. Approximation of log1p(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 - * We use a special Reme algorithm on [0,0.1716] to generate - * 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 - * R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s +Lp6*s +Lp7*s - * (the values of Lp1 to Lp7 are listed in the program) - * and - * | 2 14 | -58.45 - * | Lp1*s +...+Lp7*s - R(z) | <= 2 - * | | - * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. - * In order to guarantee error in log below 1ulp, we compute log - * by - * log1p(f) = f - (hfsq - s*(hfsq+R)). - * - * 3. Finally, log1p(x) = k*ln2 + log1p(f). - * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: - * ln2_hi + ln2_lo, - * where n*ln2_hi is always exact for |n| < 2000. - * - * Special cases: - * log1p(x) is NaN with signal if x < -1 (including -INF) ; - * log1p(+INF) is +INF; log1p(-1) is -INF with signal; - * log1p(NaN) is that NaN with no signal. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - * - * Note: Assuming log() return accurate answer, the following - * algorithm can be used to compute log1p(x) to within a few ULP: - * - * u = 1+x; - * if(u==1.0) return x ; else - * return log(u)*(x/(u-1.0)); - * - * See HP-15C Advanced Functions Handbook, p.193. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ -ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ -two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ -Lp[] = {0.0, 6.666666666666735130e-01, /* 3FE55555 55555593 */ - 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ - 2.857142874366239149e-01, /* 3FD24924 94229359 */ - 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ - 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ - 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ - 1.479819860511658591e-01}; /* 3FC2F112 DF3E5244 */ - -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif - -#ifdef __STDC__ - double __log1p(double x) -#else - double __log1p(x) - double x; -#endif -{ - double hfsq,f,c,s,z,R,u,z2,z4,z6,R1,R2,R3,R4; - int32_t k,hx,hu,ax; - - GET_HIGH_WORD(hx,x); - ax = hx&0x7fffffff; - - k = 1; - if (hx < 0x3FDA827A) { /* x < 0.41422 */ - if(ax>=0x3ff00000) { /* x <= -1.0 */ - if(x==-1.0) return -two54/(x-x);/* log1p(-1)=+inf */ - else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ - } - if(ax<0x3e200000) { /* |x| < 2**-29 */ - if(two54+x>zero /* raise inexact */ - &&ax<0x3c900000) /* |x| < 2**-54 */ - return x; - else - return x - x*x*0.5; - } - if(hx>0||hx<=((int32_t)0xbfd2bec3)) { - k=0;f=x;hu=1;} /* -0.2929= 0x7ff00000) return x+x; - if(k!=0) { - if(hx<0x43400000) { - u = 1.0+x; - GET_HIGH_WORD(hu,u); - k = (hu>>20)-1023; - c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ - c /= u; - } else { - u = x; - GET_HIGH_WORD(hu,u); - k = (hu>>20)-1023; - c = 0; - } - hu &= 0x000fffff; - if(hu<0x6a09e) { - SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ - } else { - k += 1; - SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ - hu = (0x00100000-hu)>>2; - } - f = u-1.0; - } - hfsq=0.5*f*f; - if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) { - if(k==0) return zero; - else {c += k*ln2_lo; return k*ln2_hi+c;} - } - R = hfsq*(1.0-0.66666666666666666*f); - if(k==0) return f-R; else - return k*ln2_hi-((R-(k*ln2_lo+c))-f); - } - s = f/(2.0+f); - z = s*s; -#ifdef DO_NOT_USE_THIS - R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); -#else - R1 = z*Lp[1]; z2=z*z; - R2 = Lp[2]+z*Lp[3]; z4=z2*z2; - R3 = Lp[4]+z*Lp[5]; z6=z4*z2; - R4 = Lp[6]+z*Lp[7]; - R = R1 + z2*R2 + z4*R3 + z6*R4; -#endif - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); -} -weak_alias (__log1p, log1p) -#ifdef NO_LONG_DOUBLE -strong_alias (__log1p, __log1pl) -weak_alias (__log1p, log1pl) -#endif diff --git a/sysdeps/libm-ieee754/s_log1pf.c b/sysdeps/libm-ieee754/s_log1pf.c deleted file mode 100644 index bd3d57635c..0000000000 --- a/sysdeps/libm-ieee754/s_log1pf.c +++ /dev/null @@ -1,115 +0,0 @@ -/* s_log1pf.c -- float version of s_log1p.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_log1pf.c,v 1.4 1995/05/10 20:47:48 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 */ -Lp1 = 6.6666668653e-01, /* 3F2AAAAB */ -Lp2 = 4.0000000596e-01, /* 3ECCCCCD */ -Lp3 = 2.8571429849e-01, /* 3E924925 */ -Lp4 = 2.2222198546e-01, /* 3E638E29 */ -Lp5 = 1.8183572590e-01, /* 3E3A3325 */ -Lp6 = 1.5313838422e-01, /* 3E1CD04F */ -Lp7 = 1.4798198640e-01; /* 3E178897 */ - -#ifdef __STDC__ -static const float zero = 0.0; -#else -static float zero = 0.0; -#endif - -#ifdef __STDC__ - float __log1pf(float x) -#else - float __log1pf(x) - float x; -#endif -{ - float hfsq,f,c,s,z,R,u; - int32_t k,hx,hu,ax; - - GET_FLOAT_WORD(hx,x); - ax = hx&0x7fffffff; - - k = 1; - if (hx < 0x3ed413d7) { /* x < 0.41422 */ - if(ax>=0x3f800000) { /* x <= -1.0 */ - if(x==(float)-1.0) return -two25/(x-x); /* log1p(-1)=+inf */ - else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ - } - if(ax<0x31000000) { /* |x| < 2**-29 */ - if(two25+x>zero /* raise inexact */ - &&ax<0x24800000) /* |x| < 2**-54 */ - return x; - else - return x - x*x*(float)0.5; - } - if(hx>0||hx<=((int32_t)0xbe95f61f)) { - k=0;f=x;hu=1;} /* -0.2929= 0x7f800000) return x+x; - if(k!=0) { - if(hx<0x5a000000) { - u = (float)1.0+x; - GET_FLOAT_WORD(hu,u); - k = (hu>>23)-127; - /* correction term */ - c = (k>0)? (float)1.0-(u-x):x-(u-(float)1.0); - c /= u; - } else { - u = x; - GET_FLOAT_WORD(hu,u); - k = (hu>>23)-127; - c = 0; - } - hu &= 0x007fffff; - if(hu<0x3504f7) { - SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */ - } else { - k += 1; - SET_FLOAT_WORD(u,hu|0x3f000000); /* normalize u/2 */ - hu = (0x00800000-hu)>>2; - } - f = u-(float)1.0; - } - hfsq=(float)0.5*f*f; - if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) { - if(k==0) return zero; - else {c += k*ln2_lo; return k*ln2_hi+c;} - } - R = hfsq*((float)1.0-(float)0.66666666666666666*f); - if(k==0) return f-R; else - return k*ln2_hi-((R-(k*ln2_lo+c))-f); - } - s = f/((float)2.0+f); - z = s*s; - R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); -} -weak_alias (__log1pf, log1pf) diff --git a/sysdeps/libm-ieee754/s_log2.c b/sysdeps/libm-ieee754/s_log2.c deleted file mode 100644 index 7379ce85e7..0000000000 --- a/sysdeps/libm-ieee754/s_log2.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Adapted for log2 by Ulrich Drepper . */ -/* - * ==================================================== - * 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. - * ==================================================== - */ - -/* __log2(x) - * Return the logarithm to base 2 of x - * - * Method : - * 1. Argument Reduction: find k and f such that - * x = 2^k * (1+f), - * where sqrt(2)/2 < 1+f < sqrt(2) . - * - * 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 - * We use a special Reme algorithm on [0,0.1716] to generate - * 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 - * 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) - * and - * | 2 14 | -58.45 - * | Lg1*s +...+Lg7*s - R(z) | <= 2 - * | | - * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. - * In order to guarantee error in log below 1ulp, we compute log - * by - * log(1+f) = f - s*(f - R) (if f is not too large) - * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) - * - * 3. Finally, log(x) = k + log(1+f). - * = k+(f-(hfsq-(s*(hfsq+R)))) - * - * Special cases: - * log2(x) is NaN with signal if x < 0 (including -INF) ; - * log2(+INF) is +INF; log(0) is -INF with signal; - * log2(NaN) is that NaN with no signal. - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#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 */ -Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ -Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ -Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ -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 __log2(double x) -#else - double __log2(x) - double x; -#endif -{ - double hfsq,f,s,z,R,w,t1,t2,dk; - int32_t k,hx,i,j; - u_int32_t lx; - - 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 */ - GET_HIGH_WORD(hx,x); - } - if (hx >= 0x7ff00000) return x+x; - k += (hx>>20)-1023; - hx &= 0x000fffff; - i = (hx+0x95f64)&0x100000; - SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ - k += (i>>20); - dk = (double) k; - f = x-1.0; - if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ - if(f==zero) return dk; - R = f*f*(0.5-0.33333333333333333*f); - return dk-(R-f)/ln2; - } - s = f/(2.0+f); - z = s*s; - i = hx-0x6147a; - w = z*z; - j = 0x6b851-hx; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - i |= j; - R = t2+t1; - if(i>0) { - hfsq=0.5*f*f; - return dk-((hfsq-(s*(hfsq+R)))-f)/ln2; - } else { - return dk-((s*(f-R))-f)/ln2; - } -} - -weak_alias (__log2, log2) -#ifdef NO_LONG_DOUBLE -strong_alias (__log2, __log2l) -weak_alias (__log2, log2l) -#endif diff --git a/sysdeps/libm-ieee754/s_log2f.c b/sysdeps/libm-ieee754/s_log2f.c deleted file mode 100644 index 2377acd36a..0000000000 --- a/sysdeps/libm-ieee754/s_log2f.c +++ /dev/null @@ -1,91 +0,0 @@ -/* e_logf.c -- float version of e_log.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - * adapted for log2 by Ulrich Drepper - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - - -#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 */ -Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ -Lg3 = 2.8571429849e-01, /* 3E924925 */ -Lg4 = 2.2222198546e-01, /* 3E638E29 */ -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 __log2f(float x) -#else - float __log2f(x) - float x; -#endif -{ - float hfsq,f,s,z,R,w,t1,t2,dk; - int32_t k,ix,i,j; - - GET_FLOAT_WORD(ix,x); - - k=0; - if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) - return -two25/(x-x); /* log(+-0)=-inf */ - if (ix<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; - k += (ix>>23)-127; - ix &= 0x007fffff; - i = (ix+(0x95f64<<3))&0x800000; - SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ - k += (i>>23); - dk = (float)k; - f = x-(float)1.0; - if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ - if(f==zero) return dk; - R = f*f*((float)0.5-(float)0.33333333333333333*f); - return dk-(R-f)/ln2; - } - s = f/((float)2.0+f); - z = s*s; - i = ix-(0x6147a<<3); - w = z*z; - j = (0x6b851<<3)-ix; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - i |= j; - R = t2+t1; - if(i>0) { - hfsq=(float)0.5*f*f; - return dk-((hfsq-(s*(hfsq+R)))-f)/ln2; - } else { - return dk-((s*(f-R))-f)/ln2; - } -} -weak_alias (__log2f, log2f) diff --git a/sysdeps/libm-ieee754/s_logb.c b/sysdeps/libm-ieee754/s_logb.c deleted file mode 100644 index 4668cf78f8..0000000000 --- a/sysdeps/libm-ieee754/s_logb.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)s_logb.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $"; -#endif - -/* - * double logb(x) - * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. - * Use ilogb instead. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __logb(double x) -#else - double __logb(x) - double x; -#endif -{ - int32_t lx,ix; - EXTRACT_WORDS(ix,lx,x); - ix &= 0x7fffffff; /* high |x| */ - if((ix|lx)==0) return -1.0/fabs(x); - if(ix>=0x7ff00000) return x*x; - if((ix>>=20)==0) /* IEEE 754 logb */ - return -1022.0; - else - return (double) (ix-1023); -} -weak_alias (__logb, logb) -#ifdef NO_LONG_DOUBLE -strong_alias (__logb, __logbl) -weak_alias (__logb, logbl) -#endif diff --git a/sysdeps/libm-ieee754/s_logbf.c b/sysdeps/libm-ieee754/s_logbf.c deleted file mode 100644 index ade892a8f9..0000000000 --- a/sysdeps/libm-ieee754/s_logbf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* s_logbf.c -- float version of s_logb.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_logbf.c,v 1.4 1995/05/10 20:47:51 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __logbf(float x) -#else - float __logbf(x) - float x; -#endif -{ - int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* high |x| */ - if(ix==0) return (float)-1.0/fabsf(x); - if(ix>=0x7f800000) return x*x; - if((ix>>=23)==0) /* IEEE 754 logb */ - return -126.0; - else - return (float) (ix-127); -} -weak_alias (__logbf, logbf) diff --git a/sysdeps/libm-ieee754/s_logbl.c b/sysdeps/libm-ieee754/s_logbl.c deleted file mode 100644 index 2cd9d105f8..0000000000 --- a/sysdeps/libm-ieee754/s_logbl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* s_logbl.c -- long double version of s_logb.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * long double logbl(x) - * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. - * Use ilogb instead. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __logbl(long double x) -#else - long double __logbl(x) - long double x; -#endif -{ - int32_t es,lx,ix; - GET_LDOUBLE_WORDS(es,ix,lx,x); - es &= 0x7fff; /* exponent */ - if((es|ix|lx)==0) return -1.0/fabs(x); - if(es==0x7fff) return x*x; - if(es==0) /* IEEE 754 logb */ - return -16382.0; - else - return (long double) (es-0x3fff); -} -weak_alias (__logbl, logbl) diff --git a/sysdeps/libm-ieee754/s_lrint.c b/sysdeps/libm-ieee754/s_lrint.c deleted file mode 100644 index 8f0d717963..0000000000 --- a/sysdeps/libm-ieee754/s_lrint.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -static const double two52[2] = -{ - 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ - -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ -}; - - -long int -__lrint (double x) -{ - int32_t j0; - u_int32_t i0,i1; - volatile double w; - double t; - long int result; - int sx; - - EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - sx = i0 >> 31; - i0 &= 0xfffff; - i0 |= 0x100000; - - if (j0 < 20) - { - if (j0 < -1) - return 0; - else - { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - result = i0 >> (20 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) - { - if (j0 >= 52) - result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); - else - { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sx ? -result : result; -} - -weak_alias (__lrint, lrint) -#ifdef NO_LONG_DOUBLE -strong_alias (__lrint, __lrintl) -weak_alias (__lrint, lrintl) -#endif diff --git a/sysdeps/libm-ieee754/s_lrintf.c b/sysdeps/libm-ieee754/s_lrintf.c deleted file mode 100644 index 210ffec501..0000000000 --- a/sysdeps/libm-ieee754/s_lrintf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -static const double two23[2] = -{ - 8.3886080000e+06, /* 0x4B000000 */ - -8.3886080000e+06, /* 0xCB000000 */ -}; - - -long int -__lrintf (float x) -{ - int32_t j0; - u_int32_t i0; - volatile float w; - float t; - long int result; - int sx; - - GET_FLOAT_WORD (i0, x); - - sx = i0 >> 31; - j0 = ((i0 >> 23) & 0xff) - 0x7f; - i0 &= 0x7fffff; - i0 |= 0x800000; - - if (j0 < (int32_t) (sizeof (long int) * 8) - 1) - { - if (j0 < -1) - return 0; - else if (j0 >= 23) - result = (long int) i0 << (j0 - 23); - else - { - w = two23[sx] + x; - t = w - two23[sx]; - GET_FLOAT_WORD (i0, t); - j0 = ((i0 >> 23) & 0xff) - 0x7f; - i0 &= 0x7fffff; - i0 |= 0x800000; - - result = i0 >> (23 - j0); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sx ? -result : result; -} - -weak_alias (__lrintf, lrintf) diff --git a/sysdeps/libm-ieee754/s_lrintl.c b/sysdeps/libm-ieee754/s_lrintl.c deleted file mode 100644 index 673cf3d9db..0000000000 --- a/sysdeps/libm-ieee754/s_lrintl.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Round argument to nearest integral value according to current rounding - direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -static const long double two63[2] = -{ - 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ - -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ -}; - - -long int -__lrintl (long double x) -{ - int32_t se,j0; - u_int32_t i0, i1; - long int result; - volatile long double w; - long double t; - int sx; - - GET_LDOUBLE_WORDS (se, i0, i1, x); - - sx = (se >> 15) & 1; - j0 = (se & 0x7fff) - 0x3fff; - - if (j0 < 31) - { - if (j0 < -1) - return 0; - else - { - w = two63[sx] + x; - t = w - two63[sx]; - GET_LDOUBLE_WORDS (se, i0, i1, t); - j0 = (se & 0x7fff) - 0x3fff; - - result = i0 >> (31 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) - { - if (j0 >= 63) - result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63)); - else - { - w = two63[sx] + x; - t = w - two63[sx]; - GET_LDOUBLE_WORDS (se, i0, i1, t); - j0 = (se & 0x7fff) - 0x3fff; - - result = ((long int) i0 << (j0 - 31)) | (i1 >> (63 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sx ? -result : result; -} - -weak_alias (__lrintl, lrintl) diff --git a/sysdeps/libm-ieee754/s_lround.c b/sysdeps/libm-ieee754/s_lround.c deleted file mode 100644 index 49be12f03b..0000000000 --- a/sysdeps/libm-ieee754/s_lround.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Round double value to long int. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long int -__lround (double x) -{ - int32_t j0; - u_int32_t i1, i0; - long int result; - int sign; - - EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - sign = (i0 & 0x80000000) != 0 ? -1 : 1; - i0 &= 0xfffff; - i0 |= 0x100000; - - if (j0 < 20) - { - if (j0 < 0) - return j0 < -1 ? 0 : sign; - else - { - i0 += 0x80000 >> j0; - - result = i0 >> (20 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) - { - if (j0 >= 52) - result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); - else - { - u_int32_t j = i1 + (0x80000000 >> (j0 - 20)); - if (j < i1) - ++i0; - - result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sign * result; -} - -weak_alias (__lround, lround) -#ifdef NO_LONG_DOUBLE -strong_alias (__lround, __lroundl) -weak_alias (__lround, lroundl) -#endif diff --git a/sysdeps/libm-ieee754/s_lroundf.c b/sysdeps/libm-ieee754/s_lroundf.c deleted file mode 100644 index df1d242e2a..0000000000 --- a/sysdeps/libm-ieee754/s_lroundf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Round float value to long int. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long int -__lroundf (float x) -{ - int32_t j0; - u_int32_t i; - long int result; - int sign; - - GET_FLOAT_WORD (i, x); - j0 = ((i >> 23) & 0xff) - 0x7f; - sign = (i & 0x80000000) != 0 ? -1 : 1; - i &= 0x7fffff; - i |= 0x800000; - - if (j0 < (int32_t) (8 * sizeof (long int)) - 1) - { - if (j0 < 0) - return j0 < -1 ? 0 : sign; - else if (j0 >= 23) - result = (long int) i << (j0 - 23); - else - { - i += 0x400000 >> j0; - - result = i >> (23 - j0); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sign * result; -} - -weak_alias (__lroundf, lroundf) diff --git a/sysdeps/libm-ieee754/s_lroundl.c b/sysdeps/libm-ieee754/s_lroundl.c deleted file mode 100644 index 3bdac830b4..0000000000 --- a/sysdeps/libm-ieee754/s_lroundl.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Round long double value to long int. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long int -__lroundl (long double x) -{ - int32_t j0; - u_int32_t se, i1, i0; - long int result; - int sign; - - GET_LDOUBLE_WORDS (se, i0, i1, x); - j0 = (se & 0x7fff) - 0x3fff; - sign = (se & 0x8000) != 0 ? -1 : 1; - - if (j0 < 31) - { - if (j0 < 0) - return j0 < -1 ? 0 : sign; - else - { - u_int32_t j = i0 + (0x40000000 >> j0); - if (j < i0) - { - j >>= 1; - j |= 0x80000000; - ++j0; - } - - result = j >> (31 - j0); - } - } - else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) - { - if (j0 >= 63) - result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63)); - else - { - u_int32_t j = i1 + (0x80000000 >> (j0 - 31)); - if (j < i1) - ++i0; - - result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0)); - } - } - else - { - /* The number is too large. It is left implementation defined - what happens. */ - return (long int) x; - } - - return sign * result; -} - -weak_alias (__lroundl, lroundl) diff --git a/sysdeps/libm-ieee754/s_matherr.c b/sysdeps/libm-ieee754/s_matherr.c deleted file mode 100644 index 1ad3eb3334..0000000000 --- a/sysdeps/libm-ieee754/s_matherr.c +++ /dev/null @@ -1,35 +0,0 @@ -/* @(#)s_matherr.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_matherr.c,v 1.6 1995/05/10 20:47:53 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - int - weak_function - __matherr(struct exception *x) -#else - int - weak_function - __matherr(x) - struct exception *x; -#endif -{ - int n=0; - if(x->arg1!=x->arg1) return 0; - return n; -} -weak_alias (__matherr, matherr) diff --git a/sysdeps/libm-ieee754/s_modf.c b/sysdeps/libm-ieee754/s_modf.c deleted file mode 100644 index 7851f675a4..0000000000 --- a/sysdeps/libm-ieee754/s_modf.c +++ /dev/null @@ -1,85 +0,0 @@ -/* @(#)s_modf.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_modf.c,v 1.8 1995/05/10 20:47:55 jtc Exp $"; -#endif - -/* - * modf(double x, double *iptr) - * return fraction part of x, and return x's integral part in *iptr. - * Method: - * Bit twiddling. - * - * Exception: - * No exception. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double one = 1.0; -#else -static double one = 1.0; -#endif - -#ifdef __STDC__ - double __modf(double x, double *iptr) -#else - double __modf(x, iptr) - double x,*iptr; -#endif -{ - int32_t i0,i1,j0; - u_int32_t i; - EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */ - if(j0<20) { /* integer part in high x */ - if(j0<0) { /* |x|<1 */ - INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */ - return x; - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) { /* x is integral */ - *iptr = x; - INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ - return x; - } else { - INSERT_WORDS(*iptr,i0&(~i),0); - return x - *iptr; - } - } - } else if (j0>51) { /* no fraction part */ - *iptr = x*one; - /* We must handle NaNs separately. */ - if (j0 == 0x400 && ((i0 & 0xfffff) | i1)) - return x*one; - INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ - return x; - } else { /* fraction part in low x */ - i = ((u_int32_t)(0xffffffff))>>(j0-20); - if((i1&i)==0) { /* x is integral */ - *iptr = x; - INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ - return x; - } else { - INSERT_WORDS(*iptr,i0,i1&(~i)); - return x - *iptr; - } - } -} -weak_alias (__modf, modf) -#ifdef NO_LONG_DOUBLE -strong_alias (__modf, __modfl) -weak_alias (__modf, modfl) -#endif diff --git a/sysdeps/libm-ieee754/s_modff.c b/sysdeps/libm-ieee754/s_modff.c deleted file mode 100644 index e6c22b2add..0000000000 --- a/sysdeps/libm-ieee754/s_modff.c +++ /dev/null @@ -1,66 +0,0 @@ -/* s_modff.c -- float version of s_modf.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_modff.c,v 1.4 1995/05/10 20:47:56 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float one = 1.0; -#else -static float one = 1.0; -#endif - -#ifdef __STDC__ - float __modff(float x, float *iptr) -#else - float __modff(x, iptr) - float x,*iptr; -#endif -{ - int32_t i0,j0; - u_int32_t i; - GET_FLOAT_WORD(i0,x); - j0 = ((i0>>23)&0xff)-0x7f; /* exponent of x */ - if(j0<23) { /* integer part in x */ - if(j0<0) { /* |x|<1 */ - SET_FLOAT_WORD(*iptr,i0&0x80000000); /* *iptr = +-0 */ - return x; - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) { /* x is integral */ - u_int32_t ix; - *iptr = x; - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */ - return x; - } else { - SET_FLOAT_WORD(*iptr,i0&(~i)); - return x - *iptr; - } - } - } else { /* no fraction part */ - *iptr = x*one; - /* We must handle NaNs separately. */ - if (j0 == 0x80 && (i0 & 0x7fffff)) - return x*one; - SET_FLOAT_WORD(x,i0&0x80000000); /* return +-0 */ - return x; - } -} -weak_alias (__modff, modff) diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c deleted file mode 100644 index ad16ef65ec..0000000000 --- a/sysdeps/libm-ieee754/s_modfl.c +++ /dev/null @@ -1,85 +0,0 @@ -/* s_modfl.c -- long double version of s_modf.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * modfl(long double x, long double *iptr) - * return fraction part of x, and return x's integral part in *iptr. - * Method: - * Bit twiddling. - * - * Exception: - * No exception. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double one = 1.0; -#else -static long double one = 1.0; -#endif - -#ifdef __STDC__ - long double __modfl(long double x, long double *iptr) -#else - long double __modfl(x, iptr) - long double x,*iptr; -#endif -{ - int32_t i0,i1,j0; - u_int32_t i,se; - GET_LDOUBLE_WORDS(se,i0,i1,x); - j0 = (se&0x7fff)-0x3fff; /* exponent of x */ - if(j0<32) { /* integer part in high x */ - if(j0<0) { /* |x|<1 */ - SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */ - return x; - } else { - i = (0x7fffffff)>>j0; - if(((i0&i)|i1)==0) { /* x is integral */ - *iptr = x; - SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ - return x; - } else { - SET_LDOUBLE_WORDS(*iptr,se,i0&(~i),0); - return x - *iptr; - } - } - } else if (j0>63) { /* no fraction part */ - *iptr = x*one; - /* We must handle NaNs separately. */ - if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1)) - return x*one; - SET_LDOUBLE_WORDS(x,se&0x8000,0,0); /* return +-0 */ - return x; - } else { /* fraction part in low x */ - i = ((u_int32_t)(0xffffffff))>>(j0-32); - if((i1&i)==0) { /* x is integral */ - *iptr = x; - INSERT_WORDS(x,se&0x8000,0); /* return +-0 */ - return x; - } else { - SET_LDOUBLE_WORDS(*iptr,se,i0,i1&(~i)); - return x - *iptr; - } - } -} -weak_alias (__modfl, modfl) diff --git a/sysdeps/libm-ieee754/s_nan.c b/sysdeps/libm-ieee754/s_nan.c deleted file mode 100644 index ff3b26855f..0000000000 --- a/sysdeps/libm-ieee754/s_nan.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Return quiet nan. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include -#include - - -double -__nan (const char *tagp) -{ - if (tagp[0] != '\0') - { - char buf[6 + strlen (tagp)]; - sprintf (buf, "NAN(%s)", tagp); - return strtod (buf, NULL); - } - - return NAN; -} -weak_alias (__nan, nan) -#ifdef NO_LONG_DOUBLE -strong_alias (__nan, __nanl) -weak_alias (__nan, nanl) -#endif diff --git a/sysdeps/libm-ieee754/s_nanf.c b/sysdeps/libm-ieee754/s_nanf.c deleted file mode 100644 index b59040ac82..0000000000 --- a/sysdeps/libm-ieee754/s_nanf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Return quiet nan. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include -#include - - -float -__nanf (const char *tagp) -{ - if (tagp[0] != '\0') - { - char buf[6 + strlen (tagp)]; - sprintf (buf, "NAN(%s)", tagp); - return strtof (buf, NULL); - } - - return NAN; -} -weak_alias (__nanf, nanf) diff --git a/sysdeps/libm-ieee754/s_nanl.c b/sysdeps/libm-ieee754/s_nanl.c deleted file mode 100644 index bd42689b78..0000000000 --- a/sysdeps/libm-ieee754/s_nanl.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Return quiet nan. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include -#include - - -long double -__nanl (const char *tagp) -{ - if (tagp[0] != '\0') - { - char buf[6 + strlen (tagp)]; - sprintf (buf, "NAN(%s)", tagp); - return strtold (buf, NULL); - } - - return NAN; -} -weak_alias (__nanl, nanl) diff --git a/sysdeps/libm-ieee754/s_nearbyint.c b/sysdeps/libm-ieee754/s_nearbyint.c deleted file mode 100644 index 32f5bf9447..0000000000 --- a/sysdeps/libm-ieee754/s_nearbyint.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Adapted for use as nearbyint by Ulrich Drepper . */ -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $"; -#endif - -/* - * rint(x) - * Return x rounded to integral value according to the prevailing - * rounding mode. - * Method: - * Using floating addition. - * Exception: - * Inexact flag raised if x not equal to rint(x). - */ - -#include -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -TWO52[2]={ - 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ - -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ -}; - -#ifdef __STDC__ - double __nearbyint(double x) -#else - double __nearbyint(x) - double x; -#endif -{ - fenv_t env; - int32_t i0,j0,sx; - u_int32_t i,i1; - double w,t; - EXTRACT_WORDS(i0,i1,x); - sx = (i0>>31)&1; - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { - if(((i0&0x7fffffff)|i1)==0) return x; - i1 |= (i0&0x0fffff); - i0 &= 0xfffe0000; - i0 |= ((i1|-i1)>>12)&0x80000; - SET_HIGH_WORD(x,i0); - feholdexcept (&env); - w = TWO52[sx]+x; - t = w-TWO52[sx]; - fesetenv (&env); - GET_HIGH_WORD(i0,t); - SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - i>>=1; - if(((i0&i)|i1)!=0) { - if(j0==19) i1 = 0x40000000; else - i0 = (i0&(~i))|((0x20000)>>j0); - } - } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); - if((i1&i)==0) return x; /* x is integral */ - i>>=1; - if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); - } - INSERT_WORDS(x,i0,i1); - feholdexcept (&env); - w = TWO52[sx]+x; - t = w-TWO52[sx]; - fesetenv (&env); - return t; -} -weak_alias (__nearbyint, nearbyint) -#ifdef NO_LONG_DOUBLE -strong_alias (__nearbyint, __nearbyintl) -weak_alias (__nearbyint, nearbyintl) -#endif diff --git a/sysdeps/libm-ieee754/s_nearbyintf.c b/sysdeps/libm-ieee754/s_nearbyintf.c deleted file mode 100644 index 7d6f262f51..0000000000 --- a/sysdeps/libm-ieee754/s_nearbyintf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* s_rintf.c -- float version of s_rint.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ -/* Adapted for use as nearbyint by Ulrich Drepper . */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - - -#include -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -TWO23[2]={ - 8.3886080000e+06, /* 0x4b000000 */ - -8.3886080000e+06, /* 0xcb000000 */ -}; - -#ifdef __STDC__ - float __nearbyintf(float x) -#else - float __nearbyintf(x) - float x; -#endif -{ - fenv_t env; - int32_t i0,j0,sx; - u_int32_t i,i1; - float w,t; - GET_FLOAT_WORD(i0,x); - sx = (i0>>31)&1; - j0 = ((i0>>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { - if((i0&0x7fffffff)==0) return x; - i1 = (i0&0x07fffff); - i0 &= 0xfff00000; - i0 |= ((i1|-i1)>>9)&0x400000; - SET_FLOAT_WORD(x,i0); - feholdexcept (&env); - w = TWO23[sx]+x; - t = w-TWO23[sx]; - fesetenv (&env); - GET_FLOAT_WORD(i0,t); - SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - i>>=1; - if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); - } - } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - feholdexcept (&env); - w = TWO23[sx]+x; - t = w-TWO23[sx]; - fesetenv (&env); - return t; -} -weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/libm-ieee754/s_nearbyintl.c b/sysdeps/libm-ieee754/s_nearbyintl.c deleted file mode 100644 index 3b0715e5a5..0000000000 --- a/sysdeps/libm-ieee754/s_nearbyintl.c +++ /dev/null @@ -1,100 +0,0 @@ -/* s_rintl.c -- long double version of s_rint.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ -/* Adapted for use as nearbyint by Ulrich Drepper . */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -/* - * rintl(x) - * Return x rounded to integral value according to the prevailing - * rounding mode. - * Method: - * Using floating addition. - * Exception: - * Inexact flag raised if x not equal to rintl(x). - */ - -#include -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double -#else -static long double -#endif -TWO63[2]={ - 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ - -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ -}; - -#ifdef __STDC__ - long double __nearbyintl(long double x) -#else - long double __nearbyintl(x) - long double x; -#endif -{ - fenv_t env; - int32_t se,j0,sx; - u_int32_t i,i0,i1; - long double w,t; - GET_LDOUBLE_WORDS(se,i0,i1,x); - sx = (se>>15)&1; - j0 = (se&0x7fff)-0x3fff; - if(j0<31) { - if(j0<0) { - if(((se&0x7fff)|i0|i1)==0) return x; - i1 |= i0; - i0 &= 0xe0000000; - i0 |= (i1|-i1)&0x80000000; - SET_LDOUBLE_MSW(x,i0); - feholdexcept (&env); - w = TWO63[sx]+x; - t = w-TWO63[sx]; - fesetenv (&env); - GET_LDOUBLE_EXP(i0,t); - SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15)); - return t; - } else { - i = (0x7fffffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - i>>=1; - if(((i0&i)|i1)!=0) { - if(j0==31) i1 = 0x40000000; else - i0 = (i0&(~i))|((0x20000000)>>j0); - /* Shouldn't this be - if (j0 >= 30) i1 = 0x80000000 >> (j0 - 30); - i0 = (i0&(~i))|((0x20000000)>>j0); - If yes, this should be correct in s_rint and - s_rintf, too. -- drepper@cygnus.com */ - } - } - } else if (j0>62) { - if(j0==0x4000) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-31); - if((i1&i)==0) return x; /* x is integral */ - i>>=1; - if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31)); - } - SET_LDOUBLE_WORDS(x,se,i0,i1); - feholdexcept (&env); - w = TWO63[sx]+x; - t = w-TWO63[sx]; - fesetenv (&env); - return t; -} -weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/libm-ieee754/s_nextafter.c b/sysdeps/libm-ieee754/s_nextafter.c deleted file mode 100644 index b98a161cf2..0000000000 --- a/sysdeps/libm-ieee754/s_nextafter.c +++ /dev/null @@ -1,84 +0,0 @@ -/* @(#)s_nextafter.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp $"; -#endif - -/* IEEE functions - * nextafter(x,y) - * return the next machine floating-point number of x in the - * direction toward y. - * Special cases: - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __nextafter(double x, double y) -#else - double __nextafter(x,y) - double x,y; -#endif -{ - int32_t hx,hy,ix,iy; - u_int32_t lx,ly; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - ix = hx&0x7fffffff; /* |x| */ - iy = hy&0x7fffffff; /* |y| */ - - if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ - ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ - return x+y; - if(x==y) return y; /* x=y, return y */ - if((ix|lx)==0) { /* x == 0 */ - INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ - } - if(hx>=0) { /* x > 0 */ - if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x < y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } else { /* x < 0 */ - if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x > y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } - hy = hx&0x7ff00000; - if(hy>=0x7ff00000) return x+x; /* overflow */ - if(hy<0x00100000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - INSERT_WORDS(y,hx,lx); - return y; - } - } - INSERT_WORDS(x,hx,lx); - return x; -} -weak_alias (__nextafter, nextafter) -#ifdef NO_LONG_DOUBLE -strong_alias (__nextafter, __nextafterl) -weak_alias (__nextafter, nextafterl) -#endif diff --git a/sysdeps/libm-ieee754/s_nextafterf.c b/sysdeps/libm-ieee754/s_nextafterf.c deleted file mode 100644 index 611742bdf4..0000000000 --- a/sysdeps/libm-ieee754/s_nextafterf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* s_nextafterf.c -- float version of s_nextafter.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __nextafterf(float x, float y) -#else - float __nextafterf(x,y) - float x,y; -#endif -{ - int32_t hx,hy,ix,iy; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - ix = hx&0x7fffffff; /* |x| */ - iy = hy&0x7fffffff; /* |y| */ - - if((ix>0x7f800000) || /* x is nan */ - (iy>0x7f800000)) /* y is nan */ - return x+y; - if(x==y) return y; /* x=y, return y */ - if(ix==0) { /* x == 0 */ - SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ - } - if(hx>=0) { /* x > 0 */ - if(hx>hy) { /* x > y, x -= ulp */ - hx -= 1; - } else { /* x < y, x += ulp */ - hx += 1; - } - } else { /* x < 0 */ - if(hy>=0||hx>hy){ /* x < y, x -= ulp */ - hx -= 1; - } else { /* x > y, x += ulp */ - hx += 1; - } - } - hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(y,hx); - return y; - } - } - SET_FLOAT_WORD(x,hx); - return x; -} -weak_alias (__nextafterf, nextafterf) diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c deleted file mode 100644 index aea57e3086..0000000000 --- a/sysdeps/libm-ieee754/s_nextafterl.c +++ /dev/null @@ -1,101 +0,0 @@ -/* s_nextafterl.c -- long double version of s_nextafter.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* IEEE functions - * nextafterl(x,y) - * return the next machine floating-point number of x in the - * direction toward y. - * Special cases: - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __nextafterl(long double x, long double y) -#else - long double __nextafterl(x,y) - long double x,y; -#endif -{ - int32_t hx,hy,ix,iy; - u_int32_t lx,ly,esx,esy; - - GET_LDOUBLE_WORDS(esx,hx,lx,x); - GET_LDOUBLE_WORDS(esy,hy,ly,y); - ix = esx&0x7fff; /* |x| */ - iy = esy&0x7fff; /* |y| */ - - if(((ix==0x7fff)&&((hx|lx)|-(hx|lx))!=0) || /* x is nan */ - ((iy==0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ - return x+y; - if(x==y) return y; /* x=y, return y */ - if((ix|hx|lx)==0) { /* x == 0 */ - SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ - } - if(esx<0x8000) { /* x > 0 */ - if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { - /* x > y, x -= ulp */ - if(lx==0) { - if (hx==0) esx -= 1; - hx -= 1; - } - lx -= 1; - } else { /* x < y, x += ulp */ - lx += 1; - if(lx==0) { - hx += 1; - if (hx==0) - esx += 1; - } - } - } else { /* x < 0 */ - if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){ - /* x < y, x -= ulp */ - if(lx==0) { - if (hx==0) esx -= 1; - hx -= 1; - } - lx -= 1; - } else { /* x > y, x += ulp */ - lx += 1; - if(lx==0) { - hx += 1; - if (hx==0) esx += 1; - } - } - } - esy = esx&0x7fff; - if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } - } - SET_LDOUBLE_WORDS(x,esx,hx,lx); - return x; -} -weak_alias (__nextafterl, nextafterl) -strong_alias (__nextafterl, __nexttowardl) -weak_alias (__nextafterl, nexttowardl) diff --git a/sysdeps/libm-ieee754/s_nexttoward.c b/sysdeps/libm-ieee754/s_nexttoward.c deleted file mode 100644 index 0bb57d8465..0000000000 --- a/sysdeps/libm-ieee754/s_nexttoward.c +++ /dev/null @@ -1,98 +0,0 @@ -/* s_nexttoward.c - * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support, - * drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* IEEE functions - * nextafterx(x,y) - * return the next machine floating-point number of x in the - * direction toward y. - * Special cases: - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __nexttoward(double x, long double y) -#else - double __nexttoward(x,y) - double x; - long double y; -#endif -{ - int32_t hx,ix,iy; - u_int32_t lx,hy,ly,esy; - - EXTRACT_WORDS(hx,lx,x); - GET_LDOUBLE_WORDS(esy,hy,ly,y); - ix = hx&0x7fffffff; /* |x| */ - iy = esy&0x7fff; /* |y| */ - - if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ - ((iy>=0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ - return x+y; - if((long double) x==y) return x; /* x=y, return x */ - if((ix|lx)==0) { /* x == 0 */ - double x2; - INSERT_WORDS(x,esy&0x8000?0x80000000:0,1);/* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ - } - if(hx>=0) { /* x > 0 */ - if (esy>=0x8000||((ix>>20)&0x7ff)>iy - || (((ix>>20)&0x7ff)==iy - && (((hx<<11)|(lx>>21))>(hy&0x7fffffff) - || (((hx<<11)|(lx>>21))==(hy&0x7fffffff) - && (lx<<11)>ly)))) { /* x > y, x -= ulp */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x < y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } else { /* x < 0 */ - if (esy<0x8000||((ix>>20)&0x7ff)>iy - || (((ix>>20)&0x7ff)==iy - && (((hx<<11)|(lx>>21))>(hy&0x7fffffff) - || (((hx<<11)|(lx>>21))==(hy&0x7fffffff) - && (lx<<11)>ly)))) {/* x < y, x -= ulp */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x > y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } - hy = hx&0x7ff00000; - if(hy>=0x7ff00000) return x+x; /* overflow */ - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } - } - INSERT_WORDS(x,hx,lx); - return x; -} -weak_alias (__nexttoward, nexttoward) -#ifdef NO_LONG_DOUBLE -strong_alias (__nexttoward, __nexttowardl) -weak_alias (__nexttoward, nexttowardl) -#endif diff --git a/sysdeps/libm-ieee754/s_nexttowardf.c b/sysdeps/libm-ieee754/s_nexttowardf.c deleted file mode 100644 index 71a28987ec..0000000000 --- a/sysdeps/libm-ieee754/s_nexttowardf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* s_nexttowardf.c -- float version of s_nextafter.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __nexttowardf(float x, long double y) -#else - float __nexttowardf(x,y) - float x; - long double y; -#endif -{ - int32_t hx,ix,iy; - u_int32_t hy,ly,esy; - - GET_FLOAT_WORD(hx,x); - GET_LDOUBLE_WORDS(esy,hy,ly,y); - ix = hx&0x7fffffff; /* |x| */ - iy = esy&0x7fff; /* |y| */ - - if((ix>0x7f800000) || /* x is nan */ - (iy>=0x7fff&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */ - return x+y; - if((long double) x==y) return y; /* x=y, return y */ - if(ix==0) { /* x == 0 */ - float x2; - SET_FLOAT_WORD(x,(esy&0x8000?0x80000000:0)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ - } - if(hx>=0) { /* x > 0 */ - if(esy>=0x8000||((ix>>23)&0xff)>iy - || (((ix>>23)&0xff)==iy - && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x > y, x -= ulp */ - hx -= 1; - } else { /* x < y, x += ulp */ - hx += 1; - } - } else { /* x < 0 */ - if(esy<0x8000||((ix>>23)&0xff)>iy - || (((ix>>23)&0xff)==iy - && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x < y, x -= ulp */ - hx -= 1; - } else { /* x > y, x += ulp */ - hx += 1; - } - } - hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } - } - SET_FLOAT_WORD(x,hx); - return x; -} -weak_alias (__nexttowardf, nexttowardf) diff --git a/sysdeps/libm-ieee754/s_nexttowardl.c b/sysdeps/libm-ieee754/s_nexttowardl.c deleted file mode 100644 index 73c3610fc1..0000000000 --- a/sysdeps/libm-ieee754/s_nexttowardl.c +++ /dev/null @@ -1 +0,0 @@ -/* This function is the same as nextafterl so we use an alias there. */ diff --git a/sysdeps/libm-ieee754/s_remquo.c b/sysdeps/libm-ieee754/s_remquo.c deleted file mode 100644 index 6e32efbba2..0000000000 --- a/sysdeps/libm-ieee754/s_remquo.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Compute remainder and a congruent to the quotient. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -static const double zero = 0.0; - - -double -__remquo (double x, double y, int *quo) -{ - int32_t hx,hy; - u_int32_t sx,lx,ly; - int cquo, qs; - - EXTRACT_WORDS (hx, lx, x); - EXTRACT_WORDS (hy, ly, y); - sx = hx & 0x80000000; - qs = sx ^ (hy & 0x80000000); - hy &= 0x7fffffff; - hx &= 0x7fffffff; - - /* Purge off exception values. */ - if ((hy | ly) == 0) - return (x * y) / (x * y); /* y = 0 */ - if ((hx >= 0x7ff00000) /* x not finite */ - || ((hy >= 0x7ff00000) /* p is NaN */ - && (((hy - 0x7ff00000) | ly) != 0))) - return (x * y) / (x * y); - - if (hy <= 0x7fbfffff) - x = __ieee754_fmod (x, 8 * y); /* now x < 8y */ - - if (((hx - hy) | (lx - ly)) == 0) - { - *quo = qs ? -1 : 1; - return zero * x; - } - - x = fabs (x); - y = fabs (y); - cquo = 0; - - if (x >= 4 * y) - { - x -= 4 * y; - cquo += 4; - } - if (x >= 2 * y) - { - x -= 2 * y; - cquo += 2; - } - - if (hy < 0x00200000) - { - if (x + x > y) - { - x -= y; - ++cquo; - if (x + x >= y) - { - x -= y; - ++cquo; - } - } - } - else - { - double y_half = 0.5 * y; - if (x > y_half) - { - x -= y; - ++cquo; - if (x >= y_half) - { - x -= y; - ++cquo; - } - } - } - - *quo = qs ? -cquo : cquo; - - if (sx) - x = -x; - return x; -} -weak_alias (__remquo, remquo) -#ifdef NO_LONG_DOUBLE -strong_alias (__remquo, __remquol) -weak_alias (__remquo, remquol) -#endif diff --git a/sysdeps/libm-ieee754/s_remquof.c b/sysdeps/libm-ieee754/s_remquof.c deleted file mode 100644 index 2ffd16c903..0000000000 --- a/sysdeps/libm-ieee754/s_remquof.c +++ /dev/null @@ -1,108 +0,0 @@ -/* Compute remainder and a congruent to the quotient. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -static const float zero = 0.0; - - -float -__remquof (float x, float y, int *quo) -{ - int32_t hx,hy; - u_int32_t sx; - int cquo, qs; - - GET_FLOAT_WORD (hx, x); - GET_FLOAT_WORD (hy, y); - sx = hx & 0x80000000; - qs = sx ^ (hy & 0x80000000); - hy &= 0x7fffffff; - hx &= 0x7fffffff; - - /* Purge off exception values. */ - if (hy == 0) - return (x * y) / (x * y); /* y = 0 */ - if ((hx >= 0x7f800000) /* x not finite */ - || (hy > 0x7f800000)) /* y is NaN */ - return (x * y) / (x * y); - - if (hy <= 0x7dffffff) - x = __ieee754_fmodf (x, 8 * y); /* now x < 8y */ - - if ((hx - hy) == 0) - { - *quo = qs ? -1 : 1; - return zero * x; - } - - x = fabsf (x); - y = fabsf (y); - cquo = 0; - - if (x >= 4 * y) - { - x -= 4 * y; - cquo += 4; - } - if (x >= 2 * y) - { - x -= 2 * y; - cquo += 2; - } - - if (hy < 0x01000000) - { - if (x + x > y) - { - x -= y; - ++cquo; - if (x + x >= y) - { - x -= y; - ++cquo; - } - } - } - else - { - float y_half = 0.5 * y; - if (x > y_half) - { - x -= y; - ++cquo; - if (x >= y_half) - { - x -= y; - ++cquo; - } - } - } - - *quo = qs ? -cquo : cquo; - - if (sx) - x = -x; - return x; -} -weak_alias (__remquof, remquof) diff --git a/sysdeps/libm-ieee754/s_remquol.c b/sysdeps/libm-ieee754/s_remquol.c deleted file mode 100644 index 88ff298eb6..0000000000 --- a/sysdeps/libm-ieee754/s_remquol.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Compute remainder and a congruent to the quotient. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -static const long double zero = 0.0; - - -long double -__remquol (long double x, long double p, int *quo) -{ - int32_t ex,ep,hx,hp; - u_int32_t sx,lx,lp; - int cquo,qs; - - GET_LDOUBLE_WORDS (ex, hx, lx, x); - GET_LDOUBLE_WORDS (ep, hp, lp, p); - sx = ex & 0x8000; - qs = (sx ^ (ep & 0x8000)) >> 15; - ep &= 0x7fff; - ex &= 0x7fff; - - /* Purge off exception values. */ - if ((ep | hp | lp) == 0) - return (x * p) / (x * p); /* p = 0 */ - if ((ex == 0x7fff) /* x not finite */ - || ((ep == 0x7fff) /* p is NaN */ - && ((hp | lp) != 0))) - return (x * p) / (x * p); - - if (ep <= 0x7ffb) - x = __ieee754_fmodl (x, 8 * p); /* now x < 8p */ - - if (((ex - ep) | (hx - hp) | (lx - lp)) == 0) - { - *quo = qs ? -1 : 1; - return zero * x; - } - - x = fabsl (x); - p = fabsl (p); - cquo = 0; - - if (x >= 4 * p) - { - x -= 4 * p; - cquo += 4; - } - if (x >= 2 * p) - { - x -= 2 * p; - cquo += 2; - } - - if (ep < 0x0002) - { - if (x + x > p) - { - x -= p; - ++cquo; - if (x + x >= p) - { - x -= p; - ++cquo; - } - } - } - else - { - long double p_half = 0.5 * p; - if (x > p_half) - { - x -= p; - ++cquo; - if (x >= p_half) - { - x -= p; - ++cquo; - } - } - } - - *quo = qs ? -cquo : cquo; - - if (sx) - x = -x; - return x; -} -weak_alias (__remquol, remquol) diff --git a/sysdeps/libm-ieee754/s_rint.c b/sysdeps/libm-ieee754/s_rint.c deleted file mode 100644 index e5f241291c..0000000000 --- a/sysdeps/libm-ieee754/s_rint.c +++ /dev/null @@ -1,91 +0,0 @@ -/* @(#)s_rint.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $"; -#endif - -/* - * rint(x) - * Return x rounded to integral value according to the prevailing - * rounding mode. - * Method: - * Using floating addition. - * Exception: - * Inexact flag raised if x not equal to rint(x). - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -TWO52[2]={ - 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ - -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ -}; - -#ifdef __STDC__ - double __rint(double x) -#else - double __rint(x) - double x; -#endif -{ - int32_t i0,j0,sx; - u_int32_t i,i1; - double w,t; - EXTRACT_WORDS(i0,i1,x); - sx = (i0>>31)&1; - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { - if(((i0&0x7fffffff)|i1)==0) return x; - i1 |= (i0&0x0fffff); - i0 &= 0xfffe0000; - i0 |= ((i1|-i1)>>12)&0x80000; - SET_HIGH_WORD(x,i0); - w = TWO52[sx]+x; - t = w-TWO52[sx]; - GET_HIGH_WORD(i0,t); - SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - i>>=1; - if(((i0&i)|i1)!=0) { - if(j0==19) i1 = 0x40000000; else - i0 = (i0&(~i))|((0x20000)>>j0); - } - } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); - if((i1&i)==0) return x; /* x is integral */ - i>>=1; - if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); - } - INSERT_WORDS(x,i0,i1); - w = TWO52[sx]+x; - return w-TWO52[sx]; -} -weak_alias (__rint, rint) -#ifdef NO_LONG_DOUBLE -strong_alias (__rint, __rintl) -weak_alias (__rint, rintl) -#endif diff --git a/sysdeps/libm-ieee754/s_rintf.c b/sysdeps/libm-ieee754/s_rintf.c deleted file mode 100644 index 4e5b409b29..0000000000 --- a/sysdeps/libm-ieee754/s_rintf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* s_rintf.c -- float version of s_rint.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_rintf.c,v 1.4 1995/05/10 20:48:06 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -TWO23[2]={ - 8.3886080000e+06, /* 0x4b000000 */ - -8.3886080000e+06, /* 0xcb000000 */ -}; - -#ifdef __STDC__ - float __rintf(float x) -#else - float __rintf(x) - float x; -#endif -{ - int32_t i0,j0,sx; - u_int32_t i,i1; - float w,t; - GET_FLOAT_WORD(i0,x); - sx = (i0>>31)&1; - j0 = ((i0>>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { - if((i0&0x7fffffff)==0) return x; - i1 = (i0&0x07fffff); - i0 &= 0xfff00000; - i0 |= ((i1|-i1)>>9)&0x400000; - SET_FLOAT_WORD(x,i0); - w = TWO23[sx]+x; - t = w-TWO23[sx]; - GET_FLOAT_WORD(i0,t); - SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - i>>=1; - if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); - } - } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - w = TWO23[sx]+x; - return w-TWO23[sx]; -} -weak_alias (__rintf, rintf) diff --git a/sysdeps/libm-ieee754/s_rintl.c b/sysdeps/libm-ieee754/s_rintl.c deleted file mode 100644 index 4e957d8373..0000000000 --- a/sysdeps/libm-ieee754/s_rintl.c +++ /dev/null @@ -1,96 +0,0 @@ -/* s_rintl.c -- long double version of s_rint.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * rintl(x) - * Return x rounded to integral value according to the prevailing - * rounding mode. - * Method: - * Using floating addition. - * Exception: - * Inexact flag raised if x not equal to rintl(x). - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double -#else -static long double -#endif -TWO63[2]={ - 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */ - -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */ -}; - -#ifdef __STDC__ - long double __rintl(long double x) -#else - long double __rintl(x) - long double x; -#endif -{ - int32_t se,j0,sx; - u_int32_t i,i0,i1; - long double w,t; - GET_LDOUBLE_WORDS(se,i0,i1,x); - sx = (se>>15)&1; - j0 = (se&0x7fff)-0x3fff; - if(j0<31) { - if(j0<0) { - if(((se&0x7fff)|i0|i1)==0) return x; - i1 |= i0; - i0 &= 0xe0000000; - i0 |= (i1|-i1)&0x80000000; - SET_LDOUBLE_MSW(x,i0); - w = TWO63[sx]+x; - t = w-TWO63[sx]; - GET_LDOUBLE_EXP(i0,t); - SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15)); - return t; - } else { - i = (0x7fffffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - i>>=1; - if(((i0&i)|i1)!=0) { - if(j0==31) i1 = 0x40000000; else - i0 = (i0&(~i))|((0x20000000)>>j0); - /* Shouldn't this be - if (j0 >= 30) i1 = 0x80000000 >> (j0 - 30); - i0 = (i0&(~i))|((0x20000000)>>j0); - If yes, this should be correct in s_rint and - s_rintf, too. -- drepper@cygnus.com */ - } - } - } else if (j0>62) { - if(j0==0x4000) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((u_int32_t)(0xffffffff))>>(j0-31); - if((i1&i)==0) return x; /* x is integral */ - i>>=1; - if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31)); - } - SET_LDOUBLE_WORDS(x,se,i0,i1); - w = TWO63[sx]+x; - return w-TWO63[sx]; -} -weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-ieee754/s_round.c b/sysdeps/libm-ieee754/s_round.c deleted file mode 100644 index fdb17f8de8..0000000000 --- a/sysdeps/libm-ieee754/s_round.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Round double to integer away from zero. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -static const double huge = 1.0e300; - - -double -__round (double x) -{ - int32_t i0, j0; - u_int32_t i1; - - EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) - { - if (j0 < 0) - { - if (huge + x > 0.0) - { - i0 &= 0x80000000; - if (j0 == -1) - i0 |= 0x3ff00000; - i1 = 0; - } - } - else - { - u_int32_t i = 0x000fffff >> j0; - if (((i0 & i) | i1) == 0) - /* X is integral. */ - return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - i0 += 0x00080000 >> j0; - i0 &= ~i; - i1 = 0; - } - } - } - else if (j0 > 51) - { - if (j0 == 0x400) - /* Inf or NaN. */ - return x + x; - else - return x; - } - else - { - u_int32_t i = 0xffffffff >> (j0 - 20); - if ((i1 & i) == 0) - /* X is integral. */ - return x; - - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - u_int32_t j = i1 + (1 << (51 - j0)); - if (j < i1) - i0 += 1; - i1 = j; - } - i1 &= ~i; - } - - INSERT_WORDS (x, i0, i1); - return x; -} -weak_alias (__round, round) -#ifdef NO_LONG_DOUBLE -strong_alias (__round, __roundl) -weak_alias (__round, roundl) -#endif diff --git a/sysdeps/libm-ieee754/s_roundf.c b/sysdeps/libm-ieee754/s_roundf.c deleted file mode 100644 index 5dc0e368ff..0000000000 --- a/sysdeps/libm-ieee754/s_roundf.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Round float to integer away from zero. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -static const float huge = 1.0e30; - - -float -__roundf (float x) -{ - int32_t i0, j0; - - GET_FLOAT_WORD (i0, x); - j0 = ((i0 >> 23) & 0xff) - 0x7f; - if (j0 < 23) - { - if (j0 < 0) - { - if (huge + x > 0.0F) - { - i0 &= 0x80000000; - if (j0 == -1) - i0 |= 0x3f800000; - } - } - else - { - u_int32_t i = 0x007fffff >> j0; - if ((i0 & i) == 0) - /* X is integral. */ - return x; - if (huge + x > 0.0F) - { - /* Raise inexact if x != 0. */ - i0 += 0x00400000 >> j0; - i0 &= ~i; - } - } - } - else - { - if (j0 == 0x80) - /* Inf or NaN. */ - return x + x; - else - return x; - } - - SET_FLOAT_WORD (x, i0); - return x; -} -weak_alias (__roundf, roundf) diff --git a/sysdeps/libm-ieee754/s_roundl.c b/sysdeps/libm-ieee754/s_roundl.c deleted file mode 100644 index d7482b9b7c..0000000000 --- a/sysdeps/libm-ieee754/s_roundl.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Round long double to integer away from zero. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -static const long double huge = 1.0e4930; - - -long double -__roundl (long double x) -{ - int32_t j0; - u_int32_t se, i1, i0; - - GET_LDOUBLE_WORDS (se, i0, i1, x); - j0 = (se & 0x7fff) - 0x3fff; - if (j0 < 31) - { - if (j0 < 0) - { - if (huge + x > 0.0) - { - se &= 0x8000; - i0 = i1 = 0; - if (j0 == -1) - { - se |= 0x3fff; - i0 = 0x80000000; - } - } - } - else - { - u_int32_t i = 0x7fffffff >> j0; - if (((i0 & i) | i1) == 0) - /* X is integral. */ - return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - u_int32_t j = i0 + (0x40000000 >> j0); - if (j < i0) - se += 1; - i0 = (j & ~i) | 0x80000000; - i1 = 0; - } - } - } - else if (j0 > 62) - { - if (j0 == 0x4000) - /* Inf or NaN. */ - return x + x; - else - return x; - } - else - { - u_int32_t i = 0xffffffff >> (j0 - 31); - if ((i1 & i) == 0) - /* X is integral. */ - return x; - - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - u_int32_t j = i1 + (1 << (62 - j0)); - if (j < i1) - { - u_int32_t k = i0 + 1; - if (k < i0) - { - se += 1; - k |= 0x80000000; - } - i0 = k; - } - i1 = j; - } - i1 &= ~i; - } - - SET_LDOUBLE_WORDS (x, se, i0, i1); - return x; -} -weak_alias (__roundl, roundl) diff --git a/sysdeps/libm-ieee754/s_scalbln.c b/sysdeps/libm-ieee754/s_scalbln.c deleted file mode 100644 index aa6134f093..0000000000 --- a/sysdeps/libm-ieee754/s_scalbln.c +++ /dev/null @@ -1,70 +0,0 @@ -/* @(#)s_scalbn.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; -#endif - -/* - * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ -twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ -huge = 1.0e+300, -tiny = 1.0e-300; - -#ifdef __STDC__ - double __scalbln (double x, long int n) -#else - double __scalbln (x,n) - double x; long int n; -#endif -{ - int32_t k,hx,lx; - EXTRACT_WORDS(hx,lx,x); - k = (hx&0x7ff00000)>>20; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx,x); - k = ((hx&0x7ff00000)>>20) - 54; - } - if (k==0x7ff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0x7fe) - return huge*__copysign(huge,x); /* overflow */ - if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/ - if (k > 0) /* normal result */ - {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} - if (k <= -54) - return tiny*__copysign(tiny,x); /*underflow*/ - k += 54; /* subnormal result */ - SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); - return x*twom54; -} -weak_alias (__scalbln, scalbln) -#ifdef NO_LONG_DOUBLE -strong_alias (__scalbln, __scalblnl) -weak_alias (__scalbln, scalblnl) -#endif diff --git a/sysdeps/libm-ieee754/s_scalblnf.c b/sysdeps/libm-ieee754/s_scalblnf.c deleted file mode 100644 index 4ed48733cf..0000000000 --- a/sysdeps/libm-ieee754/s_scalblnf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* s_scalbnf.c -- float version of s_scalbn.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -two25 = 3.355443200e+07, /* 0x4c000000 */ -twom25 = 2.9802322388e-08, /* 0x33000000 */ -huge = 1.0e+30, -tiny = 1.0e-30; - -#ifdef __STDC__ - float __scalblnf (float x, long int n) -#else - float __scalblnf (x,n) - float x; long int n; -#endif -{ - int32_t k,ix; - GET_FLOAT_WORD(ix,x); - k = (ix&0x7f800000)>>23; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((ix&0x7fffffff)==0) return x; /* +-0 */ - x *= two25; - GET_FLOAT_WORD(ix,x); - k = ((ix&0x7f800000)>>23) - 25; - } - if (k==0xff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0xfe) - return huge*copysignf(huge,x); /* overflow */ - if (n< -50000) - return tiny*copysignf(tiny,x); /*underflow*/ - if (k > 0) /* normal result */ - {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} - if (k <= -25) - return tiny*copysignf(tiny,x); /*underflow*/ - k += 25; /* subnormal result */ - SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); - return x*twom25; -} -weak_alias (__scalblnf, scalblnf) diff --git a/sysdeps/libm-ieee754/s_scalblnl.c b/sysdeps/libm-ieee754/s_scalblnl.c deleted file mode 100644 index b885fbcadb..0000000000 --- a/sysdeps/libm-ieee754/s_scalblnl.c +++ /dev/null @@ -1,71 +0,0 @@ -/* s_scalbnl.c -- long double version of s_scalbn.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * scalbnl (long double x, int n) - * scalbnl(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double -#else -static long double -#endif -two63 = 4.50359962737049600000e+15, -twom63 = 1.08420217248550443400e-19, -huge = 1.0e+4900L, -tiny = 1.0e-4900L; - -#ifdef __STDC__ - long double __scalblnl (long double x, long int n) -#else - long double __scalblnl (x,n) - long double x; long int n; -#endif -{ - int32_t k,es,hx,lx; - GET_LDOUBLE_WORDS(es,hx,lx,x); - k = es&0x7fff; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two63; - GET_LDOUBLE_EXP(es,x); - k = (hx&0x7fff) - 63; - } - if (k==0x7fff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0x7ffe) - return huge*__copysignl(huge,x); /* overflow */ - if (n< -50000) - return tiny*__copysignl(tiny,x); - if (k > 0) /* normal result */ - {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;} - if (k <= -63) - return tiny*__copysignl(tiny,x); /*underflow*/ - k += 54; /* subnormal result */ - SET_LDOUBLE_EXP(x,(es&0x8000)|k); - return x*twom63; -} -weak_alias (__scalblnl, scalblnl) diff --git a/sysdeps/libm-ieee754/s_scalbn.c b/sysdeps/libm-ieee754/s_scalbn.c deleted file mode 100644 index 3dbfe8fef0..0000000000 --- a/sysdeps/libm-ieee754/s_scalbn.c +++ /dev/null @@ -1,70 +0,0 @@ -/* @(#)s_scalbn.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; -#endif - -/* - * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ -twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ -huge = 1.0e+300, -tiny = 1.0e-300; - -#ifdef __STDC__ - double __scalbn (double x, int n) -#else - double __scalbn (x,n) - double x; int n; -#endif -{ - int32_t k,hx,lx; - EXTRACT_WORDS(hx,lx,x); - k = (hx&0x7ff00000)>>20; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx,x); - k = ((hx&0x7ff00000)>>20) - 54; - } - if (k==0x7ff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0x7fe) - return huge*__copysign(huge,x); /* overflow */ - if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/ - if (k > 0) /* normal result */ - {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} - if (k <= -54) - return tiny*__copysign(tiny,x); /*underflow*/ - k += 54; /* subnormal result */ - SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); - return x*twom54; -} -weak_alias (__scalbn, scalbn) -#ifdef NO_LONG_DOUBLE -strong_alias (__scalbn, __scalbnl) -weak_alias (__scalbn, scalbnl) -#endif diff --git a/sysdeps/libm-ieee754/s_scalbnf.c b/sysdeps/libm-ieee754/s_scalbnf.c deleted file mode 100644 index 11b77bd6c2..0000000000 --- a/sysdeps/libm-ieee754/s_scalbnf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* s_scalbnf.c -- float version of s_scalbn.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -two25 = 3.355443200e+07, /* 0x4c000000 */ -twom25 = 2.9802322388e-08, /* 0x33000000 */ -huge = 1.0e+30, -tiny = 1.0e-30; - -#ifdef __STDC__ - float __scalbnf (float x, int n) -#else - float __scalbnf (x,n) - float x; int n; -#endif -{ - int32_t k,ix; - GET_FLOAT_WORD(ix,x); - k = (ix&0x7f800000)>>23; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((ix&0x7fffffff)==0) return x; /* +-0 */ - x *= two25; - GET_FLOAT_WORD(ix,x); - k = ((ix&0x7f800000)>>23) - 25; - } - if (k==0xff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0xfe) - return huge*copysignf(huge,x); /* overflow */ - if (n< -50000) - return tiny*copysignf(tiny,x); /*underflow*/ - if (k > 0) /* normal result */ - {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} - if (k <= -25) - return tiny*copysignf(tiny,x); /*underflow*/ - k += 25; /* subnormal result */ - SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); - return x*twom25; -} -weak_alias (__scalbnf, scalbnf) diff --git a/sysdeps/libm-ieee754/s_scalbnl.c b/sysdeps/libm-ieee754/s_scalbnl.c deleted file mode 100644 index 32e4fb8cea..0000000000 --- a/sysdeps/libm-ieee754/s_scalbnl.c +++ /dev/null @@ -1,71 +0,0 @@ -/* s_scalbnl.c -- long double version of s_scalbn.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * scalbnl (long double x, int n) - * scalbnl(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double -#else -static long double -#endif -two63 = 4.50359962737049600000e+15, -twom63 = 1.08420217248550443400e-19, -huge = 1.0e+4900L, -tiny = 1.0e-4900L; - -#ifdef __STDC__ - long double __scalbnl (long double x, int n) -#else - long double __scalbnl (x,n) - long double x; int n; -#endif -{ - int32_t k,es,hx,lx; - GET_LDOUBLE_WORDS(es,hx,lx,x); - k = es&0x7fff; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two63; - GET_LDOUBLE_EXP(es,x); - k = (hx&0x7fff) - 63; - } - if (k==0x7fff) return x+x; /* NaN or Inf */ - k = k+n; - if (n> 50000 || k > 0x7ffe) - return huge*__copysignl(huge,x); /* overflow */ - if (n< -50000) - return tiny*__copysignl(tiny,x); - if (k > 0) /* normal result */ - {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;} - if (k <= -63) - return tiny*__copysignl(tiny,x); /*underflow*/ - k += 54; /* subnormal result */ - SET_LDOUBLE_EXP(x,(es&0x8000)|k); - return x*twom63; -} -weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/libm-ieee754/s_signbit.c b/sysdeps/libm-ieee754/s_signbit.c deleted file mode 100644 index ee340035fb..0000000000 --- a/sysdeps/libm-ieee754/s_signbit.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Return nonzero value if number is negative. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -int -__signbit (double x) -{ - int32_t hx; - - GET_HIGH_WORD (hx, x); - return hx & 0x80000000; -} diff --git a/sysdeps/libm-ieee754/s_signbitf.c b/sysdeps/libm-ieee754/s_signbitf.c deleted file mode 100644 index 85418ea73f..0000000000 --- a/sysdeps/libm-ieee754/s_signbitf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Return nonzero value if number is negative. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -int -__signbitf (float x) -{ - int32_t hx; - - GET_FLOAT_WORD (hx, x); - return hx & 0x80000000; -} diff --git a/sysdeps/libm-ieee754/s_signbitl.c b/sysdeps/libm-ieee754/s_signbitl.c deleted file mode 100644 index b12fdefff4..0000000000 --- a/sysdeps/libm-ieee754/s_signbitl.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Return nonzero value if number is negative. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - -int -__signbitl (long double x) -{ - int32_t e; - - GET_LDOUBLE_EXP (e, x); - return e & 0x8000; -} diff --git a/sysdeps/libm-ieee754/s_signgam.c b/sysdeps/libm-ieee754/s_signgam.c deleted file mode 100644 index 021b0ffca1..0000000000 --- a/sysdeps/libm-ieee754/s_signgam.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "math.h" -#include "math_private.h" -int signgam; diff --git a/sysdeps/libm-ieee754/s_significand.c b/sysdeps/libm-ieee754/s_significand.c deleted file mode 100644 index 4ab078c473..0000000000 --- a/sysdeps/libm-ieee754/s_significand.c +++ /dev/null @@ -1,39 +0,0 @@ -/* @(#)s_signif.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Exp $"; -#endif - -/* - * significand(x) computes just - * scalb(x, (double) -ilogb(x)), - * for exercising the fraction-part(F) IEEE 754-1985 test vector. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __significand(double x) -#else - double __significand(x) - double x; -#endif -{ - return __ieee754_scalb(x,(double) -ilogb(x)); -} -weak_alias (__significand, significand) -#ifdef NO_LONG_DOUBLE -strong_alias (__significand, __significandl) -weak_alias (__significand, significandl) -#endif diff --git a/sysdeps/libm-ieee754/s_significandf.c b/sysdeps/libm-ieee754/s_significandf.c deleted file mode 100644 index 2893a4e1b7..0000000000 --- a/sysdeps/libm-ieee754/s_significandf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* s_significandf.c -- float version of s_significand.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __significandf(float x) -#else - float __significandf(x) - float x; -#endif -{ - return __ieee754_scalbf(x,(float) -ilogbf(x)); -} -weak_alias (__significandf, significandf) diff --git a/sysdeps/libm-ieee754/s_significandl.c b/sysdeps/libm-ieee754/s_significandl.c deleted file mode 100644 index 6339274b5a..0000000000 --- a/sysdeps/libm-ieee754/s_significandl.c +++ /dev/null @@ -1,39 +0,0 @@ -/* s_significandl.c -- long double version of s_significand.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * significandl(x) computes just - * scalbl(x, (double) -ilogbl(x)), - * for exercising the fraction-part(F) IEEE 754-1985 test vector. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __significandl(long double x) -#else - long double __significandl(x) - long double x; -#endif -{ - return __ieee754_scalbl(x,(double) -ilogbl(x)); -} -weak_alias (__significandl, significandl) diff --git a/sysdeps/libm-ieee754/s_sin.c b/sysdeps/libm-ieee754/s_sin.c deleted file mode 100644 index 376c69ed00..0000000000 --- a/sysdeps/libm-ieee754/s_sin.c +++ /dev/null @@ -1,87 +0,0 @@ -/* @(#)s_sin.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; -#endif - -/* sin(x) - * Return sine function of x. - * - * kernel function: - * __kernel_sin ... sine function on [-pi/4,pi/4] - * __kernel_cos ... cose function on [-pi/4,pi/4] - * __ieee754_rem_pio2 ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __sin(double x) -#else - double __sin(x) - double x; -#endif -{ - double y[2],z=0.0; - int32_t n, ix; - - /* High word of x. */ - GET_HIGH_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7ff00000) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x,y); - switch(n&3) { - case 0: return __kernel_sin(y[0],y[1],1); - case 1: return __kernel_cos(y[0],y[1]); - case 2: return -__kernel_sin(y[0],y[1],1); - default: - return -__kernel_cos(y[0],y[1]); - } - } -} -weak_alias (__sin, sin) -#ifdef NO_LONG_DOUBLE -strong_alias (__sin, __sinl) -weak_alias (__sin, sinl) -#endif diff --git a/sysdeps/libm-ieee754/s_sincos.c b/sysdeps/libm-ieee754/s_sincos.c deleted file mode 100644 index 5bc564ba5b..0000000000 --- a/sysdeps/libm-ieee754/s_sincos.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -void -__sincos (double x, double *sinx, double *cosx) -{ - int32_t ix; - - /* High word of x. */ - GET_HIGH_WORD (ix, x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - { - *sinx = __kernel_sin (x, 0.0, 0); - *cosx = __kernel_cos (x, 0.0); - } - else if (ix>=0x7ff00000) - { - /* sin(Inf or NaN) is NaN */ - *sinx = *cosx = x - x; - } - else - { - /* Argument reduction needed. */ - double y[2]; - int n; - - n = __ieee754_rem_pio2 (x, y); - switch (n & 3) - { - case 0: - *sinx = __kernel_sin (y[0], y[1], 1); - *cosx = __kernel_cos (y[0], y[1]); - break; - case 1: - *sinx = __kernel_cos (y[0], y[1]); - *cosx = -__kernel_sin (y[0], y[1], 1); - break; - case 2: - *sinx = -__kernel_sin (y[0], y[1], 1); - *cosx = -__kernel_cos (y[0], y[1]); - break; - default: - *sinx = -__kernel_cos (y[0], y[1]); - *cosx = __kernel_sin (y[0], y[1], 1); - break; - } - } -} -weak_alias (__sincos, sincos) -#ifdef NO_LONG_DOUBLE -strong_alias (__sincos, __sincosl) -weak_alias (__sincos, sincosl) -#endif diff --git a/sysdeps/libm-ieee754/s_sincosf.c b/sysdeps/libm-ieee754/s_sincosf.c deleted file mode 100644 index 0fd7b0ca8b..0000000000 --- a/sysdeps/libm-ieee754/s_sincosf.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -void -__sincosf (float x, float *sinx, float *cosx) -{ - int32_t ix; - - /* High word of x. */ - GET_FLOAT_WORD (ix, x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3f490fd8) - { - *sinx = __kernel_sinf (x, 0.0, 0); - *cosx = __kernel_cosf (x, 0.0); - } - else if (ix>=0x7ff00000) - { - /* sin(Inf or NaN) is NaN */ - *sinx = *cosx = x - x; - } - else - { - /* Argument reduction needed. */ - float y[2]; - int n; - - n = __ieee754_rem_pio2f (x, y); - switch (n & 3) - { - case 0: - *sinx = __kernel_sinf (y[0], y[1], 1); - *cosx = __kernel_cosf (y[0], y[1]); - break; - case 1: - *sinx = __kernel_cosf (y[0], y[1]); - *cosx = -__kernel_sinf (y[0], y[1], 1); - break; - case 2: - *sinx = -__kernel_sinf (y[0], y[1], 1); - *cosx = -__kernel_cosf (y[0], y[1]); - break; - default: - *sinx = -__kernel_cosf (y[0], y[1]); - *cosx = __kernel_sinf (y[0], y[1], 1); - break; - } - } -} -weak_alias (__sincosf, sincosf) diff --git a/sysdeps/libm-ieee754/s_sincosl.c b/sysdeps/libm-ieee754/s_sincosl.c deleted file mode 100644 index 78c78d5619..0000000000 --- a/sysdeps/libm-ieee754/s_sincosl.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -void -__sincosl (long double x, long double *sinx, long double *cosx) -{ - int32_t se, i0, i1; - - /* High word of x. */ - GET_LDOUBLE_WORDS (se, i0, i1, x); - - /* |x| ~< pi/4 */ - se &= 0x7fff; - if (se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2)) - { - *sinx = __kernel_sinl (x, 0.0, 0); - *cosx = __kernel_cosl (x, 0.0); - } - else if (se == 0x7fff) - { - /* sin(Inf or NaN) is NaN */ - *sinx = *cosx = x - x; - } - else - { - /* Argument reduction needed. */ - long double y[2]; - int n; - - n = __ieee754_rem_pio2l (x, y); - switch (n & 3) - { - case 0: - *sinx = __kernel_sinl (y[0], y[1], 1); - *cosx = __kernel_cosl (y[0], y[1]); - break; - case 1: - *sinx = __kernel_cosl (y[0], y[1]); - *cosx = -__kernel_sinl (y[0], y[1], 1); - break; - case 2: - *sinx = -__kernel_sinl (y[0], y[1], 1); - *cosx = -__kernel_cosl (y[0], y[1]); - break; - default: - *sinx = -__kernel_cosl (y[0], y[1]); - *cosx = __kernel_sinl (y[0], y[1], 1); - break; - } - } -} -weak_alias (__sincosl, sincosl) diff --git a/sysdeps/libm-ieee754/s_sinf.c b/sysdeps/libm-ieee754/s_sinf.c deleted file mode 100644 index 76a7c21fcb..0000000000 --- a/sysdeps/libm-ieee754/s_sinf.c +++ /dev/null @@ -1,54 +0,0 @@ -/* s_sinf.c -- float version of s_sin.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __sinf(float x) -#else - float __sinf(x) - float x; -#endif -{ - float y[2],z=0.0; - int32_t n, ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2f(x,y); - switch(n&3) { - case 0: return __kernel_sinf(y[0],y[1],1); - case 1: return __kernel_cosf(y[0],y[1]); - case 2: return -__kernel_sinf(y[0],y[1],1); - default: - return -__kernel_cosf(y[0],y[1]); - } - } -} -weak_alias (__sinf, sinf) diff --git a/sysdeps/libm-ieee754/s_sinl.c b/sysdeps/libm-ieee754/s_sinl.c deleted file mode 100644 index 4fd48805b4..0000000000 --- a/sysdeps/libm-ieee754/s_sinl.c +++ /dev/null @@ -1,88 +0,0 @@ -/* s_sinl.c -- long double version of s_sin.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* sinl(x) - * Return sine function of x. - * - * kernel function: - * __kernel_sinl ... sine function on [-pi/4,pi/4] - * __kernel_cosl ... cose function on [-pi/4,pi/4] - * __ieee754_rem_pio2l ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __sinl(long double x) -#else - long double __sinl(x) - long double x; -#endif -{ - long double y[2],z=0.0; - int32_t n, se, i0, i1; - - /* High word of x. */ - GET_LDOUBLE_WORDS(se,i0,i1,x); - - /* |x| ~< pi/4 */ - se &= 0x7fff; - if(se < 0x3ffe || (se == 0x3ffe && i0 <= 0xc90fdaa2)) - return __kernel_sinl(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (se==0x7fff) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2l(x,y); - switch(n&3) { - case 0: return __kernel_sinl(y[0],y[1],1); - case 1: return __kernel_cosl(y[0],y[1]); - case 2: return -__kernel_sinl(y[0],y[1],1); - default: - return -__kernel_cosl(y[0],y[1]); - } - } -} -weak_alias (__sinl, sinl) diff --git a/sysdeps/libm-ieee754/s_tan.c b/sysdeps/libm-ieee754/s_tan.c deleted file mode 100644 index 714cf27dd2..0000000000 --- a/sysdeps/libm-ieee754/s_tan.c +++ /dev/null @@ -1,81 +0,0 @@ -/* @(#)s_tan.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_tan.c,v 1.7 1995/05/10 20:48:18 jtc Exp $"; -#endif - -/* tan(x) - * Return tangent function of x. - * - * kernel function: - * __kernel_tan ... tangent function on [-pi/4,pi/4] - * __ieee754_rem_pio2 ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __tan(double x) -#else - double __tan(x) - double x; -#endif -{ - double y[2],z=0.0; - int32_t n, ix; - - /* High word of x. */ - GET_HIGH_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1); - - /* tan(Inf or NaN) is NaN */ - else if (ix>=0x7ff00000) return x-x; /* NaN */ - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x,y); - return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even - -1 -- n odd */ - } -} -weak_alias (__tan, tan) -#ifdef NO_LONG_DOUBLE -strong_alias (__tan, __tanl) -weak_alias (__tan, tanl) -#endif diff --git a/sysdeps/libm-ieee754/s_tanf.c b/sysdeps/libm-ieee754/s_tanf.c deleted file mode 100644 index e8f6016c32..0000000000 --- a/sysdeps/libm-ieee754/s_tanf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* s_tanf.c -- float version of s_tan.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __tanf(float x) -#else - float __tanf(x) - float x; -#endif -{ - float y[2],z=0.0; - int32_t n, ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1); - - /* tan(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; /* NaN */ - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2f(x,y); - return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even - -1 -- n odd */ - } -} -weak_alias (__tanf, tanf) diff --git a/sysdeps/libm-ieee754/s_tanh.c b/sysdeps/libm-ieee754/s_tanh.c deleted file mode 100644 index 944f96386f..0000000000 --- a/sysdeps/libm-ieee754/s_tanh.c +++ /dev/null @@ -1,93 +0,0 @@ -/* @(#)s_tanh.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $"; -#endif - -/* Tanh(x) - * Return the Hyperbolic Tangent of x - * - * Method : - * x -x - * e - e - * 0. tanh(x) is defined to be ----------- - * x -x - * e + e - * 1. reduce x to non-negative by tanh(-x) = -tanh(x). - * 2. 0 <= x <= 2**-55 : tanh(x) := x*(one+x) - * -t - * 2**-55 < x <= 1 : tanh(x) := -----; t = expm1(-2x) - * t + 2 - * 2 - * 1 <= x <= 22.0 : tanh(x) := 1- ----- ; t=expm1(2x) - * t + 2 - * 22.0 < x <= INF : tanh(x) := 1. - * - * Special cases: - * tanh(NaN) is NaN; - * only tanh(0)=0 is exact for finite argument. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double one=1.0, two=2.0, tiny = 1.0e-300; -#else -static double one=1.0, two=2.0, tiny = 1.0e-300; -#endif - -#ifdef __STDC__ - double __tanh(double x) -#else - double __tanh(x) - double x; -#endif -{ - double t,z; - int32_t jx,ix,lx; - - /* High word of |x|. */ - EXTRACT_WORDS(jx,lx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7ff00000) { - if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ - else return one/x-one; /* tanh(NaN) = NaN */ - } - - /* |x| < 22 */ - if (ix < 0x40360000) { /* |x|<22 */ - if ((ix | lx) == 0) - return x; /* x == +-0 */ - if (ix<0x3c800000) /* |x|<2**-55 */ - return x*(one+x); /* tanh(small) = small */ - if (ix>=0x3ff00000) { /* |x|>=1 */ - t = __expm1(two*fabs(x)); - z = one - two/(t+two); - } else { - t = __expm1(-two*fabs(x)); - z= -t/(t+two); - } - /* |x| > 22, return +-1 */ - } else { - z = one - tiny; /* raised inexact flag */ - } - return (jx>=0)? z: -z; -} -weak_alias (__tanh, tanh) -#ifdef NO_LONG_DOUBLE -strong_alias (__tanh, __tanhl) -weak_alias (__tanh, tanhl) -#endif diff --git a/sysdeps/libm-ieee754/s_tanhf.c b/sysdeps/libm-ieee754/s_tanhf.c deleted file mode 100644 index 2a0ca9f3df..0000000000 --- a/sysdeps/libm-ieee754/s_tanhf.c +++ /dev/null @@ -1,67 +0,0 @@ -/* s_tanhf.c -- float version of s_tanh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_tanhf.c,v 1.4 1995/05/10 20:48:24 jtc Exp $"; -#endif - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float one=1.0, two=2.0, tiny = 1.0e-30; -#else -static float one=1.0, two=2.0, tiny = 1.0e-30; -#endif - -#ifdef __STDC__ - float __tanhf(float x) -#else - float __tanhf(x) - float x; -#endif -{ - float t,z; - int32_t jx,ix; - - GET_FLOAT_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7f800000) { - if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ - else return one/x-one; /* tanh(NaN) = NaN */ - } - - /* |x| < 22 */ - if (ix < 0x41b00000) { /* |x|<22 */ - if (ix == 0) - return x; /* x == +-0 */ - if (ix<0x24000000) /* |x|<2**-55 */ - return x*(one+x); /* tanh(small) = small */ - if (ix>=0x3f800000) { /* |x|>=1 */ - t = __expm1f(two*fabsf(x)); - z = one - two/(t+two); - } else { - t = __expm1f(-two*fabsf(x)); - z= -t/(t+two); - } - /* |x| > 22, return +-1 */ - } else { - z = one - tiny; /* raised inexact flag */ - } - return (jx>=0)? z: -z; -} -weak_alias (__tanhf, tanhf) diff --git a/sysdeps/libm-ieee754/s_tanhl.c b/sysdeps/libm-ieee754/s_tanhl.c deleted file mode 100644 index 1e3dc3b613..0000000000 --- a/sysdeps/libm-ieee754/s_tanhl.c +++ /dev/null @@ -1,95 +0,0 @@ -/* s_tanhl.c -- long double version of s_tanh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* tanhl(x) - * Return the Hyperbolic Tangent of x - * - * Method : - * x -x - * e - e - * 0. tanhl(x) is defined to be ----------- - * x -x - * e + e - * 1. reduce x to non-negative by tanhl(-x) = -tanhl(x). - * 2. 0 <= x <= 2**-55 : tanhl(x) := x*(one+x) - * -t - * 2**-55 < x <= 1 : tanhl(x) := -----; t = expm1l(-2x) - * t + 2 - * 2 - * 1 <= x <= 23.0 : tanhl(x) := 1- ----- ; t=expm1l(2x) - * t + 2 - * 23.0 < x <= INF : tanhl(x) := 1. - * - * Special cases: - * tanhl(NaN) is NaN; - * only tanhl(0)=0 is exact for finite argument. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const long double one=1.0, two=2.0, tiny = 1.0e-4900L; -#else -static long double one=1.0, two=2.0, tiny = 1.0e-4900L; -#endif - -#ifdef __STDC__ - long double __tanhl(long double x) -#else - long double __tanhl(x) - long double x; -#endif -{ - long double t,z; - int32_t se; - u_int32_t j0,j1,ix; - - /* High word of |x|. */ - GET_LDOUBLE_WORDS(se,j0,j1,x); - ix = se&0x7fff; - - /* x is INF or NaN */ - if(ix==0x7fff) { - /* for NaN it's not important which branch: tanhl(NaN) = NaN */ - if (se&0x8000) return one/x-one; /* tanhl(-inf)= -1; */ - else return one/x+one; /* tanhl(+inf)=+1 */ - } - - /* |x| < 23 */ - if (ix < 0x4003 || (ix == 0x4003 && j0 < 0xb8000000u)) {/* |x|<23 */ - if ((ix|j0|j1) == 0) - return x; /* x == +- 0 */ - if (ix<0x3fc8) /* |x|<2**-55 */ - return x*(one+x); /* tanh(small) = small */ - if (ix>=0x3fff) { /* |x|>=1 */ - t = __expm1l(two*fabsl(x)); - z = one - two/(t+two); - } else { - t = __expm1l(-two*fabsl(x)); - z= -t/(t+two); - } - /* |x| > 23, return +-1 */ - } else { - z = one - tiny; /* raised inexact flag */ - } - return (se>0x7fff)? -z: z; -} -weak_alias (__tanhl, tanhl) diff --git a/sysdeps/libm-ieee754/s_tanl.c b/sysdeps/libm-ieee754/s_tanl.c deleted file mode 100644 index 97a0b27f32..0000000000 --- a/sysdeps/libm-ieee754/s_tanl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* s_tanl.c -- long double version of s_tan.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* tanl(x) - * Return tangent function of x. - * - * kernel function: - * __kernel_tanl ... tangent function on [-pi/4,pi/4] - * __ieee754_rem_pio2l ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __tanl(long double x) -#else - long double __tanl(x) - long double x; -#endif -{ - long double y[2],z=0.0; - int32_t n, se; - - /* High word of x. */ - GET_LDOUBLE_EXP(se,x); - - /* |x| ~< pi/4 */ - se &= 0x7fff; - if(se <= 0x3ffe) return __kernel_tanl(x,z,1); - - /* tan(Inf or NaN) is NaN */ - else if (se==0x7fff) return x-x; /* NaN */ - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2l(x,y); - return __kernel_tanl(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even - -1 -- n odd */ - } -} -weak_alias (__tanl, tanl) diff --git a/sysdeps/libm-ieee754/s_trunc.c b/sysdeps/libm-ieee754/s_trunc.c deleted file mode 100644 index 07b4951bcb..0000000000 --- a/sysdeps/libm-ieee754/s_trunc.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Truncate argument to nearest integral value not larger than the argument. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -double -__trunc (double x) -{ - int32_t i0, j0; - u_int32_t i1; - int sx; - - EXTRACT_WORDS (i0, i1, x); - sx = i0 & 0x80000000; - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) - { - if (j0 < 0) - /* The magnitude of the number is < 1 so the result is +-0. */ - INSERT_WORDS (x, sx, 0); - else - INSERT_WORDS (x, sx | (i0 & ~(0x000fffff >> j0)), 0); - } - else if (j0 > 51) - { - if (j0 == 0x400) - /* x is inf or NaN. */ - return x + x; - } - else - { - INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (j0 - 20))); - } - - return x; -} -weak_alias (__trunc, trunc) -#ifdef NO_LONG_DOUBLE -strong_alias (__trunc, __truncl) -weak_alias (__trunc, truncl) -#endif diff --git a/sysdeps/libm-ieee754/s_truncf.c b/sysdeps/libm-ieee754/s_truncf.c deleted file mode 100644 index feb6b6f23a..0000000000 --- a/sysdeps/libm-ieee754/s_truncf.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Truncate argument to nearest integral value not larger than the argument. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -float -__truncf (float x) -{ - int32_t i0, j0; - int sx; - - GET_FLOAT_WORD (i0, x); - sx = i0 & 0x80000000; - j0 = ((i0 >> 23) & 0xff) - 0x7f; - if (j0 < 23) - { - if (j0 < 0) - /* The magnitude of the number is < 1 so the result is +-0. */ - SET_FLOAT_WORD (x, sx); - else - SET_FLOAT_WORD (x, sx | (i0 & ~(0x007fffff >> j0))); - } - else - { - if (j0 == 0x80) - /* x is inf or NaN. */ - return x + x; - } - - return x; -} -weak_alias (__truncf, truncf) diff --git a/sysdeps/libm-ieee754/s_truncl.c b/sysdeps/libm-ieee754/s_truncl.c deleted file mode 100644 index 59c3b9c173..0000000000 --- a/sysdeps/libm-ieee754/s_truncl.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Truncate argument to nearest integral value not larger than the argument. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#include "math_private.h" - - -long double -__truncl (long double x) -{ - int32_t i0, j0; - u_int32_t se, i1; - int sx; - - GET_LDOUBLE_WORDS (se, i0, i1, x); - sx = se & 0x8000; - j0 = (se & 0x7fff) - 0x3fff; - if (j0 < 31) - { - if (j0 < 0) - /* The magnitude of the number is < 1 so the result is +-0. */ - SET_LDOUBLE_WORDS (x, sx, 0, 0); - else - SET_LDOUBLE_WORDS (x, se, i0 & ~(0x7fffffff >> j0), 0); - } - else if (j0 > 63) - { - if (j0 == 0x4000) - /* x is inf or NaN. */ - return x + x; - } - else - { - SET_LDOUBLE_WORDS (x, se, i0, i1 & ~(0xffffffffu >> (j0 - 31))); - } - - return x; -} -weak_alias (__truncl, truncl) diff --git a/sysdeps/libm-ieee754/t_exp.c b/sysdeps/libm-ieee754/t_exp.c deleted file mode 100644 index b02b4f55ca..0000000000 --- a/sysdeps/libm-ieee754/t_exp.c +++ /dev/null @@ -1,436 +0,0 @@ -/* Accurate tables for exp(). - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Geoffrey Keating - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This table has the property that, for all integers -177 <= i <= 177, - exp(i/512.0 + __exp_deltatable[abs(i)]) == __exp_atable[i+177] + r - for some -2^-64 < r < 2^-64 (abs(r) < 2^-65 if i <= 0); and that - __exp_deltatable[abs(i)] == t * 2^-60 - for integer t so that abs(t) <= 8847927 * 2^8. */ - -#define W52 (2.22044605e-16) -#define W55 (2.77555756e-17) -#define W58 (3.46944695e-18) -#define W59 (1.73472348e-18) -#define W60 (8.67361738e-19) -const float __exp_deltatable[178] = { - 0*W60, 16558714*W60, -10672149*W59, 1441652*W60, - -15787963*W55, 462888*W60, 7291806*W60, 1698880*W60, - -14375103*W58, -2021016*W60, 728829*W60, -3759654*W60, - 3202123*W60, -10916019*W58, -251570*W60, -1043086*W60, - 8207536*W60, -409964*W60, -5993931*W60, -475500*W60, - 2237522*W60, 324170*W60, -244117*W60, 32077*W60, - 123907*W60, -1019734*W60, -143*W60, 813077*W60, - 743345*W60, 462461*W60, 629794*W60, 2125066*W60, - -2339121*W60, -337951*W60, 9922067*W60, -648704*W60, - 149407*W60, -2687209*W60, -631608*W60, 2128280*W60, - -4882082*W60, 2001360*W60, 175074*W60, 2923216*W60, - -538947*W60, -1212193*W60, -1920926*W60, -1080577*W60, - 3690196*W60, 2643367*W60, 2911937*W60, 671455*W60, - -1128674*W60, 593282*W60, -5219347*W60, -1941490*W60, - 11007953*W60, 239609*W60, -2969658*W60, -1183650*W60, - 942998*W60, 699063*W60, 450569*W60, -329250*W60, - -7257875*W60, -312436*W60, 51626*W60, 555877*W60, - -641761*W60, 1565666*W60, 884327*W60, -10960035*W60, - -2004679*W60, -995793*W60, -2229051*W60, -146179*W60, - -510327*W60, 1453482*W60, -3778852*W60, -2238056*W60, - -4895983*W60, 3398883*W60, -252738*W60, 1230155*W60, - 346918*W60, 1109352*W60, 268941*W60, -2930483*W60, - -1036263*W60, -1159280*W60, 1328176*W60, 2937642*W60, - -9371420*W60, -6902650*W60, -1419134*W60, 1442904*W60, - -1319056*W60, -16369*W60, 696555*W60, -279987*W60, - -7919763*W60, 252741*W60, 459711*W60, -1709645*W60, - 354913*W60, 6025867*W60, -421460*W60, -853103*W60, - -338649*W60, 962151*W60, 955965*W60, 784419*W60, - -3633653*W60, 2277133*W60, -8847927*W52, 1223028*W60, - 5907079*W60, 623167*W60, 5142888*W60, 2599099*W60, - 1214280*W60, 4870359*W60, 593349*W60, -57705*W60, - 7761209*W60, -5564097*W60, 2051261*W60, 6216869*W60, - 4692163*W60, 601691*W60, -5264906*W60, 1077872*W60, - -3205949*W60, 1833082*W60, 2081746*W60, -987363*W60, - -1049535*W60, 2015244*W60, 874230*W60, 2168259*W60, - -1740124*W60, -10068269*W60, -18242*W60, -3013583*W60, - 580601*W60, -2547161*W60, -535689*W60, 2220815*W60, - 1285067*W60, 2806933*W60, -983086*W60, -1729097*W60, - -1162985*W60, -2561904*W60, 801988*W60, 244351*W60, - 1441893*W60, -7517981*W60, 271781*W60, -15021588*W60, - -2341588*W60, -919198*W60, 1642232*W60, 4771771*W60, - -1220099*W60, -3062372*W60, 628624*W60, 1278114*W60, - 13083513*W60, -10521925*W60, 3180310*W60, -1659307*W60, - 3543773*W60, 2501203*W60, 4151*W60, -340748*W60, - -2285625*W60, 2495202*W60 -}; - -const double __exp_atable[355] /* __attribute__((mode(DF))) */ = { - 0.707722561055888932371, /* 0x0.b52d4e46605c27ffd */ - 0.709106182438804188967, /* 0x0.b587fb96f75097ffb */ - 0.710492508843861281234, /* 0x0.b5e2d649899167ffd */ - 0.711881545564593931623, /* 0x0.b63dde74d36bdfffe */ - 0.713273297897442870573, /* 0x0.b699142f945f87ffc */ - 0.714667771153751463236, /* 0x0.b6f477909c4ea0001 */ - 0.716064970655995725059, /* 0x0.b75008aec758f8004 */ - 0.717464901723956938193, /* 0x0.b7abc7a0eea7e0002 */ - 0.718867569715736398602, /* 0x0.b807b47e1586c7ff8 */ - 0.720272979947266023271, /* 0x0.b863cf5d10e380003 */ - 0.721681137825144314297, /* 0x0.b8c01855195c37ffb */ - 0.723092048691992950199, /* 0x0.b91c8f7d213740004 */ - 0.724505717938892290800, /* 0x0.b97934ec5002d0007 */ - 0.725922150953176470431, /* 0x0.b9d608b9c92ea7ffc */ - 0.727341353138962865022, /* 0x0.ba330afcc29e98003 */ - 0.728763329918453162104, /* 0x0.ba903bcc8618b7ffc */ - 0.730188086709957051568, /* 0x0.baed9b40591ba0000 */ - 0.731615628948127705309, /* 0x0.bb4b296f931e30002 */ - 0.733045962086486091436, /* 0x0.bba8e671a05617ff9 */ - 0.734479091556371366251, /* 0x0.bc06d25dd49568001 */ - 0.735915022857225542529, /* 0x0.bc64ed4bce8f6fff9 */ - 0.737353761441304711410, /* 0x0.bcc33752f915d7ff9 */ - 0.738795312814142124419, /* 0x0.bd21b08af98e78005 */ - 0.740239682467211168593, /* 0x0.bd80590b65e9a8000 */ - 0.741686875913991849885, /* 0x0.bddf30ebec4a10000 */ - 0.743136898669507939299, /* 0x0.be3e38443c84e0007 */ - 0.744589756269486091620, /* 0x0.be9d6f2c1d32a0002 */ - 0.746045454254026796384, /* 0x0.befcd5bb59baf8004 */ - 0.747503998175051087583, /* 0x0.bf5c6c09ca84c0003 */ - 0.748965393601880857739, /* 0x0.bfbc322f5b18b7ff8 */ - 0.750429646104262104698, /* 0x0.c01c2843f776fffff */ - 0.751896761271877989160, /* 0x0.c07c4e5fa18b88002 */ - 0.753366744698445112140, /* 0x0.c0dca49a5fb18fffd */ - 0.754839601988627206827, /* 0x0.c13d2b0c444db0005 */ - 0.756315338768691947122, /* 0x0.c19de1cd798578006 */ - 0.757793960659406629066, /* 0x0.c1fec8f623723fffd */ - 0.759275473314173443536, /* 0x0.c25fe09e8a0f47ff8 */ - 0.760759882363831851927, /* 0x0.c2c128dedc88f8000 */ - 0.762247193485956486805, /* 0x0.c322a1cf7d6e7fffa */ - 0.763737412354726363781, /* 0x0.c3844b88cb9347ffc */ - 0.765230544649828092739, /* 0x0.c3e626232bd8f7ffc */ - 0.766726596071518051729, /* 0x0.c44831b719bf18002 */ - 0.768225572321911687194, /* 0x0.c4aa6e5d12d078001 */ - 0.769727479119219348810, /* 0x0.c50cdc2da64a37ffb */ - 0.771232322196981678892, /* 0x0.c56f7b41744490001 */ - 0.772740107296721268087, /* 0x0.c5d24bb1259e70004 */ - 0.774250840160724651565, /* 0x0.c6354d95640dd0007 */ - 0.775764526565368872643, /* 0x0.c6988106fec447fff */ - 0.777281172269557396602, /* 0x0.c6fbe61eb1bd0ffff */ - 0.778800783068235302750, /* 0x0.c75f7cf560942fffc */ - 0.780323364758801041312, /* 0x0.c7c345a3f1983fffe */ - 0.781848923151573727006, /* 0x0.c8274043594cb0002 */ - 0.783377464064598849602, /* 0x0.c88b6cec94b3b7ff9 */ - 0.784908993312207869935, /* 0x0.c8efcbb89cba27ffe */ - 0.786443516765346961618, /* 0x0.c9545cc0a88c70003 */ - 0.787981040257604625744, /* 0x0.c9b9201dc643bfffa */ - 0.789521569657452682047, /* 0x0.ca1e15e92a5410007 */ - 0.791065110849462849192, /* 0x0.ca833e3c1ae510005 */ - 0.792611669712891875319, /* 0x0.cae8992fd84667ffd */ - 0.794161252150049179450, /* 0x0.cb4e26ddbc207fff8 */ - 0.795713864077794763584, /* 0x0.cbb3e75f301b60003 */ - 0.797269511407239561694, /* 0x0.cc19dacd978cd8002 */ - 0.798828200086368567220, /* 0x0.cc8001427e55d7ffb */ - 0.800389937624300440456, /* 0x0.cce65ade24d360006 */ - 0.801954725261124767840, /* 0x0.cd4ce7a5de839fffb */ - 0.803522573691593189330, /* 0x0.cdb3a7c79a678fffd */ - 0.805093487311204114563, /* 0x0.ce1a9b563965ffffc */ - 0.806667472122675088819, /* 0x0.ce81c26b838db8000 */ - 0.808244534127439906441, /* 0x0.cee91d213f8428002 */ - 0.809824679342317166307, /* 0x0.cf50ab9144d92fff9 */ - 0.811407913793616542005, /* 0x0.cfb86dd5758c2ffff */ - 0.812994243520784198882, /* 0x0.d0206407c20e20005 */ - 0.814583674571603966162, /* 0x0.d0888e4223facfff9 */ - 0.816176213022088536960, /* 0x0.d0f0ec9eb3f7c8002 */ - 0.817771864936188586101, /* 0x0.d1597f377d6768002 */ - 0.819370636400374108252, /* 0x0.d1c24626a46eafff8 */ - 0.820972533518165570298, /* 0x0.d22b41865ff1e7ff9 */ - 0.822577562404315121269, /* 0x0.d2947170f32ec7ff9 */ - 0.824185729164559344159, /* 0x0.d2fdd60097795fff8 */ - 0.825797039949601741075, /* 0x0.d3676f4fb796d0001 */ - 0.827411500902565544264, /* 0x0.d3d13d78b5f68fffb */ - 0.829029118181348834154, /* 0x0.d43b40960546d8001 */ - 0.830649897953322891022, /* 0x0.d4a578c222a058000 */ - 0.832273846408250750368, /* 0x0.d50fe617a3ba78005 */ - 0.833900969738858188772, /* 0x0.d57a88b1218e90002 */ - 0.835531274148056613016, /* 0x0.d5e560a94048f8006 */ - 0.837164765846411529371, /* 0x0.d6506e1aac8078003 */ - 0.838801451086016225394, /* 0x0.d6bbb1204074e0001 */ - 0.840441336100884561780, /* 0x0.d72729d4c28518004 */ - 0.842084427144139224814, /* 0x0.d792d8530e12b0001 */ - 0.843730730487052604790, /* 0x0.d7febcb61273e7fff */ - 0.845380252404570153833, /* 0x0.d86ad718c308dfff9 */ - 0.847032999194574087728, /* 0x0.d8d727962c69d7fff */ - 0.848688977161248581090, /* 0x0.d943ae49621ce7ffb */ - 0.850348192619261200615, /* 0x0.d9b06b4d832ef8005 */ - 0.852010651900976245816, /* 0x0.da1d5ebdc22220005 */ - 0.853676361342631029337, /* 0x0.da8a88b555baa0006 */ - 0.855345327311054837175, /* 0x0.daf7e94f965f98004 */ - 0.857017556155879489641, /* 0x0.db6580a7c98f7fff8 */ - 0.858693054267390953857, /* 0x0.dbd34ed9617befff8 */ - 0.860371828028939855647, /* 0x0.dc4153ffc8b65fff9 */ - 0.862053883854957292436, /* 0x0.dcaf90368bfca8004 */ - 0.863739228154875360306, /* 0x0.dd1e0399328d87ffe */ - 0.865427867361348468455, /* 0x0.dd8cae435d303fff9 */ - 0.867119807911702289458, /* 0x0.ddfb9050b1cee8006 */ - 0.868815056264353846599, /* 0x0.de6aa9dced8448001 */ - 0.870513618890481399881, /* 0x0.ded9fb03db7320006 */ - 0.872215502247877139094, /* 0x0.df4983e1380657ff8 */ - 0.873920712852848668986, /* 0x0.dfb94490ffff77ffd */ - 0.875629257204025623884, /* 0x0.e0293d2f1cb01fff9 */ - 0.877341141814212965880, /* 0x0.e0996dd786fff0007 */ - 0.879056373217612985183, /* 0x0.e109d6a64f5d57ffc */ - 0.880774957955916648615, /* 0x0.e17a77b78e72a7ffe */ - 0.882496902590150900078, /* 0x0.e1eb5127722cc7ff8 */ - 0.884222213673356738383, /* 0x0.e25c63121fb0c8006 */ - 0.885950897802399772740, /* 0x0.e2cdad93ec5340003 */ - 0.887682961567391237685, /* 0x0.e33f30c925fb97ffb */ - 0.889418411575228162725, /* 0x0.e3b0ecce2d05ffff9 */ - 0.891157254447957902797, /* 0x0.e422e1bf727718006 */ - 0.892899496816652704641, /* 0x0.e4950fb9713fc7ffe */ - 0.894645145323828439008, /* 0x0.e50776d8b0e60fff8 */ - 0.896394206626591749641, /* 0x0.e57a1739c8fadfffc */ - 0.898146687421414902124, /* 0x0.e5ecf0f97c5798007 */ - 0.899902594367530173098, /* 0x0.e660043464e378005 */ - 0.901661934163603406867, /* 0x0.e6d3510747e150006 */ - 0.903424713533971135418, /* 0x0.e746d78f06cd97ffd */ - 0.905190939194458810123, /* 0x0.e7ba97e879c91fffc */ - 0.906960617885092856864, /* 0x0.e82e92309390b0007 */ - 0.908733756358986566306, /* 0x0.e8a2c6845544afffa */ - 0.910510361377119825629, /* 0x0.e9173500c8abc7ff8 */ - 0.912290439722343249336, /* 0x0.e98bddc30f98b0002 */ - 0.914073998177417412765, /* 0x0.ea00c0e84bc4c7fff */ - 0.915861043547953501680, /* 0x0.ea75de8db8094fffe */ - 0.917651582652244779397, /* 0x0.eaeb36d09d3137ffe */ - 0.919445622318405764159, /* 0x0.eb60c9ce4ed3dffff */ - 0.921243169397334638073, /* 0x0.ebd697a43995b0007 */ - 0.923044230737526172328, /* 0x0.ec4ca06fc7768fffa */ - 0.924848813220121135342, /* 0x0.ecc2e44e865b6fffb */ - 0.926656923710931002014, /* 0x0.ed39635df34e70006 */ - 0.928468569126343790092, /* 0x0.edb01dbbc2f5b7ffa */ - 0.930283756368834757725, /* 0x0.ee2713859aab57ffa */ - 0.932102492359406786818, /* 0x0.ee9e44d9342870004 */ - 0.933924784042873379360, /* 0x0.ef15b1d4635438005 */ - 0.935750638358567643520, /* 0x0.ef8d5a94f60f50007 */ - 0.937580062297704630580, /* 0x0.f0053f38f345cffff */ - 0.939413062815381727516, /* 0x0.f07d5fde3a2d98001 */ - 0.941249646905368053689, /* 0x0.f0f5bca2d481a8004 */ - 0.943089821583810716806, /* 0x0.f16e55a4e497d7ffe */ - 0.944933593864477061592, /* 0x0.f1e72b028a2827ffb */ - 0.946780970781518460559, /* 0x0.f2603cd9fb5430001 */ - 0.948631959382661205081, /* 0x0.f2d98b497d2a87ff9 */ - 0.950486566729423554277, /* 0x0.f353166f63e3dffff */ - 0.952344799896018723290, /* 0x0.f3ccde6a11ae37ffe */ - 0.954206665969085765512, /* 0x0.f446e357f66120000 */ - 0.956072172053890279009, /* 0x0.f4c12557964f0fff9 */ - 0.957941325265908139014, /* 0x0.f53ba48781046fffb */ - 0.959814132734539637840, /* 0x0.f5b66106555d07ffa */ - 0.961690601603558903308, /* 0x0.f6315af2c2027fffc */ - 0.963570739036113010927, /* 0x0.f6ac926b8aeb80004 */ - 0.965454552202857141381, /* 0x0.f728078f7c5008002 */ - 0.967342048278315158608, /* 0x0.f7a3ba7d66a908001 */ - 0.969233234469444204768, /* 0x0.f81fab543e1897ffb */ - 0.971128118008140250896, /* 0x0.f89bda33122c78007 */ - 0.973026706099345495256, /* 0x0.f9184738d4cf97ff8 */ - 0.974929006031422851235, /* 0x0.f994f284d3a5c0008 */ - 0.976835024947348973265, /* 0x0.fa11dc35bc7820002 */ - 0.978744770239899142285, /* 0x0.fa8f046b4fb7f8007 */ - 0.980658249138918636210, /* 0x0.fb0c6b449ab1cfff9 */ - 0.982575468959622777535, /* 0x0.fb8a10e1088fb7ffa */ - 0.984496437054508843888, /* 0x0.fc07f5602d79afffc */ - 0.986421160608523028820, /* 0x0.fc8618e0e55e47ffb */ - 0.988349647107594098099, /* 0x0.fd047b83571b1fffa */ - 0.990281903873210800357, /* 0x0.fd831d66f4c018002 */ - 0.992217938695037382475, /* 0x0.fe01fead3320bfff8 */ - 0.994157757657894713987, /* 0x0.fe811f703491e8006 */ - 0.996101369488558541238, /* 0x0.ff007fd5744490005 */ - 0.998048781093141101932, /* 0x0.ff801ffa9b9280007 */ - 1.000000000000000000000, /* 0x1.00000000000000000 */ - 1.001955033605393285965, /* 0x1.0080200565d29ffff */ - 1.003913889319761887310, /* 0x1.0100802aa0e80fff0 */ - 1.005876574715736104818, /* 0x1.01812090377240007 */ - 1.007843096764807100351, /* 0x1.020201541aad7fff6 */ - 1.009813464316352327214, /* 0x1.0283229c4c9820007 */ - 1.011787683565730677817, /* 0x1.030484836910a000e */ - 1.013765762469146736174, /* 0x1.0386272b9c077fffe */ - 1.015747708536026694351, /* 0x1.04080ab526304fff0 */ - 1.017733529475172815584, /* 0x1.048a2f412375ffff0 */ - 1.019723232714418781378, /* 0x1.050c94ef7ad5e000a */ - 1.021716825883923762690, /* 0x1.058f3be0f1c2d0004 */ - 1.023714316605201180057, /* 0x1.06122436442e2000e */ - 1.025715712440059545995, /* 0x1.06954e0fec63afff2 */ - 1.027721021151397406936, /* 0x1.0718b98f41c92fff6 */ - 1.029730250269221158939, /* 0x1.079c66d49bb2ffff1 */ - 1.031743407506447551857, /* 0x1.082056011a9230009 */ - 1.033760500517691527387, /* 0x1.08a487359ebd50002 */ - 1.035781537016238873464, /* 0x1.0928fa93490d4fff3 */ - 1.037806524719013578963, /* 0x1.09adb03b3e5b3000d */ - 1.039835471338248051878, /* 0x1.0a32a84e9e5760004 */ - 1.041868384612101516848, /* 0x1.0ab7e2eea5340ffff */ - 1.043905272300907460835, /* 0x1.0b3d603ca784f0009 */ - 1.045946142174331239262, /* 0x1.0bc3205a042060000 */ - 1.047991002016745332165, /* 0x1.0c4923682a086fffe */ - 1.050039859627715177527, /* 0x1.0ccf698898f3a000d */ - 1.052092722826109660856, /* 0x1.0d55f2dce5d1dfffb */ - 1.054149599440827866881, /* 0x1.0ddcbf86b09a5fff6 */ - 1.056210497317612961855, /* 0x1.0e63cfa7abc97fffd */ - 1.058275424318780855142, /* 0x1.0eeb23619c146fffb */ - 1.060344388322010722446, /* 0x1.0f72bad65714bffff */ - 1.062417397220589476718, /* 0x1.0ffa9627c38d30004 */ - 1.064494458915699715017, /* 0x1.1082b577d0eef0003 */ - 1.066575581342167566880, /* 0x1.110b18e893a90000a */ - 1.068660772440545025953, /* 0x1.1193c09c267610006 */ - 1.070750040138235936705, /* 0x1.121cacb4959befff6 */ - 1.072843392435016474095, /* 0x1.12a5dd543cf36ffff */ - 1.074940837302467588937, /* 0x1.132f529d59552000b */ - 1.077042382749654914030, /* 0x1.13b90cb250d08fff5 */ - 1.079148036789447484528, /* 0x1.14430bb58da3dfff9 */ - 1.081257807444460983297, /* 0x1.14cd4fc984c4a000e */ - 1.083371702785017154417, /* 0x1.1557d910df9c7000e */ - 1.085489730853784307038, /* 0x1.15e2a7ae292d30002 */ - 1.087611899742884524772, /* 0x1.166dbbc422d8c0004 */ - 1.089738217537583819804, /* 0x1.16f9157586772ffff */ - 1.091868692357631731528, /* 0x1.1784b4e533cacfff0 */ - 1.094003332327482702577, /* 0x1.18109a360fc23fff2 */ - 1.096142145591650907149, /* 0x1.189cc58b155a70008 */ - 1.098285140311341168136, /* 0x1.1929370751ea50002 */ - 1.100432324652149906842, /* 0x1.19b5eecdd79cefff0 */ - 1.102583706811727015711, /* 0x1.1a42ed01dbdba000e */ - 1.104739294993289488947, /* 0x1.1ad031c69a2eafff0 */ - 1.106899097422573863281, /* 0x1.1b5dbd3f66e120003 */ - 1.109063122341542140286, /* 0x1.1beb8f8fa8150000b */ - 1.111231377994659874592, /* 0x1.1c79a8dac6ad0fff4 */ - 1.113403872669181282605, /* 0x1.1d0809445a97ffffc */ - 1.115580614653132185460, /* 0x1.1d96b0effc9db000e */ - 1.117761612217810673898, /* 0x1.1e25a001332190000 */ - 1.119946873713312474002, /* 0x1.1eb4d69bdb2a9fff1 */ - 1.122136407473298902480, /* 0x1.1f4454e3bfae00006 */ - 1.124330221845670330058, /* 0x1.1fd41afcbb48bfff8 */ - 1.126528325196519908506, /* 0x1.2064290abc98c0001 */ - 1.128730725913251964394, /* 0x1.20f47f31c9aa7000f */ - 1.130937432396844410880, /* 0x1.21851d95f776dfff0 */ - 1.133148453059692917203, /* 0x1.2216045b6784efffa */ - 1.135363796355857157764, /* 0x1.22a733a6692ae0004 */ - 1.137583470716100553249, /* 0x1.2338ab9b3221a0004 */ - 1.139807484614418608939, /* 0x1.23ca6c5e27aadfff7 */ - 1.142035846532929888057, /* 0x1.245c7613b7f6c0004 */ - 1.144268564977221958089, /* 0x1.24eec8e06b035000c */ - 1.146505648458203463465, /* 0x1.258164e8cea85fff8 */ - 1.148747105501412235671, /* 0x1.26144a5180d380009 */ - 1.150992944689175123667, /* 0x1.26a7793f5de2efffa */ - 1.153243174560058870217, /* 0x1.273af1d712179000d */ - 1.155497803703682491111, /* 0x1.27ceb43d81d42fff1 */ - 1.157756840726344771440, /* 0x1.2862c097a3d29000c */ - 1.160020294239811677834, /* 0x1.28f7170a74cf4fff1 */ - 1.162288172883275239058, /* 0x1.298bb7bb0faed0004 */ - 1.164560485298402170388, /* 0x1.2a20a2ce920dffff4 */ - 1.166837240167474476460, /* 0x1.2ab5d86a4631ffff6 */ - 1.169118446164539637555, /* 0x1.2b4b58b36d5220009 */ - 1.171404112007080167155, /* 0x1.2be123cf786790002 */ - 1.173694246390975415341, /* 0x1.2c7739e3c0aac000d */ - 1.175988858069749065617, /* 0x1.2d0d9b15deb58fff6 */ - 1.178287955789017793514, /* 0x1.2da4478b627040002 */ - 1.180591548323240091978, /* 0x1.2e3b3f69fb794fffc */ - 1.182899644456603782686, /* 0x1.2ed282d76421d0004 */ - 1.185212252993012693694, /* 0x1.2f6a11f96c685fff3 */ - 1.187529382762033236513, /* 0x1.3001ecf60082ffffa */ - 1.189851042595508889847, /* 0x1.309a13f30f28a0004 */ - 1.192177241354644978669, /* 0x1.31328716a758cfff7 */ - 1.194507987909589896687, /* 0x1.31cb4686e1e85fffb */ - 1.196843291137896336843, /* 0x1.32645269dfd04000a */ - 1.199183159977805113226, /* 0x1.32fdaae604c39000f */ - 1.201527603343041317132, /* 0x1.339750219980dfff3 */ - 1.203876630171082595692, /* 0x1.3431424300e480007 */ - 1.206230249419600664189, /* 0x1.34cb8170b3fee000e */ - 1.208588470077065268869, /* 0x1.35660dd14dbd4fffc */ - 1.210951301134513435915, /* 0x1.3600e78b6bdfc0005 */ - 1.213318751604272271958, /* 0x1.369c0ec5c38ebfff2 */ - 1.215690830512196507537, /* 0x1.373783a718d29000f */ - 1.218067546930756250870, /* 0x1.37d3465662f480007 */ - 1.220448909901335365929, /* 0x1.386f56fa770fe0008 */ - 1.222834928513994334780, /* 0x1.390bb5ba5fc540004 */ - 1.225225611877684750397, /* 0x1.39a862bd3c7a8fff3 */ - 1.227620969111500981433, /* 0x1.3a455e2a37bcafffd */ - 1.230021009336254911271, /* 0x1.3ae2a8287dfbefff6 */ - 1.232425741726685064472, /* 0x1.3b8040df76f39fffa */ - 1.234835175450728295084, /* 0x1.3c1e287682e48fff1 */ - 1.237249319699482263931, /* 0x1.3cbc5f151b86bfff8 */ - 1.239668183679933477545, /* 0x1.3d5ae4e2cc0a8000f */ - 1.242091776620540377629, /* 0x1.3df9ba07373bf0006 */ - 1.244520107762172811399, /* 0x1.3e98deaa0d8cafffe */ - 1.246953186383919165383, /* 0x1.3f3852f32973efff0 */ - 1.249391019292643401078, /* 0x1.3fd816ffc72b90001 */ - 1.251833623164381181797, /* 0x1.40782b17863250005 */ - 1.254280999953110153911, /* 0x1.41188f42caf400000 */ - 1.256733161434815393410, /* 0x1.41b943b42945bfffd */ - 1.259190116985283935980, /* 0x1.425a4893e5f10000a */ - 1.261651875958665236542, /* 0x1.42fb9e0a2df4c0009 */ - 1.264118447754797758244, /* 0x1.439d443f608c4fff9 */ - 1.266589841787181258708, /* 0x1.443f3b5bebf850008 */ - 1.269066067469190262045, /* 0x1.44e183883e561fff7 */ - 1.271547134259576328224, /* 0x1.45841cecf7a7a0001 */ - 1.274033051628237434048, /* 0x1.462707b2c43020009 */ - 1.276523829025464573684, /* 0x1.46ca44023aa410007 */ - 1.279019475999373156531, /* 0x1.476dd2045d46ffff0 */ - 1.281520002043128991825, /* 0x1.4811b1e1f1f19000b */ - 1.284025416692967214122, /* 0x1.48b5e3c3edd74fff4 */ - 1.286535729509738823464, /* 0x1.495a67d3613c8fff7 */ - 1.289050950070396384145, /* 0x1.49ff3e396e19d000b */ - 1.291571087985403654081, /* 0x1.4aa4671f5b401fff1 */ - 1.294096152842774794011, /* 0x1.4b49e2ae56d19000d */ - 1.296626154297237043484, /* 0x1.4befb10fd84a3fff4 */ - 1.299161101984141142272, /* 0x1.4c95d26d41d84fff8 */ - 1.301701005575179204100, /* 0x1.4d3c46f01d9f0fff3 */ - 1.304245874766450485904, /* 0x1.4de30ec21097d0003 */ - 1.306795719266019562007, /* 0x1.4e8a2a0ccce3d0002 */ - 1.309350548792467483458, /* 0x1.4f3198fa10346fff5 */ - 1.311910373099227200545, /* 0x1.4fd95bb3be8cffffd */ - 1.314475201942565174546, /* 0x1.50817263bf0e5fffb */ - 1.317045045107389400535, /* 0x1.5129dd3418575000e */ - 1.319619912422941299109, /* 0x1.51d29c4f01c54ffff */ - 1.322199813675649204855, /* 0x1.527bafde83a310009 */ - 1.324784758729532718739, /* 0x1.5325180cfb8b3fffd */ - 1.327374757430096474625, /* 0x1.53ced504b2bd0fff4 */ - 1.329969819671041886272, /* 0x1.5478e6f02775e0001 */ - 1.332569955346704748651, /* 0x1.55234df9d8a59fff8 */ - 1.335175174370685002822, /* 0x1.55ce0a4c5a6a9fff6 */ - 1.337785486688218616860, /* 0x1.56791c1263abefff7 */ - 1.340400902247843806217, /* 0x1.57248376aef21fffa */ - 1.343021431036279800211, /* 0x1.57d040a420c0bfff3 */ - 1.345647083048053138662, /* 0x1.587c53c5a630f0002 */ - 1.348277868295411074918, /* 0x1.5928bd063fd7bfff9 */ - 1.350913796821875845231, /* 0x1.59d57c9110ad60006 */ - 1.353554878672557082439, /* 0x1.5a8292913d68cfffc */ - 1.356201123929036356254, /* 0x1.5b2fff3212db00007 */ - 1.358852542671913132777, /* 0x1.5bddc29edcc06fff3 */ - 1.361509145047255398051, /* 0x1.5c8bdd032ed16000f */ - 1.364170941142184734180, /* 0x1.5d3a4e8a5bf61fff4 */ - 1.366837941171020309735, /* 0x1.5de9176042f1effff */ - 1.369510155261156381121, /* 0x1.5e9837b062f4e0005 */ - 1.372187593620959988833, /* 0x1.5f47afa69436cfff1 */ - 1.374870266463378287715, /* 0x1.5ff77f6eb3f8cfffd */ - 1.377558184010425845733, /* 0x1.60a7a734a9742fff9 */ - 1.380251356531521533853, /* 0x1.6158272490016000c */ - 1.382949794301995272203, /* 0x1.6208ff6a8978a000f */ - 1.385653507605306700170, /* 0x1.62ba3032c0a280004 */ - 1.388362506772382154503, /* 0x1.636bb9a994784000f */ - 1.391076802081129493127, /* 0x1.641d9bfb29a7bfff6 */ - 1.393796403973427855412, /* 0x1.64cfd7545928b0002 */ - 1.396521322756352656542, /* 0x1.65826be167badfff8 */ - 1.399251568859207761660, /* 0x1.663559cf20826000c */ - 1.401987152677323100733, /* 0x1.66e8a14a29486fffc */ - 1.404728084651919228815, /* 0x1.679c427f5a4b6000b */ - 1.407474375243217723560, /* 0x1.68503d9ba0add000f */ - 1.410226034922914983815, /* 0x1.690492cbf6303fff9 */ - 1.412983074197955213304, /* 0x1.69b9423d7b548fff6 */ -}; diff --git a/sysdeps/libm-ieee754/t_exp2.h b/sysdeps/libm-ieee754/t_exp2.h deleted file mode 100644 index 1fd73338cf..0000000000 --- a/sysdeps/libm-ieee754/t_exp2.h +++ /dev/null @@ -1,585 +0,0 @@ -/* These values are accurate to 52+12 bits when represented as - a double. */ -static const double exp2_accuratetable[512] = { -0.707106781187802013759 /* 0x0.b504f333fb3f80007 */, -0.708064712808760599040 /* 0x0.b543baa0f71b38000 */, -0.709023942160304065938 /* 0x0.b58297d3a8d518002 */, -0.709984470998547667624 /* 0x0.b5c18ad39b4ba0001 */, -0.710946301084324217006 /* 0x0.b60093a85e8d30001 */, -0.711909434180505784637 /* 0x0.b63fb25984e628005 */, -0.712873872052760648733 /* 0x0.b67ee6eea3b5f8003 */, -0.713839616467838999908 /* 0x0.b6be316f518c98001 */, -0.714806669195984345523 /* 0x0.b6fd91e328d148007 */, -0.715775032009894562898 /* 0x0.b73d0851c69e20002 */, -0.716744706683768884058 /* 0x0.b77c94c2c9b3d0003 */, -0.717715694995770148178 /* 0x0.b7bc373dd52eb0003 */, -0.718687998724665488852 /* 0x0.b7fbefca8cd530004 */, -0.719661619652575468291 /* 0x0.b83bbe70981da8001 */, -0.720636559564428180758 /* 0x0.b87ba337a194b0006 */, -0.721612820246623098989 /* 0x0.b8bb9e27556508004 */, -0.722590403488338473025 /* 0x0.b8fbaf4762c798006 */, -0.723569311081411870036 /* 0x0.b93bd69f7be1d0000 */, -0.724549544820974333906 /* 0x0.b97c1437567828007 */, -0.725531106502312561633 /* 0x0.b9bc6816a87ae8002 */, -0.726513997924421062181 /* 0x0.b9fcd2452bee00000 */, -0.727498220889519875430 /* 0x0.ba3d52ca9e6148002 */, -0.728483777200401694265 /* 0x0.ba7de9aebe05c8003 */, -0.729470668664712662563 /* 0x0.babe96f94e62a8002 */, -0.730458897090379144517 /* 0x0.baff5ab2134df0004 */, -0.731448464287988597833 /* 0x0.bb4034e0d38ab0000 */, -0.732439372072965166897 /* 0x0.bb81258d5b2d60001 */, -0.733431622260458326859 /* 0x0.bbc22cbf75fd28001 */, -0.734425216668725511232 /* 0x0.bc034a7ef32c00001 */, -0.735420157118880535324 /* 0x0.bc447ed3a50fe0005 */, -0.736416445434497690674 /* 0x0.bc85c9c560b350001 */, -0.737414083433310718618 /* 0x0.bcc72b5bf4b4e0000 */, -0.738413072966152328496 /* 0x0.bd08a39f5417a8007 */, -0.739413415848264365956 /* 0x0.bd4a32974abcd0002 */, -0.740415113911250699637 /* 0x0.bd8bd84bb68300002 */, -0.741418168994518067562 /* 0x0.bdcd94c47ddd30003 */, -0.742422582936659858376 /* 0x0.be0f6809865968006 */, -0.743428357577745613238 /* 0x0.be515222b72530003 */, -0.744435494762383687126 /* 0x0.be935317fc6ba0002 */, -0.745443996335090397492 /* 0x0.bed56af1423de8001 */, -0.746453864145572798553 /* 0x0.bf1799b67a6248007 */, -0.747465100043933849969 /* 0x0.bf59df6f970e70002 */, -0.748477705883256683178 /* 0x0.bf9c3c248dbee8001 */, -0.749491683518965001732 /* 0x0.bfdeafdd568308000 */, -0.750507034813367890373 /* 0x0.c0213aa1f0fc38004 */, -0.751523761622240105153 /* 0x0.c063dc7a559ca0003 */, -0.752541865811731880422 /* 0x0.c0a6956e883ed8000 */, -0.753561349247157341600 /* 0x0.c0e965868bd220006 */, -0.754582213796583967110 /* 0x0.c12c4cca664cb8002 */, -0.755604461332336940791 /* 0x0.c16f4b42225350006 */, -0.756628093726406381068 /* 0x0.c1b260f5ca2c48002 */, -0.757653112855631305506 /* 0x0.c1f58ded6d72d8001 */, -0.758679520599333412360 /* 0x0.c238d2311e7d08001 */, -0.759707318837184453227 /* 0x0.c27c2dc8f00368005 */, -0.760736509456435783249 /* 0x0.c2bfa0bcfd1400000 */, -0.761767094336480043995 /* 0x0.c3032b155818d0000 */, -0.762799075372231349951 /* 0x0.c346ccda248cc0001 */, -0.763832454453522768941 /* 0x0.c38a8613805488005 */, -0.764867233473625618441 /* 0x0.c3ce56c98d1ca8005 */, -0.765903414329434539816 /* 0x0.c4123f04708d80002 */, -0.766940998920452976510 /* 0x0.c4563ecc532dc0001 */, -0.767979989148100838946 /* 0x0.c49a56295f9f88006 */, -0.769020386915772125040 /* 0x0.c4de8523c2b0a0001 */, -0.770062194131770905170 /* 0x0.c522cbc3ae94e0003 */, -0.771105412703856241146 /* 0x0.c5672a1154e6b8004 */, -0.772150044545352520777 /* 0x0.c5aba014ed5f18003 */, -0.773196091570364285606 /* 0x0.c5f02dd6b09288003 */, -0.774243555696622731700 /* 0x0.c634d35edb1260003 */, -0.775292438842697939641 /* 0x0.c67990b5aa5c18004 */, -0.776342742931542928455 /* 0x0.c6be65e360bed8000 */, -0.777394469888802008854 /* 0x0.c70352f0437f50004 */, -0.778447621641124243320 /* 0x0.c74857e498fd00006 */, -0.779502200118583399303 /* 0x0.c78d74c8ab5b60000 */, -0.780558207255445668515 /* 0x0.c7d2a9a4c959f8000 */, -0.781615644985491186966 /* 0x0.c817f681412f80002 */, -0.782674515247667956808 /* 0x0.c85d5b6666c150006 */, -0.783734819983036512536 /* 0x0.c8a2d85c904760003 */, -0.784796561133562109454 /* 0x0.c8e86d6c14f850002 */, -0.785859740645942328471 /* 0x0.c92e1a9d513ec8002 */, -0.786924360469767103536 /* 0x0.c973dff8a4b390007 */, -0.787990422552312885808 /* 0x0.c9b9bd866c6440007 */, -0.789057928854407064640 /* 0x0.c9ffb34f1444b0001 */, -0.790126881326406182996 /* 0x0.ca45c15afcc570001 */, -0.791197281930050233534 /* 0x0.ca8be7b292db38000 */, -0.792269132620954885659 /* 0x0.cad2265e3cbee8000 */, -0.793342435380726906957 /* 0x0.cb187d667d3d38006 */, -0.794417192158282659010 /* 0x0.cb5eecd3b33158006 */, -0.795493404931386649540 /* 0x0.cba574ae5d2e80001 */, -0.796571075671306805268 /* 0x0.cbec14fef2a348004 */, -0.797650206352955137846 /* 0x0.cc32cdcdef0000000 */, -0.798730798954342069432 /* 0x0.cc799f23d11d18000 */, -0.799812855456121796232 /* 0x0.ccc089091abb28004 */, -0.800896377841454287795 /* 0x0.cd078b86505c18003 */, -0.801981368096190028208 /* 0x0.cd4ea6a3f97720007 */, -0.803067828208752554378 /* 0x0.cd95da6aa057b8007 */, -0.804155760170129796375 /* 0x0.cddd26e2d21b28001 */, -0.805245165974338261710 /* 0x0.ce248c151f3330001 */, -0.806336047619038653883 /* 0x0.ce6c0a0a1c1350001 */, -0.807428407102107836855 /* 0x0.ceb3a0ca5d6be0006 */, -0.808522246427078927792 /* 0x0.cefb505e7e2550007 */, -0.809617567597010201484 /* 0x0.cf4318cf18a268002 */, -0.810714372621179513182 /* 0x0.cf8afa24ce1c98004 */, -0.811812663508675536069 /* 0x0.cfd2f4683f9810005 */, -0.812912442272482604912 /* 0x0.d01b07a2126188003 */, -0.814013710929394895825 /* 0x0.d06333daeff618001 */, -0.815116471495287542325 /* 0x0.d0ab791b80d028006 */, -0.816220725993571205593 /* 0x0.d0f3d76c75b330000 */, -0.817326476447408967199 /* 0x0.d13c4ed67f1cf8000 */, -0.818433724883006474832 /* 0x0.d184df6250e3b0001 */, -0.819542473330909460055 /* 0x0.d1cd8918a3a328004 */, -0.820652723822034690935 /* 0x0.d2164c02305fa0002 */, -0.821764478391968422618 /* 0x0.d25f2827b53fb0005 */, -0.822877739077315761840 /* 0x0.d2a81d91f188b8000 */, -0.823992507918612782109 /* 0x0.d2f12c49a8d290005 */, -0.825108786960634610365 /* 0x0.d33a5457a35e40003 */, -0.826226578247117093869 /* 0x0.d38395c4a84848007 */, -0.827345883828319528258 /* 0x0.d3ccf09985d958004 */, -0.828466705754248966560 /* 0x0.d41664df0a1320005 */, -0.829589046080638992111 /* 0x0.d45ff29e094330000 */, -0.830712906863802391671 /* 0x0.d4a999df585a20005 */, -0.831838290163696481037 /* 0x0.d4f35aabd04a60006 */, -0.832965198041969556729 /* 0x0.d53d350c4be258002 */, -0.834093632565442222342 /* 0x0.d5872909aba050007 */, -0.835223595802037643865 /* 0x0.d5d136acd138e8006 */, -0.836355089820669306292 /* 0x0.d61b5dfe9f7780004 */, -0.837488116698010487424 /* 0x0.d6659f0801afa8005 */, -0.838622678508982644113 /* 0x0.d6aff9d1e147d8004 */, -0.839758777333464490056 /* 0x0.d6fa6e652d19e0000 */, -0.840896415254110962690 /* 0x0.d744fccad70d00003 */, -0.842035594355151628676 /* 0x0.d78fa50bd2c3b0000 */, -0.843176316724478125433 /* 0x0.d7da673117e730007 */, -0.844318584453106590905 /* 0x0.d8254343a19038003 */, -0.845462399634695271912 /* 0x0.d870394c6dbf30003 */, -0.846607764365415071965 /* 0x0.d8bb49547d37c0004 */, -0.847754680744707056494 /* 0x0.d9067364d45608003 */, -0.848903150873708822763 /* 0x0.d951b7867953b0006 */, -0.850053176859071113491 /* 0x0.d99d15c2787a30006 */, -0.851204760807439786431 /* 0x0.d9e88e21de11a0003 */, -0.852357904828824897169 /* 0x0.da3420adba1508003 */, -0.853512611037803181642 /* 0x0.da7fcd6f2184d8005 */, -0.854668881550406100980 /* 0x0.dacb946f2afaf8000 */, -0.855826718478671755185 /* 0x0.db1775b6e8ad48000 */, -0.856986123964844970247 /* 0x0.db63714f8e0818006 */, -0.858147100114499461478 /* 0x0.dbaf87422625b8000 */, -0.859309649060962410524 /* 0x0.dbfbb797daa460002 */, -0.860473772936213743282 /* 0x0.dc480259d3a710001 */, -0.861639473872910177676 /* 0x0.dc9467913a0f48006 */, -0.862806754008130227807 /* 0x0.dce0e7473b9b28003 */, -0.863975615481124226159 /* 0x0.dd2d8185086c20006 */, -0.865146060433749419813 /* 0x0.dd7a3653d38168005 */, -0.866318091005120138881 /* 0x0.ddc705bcccd628000 */, -0.867491709362415264210 /* 0x0.de13efc9434100004 */, -0.868666917636779056818 /* 0x0.de60f4825df9b8005 */, -0.869843717989716047624 /* 0x0.deae13f16599c0003 */, -0.871022112578215268471 /* 0x0.defb4e1f9dc388002 */, -0.872202103559697183859 /* 0x0.df48a3164a92f0001 */, -0.873383693097737778847 /* 0x0.df9612deb6e878007 */, -0.874566883362160263365 /* 0x0.dfe39d82348310001 */, -0.875751676517234511901 /* 0x0.e031430a0f0688000 */, -0.876938074732511840819 /* 0x0.e07f037f97e548001 */, -0.878126080186539592654 /* 0x0.e0ccdeec2a75e0006 */, -0.879315695055312818168 /* 0x0.e11ad5591f4078001 */, -0.880506921518618312932 /* 0x0.e168e6cfd2f880004 */, -0.881699761760385225541 /* 0x0.e1b71359a6df60003 */, -0.882894217964411143207 /* 0x0.e2055afffc1178000 */, -0.884090292325693805080 /* 0x0.e253bdcc3ffbb8001 */, -0.885287987031581180559 /* 0x0.e2a23bc7d7a1d8002 */, -0.886487304278189114386 /* 0x0.e2f0d4fc31ab80004 */, -0.887688246263368285778 /* 0x0.e33f8972bea8a8005 */, -0.888890815189881999840 /* 0x0.e38e5934f49010007 */, -0.890095013257492739835 /* 0x0.e3dd444c460bd0007 */, -0.891300842677948068626 /* 0x0.e42c4ac232f380000 */, -0.892508305659222567226 /* 0x0.e47b6ca036f8b8005 */, -0.893717404414979710310 /* 0x0.e4caa9efd40e58002 */, -0.894928141160697743242 /* 0x0.e51a02ba8e2610007 */, -0.896140518115016826430 /* 0x0.e5697709ecab90000 */, -0.897354537501434679237 /* 0x0.e5b906e77c61d0006 */, -0.898570201543732793877 /* 0x0.e608b25cca5ba8005 */, -0.899787512470129891014 /* 0x0.e6587973688ce8002 */, -0.901006472512270728537 /* 0x0.e6a85c34ecadb8000 */, -0.902227083902570559127 /* 0x0.e6f85aaaed4f20006 */, -0.903449348881299796343 /* 0x0.e74874df09a530003 */, -0.904673269686823378091 /* 0x0.e798aadadecba0007 */, -0.905898848559668845585 /* 0x0.e7e8fca80c3ee0001 */, -0.907126087750156795426 /* 0x0.e8396a503c3fe0005 */, -0.908354989505901100354 /* 0x0.e889f3dd1615b0002 */, -0.909585556079328783087 /* 0x0.e8da9958465228007 */, -0.910817789726044213523 /* 0x0.e92b5acb7d0578001 */, -0.912051692703457872481 /* 0x0.e97c38406c3c30003 */, -0.913287267274154990210 /* 0x0.e9cd31c0cbb370001 */, -0.914524515702244578108 /* 0x0.ea1e475654d540000 */, -0.915763440256158633982 /* 0x0.ea6f790ac5cc78001 */, -0.917004043205012497909 /* 0x0.eac0c6e7dd8448007 */, -0.918246326823137892807 /* 0x0.eb1230f760a428007 */, -0.919490293387826285200 /* 0x0.eb63b7431714a8007 */, -0.920735945178816406225 /* 0x0.ebb559d4cb6f30007 */, -0.921983284479243714322 /* 0x0.ec0718b64c0940002 */, -0.923232313574974705626 /* 0x0.ec58f3f16a3910002 */, -0.924483034755387955725 /* 0x0.ecaaeb8ffb3168005 */, -0.925735450311948926408 /* 0x0.ecfcff9bd67078000 */, -0.926989562542820610982 /* 0x0.ed4f301edad1a0007 */, -0.928245373740515189457 /* 0x0.eda17d22e0f9b0001 */, -0.929502886213858126045 /* 0x0.edf3e6b1d37d40001 */, -0.930762102264245716494 /* 0x0.ee466cd594c5c8005 */, -0.932023024199046146183 /* 0x0.ee990f980dcdb0005 */, -0.933285654329454095216 /* 0x0.eeebcf032bc470007 */, -0.934549994971191289044 /* 0x0.ef3eab20e0d3c0001 */, -0.935816048439005676599 /* 0x0.ef91a3fb1e1340004 */, -0.937083817055075818404 /* 0x0.efe4b99bdcc618006 */, -0.938353303143720007819 /* 0x0.f037ec0d1889b8000 */, -0.939624509028518128972 /* 0x0.f08b3b58cc2bb8006 */, -0.940897437041863904384 /* 0x0.f0dea788fc2a90000 */, -0.942172089516254085427 /* 0x0.f13230a7ad21b8003 */, -0.943448468787511540534 /* 0x0.f185d6bee754e0006 */, -0.944726577195256100890 /* 0x0.f1d999d8b73478005 */, -0.946006417082291717338 /* 0x0.f22d79ff2cb130000 */, -0.947287990793413858827 /* 0x0.f281773c59ec48007 */, -0.948571300678290207925 /* 0x0.f2d5919a566268001 */, -0.949856349088629370320 /* 0x0.f329c9233bceb0001 */, -0.951143138379053731954 /* 0x0.f37e1de1272068002 */, -0.952431670908847949364 /* 0x0.f3d28fde3a6728006 */, -0.953721949039916472305 /* 0x0.f4271f249a93f0001 */, -0.955013975135367898520 /* 0x0.f47bcbbe6deab0001 */, -0.956307751564417496418 /* 0x0.f4d095b5e16638004 */, -0.957603280698967163097 /* 0x0.f5257d1524f590006 */, -0.958900564911197350604 /* 0x0.f57a81e668d628000 */, -0.960199606581278120057 /* 0x0.f5cfa433e60e50007 */, -0.961500408088936442422 /* 0x0.f624e407d527a0007 */, -0.962802971817578789903 /* 0x0.f67a416c72b760006 */, -0.964107300155846558292 /* 0x0.f6cfbc6c011458004 */, -0.965413395493874504368 /* 0x0.f7255510c439a8002 */, -0.966721260225105960572 /* 0x0.f77b0b6503c5b8006 */, -0.968030896745834645873 /* 0x0.f7d0df730a7940005 */, -0.969342307458006424716 /* 0x0.f826d145294be8003 */, -0.970655494764855020231 /* 0x0.f87ce0e5b29fd8000 */, -0.971970461071268720958 /* 0x0.f8d30e5efaa8f0004 */, -0.973287208789983648852 /* 0x0.f92959bb5e3c08001 */, -0.974605740331924708124 /* 0x0.f97fc305383028004 */, -0.975926058115625383329 /* 0x0.f9d64a46ebb9f8004 */, -0.977248164559556209435 /* 0x0.fa2cef8adbfc68004 */, -0.978572062087848637573 /* 0x0.fa83b2db7253d0007 */, -0.979897753126343307191 /* 0x0.fada944319fda0005 */, -0.981225240104636631254 /* 0x0.fb3193cc425870002 */, -0.982554525455618277276 /* 0x0.fb88b1815e61d0003 */, -0.983885611617111077747 /* 0x0.fbdfed6ce683e0007 */, -0.985218501026348891812 /* 0x0.fc3747995282f8006 */, -0.986553196127724962867 /* 0x0.fc8ec0112202a0005 */, -0.987889699367056062238 /* 0x0.fce656ded63710002 */, -0.989228013193998778636 /* 0x0.fd3e0c0cf48d50005 */, -0.990568140061241164686 /* 0x0.fd95dfa605c7b0003 */, -0.991910082424819927754 /* 0x0.fdedd1b4965710004 */, -0.993253842749249660216 /* 0x0.fe45e2433bfea0000 */, -0.994599423484053835071 /* 0x0.fe9e115c7c05f0005 */, -0.995946827107488830167 /* 0x0.fef65f0afb4c28006 */, -0.997296056085008264529 /* 0x0.ff4ecb59509cc8001 */, -0.998647112892057764479 /* 0x0.ffa756521dbfd0007 */, -1.000000000000000000000 /* 0x1.00000000000000000 */, -1.001354719891689004659 /* 0x1.0058c86da14aa0005 */, -1.002711275050312211844 /* 0x1.00b1afa5abead0003 */, -1.004069667960743483835 /* 0x1.010ab5b2cc0660009 */, -1.005429901112333324093 /* 0x1.0163da9fb2af30008 */, -1.006791976999887428009 /* 0x1.01bd1e7716f6a0008 */, -1.008155898118476168101 /* 0x1.02168143b03890006 */, -1.009521666967782227439 /* 0x1.027003103ae320002 */, -1.010889286051850133326 /* 0x1.02c9a3e7783030002 */, -1.012258757875921233497 /* 0x1.032363d42aaa8000e */, -1.013630084952214405194 /* 0x1.037d42e11c88d0000 */, -1.015003269791313389451 /* 0x1.03d741191635a0001 */, -1.016378314911229763267 /* 0x1.04315e86e84630008 */, -1.017755222831652872635 /* 0x1.048b9b35652800002 */, -1.019133996077934645224 /* 0x1.04e5f72f65827000b */, -1.020514637175266248212 /* 0x1.0540727fc1cfa0006 */, -1.021897148653734488385 /* 0x1.059b0d3157ebb0002 */, -1.023281533050062419584 /* 0x1.05f5c74f0cfeb0002 */, -1.024667792897328677539 /* 0x1.0650a0e3c22ee0003 */, -1.026055930738840826806 /* 0x1.06ab99fa63e1b0008 */, -1.027445949118511947550 /* 0x1.0706b29ddf2700009 */, -1.028837850584049418178 /* 0x1.0761ead9253ab0009 */, -1.030231637685799839262 /* 0x1.07bd42b72a3f80008 */, -1.031627312979383592802 /* 0x1.0818ba42e824a000c */, -1.033024879021186448496 /* 0x1.0874518759b0b0008 */, -1.034424338374263729911 /* 0x1.08d0088f80ffa0006 */, -1.035825693601787333992 /* 0x1.092bdf66604e30005 */, -1.037228947273990842283 /* 0x1.0987d617019cd000a */, -1.038634101961269928846 /* 0x1.09e3ecac6f199000f */, -1.040041160239590700707 /* 0x1.0a402331b91270002 */, -1.041450124688240164200 /* 0x1.0a9c79b1f37c3000b */, -1.042860997889083929381 /* 0x1.0af8f038352160000 */, -1.044273782427270314011 /* 0x1.0b5586cf986890006 */, -1.045688480893644856116 /* 0x1.0bb23d833dfbf0006 */, -1.047105095879385272564 /* 0x1.0c0f145e46e330007 */, -1.048523629981608529302 /* 0x1.0c6c0b6bdaadc000f */, -1.049944085800634585634 /* 0x1.0cc922b72470a000f */, -1.051366465939483019223 /* 0x1.0d265a4b5238b0007 */, -1.052790773004648849929 /* 0x1.0d83b23395e510002 */, -1.054217009607077093512 /* 0x1.0de12a7b263970006 */, -1.055645178360430591625 /* 0x1.0e3ec32d3cf680000 */, -1.057075281882416506511 /* 0x1.0e9c7c55184f5000e */, -1.058507322794714378170 /* 0x1.0efa55fdfad51000a */, -1.059941303721639416236 /* 0x1.0f58503329fed0003 */, -1.061377227289284297385 /* 0x1.0fb66affed37f0000 */, -1.062815096132297298980 /* 0x1.1014a66f95540000c */, -1.064254912884593951029 /* 0x1.1073028d725850007 */, -1.065696680185205469411 /* 0x1.10d17f64d9ea2000b */, -1.067140400676658718053 /* 0x1.11301d012586a0007 */, -1.068586077004890055886 /* 0x1.118edb6db26ab0003 */, -1.070033711820396415998 /* 0x1.11edbab5e2d6e000b */, -1.071483307775789262099 /* 0x1.124cbae51b5ef0001 */, -1.072934867526001312439 /* 0x1.12abdc06c3240000c */, -1.074388393734249103080 /* 0x1.130b1e264a62e0005 */, -1.075843889063253344684 /* 0x1.136a814f20ccd0003 */, -1.077301356179926061823 /* 0x1.13ca058cbaaed000b */, -1.078760797756675327056 /* 0x1.1429aaea9260e000e */, -1.080222216468626150775 /* 0x1.148971742537c0009 */, -1.081685614993597610617 /* 0x1.14e95934f37e8000b */, -1.083150996013011013776 /* 0x1.1549623881762000d */, -1.084618362213087383633 /* 0x1.15a98c8a58a6a000b */, -1.086087716284427351384 /* 0x1.1609d8360768c0008 */, -1.087559060917626885283 /* 0x1.166a45471c13f0008 */, -1.089032398810997337465 /* 0x1.16cad3c92d7b50009 */, -1.090507732647478578212 /* 0x1.172b83c7c18b5000f */, -1.091985065182095926460 /* 0x1.178c554ead72a000c */, -1.093464399073070136880 /* 0x1.17ed48695befe000c */, -1.094945737045367906172 /* 0x1.184e5d23812500007 */, -1.096429081816546080591 /* 0x1.18af9388c90e40005 */, -1.097914436104650892651 /* 0x1.1910eba4e031a0001 */, -1.099401802629782043408 /* 0x1.19726583755720003 */, -1.100891184121537858001 /* 0x1.19d4013041b860007 */, -1.102382583308144647940 /* 0x1.1a35beb6fd0cd0007 */, -1.103876002922312915544 /* 0x1.1a979e2363fa10000 */, -1.105371445702084232160 /* 0x1.1af99f8139025000e */, -1.106868914387219016199 /* 0x1.1b5bc2dc408b9000e */, -1.108368411723785085252 /* 0x1.1bbe084045eb30002 */, -1.109869940458469095340 /* 0x1.1c206fb91524c000e */, -1.111373503344554869449 /* 0x1.1c82f952817cc0001 */, -1.112879103137133007859 /* 0x1.1ce5a51860344000f */, -1.114386742595953938610 /* 0x1.1d4873168babf000e */, -1.115896424484008608911 /* 0x1.1dab6358e1d4a000f */, -1.117408151567338414664 /* 0x1.1e0e75eb43f9c000c */, -1.118921926613465345265 /* 0x1.1e71aad995078000f */, -1.120437752409564780022 /* 0x1.1ed5022fcd8600003 */, -1.121955631720569668277 /* 0x1.1f387bf9cd88b0000 */, -1.123475567332998359439 /* 0x1.1f9c18438cdec000a */, -1.124997562033035469759 /* 0x1.1fffd71902f970002 */, -1.126521618608448571713 /* 0x1.2063b88629079000e */, -1.128047739853580200284 /* 0x1.20c7bc96ff72a0002 */, -1.129575928566289189112 /* 0x1.212be3578a81e0006 */, -1.131106187546149888259 /* 0x1.21902cd3d05f70007 */, -1.132638519598779369743 /* 0x1.21f49917ddda5000c */, -1.134172927531616359481 /* 0x1.2259282fc1c24000e */, -1.135709414157753949251 /* 0x1.22bdda27911e90007 */, -1.137247982292643566662 /* 0x1.2322af0b638e60007 */, -1.138788634756517259562 /* 0x1.2387a6e755f270000 */, -1.140331374372893558110 /* 0x1.23ecc1c788c890006 */, -1.141876203969685699176 /* 0x1.2451ffb821639000c */, -1.143423126377846266197 /* 0x1.24b760c5486dc0009 */, -1.144972144431494420774 /* 0x1.251ce4fb2a0cc0005 */, -1.146523260971646252006 /* 0x1.25828c65f9fb8000d */, -1.148076478839068270690 /* 0x1.25e85711ebaeb0000 */, -1.149631800883562204903 /* 0x1.264e450b3c8a30008 */, -1.151189229953253789786 /* 0x1.26b4565e281a20003 */, -1.152748768902654319399 /* 0x1.271a8b16f0f000002 */, -1.154310420590433317050 /* 0x1.2780e341de2fc0001 */, -1.155874187878668246681 /* 0x1.27e75eeb3abc90007 */, -1.157440073633736243899 /* 0x1.284dfe1f5633e000a */, -1.159008080725518974322 /* 0x1.28b4c0ea840d90001 */, -1.160578212048386514965 /* 0x1.291ba75932ae60000 */, -1.162150470417516290340 /* 0x1.2982b177796850008 */, -1.163724858777502646494 /* 0x1.29e9df51fdd900001 */, -1.165301379991388053320 /* 0x1.2a5130f50bf34000e */, -1.166880036952526289469 /* 0x1.2ab8a66d10fdc0008 */, -1.168460832550151540268 /* 0x1.2b203fc675b7a000a */, -1.170043769683112966389 /* 0x1.2b87fd0dad7260008 */, -1.171628851252754177681 /* 0x1.2befde4f2e3da000d */, -1.173216080163546060084 /* 0x1.2c57e397719940002 */, -1.174805459325657830448 /* 0x1.2cc00cf2f7491000c */, -1.176396991650083379037 /* 0x1.2d285a6e3ff90000b */, -1.177990680055698513602 /* 0x1.2d90cc15d4ff90005 */, -1.179586527463262646306 /* 0x1.2df961f641c57000c */, -1.181184536796979545103 /* 0x1.2e621c1c157cd000d */, -1.182784710984701836994 /* 0x1.2ecafa93e35af0004 */, -1.184387052960675701386 /* 0x1.2f33fd6a459cb0000 */, -1.185991565661414393112 /* 0x1.2f9d24abd8fd1000e */, -1.187598252026902612178 /* 0x1.300670653e083000a */, -1.189207115003001469262 /* 0x1.306fe0a31bc040008 */, -1.190818157535919796833 /* 0x1.30d9757219895000e */, -1.192431382587621380206 /* 0x1.31432edef01a1000f */, -1.194046793097208292195 /* 0x1.31ad0cf63f0630008 */, -1.195664392040319823392 /* 0x1.32170fc4ce0db000c */, -1.197284182375793593084 /* 0x1.32813757527750005 */, -1.198906167074650808198 /* 0x1.32eb83ba8eef3000f */, -1.200530349107333139048 /* 0x1.3355f4fb457e5000d */, -1.202156731453099647353 /* 0x1.33c08b2641df9000c */, -1.203785317090505513368 /* 0x1.342b46484f07b0005 */, -1.205416109005122526928 /* 0x1.3496266e3fa270005 */, -1.207049110184904572310 /* 0x1.35012ba4e8fa10000 */, -1.208684323627194912036 /* 0x1.356c55f92aabb0004 */, -1.210321752322854882437 /* 0x1.35d7a577dd33f0004 */, -1.211961399276747286580 /* 0x1.36431a2de8748000d */, -1.213603267492579629347 /* 0x1.36aeb4283309e000c */, -1.215247359985374142610 /* 0x1.371a7373b00160000 */, -1.216893679753690671322 /* 0x1.3786581d404e90000 */, -1.218542229828181611183 /* 0x1.37f26231e82e4000c */, -1.220193013225231215567 /* 0x1.385e91be9c2d20002 */, -1.221846032973555429280 /* 0x1.38cae6d05e66f0000 */, -1.223501292099485437962 /* 0x1.393761742e5830001 */, -1.225158793636904830441 /* 0x1.39a401b713cb3000e */, -1.226818540625497444577 /* 0x1.3a10c7a61ceae0007 */, -1.228480536107136034131 /* 0x1.3a7db34e5a4a50003 */, -1.230144783126481566885 /* 0x1.3aeac4bcdf8d60001 */, -1.231811284734168454619 /* 0x1.3b57fbfec6e950008 */, -1.233480043984379381835 /* 0x1.3bc559212e7a2000f */, -1.235151063936380300149 /* 0x1.3c32dc3139f2a0004 */, -1.236824347652524913647 /* 0x1.3ca0853c106ac000e */, -1.238499898199571624970 /* 0x1.3d0e544eddd240003 */, -1.240177718649636107175 /* 0x1.3d7c4976d3fcd0000 */, -1.241857812073360767273 /* 0x1.3dea64c1231f70004 */, -1.243540181554270152039 /* 0x1.3e58a63b099920005 */, -1.245224830175077013244 /* 0x1.3ec70df1c4e46000e */, -1.246911761022835740725 /* 0x1.3f359bf29741c000e */, -1.248600977188942806639 /* 0x1.3fa4504ac7b800009 */, -1.250292481770148400634 /* 0x1.40132b07a330d000a */, -1.251986277866492969263 /* 0x1.40822c367a340000b */, -1.253682368581898742876 /* 0x1.40f153e4a18e0000d */, -1.255380757024939564249 /* 0x1.4160a21f73289000d */, -1.257081446308726757662 /* 0x1.41d016f44deaa000c */, -1.258784439550028944083 /* 0x1.423fb27094c090008 */, -1.260489739869405489991 /* 0x1.42af74a1aec1c0006 */, -1.262197350394008266193 /* 0x1.431f5d950a453000c */, -1.263907274252603851764 /* 0x1.438f6d58176860004 */, -1.265619514578811388761 /* 0x1.43ffa3f84b9eb000d */, -1.267334074511444086425 /* 0x1.44700183221180008 */, -1.269050957191869555296 /* 0x1.44e0860618b930006 */, -1.270770165768063009230 /* 0x1.4551318eb4d20000e */, -1.272491703389059036805 /* 0x1.45c2042a7cc26000b */, -1.274215573211836316547 /* 0x1.4632fde6ffacd000d */, -1.275941778396075143580 /* 0x1.46a41ed1cfac40001 */, -1.277670322103555911043 /* 0x1.471566f8812ac0000 */, -1.279401207505722393185 /* 0x1.4786d668b33260005 */, -1.281134437771823675369 /* 0x1.47f86d3002637000a */, -1.282870016078732078362 /* 0x1.486a2b5c13c00000e */, -1.284607945607987078432 /* 0x1.48dc10fa916bd0004 */, -1.286348229545787758022 /* 0x1.494e1e192aaa30007 */, -1.288090871080605159846 /* 0x1.49c052c5913df000c */, -1.289835873406902644341 /* 0x1.4a32af0d7d8090002 */, -1.291583239722392528754 /* 0x1.4aa532feab5e10002 */, -1.293332973229098792374 /* 0x1.4b17dea6db8010008 */, -1.295085077135345708087 /* 0x1.4b8ab213d57d9000d */, -1.296839554650994097442 /* 0x1.4bfdad53629e10003 */, -1.298596408992440220988 /* 0x1.4c70d0735358a000d */, -1.300355643380135983739 /* 0x1.4ce41b817c99e0001 */, -1.302117261036232376282 /* 0x1.4d578e8bb52cb0003 */, -1.303881265192249561154 /* 0x1.4dcb299fde2920008 */, -1.305647659079073541490 /* 0x1.4e3eeccbd7f4c0003 */, -1.307416445934474813521 /* 0x1.4eb2d81d8a86f000b */, -1.309187629001237640529 /* 0x1.4f26eba2e35a5000e */, -1.310961211525240921493 /* 0x1.4f9b2769d35090009 */, -1.312737196755087820678 /* 0x1.500f8b804e4a30000 */, -1.314515587949291131086 /* 0x1.508417f4530d00009 */, -1.316296388365203462468 /* 0x1.50f8ccd3df1840003 */, -1.318079601265708777911 /* 0x1.516daa2cf60020002 */, -1.319865229921343141607 /* 0x1.51e2b00da3c2b0007 */, -1.321653277603506371251 /* 0x1.5257de83f5512000d */, -1.323443747588034513690 /* 0x1.52cd359dfc7d5000e */, -1.325236643161341820781 /* 0x1.5342b569d6baa000f */, -1.327031967602244177939 /* 0x1.53b85df59921b0000 */, -1.328829724206201046165 /* 0x1.542e2f4f6b17e0006 */, -1.330629916266568235675 /* 0x1.54a4298571b27000e */, -1.332432547083447937938 /* 0x1.551a4ca5d97190009 */, -1.334237619959296017340 /* 0x1.559098bed16bf0008 */, -1.336045138203900251029 /* 0x1.56070dde90c800000 */, -1.337855105129210686631 /* 0x1.567dac13510cd0009 */, -1.339667524053662184301 /* 0x1.56f4736b52e2c000c */, -1.341482398296830025383 /* 0x1.576b63f4d8333000f */, -1.343299731186792467254 /* 0x1.57e27dbe2c40e0003 */, -1.345119526053918823702 /* 0x1.5859c0d59cd37000f */, -1.346941786233264881662 /* 0x1.58d12d497cd9a0005 */, -1.348766515064854010261 /* 0x1.5948c32824b87000c */, -1.350593715891792223641 /* 0x1.59c0827ff03890007 */, -1.352423392064920459908 /* 0x1.5a386b5f43a3e0006 */, -1.354255546937278120764 /* 0x1.5ab07dd485af1000c */, -1.356090183865519494030 /* 0x1.5b28b9ee21085000f */, -1.357927306213322804534 /* 0x1.5ba11fba8816e000b */, -1.359766917346459269620 /* 0x1.5c19af482f8f2000f */, -1.361609020638567812980 /* 0x1.5c9268a594cc00004 */, -1.363453619463660171403 /* 0x1.5d0b4be135916000c */, -1.365300717204201985683 /* 0x1.5d84590998eeb0005 */, -1.367150317245710233754 /* 0x1.5dfd902d494e40001 */, -1.369002422974674892971 /* 0x1.5e76f15ad22c40008 */, -1.370857037789471544224 /* 0x1.5ef07ca0cc166000b */, -1.372714165088220639199 /* 0x1.5f6a320dcf5280006 */, -1.374573808273481745378 /* 0x1.5fe411b0790800009 */, -1.376435970755022220096 /* 0x1.605e1b976e4b1000e */, -1.378300655944092456600 /* 0x1.60d84fd155d15000e */, -1.380167867259843417228 /* 0x1.6152ae6cdf0030003 */, -1.382037608124419003675 /* 0x1.61cd3778bc879000d */, -1.383909881963391264069 /* 0x1.6247eb03a4dc40009 */, -1.385784692209972801544 /* 0x1.62c2c91c56d9b0002 */, -1.387662042298923203992 /* 0x1.633dd1d1930ec0001 */, -1.389541935670444372533 /* 0x1.63b90532200630004 */, -1.391424375772021271329 /* 0x1.6434634ccc4cc0007 */, -1.393309366052102982208 /* 0x1.64afec30677e90008 */, -1.395196909966106124701 /* 0x1.652b9febc8e0f000d */, -1.397087010973788290271 /* 0x1.65a77e8dcc7f10004 */, -1.398979672539331309267 /* 0x1.66238825534170000 */, -1.400874898129892187656 /* 0x1.669fbcc1415600008 */, -1.402772691220124823310 /* 0x1.671c1c708328e000a */, -1.404673055288671035301 /* 0x1.6798a7420988b000d */, -1.406575993818903302975 /* 0x1.68155d44ca77a000f */, -1.408481510297352468121 /* 0x1.68923e87bf70e000a */, -1.410389608216942924956 /* 0x1.690f4b19e8f74000c */, -1.412300291075172076232 /* 0x1.698c830a4c94c0008 */ -}; -#define S (1.0/4503599627370496.0) /* 2^-52 */ -static const float exp2_deltatable[512] = { - 11527*S, -963*S, 884*S, -781*S, -2363*S, -3441*S, 123*S, 526*S, - -6*S, 1254*S, -1138*S, 1519*S, 1576*S, -65*S, 1040*S, 793*S, - -1662*S, -5063*S, -387*S, 968*S, -941*S, 984*S, -2856*S, -545*S, - 495*S, -5246*S, -2109*S, 1281*S, 2075*S, 909*S, -1642*S,-78233*S, --31653*S, -265*S, 130*S, 430*S, 2482*S, -742*S, 1616*S, -2213*S, - -519*S, 20*S, -3134*S,-13981*S, 1343*S, -1740*S, 247*S, 1679*S, - -1097*S, 3131*S, 871*S, -1480*S, 1936*S, -1827*S, 17325*S, 528*S, - -322*S, 1404*S, -152*S, -1845*S, -212*S, 2639*S, -476*S, 2960*S, - -962*S, -1012*S, -1231*S, 3030*S, 1659*S, -486*S, 2154*S, 1728*S, - -2793*S, 699*S, -1560*S, -2125*S, 2156*S, 142*S, -1888*S, 4426*S, --13443*S, 1970*S, -50*S, 1771*S,-43399*S, 4979*S, -2448*S, -370*S, - 1414*S, 1075*S, 232*S, 206*S, 873*S, 2141*S, 2970*S, 1279*S, - -2331*S, 336*S, -2595*S, 753*S, -3384*S, -616*S, 89*S, -818*S, - 5755*S, -241*S, -528*S, -661*S, -3777*S, -354*S, 250*S, 3881*S, - 2632*S, -2131*S, 2565*S, -316*S, 1746*S, -2541*S, -1324*S, -50*S, - 2564*S, -782*S, 1176*S, 6452*S, -1002*S, 1288*S, 336*S, -185*S, - 3063*S, 3784*S, 2169*S, 686*S, 328*S, -400*S, 312*S, -4517*S, - -1457*S, 1046*S, -1530*S, -685*S, 1328*S,-49815*S, -895*S, 1063*S, - -2091*S, -672*S, -1710*S, -665*S, 1545*S, 1819*S,-45265*S, 3548*S, - -554*S, -568*S, 4752*S, -1907*S,-13738*S, 675*S, 9611*S, -1115*S, - -815*S, 408*S, -1281*S, -937*S,-16376*S, -4772*S, -1440*S, 992*S, - 788*S, 10364*S, -1602*S, -661*S, -1783*S, -265*S, -20*S, -3781*S, - -861*S, -345*S, -994*S, 1364*S, -5339*S, 1620*S, 9390*S, -1066*S, - -305*S, -170*S, 175*S, 2461*S, -490*S, -769*S, -1450*S, 3315*S, - 2418*S, -45*S, -852*S, -1295*S, -488*S, -96*S, 1142*S, -2639*S, - 7905*S, -9306*S, -3859*S, 760*S, 1057*S, -1570*S, 3977*S, 209*S, - -514*S, 7151*S, 1646*S, 627*S, 599*S, -774*S, -1468*S, 633*S, - -473*S, 851*S, 2406*S, 143*S, 74*S, 4260*S, 1177*S, -913*S, - 2670*S, -3298*S, -1662*S, -120*S, -3264*S, -2148*S, 410*S, 2078*S, - -2098*S, -926*S, 3580*S, -1289*S, 2450*S, -1158*S, 907*S, -590*S, - 986*S, 1801*S, 1145*S, -1677*S, 3455*S, 956*S, 710*S, 144*S, - 153*S, -255*S, -1898*S, 28102*S, 2748*S, 1194*S, -3009*S, 7076*S, - 0*S, -2720*S, 711*S, 1225*S, -3034*S, -473*S, 378*S, -1046*S, - 962*S, -2006*S, 4647*S, 3206*S, 1769*S, -2665*S, 1254*S, 2025*S, - -2430*S, 6193*S, 1224*S, -856*S, -1592*S, -325*S, -1521*S, 1827*S, - -264*S, 2403*S, -1065*S, 967*S, -681*S, -2106*S, -474*S, 1333*S, - -893*S, 2296*S, 592*S, -1220*S, -326*S, 990*S, 139*S, 206*S, - -779*S, -1683*S, 1238*S, 6098*S, 136*S, 1197*S, 790*S, -107*S, - -1004*S, -2449*S, 939*S, 5568*S, 156*S, 1812*S, 2792*S, -1094*S, - -2677*S, -251*S, 2297*S, 943*S, -1329*S, 2883*S, -853*S, -2626*S, --105929*S, -6552*S, 1095*S, -1508*S, 1003*S, 5039*S, -2600*S, -749*S, - 1790*S, 890*S, 2016*S, -1073*S, 624*S, -2084*S, -1536*S, -1330*S, - 358*S, 2444*S, -179*S,-25759*S, -243*S, -552*S, -124*S, 3766*S, - 1192*S, -1614*S, 6*S, -1227*S, 345*S, -981*S, -295*S, -1006*S, - -995*S, -1195*S, 706*S, 2512*S, -1758*S, -734*S, -6286*S, -922*S, - 1530*S, 1542*S, 1223*S, 61*S, -83*S, 522*S,116937*S, -914*S, - -418*S, -7339*S, 249*S, -520*S, -762*S, 426*S, -505*S, 2664*S, - -1093*S, -1035*S, 2130*S, 4878*S, 1982*S, 1551*S, 2304*S, 193*S, - 1532*S, -7268*S, 24357*S, 531*S, 2676*S, -1170*S, 1465*S, -1917*S, - 2143*S, 1466*S, -7*S, -7300*S, 3297*S, -1197*S, -289*S, -1548*S, - 26226*S, 4401*S, 4123*S, -1588*S, 4243*S, 4069*S, -1276*S, -2010*S, - 1407*S, 1478*S, 488*S, -2366*S, -2909*S, -2534*S, -1285*S, 7095*S, - -645*S, -2089*S, -944*S, -40*S, -1363*S, -833*S, 917*S, 1609*S, - 1286*S, 1677*S, 1613*S, -2295*S, -1248*S, 40*S, 26*S, 2038*S, - 698*S, 2675*S, -1755*S, -3522*S, -1614*S, -6111*S, 270*S, 1822*S, - -234*S, -2844*S, -1201*S, -830*S, 1193*S, 2354*S, 47*S, 1522*S, - -78*S, -640*S, 2425*S, -1596*S, 1563*S, 1169*S, -1006*S, -83*S, - 2362*S, -3521*S, -314*S, 1814*S, -1751*S, 305*S, 1715*S, -3741*S, - 7847*S, 1291*S, 1206*S, 36*S, 1397*S, -1419*S, -1194*S, -2014*S, - 1742*S, -578*S, -207*S, 875*S, 1539*S, 2826*S, -1165*S, -909*S, - 1849*S, 927*S, 2018*S, -981*S, 1637*S, -463*S, 905*S, 6618*S, - 400*S, 630*S, 2614*S, 900*S, 2323*S, -1094*S, -1858*S, -212*S, - -2069*S, 747*S, 1845*S, -1450*S, 444*S, -213*S, -438*S, 1158*S, - 4738*S, 2497*S, -370*S, -2016*S, -518*S, -1160*S, -1510*S, 123*S -}; -/* Maximum magnitude in above table: 116937 */ -#undef S diff --git a/sysdeps/libm-ieee754/t_exp2f.h b/sysdeps/libm-ieee754/t_exp2f.h deleted file mode 100644 index e15d15787c..0000000000 --- a/sysdeps/libm-ieee754/t_exp2f.h +++ /dev/null @@ -1,352 +0,0 @@ -/* Accurate tables for exp2f(). - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Geoffrey Keating - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This table has the property that, for all integers -128 <= i <= 127, - exp(i/256.0 + __exp2f_deltatable[i-128]) == __exp2f_atable[i+128] + r - for some -2^-35 < r < 2^-35 (abs(r) < 2^-36 if i <= 0); and that - __exp2f_deltatable[i+128] == t * 2^-30 - for integer t so that abs(t) <= 43447 * 2^0. */ - -#define W30 (9.31322575e-10) -static const float __exp2f_deltatable[256] = { - -810*W30, 283*W30, -1514*W30, 1304*W30, - -1148*W30, -98*W30, -744*W30, -156*W30, - -419*W30, -155*W30, 474*W30, 167*W30, - -1984*W30, -826*W30, 692*W30, 781*W30, - -578*W30, -411*W30, -129*W30, -1500*W30, - 654*W30, -141*W30, -816*W30, -53*W30, - 148*W30, 493*W30, -2214*W30, 760*W30, - 260*W30, 750*W30, -1300*W30, 1424*W30, - -1445*W30, -339*W30, -680*W30, -349*W30, - -922*W30, 531*W30, 193*W30, -2892*W30, - 290*W30, -2145*W30, -276*W30, 485*W30, - -695*W30, 215*W30, -7093*W30, 412*W30, - -4596*W30, 367*W30, 592*W30, -615*W30, - -97*W30, -1066*W30, 972*W30, -226*W30, - -625*W30, -374*W30, -5647*W30, -180*W30, - 20349*W30, -447*W30, 111*W30, -4164*W30, - -87*W30, -21*W30, -251*W30, 66*W30, - -517*W30, 2093*W30, -263*W30, 182*W30, - -601*W30, 475*W30, -483*W30, -1251*W30, - -373*W30, 1471*W30, -92*W30, -215*W30, - -97*W30, -190*W30, 0*W30, -290*W30, - -2647*W30, 1940*W30, -582*W30, 28*W30, - 833*W30, 1493*W30, 34*W30, 321*W30, - 3327*W30, -35*W30, 177*W30, -135*W30, - -796*W30, -428*W30, 129*W30, 9332*W30, - -12*W30, -69*W30, -1743*W30, 6508*W30, - -60*W30, 359*W30, 43447*W30, 15*W30, - -23*W30, -305*W30, -375*W30, -652*W30, - 667*W30, 269*W30, -1575*W30, 185*W30, - -329*W30, 200*W30, 6002*W30, 163*W30, - -647*W30, 19*W30, -603*W30, -755*W30, - 742*W30, -438*W30, 3587*W30, 2560*W30, - 0*W30, -520*W30, -241*W30, -299*W30, - -1270*W30, -991*W30, -1138*W30, 255*W30, - -1192*W30, 1722*W30, 1023*W30, 3700*W30, - -1388*W30, -1551*W30, -2549*W30, 27*W30, - 282*W30, 673*W30, 113*W30, 1561*W30, - 72*W30, 873*W30, 87*W30, -395*W30, - -433*W30, 629*W30, 3440*W30, -284*W30, - -592*W30, -103*W30, -46*W30, -3844*W30, - 1712*W30, 303*W30, 1555*W30, -631*W30, - -1400*W30, -961*W30, -854*W30, -276*W30, - 407*W30, 833*W30, -345*W30, -1501*W30, - 121*W30, -1581*W30, 400*W30, 150*W30, - 1224*W30, -139*W30, -563*W30, 879*W30, - 933*W30, 2939*W30, 788*W30, 211*W30, - 530*W30, -192*W30, 706*W30, -13347*W30, - 1065*W30, 3*W30, 111*W30, -208*W30, - -360*W30, -532*W30, -291*W30, 483*W30, - 987*W30, -33*W30, -1373*W30, -166*W30, - -1174*W30, -3955*W30, 1601*W30, -280*W30, - 1405*W30, 600*W30, -1659*W30, -23*W30, - 390*W30, 449*W30, 570*W30, -13143*W30, - -9*W30, -1646*W30, 1201*W30, 294*W30, - 2181*W30, -1173*W30, 1388*W30, -4504*W30, - 190*W30, -2304*W30, 211*W30, 239*W30, - 48*W30, -817*W30, 1018*W30, 1828*W30, - -663*W30, 1408*W30, 408*W30, -36*W30, - 1295*W30, -230*W30, 1341*W30, 9*W30, - 40*W30, 705*W30, 186*W30, 376*W30, - 557*W30, 5866*W30, 363*W30, -1558*W30, - 718*W30, 669*W30, 1369*W30, -2972*W30, - -468*W30, -121*W30, -219*W30, 667*W30, - 29954*W30, 366*W30, 48*W30, -203*W30 -}; - -static const float __exp2f_atable[256] /* __attribute__((mode(SF))) */ = { - 0.707106411447, /* 0x0.b504ecfff */ - 0.709024071690, /* 0x0.b58299fff */ - 0.710945606239, /* 0x0.b60088000 */ - 0.712874472142, /* 0x0.b67ef1000 */ - 0.714806139464, /* 0x0.b6fd88fff */ - 0.716744661340, /* 0x0.b77c94000 */ - 0.718687653549, /* 0x0.b7fbea000 */ - 0.720636486992, /* 0x0.b87ba1fff */ - 0.722590208040, /* 0x0.b8fbabfff */ - 0.724549472323, /* 0x0.b97c12fff */ - 0.726514220228, /* 0x0.b9fcd5fff */ - 0.728483855735, /* 0x0.ba7deb000 */ - 0.730457961549, /* 0x0.baff4afff */ - 0.732438981522, /* 0x0.bb811efff */ - 0.734425544748, /* 0x0.bc0350000 */ - 0.736416816713, /* 0x0.bc85d0000 */ - 0.738412797450, /* 0x0.bd089efff */ - 0.740414917465, /* 0x0.bd8bd4fff */ - 0.742422521111, /* 0x0.be0f66fff */ - 0.744434773914, /* 0x0.be9346fff */ - 0.746454179287, /* 0x0.bf179f000 */ - 0.748477637755, /* 0x0.bf9c3afff */ - 0.750506639473, /* 0x0.c02133fff */ - 0.752541840064, /* 0x0.c0a694fff */ - 0.754582285889, /* 0x0.c12c4e000 */ - 0.756628334525, /* 0x0.c1b265000 */ - 0.758678436269, /* 0x0.c238bffff */ - 0.760736882681, /* 0x0.c2bfa6fff */ - 0.762799203401, /* 0x0.c346cf000 */ - 0.764867603790, /* 0x0.c3ce5d000 */ - 0.766940355298, /* 0x0.c45633fff */ - 0.769021093841, /* 0x0.c4de90fff */ - 0.771104693409, /* 0x0.c5671dfff */ - 0.773195922364, /* 0x0.c5f02afff */ - 0.775292098512, /* 0x0.c6798afff */ - 0.777394294745, /* 0x0.c70350000 */ - 0.779501736166, /* 0x0.c78d6d000 */ - 0.781615912910, /* 0x0.c817fafff */ - 0.783734917628, /* 0x0.c8a2d9fff */ - 0.785858273516, /* 0x0.c92e02000 */ - 0.787990570071, /* 0x0.c9b9c0000 */ - 0.790125787245, /* 0x0.ca45aefff */ - 0.792268991467, /* 0x0.cad223fff */ - 0.794417440881, /* 0x0.cb5ef0fff */ - 0.796570718287, /* 0x0.cbec0efff */ - 0.798730909811, /* 0x0.cc79a0fff */ - 0.800892710672, /* 0x0.cd074dfff */ - 0.803068041795, /* 0x0.cd95ddfff */ - 0.805242776881, /* 0x0.ce2464000 */ - 0.807428598393, /* 0x0.ceb3a3fff */ - 0.809617877002, /* 0x0.cf431dfff */ - 0.811812341211, /* 0x0.cfd2eefff */ - 0.814013659956, /* 0x0.d06333000 */ - 0.816220164311, /* 0x0.d0f3ce000 */ - 0.818434238424, /* 0x0.d184e7fff */ - 0.820652604094, /* 0x0.d21649fff */ - 0.822877407074, /* 0x0.d2a818000 */ - 0.825108587751, /* 0x0.d33a51000 */ - 0.827342867839, /* 0x0.d3ccbdfff */ - 0.829588949684, /* 0x0.d45ff1000 */ - 0.831849217401, /* 0x0.d4f411fff */ - 0.834093391880, /* 0x0.d58724fff */ - 0.836355149750, /* 0x0.d61b5f000 */ - 0.838620424257, /* 0x0.d6afd3fff */ - 0.840896368027, /* 0x0.d744fc000 */ - 0.843176305293, /* 0x0.d7da66fff */ - 0.845462262643, /* 0x0.d87037000 */ - 0.847754716864, /* 0x0.d90673fff */ - 0.850052893157, /* 0x0.d99d10fff */ - 0.852359056469, /* 0x0.da3433fff */ - 0.854668736446, /* 0x0.dacb91fff */ - 0.856986224651, /* 0x0.db6373000 */ - 0.859309315673, /* 0x0.dbfbb1fff */ - 0.861639738080, /* 0x0.dc946bfff */ - 0.863975346095, /* 0x0.dd2d7d000 */ - 0.866317391394, /* 0x0.ddc6f9fff */ - 0.868666708472, /* 0x0.de60f1000 */ - 0.871022939695, /* 0x0.defb5c000 */ - 0.873383641229, /* 0x0.df9611fff */ - 0.875751554968, /* 0x0.e03141000 */ - 0.878126025200, /* 0x0.e0ccde000 */ - 0.880506813521, /* 0x0.e168e4fff */ - 0.882894217966, /* 0x0.e2055afff */ - 0.885287821299, /* 0x0.e2a239000 */ - 0.887686729423, /* 0x0.e33f6ffff */ - 0.890096127973, /* 0x0.e3dd56fff */ - 0.892507970338, /* 0x0.e47b67000 */ - 0.894928157336, /* 0x0.e51a03000 */ - 0.897355020043, /* 0x0.e5b90efff */ - 0.899788379682, /* 0x0.e65888000 */ - 0.902227103705, /* 0x0.e6f85afff */ - 0.904673457151, /* 0x0.e798ae000 */ - 0.907128036008, /* 0x0.e8398afff */ - 0.909585535528, /* 0x0.e8da99000 */ - 0.912051796915, /* 0x0.e97c3a000 */ - 0.914524436003, /* 0x0.ea1e46000 */ - 0.917003571999, /* 0x0.eac0bf000 */ - 0.919490039339, /* 0x0.eb63b2fff */ - 0.921983361257, /* 0x0.ec071a000 */ - 0.924488604054, /* 0x0.ecab48fff */ - 0.926989555360, /* 0x0.ed4f30000 */ - 0.929502844812, /* 0x0.edf3e6000 */ - 0.932021975503, /* 0x0.ee98fdfff */ - 0.934553921208, /* 0x0.ef3eecfff */ - 0.937083780759, /* 0x0.efe4b8fff */ - 0.939624726786, /* 0x0.f08b3f000 */ - 0.942198514924, /* 0x0.f133ebfff */ - 0.944726586343, /* 0x0.f1d99a000 */ - 0.947287976728, /* 0x0.f28176fff */ - 0.949856162070, /* 0x0.f329c5fff */ - 0.952431440345, /* 0x0.f3d28bfff */ - 0.955013573175, /* 0x0.f47bc5000 */ - 0.957603693021, /* 0x0.f52584000 */ - 0.960199773321, /* 0x0.f5cfa7000 */ - 0.962801992906, /* 0x0.f67a31000 */ - 0.965413510788, /* 0x0.f72556fff */ - 0.968030691152, /* 0x0.f7d0dc000 */ - 0.970655620084, /* 0x0.f87ce2fff */ - 0.973290979849, /* 0x0.f92998fff */ - 0.975926160805, /* 0x0.f9d64bfff */ - 0.978571653370, /* 0x0.fa83ac000 */ - 0.981225252139, /* 0x0.fb3193fff */ - 0.983885228626, /* 0x0.fbdfe6fff */ - 0.986552715296, /* 0x0.fc8eb7fff */ - 0.989228487027, /* 0x0.fd3e14000 */ - 0.991909801964, /* 0x0.fdedcd000 */ - 0.994601726545, /* 0x0.fe9e38000 */ - 0.997297704209, /* 0x0.ff4ee6fff */ - 1.000000000000, /* 0x1.000000000 */ - 1.002710938457, /* 0x1.00b1aa000 */ - 1.005429744692, /* 0x1.0163d7ffe */ - 1.008155703526, /* 0x1.02167dffe */ - 1.010888457284, /* 0x1.02c995fff */ - 1.013629436498, /* 0x1.037d38000 */ - 1.016377568250, /* 0x1.043152000 */ - 1.019134163841, /* 0x1.04e5f9ffe */ - 1.021896362316, /* 0x1.059b00000 */ - 1.024668931945, /* 0x1.0650b3ffe */ - 1.027446627635, /* 0x1.0706be001 */ - 1.030234098408, /* 0x1.07bd6bffe */ - 1.033023953416, /* 0x1.087441ffe */ - 1.035824656494, /* 0x1.092bce000 */ - 1.038632392900, /* 0x1.09e3d0001 */ - 1.041450142840, /* 0x1.0a9c79ffe */ - 1.044273972530, /* 0x1.0b558a001 */ - 1.047105550795, /* 0x1.0c0f1c001 */ - 1.049944162390, /* 0x1.0cc924001 */ - 1.052791833895, /* 0x1.0d83c4001 */ - 1.055645227426, /* 0x1.0e3ec3fff */ - 1.058507919326, /* 0x1.0efa60001 */ - 1.061377286898, /* 0x1.0fb66bfff */ - 1.064254641510, /* 0x1.1072fdffe */ - 1.067140102389, /* 0x1.113018000 */ - 1.070034146304, /* 0x1.11edc1fff */ - 1.072937250162, /* 0x1.12ac04001 */ - 1.075843691823, /* 0x1.136a7dfff */ - 1.078760385496, /* 0x1.1429a3ffe */ - 1.081685543070, /* 0x1.14e958000 */ - 1.084618330005, /* 0x1.15a98c000 */ - 1.087556362176, /* 0x1.166a18001 */ - 1.090508937863, /* 0x1.172b98001 */ - 1.093464612954, /* 0x1.17ed4bfff */ - 1.096430182434, /* 0x1.18afa5ffe */ - 1.099401354802, /* 0x1.19725e000 */ - 1.102381587017, /* 0x1.1a35adfff */ - 1.105370759965, /* 0x1.1af994000 */ - 1.108367800686, /* 0x1.1bbdfdffe */ - 1.111373305331, /* 0x1.1c82f6000 */ - 1.114387035385, /* 0x1.1d4878001 */ - 1.117408752440, /* 0x1.1e0e7ffff */ - 1.120437502874, /* 0x1.1ed4fe000 */ - 1.123474478729, /* 0x1.1f9c06000 */ - 1.126521706601, /* 0x1.2063ba001 */ - 1.129574775716, /* 0x1.212bd0001 */ - 1.132638812065, /* 0x1.21f49e000 */ - 1.135709524130, /* 0x1.22bddbffe */ - 1.138789534565, /* 0x1.2387b5fff */ - 1.141876101508, /* 0x1.2451fe000 */ - 1.144971728301, /* 0x1.251cddffe */ - 1.148077130296, /* 0x1.25e861ffe */ - 1.151189923305, /* 0x1.26b462001 */ - 1.154312610610, /* 0x1.278107ffe */ - 1.157440662410, /* 0x1.284e08001 */ - 1.160578370109, /* 0x1.291baa001 */ - 1.163725256932, /* 0x1.29e9e6000 */ - 1.166879892324, /* 0x1.2ab8a3ffe */ - 1.170044302935, /* 0x1.2b8805fff */ - 1.173205971694, /* 0x1.2c5739ffe */ - 1.176397800428, /* 0x1.2d2867ffe */ - 1.179586529747, /* 0x1.2df962001 */ - 1.182784795737, /* 0x1.2ecafbffe */ - 1.185991406414, /* 0x1.2f9d21ffe */ - 1.189206838636, /* 0x1.306fdc001 */ - 1.192430973067, /* 0x1.314328000 */ - 1.195664167430, /* 0x1.32170c001 */ - 1.198906540890, /* 0x1.32eb8a001 */ - 1.202157497408, /* 0x1.33c098000 */ - 1.205416083326, /* 0x1.349625fff */ - 1.208683252332, /* 0x1.356c43fff */ - 1.211961269402, /* 0x1.364318001 */ - 1.215246438983, /* 0x1.371a64000 */ - 1.218539118740, /* 0x1.37f22dffe */ - 1.221847295770, /* 0x1.38cafc000 */ - 1.225158572187, /* 0x1.39a3fdfff */ - 1.228481650325, /* 0x1.3a7dc5ffe */ - 1.231811761846, /* 0x1.3b5803fff */ - 1.235149741144, /* 0x1.3c32c5ffe */ - 1.238499879811, /* 0x1.3d0e53ffe */ - 1.241858124726, /* 0x1.3dea69fff */ - 1.245225191102, /* 0x1.3ec713fff */ - 1.248601436624, /* 0x1.3fa458000 */ - 1.251975655584, /* 0x1.40817a001 */ - 1.255380749731, /* 0x1.4160a2001 */ - 1.258783102010, /* 0x1.423f9bffe */ - 1.262198328973, /* 0x1.431f6e000 */ - 1.265619754780, /* 0x1.43ffa7fff */ - 1.269052743928, /* 0x1.44e0a4001 */ - 1.272490739830, /* 0x1.45c1f4000 */ - 1.275942921659, /* 0x1.46a432001 */ - 1.279397487615, /* 0x1.478697ffe */ - 1.282870173427, /* 0x1.486a2dffe */ - 1.286346316319, /* 0x1.494dfdffe */ - 1.289836049094, /* 0x1.4a32b2001 */ - 1.293333172770, /* 0x1.4b17e1ffe */ - 1.296839594835, /* 0x1.4bfdadfff */ - 1.300354957560, /* 0x1.4ce40fffe */ - 1.303882122055, /* 0x1.4dcb38001 */ - 1.307417988757, /* 0x1.4eb2f1ffe */ - 1.310960650439, /* 0x1.4f9b1dfff */ - 1.314516782746, /* 0x1.50842bfff */ - 1.318079948424, /* 0x1.516daffff */ - 1.321653246888, /* 0x1.5257de000 */ - 1.325237751030, /* 0x1.5342c8001 */ - 1.328829526907, /* 0x1.542e2c000 */ - 1.332433700535, /* 0x1.551a5fffe */ - 1.336045145966, /* 0x1.56070dffe */ - 1.339667558645, /* 0x1.56f473ffe */ - 1.343300342533, /* 0x1.57e287ffe */ - 1.346941947961, /* 0x1.58d130001 */ - 1.350594043714, /* 0x1.59c087ffe */ - 1.354256033883, /* 0x1.5ab085fff */ - 1.357932448365, /* 0x1.5ba175ffe */ - 1.361609339707, /* 0x1.5c926dfff */ - 1.365299344044, /* 0x1.5d8441ffe */ - 1.369003057507, /* 0x1.5e76fc001 */ - 1.372714757920, /* 0x1.5f6a3c000 */ - 1.376437187179, /* 0x1.605e2fffe */ - 1.380165219333, /* 0x1.615282001 */ - 1.383909463864, /* 0x1.6247e3ffe */ - 1.387661933907, /* 0x1.633dd0000 */ - 1.391424179060, /* 0x1.64345fffe */ - 1.395197510706, /* 0x1.652ba9fff */ - 1.399006724329, /* 0x1.66254dffe */ - 1.402773022651, /* 0x1.671c22000 */ - 1.406576037403, /* 0x1.68155dfff */ - 1.410389423392, /* 0x1.690f48001 */ -}; diff --git a/sysdeps/libm-ieee754/w_acos.c b/sysdeps/libm-ieee754/w_acos.c deleted file mode 100644 index 5a1158ea7a..0000000000 --- a/sysdeps/libm-ieee754/w_acos.c +++ /dev/null @@ -1,48 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrap_acos(x) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - double __acos(double x) /* wrapper acos */ -#else - double __acos(x) /* wrapper acos */ - double x; -#endif -{ -#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 -} -weak_alias (__acos, acos) -#ifdef NO_LONG_DOUBLE -strong_alias (__acos, __acosl) -weak_alias (__acos, acosl) -#endif diff --git a/sysdeps/libm-ieee754/w_acosf.c b/sysdeps/libm-ieee754/w_acosf.c deleted file mode 100644 index 28260ddd3e..0000000000 --- a/sysdeps/libm-ieee754/w_acosf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* w_acosf.c -- float version of w_acos.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrap_acosf(x) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - float __acosf(float x) /* wrapper acosf */ -#else - float __acosf(x) /* wrapper acosf */ - float x; -#endif -{ -#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 -} -weak_alias (__acosf, acosf) diff --git a/sysdeps/libm-ieee754/w_acosh.c b/sysdeps/libm-ieee754/w_acosh.c deleted file mode 100644 index 2b5d60f7ea..0000000000 --- a/sysdeps/libm-ieee754/w_acosh.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper acosh(x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __acosh(double x) /* wrapper acosh */ -#else - double __acosh(x) /* wrapper acosh */ - double x; -#endif -{ -#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 -} -weak_alias (__acosh, acosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__acosh, __acoshl) -weak_alias (__acosh, acoshl) -#endif diff --git a/sysdeps/libm-ieee754/w_acoshf.c b/sysdeps/libm-ieee754/w_acoshf.c deleted file mode 100644 index f701983dc2..0000000000 --- a/sysdeps/libm-ieee754/w_acoshf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* w_acoshf.c -- float version of w_acosh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - * - */ - -#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 - -/* - * wrapper acoshf(x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __acoshf(float x) /* wrapper acoshf */ -#else - float __acoshf(x) /* wrapper acoshf */ - float x; -#endif -{ -#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 -} -weak_alias (__acoshf, acoshf) diff --git a/sysdeps/libm-ieee754/w_acoshl.c b/sysdeps/libm-ieee754/w_acoshl.c deleted file mode 100644 index a37d4c15d9..0000000000 --- a/sysdeps/libm-ieee754/w_acoshl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_acoshl.c -- long double version of w_acosh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper acoshl(x) - */ - -#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 -{ -#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 -} -weak_alias (__acoshl, acoshl) diff --git a/sysdeps/libm-ieee754/w_acosl.c b/sysdeps/libm-ieee754/w_acosl.c deleted file mode 100644 index cd9cecf2f9..0000000000 --- a/sysdeps/libm-ieee754/w_acosl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* w_acosl.c -- long double version of w_acos.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrap_acosl(x) - */ - -#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 -{ -#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 -} -weak_alias (__acosl, acosl) diff --git a/sysdeps/libm-ieee754/w_asin.c b/sysdeps/libm-ieee754/w_asin.c deleted file mode 100644 index a7ca4ef9fd..0000000000 --- a/sysdeps/libm-ieee754/w_asin.c +++ /dev/null @@ -1,49 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper asin(x) - */ - - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - double __asin(double x) /* wrapper asin */ -#else - double __asin(x) /* wrapper asin */ - double x; -#endif -{ -#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 -} -weak_alias (__asin, asin) -#ifdef NO_LONG_DOUBLE -strong_alias (__asin, __asinl) -weak_alias (__asin, asinl) -#endif diff --git a/sysdeps/libm-ieee754/w_asinf.c b/sysdeps/libm-ieee754/w_asinf.c deleted file mode 100644 index d7f7a253b0..0000000000 --- a/sysdeps/libm-ieee754/w_asinf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* w_asinf.c -- float version of w_asin.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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) - */ - - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - float __asinf(float x) /* wrapper asinf */ -#else - float __asinf(x) /* wrapper asinf */ - float x; -#endif -{ -#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 -} -weak_alias (__asinf, asinf) diff --git a/sysdeps/libm-ieee754/w_asinl.c b/sysdeps/libm-ieee754/w_asinl.c deleted file mode 100644 index 0ac3038e95..0000000000 --- a/sysdeps/libm-ieee754/w_asinl.c +++ /dev/null @@ -1,49 +0,0 @@ -/* w_asinl.c -- long double version of w_asin.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper asinl(x) - */ - - -#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 -{ -#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 -} -weak_alias (__asinl, asinl) diff --git a/sysdeps/libm-ieee754/w_atan2.c b/sysdeps/libm-ieee754/w_atan2.c deleted file mode 100644 index 801baa2347..0000000000 --- a/sysdeps/libm-ieee754/w_atan2.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper atan2(y,x) - */ - -#include "math.h" -#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 -{ -#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 -} -weak_alias (__atan2, atan2) -#ifdef NO_LONG_DOUBLE -strong_alias (__atan2, __atan2l) -weak_alias (__atan2, atan2l) -#endif diff --git a/sysdeps/libm-ieee754/w_atan2f.c b/sysdeps/libm-ieee754/w_atan2f.c deleted file mode 100644 index 09caa06f00..0000000000 --- a/sysdeps/libm-ieee754/w_atan2f.c +++ /dev/null @@ -1,46 +0,0 @@ -/* w_atan2f.c -- float version of w_atan2.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper atan2f(y,x) - */ - -#include "math.h" -#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 -{ -#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 -} -weak_alias (__atan2f, atan2f) diff --git a/sysdeps/libm-ieee754/w_atan2l.c b/sysdeps/libm-ieee754/w_atan2l.c deleted file mode 100644 index 2897c8c5f9..0000000000 --- a/sysdeps/libm-ieee754/w_atan2l.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_atan2l.c -- long double version of w_atan2.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper atan2l(y,x) - */ - -#include "math.h" -#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 -{ -#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 -} -weak_alias (__atan2l, atan2l) diff --git a/sysdeps/libm-ieee754/w_atanh.c b/sysdeps/libm-ieee754/w_atanh.c deleted file mode 100644 index e7995b1830..0000000000 --- a/sysdeps/libm-ieee754/w_atanh.c +++ /dev/null @@ -1,52 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper atanh(x) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - double __atanh(double x) /* wrapper atanh */ -#else - double __atanh(x) /* wrapper atanh */ - double x; -#endif -{ -#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 -} -weak_alias (__atanh, atanh) -#ifdef NO_LONG_DOUBLE -strong_alias (__atanh, __atanhl) -weak_alias (__atanh, atanhl) -#endif diff --git a/sysdeps/libm-ieee754/w_atanhf.c b/sysdeps/libm-ieee754/w_atanhf.c deleted file mode 100644 index 0b24f2c71a..0000000000 --- a/sysdeps/libm-ieee754/w_atanhf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* w_atanhf.c -- float version of w_atanh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper atanhf(x) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - float __atanhf(float x) /* wrapper atanhf */ -#else - float __atanhf(x) /* wrapper atanhf */ - float x; -#endif -{ -#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 -} -weak_alias (__atanhf, atanhf) diff --git a/sysdeps/libm-ieee754/w_atanhl.c b/sysdeps/libm-ieee754/w_atanhl.c deleted file mode 100644 index d675fc6fe7..0000000000 --- a/sysdeps/libm-ieee754/w_atanhl.c +++ /dev/null @@ -1,52 +0,0 @@ -/* w_atanhl.c -- long double version of w_atanh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper atanhl(x) - */ - -#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 -{ -#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 -} -weak_alias (__atanhl, atanhl) diff --git a/sysdeps/libm-ieee754/w_cosh.c b/sysdeps/libm-ieee754/w_cosh.c deleted file mode 100644 index 8db25c868c..0000000000 --- a/sysdeps/libm-ieee754/w_cosh.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)w_cosh.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. - * ==================================================== - */ - -#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) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __cosh(double x) /* wrapper cosh */ -#else - double __cosh(x) /* wrapper cosh */ - double x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_cosh(x); -#else - double z; - z = __ieee754_cosh(x); - if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; - if(fabs(x)>7.10475860073943863426e+02) { - return __kernel_standard(x,x,5); /* cosh overflow */ - } else - return z; -#endif -} -weak_alias (__cosh, cosh) -#ifdef NO_LONG_DOUBLE -strong_alias (__cosh, __coshl) -weak_alias (__cosh, coshl) -#endif diff --git a/sysdeps/libm-ieee754/w_coshf.c b/sysdeps/libm-ieee754/w_coshf.c deleted file mode 100644 index 53ca84108e..0000000000 --- a/sysdeps/libm-ieee754/w_coshf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_coshf.c -- float version of w_cosh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_coshf(x); -#else - float z; - z = __ieee754_coshf(x); - if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; - if(fabsf(x)>(float)8.9415985107e+01) { - /* cosh overflow */ - return (float)__kernel_standard((double)x,(double)x,105); - } else - return z; -#endif -} -weak_alias (__coshf, coshf) diff --git a/sysdeps/libm-ieee754/w_coshl.c b/sysdeps/libm-ieee754/w_coshl.c deleted file mode 100644 index 343d5724b9..0000000000 --- a/sysdeps/libm-ieee754/w_coshl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_acoshl.c -- long double version of w_acosh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper coshl(x) - */ - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_coshl(x); -#else - long double z; - z = __ieee754_coshl(x); - if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; - if(fabsl(x)>7.10475860073943863426e+02) { - return __kernel_standard(x,x,205); /* cosh overflow */ - } else - return z; -#endif -} -weak_alias (__coshl, coshl) diff --git a/sysdeps/libm-ieee754/w_drem.c b/sysdeps/libm-ieee754/w_drem.c deleted file mode 100644 index 9e2b1e7472..0000000000 --- a/sysdeps/libm-ieee754/w_drem.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * drem() wrapper for remainder(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include - -double -__drem(x, y) - double x, y; -{ - return __remainder(x, y); -} -weak_alias (__drem, drem) -#ifdef NO_LONG_DOUBLE -strong_alias (__drem, __dreml) -weak_alias (__drem, dreml) -#endif diff --git a/sysdeps/libm-ieee754/w_dremf.c b/sysdeps/libm-ieee754/w_dremf.c deleted file mode 100644 index b740ea304c..0000000000 --- a/sysdeps/libm-ieee754/w_dremf.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * dremf() wrapper for remainderf(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include "math.h" -#include "math_private.h" - -float -__dremf(x, y) - float x, y; -{ - return __remainderf(x, y); -} -weak_alias (__dremf, dremf) diff --git a/sysdeps/libm-ieee754/w_dreml.c b/sysdeps/libm-ieee754/w_dreml.c deleted file mode 100644 index aa73eedc49..0000000000 --- a/sysdeps/libm-ieee754/w_dreml.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * dreml() wrapper for remainderl(). - * - * Written by J.T. Conklin, - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - * Placed into the Public Domain, 1994. - */ - -#include - -long double -__dreml(x, y) - long double x, y; -{ - return __remainderl(x, y); -} -weak_alias (__dreml, dreml) diff --git a/sysdeps/libm-ieee754/w_exp.c b/sysdeps/libm-ieee754/w_exp.c deleted file mode 100644 index 445c5788d2..0000000000 --- a/sysdeps/libm-ieee754/w_exp.c +++ /dev/null @@ -1,58 +0,0 @@ -/* @(#)w_exp.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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: w_exp.c,v 1.6 1995/05/10 20:48:51 jtc Exp $"; -#endif - -/* - * wrapper exp(x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ -u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ - -#ifdef __STDC__ - double __exp(double x) /* wrapper exp */ -#else - double __exp(x) /* wrapper exp */ - double x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_exp(x); -#else - double z; - z = __ieee754_exp(x); - if(_LIB_VERSION == _IEEE_) return z; - if(__finite(x)) { - if(x>o_threshold) - return __kernel_standard(x,x,6); /* exp overflow */ - else if(x. - */ - -/* - * ==================================================== - * 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) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -o_threshold= 3.0825471555991674389672e+02, -u_threshold= -3.2360724533877978485251e+02; - -#ifdef __STDC__ - double __exp10(double x) /* wrapper exp10 */ -#else - double __exp10(x) /* wrapper exp10 */ - double x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_exp10(x); -#else - double z; - z = __ieee754_exp10(x); - if(_LIB_VERSION == _IEEE_) return z; - if(__finite(x)) { - if(x>o_threshold) - return __kernel_standard(x,x,46); /* exp10 overflow */ - else if(x. - */ - -/* - * ==================================================== - * 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) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -o_threshold= 3.853183944498959298709e+01, -u_threshold= -4.515449934959717928174e+01; - -#ifdef __STDC__ - float __exp10f(float x) /* wrapper exp10f */ -#else - float __exp10f(x) /* wrapper exp10f */ - float x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_exp10f(x); -#else - float z; - z = __ieee754_exp10f(x); - if(_LIB_VERSION == _IEEE_) return z; - if(__finitef(x)) { - if(x>o_threshold) - /* exp overflow */ - return (float)__kernel_standard((double)x,(double)x,146); - else if(xo_threshold) - return __kernel_standard(x,x,246); /* exp10 overflow */ - else if(x -#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; - -double -__exp2 (double x) /* wrapper exp2 */ -{ -#ifdef _IEEE_LIBM - 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 -strong_alias (__exp2, __expl2) -weak_alias (__exp2, expl2) -#endif diff --git a/sysdeps/libm-ieee754/w_exp2f.c b/sysdeps/libm-ieee754/w_exp2f.c deleted file mode 100644 index d2c340db3f..0000000000 --- a/sysdeps/libm-ieee754/w_exp2f.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * wrapper exp2f(x) - */ - -#include -#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; - -float -__exp2f (float x) /* wrapper exp2f */ -{ -#ifdef _IEEE_LIBM - 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/sysdeps/libm-ieee754/w_exp2l.c b/sysdeps/libm-ieee754/w_exp2l.c deleted file mode 100644 index 965e9bf3e4..0000000000 --- a/sysdeps/libm-ieee754/w_exp2l.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * wrapper exp2l(x) - */ - -#include -#include "math.h" -#include "math_private.h" - -static const long double o_threshold = (long double) LDBL_MAX_EXP; -static const long double u_threshold = (long double) LDBL_MIN_EXP; - -long double -__exp2l (long double x) /* wrapper exp2l */ -{ -#ifdef _IEEE_LIBM - 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/sysdeps/libm-ieee754/w_expf.c b/sysdeps/libm-ieee754/w_expf.c deleted file mode 100644 index ad38fac0f3..0000000000 --- a/sysdeps/libm-ieee754/w_expf.c +++ /dev/null @@ -1,59 +0,0 @@ -/* w_expf.c -- float version of w_exp.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: w_expf.c,v 1.3 1995/05/10 20:48:53 jtc Exp $"; -#endif - -/* - * wrapper expf(x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -o_threshold= 8.8721679688e+01, /* 0x42b17180 */ -u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ - -#ifdef __STDC__ - float __expf(float x) /* wrapper expf */ -#else - float __expf(x) /* wrapper expf */ - float x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_expf(x); -#else - float z; - z = __ieee754_expf(x); - if(_LIB_VERSION == _IEEE_) return z; - if(__finitef(x)) { - if(x>o_threshold) - /* exp overflow */ - return (float)__kernel_standard((double)x,(double)x,106); - else if(xo_threshold) - return __kernel_standard(x,x,206); /* exp overflow */ - else if(xX_TLOSS) { - return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */ - } else - return z; -#endif -} -#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 -{ -#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 -} -#ifdef NO_LONG_DOUBLE -strong_alias (y0, y0l) -#endif diff --git a/sysdeps/libm-ieee754/w_j0f.c b/sysdeps/libm-ieee754/w_j0f.c deleted file mode 100644 index 32e2eebb56..0000000000 --- a/sysdeps/libm-ieee754/w_j0f.c +++ /dev/null @@ -1,74 +0,0 @@ -/* w_j0f.c -- float version of w_j0.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper j0f(float x), y0f(float x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float j0f(float x) /* wrapper j0f */ -#else - float j0f(x) /* wrapper j0f */ - float x; -#endif -{ -#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 -} - -#ifdef __STDC__ - float y0f(float x) /* wrapper y0f */ -#else - float y0f(x) /* wrapper y0f */ - float x; -#endif -{ -#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 -} diff --git a/sysdeps/libm-ieee754/w_j0l.c b/sysdeps/libm-ieee754/w_j0l.c deleted file mode 100644 index b74d9ddcff..0000000000 --- a/sysdeps/libm-ieee754/w_j0l.c +++ /dev/null @@ -1,73 +0,0 @@ -/* w_j0l.c -- long double version of w_j0.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper j0l(long double x), y0l(long double x) - */ - -#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 -{ -#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 -} - -#ifdef __STDC__ - long double y0l(long double x) /* wrapper y0l */ -#else - long double y0l(x) /* wrapper y0 */ - long double x; -#endif -{ -#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 -} diff --git a/sysdeps/libm-ieee754/w_j1.c b/sysdeps/libm-ieee754/w_j1.c deleted file mode 100644 index 39fe8543b1..0000000000 --- a/sysdeps/libm-ieee754/w_j1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper of j1,y1 - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double j1(double x) /* wrapper j1 */ -#else - double j1(x) /* wrapper j1 */ - double x; -#endif -{ -#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 -} -#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 -{ -#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 -} -#ifdef NO_LONG_DOUBLE -strong_alias (y1, y1l) -#endif diff --git a/sysdeps/libm-ieee754/w_j1f.c b/sysdeps/libm-ieee754/w_j1f.c deleted file mode 100644 index 2a7c8db819..0000000000 --- a/sysdeps/libm-ieee754/w_j1f.c +++ /dev/null @@ -1,75 +0,0 @@ -/* w_j1f.c -- float version of w_j1.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper of j1f,y1f - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float j1f(float x) /* wrapper j1f */ -#else - float j1f(x) /* wrapper j1f */ - float x; -#endif -{ -#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 -} - -#ifdef __STDC__ - float y1f(float x) /* wrapper y1f */ -#else - float y1f(x) /* wrapper y1f */ - float x; -#endif -{ -#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 -} diff --git a/sysdeps/libm-ieee754/w_j1l.c b/sysdeps/libm-ieee754/w_j1l.c deleted file mode 100644 index 49a486cf8e..0000000000 --- a/sysdeps/libm-ieee754/w_j1l.c +++ /dev/null @@ -1,74 +0,0 @@ -/* w_j1l.c -- long double version of w_j1.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper of j1l,y1l - */ - -#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 -{ -#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 -} - -#ifdef __STDC__ - long double y1l(long double x) /* wrapper y1l */ -#else - long double y1l(x) /* wrapper y1l */ - long double x; -#endif -{ -#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 -} diff --git a/sysdeps/libm-ieee754/w_jn.c b/sysdeps/libm-ieee754/w_jn.c deleted file mode 100644 index 85fc383fb7..0000000000 --- a/sysdeps/libm-ieee754/w_jn.c +++ /dev/null @@ -1,99 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * 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 nx, a continued fraction approximation to - * j(n,x)/j(n-1,x) is evaluated and then backward - * recursion is used starting from a supposed value - * for j(n,x). The resulting value of j(0,x) is - * compared with the actual value to correct the - * supposed value of j(n,x). - * - * yn(n,x) is similar in all respects, except - * that forward recursion is used for all - * values of n>1. - * - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double jn(int n, double x) /* wrapper jn */ -#else - double jn(n,x) /* wrapper jn */ - double x; int n; -#endif -{ -#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 -} -#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 -{ -#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 -} -#ifdef NO_LONG_DOUBLE -strong_alias (yn, ynl) -#endif diff --git a/sysdeps/libm-ieee754/w_jnf.c b/sysdeps/libm-ieee754/w_jnf.c deleted file mode 100644 index 63ad335573..0000000000 --- a/sysdeps/libm-ieee754/w_jnf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* w_jnf.c -- float version of w_jn.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -#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 -{ -#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 -} - -#ifdef __STDC__ - float ynf(int n, float x) /* wrapper ynf */ -#else - float ynf(n,x) /* wrapper ynf */ - float x; int n; -#endif -{ -#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 -} diff --git a/sysdeps/libm-ieee754/w_jnl.c b/sysdeps/libm-ieee754/w_jnl.c deleted file mode 100644 index 866e3cdb00..0000000000 --- a/sysdeps/libm-ieee754/w_jnl.c +++ /dev/null @@ -1,96 +0,0 @@ -/* w_jnl.c -- long double version of w_jn.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * 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 nx, a continued fraction approximation to - * j(n,x)/j(n-1,x) is evaluated and then backward - * recursion is used starting from a supposed value - * for j(n,x). The resulting value of j(0,x) is - * compared with the actual value to correct the - * supposed value of j(n,x). - * - * yn(n,x) is similar in all respects, except - * that forward recursion is used for all - * values of n>1. - * - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double jnl(int n, long double x) /* wrapper jnl */ -#else - long double jnl(n,x) /* wrapper jnl */ - long double x; int n; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_jnl(n,x); -#else - long double z; - z = __ieee754_jnl(n,x); - if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; - if(fabsl(x)>X_TLOSS) { - return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ - } else - return z; -#endif -} - -#ifdef __STDC__ - long double ynl(int n, long double x) /* wrapper ynl */ -#else - long double ynl(n,x) /* wrapper ynl */ - long double x; int n; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_ynl(n,x); -#else - long double z; - z = __ieee754_ynl(n,x); - if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; - if(x <= 0.0){ - if(x==0.0) - /* d= -one/(x-x); */ - return __kernel_standard((double)n,x,212); - else - /* d = zero/(x-x); */ - return __kernel_standard((double)n,x,213); - } - if(x>X_TLOSS) { - return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */ - } else - return z; -#endif -} diff --git a/sysdeps/libm-ieee754/w_lgamma.c b/sysdeps/libm-ieee754/w_lgamma.c deleted file mode 100644 index 0cc62a1784..0000000000 --- a/sysdeps/libm-ieee754/w_lgamma.c +++ /dev/null @@ -1,60 +0,0 @@ -/* @(#)w_lgamma.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. - * ==================================================== - */ - -#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. - * - * Method: call __ieee754_lgamma_r - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __lgamma(double x) -#else - double __lgamma(x) - double x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_lgamma_r(x,&signgam); -#else - double y; - int local_signgam; - y = __ieee754_lgamma_r(x,&local_signgam); - if (_LIB_VERSION != _ISOC_) - /* ISO C 9x 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 -} -weak_alias (__lgamma, lgamma) -strong_alias (__lgamma, __gamma) -weak_alias (__gamma, gamma) -#ifdef NO_LONG_DOUBLE -strong_alias (__lgamma, __lgammal) -weak_alias (__lgamma, lgammal) -strong_alias (__gamma, __gammal) -weak_alias (__gamma, gammal) -#endif diff --git a/sysdeps/libm-ieee754/w_lgamma_r.c b/sysdeps/libm-ieee754/w_lgamma_r.c deleted file mode 100644 index f3e7d821e2..0000000000 --- a/sysdeps/libm-ieee754/w_lgamma_r.c +++ /dev/null @@ -1,51 +0,0 @@ -/* @(#)wr_lgamma.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. - * ==================================================== - */ - -#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) - */ - -#include "math.h" -#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 -{ -#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 -} -weak_alias (__lgamma_r, lgamma_r) -#ifdef NO_LONG_DOUBLE -strong_alias (__lgamma_r, __lgammal_r) -weak_alias (__lgamma_r, lgammal_r) -#endif diff --git a/sysdeps/libm-ieee754/w_lgammaf.c b/sysdeps/libm-ieee754/w_lgammaf.c deleted file mode 100644 index 4c64aa4130..0000000000 --- a/sysdeps/libm-ieee754/w_lgammaf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* w_lgammaf.c -- float version of w_lgamma.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_lgammaf_r(x,&signgam); -#else - float y; - int local_signgam; - y = __ieee754_lgammaf_r(x,&local_signgam); - if (_LIB_VERSION != _ISOC_) - /* ISO C 9x 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 -} -weak_alias (__lgammaf, lgammaf) -strong_alias (__lgammaf, __gammaf) -weak_alias (__gammaf, gammaf) diff --git a/sysdeps/libm-ieee754/w_lgammaf_r.c b/sysdeps/libm-ieee754/w_lgammaf_r.c deleted file mode 100644 index 66962acc7e..0000000000 --- a/sysdeps/libm-ieee754/w_lgammaf_r.c +++ /dev/null @@ -1,52 +0,0 @@ -/* w_lgammaf_r.c -- float version of w_lgamma_r.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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) - */ - -#include "math.h" -#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 -{ -#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 -} -weak_alias (__lgammaf_r, lgammaf_r) diff --git a/sysdeps/libm-ieee754/w_lgammal.c b/sysdeps/libm-ieee754/w_lgammal.c deleted file mode 100644 index 41104e47e4..0000000000 --- a/sysdeps/libm-ieee754/w_lgammal.c +++ /dev/null @@ -1,58 +0,0 @@ -/* w_lgammal.c -- long double version of w_lgamma.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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. - * - * Method: call __ieee754_lgammal_r - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - long double __lgammal(long double x) -#else - long double __lgammal(x) - long double x; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_lgammal_r(x,&signgam); -#else - long double y; - int local_signgam; - y = __ieee754_lgammal_r(x,&local_signgam); - if (_LIB_VERSION != _ISOC_) - /* ISO C 9x 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 -} -weak_alias (__lgammal, lgammal) -strong_alias (__lgammal, __gammal) -weak_alias (__gammal, gammal) diff --git a/sysdeps/libm-ieee754/w_lgammal_r.c b/sysdeps/libm-ieee754/w_lgammal_r.c deleted file mode 100644 index 71f5c005d0..0000000000 --- a/sysdeps/libm-ieee754/w_lgammal_r.c +++ /dev/null @@ -1,52 +0,0 @@ -/* w_lgammal_r.c -- long double version of w_lgamma_r.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper long double lgammal_r(long double x, int *signgamp) - */ - -#include "math.h" -#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 -{ -#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 -} -weak_alias (__lgammal_r, lgammal_r) diff --git a/sysdeps/libm-ieee754/w_log.c b/sysdeps/libm-ieee754/w_log.c deleted file mode 100644 index 5f0af79731..0000000000 --- a/sysdeps/libm-ieee754/w_log.c +++ /dev/null @@ -1,48 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper log(x) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - double __log(double x) /* wrapper log */ -#else - double __log(x) /* wrapper log */ - double x; -#endif -{ -#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 -} -weak_alias (__log, log) -#ifdef NO_LONG_DOUBLE -strong_alias (__log, __logl) -weak_alias (__log, logl) -#endif diff --git a/sysdeps/libm-ieee754/w_log10.c b/sysdeps/libm-ieee754/w_log10.c deleted file mode 100644 index 8a0a70bdf7..0000000000 --- a/sysdeps/libm-ieee754/w_log10.c +++ /dev/null @@ -1,51 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper log10(X) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - double __log10(double x) /* wrapper log10 */ -#else - double __log10(x) /* wrapper log10 */ - double x; -#endif -{ -#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 -} -weak_alias (__log10, log10) -#ifdef NO_LONG_DOUBLE -strong_alias (__log10, __log10l) -weak_alias (__log10, log10l) -#endif diff --git a/sysdeps/libm-ieee754/w_log10f.c b/sysdeps/libm-ieee754/w_log10f.c deleted file mode 100644 index f90cb0cabc..0000000000 --- a/sysdeps/libm-ieee754/w_log10f.c +++ /dev/null @@ -1,52 +0,0 @@ -/* w_log10f.c -- float version of w_log10.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper log10f(X) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - float __log10f(float x) /* wrapper log10f */ -#else - float __log10f(x) /* wrapper log10f */ - float x; -#endif -{ -#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 -} -weak_alias (__log10f, log10f) diff --git a/sysdeps/libm-ieee754/w_log10l.c b/sysdeps/libm-ieee754/w_log10l.c deleted file mode 100644 index 0d0861689d..0000000000 --- a/sysdeps/libm-ieee754/w_log10l.c +++ /dev/null @@ -1,51 +0,0 @@ -/* w_log10l.c -- long double version of w_log10.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper log10l(X) - */ - -#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 -{ -#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 -} -weak_alias (__log10l, log10l) diff --git a/sysdeps/libm-ieee754/w_logf.c b/sysdeps/libm-ieee754/w_logf.c deleted file mode 100644 index 9eabe4b34c..0000000000 --- a/sysdeps/libm-ieee754/w_logf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* w_logf.c -- float version of w_log.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper logf(x) - */ - -#include "math.h" -#include "math_private.h" - - -#ifdef __STDC__ - float __logf(float x) /* wrapper logf */ -#else - float __logf(x) /* wrapper logf */ - float x; -#endif -{ -#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 -} -weak_alias (__logf, logf) diff --git a/sysdeps/libm-ieee754/w_logl.c b/sysdeps/libm-ieee754/w_logl.c deleted file mode 100644 index bb979c26c3..0000000000 --- a/sysdeps/libm-ieee754/w_logl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* w_logl.c -- long double version of w_log.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper logl(x) - */ - -#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 -{ -#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 -} -weak_alias (__logl, logl) diff --git a/sysdeps/libm-ieee754/w_pow.c b/sysdeps/libm-ieee754/w_pow.c deleted file mode 100644 index 5850651a1a..0000000000 --- a/sysdeps/libm-ieee754/w_pow.c +++ /dev/null @@ -1,70 +0,0 @@ - - -/* @(#)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. - * ==================================================== - */ - -/* - * wrapper pow(x,y) return x**y - */ - -#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 -{ -#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) */ - else - return __kernel_standard(x,y,43); /* pow(+0.0,negative) */ - } - 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 */ - } - } - if(z==0.0&&__finite(x)&&__finite(y)) - return __kernel_standard(x,y,22); /* pow underflow */ - return z; -#endif -} -weak_alias (__pow, pow) -#ifdef NO_LONG_DOUBLE -strong_alias (__pow, __powl) -weak_alias (__pow, powl) -#endif diff --git a/sysdeps/libm-ieee754/w_powf.c b/sysdeps/libm-ieee754/w_powf.c deleted file mode 100644 index 32196fd89f..0000000000 --- a/sysdeps/libm-ieee754/w_powf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* w_powf.c -- float version of w_pow.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper powf(x,y) return x**y - */ - -#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 -{ -#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); - else - return (float)__kernel_standard((double)x,(double)y,143); - } - 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); - } - } - if(z==(float)0.0&&__finitef(x)&&__finitef(y)) - /* powf underflow */ - return (float)__kernel_standard((double)x,(double)y,122); - return z; -#endif -} -weak_alias (__powf, powf) diff --git a/sysdeps/libm-ieee754/w_powl.c b/sysdeps/libm-ieee754/w_powl.c deleted file mode 100644 index 17feb9fc61..0000000000 --- a/sysdeps/libm-ieee754/w_powl.c +++ /dev/null @@ -1,68 +0,0 @@ -/* w_powl.c -- long double version of w_pow.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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 powl(x,y) return x**y - */ - -#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 -{ -#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) */ - else - return __kernel_standard(x,y,243); /* pow(+0.0,negative) */ - } - 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 */ - } - } - if(z==0.0&&__finitel(x)&&__finitel(y)) - return __kernel_standard(x,y,222); /* pow underflow */ - return z; -#endif -} -weak_alias (__powl, powl) diff --git a/sysdeps/libm-ieee754/w_remainder.c b/sysdeps/libm-ieee754/w_remainder.c deleted file mode 100644 index d85a3febce..0000000000 --- a/sysdeps/libm-ieee754/w_remainder.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper remainder(x,p) - */ - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_remainder(x,y); -#else - double z; - z = __ieee754_remainder(x,y); - if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z; - if(y==0.0) - return __kernel_standard(x,y,28); /* remainder(x,0) */ - else - return z; -#endif -} -weak_alias (__remainder, remainder) -#ifdef NO_LONG_DOUBLE -strong_alias (__remainder, __remainderl) -weak_alias (__remainder, remainderl) -#endif diff --git a/sysdeps/libm-ieee754/w_remainderf.c b/sysdeps/libm-ieee754/w_remainderf.c deleted file mode 100644 index 58255f5be5..0000000000 --- a/sysdeps/libm-ieee754/w_remainderf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_remainderf.c -- float version of w_remainder.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper remainderf(x,p) - */ - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_remainderf(x,y); -#else - float z; - z = __ieee754_remainderf(x,y); - if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z; - if(y==(float)0.0) - /* remainder(x,0) */ - return (float)__kernel_standard((double)x,(double)y,128); - else - return z; -#endif -} -weak_alias (__remainderf, remainderf) diff --git a/sysdeps/libm-ieee754/w_remainderl.c b/sysdeps/libm-ieee754/w_remainderl.c deleted file mode 100644 index 284140174d..0000000000 --- a/sysdeps/libm-ieee754/w_remainderl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* w_remainderl.c -- long double version of w_remainder.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper remainderl(x,p) - */ - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_remainderl(x,y); -#else - long double z; - z = __ieee754_remainderl(x,y); - if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z; - if(y==0.0) - return __kernel_standard(x,y,228); /* remainder(x,0) */ - else - return z; -#endif -} -weak_alias (__remainderl, remainderl) diff --git a/sysdeps/libm-ieee754/w_scalb.c b/sysdeps/libm-ieee754/w_scalb.c deleted file mode 100644 index e5c407a435..0000000000 --- a/sysdeps/libm-ieee754/w_scalb.c +++ /dev/null @@ -1,65 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper scalb(double x, double fn) is provide for - * passing various standard test suite. One - * should use scalbn() instead. - */ - -#include "math.h" -#include "math_private.h" - -#include - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_scalb(x,fn); -#else - double z; - z = __ieee754_scalb(x,fn); - if(_LIB_VERSION == _IEEE_) 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 -} -weak_alias (__scalb, scalb) -#ifdef NO_LONG_DOUBLE -strong_alias (__scalb, __scalbl) -weak_alias (__scalb, scalbl) -#endif diff --git a/sysdeps/libm-ieee754/w_scalbf.c b/sysdeps/libm-ieee754/w_scalbf.c deleted file mode 100644 index 488a717503..0000000000 --- a/sysdeps/libm-ieee754/w_scalbf.c +++ /dev/null @@ -1,66 +0,0 @@ -/* w_scalbf.c -- float version of w_scalb.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper scalbf(float x, float fn) is provide for - * passing various standard test suite. One - * should use scalbn() instead. - */ - -#include "math.h" -#include "math_private.h" - -#include - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_scalbf(x,fn); -#else - float z; - z = __ieee754_scalbf(x,fn); - if(_LIB_VERSION == _IEEE_) 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 -} -weak_alias (__scalbf, scalbf) diff --git a/sysdeps/libm-ieee754/w_scalbl.c b/sysdeps/libm-ieee754/w_scalbl.c deleted file mode 100644 index 3ca8d9601d..0000000000 --- a/sysdeps/libm-ieee754/w_scalbl.c +++ /dev/null @@ -1,65 +0,0 @@ -/* w_scalbl.c -- long double version of w_scalb.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper scalbl(long double x, long double fn) is provide for - * passing various standard test suite. One - * should use scalbnl() instead. - */ - -#include "math.h" -#include "math_private.h" - -#include - -#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 -{ -#ifdef _IEEE_LIBM - return __ieee754_scalbl(x,fn); -#else - long double z; - z = __ieee754_scalbl(x,fn); - if(_LIB_VERSION == _IEEE_) 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 -} -weak_alias (__scalbl, scalbl) diff --git a/sysdeps/libm-ieee754/w_sinh.c b/sysdeps/libm-ieee754/w_sinh.c deleted file mode 100644 index 9b34cd1873..0000000000 --- a/sysdeps/libm-ieee754/w_sinh.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)w_sinh.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. - * ==================================================== - */ - -#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) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __sinh(double x) /* wrapper sinh */ -#else - double __sinh(x) /* wrapper sinh */ - double x; -#endif -{ -#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 -} -weak_alias (__sinh, sinh) -#ifdef NO_LONG_DOUBLE -strong_alias (__sinh, __sinhl) -weak_alias (__sinh, sinhl) -#endif diff --git a/sysdeps/libm-ieee754/w_sinhf.c b/sysdeps/libm-ieee754/w_sinhf.c deleted file mode 100644 index a69cf3072d..0000000000 --- a/sysdeps/libm-ieee754/w_sinhf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_sinhf.c -- float version of w_sinh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 -{ -#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 -} -weak_alias (__sinhf, sinhf) diff --git a/sysdeps/libm-ieee754/w_sinhl.c b/sysdeps/libm-ieee754/w_sinhl.c deleted file mode 100644 index 3e93cc598d..0000000000 --- a/sysdeps/libm-ieee754/w_sinhl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_sinhl.c -- long double version of w_sinh.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper sinhl(x) - */ - -#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 -{ -#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 -} -weak_alias (__sinhl, sinhl) diff --git a/sysdeps/libm-ieee754/w_sqrt.c b/sysdeps/libm-ieee754/w_sqrt.c deleted file mode 100644 index be15d959ea..0000000000 --- a/sysdeps/libm-ieee754/w_sqrt.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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. - * ==================================================== - */ - -#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 - -/* - * wrapper sqrt(x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __sqrt(double x) /* wrapper sqrt */ -#else - double __sqrt(x) /* wrapper sqrt */ - double x; -#endif -{ -#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 -} -weak_alias (__sqrt, sqrt) -#ifdef NO_LONG_DOUBLE -strong_alias (__sqrt, __sqrtl) -weak_alias (__sqrt, sqrtl) -#endif diff --git a/sysdeps/libm-ieee754/w_sqrtf.c b/sysdeps/libm-ieee754/w_sqrtf.c deleted file mode 100644 index f5ccc73868..0000000000 --- a/sysdeps/libm-ieee754/w_sqrtf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_sqrtf.c -- float version of w_sqrt.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 - -/* - * wrapper sqrtf(x) - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - float __sqrtf(float x) /* wrapper sqrtf */ -#else - float sqrt(x) /* wrapper sqrtf */ - float x; -#endif -{ -#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 -} -weak_alias (__sqrtf, sqrtf) diff --git a/sysdeps/libm-ieee754/w_sqrtl.c b/sysdeps/libm-ieee754/w_sqrtl.c deleted file mode 100644 index 5873ce93ab..0000000000 --- a/sysdeps/libm-ieee754/w_sqrtl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* w_sqrtl.c -- long double version of w_sqrt.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * wrapper sqrtl(x) - */ - -#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 -{ -#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 -} -weak_alias (__sqrtl, sqrtl) diff --git a/sysdeps/libm-ieee754/w_tgamma.c b/sysdeps/libm-ieee754/w_tgamma.c deleted file mode 100644 index 2adbc2e14d..0000000000 --- a/sysdeps/libm-ieee754/w_tgamma.c +++ /dev/null @@ -1,54 +0,0 @@ -/* @(#)w_gamma.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. - * ==================================================== - */ - -#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. - */ - -#include "math.h" -#include "math_private.h" - -#ifdef __STDC__ - double __tgamma(double x) -#else - double __tgamma(x) - double x; -#endif -{ - double y; - int local_signgam; - y = __ieee754_gamma_r(x,&local_signgam); - if (local_signgam < 0) y = -y; -#ifdef _IEEE_LIBM - return y; -#else - if(_LIB_VERSION == _IEEE_) return y; - - if(!__finite(y)&&__finite(x)) { - if(__floor(x)==x&&x<=0.0) - return __kernel_standard(x,x,41); /* tgamma pole */ - else - return __kernel_standard(x,x,40); /* tgamma overflow */ - } - return y; -#endif -} -weak_alias (__tgamma, tgamma) -#ifdef NO_LONG_DOUBLE -strong_alias (__tgamma, __tgammal) -weak_alias (__tgamma, tgammal) -#endif diff --git a/sysdeps/libm-ieee754/w_tgammaf.c b/sysdeps/libm-ieee754/w_tgammaf.c deleted file mode 100644 index 152f4be156..0000000000 --- a/sysdeps/libm-ieee754/w_tgammaf.c +++ /dev/null @@ -1,50 +0,0 @@ -/* w_gammaf.c -- float version of w_gamma.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#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 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; - - if(!__finitef(y)&&__finitef(x)) { - if(__floorf(x)==x&&x<=(float)0.0) - /* tgammaf pole */ - return (float)__kernel_standard((double)x,(double)x,141); - else - /* tgammaf overflow */ - return (float)__kernel_standard((double)x,(double)x,140); - } - return y; -#endif -} -weak_alias (__tgammaf, tgammaf) diff --git a/sysdeps/libm-ieee754/w_tgammal.c b/sysdeps/libm-ieee754/w_tgammal.c deleted file mode 100644 index 9efce2bb95..0000000000 --- a/sysdeps/libm-ieee754/w_tgammal.c +++ /dev/null @@ -1,53 +0,0 @@ -/* w_gammal.c -- long double version of w_gamma.c. - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - */ - -/* - * ==================================================== - * 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. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* long double gammal(double x) - * Return the Gamma function of x. - */ - -#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 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; - - if(!__finitel(y)&&__finitel(x)) { - if(__floorl(x)==x&&x<=0.0) - return __kernel_standard(x,x,241); /* tgamma pole */ - else - return __kernel_standard(x,x,240); /* tgamma overflow */ - } - return y; -#endif -} -weak_alias (__tgammal, tgammal) diff --git a/sysdeps/m68k/Implies b/sysdeps/m68k/Implies index 09dd873973..b64e753525 100644 --- a/sysdeps/m68k/Implies +++ b/sysdeps/m68k/Implies @@ -1,3 +1,5 @@ wordsize-32 # 68k uses IEEE 754 floating point. -ieee754 +ieee754/flt-32 +ieee754/dbl-64 +ieee754/ldbl-96 diff --git a/sysdeps/m68k/printf_fphex.c b/sysdeps/m68k/printf_fphex.c index 0e68b16b77..d021a090ab 100644 --- a/sysdeps/m68k/printf_fphex.c +++ b/sysdeps/m68k/printf_fphex.c @@ -1,2 +1,2 @@ #define LONG_DOUBLE_DENORM_BIAS IEEE854_LONG_DOUBLE_BIAS -#include +#include diff --git a/sysdeps/m68k/strtold.c b/sysdeps/m68k/strtold.c index dd7fbce195..f756488275 100644 --- a/sysdeps/m68k/strtold.c +++ b/sysdeps/m68k/strtold.c @@ -1,2 +1,2 @@ #define DENORM_EXP (MIN_EXP - 1) -#include +#include diff --git a/sysdeps/mips/Implies b/sysdeps/mips/Implies index 5aeb9ae460..9f60963329 100644 --- a/sysdeps/mips/Implies +++ b/sysdeps/mips/Implies @@ -1,3 +1,4 @@ wordsize-32 # MIPS uses IEEE 754 floating point. -ieee754 +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/mips/mips64/Implies b/sysdeps/mips/mips64/Implies index 06b9091f3b..25106df989 100644 --- a/sysdeps/mips/mips64/Implies +++ b/sysdeps/mips/mips64/Implies @@ -1,3 +1,4 @@ wordsize-64 # MIPS uses IEEE 754 floating point. -ieee754 +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/powerpc/Implies b/sysdeps/powerpc/Implies index d6acf04a82..780c4e2467 100644 --- a/sysdeps/powerpc/Implies +++ b/sysdeps/powerpc/Implies @@ -1,2 +1,3 @@ wordsize-32 -ieee754 +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/sparc/Implies b/sysdeps/sparc/Implies deleted file mode 100644 index da719e1707..0000000000 --- a/sysdeps/sparc/Implies +++ /dev/null @@ -1,2 +0,0 @@ -# SPARC uses IEEE 754 floating point. -ieee754 diff --git a/sysdeps/sparc/bits/wordsize.h b/sysdeps/sparc/bits/wordsize.h deleted file mode 100644 index 2ad12e1e7f..0000000000 --- a/sysdeps/sparc/bits/wordsize.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Determine the wordsize from the preprocessor defines. */ - -#if defined __sparc_v9__ || defined __arch64__ || defined __sparcv9 -# define __WORDSIZE 64 -#else -# define __WORDSIZE 32 -#endif diff --git a/sysdeps/sparc/fpu/bits/mathdef.h b/sysdeps/sparc/fpu/bits/mathdef.h index c1727b66bb..5294ad4720 100644 --- a/sysdeps/sparc/fpu/bits/mathdef.h +++ b/sysdeps/sparc/fpu/bits/mathdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999 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 @@ -20,6 +20,8 @@ # error "Never use directly; include instead" #endif +#include + /* FIXME! This file describes properties of the compiler, not the machine; it should not be part of libc! */ @@ -74,7 +76,12 @@ typedef double double_t; #endif /* ISO C 9X */ #ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. The disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 + +# if __WORDSIZE == 32 +/* Signal that in 32bit ABI we do not really have a `long double'. + The disables the declaration of all the `long double' function + variants. */ +# define __NO_LONG_DOUBLE_MATH 1 +# endif + #endif diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h new file mode 100644 index 0000000000..9017be3544 --- /dev/null +++ b/sysdeps/sparc/fpu/bits/mathinline.h @@ -0,0 +1,211 @@ +/* Inline math functions for SPARC. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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 directly; include instead." +#endif + +#include + +#if defined __GNUC__ + +#ifdef __USE_ISOC9X + +#if __WORDSIZE == 32 + +# define __unordered_cmp(x, y) \ + (__extension__ \ + ({ unsigned __r; \ + if (sizeof(x) == 4 && sizeof(y) == 4) \ + { \ + float __x = (x); float __y = (y); \ + __asm__("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x), \ + "f" (__y) : "cc"); \ + } \ + else \ + { \ + double __x = (x); double __y = (y); \ + __asm__("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x), \ + "f" (__y) : "cc"); \ + } \ + __r; })) + +# define isgreater(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (2 << 10)) +# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & (1 << 10)) == 0) +# define isless(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (1 << 10)) +# define islessequal(x, y) ((__unordered_cmp (x, y) & (2 << 10)) == 0) +# define islessgreater(x, y) (((__unordered_cmp (x, y) + (1 << 10)) & (2 << 10)) != 0) +# define isunordered(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (3 << 10)) + +#else /* sparc64 */ + +# define __unordered_v9cmp(x, y, op, qop) \ + (__extension__ \ + ({ unsigned __r; \ + if (sizeof(x) == 4 && sizeof(y) == 4) \ + { \ + float __x = (x); float __y = (y); \ + __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" ## op ## "\t%%fcc3,1,%0" \ + : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ + } \ + else if (sizeof(x) <= 8 && sizeof(y) <= 8) \ + { \ + double __x = (x); double __y = (y); \ + __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" ## op ## "\t%%fcc3,1,%0" \ + : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ + } \ + else \ + { \ + long double __x = (x); long double __y = (y); \ + extern int _Qp_cmp(const long double *a, const long double *b); \ + __r = qop; \ + } \ + __r; })) + +# define isgreater(x, y) __unordered_v9cmp(x, y, "g", _Qp_cmp (&__x, &__y) == 2) +# define isgreaterequal(x, y) __unordered_v9cmp(x, y, "ge", (_Qp_cmp (&__x, &__y) & 1) == 0) +# define isless(x, y) __unordered_v9cmp(x, y, "l", _Qp_cmp (&__x, &__y) == 1) +# define islessequal(x, y) __unordered_v9cmp(x, y, "le", (_Qp_cmp (&__x, &__y) & 2) == 0) +# define islessgreater(x, y) __unordered_v9cmp(x, y, "lg", ((_Qp_cmp (&__x, &__y) + 1) & 2) != 0) +# define isunordered(x, y) __unordered_v9cmp(x, y, "u", _Qp_cmp (&__x, &__y) == 3) + +#endif /* sparc64 */ + +#endif /* __USE_ISOC9X */ + +#if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) && defined __OPTIMIZE__ + +#ifdef __cplusplus +# define __MATH_INLINE __inline +#else +# define __MATH_INLINE extern __inline +#endif /* __cplusplus */ + +/* The gcc, version 2.7 or below, has problems with all this inlining + code. So disable it for this version of the compiler. */ + +# if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7)) + /* Test for negative number. Used in the signbit() macro. */ +__MATH_INLINE int +__signbitf (float __x) +{ + __extension__ union { float __f; int __i; } __u = { __f: __x }; + return __u.__i < 0; +} + +__MATH_INLINE int +__signbit (double __x) +{ + __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; + return __u.__i[0] < 0; +} + +__MATH_INLINE int +__signbitl (long double __x) +{ + if (sizeof(long double) == 8) + { + __extension__ union { long double __l; int __i[2]; } __u = { __l: __x }; + return __u.__i[0] < 0; + } + else + { + __extension__ union { long double __l; int __i[4]; } __u = { __l: __x }; + return __u.__i[0] < 0; + } +} + +__MATH_INLINE double +sqrt(double __x) +{ + register double __r; + __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +__MATH_INLINE float +sqrtf(float __x) +{ + register float __r; + __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +#if __WORDSIZE == 64 +__MATH_INLINE long double +sqrtl(long double __x) +{ + long double __r; + extern void _Qp_sqrt(long double *, __const__ long double *); + _Qp_sqrt(&__r, &__x); + return __r; +} +#endif /* sparc64 */ + +/* This code is used internally in the GNU libc. */ +#ifdef __LIBC_INTERNAL_MATH_INLINES +__MATH_INLINE double +__ieee754_sqrt(double __x) +{ + register double __r; + __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +__MATH_INLINE float +__ieee754_sqrtf(float __x) +{ + register float __r; + __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +#if __WORDSIZE == 64 +__MATH_INLINE long double +__ieee754_sqrtl(long double __x) +{ + long double __r; + extern void _Qp_sqrt(long double *, __const__ long double *); + _Qp_sqrt(&__r, &__x); + return __r; +} +#endif /* sparc64 */ +#endif /* __LIBC_INTERNAL_MATH_INLINES */ +#endif /* gcc 2.8+ */ + +#ifdef __USE_ISOC9X + +__MATH_INLINE double fdim (double __x, double __y); +__MATH_INLINE double +fdim (double __x, double __y) +{ + return __x < __y ? 0 : __x - __y; +} + +__MATH_INLINE float fdimf (float __x, float __y); +__MATH_INLINE float +fdimf (float __x, float __y) +{ + return __x < __y ? 0 : __x - __y; +} + +#endif /* __USE_ISOC9X */ +#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ +#endif /* __GNUC__ */ diff --git a/sysdeps/sparc/sparc32/Implies b/sysdeps/sparc/sparc32/Implies index 39a34c5f57..ae984a8257 100644 --- a/sysdeps/sparc/sparc32/Implies +++ b/sysdeps/sparc/sparc32/Implies @@ -1 +1,4 @@ wordsize-32 +# SPARC uses IEEE 754 floating point. +ieee754/flt-32 +ieee754/dbl-64 diff --git a/sysdeps/sparc/sparc32/bits/wordsize.h b/sysdeps/sparc/sparc32/bits/wordsize.h new file mode 100644 index 0000000000..2ad12e1e7f --- /dev/null +++ b/sysdeps/sparc/sparc32/bits/wordsize.h @@ -0,0 +1,7 @@ +/* Determine the wordsize from the preprocessor defines. */ + +#if defined __sparc_v9__ || defined __arch64__ || defined __sparcv9 +# define __WORDSIZE 64 +#else +# define __WORDSIZE 32 +#endif diff --git a/sysdeps/sparc/sparc32/fpu/bits/huge_val.h b/sysdeps/sparc/sparc32/fpu/bits/huge_val.h new file mode 100644 index 0000000000..673d6f0532 --- /dev/null +++ b/sysdeps/sparc/sparc32/fpu/bits/huge_val.h @@ -0,0 +1,100 @@ +/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity). + Used by and functions for overflow. + Copyright (C) 1992, 1995, 1996, 1997, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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 directly; include instead." +#endif + +#include +#include + +/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ + +#ifdef __GNUC__ + +# define HUGE_VAL \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ + { __l: 0x7ff0000000000000ULL }).__d) + +#else /* not GCC */ + +typedef union { unsigned char __c[8]; double __d; } __huge_val_t; + +# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } + +static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; +# define HUGE_VAL (__huge_val.__d) + +#endif /* GCC. */ + + +/* ISO C 9X extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ + +#ifdef __USE_ISOC9X + +# ifdef __GNUC__ + +# define HUGE_VALF \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ + { __l: 0x7f800000UL }).__d) + +# else /* not GCC */ + +typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; + +# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } + +static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; +# define HUGE_VALF (__huge_valf.__f) + +# endif /* GCC. */ + +#if __WORDSIZE == 32 + +/* Sparc32 has IEEE 754 64bit long double */ +# define HUGE_VALL HUGE_VAL + +#else + +/* Sparc64 uses IEEE 754 128bit long double */ + +#ifdef __GNUC__ + +# define HUGE_VALL \ + (__extension__ \ + ((union { struct { unsigned long __h, __l; } __i; long double __d; }) \ + { __i: { __h: 0x7fff000000000000UL, __l: 0 } }).__d) + +#else /* not GCC */ + +typedef union { unsigned char __c[16]; long double __d; } __huge_vall_t; + +# define __HUGE_VALL_bytes { 0x7f, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes }; +# define HUGE_VALL (__huge_vall.__d) + +#endif /* GCC. */ + +#endif + +#endif /* __USE_ISOC9X. */ diff --git a/sysdeps/sparc/sparc64/Implies b/sysdeps/sparc/sparc64/Implies index a8cae95f9d..5b293ba87d 100644 --- a/sysdeps/sparc/sparc64/Implies +++ b/sysdeps/sparc/sparc64/Implies @@ -1 +1,5 @@ wordsize-64 +# SPARC uses IEEE 754 floating point. +ieee754/flt-32 +ieee754/dbl-64 +ieee754/ldbl-128 diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile index 656274d75c..312e59ea21 100644 --- a/sysdeps/sparc/sparc64/Makefile +++ b/sysdeps/sparc/sparc64/Makefile @@ -1,11 +1,2 @@ -# The Sparc`long double' is a distinct type we support. -#long-double-fcts = yes - -# But the support for ieee quads is so bad we just skip the whole thing. -# XXX This is only a temporary hack. -omit-long-double-fcts = yes - -# But we do need these few functions to even link stdio proggies -ifeq ($(subdir),math) -sysdep_routines += s_isinfl s_isnanl s_finitel s_signbitl -endif +# The Sparc `long double' is a distinct type we support. +long-double-fcts = yes diff --git a/sysdeps/sparc/sparc64/addmul_1.S b/sysdeps/sparc/sparc64/addmul_1.S index 6782db77df..db8f53656e 100644 --- a/sysdeps/sparc/sparc64/addmul_1.S +++ b/sysdeps/sparc/sparc64/addmul_1.S @@ -1,7 +1,7 @@ /* SPARC v9 __mpn_addmul_1 -- Multiply a limb vector with a single limb and add the product to a second limb vector. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -31,29 +31,26 @@ ENTRY(__mpn_addmul_1) - !#PROLOGUE# 0 save %sp,-192,%sp - !#PROLOGUE# 1 sub %g0,%i2,%o7 - sllx %o7,3,%g5 - sub %i1,%g5,%o3 - sub %i0,%g5,%o4 mov 0,%o0 ! zero cy_limb - + sllx %o7,3,%o7 + sethi %hi(0x80000000),%o2 srl %i3,0,%o1 ! extract low 32 bits of s2_limb + sub %i1,%o7,%o3 srlx %i3,32,%i3 ! extract high 32 bits of s2_limb - mov 1,%o2 - sllx %o2,32,%o2 ! o2 = 0x100000000 + sub %i0,%o7,%o4 + add %o2,%o2,%o2 ! o2 = 0x100000000 ! hi ! ! mid-1 ! ! mid-2 ! ! lo ! 1: - sllx %o7,3,%g1 - ldx [%o3+%g1],%g5 + ldx [%o3+%o7],%g5 srl %g5,0,%i0 ! zero hi bits + ldx [%o4+%o7],%l1 srlx %g5,32,%g5 mulx %o1,%i0,%i4 ! lo product mulx %i3,%i0,%i1 ! mid-1 product @@ -64,25 +61,24 @@ ENTRY(__mpn_addmul_1) addcc %i1,%l2,%i1 ! add mid products mov 0,%l0 ! we need the carry from that add... movcs %xcc,%o2,%l0 ! ...compute it and... + sllx %i1,32,%i0 ! align low bits of mid product add %i5,%l0,%i5 ! ...add to bit 32 of the hi product - sllx %i1,32,%i0 ! align low bits of mid product srl %i4,0,%g5 ! zero high 32 bits of lo product add %i0,%g5,%i0 ! combine into low 64 bits of result srlx %i1,32,%i1 ! extract high bits of mid product... + addcc %i0,%o0,%i0 ! add cy_limb to low 64 bits of result add %i5,%i1,%i1 ! ...and add them to the high result - addcc %i0,%o0,%i0 ! add cy_limb to low 64 bits of result mov 0,%g5 movcs %xcc,1,%g5 - add %o7,1,%o7 - ldx [%o4+%g1],%l1 addcc %l1,%i0,%i0 - movcs %xcc,1,%g5 - stx %i0,[%o4+%g1] - brnz %o7,1b + stx %i0,[%o4+%o7] + add %g5,1,%l1 + movcs %xcc,%l1,%g5 + addcc %o7,8,%o7 + bne,pt %xcc,1b add %i1,%g5,%o0 ! compute new cy_limb - mov %o0,%i0 jmpl %i7+8, %g0 - restore + restore %o0,%g0,%o0 END(__mpn_addmul_1) diff --git a/sysdeps/sparc/sparc64/bits/wordsize.h b/sysdeps/sparc/sparc64/bits/wordsize.h new file mode 100644 index 0000000000..2ad12e1e7f --- /dev/null +++ b/sysdeps/sparc/sparc64/bits/wordsize.h @@ -0,0 +1,7 @@ +/* Determine the wordsize from the preprocessor defines. */ + +#if defined __sparc_v9__ || defined __arch64__ || defined __sparcv9 +# define __WORDSIZE 64 +#else +# define __WORDSIZE 32 +#endif diff --git a/sysdeps/sparc/sparc64/fpu/bits/huge_val.h b/sysdeps/sparc/sparc64/fpu/bits/huge_val.h new file mode 100644 index 0000000000..673d6f0532 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/bits/huge_val.h @@ -0,0 +1,100 @@ +/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity). + Used by and functions for overflow. + Copyright (C) 1992, 1995, 1996, 1997, 1999 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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 directly; include instead." +#endif + +#include +#include + +/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ + +#ifdef __GNUC__ + +# define HUGE_VAL \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ + { __l: 0x7ff0000000000000ULL }).__d) + +#else /* not GCC */ + +typedef union { unsigned char __c[8]; double __d; } __huge_val_t; + +# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } + +static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; +# define HUGE_VAL (__huge_val.__d) + +#endif /* GCC. */ + + +/* ISO C 9X extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ + +#ifdef __USE_ISOC9X + +# ifdef __GNUC__ + +# define HUGE_VALF \ + (__extension__ \ + ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ + { __l: 0x7f800000UL }).__d) + +# else /* not GCC */ + +typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; + +# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } + +static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; +# define HUGE_VALF (__huge_valf.__f) + +# endif /* GCC. */ + +#if __WORDSIZE == 32 + +/* Sparc32 has IEEE 754 64bit long double */ +# define HUGE_VALL HUGE_VAL + +#else + +/* Sparc64 uses IEEE 754 128bit long double */ + +#ifdef __GNUC__ + +# define HUGE_VALL \ + (__extension__ \ + ((union { struct { unsigned long __h, __l; } __i; long double __d; }) \ + { __i: { __h: 0x7fff000000000000UL, __l: 0 } }).__d) + +#else /* not GCC */ + +typedef union { unsigned char __c[16]; long double __d; } __huge_vall_t; + +# define __HUGE_VALL_bytes { 0x7f, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes }; +# define HUGE_VALL (__huge_vall.__d) + +#endif /* GCC. */ + +#endif + +#endif /* __USE_ISOC9X. */ -- cgit v1.2.1