Lines Matching +full:1000 +full:base +full:- +full:x

1 /*-
23 * P[0] x^n + P[1] x^(n-1) + ... + P[n]
26 __polevll(long double x, const long double *PP, int n) in __polevll() argument
34 y = y * x + *P++; in __polevll()
35 } while (--n); in __polevll()
42 * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
45 __p1evll(long double x, const long double *PP, int n) in __p1evll() argument
51 n -= 1; in __p1evll()
52 y = x + *P++; in __p1evll()
54 y = y * x + *P++; in __p1evll()
55 } while (--n); in __p1evll()
68 * long double x, y, z, powl();
70 * z = powl( x, y );
76 * Computes x raised to the yth power. Analytically,
78 * x**y = exp( y log(x) ).
81 * of 2**-i/32 and pseudo extended precision arithmetic to
89 * The relative error of pow(x,y) can be estimated
91 * the internally computed base 2 logarithm. At the ends
93 * and its relative error is about 1 lsb = 1.1e-19. Hence
94 * the predicted relative error in the result is 2.3e-21 y .
99 * IEEE +-1000 40000 2.8e-18 3.7e-19
100 * .001 < x < 1000, with log(x) uniformly distributed.
101 * -1000 < y < 1000, y uniformly distributed.
103 * IEEE 0,8700 60000 6.5e-18 1.0e-18
104 * 0.99 < x < 1.01, 0 < y < 8700, uniformly distributed.
110 * pow overflow x**y > MAXNUM INFINITY
111 * pow underflow x**y < 1/MAXNUM 0.0
112 * pow domain x<0 and y noninteger 0.0
126 /* log(1+x) = x - .5x^2 + x^3 * P(z)/Q(z)
127 * on the domain 2^(-1/32) - 1 <= x <= 2^(1/32) - 1
130 8.3319510773868690346226E-4L,
131 4.9000050881978028599627E-1L,
141 /* A[i] = 2^(-i/32), rounded to IEEE long double precision.
146 9.7857206208770013448287E-1L,
147 9.5760328069857364691013E-1L,
148 9.3708381705514995065011E-1L,
149 9.1700404320467123175367E-1L,
150 8.9735453750155359320742E-1L,
151 8.7812608018664974155474E-1L,
152 8.5930964906123895780165E-1L,
153 8.4089641525371454301892E-1L,
154 8.2287773907698242225554E-1L,
155 8.0524516597462715409607E-1L,
156 7.8799042255394324325455E-1L,
157 7.7110541270397041179298E-1L,
158 7.5458221379671136985669E-1L,
159 7.3841307296974965571198E-1L,
160 7.2259040348852331001267E-1L,
161 7.0710678118654752438189E-1L,
162 6.9195494098191597746178E-1L,
163 6.7712777346844636413344E-1L,
164 6.6261832157987064729696E-1L,
165 6.4841977732550483296079E-1L,
166 6.3452547859586661129850E-1L,
167 6.2092890603674202431705E-1L,
168 6.0762367999023443907803E-1L,
169 5.9460355750136053334378E-1L,
170 5.8186242938878875689693E-1L,
171 5.6939431737834582684856E-1L,
172 5.5719337129794626814472E-1L,
173 5.4525386633262882960438E-1L,
174 5.3357020033841180906486E-1L,
175 5.2213689121370692017331E-1L,
176 5.1094857432705833910408E-1L,
177 5.0000000000000000000000E-1L,
181 2.6176170809902549338711E-20L,
182 -1.0126791927256478897086E-20L,
183 1.3438228172316276937655E-21L,
184 1.2207982955417546912101E-20L,
185 -6.3084814358060867200133E-21L,
186 1.3164426894366316434230E-20L,
187 -1.8527916071632873716786E-20L,
188 1.8950325588932570796551E-20L,
189 1.5564775779538780478155E-20L,
190 6.0859793637556860974380E-21L,
191 -2.0208749253662532228949E-20L,
192 1.4966292219224761844552E-20L,
193 3.3540909728056476875639E-21L,
194 -8.6987564101742849540743E-22L,
195 -1.2327176863327626135542E-20L,
199 /* 2^x = 1 + x P(x),
200 * on the interval -1/32 <= x <= 0
203 1.5089970579127659901157E-5L,
204 1.5402715328927013076125E-4L,
205 1.3333556028915671091390E-3L,
206 9.6181291046036762031786E-3L,
207 5.5504108664798463044015E-2L,
208 2.4022650695910062854352E-1L,
209 6.9314718055994530931447E-1L,
215 /* The following if denormal numbers are supported, else -MEXP: */
216 #define MNEXP (-NXT*(16384.0L+64.0L))
217 /* log2(e) - 1 */
231 static const long double MINLOGL = -1.13994985314888605586758E4L;
232 static const long double LOGE2L = 6.9314718055994530941723E-1L;
237 static const long double twom10000 = 0x1p-10000L;
239 static _Thread_local volatile long double twom10000 = 0x1p-10000L;
246 powl(long double x, long double y) in powl() argument
255 if( x == 1.0L ) in powl()
258 if( isnan(x) ) in powl()
259 return ( nan_mix(x, y) ); in powl()
261 return ( nan_mix(x, y) ); in powl()
264 return( x ); in powl()
266 if( !isfinite(y) && x == -1.0L ) in powl()
271 if( x > 1.0L ) in powl()
273 if( x > 0.0L && x < 1.0L ) in powl()
275 if( x < -1.0L ) in powl()
277 if( x > -1.0L && x < 0.0L ) in powl()
280 if( y <= -LDBL_MAX ) in powl()
282 if( x > 1.0L ) in powl()
284 if( x > 0.0L && x < 1.0L ) in powl()
286 if( x < -1.0L ) in powl()
288 if( x > -1.0L && x < 0.0L ) in powl()
291 if( x >= LDBL_MAX ) in powl()
315 if( x <= -LDBL_MAX ) in powl()
320 return( -INFINITY ); in powl()
326 return( -0.0L ); in powl()
332 nflg = 0; /* flag = 1 if x<0 raised to integer power */ in powl()
333 if( x <= 0.0L ) in powl()
335 if( x == 0.0L ) in powl()
339 if( signbit(x) && yoddint ) in powl()
340 return( -INFINITY ); in powl()
345 if( signbit(x) && yoddint ) in powl()
346 return( -0.0L ); in powl()
357 return (x - x) / (x - x); /* (x<0)**(non-int) is NaN */ in powl()
367 w = floorl(x); in powl()
368 if( (w == x) && (fabsl(y) < 32768.0) ) in powl()
370 w = powil( x, (int) y ); in powl()
377 x = fabsl(x); in powl()
380 x = frexpl( x, &i ); in powl()
385 if( x <= douba(17) ) in powl()
387 if( x <= douba(i+8) ) in powl()
389 if( x <= douba(i+4) ) in powl()
391 if( x <= douba(i+2) ) in powl()
393 if( x >= douba(1) ) in powl()
394 i = -1; in powl()
398 /* Find (x - A[i])/A[i] in powl()
399 * in order to compute log(x/A[i]): in powl()
401 * log(x) = log( a x/a ) = log(a) + log(x/a) in powl()
403 * log(x/a) = log(1+v), v = x/a - 1 = (x-a)/a in powl()
405 x -= douba(i); in powl()
406 x -= doubb(i/2); in powl()
407 x /= douba(i); in powl()
412 * log(1+v) = v - v**2/2 + v**3 P(v) / Q(v) in powl()
414 z = x*x; in powl()
415 w = x * ( z * __polevll( x, P, 3 ) / __p1evll( x, Q, 3 ) ); in powl()
416 w = w - ldexpl( z, -1 ); /* w - 0.5 * z */ in powl()
418 /* Convert to base 2 logarithm: in powl()
423 z += LOG2EA * x; in powl()
424 z += x; in powl()
426 /* Compute exponent term of the base 2 logarithm. */ in powl()
427 w = -i; in powl()
428 w = ldexpl( w, -LNXT ); /* divide by NXT */ in powl()
430 /* Now base 2 log of x is w + z. */ in powl()
432 /* Multiply base 2 log by y, in extended precision. */ in powl()
438 yb = y - ya; in powl()
445 Fb = F - Fa; in powl()
449 Gb = G - Ga; in powl()
463 Hb = H - Ha; in powl()
468 Hb -= (1.0L/NXT); /*0.0625L;*/ in powl()
471 /* Now the product y * log2(x) = Hb + e/NXT. in powl()
473 * Compute base 2 exponential of Hb, in powl()
474 * where -0.0625 <= Hb <= 0. in powl()
476 z = Hb * __polevll( Hb, R, 6 ); /* z = 2**Hb - 1 */ in powl()
486 e = NXT*i - e; in powl()
488 z = w * z; /* 2**-e * ( 1 + (2**Hb-1) ) */ in powl()
494 /* For negative x, in powl()
498 w = ldexpl( y, -1 ); in powl()
502 z = -z; /* odd exponent */ in powl()
509 /* Find a multiple of 1/NXT that is within 1/NXT of x. */
511 reducl(long double x) in reducl() argument
515 t = ldexpl( x, LNXT ); in reducl()
517 t = ldexpl( t, -LNXT ); in reducl()
529 * long double x, y, powil();
532 * y = powil( x, n );
538 * Returns argument x raised to the nth power.
540 * two. The desired power is a product of two-to-the-kth
541 * powers of x. Thus to compute the 32767 power of x requires
550 * arithmetic x domain n domain # trials peak rms
551 * IEEE .001,1000 -1022,1023 50000 4.3e-17 7.8e-18
552 * IEEE 1,2 -1022,1023 20000 3.9e-17 7.6e-18
553 * IEEE .99,1.01 0,8700 10000 3.6e-16 7.2e-17
560 powil(long double x, int nn) in powil() argument
566 if( x == 0.0L ) in powil()
580 if( x < 0.0L ) in powil()
582 asign = -1; in powil()
583 x = -x; in powil()
591 sign = -1; in powil()
592 n = -nn; in powil()
603 s = x; in powil()
605 e = (lx - 1)*n; in powil()
606 if( (e == 0) || (e > 64) || (e < -64) ) in powil()
608 s = (s - 7.0710678118654752e-1L) / (s + 7.0710678118654752e-1L); in powil()
609 s = (2.9142135623730950L * s - 0.5L + lx) * nn * LOGE2L; in powil()
622 * since roundoff error in 1.0/x will be amplified. in powil()
625 if( s < (-MAXLOGL+2.0L) ) in powil()
627 x = 1.0L/x; in powil()
628 sign = -sign; in powil()
633 y = x; in powil()
641 ww = x; in powil()
645 ww = ww * ww; /* arg to the 2-to-the-kth power */ in powil()
652 y = -y; /* odd power of negative number */ in powil()