123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- #include <float.h>
- #include <math.h>
- #include "math_private.h"
- static long double P[5] = {
- 3.279723985560247033712687707263393506266E-10L,
- 6.141506007208645008909088812338454698548E-7L,
- 2.708775201978218837374512615596512792224E-4L,
- 3.508710990737834361215404761139478627390E-2L,
- 9.999999999999999999999999999999999998502E-1L
- };
- static long double Q[6] = {
- 2.980756652081995192255342779918052538681E-12L,
- 1.771372078166251484503904874657985291164E-8L,
- 1.504792651814944826817779302637284053660E-5L,
- 3.611828913847589925056132680618007270344E-3L,
- 2.368408864814233538909747618894558968880E-1L,
- 2.000000000000000000000000000000000000150E0L
- };
- static const long double C1 = -6.93145751953125E-1L;
- static const long double C2 = -1.428606820309417232121458176568075500134E-6L;
- static const long double LOG2EL = 1.442695040888963407359924681001892137426646L;
- static const long double MAXLOGL = 1.1356523406294143949491931077970764891253E4L;
- static const long double MINLOGL = -1.143276959615573793352782661133116431383730e4L;
- static const long double huge = 0x1p10000L;
- #if 0
- static const long double twom10000 = 0x1p-10000L;
- #else
- static volatile long double twom10000 = 0x1p-10000L;
- #endif
- long double
- expl(long double x)
- {
- long double px, xx;
- int n;
- if( x > MAXLOGL)
- return (huge*huge);
- if( x < MINLOGL )
- return (twom10000*twom10000);
- px = floorl( LOG2EL * x + 0.5L );
- n = px;
- x += px * C1;
- x += px * C2;
- xx = x * x;
- px = x * __polevll( xx, P, 4 );
- xx = __polevll( xx, Q, 5 );
- x = px/( xx - px );
- x = 1.0L + x + x;
- x = ldexpl( x, n );
- return(x);
- }
|