double atan(x) double x;
{ double y, z; short sign, flag;
#ifdef MINUSZERO if( x == 0.0 ) return(x); #endif #ifdef INFINITIES if(x == INFINITY) return(PIO2); if(x == -INFINITY) return(-PIO2); #endif /* make argument positive and save the sign */
sign = 1; if( x < 0.0 )
{
sign = -1;
x = -x;
} /* range reduction */
flag = 0; if( x > T3P8 )
{
y = PIO2;
flag = 1;
x = -( 1.0/x );
} elseif( x <= 0.66 )
{
y = 0.0;
} else
{
y = PIO4;
flag = 2;
x = (x-1.0)/(x+1.0);
}
z = x * x;
z = z * polevl( z, P, 4 ) / p1evl( z, Q, 5 );
z = x * z + x; if( flag == 2 )
z += 0.5 * MOREBITS; elseif( flag == 1 )
z += MOREBITS;
y = y + z; if( sign < 0 )
y = -y; return(y);
}
/* atan2 */
#ifdef ANSIC double atan2( y, x ) #else double atan2( x, y ) #endif double x, y;
{ double z, w; short code;
code = 0;
#ifdef NANS if( isnan(x) ) return(x); if( isnan(y) ) return(y); #endif #ifdef MINUSZERO if( y == 0.0 )
{ if( signbit(y) )
{ if( x > 0.0 )
z = y; elseif( x < 0.0 )
z = -PI; else
{ if( signbit(x) )
z = -PI; else
z = y;
}
} else/* y is +0 */
{ if( x == 0.0 )
{ if( signbit(x) )
z = PI; else
z = 0.0;
} elseif( x > 0.0 )
z = 0.0; else
z = PI;
} return z;
} if( x == 0.0 )
{ if( y > 0.0 )
z = PIO2; else
z = -PIO2; return z;
} #endif/* MINUSZERO */ #ifdef INFINITIES if( x == INFINITY )
{ if( y == INFINITY )
z = 0.25 * PI; elseif( y == -INFINITY )
z = -0.25 * PI; elseif( y < 0.0 )
z = NEGZERO; else
z = 0.0; return z;
} if( x == -INFINITY )
{ if( y == INFINITY )
z = 0.75 * PI; elseif( y <= -INFINITY )
z = -0.75 * PI; elseif( y >= 0.0 )
z = PI; else
z = -PI; return z;
} if( y == INFINITY ) return( PIO2 ); if( y == -INFINITY ) return( -PIO2 ); #endif
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.