longdouble powil( x, nn ) longdouble x; int nn;
{ longdouble w, y; longdouble s; int n, e, sign, asign, lx;
if( x == 0.0L )
{ if( nn == 0 ) return( 1.0L ); elseif( nn < 0 ) return( MAXNUML ); else return( 0.0L );
}
if( nn == 0 ) return( 1.0L );
if( x < 0.0L )
{
asign = -1;
x = -x;
} else
asign = 0;
if( nn < 0 )
{
sign = -1;
n = -nn;
} else
{
sign = 1;
n = nn;
}
/* Overflow detection */
/* Calculate approximate logarithm of answer */
s = x;
s = frexpl( s, &lx );
e = (lx - 1)*n; if( (e == 0) || (e > 64) || (e < -64) )
{
s = (s - 7.0710678118654752e-1L) / (s + 7.0710678118654752e-1L);
s = (2.9142135623730950L * s - 0.5L + lx) * nn * LOGE2L;
} else
{
s = LOGE2L * e;
}
if( s > MAXLOGL )
{
mtherr( "powil", OVERFLOW );
y = MAXNUML; goto done;
}
if( s < MINLOGL )
{
mtherr( "powil", UNDERFLOW ); return(0.0L);
} /* Handle tiny denormal answer, but with less accuracy *sinceroundofferrorin1.0/xwillbeamplified. *Theprecisedemarcationshouldbethegradualunderflowthreshold.
*/ if( s < (-MAXLOGL+2.0L) )
{
x = 1.0L/x;
sign = -sign;
}
/* First bit of the power */ if( n & 1 )
y = x;
else
{
y = 1.0L;
asign = 0;
}
w = x;
n >>= 1; while( n )
{
w = w * w; /* arg to the 2-to-the-kth power */ if( n & 1 ) /* if that bit is set, then include in product */
y *= w;
n >>= 1;
}
done:
if( asign )
y = -y; /* odd power of negative number */ if( sign < 0 )
y = 1.0L/y; return(y);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-13)
¤
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.