aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/Dist2
-rw-r--r--sysdeps/ieee754/bits/nan.h10
-rw-r--r--sysdeps/ieee754/dbl-64/Dist33
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c7
-rw-r--r--sysdeps/ieee754/dbl-64/e_pow.c22
-rw-r--r--sysdeps/ieee754/dbl-64/halfulp.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_llrint.c23
-rw-r--r--sysdeps/ieee754/dbl-64/s_lrint.c21
-rw-r--r--sysdeps/ieee754/dbl-64/s_sincos.c6
-rw-r--r--sysdeps/ieee754/flt-32/Dist1
-rw-r--r--sysdeps/ieee754/flt-32/e_atan2f.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_expf.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_hypotf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_expm1f.c11
-rw-r--r--sysdeps/ieee754/flt-32/s_llrintf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_lrintf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_nextafterf.c20
-rw-r--r--sysdeps/ieee754/ldbl-128/Dist2
-rw-r--r--sysdeps/ieee754/ldbl-128/e_powl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/printf_fphex.c4
-rw-r--r--sysdeps/ieee754/ldbl-128/s_llrintl.c10
-rw-r--r--sysdeps/ieee754/ldbl-128/s_lrintl.c23
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nextafterl.c18
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttoward.c23
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/Makefile5
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acoshl.c69
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acosl.c328
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_asinl.c265
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atan2l.c124
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atanhl.c79
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_coshl.c90
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_expl.c257
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_fmodl.c145
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c58
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_hypotl.c131
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_j0l.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_j1l.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_jnl.c402
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log10l.c258
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log2l.c250
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_logl.c281
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_powl.c441
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c278
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_remainderl.c78
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sinhl.c84
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c109
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/ieee754.h210
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_cosl.c146
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sincosl.c182
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sinl.c150
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_tanl.c164
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c175
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/math_ldbl.h181
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c152
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/printf_fphex.c141
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_asinhl.c67
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_atanl.c234
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ceill.c91
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_copysignl.c45
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cosl.c88
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cprojl.c54
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c87
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ctanl.c88
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_erfl.c958
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_expm1l.c160
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_fabsl.c43
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_finitel.c45
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_floorl.c85
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c95
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_frexpl.c92
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c63
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_isinfl.c35
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_isnanl.c43
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llrintl.c147
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llroundl.c127
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_log1pl.c257
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_logbl.c47
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lrintl.c162
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lroundl.c142
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_modfl.c94
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c125
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c105
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c89
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_remquol.c111
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_rintl.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_roundl.c98
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c105
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c109
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_signbitl.c37
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_sincosl.c72
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_sinl.c84
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanhl.c90
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanl.c78
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_truncl.c102
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/strtold_l.c63
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/t_sincosl.c694
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/w_expl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_asinhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_atanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_cbrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_ceill.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_copysignl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_cosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_erfl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_expm1l.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_fabsl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_finitel.c17
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_floorl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c10
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_frexpl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_ilogbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_isinfl.c16
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_isnanl.c16
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_llrintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_llroundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_log1pl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_logbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_lrintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_lroundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_modfl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nextafterl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nexttoward.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_remquol.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_rintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_roundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_scalblnl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_scalbnl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_signbitl.c11
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_sincosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_sinl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_tanhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_tanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_truncl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/strtold_l.c63
-rw-r--r--sysdeps/ieee754/ldbl-64-128/w_expl.c5
-rw-r--r--sysdeps/ieee754/ldbl-96/printf_fphex.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/s_erfl.c8
-rw-r--r--sysdeps/ieee754/ldbl-96/s_llrintl.c10
-rw-r--r--sysdeps/ieee754/ldbl-96/s_lrintl.c17
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nextafterl.c20
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttoward.c27
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttowardf.c28
-rw-r--r--sysdeps/ieee754/ldbl-96/strtold_l.c4
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile43
-rw-r--r--sysdeps/ieee754/ldbl-opt/Versions87
-rw-r--r--sysdeps/ieee754/ldbl-opt/cabs.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cabsl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/carg.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cargl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cimag.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cimagl.c6
-rwxr-xr-xsysdeps/ieee754/ldbl-opt/configure69
-rw-r--r--sysdeps/ieee754/ldbl-opt/configure.in19
-rw-r--r--sysdeps/ieee754/ldbl-opt/conj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/conjl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/creal.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/creall.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c3
-rw-r--r--sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h52
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-acos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-acosh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asinh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atan2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atanh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cabs.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cacos.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-carg.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-casin.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-casinh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-catan.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-catanh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ccos.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ceil.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cimag.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-clog.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-clog10.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.c852
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.h87
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-conj.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-copysign.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cosh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cpow.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cproj.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-creal.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csin.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csinh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ctan.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-drem.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-erf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-erfc.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-expm1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fabs.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fdim.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-finite.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-floor.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmax.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmod.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-frexp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-gamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-hypot.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-isinf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-isnan.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-j0.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-j1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-jn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-llrint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-llround.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log1p.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-logb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lrint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lround.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-modf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c13
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-pow.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-pow10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-remainder.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-remquo.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-rint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-round.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-signbit.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-significand.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sincos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sinh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtold.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c20
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-syslog.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tanh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-trunc.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-y0.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-y1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-yn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_asinh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_atan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacos.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacosh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacoshl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacosl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catan.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cbrt.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccos.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccosh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccoshl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccosl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ceil.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexp.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexpl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10.c7
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10l.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clogl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_copysign.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpow.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpowl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cproj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cprojl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrt.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrtl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctan.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_erf.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_expm1.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fabs.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fdim.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fdiml.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_finite.c18
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_floor.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fma.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmal.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmax.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmaxl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmin.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fminl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_frexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ilogb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_isinf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_isnan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ldexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ldexpl.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_llrint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_llround.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_log1p.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_logb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_lrint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_lround.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_modf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nearbyint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nextafter.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c85
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_remquo.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_rint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_round.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_scalbln.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_scalbn.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_significand.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_significandl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_sin.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_sincos.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_tan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_tanh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_trunc.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acos.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acoshl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asin.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asinl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_cosh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_coshl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_drem.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_dreml.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmod.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmodl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypot.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypotl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jn.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jnl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgamma.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgamma_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_logl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_pow.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_powl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainder.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainderl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_scalb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_scalbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrt.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgamma.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgammal.c5
465 files changed, 15036 insertions, 230 deletions
diff --git a/sysdeps/ieee754/Dist b/sysdeps/ieee754/Dist
deleted file mode 100644
index 94cc5c9..0000000
--- a/sysdeps/ieee754/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-support.c
-ieee754.h
diff --git a/sysdeps/ieee754/bits/nan.h b/sysdeps/ieee754/bits/nan.h
index 4d4062c..bae97f2 100644
--- a/sysdeps/ieee754/bits/nan.h
+++ b/sysdeps/ieee754/bits/nan.h
@@ -1,5 +1,5 @@
/* `NAN' constant for IEEE 754 machines.
- Copyright (C) 1992, 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1992,1996,1997,1999,2004,2006 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
@@ -26,13 +26,13 @@
#if __GNUC_PREREQ(3,3)
-# define NAN (__builtin_nanf(""))
+# define NAN (__builtin_nanf (""))
-#elif defined__GNUC__
+#elif defined __GNUC__
# define NAN \
- (__extension__ \
- ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
+ (__extension__ \
+ ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
{ __l: 0x7fc00000UL }).__d)
#else
diff --git a/sysdeps/ieee754/dbl-64/Dist b/sysdeps/ieee754/dbl-64/Dist
deleted file mode 100644
index 4920cae..0000000
--- a/sysdeps/ieee754/dbl-64/Dist
+++ /dev/null
@@ -1,33 +0,0 @@
-asincos.tbl
-atnat.h
-atnat2.h
-branred.h
-dla.h
-doasin.h
-dosincos.h
-MathLib.h
-mpa.h
-mpa2.h
-mpatan.h
-mpexp.h
-mplog.h
-mpsqrt.h
-mydefs.h
-powtwo.tbl
-root.tbl
-sincos.tbl
-sincos32.h
-t_exp2.h
-uasncs.h
-uatan.tbl
-uexp.h
-uexp.tbl
-ulog.h
-ulog.tbl
-upow.h
-upow.tbl
-urem.h
-uroot.h
-usncs.h
-utan.h
-utan.tbl
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index 397acd1..ce6368b 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -1,5 +1,5 @@
/* Double-precision floating point 2^x.
- Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@@ -37,6 +37,11 @@
#include "t_exp2.h"
+/* XXX I know the assembler generates a warning about incorrect section
+ attributes. But without the attribute here the compiler places the
+ constants in the .data section. Ideally the constant is placed in
+ .rodata.cst8 so that it can be merged, but gcc sucks, it ICEs when
+ we try to force this section on it. --drepper */
static const volatile double TWO1023 = 8.988465674311579539e+307;
static const volatile double TWOM1000 = 9.3326361850321887899e-302;
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index d9bd8b4..1e159f2 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -106,20 +106,28 @@ double __ieee754_pow(double x, double y) {
else
return y < 0 ? 1.0/ABS(x) : 0.0; /* return 0 */
}
+
+ qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */
+ qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */
+
+ if (qx >= 0x7ff00000 && (qx > 0x7ff00000 || u.i[LOW_HALF] != 0)) return NaNQ.x;
+ if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0))
+ return x == 1.0 ? 1.0 : NaNQ.x;
+
/* if x<0 */
if (u.i[HIGH_HALF] < 0) {
k = checkint(y);
if (k==0) {
- if ((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] == 0) {
+ if (qy == 0x7ff00000) {
if (x == -1.0) return 1.0;
else if (x > -1.0) return v.i[HIGH_HALF] < 0 ? INF.x : 0.0;
else return v.i[HIGH_HALF] < 0 ? 0.0 : INF.x;
}
- else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0)
+ else if (qx == 0x7ff00000)
return y < 0 ? 0.0 : INF.x;
return NaNQ.x; /* y not integer and x<0 */
}
- else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0)
+ else if (qx == 0x7ff00000)
{
if (k < 0)
return y < 0 ? nZERO.x : nINF.x;
@@ -129,14 +137,6 @@ double __ieee754_pow(double x, double y) {
return (k==1)?__ieee754_pow(-x,y):-__ieee754_pow(-x,y); /* if y even or odd */
}
/* x>0 */
- qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */
- qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */
-
- if (qx > 0x7ff00000 || (qx == 0x7ff00000 && u.i[LOW_HALF] != 0)) return NaNQ.x;
- /* if 0<x<2^-0x7fe */
- if (qy > 0x7ff00000 || (qy == 0x7ff00000 && v.i[LOW_HALF] != 0))
- return x == 1.0 ? 1.0 : NaNQ.x;
- /* if y<2^-0x7fe */
if (qx == 0x7ff00000) /* x= 2^-0x3ff */
{if (y == 0) return NaNQ.x;
diff --git a/sysdeps/ieee754/dbl-64/halfulp.c b/sysdeps/ieee754/dbl-64/halfulp.c
index 9e1111b..478a4ba 100644
--- a/sysdeps/ieee754/dbl-64/halfulp.c
+++ b/sysdeps/ieee754/dbl-64/halfulp.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2005 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -42,7 +42,7 @@
double __ieee754_sqrt(double x);
-int4 tab54[32] = {
+static const int4 tab54[32] = {
262143, 11585, 1782, 511, 210, 107, 63, 42,
30, 22, 17, 14, 12, 10, 9, 7,
7, 6, 5, 5, 5, 4, 4, 4,
diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c
index 893bd71..64c870e 100644
--- a/sysdeps/ieee754/dbl-64/s_llrint.c
+++ b/sysdeps/ieee754/dbl-64/s_llrint.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,7 +23,7 @@
#include "math_private.h"
-static const long double two52[2] =
+static const double two52[2] =
{
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -48,19 +48,14 @@ __llrint (double x)
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;
+ 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);
- }
+ result = (j0 < 0 ? 0 : i0 >> (20 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
{
diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c
index 2da68d4..1084ed6 100644
--- a/sysdeps/ieee754/dbl-64/s_lrint.c
+++ b/sysdeps/ieee754/dbl-64/s_lrint.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -48,19 +48,14 @@ __lrint (double x)
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;
+ 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);
- }
+ result = (j0 < 0 ? 0 : i0 >> (20 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index f0542c5..e946f9f 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -1,5 +1,5 @@
/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -40,8 +40,8 @@ __sincos (double x, double *sinx, double *cosx)
}
else
{
- *sinx = sin (x);
- *cosx = cos (x);
+ *sinx = __sin (x);
+ *cosx = __cos (x);
}
}
weak_alias (__sincos, sincos)
diff --git a/sysdeps/ieee754/flt-32/Dist b/sysdeps/ieee754/flt-32/Dist
deleted file mode 100644
index 045ac80..0000000
--- a/sysdeps/ieee754/flt-32/Dist
+++ /dev/null
@@ -1 +0,0 @@
-t_exp2f.h
diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c
index 8b3398c..c0cafb1 100644
--- a/sysdeps/ieee754/flt-32/e_atan2f.c
+++ b/sysdeps/ieee754/flt-32/e_atan2f.c
@@ -30,7 +30,7 @@ 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 */
+pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
#ifdef __STDC__
float __ieee754_atan2f(float y, float x)
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index 752272d..194222a 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -1,5 +1,5 @@
/* Single-precision floating point 2^x.
- Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
diff --git a/sysdeps/ieee754/flt-32/e_expf.c b/sysdeps/ieee754/flt-32/e_expf.c
index 62448a9..b9cd53c 100644
--- a/sysdeps/ieee754/flt-32/e_expf.c
+++ b/sysdeps/ieee754/flt-32/e_expf.c
@@ -1,5 +1,5 @@
/* Single-precision floating point e^x.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c
index d6b1520..a8e1a52 100644
--- a/sysdeps/ieee754/flt-32/e_hypotf.c
+++ b/sysdeps/ieee754/flt-32/e_hypotf.c
@@ -23,7 +23,7 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
#ifdef __STDC__
float __ieee754_hypotf(float x, float y)
#else
- float __ieee754_hypot(x,y)
+ float __ieee754_hypotf(x,y)
float x, y;
#endif
{
@@ -47,20 +47,20 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
return w;
}
/* scale a and b by 2**-60 */
- ha -= 0x5d800000; hb -= 0x5d800000; k += 60;
+ ha -= 0x1e000000; hb -= 0x1e000000; 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 */
+ SET_FLOAT_WORD(t1,0x7e800000); /* 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 */
+ ha += 0x1e000000; /* a *= 2^60 */
+ hb += 0x1e000000; /* b *= 2^60 */
k -= 60;
SET_FLOAT_WORD(a,ha);
SET_FLOAT_WORD(b,hb);
diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c
index 375e334..1f032be 100644
--- a/sysdeps/ieee754/flt-32/s_expm1f.c
+++ b/sysdeps/ieee754/flt-32/s_expm1f.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -20,7 +20,8 @@ static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $";
#include "math.h"
#include "math_private.h"
-static const volatile float huge = 1.0e+30, tiny = 1.0e-30;
+static const volatile float huge = 1.0e+30;
+static const volatile float tiny = 1.0e-30;
#ifdef __STDC__
static const float
@@ -71,7 +72,7 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
}
/* argument reduction */
- if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */
+ 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;}
@@ -85,10 +86,10 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
}
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));
+ return x - (t-(huge+x));
}
else k = 0;
diff --git a/sysdeps/ieee754/flt-32/s_llrintf.c b/sysdeps/ieee754/flt-32/s_llrintf.c
index 3b9a484..7c6e4bc 100644
--- a/sysdeps/ieee754/flt-32/s_llrintf.c
+++ b/sysdeps/ieee754/flt-32/s_llrintf.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,7 +23,7 @@
#include "math_private.h"
-static const double two23[2] =
+static const float two23[2] =
{
8.3886080000e+06, /* 0x4B000000 */
-8.3886080000e+06, /* 0xCB000000 */
@@ -49,9 +49,7 @@ __llrintf (float x)
if (j0 < (int32_t) (sizeof (long long int) * 8) - 1)
{
- if (j0 < -1)
- return 0;
- else if (j0 >= 23)
+ if (j0 >= 23)
result = (long long int) i0 << (j0 - 23);
else
{
@@ -62,7 +60,7 @@ __llrintf (float x)
i0 &= 0x7fffff;
i0 |= 0x800000;
- result = i0 >> (23 - j0);
+ result = (j0 < 0 ? 0 : i0 >> (23 - j0));
}
}
else
diff --git a/sysdeps/ieee754/flt-32/s_lrintf.c b/sysdeps/ieee754/flt-32/s_lrintf.c
index 2a156f7..64486a4 100644
--- a/sysdeps/ieee754/flt-32/s_lrintf.c
+++ b/sysdeps/ieee754/flt-32/s_lrintf.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,7 +23,7 @@
#include "math_private.h"
-static const double two23[2] =
+static const float two23[2] =
{
8.3886080000e+06, /* 0x4B000000 */
-8.3886080000e+06, /* 0xCB000000 */
@@ -49,9 +49,7 @@ __lrintf (float x)
if (j0 < (int32_t) (sizeof (long int) * 8) - 1)
{
- if (j0 < -1)
- return 0;
- else if (j0 >= 23)
+ if (j0 >= 23)
result = (long int) i0 << (j0 - 23);
else
{
@@ -62,7 +60,7 @@ __lrintf (float x)
i0 &= 0x7fffff;
i0 |= 0x800000;
- result = i0 >> (23 - j0);
+ result = (j0 < 0 ? 0 : i0 >> (23 - j0));
}
}
else
diff --git a/sysdeps/ieee754/flt-32/s_nextafterf.c b/sysdeps/ieee754/flt-32/s_nextafterf.c
index e1568e2..600c146 100644
--- a/sysdeps/ieee754/flt-32/s_nextafterf.c
+++ b/sysdeps/ieee754/flt-32/s_nextafterf.c
@@ -18,7 +18,7 @@ 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"
+#include <math_private.h>
#include <float.h>
#ifdef __STDC__
@@ -40,9 +40,12 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp
return x+y;
if(x==y) return y; /* x=y, return y */
if(ix==0) { /* x == 0 */
+ float u;
SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */
- y = x*x;
- if(y==x) return y; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u*u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if(hx>hy) { /* x > y, x -= ulp */
@@ -61,15 +64,12 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp
if(hy>=0x7f800000) {
x = x+x; /* overflow */
if (FLT_EVAL_METHOD != 0)
- asm ("" : "=m"(x) : "m"(x));
+ asm ("" : "+m"(x));
return x; /* overflow */
}
- if(hy<0x00800000) { /* underflow */
- y = x*x;
- if(y!=x) { /* raise underflow flag */
- SET_FLOAT_WORD(y,hx);
- return y;
- }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
SET_FLOAT_WORD(x,hx);
return x;
diff --git a/sysdeps/ieee754/ldbl-128/Dist b/sysdeps/ieee754/ldbl-128/Dist
deleted file mode 100644
index 4504060..0000000
--- a/sysdeps/ieee754/ldbl-128/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-ieee754.h
-t_expl.h
diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c
index 18bf237..ba7e27b 100644
--- a/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -220,7 +220,7 @@ __ieee754_powl (x, y)
{
if (((ix - 0x3fff0000) | p.parts32.w1 | p.parts32.w2 | p.parts32.w3)
== 0)
- return y - y; /* inf**+-1 is NaN */
+ return y - y; /* +-1**inf is NaN */
else if (ix >= 0x3fff0000) /* (|x|>1)**+-inf = inf,0 */
return (hy >= 0) ? y : zero;
else /* (|x|<1)**-,+inf = inf,0 */
diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c
index 0cb6b29..361a9ba 100644
--- a/sysdeps/ieee754/ldbl-128/printf_fphex.c
+++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c
@@ -1,6 +1,6 @@
/* Print floating point number in hexadecimal notation according to
ISO C99.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2005 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
@@ -103,4 +103,4 @@ do { \
} \
} while (0)
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c
index d6899e8..5804f57 100644
--- a/sysdeps/ieee754/ldbl-128/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -48,16 +48,16 @@ __llrintl (long double x)
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);
+ GET_LDOUBLE_WORDS64 (i0, i1, t);
j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
i0 &= 0x0000ffffffffffffLL;
i0 |= 0x0001000000000000LL;
- if (j0 <= 48)
+ if (j0 < 0)
+ result = 0;
+ else if (j0 <= 48)
result = i0 >> (48 - j0);
else
result = ((long long int) i0 << (j0 - 48)) | (i1 >> (112 - j0));
diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c
index 66f9a42..ead24e9 100644
--- a/sysdeps/ieee754/ldbl-128/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -48,19 +48,14 @@ __lrintl (long double x)
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;
+ w = two112[sx] + x;
+ t = w - two112[sx];
+ GET_LDOUBLE_WORDS64 (i0, i1, t);
+ j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+ i0 &= 0x0000ffffffffffffLL;
+ i0 |= 0x0001000000000000LL;
- result = i0 >> (48 - j0);
- }
+ result = (j0 < 0 ? 0 : i0 >> (48 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
@@ -70,7 +65,7 @@ __lrintl (long double x)
{
w = two112[sx] + x;
t = w - two112[sx];
- GET_LDOUBLE_WORDS64 (i0, i1, x);
+ GET_LDOUBLE_WORDS64 (i0, i1, t);
j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
i0 &= 0x0000ffffffffffffLL;
i0 |= 0x0001000000000000LL;
diff --git a/sysdeps/ieee754/ldbl-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-128/s_nextafterl.c
index d3df668..7bc869a 100644
--- a/sysdeps/ieee754/ldbl-128/s_nextafterl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nextafterl.c
@@ -25,7 +25,7 @@ static char rcsid[] = "$NetBSD: $";
*/
#include "math.h"
-#include "math_private.h"
+#include <math_private.h>
#ifdef __STDC__
long double __nextafterl(long double x, long double y)
@@ -47,9 +47,12 @@ static char rcsid[] = "$NetBSD: $";
return x+y;
if(x==y) return y; /* x=y, return y */
if((ix|lx)==0) { /* x == 0 */
+ long double u;
SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */
- y = x*x;
- if(y==x) return y; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */
@@ -70,12 +73,9 @@ static char rcsid[] = "$NetBSD: $";
}
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;
- }
+ if(hy==0) {
+ long double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
SET_LDOUBLE_WORDS64(x,hx,lx);
return x;
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
index 553e401..178505c 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
@@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $";
*/
#include "math.h"
-#include "math_private.h"
+#include <math_private.h>
#include <float.h>
#ifdef __STDC__
@@ -53,10 +53,12 @@ static char rcsid[] = "$NetBSD: $";
return x+y;
if((long double) x==y) return y; /* x=y, return y */
if((ix|lx)==0) { /* x == 0 */
- double x2;
+ double u;
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 */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if (hy<0||(ix>>20)>(iy>>48)-0x3c00
@@ -87,16 +89,13 @@ static char rcsid[] = "$NetBSD: $";
if(hy>=0x7ff00000) {
x = x+x; /* overflow */
if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
- /* Force conversion to float. */
- asm ("" : "=m"(x) : "m"(x));
+ /* Force conversion to double. */
+ asm ("" : "+m"(x));
return x;
}
- if(hy<0x00100000) { /* underflow */
- double x2 = x*x;
- if(x2!=x) { /* raise underflow flag */
- INSERT_WORDS(x2,hx,lx);
- return x2;
- }
+ if(hy<0x00100000) {
+ double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
INSERT_WORDS(x,hx,lx);
return x;
diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile
new file mode 100644
index 0000000..8e1e2e6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/Makefile
@@ -0,0 +1,5 @@
+# The`long double' type is a distinct type we support if
+# -mlong-double-128 option is used (or when it becomes a default
+# when -mlong-double-64 is not used).
+long-double-fcts = yes
+sysdep-CFLAGS += -mlong-double-128
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
new file mode 100644
index 0000000..00576c7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.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 long double
+#else
+static long double
+#endif
+one = 1.0L,
+ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */
+
+#ifdef __STDC__
+ long double __ieee754_acoshl(long double x)
+#else
+ long double __ieee754_acoshl(x)
+ long double x;
+#endif
+{
+ long double t;
+ int64_t hx;
+ u_int64_t lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ if(hx<0x3ff0000000000000LL) { /* x < 1 */
+ return (x-x)/(x-x);
+ } else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */
+ if(hx >=0x7ff0000000000000LL) { /* x is inf of NaN */
+ return x+x;
+ } else
+ return __ieee754_logl(x)+ln2; /* acosh(huge)=log(2x) */
+ } else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) {
+ return 0.0; /* acosh(1) = 0 */
+ } else if (hx > 0x4000000000000000LL) { /* 2**28 > x > 2 */
+ t=x*x;
+ return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one)));
+ } else { /* 1<x<2 */
+ t = x-one;
+ return __log1p(t+__sqrtl(2.0*t+t*t));
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
new file mode 100644
index 0000000..8823fd6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
@@ -0,0 +1,328 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ Long double expansions are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __ieee754_acosl(x)
+ * Method :
+ * acos(x) = pi/2 - asin(x)
+ * acos(-x) = pi/2 + asin(x)
+ * For |x| <= 0.375
+ * acos(x) = pi/2 - asin(x)
+ * Between .375 and .5 the approximation is
+ * acos(0.4375 + x) = acos(0.4375) + x P(x) / Q(x)
+ * Between .5 and .625 the approximation is
+ * acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
+ * For x > 0.625,
+ * acos(x) = 2 asin(sqrt((1-x)/2))
+ * computed with an extended precision square root in the leading term.
+ * For x < -0.625
+ * acos(x) = pi - 2 asin(sqrt((1-|x|)/2))
+ *
+ * Special cases:
+ * if x is NaN, return x itself;
+ * if |x|>1, return NaN with invalid signal.
+ *
+ * Functions needed: __ieee754_sqrtl.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ one = 1.0L,
+ pio2_hi = 1.5707963267948966192313216916397514420986L,
+ pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
+
+ /* acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
+ -0.0625 <= x <= 0.0625
+ peak relative error 3.3e-35 */
+
+ rS0 = 5.619049346208901520945464704848780243887E0L,
+ rS1 = -4.460504162777731472539175700169871920352E1L,
+ rS2 = 1.317669505315409261479577040530751477488E2L,
+ rS3 = -1.626532582423661989632442410808596009227E2L,
+ rS4 = 3.144806644195158614904369445440583873264E1L,
+ rS5 = 9.806674443470740708765165604769099559553E1L,
+ rS6 = -5.708468492052010816555762842394927806920E1L,
+ rS7 = -1.396540499232262112248553357962639431922E1L,
+ rS8 = 1.126243289311910363001762058295832610344E1L,
+ rS9 = 4.956179821329901954211277873774472383512E-1L,
+ rS10 = -3.313227657082367169241333738391762525780E-1L,
+
+ sS0 = -4.645814742084009935700221277307007679325E0L,
+ sS1 = 3.879074822457694323970438316317961918430E1L,
+ sS2 = -1.221986588013474694623973554726201001066E2L,
+ sS3 = 1.658821150347718105012079876756201905822E2L,
+ sS4 = -4.804379630977558197953176474426239748977E1L,
+ sS5 = -1.004296417397316948114344573811562952793E2L,
+ sS6 = 7.530281592861320234941101403870010111138E1L,
+ sS7 = 1.270735595411673647119592092304357226607E1L,
+ sS8 = -1.815144839646376500705105967064792930282E1L,
+ sS9 = -7.821597334910963922204235247786840828217E-2L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ acosr5625 = 9.7338991014954640492751132535550279812151E-1L,
+ pimacosr5625 = 2.1682027434402468335351320579240000860757E0L,
+
+ /* acos(0.4375 + x) = acos(0.4375) + x rS(x) / sS(x)
+ -0.0625 <= x <= 0.0625
+ peak relative error 2.1e-35 */
+
+ P0 = 2.177690192235413635229046633751390484892E0L,
+ P1 = -2.848698225706605746657192566166142909573E1L,
+ P2 = 1.040076477655245590871244795403659880304E2L,
+ P3 = -1.400087608918906358323551402881238180553E2L,
+ P4 = 2.221047917671449176051896400503615543757E1L,
+ P5 = 9.643714856395587663736110523917499638702E1L,
+ P6 = -5.158406639829833829027457284942389079196E1L,
+ P7 = -1.578651828337585944715290382181219741813E1L,
+ P8 = 1.093632715903802870546857764647931045906E1L,
+ P9 = 5.448925479898460003048760932274085300103E-1L,
+ P10 = -3.315886001095605268470690485170092986337E-1L,
+ Q0 = -1.958219113487162405143608843774587557016E0L,
+ Q1 = 2.614577866876185080678907676023269360520E1L,
+ Q2 = -9.990858606464150981009763389881793660938E1L,
+ Q3 = 1.443958741356995763628660823395334281596E2L,
+ Q4 = -3.206441012484232867657763518369723873129E1L,
+ Q5 = -1.048560885341833443564920145642588991492E2L,
+ Q6 = 6.745883931909770880159915641984874746358E1L,
+ Q7 = 1.806809656342804436118449982647641392951E1L,
+ Q8 = -1.770150690652438294290020775359580915464E1L,
+ Q9 = -5.659156469628629327045433069052560211164E-1L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ acosr4375 = 1.1179797320499710475919903296900511518755E0L,
+ pimacosr4375 = 2.0236129215398221908706530535894517323217E0L,
+
+ /* asin(x) = x + x^3 pS(x^2) / qS(x^2)
+ 0 <= x <= 0.5
+ peak relative error 1.9e-35 */
+ pS0 = -8.358099012470680544198472400254596543711E2L,
+ pS1 = 3.674973957689619490312782828051860366493E3L,
+ pS2 = -6.730729094812979665807581609853656623219E3L,
+ pS3 = 6.643843795209060298375552684423454077633E3L,
+ pS4 = -3.817341990928606692235481812252049415993E3L,
+ pS5 = 1.284635388402653715636722822195716476156E3L,
+ pS6 = -2.410736125231549204856567737329112037867E2L,
+ pS7 = 2.219191969382402856557594215833622156220E1L,
+ pS8 = -7.249056260830627156600112195061001036533E-1L,
+ pS9 = 1.055923570937755300061509030361395604448E-3L,
+
+ qS0 = -5.014859407482408326519083440151745519205E3L,
+ qS1 = 2.430653047950480068881028451580393430537E4L,
+ qS2 = -4.997904737193653607449250593976069726962E4L,
+ qS3 = 5.675712336110456923807959930107347511086E4L,
+ qS4 = -3.881523118339661268482937768522572588022E4L,
+ qS5 = 1.634202194895541569749717032234510811216E4L,
+ qS6 = -4.151452662440709301601820849901296953752E3L,
+ qS7 = 5.956050864057192019085175976175695342168E2L,
+ qS8 = -4.175375777334867025769346564600396877176E1L;
+ /* 1.000000000000000000000000000000000000000E0 */
+
+#ifdef __STDC__
+long double
+__ieee754_acosl (long double x)
+#else
+long double
+__ieee754_acosl (x)
+ long double x;
+#endif
+{
+ long double z, r, w, p, q, s, t, f2;
+ int32_t ix, sign;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+ u.parts32.w0 = ix; /* |x| */
+ if (ix >= 0x3ff00000) /* |x| >= 1 */
+ {
+ if (ix == 0x3ff00000
+ && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ { /* |x| == 1 */
+ if ((sign & 0x80000000) == 0)
+ return 0.0; /* acos(1) = 0 */
+ else
+ return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */
+ }
+ return (x - x) / (x - x); /* acos(|x| > 1) is NaN */
+ }
+ else if (ix < 0x3fe00000) /* |x| < 0.5 */
+ {
+ if (ix < 0x3c600000) /* |x| < 2**-57 */
+ return pio2_hi + pio2_lo;
+ if (ix < 0x3fde0000) /* |x| < .4375 */
+ {
+ /* Arcsine of x. */
+ z = x * x;
+ p = (((((((((pS9 * z
+ + pS8) * z
+ + pS7) * z
+ + pS6) * z
+ + pS5) * z
+ + pS4) * z
+ + pS3) * z
+ + pS2) * z
+ + pS1) * z
+ + pS0) * z;
+ q = (((((((( z
+ + qS8) * z
+ + qS7) * z
+ + qS6) * z
+ + qS5) * z
+ + qS4) * z
+ + qS3) * z
+ + qS2) * z
+ + qS1) * z
+ + qS0;
+ r = x + x * p / q;
+ z = pio2_hi - (r - pio2_lo);
+ return z;
+ }
+ /* .4375 <= |x| < .5 */
+ t = u.value - 0.4375L;
+ p = ((((((((((P10 * t
+ + P9) * t
+ + P8) * t
+ + P7) * t
+ + P6) * t
+ + P5) * t
+ + P4) * t
+ + P3) * t
+ + P2) * t
+ + P1) * t
+ + P0) * t;
+
+ q = (((((((((t
+ + Q9) * t
+ + Q8) * t
+ + Q7) * t
+ + Q6) * t
+ + Q5) * t
+ + Q4) * t
+ + Q3) * t
+ + Q2) * t
+ + Q1) * t
+ + Q0;
+ r = p / q;
+ if (sign & 0x80000000)
+ r = pimacosr4375 - r;
+ else
+ r = acosr4375 + r;
+ return r;
+ }
+ else if (ix < 0x3fe40000) /* |x| < 0.625 */
+ {
+ t = u.value - 0.5625L;
+ p = ((((((((((rS10 * t
+ + rS9) * t
+ + rS8) * t
+ + rS7) * t
+ + rS6) * t
+ + rS5) * t
+ + rS4) * t
+ + rS3) * t
+ + rS2) * t
+ + rS1) * t
+ + rS0) * t;
+
+ q = (((((((((t
+ + sS9) * t
+ + sS8) * t
+ + sS7) * t
+ + sS6) * t
+ + sS5) * t
+ + sS4) * t
+ + sS3) * t
+ + sS2) * t
+ + sS1) * t
+ + sS0;
+ if (sign & 0x80000000)
+ r = pimacosr5625 - p / q;
+ else
+ r = acosr5625 + p / q;
+ return r;
+ }
+ else
+ { /* |x| >= .625 */
+ z = (one - u.value) * 0.5;
+ s = __ieee754_sqrtl (z);
+ /* Compute an extended precision square root from
+ the Newton iteration s -> 0.5 * (s + z / s).
+ The change w from s to the improved value is
+ w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s.
+ Express s = f1 + f2 where f1 * f1 is exactly representable.
+ w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
+ s + w has extended precision. */
+ u.value = s;
+ u.parts32.w2 = 0;
+ u.parts32.w3 = 0;
+ f2 = s - u.value;
+ w = z - u.value * u.value;
+ w = w - 2.0 * u.value * f2;
+ w = w - f2 * f2;
+ w = w / (2.0 * s);
+ /* Arcsine of s. */
+ p = (((((((((pS9 * z
+ + pS8) * z
+ + pS7) * z
+ + pS6) * z
+ + pS5) * z
+ + pS4) * z
+ + pS3) * z
+ + pS2) * z
+ + pS1) * z
+ + pS0) * z;
+ q = (((((((( z
+ + qS8) * z
+ + qS7) * z
+ + qS6) * z
+ + qS5) * z
+ + qS4) * z
+ + qS3) * z
+ + qS2) * z
+ + qS1) * z
+ + qS0;
+ r = s + (w + s * p / q);
+
+ if (sign & 0x80000000)
+ w = pio2_hi + (pio2_lo - r);
+ else
+ w = r;
+ return 2.0 * w;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
new file mode 100644
index 0000000..3696694
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
@@ -0,0 +1,265 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ Long double expansions are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under the
+ following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __ieee754_asin(x)
+ * Method :
+ * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
+ * we approximate asin(x) on [0,0.5] by
+ * asin(x) = x + x*x^2*R(x^2)
+ * Between .5 and .625 the approximation is
+ * asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
+ * For x in [0.625,1]
+ * asin(x) = pi/2-2*asin(sqrt((1-x)/2))
+ * Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
+ * then for x>0.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"
+long double sqrtl (long double);
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ one = 1.0L,
+ huge = 1.0e+300L,
+ pio2_hi = 1.5707963267948966192313216916397514420986L,
+ pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
+ pio4_hi = 7.8539816339744830961566084581987569936977E-1L,
+
+ /* coefficient for R(x^2) */
+
+ /* asin(x) = x + x^3 pS(x^2) / qS(x^2)
+ 0 <= x <= 0.5
+ peak relative error 1.9e-35 */
+ pS0 = -8.358099012470680544198472400254596543711E2L,
+ pS1 = 3.674973957689619490312782828051860366493E3L,
+ pS2 = -6.730729094812979665807581609853656623219E3L,
+ pS3 = 6.643843795209060298375552684423454077633E3L,
+ pS4 = -3.817341990928606692235481812252049415993E3L,
+ pS5 = 1.284635388402653715636722822195716476156E3L,
+ pS6 = -2.410736125231549204856567737329112037867E2L,
+ pS7 = 2.219191969382402856557594215833622156220E1L,
+ pS8 = -7.249056260830627156600112195061001036533E-1L,
+ pS9 = 1.055923570937755300061509030361395604448E-3L,
+
+ qS0 = -5.014859407482408326519083440151745519205E3L,
+ qS1 = 2.430653047950480068881028451580393430537E4L,
+ qS2 = -4.997904737193653607449250593976069726962E4L,
+ qS3 = 5.675712336110456923807959930107347511086E4L,
+ qS4 = -3.881523118339661268482937768522572588022E4L,
+ qS5 = 1.634202194895541569749717032234510811216E4L,
+ qS6 = -4.151452662440709301601820849901296953752E3L,
+ qS7 = 5.956050864057192019085175976175695342168E2L,
+ qS8 = -4.175375777334867025769346564600396877176E1L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ /* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
+ -0.0625 <= x <= 0.0625
+ peak relative error 3.3e-35 */
+ rS0 = -5.619049346208901520945464704848780243887E0L,
+ rS1 = 4.460504162777731472539175700169871920352E1L,
+ rS2 = -1.317669505315409261479577040530751477488E2L,
+ rS3 = 1.626532582423661989632442410808596009227E2L,
+ rS4 = -3.144806644195158614904369445440583873264E1L,
+ rS5 = -9.806674443470740708765165604769099559553E1L,
+ rS6 = 5.708468492052010816555762842394927806920E1L,
+ rS7 = 1.396540499232262112248553357962639431922E1L,
+ rS8 = -1.126243289311910363001762058295832610344E1L,
+ rS9 = -4.956179821329901954211277873774472383512E-1L,
+ rS10 = 3.313227657082367169241333738391762525780E-1L,
+
+ sS0 = -4.645814742084009935700221277307007679325E0L,
+ sS1 = 3.879074822457694323970438316317961918430E1L,
+ sS2 = -1.221986588013474694623973554726201001066E2L,
+ sS3 = 1.658821150347718105012079876756201905822E2L,
+ sS4 = -4.804379630977558197953176474426239748977E1L,
+ sS5 = -1.004296417397316948114344573811562952793E2L,
+ sS6 = 7.530281592861320234941101403870010111138E1L,
+ sS7 = 1.270735595411673647119592092304357226607E1L,
+ sS8 = -1.815144839646376500705105967064792930282E1L,
+ sS9 = -7.821597334910963922204235247786840828217E-2L,
+ /* 1.000000000000000000000000000000000000000E0 */
+
+ asinr5625 = 5.9740641664535021430381036628424864397707E-1L;
+
+
+
+#ifdef __STDC__
+long double
+__ieee754_asinl (long double x)
+#else
+double
+__ieee754_asinl (x)
+ long double x;
+#endif
+{
+ long double t, w, p, q, c, r, s;
+ int32_t ix, sign, flag;
+ ieee854_long_double_shape_type u;
+
+ flag = 0;
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+ u.parts32.w0 = ix; /* |x| */
+ if (ix >= 0x3ff00000) /* |x|>= 1 */
+ {
+ if (ix == 0x3ff00000
+ && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 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 < 0x3c600000) /* |x| < 2**-57 */
+ {
+ if (huge + x > one)
+ return x; /* return x with inexact if x!=0 */
+ }
+ else
+ {
+ t = x * x;
+ /* Mark to use pS, qS later on. */
+ flag = 1;
+ }
+ }
+ else if (ix < 0x3fe40000) /* 0.625 */
+ {
+ t = u.value - 0.5625;
+ p = ((((((((((rS10 * t
+ + rS9) * t
+ + rS8) * t
+ + rS7) * t
+ + rS6) * t
+ + rS5) * t
+ + rS4) * t
+ + rS3) * t
+ + rS2) * t
+ + rS1) * t
+ + rS0) * t;
+
+ q = ((((((((( t
+ + sS9) * t
+ + sS8) * t
+ + sS7) * t
+ + sS6) * t
+ + sS5) * t
+ + sS4) * t
+ + sS3) * t
+ + sS2) * t
+ + sS1) * t
+ + sS0;
+ t = asinr5625 + p / q;
+ if ((sign & 0x80000000) == 0)
+ return t;
+ else
+ return -t;
+ }
+ else
+ {
+ /* 1 > |x| >= 0.625 */
+ w = one - u.value;
+ t = w * 0.5;
+ }
+
+ p = (((((((((pS9 * t
+ + pS8) * t
+ + pS7) * t
+ + pS6) * t
+ + pS5) * t
+ + pS4) * t
+ + pS3) * t
+ + pS2) * t
+ + pS1) * t
+ + pS0) * t;
+
+ q = (((((((( t
+ + qS8) * t
+ + qS7) * t
+ + qS6) * t
+ + qS5) * t
+ + qS4) * t
+ + qS3) * t
+ + qS2) * t
+ + qS1) * t
+ + qS0;
+
+ if (flag) /* 2^-57 < |x| < 0.5 */
+ {
+ w = p / q;
+ return x + x * w;
+ }
+
+ s = __ieee754_sqrtl (t);
+ if (ix >= 0x3fef3333) /* |x| > 0.975 */
+ {
+ w = p / q;
+ t = pio2_hi - (2.0 * (s + s * w) - pio2_lo);
+ }
+ else
+ {
+ u.value = s;
+ u.parts32.w3 = 0;
+ u.parts32.w2 = 0;
+ w = u.value;
+ 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 ((sign & 0x80000000) == 0)
+ return t;
+ else
+ return -t;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
new file mode 100644
index 0000000..a4bb53d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
@@ -0,0 +1,124 @@
+/* e_atan2l.c -- long double version of e_atan2.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_atan2l(y,x)
+ * Method :
+ * 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x).
+ * 2. Reduce x to positive by (if x and y are unexceptional):
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = 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-300L,
+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)>0x7ff0000000000000LL)||
+ ((iy)>0x7ff0000000000000LL)) /* x or y is NaN */
+ return x+y;
+ if(((hx-0x3ff0000000000000LL))==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&0x7fffffffffffffffLL))==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&0x7fffffffffffffff))==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+ /* when x is INF */
+ if(ix==0x7ff0000000000000LL) {
+ if(iy==0x7ff0000000000000LL) {
+ 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==0x7ff0000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+ /* compute y/x */
+ k = (iy-ix)>>52;
+ if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */
+ else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */
+ else z=__atanl(fabsl(y/x)); /* safe to do y/x */
+ switch (m) {
+ case 0: return z ; /* atan(+,+) */
+ case 1: return -z ; /* atan(-,+) */
+ case 2: return pi-(z-pi_lo);/* atan(+,-) */
+ default: /* case 3 */
+ return (z-pi_lo)-pi;/* atan(-,-) */
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
new file mode 100644
index 0000000..a801bd6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
@@ -0,0 +1,79 @@
+/* @(#)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 long double one = 1.0L, huge = 1e300L;
+#else
+static long double one = 1.0L, huge = 1e300L;
+#endif
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_atanhl(long double x)
+#else
+ long double __ieee754_atanhl(x)
+ long double x;
+#endif
+{
+ long double t;
+ int64_t hx,ix;
+ u_int64_t lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ ix = hx&0x7fffffffffffffffLL;
+ if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
+ if (ix > 0x3ff0000000000000LL)
+ return (x-x)/(x-x);
+ t = fabsl (x);
+ if (t > one)
+ return (x-x)/(x-x);
+ if (t == one)
+ return x/zero;
+ }
+ if(ix<0x3e20000000000000LL&&(huge+x)>zero) return x; /* x<2**-29 */
+ x = fabsl (x);
+ if(ix<0x3fe0000000000000LL) { /* 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(hx>=0) return t; else return -t;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
new file mode 100644
index 0000000..73cb478
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
@@ -0,0 +1,90 @@
+/* @(#)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 long double one = 1.0L, half=0.5L, huge = 1.0e300L;
+#else
+static long double one = 1.0L, half=0.5L, huge = 1.0e300L;
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_coshl(long double x)
+#else
+ long double __ieee754_coshl(x)
+ long double x;
+#endif
+{
+ long double t,w;
+ int64_t ix;
+
+ /* High word of |x|. */
+ GET_LDOUBLE_MSW64(ix,x);
+ ix &= 0x7fffffffffffffffLL;
+
+ /* x is INF or NaN */
+ if(ix>=0x7ff0000000000000LL) return x*x;
+
+ /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
+ if(ix<0x3fd62e42fefa39efLL) {
+ t = __expm1l(fabsl(x));
+ w = one+t;
+ if (ix<0x3c80000000000000LL) 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 < 0x4036000000000000LL) {
+ t = __ieee754_expl(fabsl(x));
+ return half*t+half/t;
+ }
+
+ /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
+ if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x));
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ if (ix < 0x408633ce8fb9f87dLL) {
+ 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-128ibm/e_expl.c b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
new file mode 100644
index 0000000..3c4088f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
@@ -0,0 +1,257 @@
+/* Quad-precision floating point e^x.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+ Partly based on double-precision code
+ by Geoffrey Keating <geoffk@ozemail.com.au>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* The basic design here is from
+ Abraham Ziv, "Fast Evaluation of Elementary Mathematical Functions with
+ Correctly Rounded Last Bit", ACM Trans. Math. Soft., 17 (3), September 1991,
+ pp. 410-423.
+
+ We work with number pairs where the first number is the high part and
+ the second one is the low part. Arithmetic with the high part numbers must
+ be exact, without any roundoff errors.
+
+ The input value, X, is written as
+ X = n * ln(2)_0 + arg1[t1]_0 + arg2[t2]_0 + x
+ - n * ln(2)_1 + arg1[t1]_1 + arg2[t2]_1 + xl
+
+ where:
+ - n is an integer, 16384 >= n >= -16495;
+ - ln(2)_0 is the first 93 bits of ln(2), and |ln(2)_0-ln(2)-ln(2)_1| < 2^-205
+ - t1 is an integer, 89 >= t1 >= -89
+ - t2 is an integer, 65 >= t2 >= -65
+ - |arg1[t1]-t1/256.0| < 2^-53
+ - |arg2[t2]-t2/32768.0| < 2^-53
+ - x + xl is whatever is left, |x + xl| < 2^-16 + 2^-53
+
+ Then e^x is approximated as
+
+ e^x = 2^n_1 ( 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1)
+ + 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1)
+ * p (x + xl + n * ln(2)_1))
+ where:
+ - p(x) is a polynomial approximating e(x)-1
+ - e^(arg1[t1]_0 + arg1[t1]_1) is obtained from a table
+ - e^(arg2[t2]_0 + arg2[t2]_1) likewise
+ - n_1 + n_0 = n, so that |n_0| < -LDBL_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 <float.h>
+#include <ieee754.h>
+#include <math.h>
+#include <fenv.h>
+#include <inttypes.h>
+#include <math_private.h>
+#include <sysdeps/ieee754/ldbl-128/t_expl.h>
+
+static const long double C[] = {
+/* Smallest integer x for which e^x overflows. */
+#define himark C[0]
+ 709.08956571282405153382846025171462914L,
+
+/* Largest integer x for which e^x underflows. */
+#define lomark C[1]
+-709.08956571282405153382846025171462914L,
+
+/* 3x2^96 */
+#define THREEp96 C[2]
+ 59421121885698253195157962752.0L,
+
+/* 3x2^103 */
+#define THREEp103 C[3]
+ 30423614405477505635920876929024.0L,
+
+/* 3x2^111 */
+#define THREEp111 C[4]
+ 7788445287802241442795744493830144.0L,
+
+/* 1/ln(2) */
+#define M_1_LN2 C[5]
+ 1.44269504088896340735992468100189204L,
+
+/* first 93 bits of ln(2) */
+#define M_LN2_0 C[6]
+ 0.693147180559945309417232121457981864L,
+
+/* ln2_0 - ln(2) */
+#define M_LN2_1 C[7]
+-1.94704509238074995158795957333327386E-31L,
+
+/* very small number */
+#define TINY C[8]
+ 1.0e-308L,
+
+/* 2^16383 */
+#define TWO1023 C[9]
+ 8.988465674311579538646525953945123668E+307L,
+
+/* 256 */
+#define TWO8 C[10]
+ 256.0L,
+
+/* 32768 */
+#define TWO15 C[11]
+ 32768.0L,
+
+/* Chebyshev polynom coeficients for (exp(x)-1)/x */
+#define P1 C[12]
+#define P2 C[13]
+#define P3 C[14]
+#define P4 C[15]
+#define P5 C[16]
+#define P6 C[17]
+ 0.5L,
+ 1.66666666666666666666666666666666683E-01L,
+ 4.16666666666666666666654902320001674E-02L,
+ 8.33333333333333333333314659767198461E-03L,
+ 1.38888888889899438565058018857254025E-03L,
+ 1.98412698413981650382436541785404286E-04L,
+};
+
+long double
+__ieee754_expl (long double x)
+{
+ /* Check for usual case. */
+ if (isless (x, himark) && isgreater (x, lomark))
+ {
+ int tval1, tval2, unsafe, n_i, exponent2;
+ long double x22, n, result, xl;
+ union ibm_extended_long_double ex2_u, scale_u;
+ fenv_t oldenv;
+
+ feholdexcept (&oldenv);
+#ifdef FE_TONEAREST
+ fesetround (FE_TONEAREST);
+#endif
+
+ n = roundl(x*M_1_LN2);
+ x = x-n*M_LN2_0;
+ xl = n*M_LN2_1;
+
+ tval1 = roundl(x*TWO8);
+ x -= __expl_table[T_EXPL_ARG1+2*tval1];
+ xl -= __expl_table[T_EXPL_ARG1+2*tval1+1];
+
+ tval2 = roundl(x*TWO15);
+ x -= __expl_table[T_EXPL_ARG2+2*tval2];
+ xl -= __expl_table[T_EXPL_ARG2+2*tval2+1];
+
+ x = x + xl;
+
+ /* Compute ex2 = 2^n_0 e^(argtable[tval1]) e^(argtable[tval2]). */
+ ex2_u.d = __expl_table[T_EXPL_RES1 + tval1]
+ * __expl_table[T_EXPL_RES2 + tval2];
+ n_i = (int)n;
+ /* 'unsafe' is 1 iff n_1 != 0. */
+ unsafe = fabsl(n_i) >= -LDBL_MIN_EXP - 1;
+ ex2_u.ieee.exponent += n_i >> unsafe;
+ /* Fortunately, there are no subnormal lowpart doubles in
+ __expl_table, only normal values and zeros.
+ But after scaling it can be subnormal. */
+ exponent2 = ex2_u.ieee.exponent2 + (n_i >> unsafe);
+ if (ex2_u.ieee.exponent2 == 0)
+ /* assert ((ex2_u.ieee.mantissa2|ex2_u.ieee.mantissa3) == 0) */;
+ else if (exponent2 > 0)
+ ex2_u.ieee.exponent2 = exponent2;
+ else if (exponent2 <= -54)
+ {
+ ex2_u.ieee.exponent2 = 0;
+ ex2_u.ieee.mantissa2 = 0;
+ ex2_u.ieee.mantissa3 = 0;
+ }
+ else
+ {
+ static const double
+ two54 = 1.80143985094819840000e+16, /* 4350000000000000 */
+ twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */
+ ex2_u.dd[1] *= two54;
+ ex2_u.ieee.exponent2 += n_i >> unsafe;
+ ex2_u.dd[1] *= twom54;
+ }
+
+ /* Compute scale = 2^n_1. */
+ scale_u.d = 1.0L;
+ scale_u.ieee.exponent += n_i - (n_i >> unsafe);
+
+ /* Approximate e^x2 - 1, using a seventh-degree polynomial,
+ with maximum error in [-2^-16-2^-53,2^-16+2^-53]
+ less than 4.8e-39. */
+ x22 = x + x*x*(P1+x*(P2+x*(P3+x*(P4+x*(P5+x*P6)))));
+
+ /* Return result. */
+ fesetenv (&oldenv);
+
+ result = x22 * ex2_u.d + ex2_u.d;
+
+ /* Now we can test whether the result is ultimate or if we are unsure.
+ In the later case we should probably call a mpn based routine to give
+ the ultimate result.
+ Empirically, this routine is already ultimate in about 99.9986% of
+ cases, the test below for the round to nearest case will be false
+ in ~ 99.9963% of cases.
+ Without proc2 routine maximum error which has been seen is
+ 0.5000262 ulp.
+
+ union ieee854_long_double ex3_u;
+
+ #ifdef FE_TONEAREST
+ fesetround (FE_TONEAREST);
+ #endif
+ ex3_u.d = (result - ex2_u.d) - x22 * ex2_u.d;
+ ex2_u.d = result;
+ ex3_u.ieee.exponent += LDBL_MANT_DIG + 15 + IEEE854_LONG_DOUBLE_BIAS
+ - ex2_u.ieee.exponent;
+ n_i = abs (ex3_u.d);
+ n_i = (n_i + 1) / 2;
+ fesetenv (&oldenv);
+ #ifdef FE_TONEAREST
+ if (fegetround () == FE_TONEAREST)
+ n_i -= 0x4000;
+ #endif
+ if (!n_i) {
+ return __ieee754_expl_proc2 (origx);
+ }
+ */
+ if (!unsafe)
+ return result;
+ else
+ return result * scale_u.d;
+ }
+ /* Exceptional cases: */
+ else if (isless (x, himark))
+ {
+ if (__isinfl (x))
+ /* e^-inf == 0, with no error. */
+ return 0;
+ else
+ /* Underflow */
+ return TINY * TINY;
+ }
+ else
+ /* Return x, if x is a NaN or Inf; or overflow, otherwise. */
+ return TWO1023*x;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
new file mode 100644
index 0000000..e99b0ba
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -0,0 +1,145 @@
+/* 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"
+#include <ieee754.h>
+
+#ifdef __STDC__
+static const long double one = 1.0, Zero[] = {0.0, -0.0,};
+#else
+static long double one = 1.0, Zero[] = {0.0, -0.0,};
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_fmodl(long double x, long double y)
+#else
+ long double __ieee754_fmodl(x,y)
+ long double x,y;
+#endif
+{
+ int64_t n,hx,hy,hz,ix,iy,sx,i;
+ u_int64_t lx,ly,lz;
+ int temp;
+
+ 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&0x7fffffffffffffff))==0||(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
+ (hy>0x7ff0000000000000LL)) /* or y is NaN */
+ return (x*y)/(x*y);
+ if(hx<=hy) {
+ if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
+ if(lx==ly)
+ return Zero[(u_int64_t)sx>>63]; /* |x|=|y| return x*0*/
+ }
+
+ /* determine ix = ilogb(x) */
+ if(hx<0x0010000000000000LL) { /* subnormal x */
+ if(hx==0) {
+ for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
+ } else {
+ for (ix = -1022, i=hx<<19; i>0; i<<=1) ix -=1;
+ }
+ } else ix = (hx>>52)-0x3ff;
+
+ /* determine iy = ilogb(y) */
+ if(hy<0x0010000000000000LL) { /* subnormal y */
+ if(hy==0) {
+ for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
+ } else {
+ for (iy = -1022, i=hy<<19; i>0; i<<=1) iy -=1;
+ }
+ } else iy = (hy>>52)-0x3ff;
+
+ /* Make the IBM extended format 105 bit mantissa look like the ieee854 112
+ bit mantissa so the following operatations will give the correct
+ result. */
+ ldbl_extract_mantissa(&hx, &lx, &temp, x);
+ ldbl_extract_mantissa(&hy, &ly, &temp, y);
+
+ /* set up {hx,lx}, {hy,ly} and align y to x */
+ if(ix >= -1022)
+ hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
+ else { /* subnormal x, shift x to normal */
+ n = -1022-ix;
+ if(n<=63) {
+ hx = (hx<<n)|(lx>>(64-n));
+ lx <<= n;
+ } else {
+ hx = lx<<(n-64);
+ lx = 0;
+ }
+ }
+ if(iy >= -1022)
+ hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy);
+ else { /* subnormal y, shift y to normal */
+ n = -1022-iy;
+ if(n<=63) {
+ hy = (hy<<n)|(ly>>(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<ly) hz -= 1;
+ if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
+ else {
+ if((hz|(lz&0x7fffffffffffffff))==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<ly) hz -= 1;
+ if(hz>=0) {hx=hz;lx=lz;}
+
+ /* convert back to floating value and restore the sign */
+ if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ return Zero[(u_int64_t)sx>>63];
+ while(hx<0x0001000000000000LL) { /* normalize x */
+ hx = hx+hx+(lx>>63); lx = lx+lx;
+ iy -= 1;
+ }
+ if(iy>= -1022) { /* normalize output */
+ x = ldbl_insert_mantissa((sx>>63), iy, hx, lx);
+ } else { /* subnormal output */
+ n = -1022 - 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;
+ }
+ x = ldbl_insert_mantissa((sx>>63), iy, hx, lx);
+ x *= one; /* create necessary signal */
+ }
+ return x; /* exact output */
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
new file mode 100644
index 0000000..03bcb21
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
@@ -0,0 +1,58 @@
+/* Implementation of gamma function according to ISO C.
+ Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <math_private.h>
+
+
+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 | lx) & 0x7fffffffffffffffLL) == 0)
+ {
+ /* Return value for x == 0 is Inf with divide by zero exception. */
+ *signgamp = 0;
+ return 1.0 / x;
+ }
+ if (hx < 0 && (u_int64_t) hx < 0xfff0000000000000ULL && __rintl (x) == x)
+ {
+ /* Return value for integer x < 0 is NaN with invalid exception. */
+ *signgamp = 0;
+ return (x - x) / (x - x);
+ }
+ if (hx == 0xfff0000000000000ULL)
+ {
+ /* x == -Inf. According to ISO this is NaN. */
+ *signgamp = 0;
+ return x - x;
+ }
+
+ /* XXX FIXME. */
+ return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
new file mode 100644
index 0000000..4330f28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -0,0 +1,131 @@
+/* @(#)e_hypotl.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_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
+#endif
+
+/* __ieee754_hypotl(x,y)
+ *
+ * Method :
+ * If (assume round-to-nearest) z=x*x+y*y
+ * has error less than sqrtl(2)/2 ulp, than
+ * sqrtl(z) has error less than 1 ulp (exercise).
+ *
+ * So, compute sqrtl(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 53 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 53 bits cleared, t2 = 2x-t1,
+ * y1= y with lower 53 bits chopped, y2 = y-y1.
+ *
+ * NOTE: scaling may be necessary if some argument is too
+ * large or too tiny
+ *
+ * Special cases:
+ * hypotl(x,y) is INF if x or y is +INF or -INF; else
+ * hypotl(x,y) is NAN if x or y is NAN.
+ *
+ * Accuracy:
+ * hypotl(x,y) returns sqrtl(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double two600 = 0x1.0p+600L;
+static const long double two1022 = 0x1.0p+1022L;
+
+#ifdef __STDC__
+ long double __ieee754_hypotl(long double x, long double y)
+#else
+ long double __ieee754_hypotl(x,y)
+ long double x, y;
+#endif
+{
+ long double a,b,t1,t2,y1,y2,w,kld;
+ int64_t j,k,ha,hb;
+
+ GET_LDOUBLE_MSW64(ha,x);
+ ha &= 0x7fffffffffffffffLL;
+ GET_LDOUBLE_MSW64(hb,y);
+ hb &= 0x7fffffffffffffffLL;
+ if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
+ a = fabsl(a); /* a <- |a| */
+ b = fabsl(b); /* b <- |b| */
+ if((ha-hb)>0x3c0000000000000LL) {return a+b;} /* x/y > 2**60 */
+ k=0;
+ kld = 1.0L;
+ if(ha > 0x5f30000000000000LL) { /* a>2**500 */
+ if(ha >= 0x7ff0000000000000LL) { /* Inf or NaN */
+ u_int64_t low;
+ w = a+b; /* for sNaN */
+ GET_LDOUBLE_LSW64(low,a);
+ if(((ha&0xfffffffffffffLL)|(low&0x7fffffffffffffffLL))==0)
+ w = a;
+ GET_LDOUBLE_LSW64(low,b);
+ if(((hb^0x7ff0000000000000LL)|(low&0x7fffffffffffffffLL))==0)
+ w = b;
+ return w;
+ }
+ /* scale a and b by 2**-600 */
+ ha -= 0x2580000000000000LL; hb -= 0x2580000000000000LL; k += 600;
+ a /= two600;
+ b /= two600;
+ k += 600;
+ kld = two600;
+ }
+ if(hb < 0x20b0000000000000LL) { /* b < 2**-500 */
+ if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */
+ u_int64_t low;
+ GET_LDOUBLE_LSW64(low,b);
+ if((hb|(low&0x7fffffffffffffffLL))==0) return a;
+ t1=two1022; /* t1=2^1022 */
+ b *= t1;
+ a *= t1;
+ k -= 1022;
+ kld = kld / two1022;
+ } else { /* scale a and b by 2^600 */
+ ha += 0x2580000000000000LL; /* a *= 2^600 */
+ hb += 0x2580000000000000LL; /* b *= 2^600 */
+ k -= 600;
+ a *= two600;
+ b *= two600;
+ kld = kld / two600;
+ }
+ }
+ /* medium size a and b */
+ w = a-b;
+ if (w>b) {
+ SET_LDOUBLE_WORDS64(t1,ha,0);
+ t2 = a-t1;
+ w = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1)));
+ } else {
+ a = a+a;
+ SET_LDOUBLE_WORDS64(y1,hb,0);
+ y2 = b - y1;
+ SET_LDOUBLE_WORDS64(t1,ha+0x0010000000000000LL,0);
+ t2 = a - t1;
+ w = __ieee754_sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b)));
+ }
+ if(k!=0)
+ return w*kld;
+ else
+ return w;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c
new file mode 100644
index 0000000..39a238a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c
@@ -0,0 +1,3 @@
+/* Looks like we can use ieee854 e_j0l.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_j0l.c>
+
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
new file mode 100644
index 0000000..c86e24f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
@@ -0,0 +1,2 @@
+/* Looks like we can use ieee854 e_j1l.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_j1l.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
new file mode 100644
index 0000000..0eea745
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
@@ -0,0 +1,402 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ * __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 n<x, forward recursion us used starting
+ * from values of j0(x) and j1(x).
+ * for n>x, a continued fraction approximation to
+ * j(n,x)/j(n-1,x) is evaluated and then backward
+ * recursion is used starting from a supposed value
+ * for j(n,x). The resulting value of j(0,x) is
+ * compared with the actual value to correct the
+ * supposed value of j(n,x).
+ *
+ * yn(n,x) is similar in all respects, except
+ * that forward recursion is used for all
+ * values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+ invsqrtpi = 5.6418958354775628694807945156077258584405E-1L,
+ two = 2.0e0L,
+ one = 1.0e0L,
+ zero = 0.0L;
+
+
+#ifdef __STDC__
+long double
+__ieee754_jnl (int n, long double x)
+#else
+long double
+__ieee754_jnl (n, x)
+ int n;
+ long double x;
+#endif
+{
+ u_int32_t se;
+ int32_t i, ix, sgn;
+ long double a, b, temp, di;
+ long double z, w;
+ ieee854_long_double_shape_type u;
+
+
+ /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
+ * Thus, J(-n,x) = J(n,-x)
+ */
+
+ u.value = x;
+ se = u.parts32.w0;
+ ix = se & 0x7fffffff;
+
+ /* if J(n,NaN) is NaN */
+ if (ix >= 0x7ff00000)
+ {
+ if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
+ | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
+ return x + x;
+ }
+
+ if (n < 0)
+ {
+ n = -n;
+ x = -x;
+ se ^= 0x80000000;
+ }
+ if (n == 0)
+ return (__ieee754_j0l (x));
+ if (n == 1)
+ return (__ieee754_j1l (x));
+ sgn = (n & 1) & (se >> 31); /* even n -- 0, odd n -- sign(x) */
+ x = fabsl (x);
+
+ if (x == 0.0L || ix >= 0x7ff00000) /* if x is 0 or inf */
+ b = zero;
+ else if ((long 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 */
+
+ /* ??? Could use an expansion for large x here. */
+
+ /* (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
+ */
+ long double s;
+ long double c;
+ __sincosl (x, &s, &c);
+ switch (n & 3)
+ {
+ case 0:
+ temp = c + s;
+ break;
+ case 1:
+ temp = -c + s;
+ break;
+ case 2:
+ temp = -c - s;
+ break;
+ case 3:
+ temp = c - s;
+ break;
+ }
+ b = invsqrtpi * temp / __ieee754_sqrtl (x);
+ }
+ else
+ {
+ a = __ieee754_j0l (x);
+ b = __ieee754_j1l (x);
+ for (i = 1; i < n; i++)
+ {
+ temp = b;
+ b = b * ((long double) (i + i) / x) - a; /* avoid underflow */
+ a = temp;
+ }
+ }
+ }
+ else
+ {
+ if (ix < 0x3e100000)
+ { /* x < 2**-29 */
+ /* x is tiny, return the first Taylor expansion of J(n,x)
+ * J(n,x) = 1/n!*(x/2)^n - ...
+ */
+ if (n >= 33) /* underflow, result < 10^-300 */
+ b = zero;
+ else
+ {
+ temp = x * 0.5;
+ b = temp;
+ for (a = one, i = 2; i <= n; i++)
+ {
+ a *= (long 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 */
+ long double t, v;
+ long double q0, q1, h, tmp;
+ int32_t k, m;
+ w = (n + n) / (long double) x;
+ h = 2.0L / (long double) x;
+ q0 = w;
+ z = w + h;
+ q1 = w * z - 1.0L;
+ k = 1;
+ while (q1 < 1.0e17L)
+ {
+ 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_logl (fabsl (v * tmp));
+
+ if (tmp < 1.1356523406294143949491931077970765006170e+04L)
+ {
+ for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+ {
+ temp = b;
+ b *= di;
+ b = b / x - a;
+ a = temp;
+ di -= two;
+ }
+ }
+ else
+ {
+ for (i = n - 1, di = (long 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 > 1e100L)
+ {
+ a /= b;
+ t /= b;
+ b = one;
+ }
+ }
+ }
+ b = (t * __ieee754_j0l (x) / b);
+ }
+ }
+ if (sgn == 1)
+ return -b;
+ else
+ return b;
+}
+
+#ifdef __STDC__
+long double
+__ieee754_ynl (int n, long double x)
+#else
+long double
+__ieee754_ynl (n, x)
+ int n;
+ long double x;
+#endif
+{
+ u_int32_t se;
+ int32_t i, ix;
+ int32_t sign;
+ long double a, b, temp;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ se = u.parts32.w0;
+ ix = se & 0x7fffffff;
+
+ /* if Y(n,NaN) is NaN */
+ if (ix >= 0x7ff00000)
+ {
+ if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
+ | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
+ return x + x;
+ }
+ if (x <= 0.0L)
+ {
+ if (x == 0.0L)
+ return -HUGE_VALL + x;
+ if (se & 0x80000000)
+ return zero / (zero * x);
+ }
+ sign = 1;
+ if (n < 0)
+ {
+ n = -n;
+ sign = 1 - ((n & 1) << 1);
+ }
+ if (n == 0)
+ return (__ieee754_y0l (x));
+ if (n == 1)
+ return (sign * __ieee754_y1l (x));
+ if (ix >= 0x7ff00000)
+ return zero;
+ if (ix >= 0x52D00000)
+ { /* x > 2**302 */
+
+ /* ??? See comment above on the possible futility of this. */
+
+ /* (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
+ */
+ long double s;
+ long double c;
+ __sincosl (x, &s, &c);
+ switch (n & 3)
+ {
+ case 0:
+ temp = s - c;
+ break;
+ case 1:
+ temp = -s - c;
+ break;
+ case 2:
+ temp = -s + c;
+ break;
+ case 3:
+ temp = s + c;
+ break;
+ }
+ b = invsqrtpi * temp / __ieee754_sqrtl (x);
+ }
+ else
+ {
+ a = __ieee754_y0l (x);
+ b = __ieee754_y1l (x);
+ /* quit if b is -inf */
+ u.value = b;
+ se = u.parts32.w0 & 0xfff00000;
+ for (i = 1; i < n && se != 0xfff00000; i++)
+ {
+ temp = b;
+ b = ((long double) (i + i) / x) * b - a;
+ u.value = b;
+ se = u.parts32.w0 & 0xfff00000;
+ a = temp;
+ }
+ }
+ if (sign > 0)
+ return b;
+ else
+ return -b;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
new file mode 100644
index 0000000..9bcaaf7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
@@ -0,0 +1,3 @@
+/* Looks like we can use ieee854 e_lgammal_r.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_lgammal_r.c>
+
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
new file mode 100644
index 0000000..27e2c71
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
@@ -0,0 +1,258 @@
+/* log10l.c
+ *
+ * Common logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log10l();
+ *
+ * y = log10l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 10 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts. If the exponent is between -1 and +1, the logarithm
+ * of the fraction is approximated by
+ *
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting z = 2(x-1)/x+1),
+ *
+ * log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE 0.5, 2.0 30000 2.3e-34 4.9e-35
+ * IEEE exp(+-10000) 30000 1.0e-34 4.1e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+ Cephes Math Library Release 2.2: January, 1991
+ Copyright 1984, 1991 by Stephen L. Moshier
+ Adapted for glibc November, 2001
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double P[13] =
+{
+ 1.313572404063446165910279910527789794488E4L,
+ 7.771154681358524243729929227226708890930E4L,
+ 2.014652742082537582487669938141683759923E5L,
+ 3.007007295140399532324943111654767187848E5L,
+ 2.854829159639697837788887080758954924001E5L,
+ 1.797628303815655343403735250238293741397E5L,
+ 7.594356839258970405033155585486712125861E4L,
+ 2.128857716871515081352991964243375186031E4L,
+ 3.824952356185897735160588078446136783779E3L,
+ 4.114517881637811823002128927449878962058E2L,
+ 2.321125933898420063925789532045674660756E1L,
+ 4.998469661968096229986658302195402690910E-1L,
+ 1.538612243596254322971797716843006400388E-6L
+};
+static const long double Q[12] =
+{
+ 3.940717212190338497730839731583397586124E4L,
+ 2.626900195321832660448791748036714883242E5L,
+ 7.777690340007566932935753241556479363645E5L,
+ 1.347518538384329112529391120390701166528E6L,
+ 1.514882452993549494932585972882995548426E6L,
+ 1.158019977462989115839826904108208787040E6L,
+ 6.132189329546557743179177159925690841200E5L,
+ 2.248234257620569139969141618556349415120E5L,
+ 5.605842085972455027590989944010492125825E4L,
+ 9.147150349299596453976674231612674085381E3L,
+ 9.104928120962988414618126155557301584078E2L,
+ 4.839208193348159620282142911143429644326E1L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double R[6] =
+{
+ 1.418134209872192732479751274970992665513E5L,
+ -8.977257995689735303686582344659576526998E4L,
+ 2.048819892795278657810231591630928516206E4L,
+ -2.024301798136027039250415126250455056397E3L,
+ 8.057002716646055371965756206836056074715E1L,
+ -8.828896441624934385266096344596648080902E-1L
+};
+static const long double S[6] =
+{
+ 1.701761051846631278975701529965589676574E6L,
+ -1.332535117259762928288745111081235577029E6L,
+ 4.001557694070773974936904547424676279307E5L,
+ -5.748542087379434595104154610899551484314E4L,
+ 3.998526750980007367835804959888064681098E3L,
+ -1.186359407982897997337150403816839480438E2L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+static const long double
+/* log10(2) */
+L102A = 0.3125L,
+L102B = -1.14700043360188047862611052755069732318101185E-2L,
+/* log10(e) */
+L10EA = 0.5L,
+L10EB = -6.570551809674817234887108108339491770560299E-2L,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1L;
+
+
+
+/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = x + *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+
+long double
+__ieee754_log10l (x)
+ long double x;
+{
+ long double z;
+ long double y;
+ int e;
+ int64_t hx, lx;
+
+/* Test for domain */
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+ return (-1.0L / (x - x));
+ if (hx < 0)
+ return (x - x) / (x - x);
+ if (hx >= 0x7ff0000000000000LL)
+ return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+ x = __frexpl (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+ if ((e > 2) || (e < -2))
+ {
+ if (x < SQRTH)
+ { /* 2( 2x-1 )/( 2x+1 ) */
+ e -= 1;
+ z = x - 0.5L;
+ y = 0.5L * z + 0.5L;
+ }
+ else
+ { /* 2 (x-1)/(x+1) */
+ z = x - 0.5L;
+ z -= 0.5L;
+ y = 0.5L * x + 0.5L;
+ }
+ x = z / y;
+ z = x * x;
+ y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+ goto done;
+ }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+ if (x < SQRTH)
+ {
+ e -= 1;
+ x = 2.0 * x - 1.0L; /* 2x - 1 */
+ }
+ else
+ {
+ x = x - 1.0L;
+ }
+ z = x * x;
+ y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+ y = y - 0.5 * z;
+
+done:
+
+ /* Multiply log of fraction by log10(e)
+ * and base 2 exponent by log10(2).
+ */
+ z = y * L10EB;
+ z += x * L10EB;
+ z += e * L102B;
+ z += y * L10EA;
+ z += x * L10EA;
+ z += e * L102A;
+ return (z);
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
new file mode 100644
index 0000000..fe8a8e1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
@@ -0,0 +1,250 @@
+/* log2l.c
+ * Base 2 logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log2l();
+ *
+ * y = log2l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 2 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts. If the exponent is between -1 and +1, the (natural)
+ * logarithm of the fraction is approximated by
+ *
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting z = 2(x-1)/x+1),
+ *
+ * log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE 0.5, 2.0 100,000 2.6e-34 4.9e-35
+ * IEEE exp(+-10000) 100,000 9.6e-35 4.0e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+ Cephes Math Library Release 2.2: January, 1991
+ Copyright 1984, 1991 by Stephen L. Moshier
+ Adapted for glibc November, 2001
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double P[13] =
+{
+ 1.313572404063446165910279910527789794488E4L,
+ 7.771154681358524243729929227226708890930E4L,
+ 2.014652742082537582487669938141683759923E5L,
+ 3.007007295140399532324943111654767187848E5L,
+ 2.854829159639697837788887080758954924001E5L,
+ 1.797628303815655343403735250238293741397E5L,
+ 7.594356839258970405033155585486712125861E4L,
+ 2.128857716871515081352991964243375186031E4L,
+ 3.824952356185897735160588078446136783779E3L,
+ 4.114517881637811823002128927449878962058E2L,
+ 2.321125933898420063925789532045674660756E1L,
+ 4.998469661968096229986658302195402690910E-1L,
+ 1.538612243596254322971797716843006400388E-6L
+};
+static const long double Q[12] =
+{
+ 3.940717212190338497730839731583397586124E4L,
+ 2.626900195321832660448791748036714883242E5L,
+ 7.777690340007566932935753241556479363645E5L,
+ 1.347518538384329112529391120390701166528E6L,
+ 1.514882452993549494932585972882995548426E6L,
+ 1.158019977462989115839826904108208787040E6L,
+ 6.132189329546557743179177159925690841200E5L,
+ 2.248234257620569139969141618556349415120E5L,
+ 5.605842085972455027590989944010492125825E4L,
+ 9.147150349299596453976674231612674085381E3L,
+ 9.104928120962988414618126155557301584078E2L,
+ 4.839208193348159620282142911143429644326E1L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double R[6] =
+{
+ 1.418134209872192732479751274970992665513E5L,
+ -8.977257995689735303686582344659576526998E4L,
+ 2.048819892795278657810231591630928516206E4L,
+ -2.024301798136027039250415126250455056397E3L,
+ 8.057002716646055371965756206836056074715E1L,
+ -8.828896441624934385266096344596648080902E-1L
+};
+static const long double S[6] =
+{
+ 1.701761051846631278975701529965589676574E6L,
+ -1.332535117259762928288745111081235577029E6L,
+ 4.001557694070773974936904547424676279307E5L,
+ -5.748542087379434595104154610899551484314E4L,
+ 3.998526750980007367835804959888064681098E3L,
+ -1.186359407982897997337150403816839480438E2L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+static const long double
+/* log2(e) - 1 */
+LOG2EA = 4.4269504088896340735992468100189213742664595E-1L,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1L;
+
+
+/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = x + *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+
+long double
+__ieee754_log2l (x)
+ long double x;
+{
+ long double z;
+ long double y;
+ int e;
+ int64_t hx, lx;
+
+/* Test for domain */
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+ return (-1.0L / (x - x));
+ if (hx < 0)
+ return (x - x) / (x - x);
+ if (hx >= 0x7ff0000000000000LL)
+ return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+ x = __frexpl (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+ if ((e > 2) || (e < -2))
+ {
+ if (x < SQRTH)
+ { /* 2( 2x-1 )/( 2x+1 ) */
+ e -= 1;
+ z = x - 0.5L;
+ y = 0.5L * z + 0.5L;
+ }
+ else
+ { /* 2 (x-1)/(x+1) */
+ z = x - 0.5L;
+ z -= 0.5L;
+ y = 0.5L * x + 0.5L;
+ }
+ x = z / y;
+ z = x * x;
+ y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+ goto done;
+ }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+ if (x < SQRTH)
+ {
+ e -= 1;
+ x = 2.0 * x - 1.0L; /* 2x - 1 */
+ }
+ else
+ {
+ x = x - 1.0L;
+ }
+ z = x * x;
+ y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+ y = y - 0.5 * z;
+
+done:
+
+/* Multiply log of fraction by log2(e)
+ * and base 2 exponent by 1
+ */
+ z = y * LOG2EA;
+ z += x * LOG2EA;
+ z += y;
+ z += x;
+ z += e;
+ return (z);
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
new file mode 100644
index 0000000..aa5fc37
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
@@ -0,0 +1,281 @@
+/* logll.c
+ *
+ * Natural logarithm for 128-bit long double precision.
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, logl();
+ *
+ * y = logl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base e (2.718...) logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts. Use of a lookup table increases the speed of the routine.
+ * The program uses logarithms tabulated at intervals of 1/128 to
+ * cover the domain from approximately 0.7 to 1.4.
+ *
+ * On the interval [-1/128, +1/128] the logarithm of 1+x is approximated by
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x) .
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE 0.875, 1.125 100000 1.2e-34 4.1e-35
+ * IEEE 0.125, 8 100000 1.2e-34 4.1e-35
+ *
+ *
+ * WARNING:
+ *
+ * This program uses integer operations on bit fields of floating-point
+ * numbers. It does not work with data structures other than the
+ * structure assumed.
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "math_private.h"
+
+/* log(1+x) = x - .5 x^2 + x^3 l(x)
+ -.0078125 <= x <= +.0078125
+ peak relative error 1.2e-37 */
+static const long double
+l3 = 3.333333333333333333333333333333336096926E-1L,
+l4 = -2.499999999999999999999999999486853077002E-1L,
+l5 = 1.999999999999999999999999998515277861905E-1L,
+l6 = -1.666666666666666666666798448356171665678E-1L,
+l7 = 1.428571428571428571428808945895490721564E-1L,
+l8 = -1.249999999999999987884655626377588149000E-1L,
+l9 = 1.111111111111111093947834982832456459186E-1L,
+l10 = -1.000000000000532974938900317952530453248E-1L,
+l11 = 9.090909090915566247008015301349979892689E-2L,
+l12 = -8.333333211818065121250921925397567745734E-2L,
+l13 = 7.692307559897661630807048686258659316091E-2L,
+l14 = -7.144242754190814657241902218399056829264E-2L,
+l15 = 6.668057591071739754844678883223432347481E-2L;
+
+/* Lookup table of ln(t) - (t-1)
+ t = 0.5 + (k+26)/128)
+ k = 0, ..., 91 */
+static const long double logtbl[92] = {
+-5.5345593589352099112142921677820359632418E-2L,
+-5.2108257402767124761784665198737642086148E-2L,
+-4.8991686870576856279407775480686721935120E-2L,
+-4.5993270766361228596215288742353061431071E-2L,
+-4.3110481649613269682442058976885699556950E-2L,
+-4.0340872319076331310838085093194799765520E-2L,
+-3.7682072451780927439219005993827431503510E-2L,
+-3.5131785416234343803903228503274262719586E-2L,
+-3.2687785249045246292687241862699949178831E-2L,
+-3.0347913785027239068190798397055267411813E-2L,
+-2.8110077931525797884641940838507561326298E-2L,
+-2.5972247078357715036426583294246819637618E-2L,
+-2.3932450635346084858612873953407168217307E-2L,
+-2.1988775689981395152022535153795155900240E-2L,
+-2.0139364778244501615441044267387667496733E-2L,
+-1.8382413762093794819267536615342902718324E-2L,
+-1.6716169807550022358923589720001638093023E-2L,
+-1.5138929457710992616226033183958974965355E-2L,
+-1.3649036795397472900424896523305726435029E-2L,
+-1.2244881690473465543308397998034325468152E-2L,
+-1.0924898127200937840689817557742469105693E-2L,
+-9.6875626072830301572839422532631079809328E-3L,
+-8.5313926245226231463436209313499745894157E-3L,
+-7.4549452072765973384933565912143044991706E-3L,
+-6.4568155251217050991200599386801665681310E-3L,
+-5.5356355563671005131126851708522185605193E-3L,
+-4.6900728132525199028885749289712348829878E-3L,
+-3.9188291218610470766469347968659624282519E-3L,
+-3.2206394539524058873423550293617843896540E-3L,
+-2.5942708080877805657374888909297113032132E-3L,
+-2.0385211375711716729239156839929281289086E-3L,
+-1.5522183228760777967376942769773768850872E-3L,
+-1.1342191863606077520036253234446621373191E-3L,
+-7.8340854719967065861624024730268350459991E-4L,
+-4.9869831458030115699628274852562992756174E-4L,
+-2.7902661731604211834685052867305795169688E-4L,
+-1.2335696813916860754951146082826952093496E-4L,
+-3.0677461025892873184042490943581654591817E-5L,
+#define ZERO logtbl[38]
+ 0.0000000000000000000000000000000000000000E0L,
+-3.0359557945051052537099938863236321874198E-5L,
+-1.2081346403474584914595395755316412213151E-4L,
+-2.7044071846562177120083903771008342059094E-4L,
+-4.7834133324631162897179240322783590830326E-4L,
+-7.4363569786340080624467487620270965403695E-4L,
+-1.0654639687057968333207323853366578860679E-3L,
+-1.4429854811877171341298062134712230604279E-3L,
+-1.8753781835651574193938679595797367137975E-3L,
+-2.3618380914922506054347222273705859653658E-3L,
+-2.9015787624124743013946600163375853631299E-3L,
+-3.4938307889254087318399313316921940859043E-3L,
+-4.1378413103128673800485306215154712148146E-3L,
+-4.8328735414488877044289435125365629849599E-3L,
+-5.5782063183564351739381962360253116934243E-3L,
+-6.3731336597098858051938306767880719015261E-3L,
+-7.2169643436165454612058905294782949315193E-3L,
+-8.1090214990427641365934846191367315083867E-3L,
+-9.0486422112807274112838713105168375482480E-3L,
+-1.0035177140880864314674126398350812606841E-2L,
+-1.1067990155502102718064936259435676477423E-2L,
+-1.2146457974158024928196575103115488672416E-2L,
+-1.3269969823361415906628825374158424754308E-2L,
+-1.4437927104692837124388550722759686270765E-2L,
+-1.5649743073340777659901053944852735064621E-2L,
+-1.6904842527181702880599758489058031645317E-2L,
+-1.8202661505988007336096407340750378994209E-2L,
+-1.9542647000370545390701192438691126552961E-2L,
+-2.0924256670080119637427928803038530924742E-2L,
+-2.2346958571309108496179613803760727786257E-2L,
+-2.3810230892650362330447187267648486279460E-2L,
+-2.5313561699385640380910474255652501521033E-2L,
+-2.6856448685790244233704909690165496625399E-2L,
+-2.8438398935154170008519274953860128449036E-2L,
+-3.0058928687233090922411781058956589863039E-2L,
+-3.1717563112854831855692484086486099896614E-2L,
+-3.3413836095418743219397234253475252001090E-2L,
+-3.5147290019036555862676702093393332533702E-2L,
+-3.6917475563073933027920505457688955423688E-2L,
+-3.8723951502862058660874073462456610731178E-2L,
+-4.0566284516358241168330505467000838017425E-2L,
+-4.2444048996543693813649967076598766917965E-2L,
+-4.4356826869355401653098777649745233339196E-2L,
+-4.6304207416957323121106944474331029996141E-2L,
+-4.8285787106164123613318093945035804818364E-2L,
+-5.0301169421838218987124461766244507342648E-2L,
+-5.2349964705088137924875459464622098310997E-2L,
+-5.4431789996103111613753440311680967840214E-2L,
+-5.6546268881465384189752786409400404404794E-2L,
+-5.8693031345788023909329239565012647817664E-2L,
+-6.0871713627532018185577188079210189048340E-2L,
+-6.3081958078862169742820420185833800925568E-2L,
+-6.5323413029406789694910800219643791556918E-2L,
+-6.7595732653791419081537811574227049288168E-2L
+};
+
+/* ln(2) = ln2a + ln2b with extended precision. */
+static const long double
+ ln2a = 6.93145751953125e-1L,
+ ln2b = 1.4286068203094172321214581765680755001344E-6L;
+
+long double
+__ieee754_logl(long double x)
+{
+ long double z, y, w;
+ ieee854_long_double_shape_type u, t;
+ unsigned int m;
+ int k, e;
+
+ u.value = x;
+ m = u.parts32.w0;
+
+ /* Check for IEEE special cases. */
+ k = m & 0x7fffffff;
+ /* log(0) = -infinity. */
+ if ((k | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ {
+ return -0.5L / ZERO;
+ }
+ /* log ( x < 0 ) = NaN */
+ if (m & 0x80000000)
+ {
+ return (x - x) / ZERO;
+ }
+ /* log (infinity or NaN) */
+ if (k >= 0x7ff00000)
+ {
+ return x + x;
+ }
+
+ /* On this interval the table is not used due to cancellation error. */
+ if ((x <= 1.0078125L) && (x >= 0.9921875L))
+ {
+ z = x - 1.0L;
+ k = 64;
+ t.value = 1.0L;
+ e = 0;
+ }
+ else
+ {
+ /* Extract exponent and reduce domain to 0.703125 <= u < 1.40625 */
+ unsigned int w0;
+ e = (int) (m >> 20) - (int) 0x3fe;
+ m &= 0xfffff;
+ w0 = m | 0x3fe00000;
+ m |= 0x100000;
+ /* Find lookup table index k from high order bits of the significand. */
+ if (m < 0x168000)
+ {
+ k = (m - 0xff000) >> 13;
+ /* t is the argument 0.5 + (k+26)/128
+ of the nearest item to u in the lookup table. */
+ t.parts32.w0 = 0x3ff00000 + (k << 13);
+ t.parts32.w1 = 0;
+ t.parts32.w2 = 0;
+ t.parts32.w3 = 0;
+ w0 += 0x100000;
+ e -= 1;
+ k += 64;
+ }
+ else
+ {
+ k = (m - 0xfe000) >> 14;
+ t.parts32.w0 = 0x3fe00000 + (k << 14);
+ t.parts32.w1 = 0;
+ t.parts32.w2 = 0;
+ t.parts32.w3 = 0;
+ }
+ u.value = __scalbnl (u.value, ((int) ((w0 - u.parts32.w0) * 2)) >> 21);
+ /* log(u) = log( t u/t ) = log(t) + log(u/t)
+ log(t) is tabulated in the lookup table.
+ Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t.
+ cf. Cody & Waite. */
+ z = (u.value - t.value) / t.value;
+ }
+ /* Series expansion of log(1+z). */
+ w = z * z;
+ y = ((((((((((((l15 * z
+ + l14) * z
+ + l13) * z
+ + l12) * z
+ + l11) * z
+ + l10) * z
+ + l9) * z
+ + l8) * z
+ + l7) * z
+ + l6) * z
+ + l5) * z
+ + l4) * z
+ + l3) * z * w;
+ y -= 0.5 * w;
+ y += e * ln2b; /* Base 2 exponent offset times ln(2). */
+ y += z;
+ y += logtbl[k-26]; /* log(t) - (t-1) */
+ y += (t.value - 1.0L);
+ y += e * ln2a;
+ return y;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
new file mode 100644
index 0000000..feeaa8c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
@@ -0,0 +1,441 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Expansions and modifications for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __ieee754_powl(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 113-53 = 60 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
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double bp[] = {
+ 1.0L,
+ 1.5L,
+};
+
+/* log_2(1.5) */
+static const long double dp_h[] = {
+ 0.0,
+ 5.8496250072115607565592654282227158546448E-1L
+};
+
+/* Low part of log_2(1.5) */
+static const long double dp_l[] = {
+ 0.0,
+ 1.0579781240112554492329533686862998106046E-16L
+};
+
+static const long double zero = 0.0L,
+ one = 1.0L,
+ two = 2.0L,
+ two113 = 1.0384593717069655257060992658440192E34L,
+ huge = 1.0e3000L,
+ tiny = 1.0e-3000L;
+
+/* 3/2 log x = 3 z + z^3 + z^3 (z^2 R(z^2))
+ z = (x-1)/(x+1)
+ 1 <= x <= 1.25
+ Peak relative error 2.3e-37 */
+static const long double LN[] =
+{
+ -3.0779177200290054398792536829702930623200E1L,
+ 6.5135778082209159921251824580292116201640E1L,
+ -4.6312921812152436921591152809994014413540E1L,
+ 1.2510208195629420304615674658258363295208E1L,
+ -9.9266909031921425609179910128531667336670E-1L
+};
+static const long double LD[] =
+{
+ -5.129862866715009066465422805058933131960E1L,
+ 1.452015077564081884387441590064272782044E2L,
+ -1.524043275549860505277434040464085593165E2L,
+ 7.236063513651544224319663428634139768808E1L,
+ -1.494198912340228235853027849917095580053E1L
+ /* 1.0E0 */
+};
+
+/* exp(x) = 1 + x - x / (1 - 2 / (x - x^2 R(x^2)))
+ 0 <= x <= 0.5
+ Peak relative error 5.7e-38 */
+static const long double PN[] =
+{
+ 5.081801691915377692446852383385968225675E8L,
+ 9.360895299872484512023336636427675327355E6L,
+ 4.213701282274196030811629773097579432957E4L,
+ 5.201006511142748908655720086041570288182E1L,
+ 9.088368420359444263703202925095675982530E-3L,
+};
+static const long double PD[] =
+{
+ 3.049081015149226615468111430031590411682E9L,
+ 1.069833887183886839966085436512368982758E8L,
+ 8.259257717868875207333991924545445705394E5L,
+ 1.872583833284143212651746812884298360922E3L,
+ /* 1.0E0 */
+};
+
+static const long double
+ /* ln 2 */
+ lg2 = 6.9314718055994530941723212145817656807550E-1L,
+ lg2_h = 6.9314718055994528622676398299518041312695E-1L,
+ lg2_l = 2.3190468138462996154948554638754786504121E-17L,
+ ovt = 8.0085662595372944372e-0017L,
+ /* 2/(3*log(2)) */
+ cp = 9.6179669392597560490661645400126142495110E-1L,
+ cp_h = 9.6179669392597555432899980587535537779331E-1L,
+ cp_l = 5.0577616648125906047157785230014751039424E-17L;
+
+#ifdef __STDC__
+long double
+__ieee754_powl (long double x, long double y)
+#else
+long double
+__ieee754_powl (x, y)
+ long double x, y;
+#endif
+{
+ long double z, ax, z_h, z_l, p_h, p_l;
+ long double y1, t1, t2, r, s, t, u, v, w;
+ long double s2, s_h, s_l, t_h, t_l;
+ int32_t i, j, k, yisint, n;
+ u_int32_t ix, iy;
+ int32_t hx, hy;
+ ieee854_long_double_shape_type o, p, q;
+
+ p.value = x;
+ hx = p.parts32.w0;
+ ix = hx & 0x7fffffff;
+
+ q.value = y;
+ hy = q.parts32.w0;
+ iy = hy & 0x7fffffff;
+
+
+ /* y==zero: x**0 = 1 */
+ if ((iy | q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ return one;
+
+ /* 1.0**y = 1; -1.0**+-Inf = 1 */
+ if (x == one)
+ return one;
+ if (x == -1.0L && iy == 0x7ff00000
+ && (q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ return one;
+
+ /* +-NaN return x+y */
+ if ((ix > 0x7ff00000)
+ || ((ix == 0x7ff00000)
+ && ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) != 0))
+ || (iy > 0x7ff00000)
+ || ((iy == 0x7ff00000)
+ && ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) != 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 ((q.parts32.w2 & 0x7fffffff) >= 0x43400000) /* Low part >= 2^53 */
+ yisint = 2; /* even integer y */
+ else if (iy >= 0x3ff00000) /* 1.0 */
+ {
+ if (__floorl (y) == y)
+ {
+ z = 0.5 * y;
+ if (__floorl (z) == z)
+ yisint = 2;
+ else
+ yisint = 1;
+ }
+ }
+ }
+
+ /* special value of y */
+ if ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+ {
+ if (iy == 0x7ff00000 && q.parts32.w1 == 0) /* y is +-inf */
+ {
+ if (((ix - 0x3ff00000) | p.parts32.w1
+ | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
+ return y - y; /* inf**+-1 is NaN */
+ else if (ix > 0x3ff00000 || fabsl (x) > 1.0L)
+ /* (|x|>1)**+-inf = inf,0 */
+ return (hy >= 0) ? y : zero;
+ else
+ /* (|x|<1)**-,+inf = inf,0 */
+ return (hy < 0) ? -y : zero;
+ }
+ if (iy == 0x3ff00000)
+ { /* y is +-1 */
+ if (hy < 0)
+ return one / 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_sqrtl (x);
+ }
+ }
+
+ ax = fabsl (x);
+ /* special value of x */
+ if ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
+ {
+ if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)
+ {
+ z = ax; /*x is +-0,+-inf,+-1 */
+ if (hy < 0)
+ z = one / 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.
+ 2^-16495 = 1/2 of smallest representable value.
+ If (1 - 1/131072)^y underflows, y > 1.4986e9 */
+ if (iy > 0x41d654b0)
+ {
+ /* if (1 - 2^-113)^y underflows, y > 1.1873e38 */
+ if (iy > 0x47d654b0)
+ {
+ if (ix <= 0x3fefffff)
+ return (hy < 0) ? huge * huge : tiny * tiny;
+ if (ix >= 0x3ff00000)
+ return (hy > 0) ? huge * huge : tiny * tiny;
+ }
+ /* over/underflow if x is not close to one */
+ if (ix < 0x3fefffff)
+ return (hy < 0) ? huge * huge : tiny * tiny;
+ if (ix > 0x3ff00000)
+ return (hy > 0) ? huge * huge : tiny * tiny;
+ }
+
+ n = 0;
+ /* take care subnormal number */
+ if (ix < 0x00100000)
+ {
+ ax *= two113;
+ n -= 113;
+ o.value = ax;
+ ix = o.parts32.w0;
+ }
+ n += ((ix) >> 20) - 0x3ff;
+ j = ix & 0x000fffff;
+ /* determine interval */
+ ix = j | 0x3ff00000; /* normalize ix */
+ if (j <= 0x39880)
+ k = 0; /* |x|<sqrt(3/2) */
+ else if (j < 0xbb670)
+ k = 1; /* |x|<sqrt(3) */
+ else
+ {
+ k = 0;
+ n += 1;
+ ix -= 0x00100000;
+ }
+
+ o.value = ax;
+ o.value = __scalbnl (o.value, ((int) ((ix - o.parts32.w0) * 2)) >> 21);
+ ax = o.value;
+
+ /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
+ u = ax - bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
+ v = one / (ax + bp[k]);
+ s = u * v;
+ s_h = s;
+
+ o.value = s_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ s_h = o.value;
+ /* t_h=ax+bp[k] High */
+ t_h = ax + bp[k];
+ o.value = t_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t_h = o.value;
+ 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;
+ u = LN[0] + s2 * (LN[1] + s2 * (LN[2] + s2 * (LN[3] + s2 * LN[4])));
+ v = LD[0] + s2 * (LD[1] + s2 * (LD[2] + s2 * (LD[3] + s2 * (LD[4] + s2))));
+ r = s2 * s2 * u / v;
+ r += s_l * (s_h + s);
+ s2 = s_h * s_h;
+ t_h = 3.0 + s2 + r;
+ o.value = t_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t_h = o.value;
+ 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;
+ o.value = p_h;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ p_h = o.value;
+ 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 = (long double) n;
+ t1 = (((z_h + z_l) + dp_h[k]) + t);
+ o.value = t1;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t1 = o.value;
+ t2 = z_l - (((t1 - t) - dp_h[k]) - z_h);
+
+ /* s (sign of result -ve**odd) = -1 else = 1 */
+ s = one;
+ 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) */
+ y1 = y;
+ o.value = y1;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ y1 = o.value;
+ p_l = (y - y1) * t1 + y * t2;
+ p_h = y1 * t1;
+ z = p_l + p_h;
+ o.value = z;
+ j = o.parts32.w0;
+ if (j >= 0x40d00000) /* z >= 16384 */
+ {
+ /* if z > 16384 */
+ if (((j - 0x40d00000) | o.parts32.w1
+ | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ return s * huge * huge; /* overflow */
+ else
+ {
+ if (p_l + ovt > z - p_h)
+ return s * huge * huge; /* overflow */
+ }
+ }
+ else if ((j & 0x7fffffff) >= 0x40d01b90) /* z <= -16495 */
+ {
+ /* z < -16495 */
+ if (((j - 0xc0d01bc0) | o.parts32.w1
+ | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+ return s * tiny * tiny; /* underflow */
+ else
+ {
+ if (p_l <= z - p_h)
+ return s * tiny * tiny; /* 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 = __floorl (z + 0.5L);
+ t = n;
+ p_h -= t;
+ }
+ t = p_l + p_h;
+ o.value = t;
+ o.parts32.w3 = 0;
+ o.parts32.w2 &= 0xffff8000;
+ t = o.value;
+ u = t * lg2_h;
+ v = (p_l - (t - p_h)) * lg2 + t * lg2_l;
+ z = u + v;
+ w = v - (z - u);
+ /* exp(z) */
+ t = z * z;
+ u = PN[0] + t * (PN[1] + t * (PN[2] + t * (PN[3] + t * PN[4])));
+ v = PD[0] + t * (PD[1] + t * (PD[2] + t * (PD[3] + t)));
+ t1 = z - t * u / v;
+ r = (z * t1) / (t1 - two) - (w + z * w);
+ z = one - (r - z);
+ z = __scalbnl (z, n);
+ return s * z;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
new file mode 100644
index 0000000..8b1c976
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
@@ -0,0 +1,278 @@
+/* Quad-precision floating point argument reduction.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+#include <ieee754.h>
+
+/*
+ * Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi
+ */
+static const int32_t two_over_pi[] = {
+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,
+0x47c419, 0xc367cd, 0xdce809, 0x2a8359, 0xc4768b, 0x961ca6,
+0xddaf44, 0xd15719, 0x053ea5, 0xff0705, 0x3f7e33, 0xe832c2,
+0xde4f98, 0x327dbb, 0xc33d26, 0xef6b1e, 0x5ef89f, 0x3a1f35,
+0xcaf27f, 0x1d87f1, 0x21907c, 0x7c246a, 0xfa6ed5, 0x772d30,
+0x433b15, 0xc614b5, 0x9d19c3, 0xc2c4ad, 0x414d2c, 0x5d000c,
+0x467d86, 0x2d71e3, 0x9ac69b, 0x006233, 0x7cd2b4, 0x97a7b4,
+0xd55537, 0xf63ed7, 0x1810a3, 0xfc764d, 0x2a9d64, 0xabd770,
+0xf87c63, 0x57b07a, 0xe71517, 0x5649c0, 0xd9d63b, 0x3884a7,
+0xcb2324, 0x778ad6, 0x23545a, 0xb91f00, 0x1b0af1, 0xdfce19,
+0xff319f, 0x6a1e66, 0x615799, 0x47fbac, 0xd87f7e, 0xb76522,
+0x89e832, 0x60bfe6, 0xcdc4ef, 0x09366c, 0xd43f5d, 0xd7de16,
+0xde3b58, 0x929bde, 0x2822d2, 0xe88628, 0x4d58e2, 0x32cac6,
+0x16e308, 0xcb7de0, 0x50c017, 0xa71df3, 0x5be018, 0x34132e,
+0x621283, 0x014883, 0x5b8ef5, 0x7fb0ad, 0xf2e91e, 0x434a48,
+0xd36710, 0xd8ddaa, 0x425fae, 0xce616a, 0xa4280a, 0xb499d3,
+0xf2a606, 0x7f775c, 0x83c2a3, 0x883c61, 0x78738a, 0x5a8caf,
+0xbdd76f, 0x63a62d, 0xcbbff4, 0xef818d, 0x67c126, 0x45ca55,
+0x36d9ca, 0xd2a828, 0x8d61c2, 0x77c912, 0x142604, 0x9b4612,
+0xc459c4, 0x44c5c8, 0x91b24d, 0xf31700, 0xad43d4, 0xe54929,
+0x10d5fd, 0xfcbe00, 0xcc941e, 0xeece70, 0xf53e13, 0x80f1ec,
+0xc3e7b3, 0x28f8c7, 0x940593, 0x3e71c1, 0xb3092e, 0xf3450b,
+0x9c1288, 0x7b20ab, 0x9fb52e, 0xc29247, 0x2f327b, 0x6d550c,
+0x90a772, 0x1fe76b, 0x96cb31, 0x4a1679, 0xe27941, 0x89dff4,
+0x9794e8, 0x84e6e2, 0x973199, 0x6bed88, 0x365f5f, 0x0efdbb,
+0xb49a48, 0x6ca467, 0x427271, 0x325d8d, 0xb8159f, 0x09e5bc,
+0x25318d, 0x3974f7, 0x1c0530, 0x010c0d, 0x68084b, 0x58ee2c,
+0x90aa47, 0x02e774, 0x24d6bd, 0xa67df7, 0x72486e, 0xef169f,
+0xa6948e, 0xf691b4, 0x5153d1, 0xf20acf, 0x339820, 0x7e4bf5,
+0x6863b2, 0x5f3edd, 0x035d40, 0x7f8985, 0x295255, 0xc06437,
+0x10d86d, 0x324832, 0x754c5b, 0xd4714e, 0x6e5445, 0xc1090b,
+0x69f52a, 0xd56614, 0x9d0727, 0x50045d, 0xdb3bb4, 0xc576ea,
+0x17f987, 0x7d6b49, 0xba271d, 0x296996, 0xacccc6, 0x5414ad,
+0x6ae290, 0x89d988, 0x50722c, 0xbea404, 0x940777, 0x7030f3,
+0x27fc00, 0xa871ea, 0x49c266, 0x3de064, 0x83dd97, 0x973fa3,
+0xfd9443, 0x8c860d, 0xde4131, 0x9d3992, 0x8c70dd, 0xe7b717,
+0x3bdf08, 0x2b3715, 0xa0805c, 0x93805a, 0x921110, 0xd8e80f,
+0xaf806c, 0x4bffdb, 0x0f9038, 0x761859, 0x15a562, 0xbbcb61,
+0xb989c7, 0xbd4010, 0x04f2d2, 0x277549, 0xf6b6eb, 0xbb22db,
+0xaa140a, 0x2f2689, 0x768364, 0x333b09, 0x1a940e, 0xaa3a51,
+0xc2a31d, 0xaeedaf, 0x12265c, 0x4dc26d, 0x9c7a2d, 0x9756c0,
+0x833f03, 0xf6f009, 0x8c402b, 0x99316d, 0x07b439, 0x15200c,
+0x5bc3d8, 0xc492f5, 0x4badc6, 0xa5ca4e, 0xcd37a7, 0x36a9e6,
+0x9492ab, 0x6842dd, 0xde6319, 0xef8c76, 0x528b68, 0x37dbfc,
+0xaba1ae, 0x3115df, 0xa1ae00, 0xdafb0c, 0x664d64, 0xb705ed,
+0x306529, 0xbf5657, 0x3aff47, 0xb9f96a, 0xf3be75, 0xdf9328,
+0x3080ab, 0xf68c66, 0x15cb04, 0x0622fa, 0x1de4d9, 0xa4b33d,
+0x8f1b57, 0x09cd36, 0xe9424e, 0xa4be13, 0xb52333, 0x1aaaf0,
+0xa8654f, 0xa5c1d2, 0x0f3f0b, 0xcd785b, 0x76f923, 0x048b7b,
+0x721789, 0x53a6c6, 0xe26e6f, 0x00ebef, 0x584a9b, 0xb7dac4,
+0xba66aa, 0xcfcf76, 0x1d02d1, 0x2df1b1, 0xc1998c, 0x77adc3,
+0xda4886, 0xa05df7, 0xf480c6, 0x2ff0ac, 0x9aecdd, 0xbc5c3f,
+0x6dded0, 0x1fc790, 0xb6db2a, 0x3a25a3, 0x9aaf00, 0x9353ad,
+0x0457b6, 0xb42d29, 0x7e804b, 0xa707da, 0x0eaa76, 0xa1597b,
+0x2a1216, 0x2db7dc, 0xfde5fa, 0xfedb89, 0xfdbe89, 0x6c76e4,
+0xfca906, 0x70803e, 0x156e85, 0xff87fd, 0x073e28, 0x336761,
+0x86182a, 0xeabd4d, 0xafe7b3, 0x6e6d8f, 0x396795, 0x5bbf31,
+0x48d784, 0x16df30, 0x432dc7, 0x356125, 0xce70c9, 0xb8cb30,
+0xfd6cbf, 0xa200a4, 0xe46c05, 0xa0dd5a, 0x476f21, 0xd21262,
+0x845cb9, 0x496170, 0xe0566b, 0x015299, 0x375550, 0xb7d51e,
+0xc4f133, 0x5f6e13, 0xe4305d, 0xa92e85, 0xc3b21d, 0x3632a1,
+0xa4b708, 0xd4b1ea, 0x21f716, 0xe4698f, 0x77ff27, 0x80030c,
+0x2d408d, 0xa0cd4f, 0x99a520, 0xd3a2b3, 0x0a5d2f, 0x42f9b4,
+0xcbda11, 0xd0be7d, 0xc1db9b, 0xbd17ab, 0x81a2ca, 0x5c6a08,
+0x17552e, 0x550027, 0xf0147f, 0x8607e1, 0x640b14, 0x8d4196,
+0xdebe87, 0x2afdda, 0xb6256b, 0x34897b, 0xfef305, 0x9ebfb9,
+0x4f6a68, 0xa82a4a, 0x5ac44f, 0xbcf82d, 0x985ad7, 0x95c7f4,
+0x8d4d0d, 0xa63a20, 0x5f57a4, 0xb13f14, 0x953880, 0x0120cc,
+0x86dd71, 0xb6dec9, 0xf560bf, 0x11654d, 0x6b0701, 0xacb08c,
+0xd0c0b2, 0x485551, 0x0efb1e, 0xc37295, 0x3b06a3, 0x3540c0,
+0x7bdc06, 0xcc45e0, 0xfa294e, 0xc8cad6, 0x41f3e8, 0xde647c,
+0xd8649b, 0x31bed9, 0xc397a4, 0xd45877, 0xc5e369, 0x13daf0,
+0x3c3aba, 0x461846, 0x5f7555, 0xf5bdd2, 0xc6926e, 0x5d2eac,
+0xed440e, 0x423e1c, 0x87c461, 0xe9fd29, 0xf3d6e7, 0xca7c22,
+0x35916f, 0xc5e008, 0x8dd7ff, 0xe26a6e, 0xc6fdb0, 0xc10893,
+0x745d7c, 0xb2ad6b, 0x9d6ecd, 0x7b723e, 0x6a11c6, 0xa9cff7,
+0xdf7329, 0xbac9b5, 0x5100b7, 0x0db2e2, 0x24ba74, 0x607de5,
+0x8ad874, 0x2c150d, 0x0c1881, 0x94667e, 0x162901, 0x767a9f,
+0xbefdfd, 0xef4556, 0x367ed9, 0x13d9ec, 0xb9ba8b, 0xfc97c4,
+0x27a831, 0xc36ef1, 0x36c594, 0x56a8d8, 0xb5a8b4, 0x0ecccf,
+0x2d8912, 0x34576f, 0x89562c, 0xe3ce99, 0xb920d6, 0xaa5e6b,
+0x9c2a3e, 0xcc5f11, 0x4a0bfd, 0xfbf4e1, 0x6d3b8e, 0x2c86e2,
+0x84d4e9, 0xa9b4fc, 0xd1eeef, 0xc9352e, 0x61392f, 0x442138,
+0xc8d91b, 0x0afc81, 0x6a4afb, 0xd81c2f, 0x84b453, 0x8c994e,
+0xcc2254, 0xdc552a, 0xd6c6c0, 0x96190b, 0xb8701a, 0x649569,
+0x605a26, 0xee523f, 0x0f117f, 0x11b5f4, 0xf5cbfc, 0x2dbc34,
+0xeebc34, 0xcc5de8, 0x605edd, 0x9b8e67, 0xef3392, 0xb817c9,
+0x9b5861, 0xbc57e1, 0xc68351, 0x103ed8, 0x4871dd, 0xdd1c2d,
+0xa118af, 0x462c21, 0xd7f359, 0x987ad9, 0xc0549e, 0xfa864f,
+0xfc0656, 0xae79e5, 0x362289, 0x22ad38, 0xdc9367, 0xaae855,
+0x382682, 0x9be7ca, 0xa40d51, 0xb13399, 0x0ed7a9, 0x480569,
+0xf0b265, 0xa7887f, 0x974c88, 0x36d1f9, 0xb39221, 0x4a827b,
+0x21cf98, 0xdc9f40, 0x5547dc, 0x3a74e1, 0x42eb67, 0xdf9dfe,
+0x5fd45e, 0xa4677b, 0x7aacba, 0xa2f655, 0x23882b, 0x55ba41,
+0x086e59, 0x862a21, 0x834739, 0xe6e389, 0xd49ee5, 0x40fb49,
+0xe956ff, 0xca0f1c, 0x8a59c5, 0x2bfa94, 0xc5c1d3, 0xcfc50f,
+0xae5adb, 0x86c547, 0x624385, 0x3b8621, 0x94792c, 0x876110,
+0x7b4c2a, 0x1a2c80, 0x12bf43, 0x902688, 0x893c78, 0xe4c4a8,
+0x7bdbe5, 0xc23ac4, 0xeaf426, 0x8a67f7, 0xbf920d, 0x2ba365,
+0xb1933d, 0x0b7cbd, 0xdc51a4, 0x63dd27, 0xdde169, 0x19949a,
+0x9529a8, 0x28ce68, 0xb4ed09, 0x209f44, 0xca984e, 0x638270,
+0x237c7e, 0x32b90f, 0x8ef5a7, 0xe75614, 0x08f121, 0x2a9db5,
+0x4d7e6f, 0x5119a5, 0xabf9b5, 0xd6df82, 0x61dd96, 0x023616,
+0x9f3ac4, 0xa1a283, 0x6ded72, 0x7a8d39, 0xa9b882, 0x5c326b,
+0x5b2746, 0xed3400, 0x7700d2, 0x55f4fc, 0x4d5901, 0x8071e0,
+0xe13f89, 0xb295f3, 0x64a8f1, 0xaea74b, 0x38fc4c, 0xeab2bb,
+0x47270b, 0xabc3a7, 0x34ba60, 0x52dd34, 0xf8563a, 0xeb7e8a,
+0x31bb36, 0x5895b7, 0x47f7a9, 0x94c3aa, 0xd39225, 0x1e7f3e,
+0xd8974e, 0xbba94f, 0xd8ae01, 0xe661b4, 0x393d8e, 0xa523aa,
+0x33068e, 0x1633b5, 0x3bb188, 0x1d3a9d, 0x4013d0, 0xcc1be5,
+0xf862e7, 0x3bf28f, 0x39b5bf, 0x0bc235, 0x22747e, 0xa247c0,
+0xd52d1f, 0x19add3, 0x9094df, 0x9311d0, 0xb42b25, 0x496db2,
+0xe264b2, 0x5ef135, 0x3bc6a4, 0x1a4ad0, 0xaac92e, 0x64e886,
+0x573091, 0x982cfb, 0x311b1a, 0x08728b, 0xbdcee1, 0x60e142,
+0xeb641d, 0xd0bba3, 0xe559d4, 0x597b8c, 0x2a4483, 0xf332ba,
+0xf84867, 0x2c8d1b, 0x2fa9b0, 0x50f3dd, 0xf9f573, 0xdb61b4,
+0xfe233e, 0x6c41a6, 0xeea318, 0x775a26, 0xbc5e5c, 0xcea708,
+0x94dc57, 0xe20196, 0xf1e839, 0xbe4851, 0x5d2d2f, 0x4e9555,
+0xd96ec2, 0xe7d755, 0x6304e0, 0xc02e0e, 0xfc40a0, 0xbbf9b3,
+0x7125a7, 0x222dfb, 0xf619d8, 0x838c1c, 0x6619e6, 0xb20d55,
+0xbb5137, 0x79e809, 0xaf9149, 0x0d73de, 0x0b0da5, 0xce7f58,
+0xac1934, 0x724667, 0x7a1a13, 0x9e26bc, 0x4555e7, 0x585cb5,
+0x711d14, 0x486991, 0x480d60, 0x56adab, 0xd62f64, 0x96ee0c,
+0x212ff3, 0x5d6d88, 0xa67684, 0x95651e, 0xab9e0a, 0x4ddefe,
+0x571010, 0x836a39, 0xf8ea31, 0x9e381d, 0xeac8b1, 0xcac96b,
+0x37f21e, 0xd505e9, 0x984743, 0x9fc56c, 0x0331b7, 0x3b8bf8,
+0x86e56a, 0x8dc343, 0x6230e7, 0x93cfd5, 0x6a8f2d, 0x733005,
+0x1af021, 0xa09fcb, 0x7415a1, 0xd56b23, 0x6ff725, 0x2f4bc7,
+0xb8a591, 0x7fac59, 0x5c55de, 0x212c38, 0xb13296, 0x5cff50,
+0x366262, 0xfa7b16, 0xf4d9a6, 0x2acfe7, 0xf07403, 0xd4d604,
+0x6fd916, 0x31b1bf, 0xcbb450, 0x5bd7c8, 0x0ce194, 0x6bd643,
+0x4fd91c, 0xdf4543, 0x5f3453, 0xe2b5aa, 0xc9aec8, 0x131485,
+0xf9d2bf, 0xbadb9e, 0x76f5b9, 0xaf15cf, 0xca3182, 0x14b56d,
+0xe9fe4d, 0x50fc35, 0xf5aed5, 0xa2d0c1, 0xc96057, 0x192eb6,
+0xe91d92, 0x07d144, 0xaea3c6, 0x343566, 0x26d5b4, 0x3161e2,
+0x37f1a2, 0x209eff, 0x958e23, 0x493798, 0x35f4a6, 0x4bdc02,
+0xc2be13, 0xbe80a0, 0x0b72a3, 0x115c5f, 0x1e1bd1, 0x0db4d3,
+0x869e85, 0x96976b, 0x2ac91f, 0x8a26c2, 0x3070f0, 0x041412,
+0xfc9fa5, 0xf72a38, 0x9c6878, 0xe2aa76, 0x50cfe1, 0x559274,
+0x934e38, 0x0a92f7, 0x5533f0, 0xa63db4, 0x399971, 0xe2b755,
+0xa98a7c, 0x008f19, 0xac54d2, 0x2ea0b4, 0xf5f3e0, 0x60c849,
+0xffd269, 0xae52ce, 0x7a5fdd, 0xe9ce06, 0xfb0ae8, 0xa50cce,
+0xea9d3e, 0x3766dd, 0xb834f5, 0x0da090, 0x846f88, 0x4ae3d5,
+0x099a03, 0x2eae2d, 0xfcb40a, 0xfb9b33, 0xe281dd, 0x1b16ba,
+0xd8c0af, 0xd96b97, 0xb52dc9, 0x9c277f, 0x5951d5, 0x21ccd6,
+0xb6496b, 0x584562, 0xb3baf2, 0xa1a5c4, 0x7ca2cf, 0xa9b93d,
+0x7b7b89, 0x483d38,
+};
+
+static const long double c[] = {
+/* 93 bits of pi/2 */
+#define PI_2_1 c[0]
+ 1.57079632679489661923132169155131424e+00L, /* 3fff921fb54442d18469898cc5100000 */
+
+/* pi/2 - PI_2_1 */
+#define PI_2_1t c[1]
+ 8.84372056613570112025531863263659260e-29L, /* 3fa1c06e0e68948127044533e63a0106 */
+};
+
+int32_t __ieee754_rem_pio2l(long double x, long double *y)
+{
+ long double z, w, t;
+ double tx[8];
+ int exp;
+ int64_t n, ix, hx, ixd;
+ u_int64_t lx, lxd;
+
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ ix = hx & 0x7fffffffffffffffLL;
+ if (ix <= 0x3fe921fb54442d10LL) /* x in <-pi/4, pi/4> */
+ {
+ y[0] = x;
+ y[1] = 0;
+ return 0;
+ }
+
+ if (ix < 0x4002d97c7f3321d0LL) /* |x| in <pi/4, 3pi/4) */
+ {
+ if (hx > 0)
+ {
+ /* 113 + 93 bit PI is ok */
+ z = x - PI_2_1;
+ y[0] = z - PI_2_1t;
+ y[1] = (z - y[0]) - PI_2_1t;
+ return 1;
+ }
+ else
+ {
+ /* 113 + 93 bit PI is ok */
+ z = x + PI_2_1;
+ y[0] = z + PI_2_1t;
+ y[1] = (z - y[0]) + PI_2_1t;
+ return -1;
+ }
+ }
+
+ if (ix >= 0x7ff0000000000000LL) /* x is +=oo or NaN */
+ {
+ y[0] = x - x;
+ y[1] = y[0];
+ return 0;
+ }
+
+ /* Handle large arguments.
+ We split the 113 bits of the mantissa into 5 24bit integers
+ stored in a double array. */
+ /* Make the IBM extended format 105 bit mantissa look like the ieee854 112
+ bit mantissa so the next operatation will give the correct result. */
+ ldbl_extract_mantissa (&ixd, &lxd, &exp, x);
+ exp = exp - 23;
+ /* This is faster than doing this in floating point, because we
+ have to convert it to integers anyway and like this we can keep
+ both integer and floating point units busy. */
+ tx [0] = (double)(((ixd >> 25) & 0x7fffff) | 0x800000);
+ tx [1] = (double)((ixd >> 1) & 0xffffff);
+ tx [2] = (double)(((ixd << 23) | (lxd >> 41)) & 0xffffff);
+ tx [3] = (double)((lxd >> 17) & 0xffffff);
+ tx [4] = (double)((lxd << 7) & 0xffffff);
+
+ n = __kernel_rem_pio2 (tx, tx + 5, exp, ((lxd << 7) & 0xffffff) ? 5 : 4,
+ 3, two_over_pi);
+
+ /* The result is now stored in 3 double values, we need to convert it into
+ two long double values. */
+ t = (long double) tx [6] + (long double) tx [7];
+ w = (long double) tx [5];
+
+ if (hx >= 0)
+ {
+ y[0] = w + t;
+ y[1] = t - (y[0] - w);
+ return n;
+ }
+ else
+ {
+ y[0] = -(w + t);
+ y[1] = -t - (y[0] + w);
+ return -n;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
new file mode 100644
index 0000000..b7fa68f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/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&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */
+ if((hx>=0x7ff0000000000000LL)|| /* x not finite */
+ ((hp>=0x7ff0000000000000LL)&& /* p is NaN */
+ (((hp-0x7ff0000000000000LL)|lp)!=0)))
+ return (x*p)/(x*p);
+
+
+ if (hp<=0x7fdfffffffffffffLL) 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<0x0020000000000000LL) {
+ 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-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
new file mode 100644
index 0000000..38ae71d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
@@ -0,0 +1,84 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, 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 long double one = 1.0, shuge = 1.0e307;
+#else
+static long double one = 1.0, shuge = 1.0e307;
+#endif
+
+#ifdef __STDC__
+ long double __ieee754_sinhl(long double x)
+#else
+ long double __ieee754_sinhl(x)
+ long double x;
+#endif
+{
+ long double t,w,h;
+ int64_t ix,jx;
+
+ /* High word of |x|. */
+ GET_LDOUBLE_MSW64(jx,x);
+ ix = jx&0x7fffffffffffffffLL;
+
+ /* x is INF or NaN */
+ if(ix>=0x7ff0000000000000LL) 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 < 0x4036000000000000LL) { /* |x|<22 */
+ if (ix<0x3e20000000000000LL) /* |x|<2**-29 */
+ if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */
+ t = __expm1l(fabsl(x));
+ if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one));
+ return h*(t+t/(t+one));
+ }
+
+ /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
+ if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x));
+
+ /* |x| in [log(maxdouble), overflowthresold] */
+ if (ix <= 0x408633ce8fb9f87dLL) {
+ w = __ieee754_expl(0.5*fabsl(x));
+ t = h*w;
+ return t*w;
+ }
+
+ /* |x| > overflowthresold, sinh(x) overflow */
+ return x*shuge;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
new file mode 100644
index 0000000..1f533ca
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
@@ -0,0 +1,109 @@
+/*
+ * IBM Accurate Mathematical Library
+ * written by International Business Machines Corp.
+ * Copyright (C) 2001, 2004, 2006 Free Software Foundation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+/*********************************************************************/
+/* MODULE_NAME: uroot.c */
+/* */
+/* FUNCTION: usqrt */
+/* */
+/* FILES NEEDED: dla.h endian.h mydefs.h uroot.h */
+/* uroot.tbl */
+/* */
+/* An ultimate sqrt routine. Given an IEEE double machine number x */
+/* it computes the correctly rounded (to nearest) value of square */
+/* root of x. */
+/* Assumption: Machine arithmetic operations are performed in */
+/* round to nearest mode of IEEE 754 standard. */
+/* */
+/*********************************************************************/
+
+#include <math_private.h>
+
+typedef unsigned int int4;
+typedef union {int4 i[4]; long double x; double d[2]; } mynumber;
+
+static const mynumber
+ t512 = {{0x5ff00000, 0x00000000, 0x00000000, 0x00000000 }}, /* 2^512 */
+ tm256 = {{0x2ff00000, 0x00000000, 0x00000000, 0x00000000 }}; /* 2^-256 */
+static const double
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+/*********************************************************************/
+/* An ultimate sqrt routine. Given an IEEE double machine number x */
+/* it computes the correctly rounded (to nearest) value of square */
+/* root of x. */
+/*********************************************************************/
+long double __ieee754_sqrtl(long double x)
+{
+ static const long double big = 134217728.0, big1 = 134217729.0;
+ long double t,s,i;
+ mynumber a,c;
+ int4 k, l, m;
+ int n;
+ double d;
+
+ a.x=x;
+ k=a.i[0] & 0x7fffffff;
+ /*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/
+ if (k>0x000fffff && k<0x7ff00000) {
+ if (x < 0) return (big1-big1)/(big-big);
+ l = (k&0x001fffff)|0x3fe00000;
+ if (((a.i[2] & 0x7fffffff) | a.i[3]) != 0) {
+ n = (int) ((l - k) * 2) >> 21;
+ m = (a.i[2] >> 20) & 0x7ff;
+ if (m == 0) {
+ a.d[1] *= two54;
+ m = ((a.i[2] >> 20) & 0x7ff) - 54;
+ }
+ m += n;
+ if (m > 0)
+ a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+ else if (m <= -54) {
+ a.i[2] &= 0x80000000;
+ a.i[3] = 0;
+ } else {
+ m += 54;
+ a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+ a.d[1] *= twom54;
+ }
+ }
+ a.i[0] = l;
+ s = a.x;
+ d = __ieee754_sqrt (a.d[0]);
+ c.i[0] = 0x20000000+((k&0x7fe00000)>>1);
+ c.i[1] = 0;
+ c.i[2] = 0;
+ c.i[3] = 0;
+ i = d;
+ t = 0.5L * (i + s / i);
+ i = 0.5L * (t + s / t);
+ return c.x * i;
+ }
+ else {
+ if (k>=0x7ff00000) {
+ if (a.i[0] == 0xfff00000 && a.i[1] == 0)
+ return (big1-big1)/(big-big); /* sqrt (-Inf) = NaN. */
+ return x; /* sqrt (NaN) = NaN, sqrt (+Inf) = +Inf. */
+ }
+ if (x == 0) return x;
+ if (x < 0) return (big1-big1)/(big-big);
+ return tm256.x*__ieee754_sqrtl(x*t512.x);
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
new file mode 100644
index 0000000..94a2091
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -0,0 +1,210 @@
+/* Copyright (C) 1992, 1995, 1996, 1999, 2004, 2006
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _IEEE754_H
+
+#define _IEEE754_H 1
+#include <features.h>
+
+#include <endian.h>
+
+__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. */
+
+
+/* IBM extended format for long double.
+
+ Each long double is made up of two IEEE doubles. The value of the
+ long double is the sum of the values of the two parts. The most
+ significant part is required to be the value of the long double
+ rounded to the nearest double, as specified by IEEE. For Inf
+ values, the least significant part is required to be one of +0.0 or
+ -0.0. No other requirements are made; so, for example, 1.0 may be
+ represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a
+ NaN is don't-care. */
+
+union ibm_extended_long_double
+ {
+ long double d;
+ double dd[2];
+
+ /* This is the IBM extended format long double. */
+ struct
+ { /* Big endian. There is no other. */
+
+ unsigned int negative:1;
+ unsigned int exponent:11;
+ /* Together Mantissa0-3 comprise the mantissa. */
+ unsigned int mantissa0:20;
+ unsigned int mantissa1:32;
+
+ unsigned int negative2:1;
+ unsigned int exponent2:11;
+ /* There is an implied 1 here? */
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa2:20;
+ unsigned int mantissa3:32;
+ } ieee;
+ };
+
+#define IBM_EXTENDED_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
+
+__END_DECLS
+
+#endif /* ieee754.h */
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_cosl.c b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
new file mode 100644
index 0000000..b442582
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
@@ -0,0 +1,146 @@
+/* Quad-precision floating point cosine on <-pi/4,pi/4>.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+ x in <0,1/256> */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 )
+ x in <0,0.1484375> */
+#define COS1 c[6]
+#define COS2 c[7]
+#define COS3 c[8]
+#define COS4 c[9]
+#define COS5 c[10]
+#define COS6 c[11]
+#define COS7 c[12]
+#define COS8 c[13]
+-4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */
+ 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */
+-1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */
+ 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */
+-2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */
+ 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */
+-1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */
+ 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+ x in <0,1/256> */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+long double
+__kernel_cosl(long double x, long double y)
+{
+ long double h, l, z, sin_l, cos_l_m1;
+ int64_t ix;
+ u_int32_t tix, hix, index;
+ GET_LDOUBLE_MSW64 (ix, x);
+ tix = ((u_int64_t)ix) >> 32;
+ tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
+ if (tix < 0x3fc30000) /* |x| < 0.1484375 */
+ {
+ /* Argument is small enough to approximate it by a Chebyshev
+ polynomial of degree 16. */
+ if (tix < 0x3c600000) /* |x| < 2^-57 */
+ if (!((int)x)) return ONE; /* generate inexact */
+ z = x * x;
+ return ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+
+ z*(COS5+z*(COS6+z*(COS7+z*COS8))))))));
+ }
+ else
+ {
+ /* So that we don't have to use too large polynomial, we find
+ l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83
+ possible values for h. We look up cosl(h) and sinl(h) in
+ pre-computed tables, compute cosl(l) and sinl(l) using a
+ Chebyshev polynomial of degree 10(11) and compute
+ cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */
+ int six = tix;
+ tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+ index = 0x3ffe - (tix >> 16);
+ hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+ case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+ default:
+ case 2: index = (hix - 0x3ffc3000) >> 10; break;
+ }
+ hix = (hix << 4) & 0x3fffffff;
+/*
+ The following should work for double but generates the wrong index.
+ For now the code above converts double to ieee extended to compute
+ the index back to double for the h value.
+
+ index = 0x3fe - (tix >> 20);
+ hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+ case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+ default:
+ case 2: index = (hix - 0x3fc30000) >> 14; break;
+ }
+*/
+ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ l = y - (h - x);
+ z = l * l;
+ sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+ cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+ return __sincosl_table [index + SINCOSL_COS_HI]
+ + (__sincosl_table [index + SINCOSL_COS_LO]
+ - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l
+ - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1));
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
new file mode 100644
index 0000000..cd2ce7a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
@@ -0,0 +1,182 @@
+/* Quad-precision floating point sine and cosine on <-pi/4,pi/4>.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+ x in <0,1/256> */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 )
+ x in <0,0.1484375> */
+#define COS1 c[6]
+#define COS2 c[7]
+#define COS3 c[8]
+#define COS4 c[9]
+#define COS5 c[10]
+#define COS6 c[11]
+#define COS7 c[12]
+#define COS8 c[13]
+-4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */
+ 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */
+-1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */
+ 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */
+-2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */
+ 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */
+-1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */
+ 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+ x in <0,1/256> */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+
+/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 )
+ x in <0,0.1484375> */
+#define SIN1 c[19]
+#define SIN2 c[20]
+#define SIN3 c[21]
+#define SIN4 c[22]
+#define SIN5 c[23]
+#define SIN6 c[24]
+#define SIN7 c[25]
+#define SIN8 c[26]
+-1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */
+ 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */
+-1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */
+ 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */
+-2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */
+ 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */
+-7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */
+ 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+void
+__kernel_sincosl(long double x, long double y, long double *sinx, long double *cosx, int iy)
+{
+ long double h, l, z, sin_l, cos_l_m1;
+ int64_t ix;
+ u_int32_t tix, hix, index;
+ GET_LDOUBLE_MSW64 (ix, x);
+ tix = ((u_int64_t)ix) >> 32;
+ tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
+ if (tix < 0x3fc30000) /* |x| < 0.1484375 */
+ {
+ /* Argument is small enough to approximate it by a Chebyshev
+ polynomial of degree 16(17). */
+ if (tix < 0x3c600000) /* |x| < 2^-57 */
+ if (!((int)x)) /* generate inexact */
+ {
+ *sinx = x;
+ *cosx = ONE;
+ return;
+ }
+ z = x * x;
+ *sinx = x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
+ z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
+ *cosx = ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+
+ z*(COS5+z*(COS6+z*(COS7+z*COS8))))))));
+ }
+ else
+ {
+ /* So that we don't have to use too large polynomial, we find
+ l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83
+ possible values for h. We look up cosl(h) and sinl(h) in
+ pre-computed tables, compute cosl(l) and sinl(l) using a
+ Chebyshev polynomial of degree 10(11) and compute
+ sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l) and
+ cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */
+ int six = tix;
+ tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+ index = 0x3ffe - (tix >> 16);
+ hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+ case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+ default:
+ case 2: index = (hix - 0x3ffc3000) >> 10; break;
+ }
+ hix = (hix << 4) & 0x3fffffff;
+/*
+ The following should work for double but generates the wrong index.
+ For now the code above converts double to ieee extended to compute
+ the index back to double for the h value.
+
+
+ index = 0x3fe - (tix >> 20);
+ hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+ case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+ default:
+ case 2: index = (hix - 0x3fc30000) >> 14; break;
+ }
+*/
+ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ if (iy)
+ l = y - (h - x);
+ else
+ l = x - h;
+ z = l * l;
+ sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+ cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+ z = __sincosl_table [index + SINCOSL_SIN_HI]
+ + (__sincosl_table [index + SINCOSL_SIN_LO]
+ + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+ + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l));
+ *sinx = (ix < 0) ? -z : z;
+ *cosx = __sincosl_table [index + SINCOSL_COS_HI]
+ + (__sincosl_table [index + SINCOSL_COS_LO]
+ - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l
+ - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1));
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sinl.c b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
new file mode 100644
index 0000000..24cb551
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
@@ -0,0 +1,150 @@
+/* Quad-precision floating point sine on <-pi/4,pi/4>.
+ Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+ x in <0,1/256> */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 )
+ x in <0,0.1484375> */
+#define SIN1 c[6]
+#define SIN2 c[7]
+#define SIN3 c[8]
+#define SIN4 c[9]
+#define SIN5 c[10]
+#define SIN6 c[11]
+#define SIN7 c[12]
+#define SIN8 c[13]
+-1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */
+ 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */
+-1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */
+ 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */
+-2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */
+ 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */
+-7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */
+ 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+ x in <0,1/256> */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+long double
+__kernel_sinl(long double x, long double y, int iy)
+{
+ long double h, l, z, sin_l, cos_l_m1;
+ int64_t ix;
+ u_int32_t tix, hix, index;
+ GET_LDOUBLE_MSW64 (ix, x);
+ tix = ((u_int64_t)ix) >> 32;
+ tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
+ if (tix < 0x3fc30000) /* |x| < 0.1484375 */
+ {
+ /* Argument is small enough to approximate it by a Chebyshev
+ polynomial of degree 17. */
+ if (tix < 0x3c600000) /* |x| < 2^-57 */
+ if (!((int)x)) return x; /* generate inexact */
+ z = x * x;
+ return x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
+ z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
+ }
+ else
+ {
+ /* So that we don't have to use too large polynomial, we find
+ l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83
+ possible values for h. We look up cosl(h) and sinl(h) in
+ pre-computed tables, compute cosl(l) and sinl(l) using a
+ Chebyshev polynomial of degree 10(11) and compute
+ sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l). */
+ int six = tix;
+ tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+ index = 0x3ffe - (tix >> 16);
+ hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+ case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+ default:
+ case 2: index = (hix - 0x3ffc3000) >> 10; break;
+ }
+ hix = (hix << 4) & 0x3fffffff;
+/*
+ The following should work for double but generates the wrong index.
+ For now the code above converts double to ieee extended to compute
+ the index back to double for the h value.
+
+ index = 0x3fe - (tix >> 20);
+ hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
+ x = fabsl (x);
+ switch (index)
+ {
+ case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+ case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+ default:
+ case 2: index = (hix - 0x3fc30000) >> 14; break;
+ }
+*/
+ SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ if (iy)
+ l = y - (h - x);
+ else
+ l = x - h;
+ z = l * l;
+ sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+ cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+ z = __sincosl_table [index + SINCOSL_SIN_HI]
+ + (__sincosl_table [index + SINCOSL_SIN_LO]
+ + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+ + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l));
+ return (ix < 0) ? -z : z;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
new file mode 100644
index 0000000..6c45b2f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -0,0 +1,164 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ Long double expansions are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* __kernel_tanl( 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^-57, return x with inexact if x!=0.
+ * 3. tan(x) is approximated by a rational form x + x^3 / 3 + x^5 R(x^2)
+ * on [0,0.67433].
+ *
+ * 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
+ * r = x^3 * R(x^2)
+ * then
+ * tan(x+y) = x + (x^3 / 3 + (x^2 *(r+y)+y))
+ *
+ * 4. For x in [0.67433,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 long double
+#else
+static long double
+#endif
+ one = 1.0L,
+ pio4hi = 7.8539816339744830961566084581987569936977E-1L,
+ pio4lo = 2.1679525325309452561992610065108379921906E-35L,
+
+ /* tan x = x + x^3 / 3 + x^5 T(x^2)/U(x^2)
+ 0 <= x <= 0.6743316650390625
+ Peak relative error 8.0e-36 */
+ TH = 3.333333333333333333333333333333333333333E-1L,
+ T0 = -1.813014711743583437742363284336855889393E7L,
+ T1 = 1.320767960008972224312740075083259247618E6L,
+ T2 = -2.626775478255838182468651821863299023956E4L,
+ T3 = 1.764573356488504935415411383687150199315E2L,
+ T4 = -3.333267763822178690794678978979803526092E-1L,
+
+ U0 = -1.359761033807687578306772463253710042010E8L,
+ U1 = 6.494370630656893175666729313065113194784E7L,
+ U2 = -4.180787672237927475505536849168729386782E6L,
+ U3 = 8.031643765106170040139966622980914621521E4L,
+ U4 = -5.323131271912475695157127875560667378597E2L;
+ /* 1.000000000000000000000000000000000000000E0 */
+
+
+#ifdef __STDC__
+long double
+__kernel_tanl (long double x, long double y, int iy)
+#else
+long double
+__kernel_tanl (x, y, iy)
+ long double x, y;
+ int iy;
+#endif
+{
+ long double z, r, v, w, s;
+ int32_t ix, sign;
+ ieee854_long_double_shape_type u, u1;
+
+ u.value = x;
+ ix = u.parts32.w0 & 0x7fffffff;
+ if (ix < 0x3c600000) /* x < 2**-57 */
+ {
+ if ((int) x == 0)
+ { /* generate inexact */
+ if ((ix | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3
+ | (iy + 1)) == 0)
+ return one / fabs (x);
+ else
+ return (iy == 1) ? x : -one / x;
+ }
+ }
+ if (ix >= 0x3fe59420) /* |x| >= 0.6743316650390625 */
+ {
+ if ((u.parts32.w0 & 0x80000000) != 0)
+ {
+ x = -x;
+ y = -y;
+ sign = -1;
+ }
+ else
+ sign = 1;
+ z = pio4hi - x;
+ w = pio4lo - y;
+ x = z + w;
+ y = 0.0;
+ }
+ z = x * x;
+ r = T0 + z * (T1 + z * (T2 + z * (T3 + z * T4)));
+ v = U0 + z * (U1 + z * (U2 + z * (U3 + z * (U4 + z))));
+ r = r / v;
+
+ s = z * x;
+ r = y + z * (s * r + y);
+ r += TH * s;
+ w = x + r;
+ if (ix >= 0x3fe59420)
+ {
+ v = (long double) iy;
+ w = (v - 2.0 * (x - (w * w / (w + v) - r)));
+ if (sign < 0)
+ w = -w;
+ return w;
+ }
+ 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 */
+ u1.value = w;
+ u1.parts32.w2 = 0;
+ u1.parts32.w3 = 0;
+ v = r - (u1.value - x); /* u1+v = r+x */
+ z = -1.0 / w;
+ u.value = z;
+ u.parts32.w2 = 0;
+ u.parts32.w3 = 0;
+ s = 1.0 + u.value * u1.value;
+ return u.value + z * (s + u.value * v);
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
new file mode 100644
index 0000000..18a2e67
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
@@ -0,0 +1,175 @@
+/* Copyright (C) 1995,1996,1997,1998,1999,2002,2003,2006
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+#include <ieee754.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+
+/* Convert a `long double' in IBM extended format to a multi-precision
+ integer representing the significand scaled up by its number of
+ bits (106 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 ibm_extended_long_double u;
+ unsigned long long hi, lo;
+ int ediff;
+ u.d = value;
+
+ *is_neg = u.ieee.negative;
+ *expt = (int) u.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+ lo = ((long long) u.ieee.mantissa2 << 32) | u.ieee.mantissa3;
+ hi = ((long long) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
+ /* If the lower double is not a denomal or zero then set the hidden
+ 53rd bit. */
+ if (u.ieee.exponent2 > 0)
+ {
+ lo |= 1LL << 52;
+
+ /* The lower double is normalized separately from the upper. We may
+ need to adjust the lower manitissa to reflect this. */
+ ediff = u.ieee.exponent - u.ieee.exponent2;
+ if (ediff > 53)
+ lo = lo >> (ediff-53);
+ }
+ /* The high double may be rounded and the low double reflects the
+ difference between the long double and the rounded high double
+ value. This is indicated by a differnce between the signs of the
+ high and low doubles. */
+ if ((u.ieee.negative != u.ieee.negative2)
+ && ((u.ieee.exponent2 != 0) && (lo != 0L)))
+ {
+ lo = (1ULL << 53) - lo;
+ if (hi == 0LL)
+ {
+ /* we have a borrow from the hidden bit, so shift left 1. */
+ hi = 0x0ffffffffffffeLL | (lo >> 51);
+ lo = 0x1fffffffffffffLL & (lo << 1);
+ (*expt)--;
+ }
+ else
+ hi--;
+ }
+#if BITS_PER_MP_LIMB == 32
+ /* Combine the mantissas to be contiguous. */
+ res_ptr[0] = lo;
+ res_ptr[1] = (hi << (53 - 32)) | (lo >> 32);
+ res_ptr[2] = hi >> 11;
+ res_ptr[3] = hi >> (32 + 11);
+ #define N 4
+#elif BITS_PER_MP_LIMB == 64
+ /* Combine the two mantissas to be contiguous. */
+ res_ptr[0] = (hi << 53) | lo;
+ res_ptr[1] = hi >> 11;
+ #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 - l * BITS_PER_MP_LIMB - cnt;
+#endif
+ }
+ }
+ else
+ /* Add the implicit leading one bit for a normalized number. */
+ res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
+ - ((N - 1) * BITS_PER_MP_LIMB));
+
+ return N;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
new file mode 100644
index 0000000..d055d65
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -0,0 +1,181 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
+#include <ieee754.h>
+
+static inline void
+ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
+{
+ /* We have 105 bits of mantissa plus one implicit digit. Since
+ 106 bits are representable we use the first implicit digit for
+ the number before the decimal point and the second implicit bit
+ as bit 53 of the mantissa. */
+ unsigned long long hi, lo;
+ int ediff;
+ union ibm_extended_long_double eldbl;
+ eldbl.d = x;
+ *exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+ lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
+ hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
+ /* If the lower double is not a denomal or zero then set the hidden
+ 53rd bit. */
+ if (eldbl.ieee.exponent2 > 0x001)
+ {
+ lo |= (1ULL << 52);
+ lo = lo << 7; /* pre-shift lo to match ieee854. */
+ /* The lower double is normalized separately from the upper. We
+ may need to adjust the lower manitissa to reflect this. */
+ ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
+ if (ediff > 53)
+ lo = lo >> (ediff-53);
+ }
+ hi |= (1ULL << 52);
+
+ if ((eldbl.ieee.negative != eldbl.ieee.negative2)
+ && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
+ {
+ hi--;
+ lo = (1ULL << 60) - lo;
+ if (hi < (1ULL << 52))
+ {
+ /* we have a borrow from the hidden bit, so shift left 1. */
+ hi = (hi << 1) | (lo >> 59);
+ lo = 0xfffffffffffffffLL & (lo << 1);
+ *exp = *exp - 1;
+ }
+ }
+ *lo64 = (hi << 60) | lo;
+ *hi64 = hi >> 4;
+}
+
+static inline long double
+ldbl_insert_mantissa (int sign, int exp, int64_t hi64, u_int64_t lo64)
+{
+ union ibm_extended_long_double u;
+ unsigned long hidden2, lzcount;
+ unsigned long long hi, lo;
+
+ u.ieee.negative = sign;
+ u.ieee.negative2 = sign;
+ u.ieee.exponent = exp + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+ u.ieee.exponent2 = exp-53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+ /* Expect 113 bits (112 bits + hidden) right justified in two longs.
+ The low order 53 bits (52 + hidden) go into the lower double */
+ lo = (lo64 >> 7)& ((1ULL << 53) - 1);
+ hidden2 = (lo64 >> 59) & 1ULL;
+ /* The high order 53 bits (52 + hidden) go into the upper double */
+ hi = (lo64 >> 60) & ((1ULL << 11) - 1);
+ hi |= (hi64 << 4);
+
+ if (lo != 0LL)
+ {
+ /* hidden2 bit of low double controls rounding of the high double.
+ If hidden2 is '1' then round up hi and adjust lo (2nd mantissa)
+ plus change the sign of the low double to compensate. */
+ if (hidden2)
+ {
+ hi++;
+ u.ieee.negative2 = !sign;
+ lo = (1ULL << 53) - lo;
+ }
+ /* The hidden bit of the lo mantissa is zero so we need to
+ normalize the it for the low double. Shift it left until the
+ hidden bit is '1' then adjust the 2nd exponent accordingly. */
+
+ if (sizeof (lo) == sizeof (long))
+ lzcount = __builtin_clzl (lo);
+ else if ((lo >> 32) != 0)
+ lzcount = __builtin_clzl ((long) (lo >> 32));
+ else
+ lzcount = __builtin_clzl ((long) lo) + 32;
+ lzcount = lzcount - 11;
+ if (lzcount > 0)
+ {
+ int expnt2 = u.ieee.exponent2 - lzcount;
+ if (expnt2 >= 1)
+ {
+ /* Not denormal. Normalize and set low exponent. */
+ lo = lo << lzcount;
+ u.ieee.exponent2 = expnt2;
+ }
+ else
+ {
+ /* Is denormal. */
+ lo = lo << (lzcount + expnt2);
+ u.ieee.exponent2 = 0;
+ }
+ }
+ }
+ else
+ {
+ u.ieee.negative2 = 0;
+ u.ieee.exponent2 = 0;
+ }
+
+ u.ieee.mantissa3 = lo & ((1ULL << 32) - 1);
+ u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1);
+ u.ieee.mantissa1 = hi & ((1ULL << 32) - 1);
+ u.ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
+ return u.d;
+}
+
+/* Handy utility functions to pack/unpack/cononicalize and find the nearbyint
+ of long double implemented as double double. */
+static inline long double
+ldbl_pack (double a, double aa)
+{
+ union ibm_extended_long_double u;
+ u.dd[0] = a;
+ u.dd[1] = aa;
+ return u.d;
+}
+
+static inline void
+ldbl_unpack (long double l, double *a, double *aa)
+{
+ union ibm_extended_long_double u;
+ u.d = l;
+ *a = u.dd[0];
+ *aa = u.dd[1];
+}
+
+
+/* Convert a finite long double to canonical form.
+ Does not handle +/-Inf properly. */
+static inline void
+ldbl_canonicalize (double *a, double *aa)
+{
+ double xh, xl;
+
+ xh = *a + *aa;
+ xl = (*a - xh) + *aa;
+ *a = xh;
+ *aa = xl;
+}
+
+/* Simple inline nearbyint (double) function .
+ Only works in the default rounding mode
+ but is useful in long double rounding functions. */
+static inline double
+ldbl_nearbyint (double a)
+{
+ double two52 = 0x10000000000000LL;
+
+ if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
+ {
+ if (__builtin_expect ((a > 0.0), 1))
+ {
+ a += two52;
+ a -= two52;
+ }
+ else if (__builtin_expect ((a < 0.0), 1))
+ {
+ a = two52 - a;
+ a = -(a - two52);
+ }
+ }
+ return a;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
new file mode 100644
index 0000000..21d1e62
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
@@ -0,0 +1,152 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2006, 2007
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include <ieee754.h>
+#include <float.h>
+#include <math.h>
+
+/* Convert a multi-precision integer of the needed number of bits (106
+ for long double) and an integral power of two to a `long double' in
+ IBM extended format. */
+
+long double
+__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
+{
+ union ibm_extended_long_double u;
+ unsigned long lzcount;
+ unsigned long long hi, lo;
+ int exponent2;
+
+ u.ieee.negative = sign;
+ u.ieee.negative2 = sign;
+ u.ieee.exponent = expt + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+ u.ieee.exponent2 = 0;
+ exponent2 = expt - 53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+#if BITS_PER_MP_LIMB == 32
+ /* The low order 53 bits (52 + hidden) go into the lower double */
+ lo = frac_ptr[0];
+ lo |= (frac_ptr[1] & ((1LL << (53 - 32)) - 1)) << 32;
+ /* The high order 53 bits (52 + hidden) go into the upper double */
+ hi = (frac_ptr[1] >> (53 - 32)) & ((1 << 11) - 1);
+ hi |= ((unsigned long long) frac_ptr[2]) << 11;
+ hi |= ((unsigned long long) frac_ptr[3]) << (32 + 11);
+#elif BITS_PER_MP_LIMB == 64
+ /* The low order 53 bits (52 + hidden) go into the lower double */
+ lo = frac_ptr[0] & (((mp_limb_t) 1 << 53) - 1);
+ /* The high order 53 bits (52 + hidden) go into the upper double */
+ hi = (frac_ptr[0] >> 53) & (((mp_limb_t) 1 << 11) - 1);
+ hi |= (frac_ptr[1] << 11);
+#else
+ #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+
+ if ((hi & (1LL << 52)) == 0 && (hi | lo) != 0)
+ {
+ /* denormal number */
+ unsigned long long val = hi ? hi : lo;
+
+ if (sizeof (val) == sizeof (long))
+ lzcount = __builtin_clzl (val);
+ else if ((val >> 32) != 0)
+ lzcount = __builtin_clzl ((long) (val >> 32));
+ else
+ lzcount = __builtin_clzl ((long) val) + 32;
+ if (hi)
+ lzcount = lzcount - 11;
+ else
+ lzcount = lzcount + 42;
+
+ if (lzcount > u.ieee.exponent)
+ {
+ lzcount = u.ieee.exponent;
+ u.ieee.exponent = 0;
+ exponent2 -= lzcount;
+ }
+ else
+ {
+ u.ieee.exponent -= (lzcount - 1);
+ exponent2 -= (lzcount - 1);
+ }
+
+ if (lzcount <= 53)
+ {
+ hi = (hi << lzcount) | (lo >> (53 - lzcount));
+ lo = (lo << lzcount) & ((1LL << 53) - 1);
+ }
+ else
+ {
+ hi = lo << (lzcount - 53);
+ lo = 0;
+ }
+ }
+
+ if (lo != 0L)
+ {
+ /* hidden2 bit of low double controls rounding of the high double.
+ If hidden2 is '1' and either the explicit mantissa is non-zero
+ or hi is odd, then round up hi and adjust lo (2nd mantissa)
+ plus change the sign of the low double to compensate. */
+ if ((lo & (1LL << 52)) != 0
+ && ((hi & 1) != 0 || (lo & ((1LL << 52) - 1))))
+ {
+ hi++;
+ if ((hi & ((1LL << 52) - 1)) == 0)
+ {
+ if ((hi & (1LL << 53)) != 0)
+ hi -= 1LL << 52;
+ u.ieee.exponent++;
+ }
+ u.ieee.negative2 = !sign;
+ lo = (1LL << 53) - lo;
+ }
+
+ /* The hidden bit of the lo mantissa is zero so we need to normalize
+ it for the low double. Shift it left until the hidden bit is '1'
+ then adjust the 2nd exponent accordingly. */
+
+ if (sizeof (lo) == sizeof (long))
+ lzcount = __builtin_clzl (lo);
+ else if ((lo >> 32) != 0)
+ lzcount = __builtin_clzl ((long) (lo >> 32));
+ else
+ lzcount = __builtin_clzl ((long) lo) + 32;
+ lzcount = lzcount - 11;
+ if (lzcount > 0)
+ {
+ lo = lo << lzcount;
+ exponent2 = exponent2 - lzcount;
+ }
+ if (exponent2 > 0)
+ u.ieee.exponent2 = exponent2;
+ else
+ lo >>= 1 - exponent2;
+ }
+ else
+ u.ieee.negative2 = 0;
+
+ u.ieee.mantissa3 = lo & 0xffffffffLL;
+ u.ieee.mantissa2 = (lo >> 32) & 0xfffff;
+ u.ieee.mantissa1 = hi & 0xffffffffLL;
+ u.ieee.mantissa0 = (hi >> 32) & ((1LL << (LDBL_MANT_DIG - 86)) - 1);
+
+ return u.d;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
new file mode 100644
index 0000000..b2ad25e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
@@ -0,0 +1,141 @@
+/* Print floating point number in hexadecimal notation according to ISO C99.
+ Copyright (C) 1997,1998,1999,2000,2001,2002,2004,2006,2007
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define PRINT_FPHEX_LONG_DOUBLE \
+do { \
+ /* We have 105 bits of mantissa plus one implicit digit. Since \
+ 106 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; \
+ unsigned long long hi, lo; \
+ int ediff; \
+ union ibm_extended_long_double eldbl; \
+ eldbl.d = fpnum.ldbl.d; \
+ \
+ assert (sizeof (long double) == 16); \
+ \
+ lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3; \
+ hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1; \
+ lo <<= 7; /* pre-shift lo to match ieee854. */ \
+ /* If the lower double is not a denomal or zero then set the hidden \
+ 53rd bit. */ \
+ if (eldbl.ieee.exponent2 != 0) \
+ lo |= (1ULL << (52 + 7)); \
+ else \
+ lo <<= 1; \
+ /* The lower double is normalized separately from the upper. We \
+ may need to adjust the lower manitissa to reflect this. */ \
+ ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \
+ if (ediff > 53 + 63) \
+ lo = 0; \
+ else if (ediff > 53) \
+ lo = lo >> (ediff - 53); \
+ else if (eldbl.ieee.exponent2 == 0 && ediff < 53) \
+ lo = lo << (53 - ediff); \
+ if (eldbl.ieee.negative != eldbl.ieee.negative2 \
+ && (eldbl.ieee.exponent2 != 0 || lo != 0L)) \
+ { \
+ lo = (1ULL << 60) - lo; \
+ if (hi == 0L) \
+ { \
+ /* we have a borrow from the hidden bit, so shift left 1. */ \
+ hi = 0xffffffffffffeLL | (lo >> 59); \
+ lo = 0xfffffffffffffffLL & (lo << 1); \
+ eldbl.ieee.exponent--; \
+ } \
+ else \
+ hi--; \
+ } \
+ num1 = (hi << 60) | lo; \
+ num0 = hi >> 4; \
+ \
+ zero_mantissa = (num0|num1) == 0; \
+ \
+ if (sizeof (unsigned long int) > 6) \
+ { \
+ numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16, \
+ info->spec == 'A'); \
+ wnumstr = _itowa_word (num1, \
+ wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\
+ 16, info->spec == 'A'); \
+ } \
+ else \
+ { \
+ numstr = _itoa (num1, numbuf + sizeof numbuf, 16, \
+ info->spec == 'A'); \
+ wnumstr = _itowa (num1, \
+ wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t), \
+ 16, info->spec == 'A'); \
+ } \
+ \
+ while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \
+ { \
+ *--numstr = '0'; \
+ *--wnumstr = L'0'; \
+ } \
+ \
+ if (sizeof (unsigned long int) > 6) \
+ { \
+ numstr = _itoa_word (num0, numstr, 16, info->spec == 'A'); \
+ wnumstr = _itowa_word (num0, wnumstr, 16, info->spec == 'A'); \
+ } \
+ else \
+ { \
+ numstr = _itoa (num0, numstr, 16, info->spec == 'A'); \
+ wnumstr = _itowa (num0, wnumstr, 16, info->spec == 'A'); \
+ } \
+ \
+ /* Fill with zeroes. */ \
+ while (numstr > numbuf + (sizeof numbuf - 112 / 4)) \
+ { \
+ *--numstr = '0'; \
+ *--wnumstr = L'0'; \
+ } \
+ \
+ leading = eldbl.ieee.exponent == 0 ? '0' : '1'; \
+ \
+ exponent = eldbl.ieee.exponent; \
+ \
+ if (exponent == 0) \
+ { \
+ if (zero_mantissa) \
+ expnegative = 0; \
+ else \
+ { \
+ /* This is a denormalized number. */ \
+ expnegative = 1; \
+ exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1; \
+ } \
+ } \
+ else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS) \
+ { \
+ expnegative = 0; \
+ exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ } \
+ else \
+ { \
+ expnegative = 1; \
+ exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS); \
+ } \
+} while (0)
+
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
new file mode 100644
index 0000000..d1b63bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
@@ -0,0 +1,67 @@
+/* @(#)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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+one = 1.00000000000000000000e+00L, /* 0x3ff0000000000000, 0 */
+ln2 = 0.6931471805599453094172321214581766L, /* 0x3fe62e42fefa39ef, 0x3c7abc9e3b398040 */
+huge= 1.00000000000000000000e+300L;
+
+#ifdef __STDC__
+ long double __asinhl(long double x)
+#else
+ long double __asinhl(x)
+ long double x;
+#endif
+{
+ long double t,w;
+ int64_t hx,ix;
+ GET_LDOUBLE_MSW64(hx,x);
+ ix = hx&0x7fffffffffffffffLL;
+ if(ix>=0x7ff0000000000000LL) return x+x; /* x is inf or NaN */
+ if(ix< 0x3e20000000000000LL) { /* |x|<2**-29 */
+ if(huge+x>one) return x; /* return x inexact except 0 */
+ }
+ if(ix>0x41b0000000000000LL) { /* |x| > 2**28 */
+ w = __ieee754_logl(fabs(x))+ln2;
+ } else if (ix>0x4000000000000000LL) { /* 2**28 > |x| > 2.0 */
+ t = fabs(x);
+ w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t));
+ } else { /* 2.0 > |x| > 2**-29 */
+ t = x*x;
+ w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
+ }
+ if(hx>0) return w; else return -w;
+}
+long_double_symbol (libm, __asinhl, asinhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
new file mode 100644
index 0000000..b6195f1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -0,0 +1,234 @@
+/* s_atanl.c
+ *
+ * Inverse circular tangent for 128-bit long double precision
+ * (arctangent)
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, atanl();
+ *
+ * y = atanl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns radian angle between -pi/2 and +pi/2 whose tangent is x.
+ *
+ * The function uses a rational approximation of the form
+ * t + t^3 P(t^2)/Q(t^2), optimized for |t| < 0.09375.
+ *
+ * The argument is reduced using the identity
+ * arctan x - arctan u = arctan ((x-u)/(1 + ux))
+ * and an 83-entry lookup table for arctan u, with u = 0, 1/8, ..., 10.25.
+ * Use of the table improves the execution speed of the routine.
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE -19, 19 4e5 1.7e-34 5.4e-35
+ *
+ *
+ * WARNING:
+ *
+ * This program uses integer operations on bit fields of floating-point
+ * numbers. It does not work with data structures other than the
+ * structure assumed.
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* arctan(k/8), k = 0, ..., 82 */
+static const long double atantbl[84] = {
+ 0.0000000000000000000000000000000000000000E0L,
+ 1.2435499454676143503135484916387102557317E-1L, /* arctan(0.125) */
+ 2.4497866312686415417208248121127581091414E-1L,
+ 3.5877067027057222039592006392646049977698E-1L,
+ 4.6364760900080611621425623146121440202854E-1L,
+ 5.5859931534356243597150821640166127034645E-1L,
+ 6.4350110879328438680280922871732263804151E-1L,
+ 7.1882999962162450541701415152590465395142E-1L,
+ 7.8539816339744830961566084581987572104929E-1L,
+ 8.4415398611317100251784414827164750652594E-1L,
+ 8.9605538457134395617480071802993782702458E-1L,
+ 9.4200004037946366473793717053459358607166E-1L,
+ 9.8279372324732906798571061101466601449688E-1L,
+ 1.0191413442663497346383429170230636487744E0L,
+ 1.0516502125483736674598673120862998296302E0L,
+ 1.0808390005411683108871567292171998202703E0L,
+ 1.1071487177940905030170654601785370400700E0L,
+ 1.1309537439791604464709335155363278047493E0L,
+ 1.1525719972156675180401498626127513797495E0L,
+ 1.1722738811284763866005949441337046149712E0L,
+ 1.1902899496825317329277337748293183376012E0L,
+ 1.2068173702852525303955115800565576303133E0L,
+ 1.2220253232109896370417417439225704908830E0L,
+ 1.2360594894780819419094519711090786987027E0L,
+ 1.2490457723982544258299170772810901230778E0L,
+ 1.2610933822524404193139408812473357720101E0L,
+ 1.2722973952087173412961937498224804940684E0L,
+ 1.2827408797442707473628852511364955306249E0L,
+ 1.2924966677897852679030914214070816845853E0L,
+ 1.3016288340091961438047858503666855921414E0L,
+ 1.3101939350475556342564376891719053122733E0L,
+ 1.3182420510168370498593302023271362531155E0L,
+ 1.3258176636680324650592392104284756311844E0L,
+ 1.3329603993374458675538498697331558093700E0L,
+ 1.3397056595989995393283037525895557411039E0L,
+ 1.3460851583802539310489409282517796256512E0L,
+ 1.3521273809209546571891479413898128509842E0L,
+ 1.3578579772154994751124898859640585287459E0L,
+ 1.3633001003596939542892985278250991189943E0L,
+ 1.3684746984165928776366381936948529556191E0L,
+ 1.3734007669450158608612719264449611486510E0L,
+ 1.3780955681325110444536609641291551522494E0L,
+ 1.3825748214901258580599674177685685125566E0L,
+ 1.3868528702577214543289381097042486034883E0L,
+ 1.3909428270024183486427686943836432060856E0L,
+ 1.3948567013423687823948122092044222644895E0L,
+ 1.3986055122719575950126700816114282335732E0L,
+ 1.4021993871854670105330304794336492676944E0L,
+ 1.4056476493802697809521934019958079881002E0L,
+ 1.4089588955564736949699075250792569287156E0L,
+ 1.4121410646084952153676136718584891599630E0L,
+ 1.4152014988178669079462550975833894394929E0L,
+ 1.4181469983996314594038603039700989523716E0L,
+ 1.4209838702219992566633046424614466661176E0L,
+ 1.4237179714064941189018190466107297503086E0L,
+ 1.4263547484202526397918060597281265695725E0L,
+ 1.4288992721907326964184700745371983590908E0L,
+ 1.4313562697035588982240194668401779312122E0L,
+ 1.4337301524847089866404719096698873648610E0L,
+ 1.4360250423171655234964275337155008780675E0L,
+ 1.4382447944982225979614042479354815855386E0L,
+ 1.4403930189057632173997301031392126865694E0L,
+ 1.4424730991091018200252920599377292525125E0L,
+ 1.4444882097316563655148453598508037025938E0L,
+ 1.4464413322481351841999668424758804165254E0L,
+ 1.4483352693775551917970437843145232637695E0L,
+ 1.4501726582147939000905940595923466567576E0L,
+ 1.4519559822271314199339700039142990228105E0L,
+ 1.4536875822280323362423034480994649820285E0L,
+ 1.4553696664279718992423082296859928222270E0L,
+ 1.4570043196511885530074841089245667532358E0L,
+ 1.4585935117976422128825857356750737658039E0L,
+ 1.4601391056210009726721818194296893361233E0L,
+ 1.4616428638860188872060496086383008594310E0L,
+ 1.4631064559620759326975975316301202111560E0L,
+ 1.4645314639038178118428450961503371619177E0L,
+ 1.4659193880646627234129855241049975398470E0L,
+ 1.4672716522843522691530527207287398276197E0L,
+ 1.4685896086876430842559640450619880951144E0L,
+ 1.4698745421276027686510391411132998919794E0L,
+ 1.4711276743037345918528755717617308518553E0L,
+ 1.4723501675822635384916444186631899205983E0L,
+ 1.4735431285433308455179928682541563973416E0L, /* arctan(10.25) */
+ 1.5707963267948966192313216916397514420986E0L /* pi/2 */
+};
+
+
+/* arctan t = t + t^3 p(t^2) / q(t^2)
+ |t| <= 0.09375
+ peak relative error 5.3e-37 */
+
+static const long double
+ p0 = -4.283708356338736809269381409828726405572E1L,
+ p1 = -8.636132499244548540964557273544599863825E1L,
+ p2 = -5.713554848244551350855604111031839613216E1L,
+ p3 = -1.371405711877433266573835355036413750118E1L,
+ p4 = -8.638214309119210906997318946650189640184E-1L,
+ q0 = 1.285112506901621042780814422948906537959E2L,
+ q1 = 3.361907253914337187957855834229672347089E2L,
+ q2 = 3.180448303864130128268191635189365331680E2L,
+ q3 = 1.307244136980865800160844625025280344686E2L,
+ q4 = 2.173623741810414221251136181221172551416E1L;
+ /* q5 = 1.000000000000000000000000000000000000000E0 */
+
+
+long double
+__atanl (long double x)
+{
+ int k, sign;
+ long double t, u, p, q;
+ ieee854_long_double_shape_type s;
+
+ s.value = x;
+ k = s.parts32.w0;
+ if (k & 0x80000000)
+ sign = 1;
+ else
+ sign = 0;
+
+ /* Check for IEEE special cases. */
+ k &= 0x7fffffff;
+ if (k >= 0x7ff00000)
+ {
+ /* NaN. */
+ if ((k & 0xfffff) | s.parts32.w1 )
+ return (x + x);
+
+ /* Infinity. */
+ if (sign)
+ return -atantbl[83];
+ else
+ return atantbl[83];
+ }
+
+ if (sign)
+ x = -x;
+
+ if (k >= 0x40248000) /* 10.25 */
+ {
+ k = 83;
+ t = -1.0/x;
+ }
+ else
+ {
+ /* Index of nearest table element.
+ Roundoff to integer is asymmetrical to avoid cancellation when t < 0
+ (cf. fdlibm). */
+ k = 8.0 * x + 0.25;
+ u = 0.125 * k;
+ /* Small arctan argument. */
+ t = (x - u) / (1.0 + x * u);
+ }
+
+ /* Arctan of small argument t. */
+ u = t * t;
+ p = ((((p4 * u) + p3) * u + p2) * u + p1) * u + p0;
+ q = ((((u + q4) * u + q3) * u + q2) * u + q1) * u + q0;
+ u = t * u * p / q + t;
+
+ /* arctan x = arctan u + arctan t */
+ u = atantbl[k] + u;
+ if (sign)
+ return (-u);
+ else
+ return u;
+}
+
+long_double_symbol (libm, __atanl, atanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c
new file mode 100644
index 0000000..010a671
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c
@@ -0,0 +1,6 @@
+/* Looks like we can use ieee854 s_cbrtl.c as is for IBM extended format. */
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c>
+long_double_symbol (libm, __cbrtl, cbrtl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
new file mode 100644
index 0000000..035e4f5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
@@ -0,0 +1,91 @@
+/* Ceil (round to +inf) long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__ceill (long double x)
+#else
+long double
+__ceill (x)
+ long double x;
+#endif
+{
+ double xh, xl, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Return Inf, Nan, +/-0 unchanged. */
+ if (__builtin_expect (xh != 0.0
+ && __builtin_isless (__builtin_fabs (xh),
+ __builtin_inf ()), 1))
+ {
+ double orig_xh;
+ int save_round = fegetround ();
+
+ /* Long double arithmetic, including the canonicalisation below,
+ only works in round-to-nearest mode. */
+ fesetround (FE_TONEAREST);
+
+ /* Convert the high double to integer. */
+ orig_xh = xh;
+ hi = ldbl_nearbyint (xh);
+
+ /* Subtract integral high part from the value. */
+ xh -= hi;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Now convert the low double, adjusted for any remainder from the
+ high double. */
+ lo = ldbl_nearbyint (xh);
+
+ /* Adjust the result when the remainder is non-zero. nearbyint
+ rounds values to the nearest integer, and values halfway
+ between integers to the nearest even integer. ceill must
+ round towards +Inf. */
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+ lo += 1.0;
+
+ /* Ensure the final value is canonical. In certain cases,
+ rounding causes hi,lo calculated so far to be non-canonical. */
+ xh = hi;
+ xl = lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Ensure we return -0 rather than +0 when appropriate. */
+ if (orig_xh < 0.0)
+ xh = -__builtin_fabs (xh);
+
+ fesetround (save_round);
+ }
+
+ return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __ceill, ceill);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
new file mode 100644
index 0000000..7e7b441
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
@@ -0,0 +1,45 @@
+/* s_copysignl.c -- long double version of s_copysign.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
+
+/*
+ * 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
+{
+ if (y < 0.0)
+ {
+ if (x >= 0.0)
+ x = -x;
+ }
+ else if (x < 0.0)
+ x = -x;
+ return x;
+}
+weak_alias (__copysignl, copysignl)
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cosl.c b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
new file mode 100644
index 0000000..59a8196
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
@@ -0,0 +1,88 @@
+/* s_cosl.c -- long double version of s_cos.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.
+ * ====================================================
+ */
+
+/* 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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __cosl(long double x)
+#else
+ long double __cosl(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 <= 0x3fe921fb54442d18LL)
+ return __kernel_cosl(x,z);
+
+ /* cos(Inf or NaN) is NaN */
+ else if (ix>=0x7ff0000000000000LL)
+ 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);
+ }
+ }
+}
+long_double_symbol (libm, __cosl, cosl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c b/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
new file mode 100644
index 0000000..2167db3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
@@ -0,0 +1,54 @@
+/* Compute projection of complex long double value to Riemann sphere.
+ Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+__complex__ long double
+__cprojl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else 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;
+ /* __gcc_qmul does not respect -0.0 so we need the following fixup. */
+ if (__real__ x == 0.0)
+ __real__ res = __real__ x;
+
+ if (__imag__ x == 0.0)
+ __imag__ res = __imag__ x;
+ }
+
+ return res;
+}
+long_double_symbol (libm, __cprojl, cprojl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c
new file mode 100644
index 0000000..7d61903
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c
@@ -0,0 +1,87 @@
+/* Complex hyperbole tangent for long double. IBM extended format version.
+ Copyright (C) 1997,2005,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+#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);
+
+ if (den == 0.0L)
+ {
+ __complex__ long double ez = __cexpl (x);
+ __complex__ long double emz = __cexpl (-x);
+
+ res = (ez - emz) / (ez + emz);
+ }
+ else
+ {
+ __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+ /* __gcc_qmul does not respect -0.0 so we need the following fixup. */
+ if ((__real__ res == 0.0) && (__real__ x == 0.0))
+ __real__ res = __real__ x;
+
+ if ((__real__ res == 0.0) && (__imag__ x == 0.0))
+ __imag__ res = __imag__ x;
+ }
+
+ return res;
+}
+long_double_symbol (libm, __ctanhl, ctanhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ctanl.c b/sysdeps/ieee754/ldbl-128ibm/s_ctanl.c
new file mode 100644
index 0000000..00d2aa6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ctanl.c
@@ -0,0 +1,88 @@
+/* Complex tangent function for long double. IBM extended format version.
+ Copyright (C) 1997,2005,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+#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);
+
+
+ if (den == 0.0)
+ {
+ __complex__ long double ez = __cexpl (1.0i * x);
+ __complex__ long double emz = __cexpl (-1.0i * x);
+
+ res = (ez - emz) / (ez + emz) * -1.0i;
+ }
+ else
+ {
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
+ }
+ /* __gcc_qmul does not respect -0.0 so we need the following fixup. */
+ if ((__real__ res == 0.0) && (__real__ x == 0.0))
+ __real__ res = __real__ x;
+
+ if ((__real__ res == 0.0) && (__imag__ x == 0.0))
+ __imag__ res = __imag__ x;
+ }
+
+ return res;
+}
+long_double_symbol (libm, __ctanl, ctanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
new file mode 100644
index 0000000..02b450e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@@ -0,0 +1,958 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications and expansions for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* 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. erf(x) = x + x*R(x^2) for |x| in [0, 7/8]
+ * 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.
+ *
+ * 1a. erf(x) = 1 - erfc(x), for |x| > 1.0
+ * erfc(x) = 1 - erf(x) if |x| < 1/4
+ *
+ * 2. For |x| in [7/8, 1], let s = |x| - 1, and
+ * c = 0.84506291151 rounded to single (24 bits)
+ * erf(s + c) = sign(x) * (c + P1(s)/Q1(s))
+ * 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)
+ * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
+ *
+ * 3. For x in [1/4, 5/4],
+ * erfc(s + const) = erfc(const) + s P1(s)/Q1(s)
+ * for const = 1/4, 3/8, ..., 9/8
+ * and 0 <= s <= 1/8 .
+ *
+ * 4. For x in [5/4, 107],
+ * erfc(x) = (1/x)*exp(-x*x-0.5625 + R(z))
+ * z=1/x^2
+ * The interval is partitioned into several segments
+ * of width 1/8 in 1/x.
+ *
+ * Note1:
+ * To compute exp(-x*x-0.5625+R/S), let s be a single
+ * precision number and s := x; then
+ * -x*x = -s*s + (s-x)*(s+x)
+ * exp(-x*x-0.5626+R/S) =
+ * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
+ * Note2:
+ * Here 4 and 5 make use of the asymptotic series
+ * exp(-x*x)
+ * erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
+ * x*sqrt(pi)
+ *
+ * 5. For inf > x >= 107
+ * 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"
+#include <math_ldbl_opt.h>
+
+/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+ long double y;
+
+ p += n;
+ y = x + *p--;
+ do
+ {
+ y = y * x + *p--;
+ }
+ while (--n > 0);
+ return y;
+}
+
+
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+tiny = 1e-300L,
+ half = 0.5L,
+ one = 1.0L,
+ two = 2.0L,
+ /* 2/sqrt(pi) - 1 */
+ efx = 1.2837916709551257389615890312154517168810E-1L,
+ /* 8 * (2/sqrt(pi) - 1) */
+ efx8 = 1.0270333367641005911692712249723613735048E0L;
+
+
+/* erf(x) = x + x R(x^2)
+ 0 <= x <= 7/8
+ Peak relative error 1.8e-35 */
+#define NTN1 8
+static const long double TN1[NTN1 + 1] =
+{
+ -3.858252324254637124543172907442106422373E10L,
+ 9.580319248590464682316366876952214879858E10L,
+ 1.302170519734879977595901236693040544854E10L,
+ 2.922956950426397417800321486727032845006E9L,
+ 1.764317520783319397868923218385468729799E8L,
+ 1.573436014601118630105796794840834145120E7L,
+ 4.028077380105721388745632295157816229289E5L,
+ 1.644056806467289066852135096352853491530E4L,
+ 3.390868480059991640235675479463287886081E1L
+};
+#define NTD1 8
+static const long double TD1[NTD1 + 1] =
+{
+ -3.005357030696532927149885530689529032152E11L,
+ -1.342602283126282827411658673839982164042E11L,
+ -2.777153893355340961288511024443668743399E10L,
+ -3.483826391033531996955620074072768276974E9L,
+ -2.906321047071299585682722511260895227921E8L,
+ -1.653347985722154162439387878512427542691E7L,
+ -6.245520581562848778466500301865173123136E5L,
+ -1.402124304177498828590239373389110545142E4L,
+ -1.209368072473510674493129989468348633579E2L
+/* 1.0E0 */
+};
+
+
+/* erf(z+1) = erf_const + P(z)/Q(z)
+ -.125 <= z <= 0
+ Peak relative error 7.3e-36 */
+static const long double erf_const = 0.845062911510467529296875L;
+#define NTN2 8
+static const long double TN2[NTN2 + 1] =
+{
+ -4.088889697077485301010486931817357000235E1L,
+ 7.157046430681808553842307502826960051036E3L,
+ -2.191561912574409865550015485451373731780E3L,
+ 2.180174916555316874988981177654057337219E3L,
+ 2.848578658049670668231333682379720943455E2L,
+ 1.630362490952512836762810462174798925274E2L,
+ 6.317712353961866974143739396865293596895E0L,
+ 2.450441034183492434655586496522857578066E1L,
+ 5.127662277706787664956025545897050896203E-1L
+};
+#define NTD2 8
+static const long double TD2[NTD2 + 1] =
+{
+ 1.731026445926834008273768924015161048885E4L,
+ 1.209682239007990370796112604286048173750E4L,
+ 1.160950290217993641320602282462976163857E4L,
+ 5.394294645127126577825507169061355698157E3L,
+ 2.791239340533632669442158497532521776093E3L,
+ 8.989365571337319032943005387378993827684E2L,
+ 2.974016493766349409725385710897298069677E2L,
+ 6.148192754590376378740261072533527271947E1L,
+ 1.178502892490738445655468927408440847480E1L
+ /* 1.0E0 */
+};
+
+
+/* erfc(x + 0.25) = erfc(0.25) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.4e-35 */
+#define NRNr13 8
+static const long double RNr13[NRNr13 + 1] =
+{
+ -2.353707097641280550282633036456457014829E3L,
+ 3.871159656228743599994116143079870279866E2L,
+ -3.888105134258266192210485617504098426679E2L,
+ -2.129998539120061668038806696199343094971E1L,
+ -8.125462263594034672468446317145384108734E1L,
+ 8.151549093983505810118308635926270319660E0L,
+ -5.033362032729207310462422357772568553670E0L,
+ -4.253956621135136090295893547735851168471E-2L,
+ -8.098602878463854789780108161581050357814E-2L
+};
+#define NRDr13 7
+static const long double RDr13[NRDr13 + 1] =
+{
+ 2.220448796306693503549505450626652881752E3L,
+ 1.899133258779578688791041599040951431383E2L,
+ 1.061906712284961110196427571557149268454E3L,
+ 7.497086072306967965180978101974566760042E1L,
+ 2.146796115662672795876463568170441327274E2L,
+ 1.120156008362573736664338015952284925592E1L,
+ 2.211014952075052616409845051695042741074E1L,
+ 6.469655675326150785692908453094054988938E-1L
+ /* 1.0E0 */
+};
+/* erfc(0.25) = C13a + C13b to extra precision. */
+static const long double C13a = 0.723663330078125L;
+static const long double C13b = 1.0279753638067014931732235184287934646022E-5L;
+
+
+/* erfc(x + 0.375) = erfc(0.375) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.2e-35 */
+#define NRNr14 8
+static const long double RNr14[NRNr14 + 1] =
+{
+ -2.446164016404426277577283038988918202456E3L,
+ 6.718753324496563913392217011618096698140E2L,
+ -4.581631138049836157425391886957389240794E2L,
+ -2.382844088987092233033215402335026078208E1L,
+ -7.119237852400600507927038680970936336458E1L,
+ 1.313609646108420136332418282286454287146E1L,
+ -6.188608702082264389155862490056401365834E0L,
+ -2.787116601106678287277373011101132659279E-2L,
+ -2.230395570574153963203348263549700967918E-2L
+};
+#define NRDr14 7
+static const long double RDr14[NRDr14 + 1] =
+{
+ 2.495187439241869732696223349840963702875E3L,
+ 2.503549449872925580011284635695738412162E2L,
+ 1.159033560988895481698051531263861842461E3L,
+ 9.493751466542304491261487998684383688622E1L,
+ 2.276214929562354328261422263078480321204E2L,
+ 1.367697521219069280358984081407807931847E1L,
+ 2.276988395995528495055594829206582732682E1L,
+ 7.647745753648996559837591812375456641163E-1L
+ /* 1.0E0 */
+};
+/* erfc(0.375) = C14a + C14b to extra precision. */
+static const long double C14a = 0.5958709716796875L;
+static const long double C14b = 1.2118885490201676174914080878232469565953E-5L;
+
+/* erfc(x + 0.5) = erfc(0.5) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 4.7e-36 */
+#define NRNr15 8
+static const long double RNr15[NRNr15 + 1] =
+{
+ -2.624212418011181487924855581955853461925E3L,
+ 8.473828904647825181073831556439301342756E2L,
+ -5.286207458628380765099405359607331669027E2L,
+ -3.895781234155315729088407259045269652318E1L,
+ -6.200857908065163618041240848728398496256E1L,
+ 1.469324610346924001393137895116129204737E1L,
+ -6.961356525370658572800674953305625578903E0L,
+ 5.145724386641163809595512876629030548495E-3L,
+ 1.990253655948179713415957791776180406812E-2L
+};
+#define NRDr15 7
+static const long double RDr15[NRDr15 + 1] =
+{
+ 2.986190760847974943034021764693341524962E3L,
+ 5.288262758961073066335410218650047725985E2L,
+ 1.363649178071006978355113026427856008978E3L,
+ 1.921707975649915894241864988942255320833E2L,
+ 2.588651100651029023069013885900085533226E2L,
+ 2.628752920321455606558942309396855629459E1L,
+ 2.455649035885114308978333741080991380610E1L,
+ 1.378826653595128464383127836412100939126E0L
+ /* 1.0E0 */
+};
+/* erfc(0.5) = C15a + C15b to extra precision. */
+static const long double C15a = 0.4794921875L;
+static const long double C15b = 7.9346869534623172533461080354712635484242E-6L;
+
+/* erfc(x + 0.625) = erfc(0.625) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 5.1e-36 */
+#define NRNr16 8
+static const long double RNr16[NRNr16 + 1] =
+{
+ -2.347887943200680563784690094002722906820E3L,
+ 8.008590660692105004780722726421020136482E2L,
+ -5.257363310384119728760181252132311447963E2L,
+ -4.471737717857801230450290232600243795637E1L,
+ -4.849540386452573306708795324759300320304E1L,
+ 1.140885264677134679275986782978655952843E1L,
+ -6.731591085460269447926746876983786152300E0L,
+ 1.370831653033047440345050025876085121231E-1L,
+ 2.022958279982138755020825717073966576670E-2L,
+};
+#define NRDr16 7
+static const long double RDr16[NRDr16 + 1] =
+{
+ 3.075166170024837215399323264868308087281E3L,
+ 8.730468942160798031608053127270430036627E2L,
+ 1.458472799166340479742581949088453244767E3L,
+ 3.230423687568019709453130785873540386217E2L,
+ 2.804009872719893612081109617983169474655E2L,
+ 4.465334221323222943418085830026979293091E1L,
+ 2.612723259683205928103787842214809134746E1L,
+ 2.341526751185244109722204018543276124997E0L,
+ /* 1.0E0 */
+};
+/* erfc(0.625) = C16a + C16b to extra precision. */
+static const long double C16a = 0.3767547607421875L;
+static const long double C16b = 4.3570693945275513594941232097252997287766E-6L;
+
+/* erfc(x + 0.75) = erfc(0.75) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.7e-35 */
+#define NRNr17 8
+static const long double RNr17[NRNr17 + 1] =
+{
+ -1.767068734220277728233364375724380366826E3L,
+ 6.693746645665242832426891888805363898707E2L,
+ -4.746224241837275958126060307406616817753E2L,
+ -2.274160637728782675145666064841883803196E1L,
+ -3.541232266140939050094370552538987982637E1L,
+ 6.988950514747052676394491563585179503865E0L,
+ -5.807687216836540830881352383529281215100E0L,
+ 3.631915988567346438830283503729569443642E-1L,
+ -1.488945487149634820537348176770282391202E-2L
+};
+#define NRDr17 7
+static const long double RDr17[NRDr17 + 1] =
+{
+ 2.748457523498150741964464942246913394647E3L,
+ 1.020213390713477686776037331757871252652E3L,
+ 1.388857635935432621972601695296561952738E3L,
+ 3.903363681143817750895999579637315491087E2L,
+ 2.784568344378139499217928969529219886578E2L,
+ 5.555800830216764702779238020065345401144E1L,
+ 2.646215470959050279430447295801291168941E1L,
+ 2.984905282103517497081766758550112011265E0L,
+ /* 1.0E0 */
+};
+/* erfc(0.75) = C17a + C17b to extra precision. */
+static const long double C17a = 0.2888336181640625L;
+static const long double C17b = 1.0748182422368401062165408589222625794046E-5L;
+
+
+/* erfc(x + 0.875) = erfc(0.875) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 2.2e-35 */
+#define NRNr18 8
+static const long double RNr18[NRNr18 + 1] =
+{
+ -1.342044899087593397419622771847219619588E3L,
+ 6.127221294229172997509252330961641850598E2L,
+ -4.519821356522291185621206350470820610727E2L,
+ 1.223275177825128732497510264197915160235E1L,
+ -2.730789571382971355625020710543532867692E1L,
+ 4.045181204921538886880171727755445395862E0L,
+ -4.925146477876592723401384464691452700539E0L,
+ 5.933878036611279244654299924101068088582E-1L,
+ -5.557645435858916025452563379795159124753E-2L
+};
+#define NRDr18 7
+static const long double RDr18[NRDr18 + 1] =
+{
+ 2.557518000661700588758505116291983092951E3L,
+ 1.070171433382888994954602511991940418588E3L,
+ 1.344842834423493081054489613250688918709E3L,
+ 4.161144478449381901208660598266288188426E2L,
+ 2.763670252219855198052378138756906980422E2L,
+ 5.998153487868943708236273854747564557632E1L,
+ 2.657695108438628847733050476209037025318E1L,
+ 3.252140524394421868923289114410336976512E0L,
+ /* 1.0E0 */
+};
+/* erfc(0.875) = C18a + C18b to extra precision. */
+static const long double C18a = 0.215911865234375L;
+static const long double C18b = 1.3073705765341685464282101150637224028267E-5L;
+
+/* erfc(x + 1.0) = erfc(1.0) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 1.6e-35 */
+#define NRNr19 8
+static const long double RNr19[NRNr19 + 1] =
+{
+ -1.139180936454157193495882956565663294826E3L,
+ 6.134903129086899737514712477207945973616E2L,
+ -4.628909024715329562325555164720732868263E2L,
+ 4.165702387210732352564932347500364010833E1L,
+ -2.286979913515229747204101330405771801610E1L,
+ 1.870695256449872743066783202326943667722E0L,
+ -4.177486601273105752879868187237000032364E0L,
+ 7.533980372789646140112424811291782526263E-1L,
+ -8.629945436917752003058064731308767664446E-2L
+};
+#define NRDr19 7
+static const long double RDr19[NRDr19 + 1] =
+{
+ 2.744303447981132701432716278363418643778E3L,
+ 1.266396359526187065222528050591302171471E3L,
+ 1.466739461422073351497972255511919814273E3L,
+ 4.868710570759693955597496520298058147162E2L,
+ 2.993694301559756046478189634131722579643E2L,
+ 6.868976819510254139741559102693828237440E1L,
+ 2.801505816247677193480190483913753613630E1L,
+ 3.604439909194350263552750347742663954481E0L,
+ /* 1.0E0 */
+};
+/* erfc(1.0) = C19a + C19b to extra precision. */
+static const long double C19a = 0.15728759765625L;
+static const long double C19b = 1.1609394035130658779364917390740703933002E-5L;
+
+/* erfc(x + 1.125) = erfc(1.125) + x R(x)
+ 0 <= x < 0.125
+ Peak relative error 3.6e-36 */
+#define NRNr20 8
+static const long double RNr20[NRNr20 + 1] =
+{
+ -9.652706916457973956366721379612508047640E2L,
+ 5.577066396050932776683469951773643880634E2L,
+ -4.406335508848496713572223098693575485978E2L,
+ 5.202893466490242733570232680736966655434E1L,
+ -1.931311847665757913322495948705563937159E1L,
+ -9.364318268748287664267341457164918090611E-2L,
+ -3.306390351286352764891355375882586201069E0L,
+ 7.573806045289044647727613003096916516475E-1L,
+ -9.611744011489092894027478899545635991213E-2L
+};
+#define NRDr20 7
+static const long double RDr20[NRDr20 + 1] =
+{
+ 3.032829629520142564106649167182428189014E3L,
+ 1.659648470721967719961167083684972196891E3L,
+ 1.703545128657284619402511356932569292535E3L,
+ 6.393465677731598872500200253155257708763E2L,
+ 3.489131397281030947405287112726059221934E2L,
+ 8.848641738570783406484348434387611713070E1L,
+ 3.132269062552392974833215844236160958502E1L,
+ 4.430131663290563523933419966185230513168E0L
+ /* 1.0E0 */
+};
+/* erfc(1.125) = C20a + C20b to extra precision. */
+static const long double C20a = 0.111602783203125L;
+static const long double C20b = 8.9850951672359304215530728365232161564636E-6L;
+
+/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2))
+ 7/8 <= 1/x < 1
+ Peak relative error 1.4e-35 */
+#define NRNr8 9
+static const long double RNr8[NRNr8 + 1] =
+{
+ 3.587451489255356250759834295199296936784E1L,
+ 5.406249749087340431871378009874875889602E2L,
+ 2.931301290625250886238822286506381194157E3L,
+ 7.359254185241795584113047248898753470923E3L,
+ 9.201031849810636104112101947312492532314E3L,
+ 5.749697096193191467751650366613289284777E3L,
+ 1.710415234419860825710780802678697889231E3L,
+ 2.150753982543378580859546706243022719599E2L,
+ 8.740953582272147335100537849981160931197E0L,
+ 4.876422978828717219629814794707963640913E-2L
+};
+#define NRDr8 8
+static const long double RDr8[NRDr8 + 1] =
+{
+ 6.358593134096908350929496535931630140282E1L,
+ 9.900253816552450073757174323424051765523E2L,
+ 5.642928777856801020545245437089490805186E3L,
+ 1.524195375199570868195152698617273739609E4L,
+ 2.113829644500006749947332935305800887345E4L,
+ 1.526438562626465706267943737310282977138E4L,
+ 5.561370922149241457131421914140039411782E3L,
+ 9.394035530179705051609070428036834496942E2L,
+ 6.147019596150394577984175188032707343615E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2))
+ 0.75 <= 1/x <= 0.875
+ Peak relative error 2.0e-36 */
+#define NRNr7 9
+static const long double RNr7[NRNr7 + 1] =
+{
+ 1.686222193385987690785945787708644476545E1L,
+ 1.178224543567604215602418571310612066594E3L,
+ 1.764550584290149466653899886088166091093E4L,
+ 1.073758321890334822002849369898232811561E5L,
+ 3.132840749205943137619839114451290324371E5L,
+ 4.607864939974100224615527007793867585915E5L,
+ 3.389781820105852303125270837910972384510E5L,
+ 1.174042187110565202875011358512564753399E5L,
+ 1.660013606011167144046604892622504338313E4L,
+ 6.700393957480661937695573729183733234400E2L
+};
+#define NRDr7 9
+static const long double RDr7[NRDr7 + 1] =
+{
+-1.709305024718358874701575813642933561169E3L,
+-3.280033887481333199580464617020514788369E4L,
+-2.345284228022521885093072363418750835214E5L,
+-8.086758123097763971926711729242327554917E5L,
+-1.456900414510108718402423999575992450138E6L,
+-1.391654264881255068392389037292702041855E6L,
+-6.842360801869939983674527468509852583855E5L,
+-1.597430214446573566179675395199807533371E5L,
+-1.488876130609876681421645314851760773480E4L,
+-3.511762950935060301403599443436465645703E2L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 5/8 <= 1/x < 3/4
+ Peak relative error 1.9e-35 */
+#define NRNr6 9
+static const long double RNr6[NRNr6 + 1] =
+{
+ 1.642076876176834390623842732352935761108E0L,
+ 1.207150003611117689000664385596211076662E2L,
+ 2.119260779316389904742873816462800103939E3L,
+ 1.562942227734663441801452930916044224174E4L,
+ 5.656779189549710079988084081145693580479E4L,
+ 1.052166241021481691922831746350942786299E5L,
+ 9.949798524786000595621602790068349165758E4L,
+ 4.491790734080265043407035220188849562856E4L,
+ 8.377074098301530326270432059434791287601E3L,
+ 4.506934806567986810091824791963991057083E2L
+};
+#define NRDr6 9
+static const long double RDr6[NRDr6 + 1] =
+{
+-1.664557643928263091879301304019826629067E2L,
+-3.800035902507656624590531122291160668452E3L,
+-3.277028191591734928360050685359277076056E4L,
+-1.381359471502885446400589109566587443987E5L,
+-3.082204287382581873532528989283748656546E5L,
+-3.691071488256738343008271448234631037095E5L,
+-2.300482443038349815750714219117566715043E5L,
+-6.873955300927636236692803579555752171530E4L,
+-8.262158817978334142081581542749986845399E3L,
+-2.517122254384430859629423488157361983661E2L
+ /* 1.00 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/2 <= 1/x < 5/8
+ Peak relative error 4.6e-36 */
+#define NRNr5 10
+static const long double RNr5[NRNr5 + 1] =
+{
+-3.332258927455285458355550878136506961608E-3L,
+-2.697100758900280402659586595884478660721E-1L,
+-6.083328551139621521416618424949137195536E0L,
+-6.119863528983308012970821226810162441263E1L,
+-3.176535282475593173248810678636522589861E2L,
+-8.933395175080560925809992467187963260693E2L,
+-1.360019508488475978060917477620199499560E3L,
+-1.075075579828188621541398761300910213280E3L,
+-4.017346561586014822824459436695197089916E2L,
+-5.857581368145266249509589726077645791341E1L,
+-2.077715925587834606379119585995758954399E0L
+};
+#define NRDr5 9
+static const long double RDr5[NRDr5 + 1] =
+{
+ 3.377879570417399341550710467744693125385E-1L,
+ 1.021963322742390735430008860602594456187E1L,
+ 1.200847646592942095192766255154827011939E2L,
+ 7.118915528142927104078182863387116942836E2L,
+ 2.318159380062066469386544552429625026238E3L,
+ 4.238729853534009221025582008928765281620E3L,
+ 4.279114907284825886266493994833515580782E3L,
+ 2.257277186663261531053293222591851737504E3L,
+ 5.570475501285054293371908382916063822957E2L,
+ 5.142189243856288981145786492585432443560E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 3/8 <= 1/x < 1/2
+ Peak relative error 2.0e-36 */
+#define NRNr4 10
+static const long double RNr4[NRNr4 + 1] =
+{
+ 3.258530712024527835089319075288494524465E-3L,
+ 2.987056016877277929720231688689431056567E-1L,
+ 8.738729089340199750734409156830371528862E0L,
+ 1.207211160148647782396337792426311125923E2L,
+ 8.997558632489032902250523945248208224445E2L,
+ 3.798025197699757225978410230530640879762E3L,
+ 9.113203668683080975637043118209210146846E3L,
+ 1.203285891339933238608683715194034900149E4L,
+ 8.100647057919140328536743641735339740855E3L,
+ 2.383888249907144945837976899822927411769E3L,
+ 2.127493573166454249221983582495245662319E2L
+};
+#define NRDr4 10
+static const long double RDr4[NRDr4 + 1] =
+{
+-3.303141981514540274165450687270180479586E-1L,
+-1.353768629363605300707949368917687066724E1L,
+-2.206127630303621521950193783894598987033E2L,
+-1.861800338758066696514480386180875607204E3L,
+-8.889048775872605708249140016201753255599E3L,
+-2.465888106627948210478692168261494857089E4L,
+-3.934642211710774494879042116768390014289E4L,
+-3.455077258242252974937480623730228841003E4L,
+-1.524083977439690284820586063729912653196E4L,
+-2.810541887397984804237552337349093953857E3L,
+-1.343929553541159933824901621702567066156E2L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/4 <= 1/x < 3/8
+ Peak relative error 8.4e-37 */
+#define NRNr3 11
+static const long double RNr3[NRNr3 + 1] =
+{
+-1.952401126551202208698629992497306292987E-6L,
+-2.130881743066372952515162564941682716125E-4L,
+-8.376493958090190943737529486107282224387E-3L,
+-1.650592646560987700661598877522831234791E-1L,
+-1.839290818933317338111364667708678163199E0L,
+-1.216278715570882422410442318517814388470E1L,
+-4.818759344462360427612133632533779091386E1L,
+-1.120994661297476876804405329172164436784E2L,
+-1.452850765662319264191141091859300126931E2L,
+-9.485207851128957108648038238656777241333E1L,
+-2.563663855025796641216191848818620020073E1L,
+-1.787995944187565676837847610706317833247E0L
+};
+#define NRDr3 10
+static const long double RDr3[NRDr3 + 1] =
+{
+ 1.979130686770349481460559711878399476903E-4L,
+ 1.156941716128488266238105813374635099057E-2L,
+ 2.752657634309886336431266395637285974292E-1L,
+ 3.482245457248318787349778336603569327521E0L,
+ 2.569347069372696358578399521203959253162E1L,
+ 1.142279000180457419740314694631879921561E2L,
+ 3.056503977190564294341422623108332700840E2L,
+ 4.780844020923794821656358157128719184422E2L,
+ 4.105972727212554277496256802312730410518E2L,
+ 1.724072188063746970865027817017067646246E2L,
+ 2.815939183464818198705278118326590370435E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/8 <= 1/x < 1/4
+ Peak relative error 1.5e-36 */
+#define NRNr2 11
+static const long double RNr2[NRNr2 + 1] =
+{
+-2.638914383420287212401687401284326363787E-8L,
+-3.479198370260633977258201271399116766619E-6L,
+-1.783985295335697686382487087502222519983E-4L,
+-4.777876933122576014266349277217559356276E-3L,
+-7.450634738987325004070761301045014986520E-2L,
+-7.068318854874733315971973707247467326619E-1L,
+-4.113919921935944795764071670806867038732E0L,
+-1.440447573226906222417767283691888875082E1L,
+-2.883484031530718428417168042141288943905E1L,
+-2.990886974328476387277797361464279931446E1L,
+-1.325283914915104866248279787536128997331E1L,
+-1.572436106228070195510230310658206154374E0L
+};
+#define NRDr2 10
+static const long double RDr2[NRDr2 + 1] =
+{
+ 2.675042728136731923554119302571867799673E-6L,
+ 2.170997868451812708585443282998329996268E-4L,
+ 7.249969752687540289422684951196241427445E-3L,
+ 1.302040375859768674620410563307838448508E-1L,
+ 1.380202483082910888897654537144485285549E0L,
+ 8.926594113174165352623847870299170069350E0L,
+ 3.521089584782616472372909095331572607185E1L,
+ 8.233547427533181375185259050330809105570E1L,
+ 1.072971579885803033079469639073292840135E2L,
+ 6.943803113337964469736022094105143158033E1L,
+ 1.775695341031607738233608307835017282662E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+ 1/128 <= 1/x < 1/8
+ Peak relative error 2.2e-36 */
+#define NRNr1 9
+static const long double RNr1[NRNr1 + 1] =
+{
+-4.250780883202361946697751475473042685782E-8L,
+-5.375777053288612282487696975623206383019E-6L,
+-2.573645949220896816208565944117382460452E-4L,
+-6.199032928113542080263152610799113086319E-3L,
+-8.262721198693404060380104048479916247786E-2L,
+-6.242615227257324746371284637695778043982E-1L,
+-2.609874739199595400225113299437099626386E0L,
+-5.581967563336676737146358534602770006970E0L,
+-5.124398923356022609707490956634280573882E0L,
+-1.290865243944292370661544030414667556649E0L
+};
+#define NRDr1 8
+static const long double RDr1[NRDr1 + 1] =
+{
+ 4.308976661749509034845251315983612976224E-6L,
+ 3.265390126432780184125233455960049294580E-4L,
+ 9.811328839187040701901866531796570418691E-3L,
+ 1.511222515036021033410078631914783519649E-1L,
+ 1.289264341917429958858379585970225092274E0L,
+ 6.147640356182230769548007536914983522270E0L,
+ 1.573966871337739784518246317003956180750E1L,
+ 1.955534123435095067199574045529218238263E1L,
+ 9.472613121363135472247929109615785855865E0L
+ /* 1.0E0 */
+};
+
+
+#ifdef __STDC__
+long double
+__erfl (long double x)
+#else
+double
+__erfl (x)
+ long double x;
+#endif
+{
+ long double a, y, z;
+ int32_t i, ix, sign;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+
+ if (ix >= 0x7ff00000)
+ { /* erf(nan)=nan */
+ i = ((sign & 0xfff00000) >> 31) << 1;
+ return (long double) (1 - i) + one / x; /* erf(+-inf)=+-1 */
+ }
+
+ if (ix >= 0x3ff00000) /* |x| >= 1.0 */
+ {
+ y = __erfcl (x);
+ return (one - y);
+ /* return (one - __erfcl (x)); */
+ }
+ u.parts32.w0 = ix;
+ a = u.value;
+ z = x * x;
+ if (ix < 0x3fec0000) /* a < 0.875 */
+ {
+ if (ix < 0x3c600000) /* |x|<2**-57 */
+ {
+ if (ix < 0x00800000)
+ {
+ /* erf (-0) = -0. Unfortunately, for IBM extended double
+ 0.125 * (8.0 * x + efx8 * x) for x = -0 evaluates to 0. */
+ if (x == 0)
+ return x;
+ return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */
+ }
+ return x + efx * x;
+ }
+ y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1);
+ }
+ else
+ {
+ a = a - one;
+ y = erf_const + neval (a, TN2, NTN2) / deval (a, TD2, NTD2);
+ }
+
+ if (sign & 0x80000000) /* x < 0 */
+ y = -y;
+ return( y );
+}
+
+long_double_symbol (libm, __erfl, erfl);
+#ifdef __STDC__
+ long double
+ __erfcl (long double x)
+#else
+ long double
+ __erfcl (x)
+ double
+ x;
+#endif
+{
+ long double y, z, p, r;
+ int32_t i, ix, sign;
+ ieee854_long_double_shape_type u;
+
+ u.value = x;
+ sign = u.parts32.w0;
+ ix = sign & 0x7fffffff;
+ u.parts32.w0 = ix;
+
+ if (ix >= 0x7ff00000)
+ { /* erfc(nan)=nan */
+ /* erfc(+-inf)=0,2 */
+ return (long double) (((u_int32_t) sign >> 31) << 1) + one / x;
+ }
+
+ if (ix < 0x3fd00000) /* |x| <1/4 */
+ {
+ if (ix < 0x38d00000) /* |x|<2**-114 */
+ return one - x;
+ return one - __erfl (x);
+ }
+ if (ix < 0x3ff40000) /* 1.25 */
+ {
+ x = u.value;
+ i = 8.0 * x;
+ switch (i)
+ {
+ case 2:
+ z = x - 0.25L;
+ y = C13b + z * neval (z, RNr13, NRNr13) / deval (z, RDr13, NRDr13);
+ y += C13a;
+ break;
+ case 3:
+ z = x - 0.375L;
+ y = C14b + z * neval (z, RNr14, NRNr14) / deval (z, RDr14, NRDr14);
+ y += C14a;
+ break;
+ case 4:
+ z = x - 0.5L;
+ y = C15b + z * neval (z, RNr15, NRNr15) / deval (z, RDr15, NRDr15);
+ y += C15a;
+ break;
+ case 5:
+ z = x - 0.625L;
+ y = C16b + z * neval (z, RNr16, NRNr16) / deval (z, RDr16, NRDr16);
+ y += C16a;
+ break;
+ case 6:
+ z = x - 0.75L;
+ y = C17b + z * neval (z, RNr17, NRNr17) / deval (z, RDr17, NRDr17);
+ y += C17a;
+ break;
+ case 7:
+ z = x - 0.875L;
+ y = C18b + z * neval (z, RNr18, NRNr18) / deval (z, RDr18, NRDr18);
+ y += C18a;
+ break;
+ case 8:
+ z = x - 1.0L;
+ y = C19b + z * neval (z, RNr19, NRNr19) / deval (z, RDr19, NRDr19);
+ y += C19a;
+ break;
+ case 9:
+ z = x - 1.125L;
+ y = C20b + z * neval (z, RNr20, NRNr20) / deval (z, RDr20, NRDr20);
+ y += C20a;
+ break;
+ }
+ if (sign & 0x80000000)
+ y = 2.0L - y;
+ return y;
+ }
+ /* 1.25 < |x| < 107 */
+ if (ix < 0x405ac000)
+ {
+ /* x < -9 */
+ if ((ix >= 0x40220000) && (sign & 0x80000000))
+ return two - tiny;
+
+ x = fabsl (x);
+ z = one / (x * x);
+ i = 8.0 / x;
+ switch (i)
+ {
+ default:
+ case 0:
+ p = neval (z, RNr1, NRNr1) / deval (z, RDr1, NRDr1);
+ break;
+ case 1:
+ p = neval (z, RNr2, NRNr2) / deval (z, RDr2, NRDr2);
+ break;
+ case 2:
+ p = neval (z, RNr3, NRNr3) / deval (z, RDr3, NRDr3);
+ break;
+ case 3:
+ p = neval (z, RNr4, NRNr4) / deval (z, RDr4, NRDr4);
+ break;
+ case 4:
+ p = neval (z, RNr5, NRNr5) / deval (z, RDr5, NRDr5);
+ break;
+ case 5:
+ p = neval (z, RNr6, NRNr6) / deval (z, RDr6, NRDr6);
+ break;
+ case 6:
+ p = neval (z, RNr7, NRNr7) / deval (z, RDr7, NRDr7);
+ break;
+ case 7:
+ p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8);
+ break;
+ }
+ u.value = x;
+ u.parts32.w3 = 0;
+ u.parts32.w2 &= 0xffffe000;
+ z = u.value;
+ r = __ieee754_expl (-z * z - 0.5625) *
+ __ieee754_expl ((z - x) * (z + x) + p);
+ if ((sign & 0x80000000) == 0)
+ return r / x;
+ else
+ return two - r / x;
+ }
+ else
+ {
+ if ((sign & 0x80000000) == 0)
+ return tiny * tiny;
+ else
+ return two - tiny;
+ }
+}
+
+long_double_symbol (libm, __erfcl, erfcl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
new file mode 100644
index 0000000..4908d4e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
@@ -0,0 +1,160 @@
+/* expm1l.c
+ *
+ * Exponential function, minus 1
+ * 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, expm1l();
+ *
+ * y = expm1l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns e (2.71828...) raised to the x power, minus one.
+ *
+ * Range reduction is accomplished by separating the argument
+ * into an integer k and fraction f such that
+ *
+ * x k f
+ * e = 2 e.
+ *
+ * An expansion x + .5 x^2 + x^3 R(x) approximates exp(f) - 1
+ * in the basic range [-0.5 ln 2, 0.5 ln 2].
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE -79,+MAXLOG 100,000 1.7e-34 4.5e-35
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x)
+ -.5 ln 2 < x < .5 ln 2
+ Theoretical peak relative error = 8.1e-36 */
+
+static const long double
+ P0 = 2.943520915569954073888921213330863757240E8L,
+ P1 = -5.722847283900608941516165725053359168840E7L,
+ P2 = 8.944630806357575461578107295909719817253E6L,
+ P3 = -7.212432713558031519943281748462837065308E5L,
+ P4 = 4.578962475841642634225390068461943438441E4L,
+ P5 = -1.716772506388927649032068540558788106762E3L,
+ P6 = 4.401308817383362136048032038528753151144E1L,
+ P7 = -4.888737542888633647784737721812546636240E-1L,
+ Q0 = 1.766112549341972444333352727998584753865E9L,
+ Q1 = -7.848989743695296475743081255027098295771E8L,
+ Q2 = 1.615869009634292424463780387327037251069E8L,
+ Q3 = -2.019684072836541751428967854947019415698E7L,
+ Q4 = 1.682912729190313538934190635536631941751E6L,
+ Q5 = -9.615511549171441430850103489315371768998E4L,
+ Q6 = 3.697714952261803935521187272204485251835E3L,
+ Q7 = -8.802340681794263968892934703309274564037E1L,
+ /* Q8 = 1.000000000000000000000000000000000000000E0 */
+/* C1 + C2 = ln 2 */
+
+ C1 = 6.93145751953125E-1L,
+ C2 = 1.428606820309417232121458176568075500134E-6L,
+/* ln (2^16384 * (1 - 2^-113)) */
+ maxlog = 1.1356523406294143949491931077970764891253E4L,
+/* ln 2^-114 */
+ minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e307L;
+
+
+long double
+__expm1l (long double x)
+{
+ long double px, qx, xx;
+ int32_t ix, sign;
+ ieee854_long_double_shape_type u;
+ int k;
+
+ /* Detect infinity and NaN. */
+ u.value = x;
+ ix = u.parts32.w0;
+ sign = ix & 0x80000000;
+ ix &= 0x7fffffff;
+ if (ix >= 0x7ff00000)
+ {
+ /* Infinity. */
+ if (((ix & 0xfffff) | u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ {
+ if (sign)
+ return -1.0L;
+ else
+ return x;
+ }
+ /* NaN. No invalid exception. */
+ return x;
+ }
+
+ /* expm1(+- 0) = +- 0. */
+ if ((ix == 0) && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+ return x;
+
+ /* Overflow. */
+ if (x > maxlog)
+ return (big * big);
+
+ /* Minimum value. */
+ if (x < minarg)
+ return (4.0/big - 1.0L);
+
+ /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */
+ xx = C1 + C2; /* ln 2. */
+ px = __floorl (0.5 + x / xx);
+ k = px;
+ /* remainder times ln 2 */
+ x -= px * C1;
+ x -= px * C2;
+
+ /* Approximate exp(remainder ln 2). */
+ px = (((((((P7 * x
+ + P6) * x
+ + P5) * x + P4) * x + P3) * x + P2) * x + P1) * x + P0) * x;
+
+ qx = (((((((x
+ + Q7) * x
+ + Q6) * x + Q5) * x + Q4) * x + Q3) * x + Q2) * x + Q1) * x + Q0;
+
+ xx = x * x;
+ qx = x + (0.5 * xx + xx * px / qx);
+
+ /* exp(x) = exp(k ln 2) exp(remainder ln 2) = 2^k exp(remainder ln 2).
+
+ We have qx = exp(remainder ln 2) - 1, so
+ exp(x) - 1 = 2^k (qx + 1) - 1
+ = 2^k qx + 2^k - 1. */
+
+ px = ldexpl (1.0L, k);
+ x = px * qx + (px - 1.0);
+ return x;
+}
+libm_hidden_def (__expm1l)
+long_double_symbol (libm, __expm1l, expm1l);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
new file mode 100644
index 0000000..6266312
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
@@ -0,0 +1,43 @@
+/* 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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+ long double __fabsl(long double x)
+#else
+ long double __fabsl(x)
+ long double x;
+#endif
+{
+ u_int64_t hx, lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ lx = lx ^ ( hx & 0x8000000000000000LL );
+ hx = hx & 0x7fffffffffffffffLL;
+ SET_LDOUBLE_WORDS64(hx,lx,x);
+ return x;
+}
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_finitel.c b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
new file mode 100644
index 0000000..49f2c92
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
@@ -0,0 +1,45 @@
+/* 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"
+#include <math_ldbl_opt.h>
+
+int
+___finitel (long double x)
+{
+ int64_t hx;
+ GET_LDOUBLE_MSW64(hx,x);
+ return (int)((u_int64_t)((hx&0x7fffffffffffffffLL)
+ -0x7ff0000000000000LL)>>63);
+}
+hidden_ver (___finitel, __finitel)
+weak_alias (___finitel, ____finitel)
+#ifdef IS_IN_libm
+long_double_symbol (libm, ____finitel, finitel);
+long_double_symbol (libm, ___finitel, __finitel);
+#else
+long_double_symbol (libc, ____finitel, finitel);
+long_double_symbol (libc, ___finitel, __finitel);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_floorl.c b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
new file mode 100644
index 0000000..4c4ae9b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
@@ -0,0 +1,85 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__floorl (long double x)
+#else
+long double
+__floorl (x)
+ long double x;
+#endif
+{
+ double xh, xl, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Return Inf, Nan, +/-0 unchanged. */
+ if (__builtin_expect (xh != 0.0
+ && __builtin_isless (__builtin_fabs (xh),
+ __builtin_inf ()), 1))
+ {
+ int save_round = fegetround ();
+
+ /* Long double arithmetic, including the canonicalisation below,
+ only works in round-to-nearest mode. */
+ fesetround (FE_TONEAREST);
+
+ /* Convert the high double to integer. */
+ hi = ldbl_nearbyint (xh);
+
+ /* Subtract integral high part from the value. */
+ xh -= hi;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Now convert the low double, adjusted for any remainder from the
+ high double. */
+ lo = ldbl_nearbyint (xh);
+
+ /* Adjust the result when the remainder is non-zero. nearbyint
+ rounds values to the nearest integer, and values halfway
+ between integers to the nearest even integer. floorl must
+ round towards -Inf. */
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+ lo += -1.0;
+
+ /* Ensure the final value is canonical. In certain cases,
+ rounding causes hi,lo calculated so far to be non-canonical. */
+ xh = hi;
+ xl = lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ fesetround (save_round);
+ }
+
+ return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __floorl, floorl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
new file mode 100644
index 0000000..6999abc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
@@ -0,0 +1,95 @@
+/* Return classification value corresponding to argument.
+ Copyright (C) 1997,1999,2002,2004,2006,2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+ /*
+ * hx lx
+ * +NaN 7ffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+ * -NaN fffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+ * +Inf 7ff0 0000 0000 0000 xxxx xxxx xxxx xxxx
+ * -Inf fff0 0000 0000 0000 xxxx xxxx xxxx xxxx
+ * +0 0000 0000 0000 0000 xxxx xxxx xxxx xxxx
+ * -0 8000 0000 0000 0000 xxxx xxxx xxxx xxxx
+ * +normal 0360 0000 0000 0000 0000 0000 0000 0000 (smallest)
+ * -normal 8360 0000 0000 0000 0000 0000 0000 0000 (smallest)
+ * +normal 7fef ffff ffff ffff 7c8f ffff ffff fffe (largest)
+ * +normal ffef ffff ffff ffff fc8f ffff ffff fffe (largest)
+ * +denorm 0360 0000 0000 0000 8000 0000 0000 0001 (largest)
+ * -denorm 8360 0000 0000 0000 0000 0000 0000 0001 (largest)
+ * +denorm 000n nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+ * -denorm 800n nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+ */
+
+int
+___fpclassifyl (long double x)
+{
+ u_int64_t hx, lx;
+ int retval = FP_NORMAL;
+
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if ((hx & 0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) {
+ /* +/-NaN or +/-Inf */
+ if (hx & 0x000fffffffffffffULL) {
+ /* +/-NaN */
+ retval = FP_NAN;
+ } else {
+ retval = FP_INFINITE;
+ }
+ } else {
+ /* +/-zero or +/- normal or +/- denormal */
+ if (hx & 0x7fffffffffffffffULL) {
+ /* +/- normal or +/- denormal */
+ if ((hx & 0x7ff0000000000000ULL) > 0x0360000000000000ULL) {
+ /* +/- normal */
+ retval = FP_NORMAL;
+ } else {
+ if ((hx & 0x7ff0000000000000ULL) == 0x0360000000000000ULL) {
+ if ((lx & 0x7fffffffffffffff) /* lower is non-zero */
+ && ((lx^hx) & 0x8000000000000000ULL)) { /* and sign differs */
+ /* +/- denormal */
+ retval = FP_SUBNORMAL;
+ } else {
+ /* +/- normal */
+ retval = FP_NORMAL;
+ }
+ } else {
+ /* +/- denormal */
+ retval = FP_SUBNORMAL;
+ }
+ }
+ } else {
+ /* +/- zero */
+ retval = FP_ZERO;
+ }
+ }
+
+ return retval;
+}
+long_double_symbol (libm, ___fpclassifyl, __fpclassifyl);
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+libm_hidden_ver (___fpclassifyl, __fpclassifyl)
+#else
+libm_hidden_def (__fpclassifyl)
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
new file mode 100644
index 0000000..fab566d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
@@ -0,0 +1,92 @@
+/* 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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two107 = 162259276829213363391578010288128.0; /* 0x4670000000000000, 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, ixl;
+ int64_t explo;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ ixl = 0x7fffffffffffffffULL&lx;
+ ix = 0x7fffffffffffffffULL&hx;
+ *eptr = 0;
+ if(ix>=0x7ff0000000000000ULL||((ix|ixl)==0)) return x; /* 0,inf,nan */
+ if (ix<0x0010000000000000ULL) { /* subnormal */
+ x *= two107;
+ GET_LDOUBLE_MSW64(hx,x);
+ ix = hx&0x7fffffffffffffffULL;
+ *eptr = -107;
+ }
+ *eptr += (ix>>52)-1022;
+
+ if (ixl != 0ULL) {
+ explo = (ixl>>52) - (ix>>52) + 0x3fe;
+ if ((ixl&0x7ff0000000000000ULL) == 0LL) {
+ /* the lower double is a denomal so we need to correct its
+ mantissa and perhaps its exponent. */
+ int cnt;
+
+ if (sizeof (ixl) == sizeof (long))
+ cnt = __builtin_clzl (ixl);
+ else if ((ixl >> 32) != 0)
+ cnt = __builtin_clzl ((long) (ixl >> 32));
+ else
+ cnt = __builtin_clzl ((long) ixl) + 32;
+ cnt = cnt - 12;
+ lx = (lx&0x8000000000000000ULL) | ((explo-cnt)<<52)
+ | ((ixl<<(cnt+1))&0x000fffffffffffffULL);
+ } else
+ lx = (lx&0x800fffffffffffffULL) | (explo<<52);
+ } else
+ lx = 0ULL;
+
+ hx = (hx&0x800fffffffffffffULL) | 0x3fe0000000000000ULL;
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __frexpl, frexpl);
+#else
+long_double_symbol (libc, __frexpl, frexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c b/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c
new file mode 100644
index 0000000..428854d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c
@@ -0,0 +1,63 @@
+/* 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) = FP_ILOGB0
+ * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
+ * ilogbl(+-Inf) = INT_MAX (no signal is raised)
+ */
+
+#include <limits.h>
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.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 <= 0x0010000000000000LL) {
+ if((hx|(lx&0x7fffffffffffffffLL))==0)
+ return FP_ILOGB0; /* ilogbl(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<0x7ff0000000000000LL) return (hx>>52)-0x3ff;
+ else if (FP_ILOGBNAN != INT_MAX) {
+ /* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */
+ if (((hx^0x7ff0000000000000LL)|lx) == 0)
+ return INT_MAX;
+ }
+ return FP_ILOGBNAN;
+}
+long_double_symbol (libm, __ilogbl, ilogbl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
new file mode 100644
index 0000000..717b574
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
@@ -0,0 +1,35 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Change for long double by Jakub Jelinek <jj@ultra.linux.cz>
+ * 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"
+#include <math_ldbl_opt.h>
+
+int
+___isinfl (long double x)
+{
+ int64_t hx,lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ lx = (lx & 0x7fffffffffffffffLL);
+ lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
+ lx |= -lx;
+ return ~(lx >> 63) & (hx >> 62);
+}
+hidden_ver (___isinfl, __isinfl)
+#ifndef IS_IN_libm
+weak_alias (___isinfl, ____isinfl)
+long_double_symbol (libc, ___isinfl, isinfl);
+long_double_symbol (libc, ____isinfl, __isinfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
new file mode 100644
index 0000000..ae5ba8e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
@@ -0,0 +1,43 @@
+/* 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"
+#include <math_ldbl_opt.h>
+
+int
+___isnanl (long double x)
+{
+ int64_t hx,lx;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ hx &= 0x7fffffffffffffffLL;
+ hx = 0x7ff0000000000000LL - hx;
+ return (int)((u_int64_t)hx>>63);
+}
+hidden_ver (___isnanl, __isnanl)
+#ifndef IS_IN_libm
+weak_alias (___isnanl, ____isnanl)
+long_double_symbol (libc, ___isnanl, isnanl);
+long_double_symbol (libc, ____isnanl, __isnanl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
new file mode 100644
index 0000000..3718250
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -0,0 +1,147 @@
+/* Round to long long int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long long
+__llrintl (long double x)
+#else
+long long
+__llrintl (x)
+ long double x;
+#endif
+{
+ double xh, xl;
+ long long res, hi, lo;
+ int save_round;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Limit the range of values handled by the conversion to long long.
+ We do this because we aren't sure whether that conversion properly
+ raises FE_INVALID. */
+ if (__builtin_expect
+ ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1)
+#if !defined (FE_INVALID)
+ || 1
+#endif
+ )
+ {
+ save_round = fegetround ();
+
+ if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+ {
+ /* When XH is 9223372036854775808.0, converting to long long will
+ overflow, resulting in an invalid operation. However, XL might
+ be negative and of sufficient magnitude that the overall long
+ double is in fact in range. Avoid raising an exception. In any
+ case we need to convert this value specially, because
+ the converted value is not exactly represented as a double
+ thus subtracting HI from XH suffers rounding error. */
+ hi = __LONG_LONG_MAX__;
+ xh = 1.0;
+ }
+ else
+ {
+ hi = (long long) xh;
+ xh -= hi;
+ }
+ ldbl_canonicalize (&xh, &xl);
+
+ lo = (long long) xh;
+
+ /* Peg at max/min values, assuming that the above conversions do so.
+ Strictly speaking, we can return anything for values that overflow,
+ but this is more useful. */
+ res = hi + lo;
+
+ /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
+ if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ hi = res;
+ switch (save_round)
+ {
+ case FE_TONEAREST:
+ if (fabs (xh) < 0.5
+ || (fabs (xh) == 0.5
+ && ((xh > 0.0 && xl < 0.0)
+ || (xh < 0.0 && xl > 0.0)
+ || (xl == 0.0 && (res & 1) == 0))))
+ return res;
+
+ if (xh < 0.0)
+ res -= 1;
+ else
+ res += 1;
+ break;
+
+ case FE_TOWARDZERO:
+ if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0)))
+ res -= 1;
+ else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0)))
+ res += 1;
+ return res;
+ break;
+
+ case FE_UPWARD:
+ if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+ res += 1;
+ break;
+
+ case FE_DOWNWARD:
+ if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+ res -= 1;
+ break;
+ }
+
+ if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ return res;
+ }
+ else
+ {
+ if (xh > 0.0)
+ hi = __LONG_LONG_MAX__;
+ else if (xh < 0.0)
+ hi = -__LONG_LONG_MAX__ - 1;
+ else
+ /* Nan */
+ hi = 0;
+ }
+
+overflow:
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ return hi;
+}
+
+long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
new file mode 100644
index 0000000..9e25024
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -0,0 +1,127 @@
+/* Round to long long int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+#ifdef __STDC__
+long long
+__llroundl (long double x)
+#else
+long long
+__llroundl (x)
+ long double x;
+#endif
+{
+ double xh, xl;
+ long long res, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Limit the range of values handled by the conversion to long long.
+ We do this because we aren't sure whether that conversion properly
+ raises FE_INVALID. */
+ if (__builtin_expect
+ ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1)
+#if !defined (FE_INVALID)
+ || 1
+#endif
+ )
+ {
+ if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+ {
+ /* When XH is 9223372036854775808.0, converting to long long will
+ overflow, resulting in an invalid operation. However, XL might
+ be negative and of sufficient magnitude that the overall long
+ double is in fact in range. Avoid raising an exception. In any
+ case we need to convert this value specially, because
+ the converted value is not exactly represented as a double
+ thus subtracting HI from XH suffers rounding error. */
+ hi = __LONG_LONG_MAX__;
+ xh = 1.0;
+ }
+ else
+ {
+ hi = (long long) xh;
+ xh -= hi;
+ }
+ ldbl_canonicalize (&xh, &xl);
+
+ lo = (long long) xh;
+
+ /* Peg at max/min values, assuming that the above conversions do so.
+ Strictly speaking, we can return anything for values that overflow,
+ but this is more useful. */
+ res = hi + lo;
+
+ /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
+ if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ hi = res;
+ if (xh > 0.5)
+ {
+ res += 1;
+ }
+ else if (xh == 0.5)
+ {
+ if (xl > 0.0 || (xl == 0.0 && res >= 0))
+ res += 1;
+ }
+ else if (-xh > 0.5)
+ {
+ res -= 1;
+ }
+ else if (-xh == 0.5)
+ {
+ if (xl < 0.0 || (xl == 0.0 && res <= 0))
+ res -= 1;
+ }
+
+ if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ return res;
+ }
+ else
+ {
+ if (xh > 0.0)
+ hi = __LONG_LONG_MAX__;
+ else if (xh < 0.0)
+ hi = -__LONG_LONG_MAX__ - 1;
+ else
+ /* Nan */
+ hi = 0;
+ }
+
+overflow:
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ return hi;
+}
+
+long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
new file mode 100644
index 0000000..f1863fb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
@@ -0,0 +1,257 @@
+/* log1pl.c
+ *
+ * Relative error logarithm
+ * Natural logarithm of 1+x, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log1pl();
+ *
+ * y = log1pl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base e (2.718...) logarithm of 1+x.
+ *
+ * The argument 1+x is separated into its exponent and fractional
+ * parts. If the exponent is between -1 and +1, the logarithm
+ * of the fraction is approximated by
+ *
+ * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting z = 2(w-1)/(w+1),
+ *
+ * log(w) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ * Relative error:
+ * arithmetic domain # trials peak rms
+ * IEEE -1, 8 100000 1.9e-34 4.3e-35
+ */
+
+/* Copyright 2001 by Stephen L. Moshier
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* Coefficients for log(1+x) = x - x^2 / 2 + x^3 P(x)/Q(x)
+ * 1/sqrt(2) <= 1+x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double
+ P12 = 1.538612243596254322971797716843006400388E-6L,
+ P11 = 4.998469661968096229986658302195402690910E-1L,
+ P10 = 2.321125933898420063925789532045674660756E1L,
+ P9 = 4.114517881637811823002128927449878962058E2L,
+ P8 = 3.824952356185897735160588078446136783779E3L,
+ P7 = 2.128857716871515081352991964243375186031E4L,
+ P6 = 7.594356839258970405033155585486712125861E4L,
+ P5 = 1.797628303815655343403735250238293741397E5L,
+ P4 = 2.854829159639697837788887080758954924001E5L,
+ P3 = 3.007007295140399532324943111654767187848E5L,
+ P2 = 2.014652742082537582487669938141683759923E5L,
+ P1 = 7.771154681358524243729929227226708890930E4L,
+ P0 = 1.313572404063446165910279910527789794488E4L,
+ /* Q12 = 1.000000000000000000000000000000000000000E0L, */
+ Q11 = 4.839208193348159620282142911143429644326E1L,
+ Q10 = 9.104928120962988414618126155557301584078E2L,
+ Q9 = 9.147150349299596453976674231612674085381E3L,
+ Q8 = 5.605842085972455027590989944010492125825E4L,
+ Q7 = 2.248234257620569139969141618556349415120E5L,
+ Q6 = 6.132189329546557743179177159925690841200E5L,
+ Q5 = 1.158019977462989115839826904108208787040E6L,
+ Q4 = 1.514882452993549494932585972882995548426E6L,
+ Q3 = 1.347518538384329112529391120390701166528E6L,
+ Q2 = 7.777690340007566932935753241556479363645E5L,
+ Q1 = 2.626900195321832660448791748036714883242E5L,
+ Q0 = 3.940717212190338497730839731583397586124E4L;
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double
+ R5 = -8.828896441624934385266096344596648080902E-1L,
+ R4 = 8.057002716646055371965756206836056074715E1L,
+ R3 = -2.024301798136027039250415126250455056397E3L,
+ R2 = 2.048819892795278657810231591630928516206E4L,
+ R1 = -8.977257995689735303686582344659576526998E4L,
+ R0 = 1.418134209872192732479751274970992665513E5L,
+ /* S6 = 1.000000000000000000000000000000000000000E0L, */
+ S5 = -1.186359407982897997337150403816839480438E2L,
+ S4 = 3.998526750980007367835804959888064681098E3L,
+ S3 = -5.748542087379434595104154610899551484314E4L,
+ S2 = 4.001557694070773974936904547424676279307E5L,
+ S1 = -1.332535117259762928288745111081235577029E6L,
+ S0 = 1.701761051846631278975701529965589676574E6L;
+
+/* C1 + C2 = ln 2 */
+static const long double C1 = 6.93145751953125E-1L;
+static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+/* ln (2^16384 * (1 - 2^-113)) */
+static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+static const long double big = 2e300L;
+static const long double zero = 0.0L;
+
+#if 1
+/* Make sure these are prototyped. */
+long double frexpl (long double, int *);
+long double ldexpl (long double, int);
+#endif
+
+
+long double
+__log1pl (long double xm1)
+{
+ long double x, y, z, r, s;
+ ieee854_long_double_shape_type u;
+ int32_t hx;
+ int e;
+
+ /* Test for NaN or infinity input. */
+ u.value = xm1;
+ hx = u.parts32.w0;
+ if (hx >= 0x7ff00000)
+ return xm1;
+
+ /* log1p(+- 0) = +- 0. */
+ if (((hx & 0x7fffffff) == 0)
+ && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+ return xm1;
+
+ x = xm1 + 1.0L;
+
+ /* log1p(-1) = -inf */
+ if (x <= 0.0L)
+ {
+ if (x == 0.0L)
+ return (-1.0L / (x - x));
+ else
+ return (zero / (x - x));
+ }
+
+ /* Separate mantissa from exponent. */
+
+ /* Use frexp used so that denormal numbers will be handled properly. */
+ x = frexpl (x, &e);
+
+ /* Logarithm using log(x) = z + z^3 P(z^2)/Q(z^2),
+ where z = 2(x-1)/x+1). */
+ if ((e > 2) || (e < -2))
+ {
+ if (x < sqrth)
+ { /* 2( 2x-1 )/( 2x+1 ) */
+ e -= 1;
+ z = x - 0.5L;
+ y = 0.5L * z + 0.5L;
+ }
+ else
+ { /* 2 (x-1)/(x+1) */
+ z = x - 0.5L;
+ z -= 0.5L;
+ y = 0.5L * x + 0.5L;
+ }
+ x = z / y;
+ z = x * x;
+ r = ((((R5 * z
+ + R4) * z
+ + R3) * z
+ + R2) * z
+ + R1) * z
+ + R0;
+ s = (((((z
+ + S5) * z
+ + S4) * z
+ + S3) * z
+ + S2) * z
+ + S1) * z
+ + S0;
+ z = x * (z * r / s);
+ z = z + e * C2;
+ z = z + x;
+ z = z + e * C1;
+ return (z);
+ }
+
+
+ /* Logarithm using log(1+x) = x - .5x^2 + x^3 P(x)/Q(x). */
+
+ if (x < sqrth)
+ {
+ e -= 1;
+ if (e != 0)
+ x = 2.0L * x - 1.0L; /* 2x - 1 */
+ else
+ x = xm1;
+ }
+ else
+ {
+ if (e != 0)
+ x = x - 1.0L;
+ else
+ x = xm1;
+ }
+ z = x * x;
+ r = (((((((((((P12 * x
+ + P11) * x
+ + P10) * x
+ + P9) * x
+ + P8) * x
+ + P7) * x
+ + P6) * x
+ + P5) * x
+ + P4) * x
+ + P3) * x
+ + P2) * x
+ + P1) * x
+ + P0;
+ s = (((((((((((x
+ + Q11) * x
+ + Q10) * x
+ + Q9) * x
+ + Q8) * x
+ + Q7) * x
+ + Q6) * x
+ + Q5) * x
+ + Q4) * x
+ + Q3) * x
+ + Q2) * x
+ + Q1) * x
+ + Q0;
+ y = x * (z * r / s);
+ y = y + e * C2;
+ z = y - 0.5L * z;
+ z = z + x;
+ z = z + e * C1;
+ return (z);
+}
+
+long_double_symbol (libm, __log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
new file mode 100644
index 0000000..0c61cda
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -0,0 +1,47 @@
+/* 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"
+#include <math_ldbl_opt.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&0x7fffffffffffffffLL))==0) return -1.0/fabs(x);
+ if(hx>=0x7ff0000000000000LL) return x*x;
+ if((hx>>=52)==0) /* IEEE 754 logb */
+ return -1022.0;
+ else
+ return (long double) (hx-0x3ff);
+}
+long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
new file mode 100644
index 0000000..e289348
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
@@ -0,0 +1,162 @@
+/* Round to long int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long
+__lrintl (long double x)
+#else
+long
+__lrintl (x)
+ long double x;
+#endif
+{
+ double xh, xl;
+ long res, hi, lo;
+ int save_round;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Limit the range of values handled by the conversion to long.
+ We do this because we aren't sure whether that conversion properly
+ raises FE_INVALID. */
+ if (
+#if __LONG_MAX__ == 2147483647
+ __builtin_expect
+ ((__builtin_fabs (xh) <= (double) __LONG_MAX__ + 2), 1)
+#else
+ __builtin_expect
+ ((__builtin_fabs (xh) <= -(double) (-__LONG_MAX__ - 1)), 1)
+#endif
+#if !defined (FE_INVALID)
+ || 1
+#endif
+ )
+ {
+ save_round = fegetround ();
+
+#if __LONG_MAX__ == 2147483647
+ long long llhi = (long long) xh;
+ if (llhi != (long) llhi)
+ hi = llhi < 0 ? -__LONG_MAX__ - 1 : __LONG_MAX__;
+ else
+ hi = llhi;
+ xh -= hi;
+#else
+ if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+ {
+ /* When XH is 9223372036854775808.0, converting to long long will
+ overflow, resulting in an invalid operation. However, XL might
+ be negative and of sufficient magnitude that the overall long
+ double is in fact in range. Avoid raising an exception. In any
+ case we need to convert this value specially, because
+ the converted value is not exactly represented as a double
+ thus subtracting HI from XH suffers rounding error. */
+ hi = __LONG_MAX__;
+ xh = 1.0;
+ }
+ else
+ {
+ hi = (long) xh;
+ xh -= hi;
+ }
+#endif
+ ldbl_canonicalize (&xh, &xl);
+
+ lo = (long) xh;
+
+ /* Peg at max/min values, assuming that the above conversions do so.
+ Strictly speaking, we can return anything for values that overflow,
+ but this is more useful. */
+ res = hi + lo;
+
+ /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
+ if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ hi = res;
+ switch (save_round)
+ {
+ case FE_TONEAREST:
+ if (fabs (xh) < 0.5
+ || (fabs (xh) == 0.5
+ && ((xh > 0.0 && xl < 0.0)
+ || (xh < 0.0 && xl > 0.0)
+ || (xl == 0.0 && (res & 1) == 0))))
+ return res;
+
+ if (xh < 0.0)
+ res -= 1;
+ else
+ res += 1;
+ break;
+
+ case FE_TOWARDZERO:
+ if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0)))
+ res -= 1;
+ else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0)))
+ res += 1;
+ return res;
+ break;
+
+ case FE_UPWARD:
+ if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+ res += 1;
+ break;
+
+ case FE_DOWNWARD:
+ if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+ res -= 1;
+ break;
+ }
+
+ if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ return res;
+ }
+ else
+ {
+ if (xh > 0.0)
+ hi = __LONG_MAX__;
+ else if (xh < 0.0)
+ hi = -__LONG_MAX__ - 1;
+ else
+ /* Nan */
+ hi = 0;
+ }
+
+overflow:
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ return hi;
+}
+
+long_double_symbol (libm, __lrintl, lrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
new file mode 100644
index 0000000..a5251ee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
@@ -0,0 +1,142 @@
+/* Round to long int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+#ifdef __STDC__
+long
+__lroundl (long double x)
+#else
+long
+__lroundl (x)
+ long double x;
+#endif
+{
+ double xh, xl;
+ long res, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Limit the range of values handled by the conversion to long.
+ We do this because we aren't sure whether that conversion properly
+ raises FE_INVALID. */
+ if (
+#if __LONG_MAX__ == 2147483647
+ __builtin_expect
+ ((__builtin_fabs (xh) <= (double) __LONG_MAX__ + 2), 1)
+#else
+ __builtin_expect
+ ((__builtin_fabs (xh) <= -(double) (-__LONG_MAX__ - 1)), 1)
+#endif
+#if !defined (FE_INVALID)
+ || 1
+#endif
+ )
+ {
+#if __LONG_MAX__ == 2147483647
+ long long llhi = (long long) xh;
+ if (llhi != (long) llhi)
+ hi = llhi < 0 ? -__LONG_MAX__ - 1 : __LONG_MAX__;
+ else
+ hi = llhi;
+ xh -= hi;
+#else
+ if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+ {
+ /* When XH is 9223372036854775808.0, converting to long long will
+ overflow, resulting in an invalid operation. However, XL might
+ be negative and of sufficient magnitude that the overall long
+ double is in fact in range. Avoid raising an exception. In any
+ case we need to convert this value specially, because
+ the converted value is not exactly represented as a double
+ thus subtracting HI from XH suffers rounding error. */
+ hi = __LONG_MAX__;
+ xh = 1.0;
+ }
+ else
+ {
+ hi = (long) xh;
+ xh -= hi;
+ }
+#endif
+ ldbl_canonicalize (&xh, &xl);
+
+ lo = (long) xh;
+
+ /* Peg at max/min values, assuming that the above conversions do so.
+ Strictly speaking, we can return anything for values that overflow,
+ but this is more useful. */
+ res = hi + lo;
+
+ /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */
+ if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ hi = res;
+ if (xh > 0.5)
+ {
+ res += 1;
+ }
+ else if (xh == 0.5)
+ {
+ if (xl > 0.0 || (xl == 0.0 && res >= 0))
+ res += 1;
+ }
+ else if (-xh > 0.5)
+ {
+ res -= 1;
+ }
+ else if (-xh == 0.5)
+ {
+ if (xl < 0.0 || (xl == 0.0 && res <= 0))
+ res -= 1;
+ }
+
+ if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+ goto overflow;
+
+ return res;
+ }
+ else
+ {
+ if (xh > 0.0)
+ hi = __LONG_MAX__;
+ else if (xh < 0.0)
+ hi = -__LONG_MAX__ - 1;
+ else
+ /* Nan */
+ hi = 0;
+ }
+
+overflow:
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ return hi;
+}
+
+long_double_symbol (libm, __lroundl, lroundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_modfl.c b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
new file mode 100644
index 0000000..f2e65f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
@@ -0,0 +1,94 @@
+/* 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"
+#include <math_ldbl_opt.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);
+ i1 &= 0x000fffffffffffffLL;
+ j0 = ((i0>>52)&0x7ff)-0x3ff; /* exponent of x */
+ if(j0<52) { /* integer part in high x */
+ if(j0<0) { /* |x|<1 */
+ /* *iptr = +-0 */
+ SET_LDOUBLE_WORDS64(*iptr,i0&0x8000000000000000ULL,0);
+ return x;
+ } else {
+ i = (0x000fffffffffffffLL)>>j0;
+ if(((i0&i)|(i1&0x7fffffffffffffffLL))==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>103) { /* no fraction part */
+ *iptr = x*one;
+ /* We must handle NaNs separately. */
+ if (j0 == 0x400 && ((i0 & 0x000fffffffffffffLL) | i1))
+ return x*one;
+ /* return +-0 */
+ SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+ return x;
+ } else { /* fraction part in low x */
+ i = -1ULL>>(j0-52);
+ 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;
+ }
+ }
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __modfl, modfl);
+#else
+long_double_symbol (libc, __modfl, modfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
new file mode 100644
index 0000000..2561fda
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -0,0 +1,125 @@
+/* Round to int long double floating-point values without raising inexact.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__nearbyintl (long double x)
+#else
+long double
+__nearbyintl (x)
+ long double x;
+#endif
+{
+ fenv_t env;
+ static const long double TWO52 = 4503599627370496.0L;
+ union ibm_extended_long_double u;
+ u.d = x;
+
+ if (fabs (u.dd[0]) < TWO52)
+ {
+ double high = u.dd[0];
+ feholdexcept (&env);
+ if (high > 0.0)
+ {
+ high += TWO52;
+ high -= TWO52;
+ if (high == -0.0) high = 0.0;
+ }
+ else if (high < 0.0)
+ {
+ high -= TWO52;
+ high += TWO52;
+ if (high == 0.0) high = -0.0;
+ }
+ u.dd[0] = high;
+ u.dd[1] = 0.0;
+ fesetenv (&env);
+ }
+ else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+ {
+ double high, low, tau;
+ /* In this case we have to round the low double and handle any
+ adjustment to the high double that may be caused by rounding
+ (up). This is complicated by the fact that the high double
+ may already be rounded and the low double may have the
+ opposite sign to compensate. */
+ feholdexcept (&env);
+ if (u.dd[0] > 0.0)
+ {
+ if (u.dd[1] > 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] < 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low += TWO52;
+ low -= TWO52;
+ }
+ else if (u.dd[0] < 0.0)
+ {
+ if (u.dd[1] < 0.0)
+ {
+ /* If the high/low doubles are the same sign then simply
+ round the low double. */
+ high = u.dd[0];
+ low = u.dd[1];
+ }
+ else if (u.dd[1] > 0.0)
+ {
+ /* Else the high double is pre rounded and we need to
+ adjust for that. */
+ tau = nextafter (u.dd[0], 0.0);
+ tau = (u.dd[0] - tau) * 2.0;
+ high = u.dd[0] - tau;
+ low = u.dd[1] + tau;
+ }
+ low = TWO52 - low;
+ low = -(low - TWO52);
+ }
+ u.dd[0] = high + low;
+ u.dd[1] = high - u.dd[0] + low;
+ fesetenv (&env);
+ }
+
+ return u.d;
+}
+
+long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
new file mode 100644
index 0000000..39d0e6a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
@@ -0,0 +1,119 @@
+/* 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>
+#include <math_ldbl_opt.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,ihx,ihy,ilx;
+ u_int64_t lx,ly;
+
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ ihx = hx&0x7fffffffffffffffLL; /* |hx| */
+ ilx = lx&0x7fffffffffffffffLL; /* |lx| */
+ ihy = hy&0x7fffffffffffffffLL; /* |hy| */
+
+ if((((ihx&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
+ ((ihx&0x000fffffffffffffLL)!=0)) || /* x is nan */
+ (((ihy&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
+ ((ihy&0x000fffffffffffffLL)!=0))) /* y is nan */
+ return x+y; /* signal the nan */
+ if(x==y)
+ return y; /* x=y, return y */
+ if(ihx == 0 && ilx == 0) { /* x == 0 */
+ long double u;
+ hy = (hy & 0x8000000000000000ULL) | 1;
+ SET_LDOUBLE_WORDS64(x,hy,0ULL);/* return +-minsubnormal */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+
+ long double u;
+ if(x > y) { /* x > y, x -= ulp */
+ if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL))
+ return x+x; /* overflow, return -inf */
+ if (hx >= 0x7ff0000000000000LL) {
+ SET_LDOUBLE_WORDS64(u,0x7fefffffffffffffLL,0x7c8ffffffffffffeLL);
+ return u;
+ }
+ if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */
+ u = math_opt_barrier (x);
+ x -= __LDBL_DENORM_MIN__;
+ if (ihx < 0x0360000000000000LL
+ || (hx > 0 && (int64_t) lx <= 0)
+ || (hx < 0 && (int64_t) lx > 1)) {
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ }
+ return x;
+ }
+ if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
+ SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
+ u *= 0x1.0000000000000p-105L;
+ } else
+ SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
+ return x - u;
+ } else { /* x < y, x += ulp */
+ if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL))
+ return x+x; /* overflow, return +inf */
+ if ((u_int64_t) hx >= 0xfff0000000000000ULL) {
+ SET_LDOUBLE_WORDS64(u,0xffefffffffffffffLL,0xfc8ffffffffffffeLL);
+ return u;
+ }
+ if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */
+ u = math_opt_barrier (x);
+ x += __LDBL_DENORM_MIN__;
+ if (ihx < 0x0360000000000000LL
+ || (hx > 0 && (int64_t) lx < 0 && lx != 0x8000000000000001LL)
+ || (hx < 0 && (int64_t) lx >= 0)) {
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ }
+ if (x == 0.0L) /* handle negative __LDBL_DENORM_MIN__ case */
+ x = -0.0L;
+ return x;
+ }
+ if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
+ SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
+ u *= 0x1.0000000000000p-105L;
+ } else
+ SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
+ return x + u;
+ }
+}
+strong_alias (__nextafterl, __nexttowardl)
+long_double_symbol (libm, __nextafterl, nextafterl);
+long_double_symbol (libm, __nexttowardl, nexttowardl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
new file mode 100644
index 0000000..e2f6521
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
@@ -0,0 +1,105 @@
+/* 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>
+#include <math_ldbl_opt.h>
+#include <float.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,uly;
+
+ EXTRACT_WORDS(hx,lx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffffffffffffLL; /* |y| */
+ uly = ly&0x7fffffffffffffffLL; /* |y| */
+
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
+ ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+ /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if((ix|lx)==0) { /* x == 0 */
+ double u;
+ INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if (hy<0||(ix>>20)>(iy>>52)
+ || ((ix>>20)==(iy>>52)
+ && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL)
+ || (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL)
+ )))) { /* 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>>52)
+ || ((ix>>20)==(iy>>52)
+ && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL)
+ || (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL)
+ )))) { /* 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) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+ /* Force conversion to double. */
+ asm ("" : "+m"(x));
+ return x;
+ }
+ if(hy<0x00100000) {
+ double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ }
+ INSERT_WORDS(x,hx,lx);
+ return x;
+}
+long_double_symbol (libm, __nexttoward, nexttoward);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
new file mode 100644
index 0000000..cf655fa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
@@ -0,0 +1,89 @@
+/* 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>
+#include <math_ldbl_opt.h>
+#include <float.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, uly;
+
+ GET_FLOAT_WORD(hx,x);
+ GET_LDOUBLE_WORDS64(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffffffffffffLL; /* |y| */
+ uly = ly&0x7fffffffffffffffLL; /* |y| */
+
+ if((ix>0x7f800000) || /* x is nan */
+ ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+ /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float u;
+ SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hy<0||(ix>>23)>(iy>>52)-0x380
+ || ((ix>>23)==(iy>>52)-0x380
+ && (ix&0x7fffff)>((hy>>29)&0x7fffff))) {/* x > y, x -= ulp */
+ hx -= 1;
+ } else { /* x < y, x += ulp */
+ hx += 1;
+ }
+ } else { /* x < 0 */
+ if(hy>=0||(ix>>23)>(iy>>52)-0x380
+ || ((ix>>23)==(iy>>52)-0x380
+ && (ix&0x7fffff)>((hy>>29)&0x7fffff))) {/* x < y, x -= ulp */
+ hx -= 1;
+ } else { /* x > y, x += ulp */
+ hx += 1;
+ }
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "+m"(x));
+ return x;
+ }
+ if(hy<0x00800000) { /* underflow */
+ float u = x*x;
+ math_force_eval (u); /* raise underflow flag */
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+long_double_symbol (libm, __nexttowardf, nexttowardf);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
new file mode 100644
index 0000000..ca504a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
@@ -0,0 +1,111 @@
+/* Compute remainder and a congruent to the quotient.
+ Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.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,qs;
+ int cquo;
+
+ 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 & 0x7fffffffffffffff)) == 0)
+ return (x * y) / (x * y); /* y = 0 */
+ if ((hx >= 0x7ff0000000000000LL) /* x not finite */
+ || ((hy >= 0x7ff0000000000000LL) /* y is NaN */
+ && (((hy - 0x7ff0000000000000LL) | ly) != 0)))
+ return (x * y) / (x * y);
+
+ if (hy <= 0x7fbfffffffffffffLL)
+ 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 < 0x0020000000000000LL)
+ {
+ 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;
+}
+long_double_symbol (libm, __remquol, remquol);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
new file mode 100644
index 0000000..1f4e33f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
@@ -0,0 +1,119 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__rintl (long double x)
+#else
+long double
+__rintl (x)
+ long double x;
+#endif
+{
+ double xh, xl, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Return Inf, Nan, +/-0 unchanged. */
+ if (__builtin_expect (xh != 0.0
+ && __builtin_isless (__builtin_fabs (xh),
+ __builtin_inf ()), 1))
+ {
+ double orig_xh;
+ int save_round = fegetround ();
+
+ /* Long double arithmetic, including the canonicalisation below,
+ only works in round-to-nearest mode. */
+ fesetround (FE_TONEAREST);
+
+ /* Convert the high double to integer. */
+ orig_xh = xh;
+ hi = ldbl_nearbyint (xh);
+
+ /* Subtract integral high part from the value. If the low double
+ happens to be exactly 0.5 or -0.5, you might think that this
+ subtraction could result in an incorrect conversion. For
+ instance, subtracting an odd number would cause this function
+ to round in the wrong direction. However, if we have a
+ canonical long double with the low double 0.5 or -0.5, then the
+ high double must be even. */
+ xh -= hi;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Now convert the low double, adjusted for any remainder from the
+ high double. */
+ lo = ldbl_nearbyint (xh);
+
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ switch (save_round)
+ {
+ case FE_TONEAREST:
+ if (xl > 0.0 && xh == 0.5)
+ lo += 1.0;
+ else if (xl < 0.0 && -xh == 0.5)
+ lo -= 1.0;
+ break;
+
+ case FE_TOWARDZERO:
+ if (orig_xh < 0.0)
+ goto do_up;
+ /* Fall thru */
+
+ case FE_DOWNWARD:
+ if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+ lo -= 1.0;
+ break;
+
+ case FE_UPWARD:
+ do_up:
+ if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+ lo += 1.0;
+ break;
+ }
+
+ /* Ensure the final value is canonical. In certain cases,
+ rounding causes hi,lo calculated so far to be non-canonical. */
+ xh = hi;
+ xl = lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Ensure we return -0 rather than +0 when appropriate. */
+ if (orig_xh < 0.0)
+ xh = -__builtin_fabs (xh);
+
+ fesetround (save_round);
+ }
+
+ return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __rintl, rintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_roundl.c b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
new file mode 100644
index 0000000..0880e6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
@@ -0,0 +1,98 @@
+/* Round to int long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__roundl (long double x)
+#else
+long double
+__roundl (x)
+ long double x;
+#endif
+{
+ double xh, xl, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Return Inf, Nan, +/-0 unchanged. */
+ if (__builtin_expect (xh != 0.0
+ && __builtin_isless (__builtin_fabs (xh),
+ __builtin_inf ()), 1))
+ {
+ double orig_xh;
+ int save_round = fegetround ();
+
+ /* Long double arithmetic, including the canonicalisation below,
+ only works in round-to-nearest mode. */
+ fesetround (FE_TONEAREST);
+
+ /* Convert the high double to integer. */
+ orig_xh = xh;
+ hi = ldbl_nearbyint (xh);
+
+ /* Subtract integral high part from the value. */
+ xh -= hi;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Now convert the low double, adjusted for any remainder from the
+ high double. */
+ lo = ldbl_nearbyint (xh);
+
+ /* Adjust the result when the remainder is exactly 0.5. nearbyint
+ rounds values halfway between integers to the nearest even
+ integer. roundl must round away from zero.
+ Also correct cases where nearbyint returns an incorrect value
+ for LO. */
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+ if (xh == 0.5)
+ {
+ if (xl > 0.0 || (xl == 0.0 && orig_xh > 0.0))
+ lo += 1.0;
+ }
+ else if (-xh == 0.5)
+ {
+ if (xl < 0.0 || (xl == 0.0 && orig_xh < 0.0))
+ lo -= 1.0;
+ }
+
+ /* Ensure the final value is canonical. In certain cases,
+ rounding causes hi,lo calculated so far to be non-canonical. */
+ xh = hi;
+ xl = lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ fesetround (save_round);
+ }
+
+ return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __roundl, roundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
new file mode 100644
index 0000000..3a1ba07
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
@@ -0,0 +1,105 @@
+/* s_scalblnl.c -- long double version of s_scalbln.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_scalbln.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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */
+huge = 1.0E+300L,
+tiny = 1.0E-300L;
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+#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,l,hx,lx;
+ union { int64_t i; double d; } u;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ k = (hx>>52)&0x7ff; /* extract exponent */
+ l = (lx>>52)&0x7ff;
+ if (k==0) { /* 0 or subnormal x */
+ if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
+ u.i = hx;
+ u.d *= two54;
+ hx = u.i;
+ k = ((hx>>52)&0x7ff) - 54;
+ }
+ else if (k==0x7ff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0x7fe)
+ return huge*__copysignl(huge,x); /* overflow */
+ if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */
+ if (k > 0) { /* normal result */
+ hx = (hx&0x800fffffffffffffULL)|(k<<52);
+ if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (l == 0) { /* low part subnormal */
+ u.i = lx;
+ u.d *= two54;
+ lx = u.i;
+ l = ((lx>>52)&0x7ff) - 54;
+ }
+ l = l + n;
+ if (l > 0)
+ lx = (lx&0x800fffffffffffffULL)|(l<<52);
+ else if (l <= -54)
+ lx = (lx&0x8000000000000000ULL);
+ else {
+ l += 54;
+ u.i = (lx&0x800fffffffffffffULL)|(l<<52);
+ u.d *= twom54;
+ lx = u.i;
+ }
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (k <= -54)
+ return tiny*__copysignl(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ lx &= 0x8000000000000000ULL;
+ SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
+ return x*twolm54;
+}
+long_double_symbol (libm, __scalblnl, scalblnl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
new file mode 100644
index 0000000..50bd8cb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
@@ -0,0 +1,109 @@
+/* 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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */
+huge = 1.0E+300L,
+tiny = 1.0E-300L;
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+#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,l,hx,lx;
+ union { int64_t i; double d; } u;
+ GET_LDOUBLE_WORDS64(hx,lx,x);
+ k = (hx>>52)&0x7ff; /* extract exponent */
+ l = (lx>>52)&0x7ff;
+ if (k==0) { /* 0 or subnormal x */
+ if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
+ u.i = hx;
+ u.d *= two54;
+ hx = u.i;
+ k = ((hx>>52)&0x7ff) - 54;
+ }
+ else if (k==0x7ff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0x7fe)
+ return huge*__copysignl(huge,x); /* overflow */
+ if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */
+ if (k > 0) { /* normal result */
+ hx = (hx&0x800fffffffffffffULL)|(k<<52);
+ if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (l == 0) { /* low part subnormal */
+ u.i = lx;
+ u.d *= two54;
+ lx = u.i;
+ l = ((lx>>52)&0x7ff) - 54;
+ }
+ l = l + n;
+ if (l > 0)
+ lx = (lx&0x800fffffffffffffULL)|(l<<52);
+ else if (l <= -54)
+ lx = (lx&0x8000000000000000ULL);
+ else {
+ l += 54;
+ u.i = (lx&0x800fffffffffffffULL)|(l<<52);
+ u.d *= twom54;
+ lx = u.i;
+ }
+ SET_LDOUBLE_WORDS64(x,hx,lx);
+ return x;
+ }
+ if (k <= -54)
+ return tiny*__copysignl(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ lx &= 0x8000000000000000ULL;
+ SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
+ return x*twolm54;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalbnl, scalbnl);
+#else
+long_double_symbol (libc, __scalbnl, scalbnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
new file mode 100644
index 0000000..b428546
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
@@ -0,0 +1,37 @@
+/* Return nonzero value if number is negative.
+ Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___signbitl (long double x)
+{
+ int64_t e;
+
+ GET_LDOUBLE_MSW64 (e, x);
+ return e < 0;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, ___signbitl, __signbitl);
+#else
+long_double_symbol (libc, ___signbitl, __signbitl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
new file mode 100644
index 0000000..1d3d7a4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
@@ -0,0 +1,72 @@
+/* Compute sine and cosine of argument.
+ Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+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 <= 0x3fe921fb54442d10LL)
+ __kernel_sincosl (x, 0.0L, sinx, cosx, 0);
+ else if (ix >= 0x7ff0000000000000LL)
+ {
+ /* 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:
+ __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
+ break;
+ case 1:
+ __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
+ *cosx = -*cosx;
+ break;
+ case 2:
+ __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
+ *sinx = -*sinx;
+ *cosx = -*cosx;
+ break;
+ default:
+ __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
+ *sinx = -*sinx;
+ break;
+ }
+ }
+}
+long_double_symbol (libm, __sincosl, sincosl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sinl.c b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
new file mode 100644
index 0000000..8cc592c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
@@ -0,0 +1,84 @@
+/* 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"
+#include <math_ldbl_opt.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 <= 0x3fe921fb54442d10LL)
+ return __kernel_sinl(x,z,0);
+
+ /* sin(Inf or NaN) is NaN */
+ else if (ix>=0x7ff0000000000000LL) 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]);
+ }
+ }
+}
+long_double_symbol (libm, __sinl, sinl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
new file mode 100644
index 0000000..851ca12
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
@@ -0,0 +1,90 @@
+/* @(#)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**-57 : tanh(x) := x*(one+x)
+ * -t
+ * 2**-57 < 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"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
+#else
+static long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
+#endif
+
+#ifdef __STDC__
+ long double __tanhl(long double x)
+#else
+ long double __tanhl(x)
+ long double x;
+#endif
+{
+ long double t,z;
+ int64_t jx,ix,lx;
+
+ /* High word of |x|. */
+ GET_LDOUBLE_WORDS64(jx,lx,x);
+ ix = jx&0x7fffffffffffffffLL;
+
+ /* x is INF or NaN */
+ if(ix>=0x7ff0000000000000LL) {
+ if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */
+ else return one/x-one; /* tanh(NaN) = NaN */
+ }
+
+ /* |x| < 22 */
+ if (ix < 0x4036000000000000LL) { /* |x|<22 */
+ if ((ix | (lx&0x7fffffffffffffffLL)) == 0)
+ return x; /* x == +-0 */
+ if (ix<0x3c60000000000000LL) /* |x|<2**-57 */
+ return x*(one+x); /* tanh(small) = small */
+ if (ix>=0x3ff0000000000000LL) { /* |x|>=1 */
+ t = __expm1l(two*fabsl(x));
+ z = one - two/(t+two);
+ } else {
+ t = __expm1l(-two*fabsl(x));
+ z= -t/(t+two);
+ }
+ /* |x| > 22, return +-1 */
+ } else {
+ z = one - tiny; /* raised inexact flag */
+ }
+ return (jx>=0)? z: -z;
+}
+long_double_symbol (libm, __tanhl, tanhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
new file mode 100644
index 0000000..ea5a7f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
@@ -0,0 +1,78 @@
+/* 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"
+#include <math_ldbl_opt.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 <= 0x3fe921fb54442d10LL) return __kernel_tanl(x,z,1);
+
+ /* tanl(Inf or NaN) is NaN */
+ else if (ix>=0x7ff0000000000000LL) 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 */
+ }
+}
+long_double_symbol (libm, __tanl, tanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_truncl.c b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
new file mode 100644
index 0000000..d7bc47e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
@@ -0,0 +1,102 @@
+/* Truncate (toward zero) long double floating-point values.
+ IBM extended format long double version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+ when it's coded in C. */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__truncl (long double x)
+#else
+long double
+__truncl (x)
+ long double x;
+#endif
+{
+ double xh, xl, hi, lo;
+
+ ldbl_unpack (x, &xh, &xl);
+
+ /* Return Inf, Nan, +/-0 unchanged. */
+ if (__builtin_expect (xh != 0.0
+ && __builtin_isless (__builtin_fabs (xh),
+ __builtin_inf ()), 1))
+ {
+ double orig_xh;
+ int save_round = fegetround ();
+
+ /* Long double arithmetic, including the canonicalisation below,
+ only works in round-to-nearest mode. */
+ fesetround (FE_TONEAREST);
+
+ /* Convert the high double to integer. */
+ orig_xh = xh;
+ hi = ldbl_nearbyint (xh);
+
+ /* Subtract integral high part from the value. */
+ xh -= hi;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Now convert the low double, adjusted for any remainder from the
+ high double. */
+ lo = ldbl_nearbyint (xh);
+
+ /* Adjust the result when the remainder is non-zero. nearbyint
+ rounds values to the nearest integer, and values halfway
+ between integers to the nearest even integer. floorl must
+ round towards -Inf. */
+ xh -= lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ if (orig_xh < 0.0)
+ {
+ if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+ lo += 1.0;
+ }
+ else
+ {
+ if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+ lo -= 1.0;
+ }
+
+ /* Ensure the final value is canonical. In certain cases,
+ rounding causes hi,lo calculated so far to be non-canonical. */
+ xh = hi;
+ xl = lo;
+ ldbl_canonicalize (&xh, &xl);
+
+ /* Ensure we return -0 rather than +0 when appropriate. */
+ if (orig_xh < 0.0)
+ xh = -__builtin_fabs (xh);
+
+ fesetround (save_round);
+ }
+
+ return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __truncl, truncl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
new file mode 100644
index 0000000..d558b00
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <xlocale.h>
+
+/* 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_WIDE_CHAR
+extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
+# define STRTOF __new_wcstold_l
+# define __STRTOF ____new_wcstold_l
+# define ____STRTOF_INTERNAL ____wcstold_l_internal
+#else
+extern long double ____new_strtold_l (const char *, char **, __locale_t);
+# define STRTOF __new_strtold_l
+# define __STRTOF ____new_strtold_l
+# define ____STRTOF_INTERNAL ____strtold_l_internal
+#endif
+#define MPN2FLOAT __mpn_construct_long_double
+#define FLOAT_HUGE_VAL HUGE_VALL
+# define SET_MANTISSA(flt, mant) \
+ do { union ibm_extended_long_double u; \
+ u.d = (flt); \
+ if ((mant & 0xfffffffffffffULL) == 0) \
+ mant = 0x8000000000000ULL; \
+ u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff; \
+ u.ieee.mantissa1 = (mant) & 0xffffffff; \
+ (flt) = u.d; \
+ } while (0)
+
+#include <strtod_l.c>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold_l, wcstold_l);
+long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
+# else
+long_double_symbol (libc, __new_strtold_l, strtold_l);
+long_double_symbol (libc, ____new_strtold_l, __strtold_l);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c
new file mode 100644
index 0000000..4c92a0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c
@@ -0,0 +1,694 @@
+/* Quad-precision floating point sine and cosine tables.
+ Copyright (C) 1999,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* For 0.1484375 + n/128.0, n=0..82 this table contains
+ first 113 bits of cosine, then at least 113 additional
+ bits and the same for sine.
+ 0.1484375+82.0/128.0 is the smallest number among above defined numbers
+ larger than pi/4.
+ Computed using gmp.
+ */
+
+const long double __sincosl_table[] = {
+
+/* x = 1.48437500000000000000000000000000000e-01L 3ffc3000000000000000000000000000 */
+/* cos(x) = 0.fd2f5320e1b790209b4dda2f98 f79caaa7b873aff1014b0fbc52 43766d03cb006bc837c4358 */
+ 0x0.fd2f5320e1b790209b4dda2f98p0L,
+ 0x0.f79caaa7b873aff1014b0fbc52p-104L,
+/* sin(x) = 0.25dc50bc95711d0d9787d108fd 438cf5959ee0bfb7a1e36e8b1a 112968f356657420e9cc9ea */
+ 0x0.25dc50bc95711d0d9787d108fdp0L,
+ 0x0.438cf5959ee0bfb7a1e36e8b1ap-104L,
+
+/* x = 1.56250000000000000000000000000000000e-01 3ffc4000000000000000000000000000 */
+/* cos(x) = 0.fce1a053e621438b6d60c76e8c 45bf0a9dc71aa16f922acc10e9 5144ec796a249813c9cb649 */
+ 0x0.fce1a053e621438b6d60c76e8cp0L,
+ 0x0.45bf0a9dc71aa16f922acc10e9p-104L,
+/* sin(x) = 0.27d66258bacd96a3eb335b365c 87d59438c5142bb56a489e9b8d b9d36234ffdebb6bdc22d8e */
+ 0x0.27d66258bacd96a3eb335b365cp0L,
+ 0x0.87d59438c5142bb56a489e9b8dp-104L,
+
+/* x = 1.64062500000000000000000000000000000e-01 3ffc5000000000000000000000000000 */
+/* cos(x) = 0.fc8ffa01ba6807417e05962b0d 9fdf1fddb0cc4c07d22e19e080 19bffa50a6c7acdb40307a3 */
+ 0x0.fc8ffa01ba6807417e05962b0dp0L,
+ 0x0.9fdf1fddb0cc4c07d22e19e080p-104L,
+/* sin(x) = 0.29cfd49b8be4f665276cab01cb f0426934906c3dd105473b226e 410b1450f62e53ff7c6cce1 */
+ 0x0.29cfd49b8be4f665276cab01cbp0L,
+ 0x0.f0426934906c3dd105473b226ep-104L,
+
+/* x = 1.71875000000000000000000000000000000e-01 3ffc6000000000000000000000000000 */
+/* cos(x) = 0.fc3a6170f767ac735d63d99a9d 439e1db5e59d3ef153a4265d58 55850ed82b536bf361b80e3 */
+ 0x0.fc3a6170f767ac735d63d99a9dp0L,
+ 0x0.439e1db5e59d3ef153a4265d58p-104L,
+/* sin(x) = 0.2bc89f9f424de5485de7ce03b2 514952b9faf5648c3244d4736f eb95dbb9da49f3b58a9253b */
+ 0x0.2bc89f9f424de5485de7ce03b2p0L,
+ 0x0.514952b9faf5648c3244d4736fp-104L,
+
+/* x = 1.79687500000000000000000000000000000e-01 3ffc7000000000000000000000000000 */
+/* cos(x) = 0.fbe0d7f7fef11e70aa43b8abf4 f6a457cea20c8f3f676b47781f 9821bbe9ce04b3c7b981c0b */
+ 0x0.fbe0d7f7fef11e70aa43b8abf4p0L,
+ 0x0.f6a457cea20c8f3f676b47781fp-104L,
+/* sin(x) = 0.2dc0bb80b49a97ffb34e8dd1f8 db9df7af47ed2dcf58b12c8e78 27e048cae929da02c04ecac */
+ 0x0.2dc0bb80b49a97ffb34e8dd1f8p0L,
+ 0x0.db9df7af47ed2dcf58b12c8e78p-104L,
+
+/* x = 1.87500000000000000000000000000000000e-01 3ffc8000000000000000000000000000 */
+/* cos(x) = 0.fb835efcf670dd2ce6fe792469 7eea13ea358867e9cdb3899b78 3f4f9f43aa5626e8b67b3bc */
+ 0x0.fb835efcf670dd2ce6fe792469p0L,
+ 0x0.7eea13ea358867e9cdb3899b78p-104L,
+/* sin(x) = 0.2fb8205f75e56a2b56a1c4792f 856258769af396e0189ef72c05 e4df59a6b00e4b44a6ea515 */
+ 0x0.2fb8205f75e56a2b56a1c4792fp0L,
+ 0x0.856258769af396e0189ef72c05p-104L,
+
+/* x = 1.95312500000000000000000000000000000e-01 3ffc9000000000000000000000000000 */
+/* cos(x) = 0.fb21f7f5c156696b00ac1fe28a c5fd76674a92b4df80d9c8a46c 684399005deccc41386257c */
+ 0x0.fb21f7f5c156696b00ac1fe28ap0L,
+ 0x0.c5fd76674a92b4df80d9c8a46cp-104L,
+/* sin(x) = 0.31aec65df552876f82ece9a235 6713246eba6799983d7011b0b3 698d6e1da919c15d57c30c1 */
+ 0x0.31aec65df552876f82ece9a235p0L,
+ 0x0.6713246eba6799983d7011b0b3p-104L,
+
+/* x = 2.03125000000000000000000000000000000e-01 3ffca000000000000000000000000000 */
+/* cos(x) = 0.fabca467fb3cb8f1d069f01d8e a33ade5bfd68296ecd1cc9f7b7 609bbcf3676e726c3301334 */
+ 0x0.fabca467fb3cb8f1d069f01d8ep0L,
+ 0x0.a33ade5bfd68296ecd1cc9f7b7p-104L,
+/* sin(x) = 0.33a4a5a19d86246710f602c44d f4fa513f4639ce938477aeeabb 82e8e0a7ed583a188879fd4 */
+ 0x0.33a4a5a19d86246710f602c44dp0L,
+ 0x0.f4fa513f4639ce938477aeeabbp-104L,
+
+/* x = 2.10937500000000000000000000000000000e-01 3ffcb000000000000000000000000000 */
+/* cos(x) = 0.fa5365e8f1d3ca27be1db5d76a e64d983d7470a4ab0f4ccf65a2 b8c67a380df949953a09bc1 */
+ 0x0.fa5365e8f1d3ca27be1db5d76ap0L,
+ 0x0.e64d983d7470a4ab0f4ccf65a2p-104L,
+/* sin(x) = 0.3599b652f40ec999df12a0a4c8 561de159c98d4e54555de518b9 7f48886f715d8df5f4f093e */
+ 0x0.3599b652f40ec999df12a0a4c8p0L,
+ 0x0.561de159c98d4e54555de518b9p-104L,
+
+/* x = 2.18750000000000000000000000000000000e-01 3ffcc000000000000000000000000000 */
+/* cos(x) = 0.f9e63e1d9e8b6f6f2e296bae5b 5ed9c11fd7fa2fe11e09fc7bde 901abed24b6365e72f7db4e */
+ 0x0.f9e63e1d9e8b6f6f2e296bae5bp0L,
+ 0x0.5ed9c11fd7fa2fe11e09fc7bdep-104L,
+/* sin(x) = 0.378df09db8c332ce0d2b53d865 582e4526ea336c768f68c32b49 6c6d11c1cd241bb9f1da523 */
+ 0x0.378df09db8c332ce0d2b53d865p0L,
+ 0x0.582e4526ea336c768f68c32b49p-104L,
+
+/* x = 2.26562500000000000000000000000000000e-01 3ffcd000000000000000000000000000 */
+/* cos(x) = 0.f9752eba9fff6b98842beadab0 54a932fb0f8d5b875ae63d6b22 88d09b148921aeb6e52f61b */
+ 0x0.f9752eba9fff6b98842beadab0p0L,
+ 0x0.54a932fb0f8d5b875ae63d6b22p-104L,
+/* sin(x) = 0.39814cb10513453cb97b21bc1c a6a337b150c21a675ab85503bc 09a436a10ab1473934e20c8 */
+ 0x0.39814cb10513453cb97b21bc1cp0L,
+ 0x0.a6a337b150c21a675ab85503bcp-104L,
+
+/* x = 2.34375000000000000000000000000000000e-01 3ffce000000000000000000000000000 */
+/* cos(x) = 0.f90039843324f9b940416c1984 b6cbed1fc733d97354d4265788 a86150493ce657cae032674 */
+ 0x0.f90039843324f9b940416c1984p0L,
+ 0x0.b6cbed1fc733d97354d4265788p-104L,
+/* sin(x) = 0.3b73c2bf6b4b9f668ef9499c81 f0d965087f1753fa64b086e58c b8470515c18c1412f8c2e02 */
+ 0x0.3b73c2bf6b4b9f668ef9499c81p0L,
+ 0x0.f0d965087f1753fa64b086e58cp-104L,
+
+/* x = 2.42187500000000000000000000000000000e-01 3ffcf000000000000000000000000000 */
+/* cos(x) = 0.f887604e2c39dbb20e4ec58250 59a789ffc95b275ad9954078ba 8a28d3fcfe9cc2c1d49697b */
+ 0x0.f887604e2c39dbb20e4ec58250p0L,
+ 0x0.59a789ffc95b275ad9954078bap-104L,
+/* sin(x) = 0.3d654aff15cb457a0fca854698 aba33039a8a40626609204472d 9d40309b626eccc6dff0ffa */
+ 0x0.3d654aff15cb457a0fca854698p0L,
+ 0x0.aba33039a8a40626609204472dp-104L,
+
+/* x = 2.50000000000000000000000000000000000e-01 3ffd0000000000000000000000000000 */
+/* cos(x) = 0.f80aa4fbef750ba783d33cb95f 94f8a41426dbe79edc4a023ef9 ec13c944551c0795b84fee1 */
+ 0x0.f80aa4fbef750ba783d33cb95fp0L,
+ 0x0.94f8a41426dbe79edc4a023ef9p-104L,
+/* sin(x) = 0.3f55dda9e62aed7513bd7b8e6a 3d1635dd5676648d7db525898d 7086af9330f03c7f285442a */
+ 0x0.3f55dda9e62aed7513bd7b8e6ap0L,
+ 0x0.3d1635dd5676648d7db525898dp-104L,
+
+/* x = 2.57812500000000000000000000000000000e-01 3ffd0800000000000000000000000000 */
+/* cos(x) = 0.f78a098069792daabc9ee42591 b7c5a68cb1ab822aeb446b3311 b4ba5371b8970e2c1547ad7 */
+ 0x0.f78a098069792daabc9ee42591p0L,
+ 0x0.b7c5a68cb1ab822aeb446b3311p-104L,
+/* sin(x) = 0.414572fd94556e6473d6202713 88dd47c0ba050cdb5270112e3e 370e8c4705ae006426fb5d5 */
+ 0x0.414572fd94556e6473d6202713p0L,
+ 0x0.88dd47c0ba050cdb5270112e3ep-104L,
+
+/* x = 2.65625000000000000000000000000000000e-01 3ffd1000000000000000000000000000 */
+/* cos(x) = 0.f7058fde0788dfc805b8fe8878 9e4f4253e3c50afe8b22f41159 620ab5940ff7df9557c0d1f */
+ 0x0.f7058fde0788dfc805b8fe8878p0L,
+ 0x0.9e4f4253e3c50afe8b22f41159p-104L,
+/* sin(x) = 0.4334033bcd90d6604f5f36c1d4 b84451a87150438275b77470b5 0e5b968fa7962b5ffb379b7 */
+ 0x0.4334033bcd90d6604f5f36c1d4p0L,
+ 0x0.b84451a87150438275b77470b5p-104L,
+
+/* x = 2.73437500000000000000000000000000000e-01 3ffd1800000000000000000000000000 */
+/* cos(x) = 0.f67d3a26af7d07aa4bd6d42af8 c0067fefb96d5b46c031eff536 27f215ea3242edc3f2e13eb */
+ 0x0.f67d3a26af7d07aa4bd6d42af8p0L,
+ 0x0.c0067fefb96d5b46c031eff536p-104L,
+/* sin(x) = 0.452186aa5377ab20bbf2524f52 e3a06a969f47166ab88cf88c11 1ad12c55941021ef3317a1a */
+ 0x0.452186aa5377ab20bbf2524f52p0L,
+ 0x0.e3a06a969f47166ab88cf88c11p-104L,
+
+/* x = 2.81250000000000000000000000000000000e-01 3ffd2000000000000000000000000000 */
+/* cos(x) = 0.f5f10a7bb77d3dfa0c1da8b578 42783280d01ce3c0f82bae3b9d 623c168d2e7c29977994451 */
+ 0x0.f5f10a7bb77d3dfa0c1da8b578p0L,
+ 0x0.42783280d01ce3c0f82bae3b9dp-104L,
+/* sin(x) = 0.470df5931ae1d946076fe0dcff 47fe31bb2ede618ebc607821f8 462b639e1f4298b5ae87fd3 */
+ 0x0.470df5931ae1d946076fe0dcffp0L,
+ 0x0.47fe31bb2ede618ebc607821f8p-104L,
+
+/* x = 2.89062500000000000000000000000000000e-01 3ffd2800000000000000000000000000 */
+/* cos(x) = 0.f561030ddd7a78960ea9f4a32c 6521554995667f5547bafee9ec 48b3155cdb0f7fd00509713 */
+ 0x0.f561030ddd7a78960ea9f4a32cp0L,
+ 0x0.6521554995667f5547bafee9ecp-104L,
+/* sin(x) = 0.48f948446abcd6b0f7fccb100e 7a1b26eccad880b0d24b59948c 7cdd49514d44b933e6985c2 */
+ 0x0.48f948446abcd6b0f7fccb100ep0L,
+ 0x0.7a1b26eccad880b0d24b59948cp-104L,
+
+/* x = 2.96875000000000000000000000000000000e-01 3ffd3000000000000000000000000000 */
+/* cos(x) = 0.f4cd261d3e6c15bb369c875863 0d2ac00b7ace2a51c0631bfeb3 9ed158ba924cc91e259c195 */
+ 0x0.f4cd261d3e6c15bb369c875863p0L,
+ 0x0.0d2ac00b7ace2a51c0631bfeb3p-104L,
+/* sin(x) = 0.4ae37710fad27c8aa9c4cf96c0 3519b9ce07dc08a1471775499f 05c29f86190aaebaeb9716e */
+ 0x0.4ae37710fad27c8aa9c4cf96c0p0L,
+ 0x0.3519b9ce07dc08a1471775499fp-104L,
+
+/* x = 3.04687500000000000000000000000000000e-01 3ffd3800000000000000000000000000 */
+/* cos(x) = 0.f43575f94d4f6b272f5fb76b14 d2a64ab52df1ee8ddf7c651034 e5b2889305a9ea9015d758a */
+ 0x0.f43575f94d4f6b272f5fb76b14p0L,
+ 0x0.d2a64ab52df1ee8ddf7c651034p-104L,
+/* sin(x) = 0.4ccc7a50127e1de0cb6b40c302 c651f7bded4f9e7702b0471ae0 288d091a37391950907202f */
+ 0x0.4ccc7a50127e1de0cb6b40c302p0L,
+ 0x0.c651f7bded4f9e7702b0471ae0p-104L,
+
+/* x = 3.12500000000000000000000000000000000e-01 3ffd4000000000000000000000000000 */
+/* cos(x) = 0.f399f500c9e9fd37ae9957263d ab8877102beb569f101ee44953 50868e5847d181d50d3cca2 */
+ 0x0.f399f500c9e9fd37ae9957263dp0L,
+ 0x0.ab8877102beb569f101ee44953p-104L,
+/* sin(x) = 0.4eb44a5da74f600207aaa090f0 734e288603ffadb3eb2542a469 77b105f8547128036dcf7f0 */
+ 0x0.4eb44a5da74f600207aaa090f0p0L,
+ 0x0.734e288603ffadb3eb2542a469p-104L,
+
+/* x = 3.20312500000000000000000000000000000e-01 3ffd4800000000000000000000000000 */
+/* cos(x) = 0.f2faa5a1b74e82fd61fa05f917 7380e8e69b7b15a945e8e5ae11 24bf3d12b0617e03af4fab5 */
+ 0x0.f2faa5a1b74e82fd61fa05f917p0L,
+ 0x0.7380e8e69b7b15a945e8e5ae11p-104L,
+/* sin(x) = 0.509adf9a7b9a5a0f638a8fa3a6 0a199418859f18b37169a644fd b986c21ecb00133853bc35b */
+ 0x0.509adf9a7b9a5a0f638a8fa3a6p0L,
+ 0x0.0a199418859f18b37169a644fdp-104L,
+
+/* x = 3.28125000000000000000000000000000000e-01 3ffd5000000000000000000000000000 */
+/* cos(x) = 0.f2578a595224dd2e6bfa2eb2f9 9cc674f5ea6f479eae2eb58018 6897ae3f893df1113ca06b8 */
+ 0x0.f2578a595224dd2e6bfa2eb2f9p0L,
+ 0x0.9cc674f5ea6f479eae2eb58018p-104L,
+/* sin(x) = 0.5280326c3cf481823ba6bb08ea c82c2093f2bce3c4eb4ee3dec7 df41c92c8a4226098616075 */
+ 0x0.5280326c3cf481823ba6bb08eap0L,
+ 0x0.c82c2093f2bce3c4eb4ee3dec7p-104L,
+
+/* x = 3.35937500000000000000000000000000000e-01 3ffd5800000000000000000000000000 */
+/* cos(x) = 0.f1b0a5b406b526d886c55feadc 8d0dcc8eb9ae2ac707051771b4 8e05b25b000009660bdb3e3 */
+ 0x0.f1b0a5b406b526d886c55feadcp0L,
+ 0x0.8d0dcc8eb9ae2ac707051771b4p-104L,
+/* sin(x) = 0.54643b3da29de9b357155eef0f 332fb3e66c83bf4dddd9491c5e b8e103ccd92d6175220ed51 */
+ 0x0.54643b3da29de9b357155eef0fp0L,
+ 0x0.332fb3e66c83bf4dddd9491c5ep-104L,
+
+/* x = 3.43750000000000000000000000000000000e-01 3ffd6000000000000000000000000000 */
+/* cos(x) = 0.f105fa4d66b607a67d44e04272 5204435142ac8ad54dfb0907a4 f6b56b06d98ee60f19e557a */
+ 0x0.f105fa4d66b607a67d44e04272p0L,
+ 0x0.5204435142ac8ad54dfb0907a4p-104L,
+/* sin(x) = 0.5646f27e8bd65cbe3a5d61ff06 572290ee826d9674a00246b05a e26753cdfc90d9ce81a7d02 */
+ 0x0.5646f27e8bd65cbe3a5d61ff06p0L,
+ 0x0.572290ee826d9674a00246b05ap-104L,
+
+/* x = 3.51562500000000000000000000000000000e-01 3ffd6800000000000000000000000000 */
+/* cos(x) = 0.f0578ad01ede707fa39c09dc6b 984afef74f3dc8d0efb0f4c5a6 b13771145b3e0446fe33887 */
+ 0x0.f0578ad01ede707fa39c09dc6bp0L,
+ 0x0.984afef74f3dc8d0efb0f4c5a6p-104L,
+/* sin(x) = 0.582850a41e1dd46c7f602ea244 cdbbbfcdfa8f3189be794dda42 7ce090b5f85164f1f80ac13 */
+ 0x0.582850a41e1dd46c7f602ea244p0L,
+ 0x0.cdbbbfcdfa8f3189be794dda42p-104L,
+
+/* x = 3.59375000000000000000000000000000000e-01 3ffd7000000000000000000000000000 */
+/* cos(x) = 0.efa559f5ec3aec3a4eb0331927 8a2d41fcf9189462261125fe61 47b078f1daa0b06750a1654 */
+ 0x0.efa559f5ec3aec3a4eb0331927p0L,
+ 0x0.8a2d41fcf9189462261125fe61p-104L,
+/* sin(x) = 0.5a084e28e35fda2776dfdbbb55 31d74ced2b5d17c0b1afc46475 29d50c295e36d8ceec126c1 */
+ 0x0.5a084e28e35fda2776dfdbbb55p0L,
+ 0x0.31d74ced2b5d17c0b1afc46475p-104L,
+
+/* x = 3.67187500000000000000000000000000000e-01 3ffd7800000000000000000000000000 */
+/* cos(x) = 0.eeef6a879146af0bf9b95ea2ea 0ac0d3e2e4d7e15d93f48cbd41 bf8e4fded40bef69e19eafa */
+ 0x0.eeef6a879146af0bf9b95ea2eap0L,
+ 0x0.0ac0d3e2e4d7e15d93f48cbd41p-104L,
+/* sin(x) = 0.5be6e38ce8095542bc14ee9da0 d36483e6734bcab2e07624188a f5653f114eeb46738fa899d */
+ 0x0.5be6e38ce8095542bc14ee9da0p0L,
+ 0x0.d36483e6734bcab2e07624188ap-104L,
+
+/* x = 3.75000000000000000000000000000000000e-01 3ffd8000000000000000000000000000 */
+/* cos(x) = 0.ee35bf5ccac89052cd91ddb734 d3a47e262e3b609db604e21705 3803be0091e76daf28a89b7 */
+ 0x0.ee35bf5ccac89052cd91ddb734p0L,
+ 0x0.d3a47e262e3b609db604e21705p-104L,
+/* sin(x) = 0.5dc40955d9084f48a94675a249 8de5d851320ff5528a6afb3f2e 24de240fce6cbed1ba0ccd6 */
+ 0x0.5dc40955d9084f48a94675a249p0L,
+ 0x0.8de5d851320ff5528a6afb3f2ep-104L,
+
+/* x = 3.82812500000000000000000000000000000e-01 3ffd8800000000000000000000000000 */
+/* cos(x) = 0.ed785b5c44741b4493c56bcb9d 338a151c6f6b85d8f8aca658b2 8572c162b199680eb9304da */
+ 0x0.ed785b5c44741b4493c56bcb9dp0L,
+ 0x0.338a151c6f6b85d8f8aca658b2p-104L,
+/* sin(x) = 0.5f9fb80f21b53649c432540a50 e22c53057ff42ae0fdf1307760 dc0093f99c8efeb2fbd7073 */
+ 0x0.5f9fb80f21b53649c432540a50p0L,
+ 0x0.e22c53057ff42ae0fdf1307760p-104L,
+
+/* x = 3.90625000000000000000000000000000000e-01 3ffd9000000000000000000000000000 */
+/* cos(x) = 0.ecb7417b8d4ee3fec37aba4073 aa48f1f14666006fb431d96713 03c8100d10190ec8179c41d */
+ 0x0.ecb7417b8d4ee3fec37aba4073p0L,
+ 0x0.aa48f1f14666006fb431d96713p-104L,
+/* sin(x) = 0.6179e84a09a5258a40e9b5face 03e525f8b5753cd0105d93fe62 98010c3458e84d75fe420e9 */
+ 0x0.6179e84a09a5258a40e9b5facep0L,
+ 0x0.03e525f8b5753cd0105d93fe62p-104L,
+
+/* x = 3.98437500000000000000000000000000000e-01 3ffd9800000000000000000000000000 */
+/* cos(x) = 0.ebf274bf0bda4f62447e56a093 626798d3013b5942b1abfd155a acc9dc5c6d0806a20d6b9c1 */
+ 0x0.ebf274bf0bda4f62447e56a093p0L,
+ 0x0.626798d3013b5942b1abfd155ap-104L,
+/* sin(x) = 0.6352929dd264bd44a02ea76632 5d8aa8bd9695fc8def3caefba5 b94c9a3c873f7b2d3776ead */
+ 0x0.6352929dd264bd44a02ea76632p0L,
+ 0x0.5d8aa8bd9695fc8def3caefba5p-104L,
+
+/* x = 4.06250000000000000000000000000000000e-01 3ffda000000000000000000000000000 */
+/* cos(x) = 0.eb29f839f201fd13b937968279 16a78f15c85230a4e8ea4b2155 8265a14367e1abb4c30695a */
+ 0x0.eb29f839f201fd13b937968279p0L,
+ 0x0.16a78f15c85230a4e8ea4b2155p-104L,
+/* sin(x) = 0.6529afa7d51b129631ec197c0a 840a11d7dc5368b0a47956feb2 85caa8371c4637ef17ef01b */
+ 0x0.6529afa7d51b129631ec197c0ap0L,
+ 0x0.840a11d7dc5368b0a47956feb2p-104L,
+
+/* x = 4.14062500000000000000000000000000000e-01 3ffda800000000000000000000000000 */
+/* cos(x) = 0.ea5dcf0e30cf03e6976ef0b1ec 26515fba47383855c3b4055a99 b5e86824b2cd1a691fdca7b */
+ 0x0.ea5dcf0e30cf03e6976ef0b1ecp0L,
+ 0x0.26515fba47383855c3b4055a99p-104L,
+/* sin(x) = 0.66ff380ba0144109e39a320b0a 3fa5fd65ea0585bcbf9b1a769a 9b0334576c658139e1a1cbe */
+ 0x0.66ff380ba0144109e39a320b0ap0L,
+ 0x0.3fa5fd65ea0585bcbf9b1a769ap-104L,
+
+/* x = 4.21875000000000000000000000000000000e-01 3ffdb000000000000000000000000000 */
+/* cos(x) = 0.e98dfc6c6be031e60dd3089cbd d18a75b1f6b2c1e97f79225202 f03dbea45b07a5ec4efc062 */
+ 0x0.e98dfc6c6be031e60dd3089cbdp0L,
+ 0x0.d18a75b1f6b2c1e97f79225202p-104L,
+/* sin(x) = 0.68d32473143327973bc712bcc4 ccddc47630d755850c0655243b 205934dc49ffed8eb76adcb */
+ 0x0.68d32473143327973bc712bcc4p0L,
+ 0x0.ccddc47630d755850c0655243bp-104L,
+
+/* x = 4.29687500000000000000000000000000000e-01 3ffdb800000000000000000000000000 */
+/* cos(x) = 0.e8ba8393eca7821aa563d83491 b6101189b3b101c3677f73d7ba d7c10f9ee02b7ab4009739a */
+ 0x0.e8ba8393eca7821aa563d83491p0L,
+ 0x0.b6101189b3b101c3677f73d7bap-104L,
+/* sin(x) = 0.6aa56d8e8249db4eb60a761fe3 f9e559be456b9e13349ca99b0b fb787f22b95db3b70179615 */
+ 0x0.6aa56d8e8249db4eb60a761fe3p0L,
+ 0x0.f9e559be456b9e13349ca99b0bp-104L,
+
+/* x = 4.37500000000000000000000000000000000e-01 3ffdc000000000000000000000000000 */
+/* cos(x) = 0.e7e367d2956cfb16b6aa11e541 9cd0057f5c132a6455bf064297 e6a76fe2b72bb630d6d50ff */
+ 0x0.e7e367d2956cfb16b6aa11e541p0L,
+ 0x0.9cd0057f5c132a6455bf064297p-104L,
+/* sin(x) = 0.6c760c14c8585a51dbd34660ae 6c52ac7036a0b40887a0b63724 f8b4414348c3063a637f457 */
+ 0x0.6c760c14c8585a51dbd34660aep0L,
+ 0x0.6c52ac7036a0b40887a0b63724p-104L,
+
+/* x = 4.45312500000000000000000000000000000e-01 3ffdc800000000000000000000000000 */
+/* cos(x) = 0.e708ac84d4172a3e2737662213 429e14021074d7e702e77d72a8 f1101a7e70410df8273e9aa */
+ 0x0.e708ac84d4172a3e2737662213p0L,
+ 0x0.429e14021074d7e702e77d72a8p-104L,
+/* sin(x) = 0.6e44f8c36eb10a1c752d093c00 f4d47ba446ac4c215d26b03164 42f168459e677d06e7249e3 */
+ 0x0.6e44f8c36eb10a1c752d093c00p0L,
+ 0x0.f4d47ba446ac4c215d26b03164p-104L,
+
+/* x = 4.53125000000000000000000000000000000e-01 3ffdd000000000000000000000000000 */
+/* cos(x) = 0.e62a551594b970a770b15d41d4 c0e483e47aca550111df6966f9 e7ac3a94ae49e6a71eb031e */
+ 0x0.e62a551594b970a770b15d41d4p0L,
+ 0x0.c0e483e47aca550111df6966f9p-104L,
+/* sin(x) = 0.70122c5ec5028c8cff33abf4fd 340ccc382e038379b09cf04f9a 52692b10b72586060cbb001 */
+ 0x0.70122c5ec5028c8cff33abf4fdp0L,
+ 0x0.340ccc382e038379b09cf04f9ap-104L,
+
+/* x = 4.60937500000000000000000000000000000e-01 3ffdd800000000000000000000000000 */
+/* cos(x) = 0.e54864fe33e8575cabf5bd0e5c f1b1a8bc7c0d5f61702450fa6b 6539735820dd2603ae355d5 */
+ 0x0.e54864fe33e8575cabf5bd0e5cp0L,
+ 0x0.f1b1a8bc7c0d5f61702450fa6bp-104L,
+/* sin(x) = 0.71dd9fb1ff4677853acb970a9f 6729c6e3aac247b1c57cea66c7 7413f1f98e8b9e98e49d851 */
+ 0x0.71dd9fb1ff4677853acb970a9fp0L,
+ 0x0.6729c6e3aac247b1c57cea66c7p-104L,
+
+/* x = 4.68750000000000000000000000000000000e-01 3ffde000000000000000000000000000 */
+/* cos(x) = 0.e462dfc670d421ab3d1a159012 28f146a0547011202bf5ab01f9 14431859aef577966bc4fa4 */
+ 0x0.e462dfc670d421ab3d1a159012p0L,
+ 0x0.28f146a0547011202bf5ab01f9p-104L,
+/* sin(x) = 0.73a74b8f52947b681baf6928eb 3fb021769bf4779bad0e3aa9b1 cdb75ec60aad9fc63ff19d5 */
+ 0x0.73a74b8f52947b681baf6928ebp0L,
+ 0x0.3fb021769bf4779bad0e3aa9b1p-104L,
+
+/* x = 4.76562500000000000000000000000000000e-01 3ffde800000000000000000000000000 */
+/* cos(x) = 0.e379c9045f29d517c4808aa497 c2057b2b3d109e76c0dc302d4d 0698b36e3f0bdbf33d8e952 */
+ 0x0.e379c9045f29d517c4808aa497p0L,
+ 0x0.c2057b2b3d109e76c0dc302d4dp-104L,
+/* sin(x) = 0.756f28d011d98528a44a75fc29 c779bd734ecdfb582fdb74b68a 4c4c4be54cfd0b2d3ad292f */
+ 0x0.756f28d011d98528a44a75fc29p0L,
+ 0x0.c779bd734ecdfb582fdb74b68ap-104L,
+
+/* x = 4.84375000000000000000000000000000000e-01 3ffdf000000000000000000000000000 */
+/* cos(x) = 0.e28d245c58baef72225e232abc 003c4366acd9eb4fc2808c2ab7 fe7676cf512ac7f945ae5fb */
+ 0x0.e28d245c58baef72225e232abcp0L,
+ 0x0.003c4366acd9eb4fc2808c2ab7p-104L,
+/* sin(x) = 0.77353054ca72690d4c6e171fd9 9e6b39fa8e1ede5f052fd29645 34c75340970a3a9cd3c5c32 */
+ 0x0.77353054ca72690d4c6e171fd9p0L,
+ 0x0.9e6b39fa8e1ede5f052fd29645p-104L,
+
+/* x = 4.92187500000000000000000000000000000e-01 3ffdf800000000000000000000000000 */
+/* cos(x) = 0.e19cf580eeec046aa1422fa748 07ecefb2a1911c94e7b5f20a00 f70022d940193691e5bd790 */
+ 0x0.e19cf580eeec046aa1422fa748p0L,
+ 0x0.07ecefb2a1911c94e7b5f20a00p-104L,
+/* sin(x) = 0.78f95b0560a9a3bd6df7bd981d c38c61224d08bc20631ea932e6 05e53b579e9e0767dfcbbcb */
+ 0x0.78f95b0560a9a3bd6df7bd981dp0L,
+ 0x0.c38c61224d08bc20631ea932e6p-104L,
+
+/* x = 5.00000000000000000000000000000000000e-01 3ffe0000000000000000000000000000 */
+/* cos(x) = 0.e0a94032dbea7cedbddd9da2fa fad98556566b3a89f43eabd723 50af3e8b19e801204d8fe2e */
+ 0x0.e0a94032dbea7cedbddd9da2fap0L,
+ 0x0.fad98556566b3a89f43eabd723p-104L,
+/* sin(x) = 0.7abba1d12c17bfa1d92f0d93f6 0ded9992f45b4fcaf13cd58b30 3693d2a0db47db35ae8a3a9 */
+ 0x0.7abba1d12c17bfa1d92f0d93f6p0L,
+ 0x0.0ded9992f45b4fcaf13cd58b30p-104L,
+
+/* x = 5.07812500000000000000000000000000000e-01 3ffe0400000000000000000000000000 */
+/* cos(x) = 0.dfb20840f3a9b36f7ae2c51534 2890b5ec583b8366cc2b55029e 95094d31112383f2553498b */
+ 0x0.dfb20840f3a9b36f7ae2c51534p0L,
+ 0x0.2890b5ec583b8366cc2b55029ep-104L,
+/* sin(x) = 0.7c7bfdaf13e5ed17212f8a7525 bfb113aba6c0741b5362bb8d59 282a850b63716bca0c910f0 */
+ 0x0.7c7bfdaf13e5ed17212f8a7525p0L,
+ 0x0.bfb113aba6c0741b5362bb8d59p-104L,
+
+/* x = 5.15625000000000000000000000000000000e-01 3ffe0800000000000000000000000000 */
+/* cos(x) = 0.deb7518814a7a931bbcc88c109 cd41c50bf8bb48f20ae8c36628 d1d3d57574f7dc58f27d91c */
+ 0x0.deb7518814a7a931bbcc88c109p0L,
+ 0x0.cd41c50bf8bb48f20ae8c36628p-104L,
+/* sin(x) = 0.7e3a679daaf25c676542bcb402 8d0964172961c921823a4ef0c3 a9070d886dbd073f6283699 */
+ 0x0.7e3a679daaf25c676542bcb402p0L,
+ 0x0.8d0964172961c921823a4ef0c3p-104L,
+
+/* x = 5.23437500000000000000000000000000000e-01 3ffe0c00000000000000000000000000 */
+/* cos(x) = 0.ddb91ff318799172bd2452d0a3 889f5169c64a0094bcf0b8aa7d cf0d7640a2eba68955a80be */
+ 0x0.ddb91ff318799172bd2452d0a3p0L,
+ 0x0.889f5169c64a0094bcf0b8aa7dp-104L,
+/* sin(x) = 0.7ff6d8a34bd5e8fa54c97482db 5159df1f24e8038419c0b448b9 eea8939b5d4dfcf40900257 */
+ 0x0.7ff6d8a34bd5e8fa54c97482dbp0L,
+ 0x0.5159df1f24e8038419c0b448b9p-104L,
+
+/* x = 5.31250000000000000000000000000000000e-01 3ffe1000000000000000000000000000 */
+/* cos(x) = 0.dcb7777ac420705168f31e3eb7 80ce9c939ecada62843b54522f 5407eb7f21e556059fcd734 */
+ 0x0.dcb7777ac420705168f31e3eb7p0L,
+ 0x0.80ce9c939ecada62843b54522fp-104L,
+/* sin(x) = 0.81b149ce34caa5a4e650f8d09f d4d6aa74206c32ca951a93074c 83b2d294d25dbb0f7fdfad2 */
+ 0x0.81b149ce34caa5a4e650f8d09fp0L,
+ 0x0.d4d6aa74206c32ca951a93074cp-104L,
+
+/* x = 5.39062500000000000000000000000000000e-01 3ffe1400000000000000000000000000 */
+/* cos(x) = 0.dbb25c25b8260c14f6e7bc98ec 991b70c65335198b0ab628bad2 0cc7b229d4dd62183cfa055 */
+ 0x0.dbb25c25b8260c14f6e7bc98ecp0L,
+ 0x0.991b70c65335198b0ab628bad2p-104L,
+/* sin(x) = 0.8369b434a372da7eb5c8a71fe3 6ce1e0b2b493f6f5cb2e38bcae c2a556b3678c401940d1c3c */
+ 0x0.8369b434a372da7eb5c8a71fe3p0L,
+ 0x0.6ce1e0b2b493f6f5cb2e38bcaep-104L,
+
+/* x = 5.46875000000000000000000000000000000e-01 3ffe1800000000000000000000000000 */
+/* cos(x) = 0.daa9d20860827063fde51c09e8 55e9932e1b17143e7244fd267a 899d41ae1f3bc6a0ec42e27 */
+ 0x0.daa9d20860827063fde51c09e8p0L,
+ 0x0.55e9932e1b17143e7244fd267ap-104L,
+/* sin(x) = 0.852010f4f0800521378bd8dd61 4753d080c2e9e0775ffc609947 b9132f5357404f464f06a58 */
+ 0x0.852010f4f0800521378bd8dd61p0L,
+ 0x0.4753d080c2e9e0775ffc609947p-104L,
+
+/* x = 5.54687500000000000000000000000000000e-01 3ffe1c00000000000000000000000000 */
+/* cos(x) = 0.d99ddd44e44a43d4d4a3a3ed95 204106fd54d78e8c7684545c0d a0b7c2c72be7a89b7c182ad */
+ 0x0.d99ddd44e44a43d4d4a3a3ed95p0L,
+ 0x0.204106fd54d78e8c7684545c0dp-104L,
+/* sin(x) = 0.86d45935ab396cb4e421e822de e54f3562dfcefeaa782184c234 01d231f5ad981a1cc195b18 */
+ 0x0.86d45935ab396cb4e421e822dep0L,
+ 0x0.e54f3562dfcefeaa782184c234p-104L,
+
+/* x = 5.62500000000000000000000000000000000e-01 3ffe2000000000000000000000000000 */
+/* cos(x) = 0.d88e820b1526311dd561efbc0c 1a9a5375eb26f65d246c5744b1 3ca26a7e0fd42556da843c8 */
+ 0x0.d88e820b1526311dd561efbc0cp0L,
+ 0x0.1a9a5375eb26f65d246c5744b1p-104L,
+/* sin(x) = 0.88868625b4e1dbb23133101330 22527200c143a5cb16637cb7da f8ade82459ff2e98511f40f */
+ 0x0.88868625b4e1dbb23133101330p0L,
+ 0x0.22527200c143a5cb16637cb7dap-104L,
+
+/* x = 5.70312500000000000000000000000000000e-01 3ffe2400000000000000000000000000 */
+/* cos(x) = 0.d77bc4985e93a607c9d868b906 bbc6bbe3a04258814acb035846 8b826fc91bd4d814827f65e */
+ 0x0.d77bc4985e93a607c9d868b906p0L,
+ 0x0.bbc6bbe3a04258814acb035846p-104L,
+/* sin(x) = 0.8a3690fc5bfc11bf9535e2739a 8512f448a41251514bbed7fc18 d530f9b4650fcbb2861b0aa */
+ 0x0.8a3690fc5bfc11bf9535e2739ap0L,
+ 0x0.8512f448a41251514bbed7fc18p-104L,
+
+/* x = 5.78125000000000000000000000000000000e-01 3ffe2800000000000000000000000000 */
+/* cos(x) = 0.d665a937b4ef2b1f6d51bad6d9 88a4419c1d7051faf31a9efa15 1d7631117efac03713f950a */
+ 0x0.d665a937b4ef2b1f6d51bad6d9p0L,
+ 0x0.88a4419c1d7051faf31a9efa15p-104L,
+/* sin(x) = 0.8be472f9776d809af2b8817124 3d63d66dfceeeb739cc894e023 fbc165a0e3f26ff729c5d57 */
+ 0x0.8be472f9776d809af2b8817124p0L,
+ 0x0.3d63d66dfceeeb739cc894e023p-104L,
+
+/* x = 5.85937500000000000000000000000000000e-01 3ffe2c00000000000000000000000000 */
+/* cos(x) = 0.d54c3441844897fc8f853f0655 f1ba695eba9fbfd7439dbb1171 d862d9d9146ca5136f825ac */
+ 0x0.d54c3441844897fc8f853f0655p0L,
+ 0x0.f1ba695eba9fbfd7439dbb1171p-104L,
+/* sin(x) = 0.8d902565817ee7839bce3cd128 060119492cd36d42d82ada30d7 f8bde91324808377ddbf5d4 */
+ 0x0.8d902565817ee7839bce3cd128p0L,
+ 0x0.060119492cd36d42d82ada30d7p-104L,
+
+/* x = 5.93750000000000000000000000000000000e-01 3ffe3000000000000000000000000000 */
+/* cos(x) = 0.d42f6a1b9f0168cdf031c2f63c 8d9304d86f8d34cb1d5fccb68c a0f2241427fc18d1fd5bbdf */
+ 0x0.d42f6a1b9f0168cdf031c2f63cp0L,
+ 0x0.8d9304d86f8d34cb1d5fccb68cp-104L,
+/* sin(x) = 0.8f39a191b2ba6122a3fa4f41d5 a3ffd421417d46f19a22230a14 f7fcc8fce5c75b4b28b29d1 */
+ 0x0.8f39a191b2ba6122a3fa4f41d5p0L,
+ 0x0.a3ffd421417d46f19a22230a14p-104L,
+
+/* x = 6.01562500000000000000000000000000000e-01 3ffe3400000000000000000000000000 */
+/* cos(x) = 0.d30f4f392c357ab0661c5fa8a7 d9b26627846fef214b1d19a223 79ff9eddba087cf410eb097 */
+ 0x0.d30f4f392c357ab0661c5fa8a7p0L,
+ 0x0.d9b26627846fef214b1d19a223p-104L,
+/* sin(x) = 0.90e0e0d81ca678796cc92c8ea8 c2815bc72ca78abe571bfa8576 aacc571e096a33237e0e830 */
+ 0x0.90e0e0d81ca678796cc92c8ea8p0L,
+ 0x0.c2815bc72ca78abe571bfa8576p-104L,
+
+/* x = 6.09375000000000000000000000000000000e-01 3ffe3800000000000000000000000000 */
+/* cos(x) = 0.d1ebe81a95ee752e48a26bcd32 d6e922d7eb44b8ad2232f69307 95e84b56317269b9dd1dfa6 */
+ 0x0.d1ebe81a95ee752e48a26bcd32p0L,
+ 0x0.d6e922d7eb44b8ad2232f69307p-104L,
+/* sin(x) = 0.9285dc9bc45dd9ea3d02457bcc e59c4175aab6ff7929a8d28719 5525fdace200dba032874fb */
+ 0x0.9285dc9bc45dd9ea3d02457bccp0L,
+ 0x0.e59c4175aab6ff7929a8d28719p-104L,
+
+/* x = 6.17187500000000000000000000000000000e-01 3ffe3c00000000000000000000000000 */
+/* cos(x) = 0.d0c5394d772228195e25736c03 574707de0af1ca344b13bd3914 bfe27518e9e426f5deff1e1 */
+ 0x0.d0c5394d772228195e25736c03p0L,
+ 0x0.574707de0af1ca344b13bd3914p-104L,
+/* sin(x) = 0.94288e48bd0335fc41c4cbd292 0497a8f5d1d8185c99fa0081f9 0c27e2a53ffdd208a0dbe69 */
+ 0x0.94288e48bd0335fc41c4cbd292p0L,
+ 0x0.0497a8f5d1d8185c99fa0081f9p-104L,
+
+/* x = 6.25000000000000000000000000000000000e-01 3ffe4000000000000000000000000000 */
+/* cos(x) = 0.cf9b476c897c25c5bfe750dd3f 308eaf7bcc1ed00179a256870f 4200445043dcdb1974b5878 */
+ 0x0.cf9b476c897c25c5bfe750dd3fp0L,
+ 0x0.308eaf7bcc1ed00179a256870fp-104L,
+/* sin(x) = 0.95c8ef544210ec0b91c49bd2aa 09e8515fa61a156ebb10f5f8c2 32a6445b61ebf3c2ec268f9 */
+ 0x0.95c8ef544210ec0b91c49bd2aap0L,
+ 0x0.09e8515fa61a156ebb10f5f8c2p-104L,
+
+/* x = 6.32812500000000000000000000000000000e-01 3ffe4400000000000000000000000000 */
+/* cos(x) = 0.ce6e171f92f2e27f32225327ec 440ddaefae248413efc0e58cee e1ae369aabe73f88c87ed1a */
+ 0x0.ce6e171f92f2e27f32225327ecp0L,
+ 0x0.440ddaefae248413efc0e58ceep-104L,
+/* sin(x) = 0.9766f93cd18413a6aafc1cfc6f c28abb6817bf94ce349901ae3f 48c3215d3eb60acc5f78903 */
+ 0x0.9766f93cd18413a6aafc1cfc6fp0L,
+ 0x0.c28abb6817bf94ce349901ae3fp-104L,
+
+/* x = 6.40625000000000000000000000000000000e-01 3ffe4800000000000000000000000000 */
+/* cos(x) = 0.cd3dad1b5328a2e459f993f4f5 108819faccbc4eeba9604e81c7 adad51cc8a2561631a06826 */
+ 0x0.cd3dad1b5328a2e459f993f4f5p0L,
+ 0x0.108819faccbc4eeba9604e81c7p-104L,
+/* sin(x) = 0.9902a58a45e27bed68412b426b 675ed503f54d14c8172e0d373f 42cadf04daf67319a7f94be */
+ 0x0.9902a58a45e27bed68412b426bp0L,
+ 0x0.675ed503f54d14c8172e0d373fp-104L,
+
+/* x = 6.48437500000000000000000000000000000e-01 3ffe4c00000000000000000000000000 */
+/* cos(x) = 0.cc0a0e21709883a3ff00911e11 a07ee3bd7ea2b04e081be99be0 264791170761ae64b8b744a */
+ 0x0.cc0a0e21709883a3ff00911e11p0L,
+ 0x0.a07ee3bd7ea2b04e081be99be0p-104L,
+/* sin(x) = 0.9a9bedcdf01b38d993f3d78207 81de292033ead73b89e28f3931 3dbe3a6e463f845b5fa8490 */
+ 0x0.9a9bedcdf01b38d993f3d78207p0L,
+ 0x0.81de292033ead73b89e28f3931p-104L,
+
+/* x = 6.56250000000000000000000000000000000e-01 3ffe5000000000000000000000000000 */
+/* cos(x) = 0.cad33f00658fe5e8204bbc0f3a 66a0e6a773f87987a780b243d7 be83b3db1448ca0e0e62787 */
+ 0x0.cad33f00658fe5e8204bbc0f3ap0L,
+ 0x0.66a0e6a773f87987a780b243d7p-104L,
+/* sin(x) = 0.9c32cba2b14156ef05256c4f85 7991ca6a547cd7ceb1ac8a8e62 a282bd7b9183648a462bd04 */
+ 0x0.9c32cba2b14156ef05256c4f85p0L,
+ 0x0.7991ca6a547cd7ceb1ac8a8e62p-104L,
+
+/* x = 6.64062500000000000000000000000000000e-01 3ffe5400000000000000000000000000 */
+/* cos(x) = 0.c99944936cf48c8911ff93fe64 b3ddb7981e414bdaf6aae12035 77de44878c62bc3bc9cf7b9 */
+ 0x0.c99944936cf48c8911ff93fe64p0L,
+ 0x0.b3ddb7981e414bdaf6aae12035p-104L,
+/* sin(x) = 0.9dc738ad14204e689ac582d0f8 5826590feece34886cfefe2e08 cf2bb8488d55424dc9d3525 */
+ 0x0.9dc738ad14204e689ac582d0f8p0L,
+ 0x0.5826590feece34886cfefe2e08p-104L,
+
+/* x = 6.71875000000000000000000000000000000e-01 3ffe5800000000000000000000000000 */
+/* cos(x) = 0.c85c23c26ed7b6f014ef546c47 929682122876bfbf157de0aff3 c4247d820c746e32cd4174f */
+ 0x0.c85c23c26ed7b6f014ef546c47p0L,
+ 0x0.929682122876bfbf157de0aff3p-104L,
+/* sin(x) = 0.9f592e9b66a9cf906a3c7aa3c1 0199849040c45ec3f0a7475973 11038101780c5f266059dbf */
+ 0x0.9f592e9b66a9cf906a3c7aa3c1p0L,
+ 0x0.0199849040c45ec3f0a7475973p-104L,
+
+/* x = 6.79687500000000000000000000000000000e-01 3ffe5c00000000000000000000000000 */
+/* cos(x) = 0.c71be181ecd6875ce2da5615a0 3cca207d9adcb9dfb0a1d6c40a 4f0056437f1a59ccddd06ee */
+ 0x0.c71be181ecd6875ce2da5615a0p0L,
+ 0x0.3cca207d9adcb9dfb0a1d6c40ap-104L,
+/* sin(x) = 0.a0e8a725d33c828c11fa50fd9e 9a15ffecfad43f3e534358076b 9b0f6865694842b1e8c67dc */
+ 0x0.a0e8a725d33c828c11fa50fd9ep0L,
+ 0x0.9a15ffecfad43f3e534358076bp-104L,
+
+/* x = 6.87500000000000000000000000000000000e-01 3ffe6000000000000000000000000000 */
+/* cos(x) = 0.c5d882d2ee48030c7c07d28e98 1e34804f82ed4cf93655d23653 89b716de6ad44676a1cc5da */
+ 0x0.c5d882d2ee48030c7c07d28e98p0L,
+ 0x0.1e34804f82ed4cf93655d23653p-104L,
+/* sin(x) = 0.a2759c0e79c35582527c32b55f 5405c182c66160cb1d9eb7bb0b 7cdf4ad66f317bda4332914 */
+ 0x0.a2759c0e79c35582527c32b55fp0L,
+ 0x0.5405c182c66160cb1d9eb7bb0bp-104L,
+
+/* x = 6.95312500000000000000000000000000000e-01 3ffe6400000000000000000000000000 */
+/* cos(x) = 0.c4920cc2ec38fb891b38827db0 8884fc66371ac4c2052ca8885b 981bbcfd3bb7b093ee31515 */
+ 0x0.c4920cc2ec38fb891b38827db0p0L,
+ 0x0.8884fc66371ac4c2052ca8885bp-104L,
+/* sin(x) = 0.a400072188acf49cd6b173825e 038346f105e1301afe642bcc36 4cea455e21e506e3e927ed8 */
+ 0x0.a400072188acf49cd6b173825ep0L,
+ 0x0.038346f105e1301afe642bcc36p-104L,
+
+/* x = 7.03125000000000000000000000000000000e-01 3ffe6800000000000000000000000000 */
+/* cos(x) = 0.c348846bbd3631338ffe2bfe9d d1381a35b4e9c0c51b4c13fe37 6bad1bf5caacc4542be0aa9 */
+ 0x0.c348846bbd3631338ffe2bfe9dp0L,
+ 0x0.d1381a35b4e9c0c51b4c13fe37p-104L,
+/* sin(x) = 0.a587e23555bb08086d02b9c662 cdd29316c3e9bd08d93793634a 21b1810cce73bdb97a99b9e */
+ 0x0.a587e23555bb08086d02b9c662p0L,
+ 0x0.cdd29316c3e9bd08d93793634ap-104L,
+
+/* x = 7.10937500000000000000000000000000000e-01 3ffe6c00000000000000000000000000 */
+/* cos(x) = 0.c1fbeef380e4ffdd5a613ec872 2f643ffe814ec2343e53adb549 627224fdc9f2a7b77d3d69f */
+ 0x0.c1fbeef380e4ffdd5a613ec872p0L,
+ 0x0.2f643ffe814ec2343e53adb549p-104L,
+/* sin(x) = 0.a70d272a76a8d4b6da0ec90712 bb748b96dabf88c3079246f3db 7eea6e58ead4ed0e2843303 */
+ 0x0.a70d272a76a8d4b6da0ec90712p0L,
+ 0x0.bb748b96dabf88c3079246f3dbp-104L,
+
+/* x = 7.18750000000000000000000000000000000e-01 3ffe7000000000000000000000000000 */
+/* cos(x) = 0.c0ac518c8b6ae710ba37a3eeb9 0cb15aebcb8bed4356fb507a48 a6e97de9aa6d9660116b436 */
+ 0x0.c0ac518c8b6ae710ba37a3eeb9p0L,
+ 0x0.0cb15aebcb8bed4356fb507a48p-104L,
+/* sin(x) = 0.a88fcfebd9a8dd47e2f3c76ef9 e2439920f7e7fbe735f8bcc985 491ec6f12a2d4214f8cfa99 */
+ 0x0.a88fcfebd9a8dd47e2f3c76ef9p0L,
+ 0x0.e2439920f7e7fbe735f8bcc985p-104L,
+
+/* x = 7.26562500000000000000000000000000000e-01 3ffe7400000000000000000000000000 */
+/* cos(x) = 0.bf59b17550a440687596929656 7cf3e3b4e483061877c02811c6 cae85fad5a6c3da58f49292 */
+ 0x0.bf59b17550a440687596929656p0L,
+ 0x0.7cf3e3b4e483061877c02811c6p-104L,
+/* sin(x) = 0.aa0fd66eddb921232c28520d39 11b8a03193b47f187f1471ac21 6fbcd5bb81029294d3a73f1 */
+ 0x0.aa0fd66eddb921232c28520d39p0L,
+ 0x0.11b8a03193b47f187f1471ac21p-104L,
+
+/* x = 7.34375000000000000000000000000000000e-01 3ffe7800000000000000000000000000 */
+/* cos(x) = 0.be0413f84f2a771c614946a88c bf4da1d75a5560243de8f2283f efa0ea4a48468a52d51d8b3 */
+ 0x0.be0413f84f2a771c614946a88cp0L,
+ 0x0.bf4da1d75a5560243de8f2283fp-104L,
+/* sin(x) = 0.ab8d34b36acd987210ed343ec6 5d7e3adc2e7109fce43d55c8d5 7dfdf55b9e01d2cc1f1b9ec */
+ 0x0.ab8d34b36acd987210ed343ec6p0L,
+ 0x0.5d7e3adc2e7109fce43d55c8d5p-104L,
+
+/* x = 7.42187500000000000000000000000000000e-01 3ffe7c00000000000000000000000000 */
+/* cos(x) = 0.bcab7e6bfb2a14a9b122c574a3 76bec98ab14808c64a4e731b34 047e217611013ac99c0f25d */
+ 0x0.bcab7e6bfb2a14a9b122c574a3p0L,
+ 0x0.76bec98ab14808c64a4e731b34p-104L,
+/* sin(x) = 0.ad07e4c409d08c4fa3a9057bb0 ac24b8636e74e76f51e09bd6b2 319707cbd9f5e254643897a */
+ 0x0.ad07e4c409d08c4fa3a9057bb0p0L,
+ 0x0.ac24b8636e74e76f51e09bd6b2p-104L,
+
+/* x = 7.50000000000000000000000000000000000e-01 3ffe8000000000000000000000000000 */
+/* cos(x) = 0.bb4ff632a908f73ec151839cb9 d993b4e0bfb8f20e7e44e6e4ae e845e35575c3106dbe6fd06 */
+ 0x0.bb4ff632a908f73ec151839cb9p0L,
+ 0x0.d993b4e0bfb8f20e7e44e6e4aep-104L,
+/* sin(x) = 0.ae7fe0b5fc786b2d966e1d6af1 40a488476747c2646425fc7533 f532cd044cb10a971a49a6a */
+ 0x0.ae7fe0b5fc786b2d966e1d6af1p0L,
+ 0x0.40a488476747c2646425fc7533p-104L,
+
+/* x = 7.57812500000000000000000000000000000e-01 3ffe8400000000000000000000000000 */
+/* cos(x) = 0.b9f180ba77dd0751628e135a95 08299012230f14becacdd14c3f 8862d122de5b56d55b53360 */
+ 0x0.b9f180ba77dd0751628e135a95p0L,
+ 0x0.08299012230f14becacdd14c3fp-104L,
+/* sin(x) = 0.aff522a954f2ba16d9defdc416 e33f5e9a5dfd5a6c228e0abc4d 521327ff6e2517a7b3851dd */
+ 0x0.aff522a954f2ba16d9defdc416p0L,
+ 0x0.e33f5e9a5dfd5a6c228e0abc4dp-104L,
+
+/* x = 7.65625000000000000000000000000000000e-01 3ffe8800000000000000000000000000 */
+/* cos(x) = 0.b890237d3bb3c284b614a05390 16bfa1053730bbdf940fa895e1 85f8e58884d3dda15e63371 */
+ 0x0.b890237d3bb3c284b614a05390p0L,
+ 0x0.16bfa1053730bbdf940fa895e1p-104L,
+/* sin(x) = 0.b167a4c90d63c4244cf5493b7c c23bd3c3c1225e078baa0c53d6 d400b926281f537a1a260e6 */
+ 0x0.b167a4c90d63c4244cf5493b7cp0L,
+ 0x0.c23bd3c3c1225e078baa0c53d6p-104L,
+
+/* x = 7.73437500000000000000000000000000000e-01 3ffe8c00000000000000000000000000 */
+/* cos(x) = 0.b72be40067aaf2c050dbdb7a14 c3d7d4f203f6b3f0224a4afe55 d6ec8e92b508fd5c5984b3b */
+ 0x0.b72be40067aaf2c050dbdb7a14p0L,
+ 0x0.c3d7d4f203f6b3f0224a4afe55p-104L,
+/* sin(x) = 0.b2d7614b1f3aaa24df2d6e20a7 7e1ca3e6d838c03e29c1bcb026 e6733324815fadc9eb89674 */
+ 0x0.b2d7614b1f3aaa24df2d6e20a7p0L,
+ 0x0.7e1ca3e6d838c03e29c1bcb026p-104L,
+
+/* x = 7.81250000000000000000000000000000000e-01 3ffe9000000000000000000000000000 */
+/* cos(x) = 0.b5c4c7d4f7dae915ac786ccf4b 1a498d3e73b6e5e74fe7519d9c 53ee6d6b90e881bddfc33e1 */
+ 0x0.b5c4c7d4f7dae915ac786ccf4bp0L,
+ 0x0.1a498d3e73b6e5e74fe7519d9cp-104L,
+/* sin(x) = 0.b44452709a5975290591376543 4a59d111f0433eb2b133f7d103 207e2aeb4aae111ddc385b3 */
+ 0x0.b44452709a5975290591376543p0L,
+ 0x0.4a59d111f0433eb2b133f7d103p-104L,
+
+/* x = 7.89062500000000000000000000000000000e-01 3ffe9400000000000000000000000000 */
+/* cos(x) = 0.b45ad4975b1294cadca4cf40ec 8f22a68cd14b175835239a37e6 3acb85e8e9505215df18140 */
+ 0x0.b45ad4975b1294cadca4cf40ecp0L,
+ 0x0.8f22a68cd14b175835239a37e6p-104L,
+/* sin(x) = 0.b5ae7285bc10cf515753847e8f 8b7a30e0a580d929d770103509 880680f7b8b0e8ad23b65d8 */
+ 0x0.b5ae7285bc10cf515753847e8fp0L,
+ 0x0.8b7a30e0a580d929d770103509p-104L
+};
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl.c b/sysdeps/ieee754/ldbl-128ibm/w_expl.c
new file mode 100644
index 0000000..a5e72b2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/w_expl.c
@@ -0,0 +1,6 @@
+/* Looks like we can use ieee854 w_expl.c as is for IBM extended format. */
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/w_expl.c>
+long_double_symbol (libm, __expl, expl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_asinhl.c b/sysdeps/ieee754/ldbl-64-128/s_asinhl.c
new file mode 100644
index 0000000..4e8a541
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_asinhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_asinhl.c>
+long_double_symbol (libm, __asinhl, asinhl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_atanl.c b/sysdeps/ieee754/ldbl-64-128/s_atanl.c
new file mode 100644
index 0000000..c23d14a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_atanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_atanl.c>
+long_double_symbol (libm, __atanl, atanl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c b/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c
new file mode 100644
index 0000000..ace5645
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c>
+long_double_symbol (libm, __cbrtl, cbrtl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_ceill.c b/sysdeps/ieee754/ldbl-64-128/s_ceill.c
new file mode 100644
index 0000000..a646494
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_ceill.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_ceill.c>
+long_double_symbol (libm, __ceill, ceill);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
new file mode 100644
index 0000000..1319584
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl);
+#else
+long_double_symbol (libc, __copysignl, copysignl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_cosl.c b/sysdeps/ieee754/ldbl-64-128/s_cosl.c
new file mode 100644
index 0000000..6a7e2e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_cosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cosl.c>
+long_double_symbol (libm, __cosl, cosl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_erfl.c b/sysdeps/ieee754/ldbl-64-128/s_erfl.c
new file mode 100644
index 0000000..c5f9bb3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_erfl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_erfl.c>
+long_double_symbol (libm, __erfl, erfl);
+long_double_symbol (libm, __erfcl, erfcl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_expm1l.c b/sysdeps/ieee754/ldbl-64-128/s_expm1l.c
new file mode 100644
index 0000000..4fb1861
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_expm1l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_expm1l.c>
+long_double_symbol (libm, __expm1l, expm1l);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_fabsl.c b/sysdeps/ieee754/ldbl-64-128/s_fabsl.c
new file mode 100644
index 0000000..93d81d9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_fabsl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_fabsl.c>
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_finitel.c b/sysdeps/ieee754/ldbl-64-128/s_finitel.c
new file mode 100644
index 0000000..90717a1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_finitel.c
@@ -0,0 +1,17 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#undef hidden_def
+#define hidden_def(x)
+#define __finitel(arg) ___finitel(arg)
+#include <sysdeps/ieee754/ldbl-128/s_finitel.c>
+#undef __finitel
+hidden_ver (___finitel, __finitel)
+_weak_alias (___finitel, ____finitel)
+#ifdef IS_IN_libm
+long_double_symbol (libm, ____finitel, finitel);
+long_double_symbol (libm, ___finitel, __finitel);
+#else
+long_double_symbol (libc, ____finitel, finitel);
+long_double_symbol (libc, ___finitel, __finitel);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_floorl.c b/sysdeps/ieee754/ldbl-64-128/s_floorl.c
new file mode 100644
index 0000000..9530430
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_floorl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_floorl.c>
+long_double_symbol (libm, __floorl, floorl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
new file mode 100644
index 0000000..a10b6c3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
@@ -0,0 +1,10 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __fpclassifyl ___fpclassifyl
+#undef libm_hidden_def
+#define libm_hidden_def(a)
+#include <sysdeps/ieee754/ldbl-128/s_fpclassifyl.c>
+#undef __fpclassifyl
+long_double_symbol (libm, ___fpclassifyl, __fpclassifyl);
+libm_hidden_ver (___fpclassifyl, __fpclassifyl)
diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
new file mode 100644
index 0000000..685bbba
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __frexpl, frexpl);
+#else
+long_double_symbol (libc, __frexpl, frexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c b/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c
new file mode 100644
index 0000000..bb88082
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_ilogbl.c>
+long_double_symbol (libm, __ilogbl, ilogbl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_isinfl.c b/sysdeps/ieee754/ldbl-64-128/s_isinfl.c
new file mode 100644
index 0000000..e046032
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_isinfl.c
@@ -0,0 +1,16 @@
+#include <math_ldbl_opt.h>
+#ifndef IS_IN_libm
+# undef weak_alias
+# define weak_alias(n,a)
+# undef hidden_def
+# define hidden_def(x)
+# define __isinfl(arg) ___isinfl(arg)
+#endif
+#include <sysdeps/ieee754/ldbl-128/s_isinfl.c>
+#ifndef IS_IN_libm
+# undef __isinfl
+hidden_ver (___isinfl, __isinfl)
+_weak_alias (___isinfl, ____isinfl)
+long_double_symbol (libc, ____isinfl, isinfl);
+long_double_symbol (libc, ___isinfl, __isinfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_isnanl.c b/sysdeps/ieee754/ldbl-64-128/s_isnanl.c
new file mode 100644
index 0000000..3673463
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_isnanl.c
@@ -0,0 +1,16 @@
+#include <math_ldbl_opt.h>
+#ifndef IS_IN_libm
+# undef weak_alias
+# define weak_alias(n,a)
+# undef hidden_def
+# define hidden_def(x)
+# define __isnanl(arg) ___isnanl(arg)
+#endif
+#include <sysdeps/ieee754/ldbl-128/s_isnanl.c>
+#ifndef IS_IN_libm
+# undef __isnanl
+hidden_ver (___isnanl, __isnanl)
+_weak_alias (___isnanl, ____isnanl)
+long_double_symbol (libc, ____isnanl, isnanl);
+long_double_symbol (libc, ___isnanl, __isnanl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_llrintl.c b/sysdeps/ieee754/ldbl-64-128/s_llrintl.c
new file mode 100644
index 0000000..1515f3a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_llrintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_llrintl.c>
+long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_llroundl.c b/sysdeps/ieee754/ldbl-64-128/s_llroundl.c
new file mode 100644
index 0000000..ca35dae
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_llroundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_llroundl.c>
+long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_log1pl.c b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c
new file mode 100644
index 0000000..eebd636
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_log1pl.c>
+long_double_symbol (libm, __log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_logbl.c b/sysdeps/ieee754/ldbl-64-128/s_logbl.c
new file mode 100644
index 0000000..8ba8179
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_logbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_logbl.c>
+long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_lrintl.c b/sysdeps/ieee754/ldbl-64-128/s_lrintl.c
new file mode 100644
index 0000000..56e69c9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_lrintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_lrintl.c>
+long_double_symbol (libm, __lrintl, lrintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_lroundl.c b/sysdeps/ieee754/ldbl-64-128/s_lroundl.c
new file mode 100644
index 0000000..d5429e2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_lroundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_lroundl.c>
+long_double_symbol (libm, __lroundl, lroundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
new file mode 100644
index 0000000..c17d669
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_modfl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __modfl, modfl);
+#else
+long_double_symbol (libc, __modfl, modfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c
new file mode 100644
index 0000000..a6d0a31
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nearbyintl.c>
+long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c
new file mode 100644
index 0000000..64c663e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nextafterl.c>
+long_double_symbol (libm, __nextafterl, nextafterl);
+long_double_symbol (libm, __nexttowardl, nexttowardl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c
new file mode 100644
index 0000000..2968503
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nexttoward.c>
+long_double_symbol (libm, __nexttoward, nexttoward);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c
new file mode 100644
index 0000000..64b9c24
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nexttowardf.c>
+long_double_symbol (libm, __nexttowardf, nexttowardf);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_remquol.c b/sysdeps/ieee754/ldbl-64-128/s_remquol.c
new file mode 100644
index 0000000..16f0eb1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_remquol.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_remquol.c>
+long_double_symbol (libm, __remquol, remquol);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_rintl.c b/sysdeps/ieee754/ldbl-64-128/s_rintl.c
new file mode 100644
index 0000000..19af9bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_rintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_rintl.c>
+long_double_symbol (libm, __rintl, rintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_roundl.c b/sysdeps/ieee754/ldbl-64-128/s_roundl.c
new file mode 100644
index 0000000..3fa99d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_roundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_roundl.c>
+long_double_symbol (libm, __roundl, roundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c b/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c
new file mode 100644
index 0000000..3143f18
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_scalblnl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalblnl, scalblnl);
+#else
+long_double_symbol (libc, __scalblnl, scalblnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c b/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c
new file mode 100644
index 0000000..78520e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_scalbnl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalbnl, scalbnl);
+#else
+long_double_symbol (libc, __scalbnl, scalbnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_signbitl.c b/sysdeps/ieee754/ldbl-64-128/s_signbitl.c
new file mode 100644
index 0000000..f66db2f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_signbitl.c
@@ -0,0 +1,11 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __signbitl(arg) ___signbitl(arg)
+#include <sysdeps/ieee754/ldbl-128/s_signbitl.c>
+#undef __signbitl
+#ifdef IS_IN_libm
+long_double_symbol (libm, ___signbitl, __signbitl);
+#else
+long_double_symbol (libc, ___signbitl, __signbitl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_sincosl.c b/sysdeps/ieee754/ldbl-64-128/s_sincosl.c
new file mode 100644
index 0000000..ce0d4e2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_sincosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_sincosl.c>
+long_double_symbol (libm, __sincosl, sincosl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_sinl.c b/sysdeps/ieee754/ldbl-64-128/s_sinl.c
new file mode 100644
index 0000000..ebc20af
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_sinl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_sinl.c>
+long_double_symbol (libm, __sinl, sinl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_tanhl.c b/sysdeps/ieee754/ldbl-64-128/s_tanhl.c
new file mode 100644
index 0000000..ede9393
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_tanhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_tanhl.c>
+long_double_symbol (libm, __tanhl, tanhl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_tanl.c b/sysdeps/ieee754/ldbl-64-128/s_tanl.c
new file mode 100644
index 0000000..6e635df
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_tanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_tanl.c>
+long_double_symbol (libm, __tanl, tanl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_truncl.c b/sysdeps/ieee754/ldbl-64-128/s_truncl.c
new file mode 100644
index 0000000..6311479
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_truncl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_truncl.c>
+long_double_symbol (libm, __truncl, truncl);
diff --git a/sysdeps/ieee754/ldbl-64-128/strtold_l.c b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
new file mode 100644
index 0000000..ef8fe05
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <xlocale.h>
+
+/* 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_WIDE_CHAR
+extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
+# define STRTOF __new_wcstold_l
+# define __STRTOF ____new_wcstold_l
+# define ____STRTOF_INTERNAL ____wcstold_l_internal
+#else
+extern long double ____new_strtold_l (const char *, char **, __locale_t);
+# define STRTOF __new_strtold_l
+# define __STRTOF ____new_strtold_l
+# define ____STRTOF_INTERNAL ____strtold_l_internal
+#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_l.c>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold_l, wcstold_l);
+long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
+# else
+long_double_symbol (libc, __new_strtold_l, strtold_l);
+long_double_symbol (libc, ____new_strtold_l, __strtold_l);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/w_expl.c b/sysdeps/ieee754/ldbl-64-128/w_expl.c
new file mode 100644
index 0000000..2a402b0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/w_expl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/w_expl.c>
+long_double_symbol (libm, __expl, expl);
diff --git a/sysdeps/ieee754/ldbl-96/printf_fphex.c b/sysdeps/ieee754/ldbl-96/printf_fphex.c
index 3c8183d..ba9f4c2 100644
--- a/sysdeps/ieee754/ldbl-96/printf_fphex.c
+++ b/sysdeps/ieee754/ldbl-96/printf_fphex.c
@@ -1,5 +1,5 @@
/* Print floating point number in hexadecimal notation according to ISO C99.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2005 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
@@ -90,4 +90,4 @@ do { \
} \
} while (0)
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c
index e026f5a..7406c36 100644
--- a/sysdeps/ieee754/ldbl-96/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-96/s_erfl.c
@@ -341,10 +341,6 @@ __erfl (x)
}
weak_alias (__erfl, erfl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erf, __erfl)
-weak_alias (__erf, erfl)
-#endif
#ifdef __STDC__
long double
__erfcl (long double x)
@@ -456,7 +452,3 @@ weak_alias (__erf, erfl)
}
weak_alias (__erfcl, erfcl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erfc, __erfcl)
-weak_alias (__erfc, erfcl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-96/s_llrintl.c b/sysdeps/ieee754/ldbl-96/s_llrintl.c
index e927a8af..d6eedf1 100644
--- a/sysdeps/ieee754/ldbl-96/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -47,9 +47,7 @@ __llrintl (long double x)
if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
{
- if (j0 < -1)
- return 0;
- else if (j0 >= 63)
+ if (j0 >= 63)
result = (((long long int) i0 << 32) | i1) << (j0 - 63);
else
{
@@ -58,7 +56,9 @@ __llrintl (long double x)
GET_LDOUBLE_WORDS (se, i0, i1, t);
j0 = (se & 0x7fff) - 0x3fff;
- if (j0 <= 31)
+ if (j0 < 0)
+ result = 0;
+ else if (j0 <= 31)
result = i0 >> (31 - j0);
else
result = ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
diff --git a/sysdeps/ieee754/ldbl-96/s_lrintl.c b/sysdeps/ieee754/ldbl-96/s_lrintl.c
index 4212093..621951d 100644
--- a/sysdeps/ieee754/ldbl-96/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_lrintl.c
@@ -1,6 +1,6 @@
/* Round argument to nearest integral value according to current rounding
direction.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -47,17 +47,12 @@ __lrintl (long double x)
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;
+ w = two63[sx] + x;
+ t = w - two63[sx];
+ GET_LDOUBLE_WORDS (se, i0, i1, t);
+ j0 = (se & 0x7fff) - 0x3fff;
- result = i0 >> (31 - j0);
- }
+ result = (j0 < 0 ? 0 : i0 >> (31 - j0));
}
else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
{
diff --git a/sysdeps/ieee754/ldbl-96/s_nextafterl.c b/sysdeps/ieee754/ldbl-96/s_nextafterl.c
index 1798261..ed0877d 100644
--- a/sysdeps/ieee754/ldbl-96/s_nextafterl.c
+++ b/sysdeps/ieee754/ldbl-96/s_nextafterl.c
@@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $";
*/
#include "math.h"
-#include "math_private.h"
+#include <math_private.h>
#ifdef __STDC__
long double __nextafterl(long double x, long double y)
@@ -48,9 +48,12 @@ static char rcsid[] = "$NetBSD: $";
return x+y;
if(x==y) return y; /* x=y, return y */
if((ix|hx|lx)==0) { /* x == 0 */
+ long double u;
SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
- y = x*x;
- if(y==x) return y; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(esx<0x8000) { /* x > 0 */
if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
@@ -85,13 +88,10 @@ static char rcsid[] = "$NetBSD: $";
}
}
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;
- }
+ if(esy==0x7fff) return x+x; /* overflow */
+ if(esy==0) {
+ long double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
SET_LDOUBLE_WORDS(x,esx,hx,lx);
return x;
diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
index 8b273af..e304384 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
@@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $";
*/
#include "math.h"
-#include "math_private.h"
+#include <math_private.h>
#include <float.h>
#ifdef __STDC__
@@ -50,10 +50,12 @@ static char rcsid[] = "$NetBSD: $";
return x+y;
if((long double) x==y) return y; /* x=y, return y */
if((ix|lx)==0) { /* x == 0 */
- double x2;
+ double u;
INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */
- x2 = x*x;
- if(x2==x) return x2; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00
@@ -84,22 +86,15 @@ static char rcsid[] = "$NetBSD: $";
if(hy>=0x7ff00000) {
x = x+x; /* overflow */
if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
- /* Force conversion to float. */
- asm ("" : "=m"(x) : "m"(x));
+ /* Force conversion to double. */
+ asm ("" : "+m"(x));
return x;
}
- if(hy<0x00100000) { /* underflow */
- double x2 = x*x;
- if(x2!=x) { /* raise underflow flag */
- INSERT_WORDS(x2,hx,lx);
- return x2;
- }
+ if(hy<0x00100000) {
+ double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
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
index a1c38b5..6357975 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttowardf.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c
@@ -18,7 +18,8 @@ static char rcsid[] = "$NetBSD: $";
#endif
#include "math.h"
-#include "math_private.h"
+#include <math_private.h>
+#include <float.h>
#ifdef __STDC__
float __nexttowardf(float x, long double y)
@@ -41,10 +42,12 @@ static char rcsid[] = "$NetBSD: $";
return x+y;
if((long double) x==y) return y; /* x=y, return y */
if(ix==0) { /* x == 0 */
- float x2;
+ float u;
SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/
- x2 = x*x;
- if(x2==x) return x2; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80
@@ -64,13 +67,16 @@ static char rcsid[] = "$NetBSD: $";
}
}
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;
- }
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "+m"(x));
+ return x;
+ }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
}
SET_FLOAT_WORD(x,hx);
return x;
diff --git a/sysdeps/ieee754/ldbl-96/strtold_l.c b/sysdeps/ieee754/ldbl-96/strtold_l.c
index 32bf180..52335c2 100644
--- a/sysdeps/ieee754/ldbl-96/strtold_l.c
+++ b/sysdeps/ieee754/ldbl-96/strtold_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2004, 2005 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
@@ -42,4 +42,4 @@
(flt) = u.d; \
} while (0)
-#include <strtod_l.c>
+#include <stdlib/strtod_l.c>
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
new file mode 100644
index 0000000..7f7bc3c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -0,0 +1,43 @@
+# The`long double' type is a distinct type we support if
+# -mlong-double-128 option is used (or when it becomes a default
+# when -mlong-double-64 is not used).
+long-double-fcts = yes
+ifeq (,$(filter -mlong-double-128,$(sysdep-CFLAGS)))
+sysdep-CFLAGS += -mlong-double-128
+endif
+
+ifeq ($(subdir),math)
+libm-routines += s_nexttowardfd
+routines += math_ldbl_opt nldbl-compat
+
+extra-libs += libnldbl
+libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
+ obstack_printf obstack_vprintf printf scanf snprintf \
+ sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
+ vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
+ vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
+ wprintf wscanf printf_fp printf_size \
+ fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
+ swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
+ vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
+ wprintf_chk \
+ syslog syslog_chk vsyslog vsyslog_chk \
+ strfmon strfmon_l \
+ strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
+ qecvt qfcvt qgcvt qecvt_r qfcvt_r \
+ isinf isnan finite signbit scalb log2 lgamma_r ceil \
+ significand acos asin atan atan2 cos sin tan cosh sinh \
+ tanh acosh asinh atanh exp log log10 exp10 pow10 expm1 \
+ log1p logb exp2 sqrt cbrt fabs floor j0 j1 y0 y1 erf erfc \
+ lgamma tgamma gamma rint nearbyint round trunc \
+ copysign fdim fmax fmin nextafter pow hypot fmod drem \
+ remainder ldexp scalbn frexp modf scalbln fma nan sincos \
+ jn yn ilogb remquo lrint lround llrint llround nexttowardf \
+ nexttoward conj cacos cacosh casin catan catanh ccos ccosh \
+ casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
+ cabs carg cimag creal clog10
+libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
+libnldbl-inhibit-o = $(object-suffixes)
+libnldbl-static-only-routines = $(libnldbl-routines)
+
+endif
diff --git a/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
new file mode 100644
index 0000000..d22b18e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -0,0 +1,87 @@
+%include <nldbl-abi.h>
+%ifndef NLDBL_VERSION
+% error "nldbl-abi.h must define NLDBL_VERSION"
+%endif
+
+libc {
+ NLDBL_VERSION {
+ # IEEE quad long double functions (older symver is for
+ # IEEE double long double).
+ ldexpl; copysignl; finitel; frexpl; isinfl; isnanl; modfl;
+ __isinfl; __isnanl; __finitel; __signbitl;
+ scalbnl;
+ qecvt; qfcvt; qgcvt; qecvt_r; qfcvt_r;
+
+ strtold; __strtold_internal; wcstold; __wcstold_internal;
+ __strtold_l; strtold_l; __wcstold_l; wcstold_l;
+
+ strfmon; __strfmon_l; strfmon_l;
+ __nldbl_strfmon; __nldbl___strfmon_l; __nldbl_strfmon_l;
+ __nldbl___vstrfmon; __nldbl___vstrfmon_l;
+
+ syslog; vsyslog;
+ __nldbl_syslog; __nldbl_vsyslog;
+ __nldbl___syslog_chk; __nldbl___vsyslog_chk;
+
+ # *printf* family, using IEEE quad long double
+ __asprintf; asprintf; dprintf; fprintf; fwprintf; _IO_fprintf;
+ _IO_printf; _IO_sprintf; _IO_vfprintf; _IO_vsprintf; obstack_printf;
+ obstack_vprintf; printf; __printf_fp; printf_size; snprintf; sprintf;
+ swprintf; vasprintf; vdprintf; vfprintf; vfwprintf; vprintf; vsnprintf;
+ __vsnprintf; vsprintf; vswprintf; vwprintf; wprintf;
+
+ # *printf* family, using IEEE double as long double
+ # The standard functions are __REDIRECTed to these if -mlong-double-64
+ __nldbl___asprintf; __nldbl_asprintf; __nldbl_dprintf; __nldbl_fprintf;
+ __nldbl_fwprintf; __nldbl__IO_fprintf; __nldbl__IO_printf;
+ __nldbl__IO_sprintf; __nldbl__IO_vfprintf; __nldbl__IO_vsprintf;
+ __nldbl_obstack_printf; __nldbl_obstack_vprintf; __nldbl_printf;
+ __nldbl___printf_fp; __nldbl_printf_size; __nldbl_snprintf;
+ __nldbl_sprintf; __nldbl_swprintf; __nldbl_vasprintf; __nldbl_vdprintf;
+ __nldbl_vfprintf; __nldbl_vfwprintf; __nldbl_vprintf; __nldbl_vsnprintf;
+ __nldbl___vsnprintf; __nldbl_vsprintf; __nldbl_vswprintf;
+ __nldbl_vwprintf; __nldbl_wprintf;
+
+ # *scanf family, using IEEE quad long double
+ _IO_sscanf; _IO_vfscanf; __vfscanf; __vsscanf; fscanf; fwscanf; scanf;
+ sscanf; swscanf; vfscanf; vfwscanf; vscanf; vsscanf; vswscanf; vwscanf;
+ wscanf;
+
+ # *scanf family, using IEEE double as long double
+ __nldbl__IO_sscanf; __nldbl__IO_vfscanf; __nldbl___vfscanf;
+ __nldbl___vsscanf; __nldbl_fscanf; __nldbl_fwscanf; __nldbl_scanf;
+ __nldbl_sscanf; __nldbl_swscanf; __nldbl_vfscanf; __nldbl_vfwscanf;
+ __nldbl_vscanf; __nldbl_vsscanf; __nldbl_vswscanf; __nldbl_vwscanf;
+ __nldbl_wscanf;
+
+ # checking versions, using IEEE quad long double
+ __sprintf_chk; __vsprintf_chk; __snprintf_chk; __vsnprintf_chk;
+ __printf_chk; __fprintf_chk; __vprintf_chk; __vfprintf_chk;
+
+ # checking versions, using IEEE double as long double
+ __nldbl___sprintf_chk; __nldbl___vsprintf_chk; __nldbl___snprintf_chk;
+ __nldbl___vsnprintf_chk; __nldbl___printf_chk; __nldbl___fprintf_chk;
+ __nldbl___vprintf_chk; __nldbl___vfprintf_chk;
+ __nldbl___swprintf_chk; __nldbl___vswprintf_chk; __nldbl___fwprintf_chk;
+ __nldbl___wprintf_chk; __nldbl___vfwprintf_chk; __nldbl___vwprintf_chk;
+ }
+}
+libm {
+ NLDBL_VERSION {
+ # IEEE quad long double functions (older symver is for
+ # IEEE double as long double).
+ cabsl; cargl; cimagl; conjl; creall; cacosl; cacoshl; casinl;
+ catanl; catanhl; ccosl; ccoshl; casinhl; cexpl; clogl; __clog10l;
+ clog10l; cpowl; cprojl; csinl; csinhl; csqrtl; ctanl; ctanhl;
+ fdiml; fmal; fmaxl; fminl; ldexpl; nanl; nextafterl; nexttowardl;
+ significandl; acosl; acoshl; asinl; atan2l; atanhl; coshl; dreml;
+ exp10l; pow10l; exp2l; fmodl; hypotl; j0l; y0l; j1l; y1l; jnl; ynl;
+ lgammal; gammal; lgammal_r; logl; log10l; log2l; powl; remainderl;
+ scalbl; sinhl; sqrtl; tgammal; asinhl; atanl; cbrtl; ceill; copysignl;
+ erfl; erfcl; expm1l; fabsl; finitel; floorl; frexpl; ilogbl;
+ llrintl; llroundl; log1pl; logbl; lrintl; lroundl; modfl;
+ nearbyintl; remquol; rintl; roundl; scalblnl; scalbnl; sinl; cosl;
+ sincosl; tanl; tanhl; truncl; expl; __finitel; __signbitl;
+ __fpclassifyl; nexttowardf; nexttoward; __nldbl_nexttowardf;
+ }
+}
diff --git a/sysdeps/ieee754/ldbl-opt/cabs.c b/sysdeps/ieee754/ldbl-opt/cabs.c
new file mode 100644
index 0000000..a181de2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cabs.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/cabs.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cabs, cabsl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cabsl.c b/sysdeps/ieee754/ldbl-opt/cabsl.c
new file mode 100644
index 0000000..b861633
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cabsl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cabsl.c>
+long_double_symbol (libm, __cabsl, cabsl);
diff --git a/sysdeps/ieee754/ldbl-opt/carg.c b/sysdeps/ieee754/ldbl-opt/carg.c
new file mode 100644
index 0000000..2ed3581
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/carg.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/carg.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __carg, cargl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cargl.c b/sysdeps/ieee754/ldbl-opt/cargl.c
new file mode 100644
index 0000000..952dc60
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cargl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cargl.c>
+long_double_symbol (libm, __cargl, cargl);
diff --git a/sysdeps/ieee754/ldbl-opt/cimag.c b/sysdeps/ieee754/ldbl-opt/cimag.c
new file mode 100644
index 0000000..f805258
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cimag.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/cimag.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cimag, cimagl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cimagl.c b/sysdeps/ieee754/ldbl-opt/cimagl.c
new file mode 100644
index 0000000..112365e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cimagl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cimagl.c>
+long_double_symbol (libm, __cimagl, cimagl);
diff --git a/sysdeps/ieee754/ldbl-opt/configure b/sysdeps/ieee754/ldbl-opt/configure
new file mode 100755
index 0000000..dc81365
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/configure
@@ -0,0 +1,69 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/ieee754/ldbl-opt/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mlong-double-128" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mlong-double-128... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __LONG_DOUBLE_128__
+# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
+#endif
+long double foobar (long double x) { return x; }
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ libc_cv_mlong_double_128=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128" >&6
+if test "$libc_cv_mlong_double_128" = no; then
+ { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 support" >&2;}
+ { (exit 1); exit 1; }; }
+fi
diff --git a/sysdeps/ieee754/ldbl-opt/configure.in b/sysdeps/ieee754/ldbl-opt/configure.in
new file mode 100644
index 0000000..a77fadd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/configure.in
@@ -0,0 +1,19 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/ieee754/ldbl-opt/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS supports -mlong-double-128,
+ libc_cv_mlong_double_128, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE(, [
+#ifndef __LONG_DOUBLE_128__
+# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
+#endif
+long double foobar (long double x) { return x; }],
+ libc_cv_mlong_double_128=yes,
+ libc_cv_mlong_double_128=no)
+CFLAGS="$save_CFLAGS"])
+if test "$libc_cv_mlong_double_128" = no; then
+ AC_MSG_ERROR([this configuration requires -mlong-double-128 support])
+fi
diff --git a/sysdeps/ieee754/ldbl-opt/conj.c b/sysdeps/ieee754/ldbl-opt/conj.c
new file mode 100644
index 0000000..e4edade
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/conj.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/conj.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __conj, conjl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/conjl.c b/sysdeps/ieee754/ldbl-opt/conjl.c
new file mode 100644
index 0000000..c98e0ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/conjl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/conjl.c>
+long_double_symbol (libm, __conjl, conjl);
diff --git a/sysdeps/ieee754/ldbl-opt/creal.c b/sysdeps/ieee754/ldbl-opt/creal.c
new file mode 100644
index 0000000..0d1c93e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/creal.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/creal.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __creal, creall, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/creall.c b/sysdeps/ieee754/ldbl-opt/creall.c
new file mode 100644
index 0000000..68fedd4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/creall.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/creall.c>
+long_double_symbol (libm, __creall, creall);
diff --git a/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c
new file mode 100644
index 0000000..49c5c12
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c
@@ -0,0 +1,3 @@
+/* Set temporarily to non-zero if long double should be considered
+ the same as double. */
+__thread int __no_long_double attribute_tls_model_ie attribute_hidden;
diff --git a/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
new file mode 100644
index 0000000..692b0c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
@@ -0,0 +1,52 @@
+/* -mlong-double-64 compatibility mode macros. */
+
+#include <nldbl-abi.h>
+#ifndef LONG_DOUBLE_COMPAT_VERSION
+# error "nldbl-abi.h must define LONG_DOUBLE_COMPAT_VERSION"
+#endif
+
+#include <shlib-compat.h>
+#define LONG_DOUBLE_COMPAT(lib, introduced) \
+ SHLIB_COMPAT(lib, introduced, LONG_DOUBLE_COMPAT_VERSION)
+#define long_double_symbol(lib, local, symbol) \
+ long_double_symbol_1 (lib, local, symbol, LONG_DOUBLE_COMPAT_VERSION)
+#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
+# define ldbl_hidden_def(local, name) libc_hidden_ver (local, name)
+# define ldbl_strong_alias(name, aliasname) \
+ strong_alias (name, __GL_##name##_##aliasname) \
+ long_double_symbol (libc, __GL_##name##_##aliasname, aliasname);
+# define ldbl_weak_alias(name, aliasname) \
+ weak_alias (name, __GL_##name##_##aliasname) \
+ long_double_symbol (libc, __GL_##name##_##aliasname, aliasname);
+# define long_double_symbol_1(lib, local, symbol, version) \
+ versioned_symbol (lib, local, symbol, version)
+#elif defined HAVE_WEAK_SYMBOLS
+# define ldbl_hidden_def(local, name) libc_hidden_def (name)
+# define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+# define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname)
+# ifndef __ASSEMBLER__
+/* Note that weak_alias cannot be used - it is defined to nothing
+ in most of the C files. */
+# define long_double_symbol_1(lib, local, symbol, version) \
+ _weak_alias (local, symbol)
+# else
+# define long_double_symbol_1(lib, local, symbol, version) \
+ weak_alias (local, symbol)
+# endif
+#else
+# define ldbl_hidden_def(local, name) libc_hidden_def (name)
+# define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+# define ldbl_weak_alias(name, aliasname) strong_alias (name, aliasname)
+# define long_double_symbol_1(lib, local, symbol, version) \
+ strong_alias (local, symbol)
+#endif
+
+#ifndef __ASSEMBLER__
+# include <math.h>
+# include <math/math_private.h>
+
+/* Set temporarily to non-zero if long double should be considered
+ the same as double. */
+extern __thread int __no_long_double attribute_tls_model_ie attribute_hidden;
+# define __ldbl_is_dbl __builtin_expect (__no_long_double, 0)
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-acos.c b/sysdeps/ieee754/ldbl-opt/nldbl-acos.c
new file mode 100644
index 0000000..813a17e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-acos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+acosl (double x)
+{
+ return acos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c
new file mode 100644
index 0000000..75508e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+acoshl (double x)
+{
+ return acosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asin.c b/sysdeps/ieee754/ldbl-opt/nldbl-asin.c
new file mode 100644
index 0000000..5bbe6cd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+asinl (double x)
+{
+ return asin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c
new file mode 100644
index 0000000..512f685
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+asinhl (double x)
+{
+ return asinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c
new file mode 100644
index 0000000..4be216d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+__asprintf (char **string_ptr, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vasprintf (string_ptr, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (__asprintf) asprintf attribute_hidden;
+weak_alias (__asprintf, asprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atan.c b/sysdeps/ieee754/ldbl-opt/nldbl-atan.c
new file mode 100644
index 0000000..2849e48
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atanl (double x)
+{
+ return atan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c b/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c
new file mode 100644
index 0000000..d4e5a91
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atan2l (double x, double y)
+{
+ return atan2 (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c
new file mode 100644
index 0000000..82b54ca
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atanhl (double x)
+{
+ return atanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c b/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c
new file mode 100644
index 0000000..837822d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cabsl (double _Complex x)
+{
+ return cabs (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c b/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c
new file mode 100644
index 0000000..d935b51
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cacosl (double _Complex x)
+{
+ return cacos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c
new file mode 100644
index 0000000..67f994b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cacoshl (double _Complex x)
+{
+ return cacosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-carg.c b/sysdeps/ieee754/ldbl-opt/nldbl-carg.c
new file mode 100644
index 0000000..bfff141
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-carg.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cargl (double _Complex x)
+{
+ return carg (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-casin.c b/sysdeps/ieee754/ldbl-opt/nldbl-casin.c
new file mode 100644
index 0000000..310aa0a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-casin.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+casinl (double _Complex x)
+{
+ return casin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c
new file mode 100644
index 0000000..71b466e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+casinhl (double _Complex x)
+{
+ return casinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-catan.c b/sysdeps/ieee754/ldbl-opt/nldbl-catan.c
new file mode 100644
index 0000000..ea5f528
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-catan.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+catanl (double _Complex x)
+{
+ return catan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c
new file mode 100644
index 0000000..e6f58aa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+catanhl (double _Complex x)
+{
+ return catanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c
new file mode 100644
index 0000000..1c353a6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+cbrtl (double x)
+{
+ return cbrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c b/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c
new file mode 100644
index 0000000..0e1c2e7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ccosl (double _Complex x)
+{
+ return ccos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c
new file mode 100644
index 0000000..da2bf58
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ccoshl (double _Complex x)
+{
+ return ccosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c b/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c
new file mode 100644
index 0000000..a8fc3d5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ceill (double x)
+{
+ return ceil (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c
new file mode 100644
index 0000000..f1837af
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cexpl (double _Complex x)
+{
+ return cexp (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c b/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c
new file mode 100644
index 0000000..fffbdd5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cimagl (double _Complex x)
+{
+ return cimag (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-clog.c b/sysdeps/ieee754/ldbl-opt/nldbl-clog.c
new file mode 100644
index 0000000..ecbae7b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-clog.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+clogl (double _Complex x)
+{
+ return clog (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c b/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c
new file mode 100644
index 0000000..193f401
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c
@@ -0,0 +1,11 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+clog10l (double _Complex x)
+{
+ return clog10 (x);
+}
+extern __typeof (clog10l) __clog10l attribute_hidden;
+weak_alias (clog10l, __clog10l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
new file mode 100644
index 0000000..f82c5f6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -0,0 +1,852 @@
+/* *printf* family compatibility routines for IEEE double as long double
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <libioP.h>
+#include <wchar.h>
+#include <printf.h>
+#include <monetary.h>
+#include <locale/localeinfo.h>
+#include <sys/syslog.h>
+#include <bits/libc-lock.h>
+
+#include "nldbl-compat.h"
+
+libc_hidden_proto (__nldbl_vfprintf)
+libc_hidden_proto (__nldbl_vsscanf)
+libc_hidden_proto (__nldbl_vsprintf)
+libc_hidden_proto (__nldbl_vfscanf)
+libc_hidden_proto (__nldbl_vfwscanf)
+libc_hidden_proto (__nldbl_vdprintf)
+libc_hidden_proto (__nldbl_vswscanf)
+libc_hidden_proto (__nldbl_vfwprintf)
+libc_hidden_proto (__nldbl_vswprintf)
+libc_hidden_proto (__nldbl_vsnprintf)
+libc_hidden_proto (__nldbl_vasprintf)
+libc_hidden_proto (__nldbl_obstack_vprintf)
+libc_hidden_proto (__nldbl___vfwprintf_chk)
+libc_hidden_proto (__nldbl___vsnprintf_chk)
+libc_hidden_proto (__nldbl___vfprintf_chk)
+libc_hidden_proto (__nldbl___vsyslog_chk)
+libc_hidden_proto (__nldbl___vsprintf_chk)
+libc_hidden_proto (__nldbl___vswprintf_chk)
+libc_hidden_proto (__nldbl___vstrfmon)
+libc_hidden_proto (__nldbl___vstrfmon_l)
+
+static void
+__nldbl_cleanup (void *arg)
+{
+ __no_long_double = 0;
+}
+
+#define set_no_long_double() \
+ __libc_cleanup_push (__nldbl_cleanup, NULL); __no_long_double = 1
+#define clear_no_long_double() \
+ __no_long_double = 0; __libc_cleanup_pop (0)
+
+/* Compatibility with IEEE double as long double.
+ IEEE quad long double is used by default for most programs, so
+ we don't need to split this into one file per function for the
+ sake of statically linked programs. */
+
+int
+attribute_compat_text_section
+__nldbl___asprintf (char **string_ptr, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vasprintf (string_ptr, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+weak_alias (__nldbl___asprintf, __nldbl_asprintf)
+
+int
+attribute_compat_text_section
+__nldbl_dprintf (int d, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vdprintf (d, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_fprintf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_printf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (__nldbl_printf, __nldbl__IO_printf)
+
+int
+attribute_compat_text_section
+__nldbl_sprintf (char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsprintf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
+{
+ int done;
+ set_no_long_double ();
+ done = INTUSE(_IO_vfprintf) (s, fmt, ap);
+ clear_no_long_double ();
+ return done;
+}
+libc_hidden_def (__nldbl_vfprintf)
+strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
+
+int
+attribute_compat_text_section
+__nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap)
+{
+ int done;
+ __no_long_double = 1;
+ done = INTUSE(_IO_vsprintf) (string, fmt, ap);
+ __no_long_double = 0;
+ return done;
+}
+weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)
+libc_hidden_def (__nldbl_vsprintf)
+
+int
+attribute_compat_text_section
+__nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
+ va_list ap)
+{
+ int done;
+ __no_long_double = 1;
+ done = _IO_obstack_vprintf (obstack, fmt, ap);
+ __no_long_double = 0;
+ return done;
+}
+libc_hidden_def (__nldbl_obstack_vprintf)
+
+int
+attribute_compat_text_section
+__nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
+{
+ int result;
+ va_list ap;
+ va_start (ap, fmt);
+ result = __nldbl_obstack_vprintf (obstack, fmt, ap);
+ va_end (ap);
+ return result;
+}
+
+int
+attribute_compat_text_section weak_function
+__nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswprintf (s, n, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vasprintf (result_ptr, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vasprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vdprintf (int d, const char *fmt, va_list arg)
+{
+ int res;
+ set_no_long_double ();
+ res = _IO_vdprintf (d, fmt, arg);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl_vdprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = _IO_vfwprintf (s, fmt, ap);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl_vfwprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vprintf (const char *fmt, va_list ap)
+{
+ return __nldbl_vfprintf (stdout, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
+ va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vsnprintf (string, maxlen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vsnprintf)
+weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
+ va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vswprintf (string, maxlen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vswprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vwprintf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwprintf (stdout, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_wprintf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap,
+ int *errp)
+{
+ int res;
+ set_no_long_double ();
+ res = INTUSE(_IO_vfscanf) (s, fmt, ap, errp);
+ clear_no_long_double ();
+ return res;
+}
+
+int
+attribute_compat_text_section
+__nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = INTUSE(_IO_vfscanf) (s, fmt, ap, NULL);
+ clear_no_long_double ();
+ return res;
+}
+weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
+libc_hidden_def (__nldbl_vfscanf)
+
+int
+attribute_compat_text_section
+__nldbl_sscanf (const char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
+
+int
+attribute_compat_text_section
+__nldbl___vsscanf (const char *string, const char *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = _IO_vsscanf (string, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
+libc_hidden_def (__nldbl_vsscanf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vscanf (const char *fmt, va_list ap)
+{
+ return __nldbl_vfscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_fscanf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfscanf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_scanf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfscanf (stdin, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = _IO_vfwscanf (s, fmt, ap, NULL);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl_vfwscanf)
+
+int
+attribute_compat_text_section
+__nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = vswscanf (string, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl_vswscanf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vwscanf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_wscanf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stdin, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___printf_chk (int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+ const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+ const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = __vfprintf_chk (s, flag, fmt, ap);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl___vfprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+{
+ int res;
+ set_no_long_double ();
+ res = __vfwprintf_chk (s, flag, fmt, ap);
+ clear_no_long_double ();
+ return res;
+}
+libc_hidden_def (__nldbl___vfwprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
+{
+ return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
+ const char *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = __vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl___vsnprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
+ va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = __vsprintf_chk (string, flag, slen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl___vsprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+ const wchar_t *fmt, va_list ap)
+{
+ int res;
+ __no_long_double = 1;
+ res = __vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
+ __no_long_double = 0;
+ return res;
+}
+libc_hidden_def (__nldbl___vswprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+
+extern __typeof (printf_size) __printf_size;
+
+int
+attribute_compat_text_section
+__nldbl_printf_size (FILE *fp, const struct printf_info *info,
+ const void *const *args)
+{
+ struct printf_info info_no_ldbl = *info;
+
+ info_no_ldbl.is_long_double = 0;
+ return __printf_size (fp, &info_no_ldbl, args);
+}
+
+extern __typeof (__printf_fp) ___printf_fp;
+
+int
+attribute_compat_text_section
+__nldbl___printf_fp (FILE *fp, const struct printf_info *info,
+ const void *const *args)
+{
+ struct printf_info info_no_ldbl = *info;
+
+ info_no_ldbl.is_long_double = 0;
+ return ___printf_fp (fp, &info_no_ldbl, args);
+}
+
+ssize_t
+attribute_compat_text_section
+__nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon (s, maxsize, format, ap);
+ va_end (ap);
+ return res;
+}
+
+ssize_t
+attribute_compat_text_section
+__nldbl___strfmon_l (char *s, size_t maxsize, __locale_t loc,
+ const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
+ va_end (ap);
+ return res;
+}
+weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
+
+ssize_t
+attribute_compat_text_section
+__nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
+{
+ ssize_t res;
+ __no_long_double = 1;
+ res = __vstrfmon_l (s, maxsize, _NL_CURRENT_LOCALE, format, ap);
+ __no_long_double = 0;
+ va_end (ap);
+ return res;
+}
+libc_hidden_def (__nldbl___vstrfmon)
+
+ssize_t
+attribute_compat_text_section
+__nldbl___vstrfmon_l (char *s, size_t maxsize, __locale_t loc,
+ const char *format, va_list ap)
+{
+ ssize_t res;
+ __no_long_double = 1;
+ res = __vstrfmon_l (s, maxsize, loc, format, ap);
+ __no_long_double = 0;
+ va_end (ap);
+ return res;
+}
+libc_hidden_def (__nldbl___vstrfmon_l)
+
+void
+attribute_compat_text_section
+__nldbl_syslog (int pri, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+ va_end (ap);
+}
+
+void
+attribute_compat_text_section
+__nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+ va_end(ap);
+}
+
+void
+attribute_compat_text_section
+__nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
+{
+ set_no_long_double ();
+ __vsyslog_chk (pri, flag, fmt, ap);
+ clear_no_long_double ();
+}
+libc_hidden_def (__nldbl___vsyslog_chk)
+
+void
+attribute_compat_text_section
+__nldbl_vsyslog (int pri, const char *fmt, va_list ap)
+{
+ __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+}
+
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
+compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
+compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
+compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
+compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
+compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
+compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
+compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
new file mode 100644
index 0000000..c046100
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
@@ -0,0 +1,87 @@
+/* Prototypes for compatibility double == long double entry points.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __NLDBL_COMPAT_H
+#define __NLDBL_COMPAT_H 1
+
+/* Avoid long double prototypes. */
+#define __NO_LONG_DOUBLE_MATH 1
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <printf.h>
+#include <wchar.h>
+#include <math.h>
+#include <monetary.h>
+#include <sys/syslog.h>
+
+
+/* Declare the __nldbl_NAME function the wrappers call that's in libc.so. */
+#define NLDBL_DECL(name) extern __typeof (name) __nldbl_##name
+
+NLDBL_DECL (_IO_vfscanf);
+NLDBL_DECL (vfscanf);
+NLDBL_DECL (vfwscanf);
+NLDBL_DECL (obstack_vprintf);
+NLDBL_DECL (vasprintf);
+NLDBL_DECL (dprintf);
+NLDBL_DECL (vdprintf);
+NLDBL_DECL (fprintf);
+NLDBL_DECL (vfprintf);
+NLDBL_DECL (vfwprintf);
+NLDBL_DECL (vsnprintf);
+NLDBL_DECL (vsprintf);
+NLDBL_DECL (vsscanf);
+NLDBL_DECL (vswprintf);
+NLDBL_DECL (vswscanf);
+NLDBL_DECL (__asprintf);
+NLDBL_DECL (asprintf);
+NLDBL_DECL (__printf_fp);
+NLDBL_DECL (printf_size);
+NLDBL_DECL (syslog);
+NLDBL_DECL (vsyslog);
+NLDBL_DECL (qecvt);
+NLDBL_DECL (qfcvt);
+NLDBL_DECL (qgcvt);
+NLDBL_DECL (__vstrfmon_l);
+
+/* This one does not exist in the normal interface, only
+ __nldbl___vstrfmon really exists. */
+extern ssize_t __nldbl___vstrfmon (char *, size_t, const char *, va_list)
+ __THROW;
+
+/* These don't use __typeof because they were not declared by the headers,
+ since we don't compile with _FORTIFY_SOURCE. */
+extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
+ const char *__restrict, _G_va_list);
+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
+ const wchar_t *__restrict, __gnuc_va_list);
+extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
+ const char *__restrict, _G_va_list) __THROW;
+extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
+ const char *__restrict, _G_va_list)
+ __THROW;
+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
+ const wchar_t *__restrict, __gnuc_va_list)
+ __THROW;
+extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
+
+
+#endif /* __NLDBL_COMPAT_H */
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-conj.c b/sysdeps/ieee754/ldbl-opt/nldbl-conj.c
new file mode 100644
index 0000000..8927ea9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-conj.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+conjl (double _Complex x)
+{
+ return conj (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c b/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c
new file mode 100644
index 0000000..ef23bad
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+copysignl (double x, double y)
+{
+ return copysign (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cos.c b/sysdeps/ieee754/ldbl-opt/nldbl-cos.c
new file mode 100644
index 0000000..08738af
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+cosl (double x)
+{
+ return cos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c
new file mode 100644
index 0000000..0ab834f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+coshl (double x)
+{
+ return cosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c b/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c
new file mode 100644
index 0000000..709e7d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cpowl (double _Complex x, double _Complex y)
+{
+ return cpow (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c b/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c
new file mode 100644
index 0000000..6f88b88
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cprojl (double _Complex x)
+{
+ return cproj (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-creal.c b/sysdeps/ieee754/ldbl-opt/nldbl-creal.c
new file mode 100644
index 0000000..b02ce6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-creal.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+creall (double _Complex x)
+{
+ return creal (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csin.c b/sysdeps/ieee754/ldbl-opt/nldbl-csin.c
new file mode 100644
index 0000000..b2e2c9c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csin.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csinl (double _Complex x)
+{
+ return csin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c
new file mode 100644
index 0000000..2bcba920
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csinhl (double _Complex x)
+{
+ return csinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c
new file mode 100644
index 0000000..ae00a29
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csqrtl (double _Complex x)
+{
+ return csqrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c b/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c
new file mode 100644
index 0000000..422c5cc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ctanl (double _Complex x)
+{
+ return ctan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c
new file mode 100644
index 0000000..f3842ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ctanhl (double _Complex x)
+{
+ return ctanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c
new file mode 100644
index 0000000..6e26db2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+dprintf (int d, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vdprintf (d, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-drem.c b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c
new file mode 100644
index 0000000..1e08ce1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+dreml (double x, double y)
+{
+ return drem (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-erf.c b/sysdeps/ieee754/ldbl-opt/nldbl-erf.c
new file mode 100644
index 0000000..0032c1f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-erf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+erfl (double x)
+{
+ return erf (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c b/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c
new file mode 100644
index 0000000..21d0968
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+erfcl (double x)
+{
+ return erfc (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp.c
new file mode 100644
index 0000000..ad2c89b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+expl (double x)
+{
+ return exp (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c
new file mode 100644
index 0000000..2d0ead6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+exp10l (double x)
+{
+ return exp10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c
new file mode 100644
index 0000000..d5fce39
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+exp2l (double x)
+{
+ return exp2 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c b/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c
new file mode 100644
index 0000000..be5c6e5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+expm1l (double x)
+{
+ return expm1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c b/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c
new file mode 100644
index 0000000..10729a6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fabsl (double x)
+{
+ return fabs (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c b/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c
new file mode 100644
index 0000000..72896b6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fdiml (double x, double y)
+{
+ return fdim (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-finite.c b/sysdeps/ieee754/ldbl-opt/nldbl-finite.c
new file mode 100644
index 0000000..000adfb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-finite.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__finitel (double x)
+{
+ return __finite (x);
+}
+extern __typeof (__finitel) finitel attribute_hidden;
+weak_alias (__finitel, finitel)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-floor.c b/sysdeps/ieee754/ldbl-opt/nldbl-floor.c
new file mode 100644
index 0000000..c7e9f83
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-floor.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+floorl (double x)
+{
+ return floor (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fma.c b/sysdeps/ieee754/ldbl-opt/nldbl-fma.c
new file mode 100644
index 0000000..9474483
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmal (double x, double y, double z)
+{
+ return fma (x, y, z);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c
new file mode 100644
index 0000000..f5a8477
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmaxl (double x, double y)
+{
+ return fmax (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c
new file mode 100644
index 0000000..a353cf9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fminl (double x, double y)
+{
+ return fmin (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c
new file mode 100644
index 0000000..aa692b9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmodl (double x, double y)
+{
+ return fmod (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c
new file mode 100644
index 0000000..9df4c4b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+fprintf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (fprintf) _IO_fprintf attribute_hidden;
+weak_alias (fprintf, _IO_fprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c
new file mode 100644
index 0000000..43a7618
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c
new file mode 100644
index 0000000..0ec97e1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+frexpl (double x, int *exponent)
+{
+ return frexp (x, exponent);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
new file mode 100644
index 0000000..1b768e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+fscanf (FILE *stream, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl__IO_vfscanf (stream, fmt, arg, NULL);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c
new file mode 100644
index 0000000..18362af
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+fwprintf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c
new file mode 100644
index 0000000..09731cf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
new file mode 100644
index 0000000..27fc1a7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stream, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c
new file mode 100644
index 0000000..10dc640
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+gammal (double x)
+{
+ return gamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c b/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c
new file mode 100644
index 0000000..2105f3e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+hypotl (double x, double y)
+{
+ return hypot (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c b/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c
new file mode 100644
index 0000000..e840b2a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+ilogbl (double x)
+{
+ return ilogb (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
new file mode 100644
index 0000000..05581c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+_IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap, int *errp)
+{
+ return __nldbl__IO_vfscanf (s, fmt, ap, errp);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c b/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c
new file mode 100644
index 0000000..340d241
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isinfl (double x)
+{
+ return __isinf (x);
+}
+extern __typeof (__isinfl) isinfl attribute_hidden;
+weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c b/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c
new file mode 100644
index 0000000..e5f0f1b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isnanl (double x)
+{
+ return __isnan (x);
+}
+extern __typeof (__isnanl) isnanl attribute_hidden;
+weak_alias (__isnanl, isnanl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-j0.c b/sysdeps/ieee754/ldbl-opt/nldbl-j0.c
new file mode 100644
index 0000000..9d59f0a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-j0.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+j0l (double x)
+{
+ return j0 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-j1.c b/sysdeps/ieee754/ldbl-opt/nldbl-j1.c
new file mode 100644
index 0000000..dba7366
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-j1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+j1l (double x)
+{
+ return j1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-jn.c b/sysdeps/ieee754/ldbl-opt/nldbl-jn.c
new file mode 100644
index 0000000..3f19bbb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-jn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+jnl (int n, double x)
+{
+ return jn (n, x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c
new file mode 100644
index 0000000..360f8f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ldexpl (double x, int exponent)
+{
+ return ldexp (x, exponent);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c
new file mode 100644
index 0000000..0055212
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+lgammal (double x)
+{
+ return lgamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c
new file mode 100644
index 0000000..e1ab9a1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+lgammal_r (double x, int *signgamp)
+{
+ return lgamma_r (x, signgamp);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c b/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c
new file mode 100644
index 0000000..6dfce89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long long int
+attribute_hidden
+llrintl (double x)
+{
+ return llrint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-llround.c b/sysdeps/ieee754/ldbl-opt/nldbl-llround.c
new file mode 100644
index 0000000..0157a07
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-llround.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long long int
+attribute_hidden
+llroundl (double x)
+{
+ return llround (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log.c b/sysdeps/ieee754/ldbl-opt/nldbl-log.c
new file mode 100644
index 0000000..a5a1ae7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+logl (double x)
+{
+ return log (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log10.c b/sysdeps/ieee754/ldbl-opt/nldbl-log10.c
new file mode 100644
index 0000000..1477866
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log10l (double x)
+{
+ return log10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c b/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c
new file mode 100644
index 0000000..455b25a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log1pl (double x)
+{
+ return log1p (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log2.c b/sysdeps/ieee754/ldbl-opt/nldbl-log2.c
new file mode 100644
index 0000000..8c1ae34
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log2l (double x)
+{
+ return log2 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-logb.c b/sysdeps/ieee754/ldbl-opt/nldbl-logb.c
new file mode 100644
index 0000000..d9ce8de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-logb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+logbl (double x)
+{
+ return logb (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c b/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c
new file mode 100644
index 0000000..0acd3d4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long int
+attribute_hidden
+lrintl (double x)
+{
+ return lrint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lround.c b/sysdeps/ieee754/ldbl-opt/nldbl-lround.c
new file mode 100644
index 0000000..aadb111
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lround.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long int
+attribute_hidden
+lroundl (double x)
+{
+ return lround (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-modf.c b/sysdeps/ieee754/ldbl-opt/nldbl-modf.c
new file mode 100644
index 0000000..bcbe6bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-modf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+modfl (double x, double *iptr)
+{
+ return modf (x, iptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nan.c b/sysdeps/ieee754/ldbl-opt/nldbl-nan.c
new file mode 100644
index 0000000..8db157a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nanl (const char *tag)
+{
+ return nan (tag);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c b/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c
new file mode 100644
index 0000000..fd4a246
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nearbyintl (double x)
+{
+ return nearbyint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c b/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c
new file mode 100644
index 0000000..b0bae43
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nextafterl (double x, double y)
+{
+ return nextafter (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c b/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c
new file mode 100644
index 0000000..acbd01a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c
@@ -0,0 +1,14 @@
+#define nexttoward nexttoward_XXX
+#define nexttowardl nexttowardl_XXX
+#include "nldbl-compat.h"
+#undef nexttoward
+#undef nexttowardl
+
+double
+attribute_hidden
+nexttoward (double x, double y)
+{
+ return nextafter (x, y);
+}
+extern __typeof (nexttoward) nexttowardl attribute_hidden;
+strong_alias (nexttoward, nexttowardl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c b/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c
new file mode 100644
index 0000000..350b08d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c
@@ -0,0 +1,12 @@
+#define nexttowardf nexttowardf_XXX
+#include "nldbl-compat.h"
+#undef nexttowardf
+
+extern float __nldbl_nexttowardf (float x, double y);
+
+float
+attribute_hidden
+nexttowardf (float x, double y)
+{
+ return __nldbl_nexttowardf (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c
new file mode 100644
index 0000000..4abff2d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c
@@ -0,0 +1,13 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+obstack_printf (struct obstack *obstack, const char *fmt, ...)
+{
+ int result;
+ va_list ap;
+ va_start (ap, fmt);
+ result = __nldbl_obstack_vprintf (obstack, fmt, ap);
+ va_end (ap);
+ return result;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
new file mode 100644
index 0000000..228a507
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+obstack_vprintf (struct obstack *obstack, const char *fmt, va_list ap)
+{
+ return __nldbl_obstack_vprintf (obstack, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-pow.c b/sysdeps/ieee754/ldbl-opt/nldbl-pow.c
new file mode 100644
index 0000000..a5cc446
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-pow.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+powl (double x, double y)
+{
+ return pow (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c b/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c
new file mode 100644
index 0000000..20ebf8d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+pow10l (double x)
+{
+ return pow10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf.c
new file mode 100644
index 0000000..e4b0fba
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+printf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (printf) _IO_printf attribute_hidden;
+strong_alias (printf, _IO_printf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c
new file mode 100644
index 0000000..926db41
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__printf_chk (int flag, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c
new file mode 100644
index 0000000..057dfe0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__printf_fp (FILE *fp, const struct printf_info *info,
+ const void *const *args)
+{
+ return __nldbl___printf_fp (fp, info, args);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c
new file mode 100644
index 0000000..d8b1fc9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+printf_size (FILE *__restrict fp, const struct printf_info *info,
+ const void *const *__restrict args)
+{
+ return __nldbl_printf_size (fp, info, args);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c
new file mode 100644
index 0000000..9f0b0a6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c
@@ -0,0 +1,10 @@
+#define qecvt qecvt_XXX
+#include "nldbl-compat.h"
+#undef qecvt
+
+attribute_hidden
+char *
+qecvt (double val, int ndigit, int *__restrict decpt, int *__restrict sign)
+{
+ return ecvt (val, ndigit, decpt, sign);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c
new file mode 100644
index 0000000..06f9914
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c
@@ -0,0 +1,11 @@
+#define qecvt_r qecvt_r_XXX
+#include "nldbl-compat.h"
+#undef qecvt_r
+
+int
+attribute_hidden
+qecvt_r (double val, int ndigit, int *__restrict decpt, int *__restrict sign,
+ char *__restrict buf, size_t len)
+{
+ return ecvt_r (val, ndigit, decpt, sign, buf, len);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c
new file mode 100644
index 0000000..37fa7f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c
@@ -0,0 +1,10 @@
+#define qfcvt qfcvt_XXX
+#include "nldbl-compat.h"
+#undef qfcvt
+
+attribute_hidden
+char *
+qfcvt (double val, int ndigit, int *__restrict decpt, int *__restrict sign)
+{
+ return fcvt (val, ndigit, decpt, sign);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c
new file mode 100644
index 0000000..03224fe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c
@@ -0,0 +1,11 @@
+#define qfcvt_r qfcvt_r_XXX
+#include "nldbl-compat.h"
+#undef qfcvt_r
+
+int
+attribute_hidden
+qfcvt_r (double val, int ndigit, int *__restrict decpt, int *__restrict sign,
+ char *__restrict buf, size_t len)
+{
+ return fcvt_r (val, ndigit, decpt, sign, buf, len);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c
new file mode 100644
index 0000000..b935d09
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c
@@ -0,0 +1,10 @@
+#define qgcvt qgcvt_XXX
+#include "nldbl-compat.h"
+#undef qgcvt
+
+attribute_hidden
+char *
+qgcvt (double val, int ndigit, char *buf)
+{
+ return gcvt (val, ndigit, buf);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c
new file mode 100644
index 0000000..a8d5baf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+remainderl (double x, double y)
+{
+ return remainder (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c b/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c
new file mode 100644
index 0000000..592dada
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+remquol (double x, double y, int *quo)
+{
+ return remquo (x, y, quo);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-rint.c b/sysdeps/ieee754/ldbl-opt/nldbl-rint.c
new file mode 100644
index 0000000..00f942f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-rint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+rintl (double x)
+{
+ return rint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-round.c b/sysdeps/ieee754/ldbl-opt/nldbl-round.c
new file mode 100644
index 0000000..be9bd51
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-round.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+roundl (double x)
+{
+ return round (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c
new file mode 100644
index 0000000..00d3e2e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalbl (double x, double n)
+{
+ return scalb (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c
new file mode 100644
index 0000000..b5bd501
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalblnl (double x, long int n)
+{
+ return scalbln (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c
new file mode 100644
index 0000000..b1914eb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalbnl (double x, int n)
+{
+ return scalbn (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
new file mode 100644
index 0000000..bbab371
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+scanf (const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl__IO_vfscanf (stdin, fmt, arg, NULL);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c b/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c
new file mode 100644
index 0000000..b62d0ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c
@@ -0,0 +1,10 @@
+#define __signbitl __signbitl_XXX
+#include "nldbl-compat.h"
+#undef __signbitl
+
+int
+attribute_hidden
+__signbitl (double x)
+{
+ return __signbit (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-significand.c b/sysdeps/ieee754/ldbl-opt/nldbl-significand.c
new file mode 100644
index 0000000..624381d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-significand.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+significandl (double x)
+{
+ return significand (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sin.c b/sysdeps/ieee754/ldbl-opt/nldbl-sin.c
new file mode 100644
index 0000000..0e76e05
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sinl (double x)
+{
+ return sin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c b/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c
new file mode 100644
index 0000000..9f2ab2b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+sincosl (double x, double *sinx, double *cosx)
+{
+ sincos (x, sinx, cosx);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c
new file mode 100644
index 0000000..99ea62e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sinhl (double x)
+{
+ return sinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c
new file mode 100644
index 0000000..ef6fb96
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+snprintf (char *s, size_t maxlen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c
new file mode 100644
index 0000000..944d3de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+ const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c
new file mode 100644
index 0000000..5d37a7e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+sprintf (char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsprintf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (sprintf) _IO_sprintf attribute_hidden;
+strong_alias (sprintf, _IO_sprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c
new file mode 100644
index 0000000..349b7c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c
new file mode 100644
index 0000000..4ae6566
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sqrtl (double x)
+{
+ return sqrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
new file mode 100644
index 0000000..a771d49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+sscanf (const char *s, const char *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vsscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
+extern __typeof (sscanf) _IO_sscanf attribute_hidden;
+strong_alias (sscanf, _IO_sscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c
new file mode 100644
index 0000000..38f4071
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c
@@ -0,0 +1,14 @@
+#include "nldbl-compat.h"
+
+ssize_t
+attribute_hidden
+strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon (s, maxsize, format, ap);
+ va_end (ap);
+ return res;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
new file mode 100644
index 0000000..0db0e8c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+ssize_t
+attribute_hidden
+__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
+{
+ va_list ap;
+ ssize_t res;
+
+ va_start (ap, format);
+ res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
+ va_end (ap);
+ return res;
+}
+extern __typeof (__strfmon_l) strfmon_l attribute_hidden;
+weak_alias (__strfmon_l, strfmon_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c
new file mode 100644
index 0000000..99b9079
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c
@@ -0,0 +1,10 @@
+#define strtold strtold_XXX
+#include "nldbl-compat.h"
+#undef strtold
+
+double
+attribute_hidden
+strtold (const char *nptr, char **endptr)
+{
+ return strtod (nptr, endptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
new file mode 100644
index 0000000..4227463
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
@@ -0,0 +1,20 @@
+#define strtold_l strtold_l_XXX
+#define __strtold_l __strtold_l_XXX
+#define __strtod_l __strtod_l_XXX
+#include "nldbl-compat.h"
+#undef strtold_l
+#undef __strtold_l
+#undef __strtod_l
+
+extern double
+__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ __locale_t __loc);
+
+double
+attribute_hidden
+__strtold_l (const char *nptr, char **endptr, __locale_t loc)
+{
+ return __strtod_l (nptr, endptr, loc);
+}
+extern __typeof (__strtold_l) strtold_l attribute_hidden;
+weak_alias (__strtold_l, strtold_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c
new file mode 100644
index 0000000..0bafabc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c
@@ -0,0 +1,10 @@
+#define __strtold_internal __strtold_internal_XXX
+#include "nldbl-compat.h"
+#undef __strtold_internal
+
+double
+attribute_hidden
+__strtold_internal (const char *nptr, char **endptr, int group)
+{
+ return __strtod_internal (nptr, endptr, group);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c
new file mode 100644
index 0000000..7f4f7b0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswprintf (s, n, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c
new file mode 100644
index 0000000..0373f6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+ const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
new file mode 100644
index 0000000..dd058f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vswscanf (s, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c b/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c
new file mode 100644
index 0000000..8687e9f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c
@@ -0,0 +1,11 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+syslog (int pri, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ __nldbl_vsyslog (pri, fmt, ap);
+ va_end (ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c
new file mode 100644
index 0000000..31ea6a8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c
@@ -0,0 +1,12 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+__syslog_chk (int pri, int flag, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+ va_end(ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tan.c b/sysdeps/ieee754/ldbl-opt/nldbl-tan.c
new file mode 100644
index 0000000..1a27b6f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tanl (double x)
+{
+ return tan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c
new file mode 100644
index 0000000..fc2fd32
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tanhl (double x)
+{
+ return tanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c
new file mode 100644
index 0000000..bbf613a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tgammal (double x)
+{
+ return tgamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c b/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c
new file mode 100644
index 0000000..d0131e8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+truncl (double x)
+{
+ return trunc (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c
new file mode 100644
index 0000000..52fa18c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vasprintf (char **result_ptr, const char *fmt, va_list ap)
+{
+ return __nldbl_vasprintf (result_ptr, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c
new file mode 100644
index 0000000..1acbd40
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vdprintf (int d, const char *fmt, va_list arg)
+{
+ return __nldbl_vdprintf (d, fmt, arg);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c
new file mode 100644
index 0000000..6ca8437
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vfprintf (FILE *s, const char *fmt, va_list ap)
+{
+ return __nldbl_vfprintf (s, fmt, ap);
+}
+extern __typeof (vfprintf) _IO_vfprintf attribute_hidden;
+strong_alias (vfprintf, _IO_vfprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c
new file mode 100644
index 0000000..0f6820a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
+{
+ return __nldbl___vfprintf_chk (s, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
new file mode 100644
index 0000000..f23465e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+ return __nldbl__IO_vfscanf (s, fmt, ap, NULL);
+}
+extern __typeof (__vfscanf) vfscanf attribute_hidden;
+weak_alias (__vfscanf, vfscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c
new file mode 100644
index 0000000..c3fe76a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwprintf (s, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c
new file mode 100644
index 0000000..b3b69f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vfwprintf_chk (s, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
new file mode 100644
index 0000000..be9febc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwscanf (s, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c
new file mode 100644
index 0000000..ed0d27d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vprintf (const char *fmt, va_list ap)
+{
+ return __nldbl_vfprintf (stdout, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c
new file mode 100644
index 0000000..63b3e8f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vprintf_chk (int flag, const char *fmt, va_list ap)
+{
+ return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
new file mode 100644
index 0000000..e75907b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vscanf (const char *fmt, va_list ap)
+{
+ return __nldbl__IO_vfscanf (stdin, fmt, ap, NULL);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c
new file mode 100644
index 0000000..5a9bcbc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vsnprintf (char *string, size_t maxlen, const char *fmt, va_list ap)
+{
+ return __nldbl_vsnprintf (string, maxlen, fmt, ap);
+}
+extern __typeof (vsnprintf) __vsnprintf attribute_hidden;
+weak_alias (vsnprintf, __vsnprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c
new file mode 100644
index 0000000..1938029
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
+ const char *fmt, va_list ap)
+{
+ return __nldbl___vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c
new file mode 100644
index 0000000..04406d0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+_IO_vsprintf (char *string, const char *fmt, va_list ap)
+{
+ return __nldbl_vsprintf (string, fmt, ap);
+}
+extern __typeof (_IO_vsprintf) vsprintf attribute_hidden;
+weak_alias (_IO_vsprintf, vsprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c
new file mode 100644
index 0000000..9df143f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
+ va_list ap)
+{
+ return __nldbl___vsprintf_chk (string, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
new file mode 100644
index 0000000..f5594c1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsscanf (const char *string, const char *fmt, va_list ap)
+{
+ return __nldbl_vsscanf (string, fmt, ap);
+}
+extern __typeof (__vsscanf) vsscanf attribute_hidden;
+weak_alias (__vsscanf, vsscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c
new file mode 100644
index 0000000..ff3415a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vswprintf (string, maxlen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c
new file mode 100644
index 0000000..0cd1f96
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+ const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
new file mode 100644
index 0000000..bd4bb51
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vswscanf (string, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c
new file mode 100644
index 0000000..eed1010
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+void
+vsyslog (int pri, const char *fmt, va_list ap)
+{
+ __nldbl_vsyslog (pri, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c
new file mode 100644
index 0000000..2221474
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+__vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
+{
+ __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c
new file mode 100644
index 0000000..f46bdb3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vwprintf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwprintf (stdout, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c
new file mode 100644
index 0000000..f7e7185
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
+{
+ return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
new file mode 100644
index 0000000..d39578c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vwscanf (const wchar_t *fmt, va_list ap)
+{
+ return __nldbl_vfwscanf (stdin, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c
new file mode 100644
index 0000000..dbaffaa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c
@@ -0,0 +1,10 @@
+#define wcstold wcstold_XXX
+#include "nldbl-compat.h"
+#undef wcstold
+
+double
+attribute_hidden
+wcstold (const wchar_t *nptr, wchar_t **endptr)
+{
+ return wcstod (nptr, endptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
new file mode 100644
index 0000000..e32d13a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
@@ -0,0 +1,14 @@
+#define wcstold_l wcstold_l_XXX
+#define __wcstold_l __wcstold_l_XXX
+#include "nldbl-compat.h"
+#undef wcstold_l
+#undef __wcstold_l
+
+double
+attribute_hidden
+__wcstold_l (const wchar_t *nptr, wchar_t **endptr, __locale_t loc)
+{
+ return __wcstod_l (nptr, endptr, loc);
+}
+extern __typeof (__wcstold_l) wcstold_l attribute_hidden;
+weak_alias (__wcstold_l, wcstold_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c
new file mode 100644
index 0000000..b638a39
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c
@@ -0,0 +1,10 @@
+#define __wcstold_internal __wcstold_internal_XXX
+#include "nldbl-compat.h"
+#undef __wcstold_internal
+
+double
+attribute_hidden
+__wcstold_internal (const wchar_t *nptr, wchar_t **endptr, int group)
+{
+ return __wcstod_internal (nptr, endptr, group);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c
new file mode 100644
index 0000000..2aa1a74
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+wprintf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwprintf (stdout, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c
new file mode 100644
index 0000000..39191e1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__wprintf_chk (int flag, const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c
new file mode 100644
index 0000000..4ee3fdc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+wscanf (const wchar_t *fmt, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, fmt);
+ done = __nldbl_vfwscanf (stdin, fmt, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-y0.c b/sysdeps/ieee754/ldbl-opt/nldbl-y0.c
new file mode 100644
index 0000000..e35621f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-y0.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+y0l (double x)
+{
+ return y0 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-y1.c b/sysdeps/ieee754/ldbl-opt/nldbl-y1.c
new file mode 100644
index 0000000..c47abcd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-y1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+y1l (double x)
+{
+ return y1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-yn.c b/sysdeps/ieee754/ldbl-opt/nldbl-yn.c
new file mode 100644
index 0000000..7623d45
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-yn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ynl (int n, double x)
+{
+ return yn (n, x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/s_asinh.c b/sysdeps/ieee754/ldbl-opt/s_asinh.c
new file mode 100644
index 0000000..e9bcfae
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_asinh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_asinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __asinh, asinhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_atan.c b/sysdeps/ieee754/ldbl-opt/s_atan.c
new file mode 100644
index 0000000..5fbd5e6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_atan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_atan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, atan, atanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacos.c b/sysdeps/ieee754/ldbl-opt/s_cacos.c
new file mode 100644
index 0000000..db90a9e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacos.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cacos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cacos, cacosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosh.c b/sysdeps/ieee754/ldbl-opt/s_cacosh.c
new file mode 100644
index 0000000..e68049d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacosh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cacosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cacosh, cacoshl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacoshl.c b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c
new file mode 100644
index 0000000..ed4a299
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cacoshl.c>
+long_double_symbol (libm, __cacoshl, cacoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosl.c b/sysdeps/ieee754/ldbl-opt/s_cacosl.c
new file mode 100644
index 0000000..9b84005
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacosl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cacosl.c>
+long_double_symbol (libm, __cacosl, cacosl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casin.c b/sysdeps/ieee754/ldbl-opt/s_casin.c
new file mode 100644
index 0000000..04c47ca
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casin.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_casin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __casin, casinl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinh.c b/sysdeps/ieee754/ldbl-opt/s_casinh.c
new file mode 100644
index 0000000..19c4fa3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_casinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __casinh, casinhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinhl.c b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
new file mode 100644
index 0000000..976fa8e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_casinhl.c>
+long_double_symbol (libm, __casinhl, casinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinl.c b/sysdeps/ieee754/ldbl-opt/s_casinl.c
new file mode 100644
index 0000000..7afb77c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_casinl.c>
+long_double_symbol (libm, __casinl, casinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catan.c b/sysdeps/ieee754/ldbl-opt/s_catan.c
new file mode 100644
index 0000000..19f6173
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catan.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_catan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __catan, catanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanh.c b/sysdeps/ieee754/ldbl-opt/s_catanh.c
new file mode 100644
index 0000000..cff7861
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_catanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __catanh, catanhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanhl.c b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
new file mode 100644
index 0000000..e956282
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_catanhl.c>
+long_double_symbol (libm, __catanhl, catanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanl.c b/sysdeps/ieee754/ldbl-opt/s_catanl.c
new file mode 100644
index 0000000..ee2fdf5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_catanl.c>
+long_double_symbol (libm, __catanl, catanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cbrt.c b/sysdeps/ieee754/ldbl-opt/s_cbrt.c
new file mode 100644
index 0000000..cdc6357
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cbrt.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_cbrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __cbrt, cbrtl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccos.c b/sysdeps/ieee754/ldbl-opt/s_ccos.c
new file mode 100644
index 0000000..2c43c7f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccos.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ccos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ccos, ccosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosh.c b/sysdeps/ieee754/ldbl-opt/s_ccosh.c
new file mode 100644
index 0000000..3753cd5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccosh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ccosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ccosh, ccoshl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccoshl.c b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c
new file mode 100644
index 0000000..9f0c1e1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ccoshl.c>
+long_double_symbol (libm, __ccoshl, ccoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosl.c b/sysdeps/ieee754/ldbl-opt/s_ccosl.c
new file mode 100644
index 0000000..e93e805
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccosl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ccosl.c>
+long_double_symbol (libm, __ccosl, ccosl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ceil.c b/sysdeps/ieee754/ldbl-opt/s_ceil.c
new file mode 100644
index 0000000..6e4b707
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ceil.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexp.c b/sysdeps/ieee754/ldbl-opt/s_cexp.c
new file mode 100644
index 0000000..d983c96
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cexp.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cexp.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cexp, cexpl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexpl.c b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
new file mode 100644
index 0000000..d5ae1fc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cexpl.c>
+long_double_symbol (libm, __cexpl, cexpl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog.c b/sysdeps/ieee754/ldbl-opt/s_clog.c
new file mode 100644
index 0000000..3e0e90c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_clog.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __clog, clogl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10.c b/sysdeps/ieee754/ldbl-opt/s_clog10.c
new file mode 100644
index 0000000..ac3f4a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10.c
@@ -0,0 +1,7 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_clog10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __clog10, __clog10l, GLIBC_2_1);
+compat_symbol (libm, clog10, clog10l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10l.c b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
new file mode 100644
index 0000000..954f680
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
@@ -0,0 +1,10 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __clog10l __clog10l_internal
+#include <math/s_clog10l.c>
+#undef __clog10l
+strong_alias (__clog10l_internal, __clog10l__internal)
+long_double_symbol (libm, __clog10l_internal, __clog10l);
+long_double_symbol (libm, __clog10l__internal, clog10l);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clogl.c b/sysdeps/ieee754/ldbl-opt/s_clogl.c
new file mode 100644
index 0000000..75126c8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clogl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_clogl.c>
+long_double_symbol (libm, __clogl, clogl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_copysign.c b/sysdeps/ieee754/ldbl-opt/s_copysign.c
new file mode 100644
index 0000000..425e0ea
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_copysign.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_copysign.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpow.c b/sysdeps/ieee754/ldbl-opt/s_cpow.c
new file mode 100644
index 0000000..4801d7c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cpow.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cpow.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cpow, cpowl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpowl.c b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
new file mode 100644
index 0000000..61840e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cpowl.c>
+long_double_symbol (libm, __cpowl, cpowl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cproj.c b/sysdeps/ieee754/ldbl-opt/s_cproj.c
new file mode 100644
index 0000000..f298c37
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cproj.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cproj.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cproj, cprojl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cprojl.c b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
new file mode 100644
index 0000000..1cc0580
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cprojl.c>
+long_double_symbol (libm, __cprojl, cprojl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csin.c b/sysdeps/ieee754/ldbl-opt/s_csin.c
new file mode 100644
index 0000000..7017c95
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csin.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csin, csinl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinh.c b/sysdeps/ieee754/ldbl-opt/s_csinh.c
new file mode 100644
index 0000000..a1fa667
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csinh, csinhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinhl.c b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
new file mode 100644
index 0000000..484d466
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csinhl.c>
+long_double_symbol (libm, __csinhl, csinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinl.c b/sysdeps/ieee754/ldbl-opt/s_csinl.c
new file mode 100644
index 0000000..f71642e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csinl.c>
+long_double_symbol (libm, __csinl, csinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrt.c b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
new file mode 100644
index 0000000..2b6dcfe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csqrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csqrt, csqrtl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
new file mode 100644
index 0000000..045ff93
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csqrtl.c>
+long_double_symbol (libm, __csqrtl, csqrtl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctan.c b/sysdeps/ieee754/ldbl-opt/s_ctan.c
new file mode 100644
index 0000000..a6a21f9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctan.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ctan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ctan, ctanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanh.c b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
new file mode 100644
index 0000000..fd4be12
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ctanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ctanh, ctanhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanhl.c b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
new file mode 100644
index 0000000..f159373
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ctanhl.c>
+long_double_symbol (libm, __ctanhl, ctanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanl.c b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
new file mode 100644
index 0000000..0c2d94c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ctanl.c>
+long_double_symbol (libm, __ctanl, ctanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_erf.c b/sysdeps/ieee754/ldbl-opt/s_erf.c
new file mode 100644
index 0000000..76f1baa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_erf.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_erf.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __erf, erfl, GLIBC_2_0);
+compat_symbol (libm, __erfc, erfcl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_expm1.c b/sysdeps/ieee754/ldbl-opt/s_expm1.c
new file mode 100644
index 0000000..ef9b595
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_expm1.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_expm1.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __expm1, expm1l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fabs.c b/sysdeps/ieee754/ldbl-opt/s_fabs.c
new file mode 100644
index 0000000..e7c9218
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fabs.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_fabs.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fdim.c b/sysdeps/ieee754/ldbl-opt/s_fdim.c
new file mode 100644
index 0000000..02c95bf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fdiml.c b/sysdeps/ieee754/ldbl-opt/s_fdiml.c
new file mode 100644
index 0000000..06b760b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fdiml.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fdiml.c>
+long_double_symbol (libm, __fdiml, fdiml);
diff --git a/sysdeps/ieee754/ldbl-opt/s_finite.c b/sysdeps/ieee754/ldbl-opt/s_finite.c
new file mode 100644
index 0000000..897dbfd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_finite.c
@@ -0,0 +1,18 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_finite.c>
+weak_alias (__finite, ___finite)
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
+# endif
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, ___finite, finitel, GLIBC_2_0);
+# endif
+#else
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_0);
+# endif
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, ___finite, finitel, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_floor.c b/sysdeps/ieee754/ldbl-opt/s_floor.c
new file mode 100644
index 0000000..7797944
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_floor.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_floor.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fma.c b/sysdeps/ieee754/ldbl-opt/s_fma.c
new file mode 100644
index 0000000..2ee7214
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fma.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fma, fmal, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmal.c b/sysdeps/ieee754/ldbl-opt/s_fmal.c
new file mode 100644
index 0000000..bd12dab
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmal.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fmal.c>
+long_double_symbol (libm, __fmal, fmal);
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmax.c b/sysdeps/ieee754/ldbl-opt/s_fmax.c
new file mode 100644
index 0000000..11e7591
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmax.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fmax.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
new file mode 100644
index 0000000..98221b2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fmaxl.c>
+long_double_symbol (libm, __fmaxl, fmaxl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmin.c b/sysdeps/ieee754/ldbl-opt/s_fmin.c
new file mode 100644
index 0000000..c3fe44d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmin.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fmin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fminl.c b/sysdeps/ieee754/ldbl-opt/s_fminl.c
new file mode 100644
index 0000000..9bfdc7a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fminl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fminl.c>
+long_double_symbol (libm, __fminl, fminl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_frexp.c b/sysdeps/ieee754/ldbl-opt/s_frexp.c
new file mode 100644
index 0000000..59ce352
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_frexp.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_frexp.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __frexp, frexpl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __frexp, frexpl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ilogb.c b/sysdeps/ieee754/ldbl-opt/s_ilogb.c
new file mode 100644
index 0000000..3a6ccbd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ilogb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_ilogb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ilogb, ilogbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_isinf.c b/sysdeps/ieee754/ldbl-opt/s_isinf.c
new file mode 100644
index 0000000..401c8b1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_isinf.c
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_isinf.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
+compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_isnan.c b/sysdeps/ieee754/ldbl-opt/s_isnan.c
new file mode 100644
index 0000000..164b800
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_isnan.c
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexp.c b/sysdeps/ieee754/ldbl-opt/s_ldexp.c
new file mode 100644
index 0000000..f0f6519
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexp.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <math/s_ldexp.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ldexp, ldexpl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __ldexp, ldexpl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
new file mode 100644
index 0000000..d4636b9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ldexpl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __ldexpl, ldexpl);
+#else
+long_double_symbol (libc, __ldexpl, ldexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_llrint.c b/sysdeps/ieee754/ldbl-opt/s_llrint.c
new file mode 100644
index 0000000..e631197
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_llrint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_llrint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_llround.c b/sysdeps/ieee754/ldbl-opt/s_llround.c
new file mode 100644
index 0000000..36c7e6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_llround.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_llround.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llround, llroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_log1p.c b/sysdeps/ieee754/ldbl-opt/s_log1p.c
new file mode 100644
index 0000000..495fa32
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_log1p.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_log1p.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log1p, log1pl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_logb.c b/sysdeps/ieee754/ldbl-opt/s_logb.c
new file mode 100644
index 0000000..4d7a6db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_logb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_logb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __logb, logbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_lrint.c b/sysdeps/ieee754/ldbl-opt/s_lrint.c
new file mode 100644
index 0000000..b7af812
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_lrint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_lrint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_lround.c b/sysdeps/ieee754/ldbl-opt/s_lround.c
new file mode 100644
index 0000000..f3a27fa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_lround.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_lround.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_modf.c b/sysdeps/ieee754/ldbl-opt/s_modf.c
new file mode 100644
index 0000000..2263811
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_modf.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __modf, modfl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __modf, modfl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nan.c b/sysdeps/ieee754/ldbl-opt/s_nan.c
new file mode 100644
index 0000000..418aad2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_nan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nan, nanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nanl.c b/sysdeps/ieee754/ldbl-opt/s_nanl.c
new file mode 100644
index 0000000..9496e0b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_nanl.c>
+long_double_symbol (libm, __nanl, nanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_nearbyint.c b/sysdeps/ieee754/ldbl-opt/s_nearbyint.c
new file mode 100644
index 0000000..a8b7973
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nearbyint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_nearbyint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nextafter.c b/sysdeps/ieee754/ldbl-opt/s_nextafter.c
new file mode 100644
index 0000000..78e2c0f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nextafter.c
@@ -0,0 +1,12 @@
+#include <math_ldbl_opt.h>
+#include <math/s_nextafter.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nextafter, nextafterl, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+strong_alias (__nextafter, __nexttowardd)
+strong_alias (__nextafter, __nexttowardld)
+#undef nexttoward
+compat_symbol (libm, __nexttowardd, nexttoward, GLIBC_2_1);
+compat_symbol (libm, __nexttowardld, nexttowardl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
new file mode 100644
index 0000000..68027f2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
@@ -0,0 +1,85 @@
+/* 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
+ * __nexttowardfd(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * This is for machines which use different binary type for double and
+ * long double conditionally, y is long double equal to double.
+ * Special cases:
+ */
+
+#include <math.h>
+#include <math_private.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+
+float __nldbl_nexttowardf(float x, double y);
+
+float __nldbl_nexttowardf(float x, double y)
+{
+ 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((double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float u;
+ SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ 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) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "+m"(x));
+ return x;
+ }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nldbl_nexttowardf, nexttowardf, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_remquo.c b/sysdeps/ieee754/ldbl-opt/s_remquo.c
new file mode 100644
index 0000000..9f3d7ba
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_remquo.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_remquo.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __remquo, remquol, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_rint.c b/sysdeps/ieee754/ldbl-opt/s_rint.c
new file mode 100644
index 0000000..d9b156e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_rint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_rint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_round.c b/sysdeps/ieee754/ldbl-opt/s_round.c
new file mode 100644
index 0000000..edff2f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_round.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_round.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_scalbln.c b/sysdeps/ieee754/ldbl-opt/s_scalbln.c
new file mode 100644
index 0000000..2398bba
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_scalbln.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_scalbln.c>
+#ifdef IS_IN_libm
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __scalbln, scalblnl, GLIBC_2_1);
+#endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+compat_symbol (libc, __scalbln, scalblnl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_scalbn.c b/sysdeps/ieee754/ldbl-opt/s_scalbn.c
new file mode 100644
index 0000000..094735e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_scalbn.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_scalbn.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __scalbn, scalbnl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __scalbn, scalbnl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_significand.c b/sysdeps/ieee754/ldbl-opt/s_significand.c
new file mode 100644
index 0000000..5287c09
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_significand.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_significand.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __significand, significandl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_significandl.c b/sysdeps/ieee754/ldbl-opt/s_significandl.c
new file mode 100644
index 0000000..9339b47
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_significandl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_significandl.c>
+long_double_symbol (libm, __significandl, significandl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_sin.c b/sysdeps/ieee754/ldbl-opt/s_sin.c
new file mode 100644
index 0000000..a11d5a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_sin.c
@@ -0,0 +1,10 @@
+/* dbl-64/s_sin.c uses NAN and sincos identifiers internally. */
+#define sincos sincos_disable
+#include <math_ldbl_opt.h>
+#undef NAN
+#undef sincos
+#include <sysdeps/ieee754/dbl-64/s_sin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sin, sinl, GLIBC_2_0);
+compat_symbol (libm, __cos, cosl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_sincos.c b/sysdeps/ieee754/ldbl-opt/s_sincos.c
new file mode 100644
index 0000000..6d2a48f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_sincos.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_sincos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __sincos, sincosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_tan.c b/sysdeps/ieee754/ldbl-opt/s_tan.c
new file mode 100644
index 0000000..6b0fec0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_tan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_tan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, tan, tanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_tanh.c b/sysdeps/ieee754/ldbl-opt/s_tanh.c
new file mode 100644
index 0000000..e763bbd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_tanh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_tanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __tanh, tanhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_trunc.c b/sysdeps/ieee754/ldbl-opt/s_trunc.c
new file mode 100644
index 0000000..9d90a2b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_trunc.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_trunc.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acos.c b/sysdeps/ieee754/ldbl-opt/w_acos.c
new file mode 100644
index 0000000..2934041
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acos.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_acos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __acos, acosl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosh.c b/sysdeps/ieee754/ldbl-opt/w_acosh.c
new file mode 100644
index 0000000..7f7fa14
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acosh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_acosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __acosh, acoshl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acoshl.c b/sysdeps/ieee754/ldbl-opt/w_acoshl.c
new file mode 100644
index 0000000..6243c2a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acoshl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_acoshl.c>
+long_double_symbol (libm, __acoshl, acoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosl.c b/sysdeps/ieee754/ldbl-opt/w_acosl.c
new file mode 100644
index 0000000..8b6e890
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_acosl.c>
+long_double_symbol (libm, __acosl, acosl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_asin.c b/sysdeps/ieee754/ldbl-opt/w_asin.c
new file mode 100644
index 0000000..5e1d70f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_asin.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_asin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __asin, asinl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_asinl.c b/sysdeps/ieee754/ldbl-opt/w_asinl.c
new file mode 100644
index 0000000..a58a224
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_asinl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_asinl.c>
+long_double_symbol (libm, __asinl, asinl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2.c b/sysdeps/ieee754/ldbl-opt/w_atan2.c
new file mode 100644
index 0000000..f1d1501
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_atan2.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __atan2, atan2l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2l.c b/sysdeps/ieee754/ldbl-opt/w_atan2l.c
new file mode 100644
index 0000000..01431ef
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_atan2l.c>
+long_double_symbol (libm, __atan2l, atan2l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanh.c b/sysdeps/ieee754/ldbl-opt/w_atanh.c
new file mode 100644
index 0000000..b4cab87
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atanh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_atanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __atanh, atanhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanhl.c b/sysdeps/ieee754/ldbl-opt/w_atanhl.c
new file mode 100644
index 0000000..0dbc114
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atanhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_atanhl.c>
+long_double_symbol (libm, __atanhl, atanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_cosh.c b/sysdeps/ieee754/ldbl-opt/w_cosh.c
new file mode 100644
index 0000000..a6f56cf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_cosh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_cosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __cosh, coshl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_coshl.c b/sysdeps/ieee754/ldbl-opt/w_coshl.c
new file mode 100644
index 0000000..8c7dccb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_coshl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_coshl.c>
+long_double_symbol (libm, __coshl, coshl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_drem.c b/sysdeps/ieee754/ldbl-opt/w_drem.c
new file mode 100644
index 0000000..788a5d2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_drem.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_drem.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __drem, dreml, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_dreml.c b/sysdeps/ieee754/ldbl-opt/w_dreml.c
new file mode 100644
index 0000000..d14d7e2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_dreml.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_dreml.c>
+long_double_symbol (libm, __dreml, dreml);
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp.c b/sysdeps/ieee754/ldbl-opt/w_exp.c
new file mode 100644
index 0000000..61fcfcc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/w_exp.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __exp, expl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10.c b/sysdeps/ieee754/ldbl-opt/w_exp10.c
new file mode 100644
index 0000000..990c48e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_exp10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __exp10, exp10l, GLIBC_2_1);
+compat_symbol (libm, __pow10, pow10l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10l.c b/sysdeps/ieee754/ldbl-opt/w_exp10l.c
new file mode 100644
index 0000000..e06dfb5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_exp10l.c>
+long_double_symbol (libm, __exp10l, exp10l);
+long_double_symbol (libm, __pow10l, pow10l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmod.c b/sysdeps/ieee754/ldbl-opt/w_fmod.c
new file mode 100644
index 0000000..81ad505
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_fmod.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_fmod.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fmod, fmodl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmodl.c b/sysdeps/ieee754/ldbl-opt/w_fmodl.c
new file mode 100644
index 0000000..2a534a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_fmodl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_fmodl.c>
+long_double_symbol (libm, __fmodl, fmodl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypot.c b/sysdeps/ieee754/ldbl-opt/w_hypot.c
new file mode 100644
index 0000000..e1cf1ff
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_hypot.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_hypot.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __hypot, hypotl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypotl.c b/sysdeps/ieee754/ldbl-opt/w_hypotl.c
new file mode 100644
index 0000000..6c46bd4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_hypotl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_hypotl.c>
+long_double_symbol (libm, __hypotl, hypotl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0.c b/sysdeps/ieee754/ldbl-opt/w_j0.c
new file mode 100644
index 0000000..5c78aff
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j0.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_j0.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, j0, j0l, GLIBC_2_0);
+compat_symbol (libm, y0, y0l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0l.c b/sysdeps/ieee754/ldbl-opt/w_j0l.c
new file mode 100644
index 0000000..767a1bc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j0l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_j0l.c>
+long_double_symbol (libm, __j0l, j0l);
+long_double_symbol (libm, __y0l, y0l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1.c b/sysdeps/ieee754/ldbl-opt/w_j1.c
new file mode 100644
index 0000000..ed3dbc0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j1.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_j1.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, j1, j1l, GLIBC_2_0);
+compat_symbol (libm, y1, y1l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1l.c b/sysdeps/ieee754/ldbl-opt/w_j1l.c
new file mode 100644
index 0000000..946c364
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j1l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_j1l.c>
+long_double_symbol (libm, __j1l, j1l);
+long_double_symbol (libm, __y1l, y1l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_jn.c b/sysdeps/ieee754/ldbl-opt/w_jn.c
new file mode 100644
index 0000000..7a7e0d4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_jn.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_jn.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, jn, jnl, GLIBC_2_0);
+compat_symbol (libm, yn, ynl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_jnl.c b/sysdeps/ieee754/ldbl-opt/w_jnl.c
new file mode 100644
index 0000000..5219543
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_jnl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_jnl.c>
+long_double_symbol (libm, __jnl, jnl);
+long_double_symbol (libm, __ynl, ynl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgamma.c b/sysdeps/ieee754/ldbl-opt/w_lgamma.c
new file mode 100644
index 0000000..ef801c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgamma.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_lgamma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lgamma, lgammal, GLIBC_2_0);
+compat_symbol (libm, __gamma, gammal, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c b/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c
new file mode 100644
index 0000000..eeab6a6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_lgamma_r.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lgamma_r, lgammal_r, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal.c b/sysdeps/ieee754/ldbl-opt/w_lgammal.c
new file mode 100644
index 0000000..9de7ec8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_lgammal.c>
+long_double_symbol (libm, __lgammal, lgammal);
+long_double_symbol (libm, __gammal, gammal);
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c b/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c
new file mode 100644
index 0000000..2545975
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_lgammal_r.c>
+long_double_symbol (libm, __lgammal_r, lgammal_r);
diff --git a/sysdeps/ieee754/ldbl-opt/w_log.c b/sysdeps/ieee754/ldbl-opt/w_log.c
new file mode 100644
index 0000000..bde1e31
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log, logl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10.c b/sysdeps/ieee754/ldbl-opt/w_log10.c
new file mode 100644
index 0000000..74e7168
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log10.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log10, log10l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10l.c b/sysdeps/ieee754/ldbl-opt/w_log10l.c
new file mode 100644
index 0000000..9c936e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log10l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_log10l.c>
+long_double_symbol (libm, __log10l, log10l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2.c b/sysdeps/ieee754/ldbl-opt/w_log2.c
new file mode 100644
index 0000000..9b9b45b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log2.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log2.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __log2, log2l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2l.c b/sysdeps/ieee754/ldbl-opt/w_log2l.c
new file mode 100644
index 0000000..c859682
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log2l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_log2l.c>
+long_double_symbol (libm, __log2l, log2l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_logl.c b/sysdeps/ieee754/ldbl-opt/w_logl.c
new file mode 100644
index 0000000..c2354a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_logl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_logl.c>
+long_double_symbol (libm, __logl, logl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_pow.c b/sysdeps/ieee754/ldbl-opt/w_pow.c
new file mode 100644
index 0000000..2d98fb9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_pow.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_pow.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __pow, powl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_powl.c b/sysdeps/ieee754/ldbl-opt/w_powl.c
new file mode 100644
index 0000000..85b8927
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_powl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_powl.c>
+long_double_symbol (libm, __powl, powl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainder.c b/sysdeps/ieee754/ldbl-opt/w_remainder.c
new file mode 100644
index 0000000..94d9893
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_remainder.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_remainder.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __remainder, remainderl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainderl.c b/sysdeps/ieee754/ldbl-opt/w_remainderl.c
new file mode 100644
index 0000000..e450a25
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_remainderl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_remainderl.c>
+long_double_symbol (libm, __remainderl, remainderl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalb.c b/sysdeps/ieee754/ldbl-opt/w_scalb.c
new file mode 100644
index 0000000..e2ac601
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_scalb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_scalb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __scalb, scalbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalbl.c b/sysdeps/ieee754/ldbl-opt/w_scalbl.c
new file mode 100644
index 0000000..f3d3901
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_scalbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_scalbl.c>
+long_double_symbol (libm, __scalbl, scalbl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinh.c b/sysdeps/ieee754/ldbl-opt/w_sinh.c
new file mode 100644
index 0000000..a5400b5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sinh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_sinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sinh, sinhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinhl.c b/sysdeps/ieee754/ldbl-opt/w_sinhl.c
new file mode 100644
index 0000000..b94f4ec
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sinhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_sinhl.c>
+long_double_symbol (libm, __sinhl, sinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrt.c b/sysdeps/ieee754/ldbl-opt/w_sqrt.c
new file mode 100644
index 0000000..ca2ba06
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrt.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_sqrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrtl.c b/sysdeps/ieee754/ldbl-opt/w_sqrtl.c
new file mode 100644
index 0000000..609f5bf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrtl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_sqrtl.c>
+long_double_symbol (libm, __sqrtl, sqrtl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgamma.c b/sysdeps/ieee754/ldbl-opt/w_tgamma.c
new file mode 100644
index 0000000..cce9f34
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_tgamma.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_tgamma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __tgamma, tgammal, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgammal.c b/sysdeps/ieee754/ldbl-opt/w_tgammal.c
new file mode 100644
index 0000000..c3c511d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_tgammal.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_tgammal.c>
+long_double_symbol (libm, __tgammal, tgammal);