nflg = 0; /* flag = 1 if x<0 raised to integer power */ if( x <= 0.0 )
{ if( x == 0.0 )
{ if( y < 0.0 )
{ #ifdef MINUSZERO if( signbit(x) && yoddint ) return( -INFINITY ); #endif return( INFINITY );
} if( y > 0.0 )
{ #ifdef MINUSZERO if( signbit(x) && yoddint ) return( NEGZERO ); #endif return( 0.0 );
} return( 1.0 );
} else
{ if( iyflg == 0 )
{ /* noninteger power of negative number */
mtherr( fname, DOMAIN ); return(NAN);
}
nflg = 1;
}
}
/* Integer power of an integer. */
if( iyflg )
{
i = w;
w = floor(x); if( (w == x) && (fabs(y) < 32768.0) )
{
w = powi( x, (int) y ); return( w );
}
}
if( nflg )
x = fabs(x);
/* For values close to 1, use a series expansion. */
w = x - 1.0;
aw = fabs(w);
ay = fabs(y);
wy = w * y;
ya = fabs(wy); if((aw <= 1.0e-3 && ay <= 1.0)
|| (ya <= 1.0e-3 && ay >= 1.0))
{
z = (((((w*(y-5.)/720. + 1./120.)*w*(y-4.) + 1./24.)*w*(y-3.)
+ 1./6.)*w*(y-2.) + 0.5)*w*(y-1.) )*wy + wy + 1.; goto done;
} /* w=y*log(x); if(aw>1.0e-3&&fabs(w)<1.0e-3) { z=(((((( w/7.+1.)*w/6.+1.)*w/5.+1.)*w/4.+1.)*w/3.+1.)*w/2.+1.)*w+1.; gotodone; }
*/ /* if(ya<=1.0e-3&&aw<=1.0e-4) { z=((((( wy*1./720. +(-w*1./48.+1./120.))*wy +((w*17./144.-1./12.)*w+1./24.))*wy +(((-w*5./16.+7./24.)*w-1./4.)*w+1./6.))*wy +((((w*137./360.-5./12.)*w+11./24.)*w-1./2.)*w+1./2.))*wy +(((((-w*1./6.+1./5.)*w-1./4)*w+1./3.)*w-1./2.)*w))*wy +wy+1.0; gotodone; }
*/ /* separate significand from exponent */
x = frexp( x, &e );
/* Check for gross overflow. */ /* if((e*y)>(MEXP+1024)) gotooverflow;
*/ /* Find significand of x in antilog table A[]. */
i = 1; if( x <= douba(9) )
i = 9; if( x <= douba(i+4) )
i += 4; if( x <= douba(i+2) )
i += 2; if( x >= douba(1) )
i = -1;
i += 1;
/* Find (x - A[i])/A[i] *inordertocomputelog(x/A[i]): * *log(x)=log(ax/a)=log(a)+log(x/a) * *log(x/a)=log(1+v),v=x/a-1=(x-a)/a
*/
x -= douba(i);
x -= doubb(i/2);
x /= douba(i);
/* rational approximation for log(1+v): * *log(1+v)=v-v**2/2+v**3P(v)/Q(v)
*/
z = x*x;
w = x * ( z * polevl( x, P, 3 ) / p1evl( x, Q, 4 ) );
w = w - ldexp( z, -1 ); /* w - 0.5 * z */
/* Convert to base 2 logarithm: *multiplybylog2(e)
*/
w = w + LOG2EA * w; /* Note x was not yet added in *toaboverationalapproximation, *sodoitnow,whilemultiplying *bylog2(e).
*/
z = w + LOG2EA * x;
z = z + x;
/* Compute exponent term of the base 2 logarithm. */
w = -i;
w = ldexp( w, -4 ); /* divide by 16 */
w += e; /* Now base 2 log of x is w + z. */
/* Multiply base 2 log by y, in extended precision. */
/* separate y into large part ya *andsmallpartyblessthan1/16
*/
ya = reduc(y);
yb = y - ya;
F = z * y + w * yb;
Fa = reduc(F);
Fb = F - Fa;
G = Fa + w * ya;
Ga = reduc(G);
Gb = G - Ga;
H = Fb + Gb;
Ha = reduc(H);
w = ldexp( Ga+Ha, 4 );
/* Test the power of 2 for overflow */ if( w > MEXP )
{ #ifndef INFINITIES
mtherr( fname, OVERFLOW ); #endif if( nflg && yoddint ) return( -INFINITY ); return( INFINITY );
}
/* Now the product y * log2(x) = Hb + e/16.0. * *Computebase2exponentialofHb, *where-0.0625<=Hb<=0.
*/
z = Hb * polevl( Hb, R, 6 ); /* z = 2**Hb - 1 */
/* Express e/16 as an integer plus a negative number of 16ths. *Findlookuptableentryforthefractionalpowerof2.
*/ if( e < 0 )
i = 0; else
i = 1;
i = e/16 + i;
e = 16*i - e;
w = douba( e );
z = w + w * z; /* 2**-e * ( 1 + (2**Hb-1) ) */
z = ldexp( z, i ); /* multiply by integer power of 2 */
done:
/* Negate if odd integer power of negative number */ if( nflg && yoddint )
{ if( z == 0.0 )
z = NEGZERO; else
z = -z;
} return( z );
}
/* Find a multiple of 1/16 that is within 1/16 of x. */ staticdouble reduc(x) double x;
{ double t; double ldexp(), floor();
t = ldexp( x, 4 );
t = floor( t );
t = ldexp( t, -4 ); return(t);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-06-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.