From 1077fa4d772832f77a677ce7fb7c2d513b959e3f Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 10 May 2001 00:40:28 +0000 Subject: uClibc now has a math library. muahahahaha! -Erik --- Makefile | 14 +- include/math.h | 796 +++++-- libm/Makefile | 75 + libm/README | 42 + libm/double/Makefile | 115 + libm/double/README.txt | 5845 ++++++++++++++++++++++++++++++++++++++++++++++ libm/double/acosh.c | 167 ++ libm/double/airy.c | 965 ++++++++ libm/double/arcdot.c | 110 + libm/double/asin.c | 324 +++ libm/double/asinh.c | 165 ++ libm/double/atan.c | 393 ++++ libm/double/atanh.c | 156 ++ libm/double/bdtr.c | 263 +++ libm/double/bernum.c | 74 + libm/double/beta.c | 201 ++ libm/double/btdtr.c | 64 + libm/double/cbrt.c | 142 ++ libm/double/chbevl.c | 82 + libm/double/chdtr.c | 200 ++ libm/double/cheby.c | 149 ++ libm/double/clog.c | 1043 +++++++++ libm/double/cmplx.c | 461 ++++ libm/double/coil.c | 63 + libm/double/const.c | 252 ++ libm/double/cosh.c | 83 + libm/double/cpmul.c | 104 + libm/double/dawsn.c | 392 ++++ libm/double/dcalc.c | 1512 ++++++++++++ libm/double/dcalc.h | 77 + libm/double/dtestvec.c | 543 +++++ libm/double/ei.c | 1062 +++++++++ libm/double/eigens.c | 181 ++ libm/double/ellie.c | 148 ++ libm/double/ellik.c | 148 ++ libm/double/ellpe.c | 195 ++ libm/double/ellpj.c | 171 ++ libm/double/ellpk.c | 234 ++ libm/double/eltst.c | 37 + libm/double/euclid.c | 251 ++ libm/double/exp.c | 203 ++ libm/double/exp10.c | 223 ++ libm/double/exp2.c | 183 ++ libm/double/expn.c | 208 ++ libm/double/fabs.c | 56 + libm/double/fac.c | 263 +++ libm/double/fdtr.c | 237 ++ libm/double/fftr.c | 237 ++ libm/double/floor.c | 453 ++++ libm/double/fltest.c | 272 +++ libm/double/fltest2.c | 18 + libm/double/fltest3.c | 259 ++ libm/double/fresnl.c | 515 ++++ libm/double/gamma.c | 685 ++++++ libm/double/gdtr.c | 130 ++ libm/double/gels.c | 232 ++ libm/double/hyp2f1.c | 460 ++++ libm/double/hyperg.c | 386 +++ libm/double/i0.c | 397 ++++ libm/double/i1.c | 402 ++++ libm/double/igam.c | 210 ++ libm/double/igami.c | 187 ++ libm/double/incbet.c | 409 ++++ libm/double/incbi.c | 313 +++ libm/double/isnan.c | 237 ++ libm/double/iv.c | 116 + libm/double/j0.c | 543 +++++ libm/double/j1.c | 515 ++++ libm/double/jn.c | 133 ++ libm/double/jv.c | 884 +++++++ libm/double/k0.c | 333 +++ libm/double/k1.c | 335 +++ libm/double/kn.c | 255 ++ libm/double/kolmogorov.c | 243 ++ libm/double/levnsn.c | 82 + libm/double/log.c | 341 +++ libm/double/log10.c | 250 ++ libm/double/log2.c | 348 +++ libm/double/lrand.c | 86 + libm/double/lsqrt.c | 85 + libm/double/ltstd.c | 469 ++++ libm/double/minv.c | 61 + libm/double/mod2pi.c | 122 + libm/double/monot.c | 308 +++ libm/double/mtherr.c | 102 + libm/double/mtransp.c | 61 + libm/double/mtst.c | 464 ++++ libm/double/nbdtr.c | 222 ++ libm/double/ndtr.c | 481 ++++ libm/double/ndtri.c | 417 ++++ libm/double/paranoia.c | 2156 +++++++++++++++++ libm/double/pdtr.c | 184 ++ libm/double/planck.c | 223 ++ libm/double/polevl.c | 97 + libm/double/polmisc.c | 309 +++ libm/double/polrt.c | 227 ++ libm/double/polylog.c | 467 ++++ libm/double/polyn.c | 471 ++++ libm/double/polyr.c | 533 +++++ libm/double/pow.c | 756 ++++++ libm/double/powi.c | 186 ++ libm/double/psi.c | 201 ++ libm/double/revers.c | 156 ++ libm/double/rgamma.c | 209 ++ libm/double/round.c | 70 + libm/double/setprec.c | 10 + libm/double/shichi.c | 599 +++++ libm/double/sici.c | 675 ++++++ libm/double/simpsn.c | 81 + libm/double/simq.c | 180 ++ libm/double/sin.c | 387 +++ libm/double/sincos.c | 364 +++ libm/double/sindg.c | 308 +++ libm/double/sinh.c | 148 ++ libm/double/spence.c | 205 ++ libm/double/sqrt.c | 178 ++ libm/double/stdtr.c | 225 ++ libm/double/struve.c | 312 +++ libm/double/tan.c | 304 +++ libm/double/tandg.c | 267 +++ libm/double/tanh.c | 141 ++ libm/double/time-it.c | 38 + libm/double/unity.c | 138 ++ libm/double/yn.c | 114 + libm/double/zeta.c | 189 ++ libm/double/zetac.c | 599 +++++ libm/float/Makefile | 62 + libm/float/README.txt | 4721 +++++++++++++++++++++++++++++++++++++ libm/float/acoshf.c | 97 + libm/float/airyf.c | 377 +++ libm/float/asinf.c | 186 ++ libm/float/asinhf.c | 88 + libm/float/atanf.c | 190 ++ libm/float/atanhf.c | 92 + libm/float/bdtrf.c | 247 ++ libm/float/betaf.c | 122 + libm/float/cbrtf.c | 119 + libm/float/chbevlf.c | 86 + libm/float/chdtrf.c | 210 ++ libm/float/clogf.c | 669 ++++++ libm/float/cmplxf.c | 407 ++++ libm/float/constf.c | 20 + libm/float/coshf.c | 67 + libm/float/dawsnf.c | 168 ++ libm/float/ellief.c | 115 + libm/float/ellikf.c | 113 + libm/float/ellpef.c | 105 + libm/float/ellpjf.c | 161 ++ libm/float/ellpkf.c | 128 + libm/float/exp10f.c | 115 + libm/float/exp2f.c | 116 + libm/float/expf.c | 122 + libm/float/expnf.c | 207 ++ libm/float/facf.c | 106 + libm/float/fdtrf.c | 214 ++ libm/float/floorf.c | 526 +++++ libm/float/fresnlf.c | 173 ++ libm/float/gammaf.c | 423 ++++ libm/float/gdtrf.c | 144 ++ libm/float/hyp2f1f.c | 442 ++++ libm/float/hypergf.c | 384 +++ libm/float/i0f.c | 160 ++ libm/float/i1f.c | 177 ++ libm/float/igamf.c | 223 ++ libm/float/igamif.c | 112 + libm/float/incbetf.c | 424 ++++ libm/float/incbif.c | 197 ++ libm/float/ivf.c | 114 + libm/float/j0f.c | 228 ++ libm/float/j0tst.c | 43 + libm/float/j1f.c | 211 ++ libm/float/jnf.c | 124 + libm/float/jvf.c | 848 +++++++ libm/float/k0f.c | 175 ++ libm/float/k1f.c | 174 ++ libm/float/knf.c | 252 ++ libm/float/log10f.c | 129 + libm/float/log2f.c | 129 + libm/float/logf.c | 128 + libm/float/mtherr.c | 99 + libm/float/nantst.c | 54 + libm/float/nbdtrf.c | 141 ++ libm/float/ndtrf.c | 281 +++ libm/float/ndtrif.c | 186 ++ libm/float/pdtrf.c | 188 ++ libm/float/polevlf.c | 99 + libm/float/polynf.c | 520 +++++ libm/float/powf.c | 338 +++ libm/float/powif.c | 156 ++ libm/float/powtst.c | 41 + libm/float/psif.c | 153 ++ libm/float/rgammaf.c | 130 ++ libm/float/setprec.c | 10 + libm/float/shichif.c | 212 ++ libm/float/sicif.c | 279 +++ libm/float/sindgf.c | 232 ++ libm/float/sinf.c | 283 +++ libm/float/sinhf.c | 87 + libm/float/spencef.c | 135 ++ libm/float/sqrtf.c | 140 ++ libm/float/stdtrf.c | 154 ++ libm/float/struvef.c | 315 +++ libm/float/tandgf.c | 206 ++ libm/float/tanf.c | 192 ++ libm/float/tanhf.c | 88 + libm/float/ynf.c | 120 + libm/float/zetacf.c | 266 +++ libm/float/zetaf.c | 175 ++ libm/ldouble/Makefile | 123 + libm/ldouble/README.txt | 3502 +++++++++++++++++++++++++++ libm/ldouble/acoshl.c | 167 ++ libm/ldouble/arcdotl.c | 108 + libm/ldouble/asinhl.c | 156 ++ libm/ldouble/asinl.c | 249 ++ libm/ldouble/atanhl.c | 163 ++ libm/ldouble/atanl.c | 376 +++ libm/ldouble/bdtrl.c | 260 +++ libm/ldouble/btdtrl.c | 68 + libm/ldouble/cbrtl.c | 143 ++ libm/ldouble/chdtrl.c | 200 ++ libm/ldouble/clogl.c | 720 ++++++ libm/ldouble/cmplxl.c | 461 ++++ libm/ldouble/coshl.c | 89 + libm/ldouble/econst.c | 96 + libm/ldouble/ehead.h | 45 + libm/ldouble/elliel.c | 146 ++ libm/ldouble/ellikl.c | 148 ++ libm/ldouble/ellpel.c | 173 ++ libm/ldouble/ellpjl.c | 164 ++ libm/ldouble/ellpkl.c | 203 ++ libm/ldouble/exp10l.c | 192 ++ libm/ldouble/exp2l.c | 166 ++ libm/ldouble/expl.c | 183 ++ libm/ldouble/fdtrl.c | 237 ++ libm/ldouble/floorl.c | 432 ++++ libm/ldouble/flrtstl.c | 104 + libm/ldouble/fltestl.c | 265 +++ libm/ldouble/gammal.c | 764 ++++++ libm/ldouble/gdtrl.c | 130 ++ libm/ldouble/gelsl.c | 240 ++ libm/ldouble/ieee.c | 4182 +++++++++++++++++++++++++++++++++ libm/ldouble/igamil.c | 193 ++ libm/ldouble/igaml.c | 220 ++ libm/ldouble/incbetl.c | 406 ++++ libm/ldouble/incbil.c | 305 +++ libm/ldouble/isnanl.c | 186 ++ libm/ldouble/j0l.c | 541 +++++ libm/ldouble/j1l.c | 551 +++++ libm/ldouble/jnl.c | 130 ++ libm/ldouble/lcalc.c | 1484 ++++++++++++ libm/ldouble/lcalc.h | 79 + libm/ldouble/ldrand.c | 175 ++ libm/ldouble/log10l.c | 319 +++ libm/ldouble/log2l.c | 302 +++ libm/ldouble/logl.c | 292 +++ libm/ldouble/lparanoi.c | 2348 +++++++++++++++++++ libm/ldouble/monotl.c | 307 +++ libm/ldouble/mtherr.c | 102 + libm/ldouble/mtstl.c | 521 +++++ libm/ldouble/nantst.c | 61 + libm/ldouble/nbdtrl.c | 197 ++ libm/ldouble/ndtril.c | 416 ++++ libm/ldouble/ndtrl.c | 473 ++++ libm/ldouble/pdtrl.c | 184 ++ libm/ldouble/polevll.c | 182 ++ libm/ldouble/powil.c | 164 ++ libm/ldouble/powl.c | 739 ++++++ libm/ldouble/sinhl.c | 150 ++ libm/ldouble/sinl.c | 342 +++ libm/ldouble/sqrtl.c | 172 ++ libm/ldouble/stdtrl.c | 225 ++ libm/ldouble/tanhl.c | 129 + libm/ldouble/tanl.c | 279 +++ libm/ldouble/testvect.c | 497 ++++ libm/ldouble/unityl.c | 128 + libm/ldouble/wronkl.c | 67 + libm/ldouble/ynl.c | 113 + 277 files changed, 91551 insertions(+), 170 deletions(-) create mode 100644 libm/Makefile create mode 100644 libm/README create mode 100644 libm/double/Makefile create mode 100644 libm/double/README.txt create mode 100644 libm/double/acosh.c create mode 100644 libm/double/airy.c create mode 100644 libm/double/arcdot.c create mode 100644 libm/double/asin.c create mode 100644 libm/double/asinh.c create mode 100644 libm/double/atan.c create mode 100644 libm/double/atanh.c create mode 100644 libm/double/bdtr.c create mode 100644 libm/double/bernum.c create mode 100644 libm/double/beta.c create mode 100644 libm/double/btdtr.c create mode 100644 libm/double/cbrt.c create mode 100644 libm/double/chbevl.c create mode 100644 libm/double/chdtr.c create mode 100644 libm/double/cheby.c create mode 100644 libm/double/clog.c create mode 100644 libm/double/cmplx.c create mode 100644 libm/double/coil.c create mode 100644 libm/double/const.c create mode 100644 libm/double/cosh.c create mode 100644 libm/double/cpmul.c create mode 100644 libm/double/dawsn.c create mode 100644 libm/double/dcalc.c create mode 100644 libm/double/dcalc.h create mode 100644 libm/double/dtestvec.c create mode 100644 libm/double/ei.c create mode 100644 libm/double/eigens.c create mode 100644 libm/double/ellie.c create mode 100644 libm/double/ellik.c create mode 100644 libm/double/ellpe.c create mode 100644 libm/double/ellpj.c create mode 100644 libm/double/ellpk.c create mode 100644 libm/double/eltst.c create mode 100644 libm/double/euclid.c create mode 100644 libm/double/exp.c create mode 100644 libm/double/exp10.c create mode 100644 libm/double/exp2.c create mode 100644 libm/double/expn.c create mode 100644 libm/double/fabs.c create mode 100644 libm/double/fac.c create mode 100644 libm/double/fdtr.c create mode 100644 libm/double/fftr.c create mode 100644 libm/double/floor.c create mode 100644 libm/double/fltest.c create mode 100644 libm/double/fltest2.c create mode 100644 libm/double/fltest3.c create mode 100644 libm/double/fresnl.c create mode 100644 libm/double/gamma.c create mode 100644 libm/double/gdtr.c create mode 100644 libm/double/gels.c create mode 100644 libm/double/hyp2f1.c create mode 100644 libm/double/hyperg.c create mode 100644 libm/double/i0.c create mode 100644 libm/double/i1.c create mode 100644 libm/double/igam.c create mode 100644 libm/double/igami.c create mode 100644 libm/double/incbet.c create mode 100644 libm/double/incbi.c create mode 100644 libm/double/isnan.c create mode 100644 libm/double/iv.c create mode 100644 libm/double/j0.c create mode 100644 libm/double/j1.c create mode 100644 libm/double/jn.c create mode 100644 libm/double/jv.c create mode 100644 libm/double/k0.c create mode 100644 libm/double/k1.c create mode 100644 libm/double/kn.c create mode 100644 libm/double/kolmogorov.c create mode 100644 libm/double/levnsn.c create mode 100644 libm/double/log.c create mode 100644 libm/double/log10.c create mode 100644 libm/double/log2.c create mode 100644 libm/double/lrand.c create mode 100644 libm/double/lsqrt.c create mode 100644 libm/double/ltstd.c create mode 100644 libm/double/minv.c create mode 100644 libm/double/mod2pi.c create mode 100644 libm/double/monot.c create mode 100644 libm/double/mtherr.c create mode 100644 libm/double/mtransp.c create mode 100644 libm/double/mtst.c create mode 100644 libm/double/nbdtr.c create mode 100644 libm/double/ndtr.c create mode 100644 libm/double/ndtri.c create mode 100644 libm/double/paranoia.c create mode 100644 libm/double/pdtr.c create mode 100644 libm/double/planck.c create mode 100644 libm/double/polevl.c create mode 100644 libm/double/polmisc.c create mode 100644 libm/double/polrt.c create mode 100644 libm/double/polylog.c create mode 100644 libm/double/polyn.c create mode 100644 libm/double/polyr.c create mode 100644 libm/double/pow.c create mode 100644 libm/double/powi.c create mode 100644 libm/double/psi.c create mode 100644 libm/double/revers.c create mode 100644 libm/double/rgamma.c create mode 100644 libm/double/round.c create mode 100644 libm/double/setprec.c create mode 100644 libm/double/shichi.c create mode 100644 libm/double/sici.c create mode 100644 libm/double/simpsn.c create mode 100644 libm/double/simq.c create mode 100644 libm/double/sin.c create mode 100644 libm/double/sincos.c create mode 100644 libm/double/sindg.c create mode 100644 libm/double/sinh.c create mode 100644 libm/double/spence.c create mode 100644 libm/double/sqrt.c create mode 100644 libm/double/stdtr.c create mode 100644 libm/double/struve.c create mode 100644 libm/double/tan.c create mode 100644 libm/double/tandg.c create mode 100644 libm/double/tanh.c create mode 100644 libm/double/time-it.c create mode 100644 libm/double/unity.c create mode 100644 libm/double/yn.c create mode 100644 libm/double/zeta.c create mode 100644 libm/double/zetac.c create mode 100644 libm/float/Makefile create mode 100644 libm/float/README.txt create mode 100644 libm/float/acoshf.c create mode 100644 libm/float/airyf.c create mode 100644 libm/float/asinf.c create mode 100644 libm/float/asinhf.c create mode 100644 libm/float/atanf.c create mode 100644 libm/float/atanhf.c create mode 100644 libm/float/bdtrf.c create mode 100644 libm/float/betaf.c create mode 100644 libm/float/cbrtf.c create mode 100644 libm/float/chbevlf.c create mode 100644 libm/float/chdtrf.c create mode 100644 libm/float/clogf.c create mode 100644 libm/float/cmplxf.c create mode 100644 libm/float/constf.c create mode 100644 libm/float/coshf.c create mode 100644 libm/float/dawsnf.c create mode 100644 libm/float/ellief.c create mode 100644 libm/float/ellikf.c create mode 100644 libm/float/ellpef.c create mode 100644 libm/float/ellpjf.c create mode 100644 libm/float/ellpkf.c create mode 100644 libm/float/exp10f.c create mode 100644 libm/float/exp2f.c create mode 100644 libm/float/expf.c create mode 100644 libm/float/expnf.c create mode 100644 libm/float/facf.c create mode 100644 libm/float/fdtrf.c create mode 100644 libm/float/floorf.c create mode 100644 libm/float/fresnlf.c create mode 100644 libm/float/gammaf.c create mode 100644 libm/float/gdtrf.c create mode 100644 libm/float/hyp2f1f.c create mode 100644 libm/float/hypergf.c create mode 100644 libm/float/i0f.c create mode 100644 libm/float/i1f.c create mode 100644 libm/float/igamf.c create mode 100644 libm/float/igamif.c create mode 100644 libm/float/incbetf.c create mode 100644 libm/float/incbif.c create mode 100644 libm/float/ivf.c create mode 100644 libm/float/j0f.c create mode 100644 libm/float/j0tst.c create mode 100644 libm/float/j1f.c create mode 100644 libm/float/jnf.c create mode 100644 libm/float/jvf.c create mode 100644 libm/float/k0f.c create mode 100644 libm/float/k1f.c create mode 100644 libm/float/knf.c create mode 100644 libm/float/log10f.c create mode 100644 libm/float/log2f.c create mode 100644 libm/float/logf.c create mode 100644 libm/float/mtherr.c create mode 100644 libm/float/nantst.c create mode 100644 libm/float/nbdtrf.c create mode 100644 libm/float/ndtrf.c create mode 100644 libm/float/ndtrif.c create mode 100644 libm/float/pdtrf.c create mode 100644 libm/float/polevlf.c create mode 100644 libm/float/polynf.c create mode 100644 libm/float/powf.c create mode 100644 libm/float/powif.c create mode 100644 libm/float/powtst.c create mode 100644 libm/float/psif.c create mode 100644 libm/float/rgammaf.c create mode 100644 libm/float/setprec.c create mode 100644 libm/float/shichif.c create mode 100644 libm/float/sicif.c create mode 100644 libm/float/sindgf.c create mode 100644 libm/float/sinf.c create mode 100644 libm/float/sinhf.c create mode 100644 libm/float/spencef.c create mode 100644 libm/float/sqrtf.c create mode 100644 libm/float/stdtrf.c create mode 100644 libm/float/struvef.c create mode 100644 libm/float/tandgf.c create mode 100644 libm/float/tanf.c create mode 100644 libm/float/tanhf.c create mode 100644 libm/float/ynf.c create mode 100644 libm/float/zetacf.c create mode 100644 libm/float/zetaf.c create mode 100644 libm/ldouble/Makefile create mode 100644 libm/ldouble/README.txt create mode 100644 libm/ldouble/acoshl.c create mode 100644 libm/ldouble/arcdotl.c create mode 100644 libm/ldouble/asinhl.c create mode 100644 libm/ldouble/asinl.c create mode 100644 libm/ldouble/atanhl.c create mode 100644 libm/ldouble/atanl.c create mode 100644 libm/ldouble/bdtrl.c create mode 100644 libm/ldouble/btdtrl.c create mode 100644 libm/ldouble/cbrtl.c create mode 100644 libm/ldouble/chdtrl.c create mode 100644 libm/ldouble/clogl.c create mode 100644 libm/ldouble/cmplxl.c create mode 100644 libm/ldouble/coshl.c create mode 100644 libm/ldouble/econst.c create mode 100644 libm/ldouble/ehead.h create mode 100644 libm/ldouble/elliel.c create mode 100644 libm/ldouble/ellikl.c create mode 100644 libm/ldouble/ellpel.c create mode 100644 libm/ldouble/ellpjl.c create mode 100644 libm/ldouble/ellpkl.c create mode 100644 libm/ldouble/exp10l.c create mode 100644 libm/ldouble/exp2l.c create mode 100644 libm/ldouble/expl.c create mode 100644 libm/ldouble/fdtrl.c create mode 100644 libm/ldouble/floorl.c create mode 100644 libm/ldouble/flrtstl.c create mode 100644 libm/ldouble/fltestl.c create mode 100644 libm/ldouble/gammal.c create mode 100644 libm/ldouble/gdtrl.c create mode 100644 libm/ldouble/gelsl.c create mode 100644 libm/ldouble/ieee.c create mode 100644 libm/ldouble/igamil.c create mode 100644 libm/ldouble/igaml.c create mode 100644 libm/ldouble/incbetl.c create mode 100644 libm/ldouble/incbil.c create mode 100644 libm/ldouble/isnanl.c create mode 100644 libm/ldouble/j0l.c create mode 100644 libm/ldouble/j1l.c create mode 100644 libm/ldouble/jnl.c create mode 100644 libm/ldouble/lcalc.c create mode 100644 libm/ldouble/lcalc.h create mode 100644 libm/ldouble/ldrand.c create mode 100644 libm/ldouble/log10l.c create mode 100644 libm/ldouble/log2l.c create mode 100644 libm/ldouble/logl.c create mode 100644 libm/ldouble/lparanoi.c create mode 100644 libm/ldouble/monotl.c create mode 100644 libm/ldouble/mtherr.c create mode 100644 libm/ldouble/mtstl.c create mode 100644 libm/ldouble/nantst.c create mode 100644 libm/ldouble/nbdtrl.c create mode 100644 libm/ldouble/ndtril.c create mode 100644 libm/ldouble/ndtrl.c create mode 100644 libm/ldouble/pdtrl.c create mode 100644 libm/ldouble/polevll.c create mode 100644 libm/ldouble/powil.c create mode 100644 libm/ldouble/powl.c create mode 100644 libm/ldouble/sinhl.c create mode 100644 libm/ldouble/sinl.c create mode 100644 libm/ldouble/sqrtl.c create mode 100644 libm/ldouble/stdtrl.c create mode 100644 libm/ldouble/tanhl.c create mode 100644 libm/ldouble/tanl.c create mode 100644 libm/ldouble/testvect.c create mode 100644 libm/ldouble/unityl.c create mode 100644 libm/ldouble/wronkl.c create mode 100644 libm/ldouble/ynl.c diff --git a/Makefile b/Makefile index 5ccc78a42..7368b4410 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ TOPDIR=./ include Rules.mak -DIRS = extra misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd crypt libutil +DIRS = extra misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd crypt libutil libm ifeq ($(strip $(HAS_MMU)),true) DO_SHARED=shared @@ -60,6 +60,7 @@ shared: $(LIBNAME) ln -sf $(SHARED_MAJORNAME) libc.so @$(MAKE) -C crypt shared @$(MAKE) -C libutil shared + @$(MAKE) -C libm shared @$(MAKE) -C ld.so-1 done: $(LIBNAME) $(DO_SHARED) @@ -116,6 +117,7 @@ install: install_runtime install_dev install_ldso install_runtime: @$(MAKE) -C crypt install @$(MAKE) -C libutil install + @$(MAKE) -C libm install ifneq ($(DO_SHARED),) install -d $(INSTALL_DIR)/lib rm -rf $(INSTALL_DIR)/lib/$(SHARED_FULLNAME) @@ -180,6 +182,16 @@ uClibc_config.h: Config else \ echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \ fi + @if [ "$(HAS_DOUBLE)" = "true" ] ; then \ + echo "#define __UCLIBC_HAS_DOUBLE__ 1" >> uClibc_config.h ; \ + else \ + echo "#undef __UCLIBC_HAS_DOUBLE__" >> uClibc_config.h ; \ + fi + @if [ "$(HAS_LONG_DOUBLE)" = "true" ] ; then \ + echo "#define __UCLIBC_HAS_LONG_DOUBLE__ 1" >> uClibc_config.h ; \ + else \ + echo "#undef __UCLIBC_HAS_LONG_DOUBLE__" >> uClibc_config.h ; \ + fi @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \ echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \ else \ diff --git a/include/math.h b/include/math.h index ab74e5ee8..853d71368 100644 --- a/include/math.h +++ b/include/math.h @@ -1,176 +1,634 @@ -#ifndef _MATH_H -#define _MATH_H -/* - * This file was automatically generated by version 1.7 of cextract. - * Manual editing not recommended. +/* mconf.h + * + * ISO/IEC 9899:1999 -- Programming Languages C: 7.12 Mathematics + * Derived from the Cephes Math Library Release 2.3 + * Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier * - * Created: Fri Feb 23 20:31:13 1996 * - * Modified (anyway) for PalmOS Feb 22, 1997, D.Jeff Dionne + * DESCRIPTION: + * + * The file also includes a conditional assembly definition + * for the type of computer arithmetic (IEEE, DEC, Motorola + * IEEE, or UNKnown). + * + * For Digital Equipment PDP-11 and VAX computers, certain + * IBM systems, and others that use numbers with a 56-bit + * significand, the symbol DEC should be defined. In this + * mode, most floating point constants are given as arrays + * of octal integers to eliminate decimal to binary conversion + * errors that might be introduced by the compiler. + * + * For little-endian computers, such as IBM PC, that follow the + * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE + * Std 754-1985), the symbol IBMPC should be defined. These + * numbers have 53-bit significands. In this mode, constants + * are provided as arrays of hexadecimal 16 bit integers. + * + * Big-endian IEEE format is denoted MIEEE. On some RISC + * systems such as Sun SPARC, double precision constants + * must be stored on 8-byte address boundaries. Since integer + * arrays may be aligned differently, the MIEEE configuration + * may fail on such machines. + * + * To accommodate other types of computer arithmetic, all + * constants are also provided in a normal decimal radix + * which one can hope are correctly converted to a suitable + * format by the available C language compiler. To invoke + * this mode, define the symbol UNK. + * + * An important difference among these modes is a predefined + * set of machine arithmetic constants for each. The numbers + * MACHEP (the machine roundoff error), MAXNUM (largest number + * represented), and several other parameters are preset by + * the configuration symbol. Check the file const.c to + * ensure that these values are correct for your computer. + * + * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL + * may fail on many systems. Verify that they are supposed + * to work on your computer. + */ + + +#ifndef _MATH_H +#define _MATH_H 1 + +#include + +#ifndef __UCLIBC_HAS_FLOATS__ + #define float int +#endif +#ifndef __UCLIBC_HAS_DOUBLE__ + #define double int +#endif +#ifndef __UCLIBC_HAS_LONG_DOUBLE__ + #define long + #ifndef double + # define double int + #endif +#endif + +/* Type of computer arithmetic */ + +/* PDP-11, Pro350, VAX: + */ +/* #define DEC 1 */ + +/* Intel IEEE, low order words come first: + */ +/* #define IBMPC 1 */ + +/* Motorola IEEE, high order words come first + * (Sun 680x0 workstation): + */ +/* #define MIEEE 1 */ + +/* UNKnown arithmetic, invokes coefficients given in + * normal decimal format. Beware of range boundary + * problems (MACHEP, MAXLOG, etc. in const.c) and + * roundoff problems in pow.c: + * (Sun SPARCstation) + */ +#define UNK 1 + + +/* Define if the `long double' type works. */ +#define HAVE_LONG_DOUBLE 1 + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define if floating point words are bigendian. */ +/* #undef FLOAT_WORDS_BIGENDIAN */ + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + + +/* Define this `volatile' if your compiler thinks + * that floating point arithmetic obeys the associative + * and distributive laws. It will defeat some optimizations + * (but probably not enough of them). + * + * #define VOLATILE volatile + */ +#define VOLATILE + +/* For 12-byte long doubles on an i386, pad a 16-bit short 0 + * to the end of real constants initialized by integer arrays. + * + * #define XPD 0, + * + * Otherwise, the type is 10 bytes long and XPD should be + * defined blank (e.g., Microsoft C). + * + * #define XPD */ +#define XPD 0, + +/* Define to support tiny denormal numbers, else undefine. */ +#define DENORMAL 1 + +/* Define to ask for infinity support, else undefine. */ +#define INFINITIES 1 + +/* Define to ask for support of numbers that are Not-a-Number, + else undefine. This may automatically define INFINITIES in some files. */ +#define NANS 1 + +/* Define to distinguish between -0.0 and +0.0. */ +#define MINUSZERO 1 + +/* Define 1 for ANSI C atan2() function + and ANSI prototypes for float arguments. + See atan.c and clog.c. */ +#define ANSIC 1 +#define ANSIPROT 1 + + +/* Constant definitions for math error conditions */ + +#define DOMAIN 1 /* argument domain error */ +#define SING 2 /* argument singularity */ +#define OVERFLOW 3 /* overflow range error */ +#define UNDERFLOW 4 /* underflow range error */ +#define TLOSS 5 /* total loss of precision */ +#define PLOSS 6 /* partial loss of precision */ + +#define EDOM 33 +#define ERANGE 34 + +/* Complex numeral. */ +typedef struct + { + double r; + double i; + } cmplx; + +typedef struct + { + float r; + float i; + } cmplxf; + +#ifdef HAVE_LONG_DOUBLE +/* Long double complex numeral. */ +typedef struct + { + long double r; + long double i; + } cmplxl; +#endif + + + +/* Variable for error reporting. See mtherr.c. */ +extern int mtherr(); +extern int merror; + + +/* If you define UNK, then be sure to set BIGENDIAN properly. */ +#include +#if __BYTE_ORDER == __BIG_ENDIAN +# define BIGENDIAN 1 +#else /* __BYTE_ORDER == __LITTLE_ENDIAN */ +# define BIGENDIAN 0 +#endif + + +#define __USE_ISOC9X +/* Get general and ISO C 9X specific information. */ +#include +#undef INFINITY +#undef DECIMAL_DIG +#undef FP_ILOGB0 +#undef FP_ILOGBNAN + +/* Get the architecture specific values describing the floating-point + evaluation. The following symbols will get defined: + + float_t floating-point type at least as wide as `float' used + to evaluate `float' expressions + double_t floating-point type at least as wide as `double' used + to evaluate `double' expressions + + FLT_EVAL_METHOD + Defined to + 0 if `float_t' is `float' and `double_t' is `double' + 1 if `float_t' and `double_t' are `double' + 2 if `float_t' and `double_t' are `long double' + else `float_t' and `double_t' are unspecified + + INFINITY representation of the infinity value of type `float' + + FP_FAST_FMA + FP_FAST_FMAF + FP_FAST_FMAL + If defined it indicates that the `fma' function + generally executes about as fast as a multiply and an add. + This macro is defined only iff the `fma' function is + implemented directly with a hardware multiply-add instructions. + + FP_ILOGB0 Expands to a value returned by `ilogb (0.0)'. + FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'. + + DECIMAL_DIG Number of decimal digits supported by conversion between + decimal and all internal floating-point formats. + +*/ + +/* All floating-point numbers can be put in one of these categories. */ +enum + { + FP_NAN, +# define FP_NAN FP_NAN + FP_INFINITE, +# define FP_INFINITE FP_INFINITE + FP_ZERO, +# define FP_ZERO FP_ZERO + FP_SUBNORMAL, +# define FP_SUBNORMAL FP_SUBNORMAL + FP_NORMAL +# define FP_NORMAL FP_NORMAL + }; + +/* Return number of classification appropriate for X. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define fpclassify(x) \ + (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x)) +# else +# define fpclassify(x) \ + (sizeof (x) == sizeof (float) ? \ + __fpclassifyf (x) \ + : sizeof (x) == sizeof (double) ? \ + __fpclassify (x) : __fpclassifyl (x)) +# endif + +/* Return nonzero value if sign of X is negative. */ +int signbit(double x); +int signbitl(long double x); + +/* Return nonzero value if X is not +-Inf or NaN. */ +int isfinite(double x); +int isfinitel(long double x); + +/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */ +# define isnormal(x) (fpclassify (x) == FP_NORMAL) + +/* Return nonzero value if X is a NaN */ +int isnan(double x); +int isnanl(long double x); + +/* Return nonzero value is X is positive or negative infinity. */ +# ifdef __NO_LONG_DOUBLE_MATH +# define isinf(x) \ + (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) +# else +# define isinf(x) \ + (sizeof (x) == sizeof (float) ? \ + __isinff (x) \ + : sizeof (x) == sizeof (double) ? \ + __isinf (x) : __isinfl (x)) +# endif + -typedef struct { - double r; - double i; -}cmplxf; /* Some useful constants. */ -#define M_E 2.7182818284590452354 /* e */ -#define M_LOG2E 1.4426950408889634074 /* log_2 e */ -#define M_LOG10E 0.43429448190325182765 /* log_10 e */ -#define M_LN2 0.69314718055994530942 /* log_e 2 */ -#define M_LN10 2.30258509299404568402 /* log_e 10 */ -#define M_PI 3.14159265358979323846 /* pi */ -#define M_PI_2 1.57079632679489661923 /* pi/2 */ -#define M_PI_4 0.78539816339744830962 /* pi/4 */ -#define M_1_PI 0.31830988618379067154 /* 1/pi */ -#define M_2_PI 0.63661977236758134308 /* 2/pi */ -#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ -#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ - - -extern double acos ( double x ); -extern double acosh ( double xx ); -extern int airy ( double xx, double *ai, double *aip, double *bi, double *bip ); -extern double asin ( double xx ); -extern double asinh ( double xx ); -extern double atan2 ( double y, double x ); -extern double atan ( double xx ); -extern double atanh ( double xx ); -extern double bdtrc ( int k, int n, double pp ); -extern double bdtr ( int k, int n, double pp ); -extern double bdtri ( int k, int n, double yy ); -extern double beta ( double aa, double bb ); -extern double cabs ( cmplxf *z ); -extern void cacos ( cmplxf *z, cmplxf *w ); -extern void cadd ( cmplxf *a, cmplxf *b, cmplxf *c ); -extern void casin ( cmplxf *z, cmplxf *w ); -extern void catan ( cmplxf *z, cmplxf *w ); -extern double cbrt ( double xx ); -extern void cchsh ( double xx, double *c, double *s ); -extern void ccos ( cmplxf *z, cmplxf *w ); -extern void ccot ( cmplxf *z, cmplxf *w ); -extern void cdiv ( cmplxf *a, cmplxf *b, cmplxf *c ); -extern double ceil ( double x ); -extern void cexp ( cmplxf *z, cmplxf *w ); -extern double chbevl ( double x, double *array, int n ); -extern double chdtrc ( double dff, double xx ); -extern double chdtr ( double dff, double xx ); -extern double chdtri ( double dff, double yy ); -#if 0 -extern void clog ( cmplxf *z, cmplxf *w ); +#if defined __USE_BSD || defined __USE_XOPEN +# define M_E 2.7182818284590452354 /* e */ +# define M_LOG2E 1.4426950408889634074 /* log_2 e */ +# define M_LOG10E 0.43429448190325182765 /* log_10 e */ +# define M_LN2 0.69314718055994530942 /* log_e 2 */ +# define M_LN10 2.30258509299404568402 /* log_e 10 */ +# define M_PI 3.14159265358979323846 /* pi */ +# define M_PI_2 1.57079632679489661923 /* pi/2 */ +# define M_PI_4 0.78539816339744830962 /* pi/4 */ +# define M_1_PI 0.31830988618379067154 /* 1/pi */ +# define M_2_PI 0.63661977236758134308 /* 2/pi */ +# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif +#ifdef __USE_GNU +# define M_El M_E +# define M_LOG2El M_LOG2E +# define M_LOG10El M_LOG10E +# define M_LN2l M_LN2 +# define M_LN10l M_LN10 +# define M_PIl M_PI +# define M_PI_2l M_PI_2 +# define M_PI_4l M_PI_4 +# define M_1_PIl M_1_PI +# define M_2_PIl M_2_PI +# define M_2_SQRTPIl M_2_SQRTPI +# define M_SQRT2l M_SQRT2 +# define M_SQRT1_2l M_SQRT1_2 +#endif + + + + +/* 7.12.4 Trigonometric functions */ +extern double acos(double x); +extern float acosf(float x); +extern long double acosl(long double x); + +extern double asin(double x); +extern float asinf(float x); +extern long double asinl(long double x); + +extern double atan(double x); +extern float atanf(float x); +extern long double atanl(long double x); + +double atan2(double y, double x); +float atan2f(float y, float x); +long double atan2l(long double y, long double x); + +double cos(double x); +float cosf(float x); +long double cosl(long double x); + +double sin(double x); +float sinf(float x); +long double sinl(long double x); + +double tan(double x); +float tanf(float x); +long double tanl(long double x); + + +/* 7.12.5 Hyperbolic functions */ +double acosh(double x); +float acoshf(float x); +long double acoshl(long double x); + +double asinh(double x); +float asinhf(float x); +long double asinhl(long double x); + +double atanh(double x); +float atanhf(float x); +long double atanhl(long double x); + +double cosh(double x); +float coshf(float x); +long double coshl(long double x); + +double sinh(double x); +float sinhf(float x); +long double sinhl(long double x); + +double tanh(double x); +float tanhf(float x); +long double tanhl(long double x); + + +/* 7.12.6 Exponential and logarithmic functions */ +double exp(double x); +float expf(float x); +long double expl(long double x); + +double exp2(double x); +float exp2f(float x); +long double exp2l(long double x); + +double expm1(double x); +float expm1f(float x); +long double expm1l(long double x); + +double frexp(double value, int *exp); +float frexpf(float value, int *exp); +long double frexpl(long double value, int *exp); + +int ilogb(double x); +int ilogbf(float x); +int ilogbl(long double x); + +double ldexp(double x, int exp); +float ldexpf(float x, int exp); +long double ldexpl(long double x, int exp); + +double log(double x); +float logf(float x); +long double logl(long double x); + +double log10(double x); +float log10f(float x); +long double log10l(long double x); + +double log1p(double x); +float log1pf(float x); +long double log1pl(long double x); + +double log2(double x); +float log2f(float x); +long double log2l(long double x); + +double logb(double x); +float logbf(float x); +long double logbl(long double x); + +double modf(double value, double *iptr); +float modff(float value, float *iptr); +long double modfl(long double value, long double *iptr); + +double scalbn(double x, int n); +float scalbnf(float x, int n); +long double scalbnl(long double x, int n); +double scalbln(double x, long int n); +float scalblnf(float x, long int n); +long double scalblnl(long double x, long int n); + +/* 7.12.7 Power and absolute-value functions */ +double fabs(double x); +float fabsf(float x); +long double fabsl(long double x); + +double hypot(double x, double y); +float hypotf(float x, float y); +long double hypotl(long double x, long double y); + +double pow(double x, double y); +float powf(float x, float y); +long double powl(long double x, long double y); + +double sqrt(double x); +float sqrtf(float x); +long double sqrtl(long double x); + +/* 7.12.8 Error and gamma functions */ +double erf(double x); +float erff(float x); +long double erfl(long double x); + +double erfc(double x); +float erfcf(float x); +long double erfcl(long double x); + +double lgamma(double x); +float lgammaf(float x); +long double lgammal(long double x); + +double tgamma(double x); +float tgammaf(float x); +long double tgammal(long double x); + +/* 7.12.9 Nearest integer functions */ +double ceil(double x); +float ceilf(float x); +long double ceill(long double x); + +double floor(double x); +float floorf(float x); +long double floorl(long double x); + +double nearbyint(double x); +float nearbyintf(float x); +long double nearbyintl(long double x); + +double rint(double x); +float rintf(float x); +long double rintl(long double x); + +long int lrint(double x); +long int lrintf(float x); +long int lrintl(long double x); +long long int llrint(double x); +long long int llrintf(float x); +long long int llrintl(long double x); + +double round(double x); +float roundf(float x); +long double roundl(long double x); + +long int lround(double x); +long int lroundf(float x); +long int lroundl(long double x); +long long int llround(double x); +long long int llroundf(float x); +long long int llroundl(long double x); + +double trunc(double x); +float truncf(float x); +long double truncl(long double x); + +/* 7.12.10 Remainder functions */ +double fmod(double x, double y); +float fmodf(float x, float y); +long double fmodl(long double x, long double y); + +double remainder(double x, double y); +float remainderf(float x, float y); +long double remainderl(long double x, long double y); + +double remquo(double x, double y, int *quo); +float remquof(float x, float y, int *quo); +long double remquol(long double x, long double y, int *quo); + +/* 7.12.11 Manipulation functions */ +double copysign(double x, double y); +float copysignf(float x, float y); +long double copysignl(long double x, long double y); + +double nan(const char *tagp); +float nanf(const char *tagp); +long double nanl(const char *tagp); + +double nextafter(double x, double y); +float nextafterf(float x, float y); +long double nextafterl(long double x, long double y); + +double nexttoward(double x, long double y); +float nexttowardf(float x, long double y); +long double nexttowardl(long double x, long double y); + +/* 7.12.12 Maximum, minimum, and positive difference functions */ +double fdim(double x, double y); +float fdimf(float x, float y); +long double fdiml(long double x, long double y); + +double fmax(double x, double y); +float fmaxf(float x, float y); +long double fmaxl(long double x, long double y); + +double fmin(double x, double y); +float fminf(float x, float y); +long double fminl(long double x, long double y); + +/* 7.12.13 Floating multiply-add */ +double fma(double x, double y, double z); +float fmaf(float x, float y, float z); +long double fmal(long double x, long double y, long double z); + +/* 7.12.14 Comparison macros */ +# ifndef isgreater +# define isgreater(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x > __y; })) +# endif + +/* Return nonzero value if X is greater than or equal to Y. */ +# ifndef isgreaterequal +# define isgreaterequal(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x >= __y; })) +# endif + +/* Return nonzero value if X is less than Y. */ +# ifndef isless +# define isless(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x < __y; })) +# endif + +/* Return nonzero value if X is less than or equal to Y. */ +# ifndef islessequal +# define islessequal(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x <= __y; })) +# endif + +/* Return nonzero value if either X is less than Y or Y is less than X. */ +# ifndef islessgreater +# define islessgreater(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && (__x < __y || __y < __x); })) +# endif + +/* Return nonzero value if arguments are unordered. */ +# ifndef isunordered +# define isunordered(u, v) \ + (__extension__ \ + ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \ + fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; })) +# endif + + +#ifndef __UCLIBC_HAS_FLOATS__ + #undef float #endif -extern void cmov ( short *a, short *b ); -extern void cmul ( cmplxf *a, cmplxf *b, cmplxf *c ); -extern void cneg ( cmplxf *a ); -extern double cosdg ( double xx ); -extern double cos ( double xx ); -extern double cosh ( double xx ); -extern double cotdg ( double x ); -extern double cot ( double x ); -extern void csin ( cmplxf *z, cmplxf *w ); -extern void csqrt ( cmplxf *z, cmplxf *w ); -extern void csub ( cmplxf *a, cmplxf *b, cmplxf *c ); -extern void ctan ( cmplxf *z, cmplxf *w ); -extern double ctans ( cmplxf *z ); -extern double dawsn ( double xxx ); -extern int dprec ( void ); -extern double ellie ( double phia, double ma ); -extern double ellik ( double phia, double ma ); -extern double ellpe ( double xx ); -extern int ellpj ( double uu, double mm, double *sn, double *cn, double *dn, double *ph ); -extern double ellpk ( double xx ); -extern double erfc ( double aa ); -extern double erf ( double xx ); -extern double exp10 ( double xx ); -extern double exp2 ( double xx ); -extern double exp ( double xx ); -extern double expn ( int n, double xx ); -extern double fac ( int i ); -extern double fdtrc ( int ia, int ib, double xx ); -extern double fdtr ( int ia, int ib, int xx ); -extern double fdtri ( int ia, int ib, double yy ); -extern double floor ( double x ); -extern void fresnl ( double xxa, double *ssa, double *cca ); -extern double frexp ( double x, int *pw2 ); -extern double gamma ( double xx ); -extern double gdtrc ( double aa, double bb, double xx ); -extern double gdtr ( double aa, double bb, double xx ); -extern double hyp2f0 ( double aa, double bb, double xx, int type, double *err ); -extern double hyp2f1 ( double aa, double bb, double cc, double xx ); -extern double hyperg ( double aa, double bb, double xx ); -extern double i0e ( double x ); -extern double i0 ( double x ); -extern double i1e ( double xx ); -extern double i1 ( double xx ); -extern double igamc ( double aa, double xx ); -extern double igam ( double aa, double xx ); -extern double igami ( double aa, double yy0 ); -extern double incbet ( double aaa, double bbb, double xxx ); -extern double incbi ( double aaa, double bbb, double yyy0 ); -extern double incbps ( double aa, double bb, double xx ); -extern double iv ( double v, double x ); -extern double j0 ( double xx ); -extern double j1 ( double xx ); -extern double jn ( int n, double xx ); -extern double jv ( double nn, double xx ); -extern double k0e ( double xx ); -extern double k0 ( double xx ); -extern double k1e ( double xx ); -extern double k1 ( double xx ); -extern double kn ( int nnn, double xx ); -extern double ldexp ( double x, int pw2 ); -extern int ldprec ( void ); -extern double lgam ( double xx ); -extern double log10 ( double xx ); -extern double log2 ( double xx ); -extern double log ( double xx ); -/* extern int mtherr ( char *name, int code ); */ -extern double nbdtrc ( int k, int n, double pp ); -extern double nbdtr ( int k, int n, double pp ); -extern double ndtr ( double aa ); -extern double ndtri ( double yy0 ); -extern double onef2 ( double aa, double bb, double cc, double xx, double *err ); -extern double p1evl ( double xx, double *coef, int N ); -extern double pdtrc ( int k, double mm ); -extern double pdtr ( int k, double mm ); -extern double pdtri ( int k, double yy ); -extern void poladd ( double a[], int na, double b[], int nb, double c[] ); -extern void polclr ( double *a, int n ); -extern int poldiv ( double a[], int na, double b[], int nb, double c[] ); -extern double poleva ( double *a, int na, double xx ); -extern double polevl ( double xx, double *coef, int N ); -extern void polini ( int maxdeg ); -extern void polmov ( double *a, int na, double *b ); -extern void polmul ( double a[], int na, double b[], int nb, double c[] ); -extern void polprt ( double *a, int na, int d ); -extern void polsbt ( double a[], int na, double b[], int nb, double c[] ); -extern void polsub ( double a[], int na, double b[], int nb, double c[] ); -extern double pow ( double x, double y ); -extern double powi ( double x, int nn ); -extern double psi ( double xx ); -extern double redupi ( double xx ); -extern double rgamma ( double xx ); -extern int shichi ( double xx, double *si, double *ci ); -extern int sici ( double xx, double *si, double *ci ); -extern double sindg ( double xx ); -extern double sin ( double xx ); -extern double sinh ( double xx ); -extern double spence ( double xx ); -extern int sprec ( void ); -extern double sqrt ( double xx ); -extern double stdtr ( int k, double tt ); -extern double struve ( double vv, double xx ); -extern double tandg ( double x ); -extern double tan ( double x ); -extern double tanh ( double xx ); -extern double threef0 ( double aa, double bb, double cc, double xx, double *err ); -extern double y0 ( double xx ); -extern double y1 ( double xx ); -extern double yn ( int nn, double xx ); -extern double yv ( double vv, double xx ); -extern double zetac ( double xx ); -extern double zeta ( double xx, double qq ); - -#endif /* _MATH_H */ +#ifndef __UCLIBC_HAS_DOUBLE__ + #undef double +#endif +#ifndef __UCLIBC_HAS_LONG_DOUBLE__ + #undef long + #undef double +#endif + + +#endif /* math.h */ diff --git a/libm/Makefile b/libm/Makefile new file mode 100644 index 000000000..c151d7cbd --- /dev/null +++ b/libm/Makefile @@ -0,0 +1,75 @@ +# Makefile for uClibc's math library +# +# Copyright (C) 2001 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 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 Library General Public License for more +# details. +# +# You should have received a copy of the GNU Library 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 +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + +TOPDIR=../ +include $(TOPDIR)Rules.mak + +LIBM=libm.a +LIBM_SHARED=libm.so +TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc + +DIRS= +ifeq ($(strip $(HAS_FLOATS)),true) + DIRS+=float +endif +ifeq ($(strip $(HAS_DOUBLE)),true) + DIRS+=double +endif +ifeq ($(strip $(HAS_LONG_DOUBLE)),true) + DIRS+=ldouble +endif +ALL_SUBDIRS = $(shell find * -type d -prune -name [a-z]\*) + +all: $(LIBM) + +$(LIBM): subdirs + +tags: + ctags -R + +shared: $(LIBM) + $(TARGET_CC) $(LDFLAGS) -shared -o $(LIBM_SHARED).$(MAJOR_VERSION) \ + -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive $(LIBM) $(TOPDIR)$(SHARED_FULLNAME) + +install: all + install -d $(INSTALL_DIR)/lib + install -m 644 $(LIBM) $(INSTALL_DIR)/lib/ + @if [ -f $(LIBM_SHARED).$(MAJOR_VERSION) ] ; then \ + install -m 644 $(LIBM_SHARED).$(MAJOR_VERSION) $(INSTALL_DIR)/lib/; \ + (cd $(INSTALL_DIR)/lib/;ln -sf $(LIBM_SHARED).$(MAJOR_VERSION) $(LIBM_SHARED)); \ + fi; + +subdirs: $(patsubst %, _dir_%, $(DIRS)) +subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) + +$(patsubst %, _dir_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dir_%, %, $@) + +$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy + $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean + +clean: subdirs_clean + rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM) + +.PHONY: dummy + + diff --git a/libm/README b/libm/README new file mode 100644 index 000000000..023e46846 --- /dev/null +++ b/libm/README @@ -0,0 +1,42 @@ +The actual routines included in this math library are derived almost +exclusively from the Cephes Mathematical Library, which "is copyrighted by the +author [and] may be used freely but ... comes with no support or guarantee" + +It has been ported to fit into uClibc and generally behave +by Erik Andersen , + 5 May, 2001 + +-------------------------------------------------- + + Some software in this archive may be from the book _Methods and +Programs for Mathematical Functions_ (Prentice-Hall, 1989) or +from the Cephes Mathematical Library, a commercial product. In +either event, it is copyrighted by the author. What you see here +may be used freely but it comes with no support or guarantee. + + The two known misprints in the book are repaired here in the +source listings for the gamma function and the incomplete beta +integral. + + + Stephen L. Moshier + moshier@world.std.com + +-------------------------------------------------- + +19 November 1992 + +ZIP archive constructed and index compiled. + +To reconstruct the original directory structure, use the -d switch: + + C:\CEPHES>pkunzip -d cephes + +This archive includes all the programs in the /netlib/cephes directory +on research.att.com as of 17 Nov 92. The file "index" will tell you in +what directory and file each function can be found. If there is +something else mentioned in cephes.doc that you need, you can check +research.att.com to see whether it has been added. Failing that, you +can contact Stephen Moshier. + + Jim Van Zandt diff --git a/libm/double/Makefile b/libm/double/Makefile new file mode 100644 index 000000000..be3c5878a --- /dev/null +++ b/libm/double/Makefile @@ -0,0 +1,115 @@ +# Makefile for uClibc's math library +# +# Copyright (C) 2001 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 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 Library General Public License for more +# details. +# +# You should have received a copy of the GNU Library 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 +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + +TOPDIR=../../ +include $(TOPDIR)Rules.mak + +LIBM=../libm.a +TARGET_CC= $(TOPDIR)/extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc + +CSRC=acosh.c airy.c asin.c asinh.c atan.c atanh.c bdtr.c beta.c \ + btdtr.c cbrt.c chbevl.c chdtr.c clog.c cmplx.c const.c \ + cosh.c dawsn.c ei.c ellie.c ellik.c ellpe.c ellpj.c ellpk.c \ + exp.c exp10.c exp2.c expn.c fabs.c fac.c fdtr.c \ + fresnl.c gamma.c gdtr.c hyp2f1.c hyperg.c i0.c i1.c igami.c incbet.c \ + incbi.c igam.c isnan.c iv.c j0.c j1.c jn.c jv.c k0.c k1.c kn.c kolmogorov.c \ + log.c log2.c log10.c lrand.c nbdtr.c ndtr.c ndtri.c pdtr.c planck.c \ + polevl.c polmisc.c polylog.c polyn.c pow.c powi.c psi.c rgamma.c round.c \ + shichi.c sici.c sin.c sindg.c sinh.c spence.c stdtr.c struve.c \ + tan.c tandg.c tanh.c unity.c yn.c zeta.c zetac.c \ + sqrt.c floor.c setprec.c mtherr.c + +COBJS=$(patsubst %.c,%.o, $(CSRC)) + + +OBJS=$(COBJS) + +all: $(OBJS) $(LIBM) + +$(LIBM): ar-target + +ar-target: $(OBJS) + $(AR) $(ARFLAGS) $(LIBM) $(OBJS) + +$(COBJS): %.o : %.c + $(TARGET_CC) $(CFLAGS) -c $< -o $@ + $(STRIPTOOL) -x -R .note -R .comment $*.o + +$(OBJ): Makefile + +clean: + rm -f *.[oa] *~ core + + + +#----------------------------------------- + +#all: libmd.a mtst dtestvec monot dcalc paranoia + +time-it: time-it.o + $(CC) -o time-it time-it.o + +time-it.o: time-it.c + $(CC) -O2 -c time-it.c + +dcalc: dcalc.o libmd.a + $(CC) -o dcalc dcalc.o libmd.a + +mtst: mtst.o libmd.a + $(CC) -v -o mtst mtst.o libmd.a + +mtst.o: mtst.c + $(CC) -O2 -Wall -c mtst.c + +dtestvec: dtestvec.o libmd.a + $(CC) -o dtestvec dtestvec.o libmd.a + +dtestvec.o: dtestvec.c + $(CC) -g -c dtestvec.c + +monot: monot.o libmd.a + $(CC) -o monot monot.o libmd.a + +monot.o: monot.c + $(CC) -g -c monot.c + +paranoia: paranoia.o setprec.o libmd.a + $(CC) -o paranoia paranoia.o setprec.o libmd.a + +paranoia.o: paranoia.c + $(CC) $(CFLAGS) -Wno-implicit -c paranoia.c + +libmd.a: $(OBJS) $(INCS) + $(AR) rv libmd.a $(OBJS) + +#clean: +# rm -f *.o +# rm -f mtst +# rm -f paranoia +# rm -f dcalc +# rm -f dtestvec +# rm -f monot +# rm -f libmd.a +# rm -f time-it +# rm -f dtestvec + + diff --git a/libm/double/README.txt b/libm/double/README.txt new file mode 100644 index 000000000..f2cb6c3dc --- /dev/null +++ b/libm/double/README.txt @@ -0,0 +1,5845 @@ +/* acosh.c + * + * Inverse hyperbolic cosine + * + * + * + * SYNOPSIS: + * + * double x, y, acosh(); + * + * y = acosh( x ); + * + * + * + * DESCRIPTION: + * + * Returns inverse hyperbolic cosine of argument. + * + * If 1 <= x < 1.5, a rational approximation + * + * sqrt(z) * P(z)/Q(z) + * + * where z = x-1, is used. Otherwise, + * + * acosh(x) = log( x + sqrt( (x-1)(x+1) ). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC 1,3 30000 4.2e-17 1.1e-17 + * IEEE 1,3 30000 4.6e-16 8.7e-17 + * + * + * ERROR MESSAGES: + * + * message condition value returned + * acosh domain |x| < 1 NAN + * + */ + +/* airy.c + * + * Airy function + * + * + * + * SYNOPSIS: + * + * double x, ai, aip, bi, bip; + * int airy(); + * + * airy( x, _&ai, _&aip, _&bi, _&bip ); + * + * + * + * DESCRIPTION: + * + * Solution of the differential equation + * + * y"(x) = xy. + * + * The function returns the two independent solutions Ai, Bi + * and their first derivatives Ai'(x), Bi'(x). + * + * Evaluation is by power series summation for small x, + * by rational minimax approximations for large x. + * + * + * + * ACCURACY: + * Error criterion is absolute when function <= 1, relative + * when function > 1, except * denotes relative error criterion. + * For large negative x, the absolute error increases as x^1.5. + * For large positive x, the relative error increases as x^1.5. + * + * Arithmetic domain function # trials peak rms + * IEEE -10, 0 Ai 10000 1.6e-15 2.7e-16 + * IEEE 0, 10 Ai 10000 2.3e-14* 1.8e-15* + * IEEE -10, 0 Ai' 10000 4.6e-15 7.6e-16 + * IEEE 0, 10 Ai' 10000 1.8e-14* 1.5e-15* + * IEEE -10, 10 Bi 30000 4.2e-15 5.3e-16 + * IEEE -10, 10 Bi' 30000 4.9e-15 7.3e-16 + * DEC -10, 0 Ai 5000 1.7e-16 2.8e-17 + * DEC 0, 10 Ai 5000 2.1e-15* 1.7e-16* + * DEC -10, 0 Ai' 5000 4.7e-16 7.8e-17 + * DEC 0, 10 Ai' 12000 1.8e-15* 1.5e-16* + * DEC -10, 10 Bi 10000 5.5e-16 6.8e-17 + * DEC -10, 10 Bi' 7000 5.3e-16 8.7e-17 + * + */ + +/* asin.c + * + * Inverse circular sine + * + * + * + * SYNOPSIS: + * + * double x, y, asin(); + * + * y = asin( x ); + * + * + * + * DESCRIPTION: + * + * Returns radian angle between -pi/2 and +pi/2 whose sine is x. + * + * A rational function of the form x + x**3 P(x**2)/Q(x**2) + * is used for |x| in the interval [0, 0.5]. If |x| > 0.5 it is + * transformed by the identity + * + * asin(x) = pi/2 - 2 asin( sqrt( (1-x)/2 ) ). + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -1, 1 40000 2.6e-17 7.1e-18 + * IEEE -1, 1 10^6 1.9e-16 5.4e-17 + * + * + * ERROR MESSAGES: + * + * message condition value returned + * asin domain |x| > 1 NAN + * + */ + /* acos() + * + * Inverse circular cosine + * + * + * + * SYNOPSIS: + * + * double x, y, acos(); + * + * y = acos( x ); + * + * + * + * DESCRIPTION: + * + * Returns radian angle between 0 and pi whose cosine + * is x. + * + * Analytically, acos(x) = pi/2 - asin(x). However if |x| is + * near 1, there is cancellation error in subtracting asin(x) + * from pi/2. Hence if x < -0.5, + * + * acos(x) = pi - 2.0 * asin( sqrt((1+x)/2) ); + * + * or if x > +0.5, + * + * acos(x) = 2.0 * asin( sqrt((1-x)/2) ). + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -1, 1 50000 3.3e-17 8.2e-18 + * IEEE -1, 1 10^6 2.2e-16 6.5e-17 + * + * + * ERROR MESSAGES: + * + * message condition value returned + * asin domain |x| > 1 NAN + */ + +/* asinh.c + * + * Inverse hyperbolic sine + * + * + * + * SYNOPSIS: + * + * double x, y, asinh(); + * + * y = asinh( x ); + * + * + * + * DESCRIPTION: + * + * Returns inverse hyperbolic sine of argument. + * + * If |x| < 0.5, the function is approximated by a rational + * form x + x**3 P(x)/Q(x). Otherwise, + * + * asinh(x) = log( x + sqrt(1 + x*x) ). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -3,3 75000 4.6e-17 1.1e-17 + * IEEE -1,1 30000 3.7e-16 7.8e-17 + * IEEE 1,3 30000 2.5e-16 6.7e-17 + * + */ + +/* atan.c + * + * Inverse circular tangent + * (arctangent) + * + * + * + * SYNOPSIS: + * + * double x, y, atan(); + * + * y = atan( x ); + * + * + * + * DESCRIPTION: + * + * Returns radian angle between -pi/2 and +pi/2 whose tangent + * is x. + * + * Range reduction is from three intervals into the interval + * from zero to 0.66. The approximant uses a rational + * function of degree 4/5 of the form x + x**3 P(x)/Q(x). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -10, 10 50000 2.4e-17 8.3e-18 + * IEEE -10, 10 10^6 1.8e-16 5.0e-17 + * + */ + /* atan2() + * + * Quadrant correct inverse circular tangent + * + * + * + * SYNOPSIS: + * + * double x, y, z, atan2(); + * + * z = atan2( y, x ); + * + * + * + * DESCRIPTION: + * + * Returns radian angle whose tangent is y/x. + * Define compile time symbol ANSIC = 1 for ANSI standard, + * range -PI < z <= +PI, args (y,x); else ANSIC = 0 for range + * 0 to 2PI, args (x,y). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * IEEE -10, 10 10^6 2.5e-16 6.9e-17 + * See atan.c. + * + */ + +/* atanh.c + * + * Inverse hyperbolic tangent + * + * + * + * SYNOPSIS: + * + * double x, y, atanh(); + * + * y = atanh( x ); + * + * + * + * DESCRIPTION: + * + * Returns inverse hyperbolic tangent of argument in the range + * MINLOG to MAXLOG. + * + * If |x| < 0.5, the rational form x + x**3 P(x)/Q(x) is + * employed. Otherwise, + * atanh(x) = 0.5 * log( (1+x)/(1-x) ). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * DEC -1,1 50000 2.4e-17 6.4e-18 + * IEEE -1,1 30000 1.9e-16 5.2e-17 + * + */ + +/* bdtr.c + * + * Binomial distribution + * + * + * + * SYNOPSIS: + * + * int k, n; + * double p, y, bdtr(); + * + * y = bdtr( k, n, p ); + * + * DESCRIPTION: + * + * Returns the sum of the terms 0 through k of the Binomial + * probability density: + * + * k + * -- ( n ) j n-j + * > ( ) p (1-p) + * -- ( j ) + * j=0 + * + * The terms are not summed directly; instead the incomplete + * beta integral is employed, according to the formula + * + * y = bdtr( k, n, p ) = incbet( n-k, k+1, 1-p ). + * + * The arguments must be positive, with p ranging from 0 to 1. + * + * ACCURACY: + * + * Tested at random points (a,b,p), with p between 0 and 1. + * + * a,b Relative error: + * arithmetic domain # trials peak rms + * For p between 0.001 and 1: + * IEEE 0,100 100000 4.3e-15 2.6e-16 + * See also incbet.c. + * + * ERROR MESSAGES: + * + * message condition value returned + * bdtr domain k < 0 0.0 + * n < k + * x < 0, x > 1 + */ + /* bdtrc() + * + * Complemented binomial distribution + * + * + * + * SYNOPSIS: + * + * int k, n; + * double p, y, bdtrc(); + * + * y = bdtrc( k, n, p ); + * + * DESCRIPTION: + * + * Returns the sum of the terms k+1 through n of the Binomial + * probability density: + * + * n + * -- ( n ) j n-j + * > ( ) p (1-p) + * -- ( j ) + * j=k+1 + * + * The terms are not summed directly; instead the incomplete + * beta integral is employed, according to the formula + * + * y = bdtrc( k, n, p ) = incbet( k+1, n-k, p ). + * + * The arguments must be positive, with p ranging from 0 to 1. + * + * ACCURACY: + * + * Tested at random points (a,b,p). + * + * a,b Relative error: + * arithmetic domain # trials peak rms + * For p between 0.001 and 1: + * IEEE 0,100 100000 6.7e-15 8.2e-16 + * For p between 0 and .001: + * IEEE 0,100 100000 1.5e-13 2.7e-15 + * + * ERROR MESSAGES: + * + * message condition value returned + * bdtrc domain x<0, x>1, n