#ifdef ANSIC float sindgf( float xx ) #else float sindgf(xx) double xx; #endif
{ float x, y, z; long j; int sign;
sign = 1;
x = xx; if( xx < 0 )
{
sign = -1;
x = -xx;
} if( x > T24M1 )
{
mtherr( "sindgf", TLOSS ); return(0.0);
}
j = 0.022222222222222222222 * x; /* integer part of x/45 */
y = j; /* map zeros to origin */ if( j & 1 )
{
j += 1;
y += 1.0;
}
j &= 7; /* octant modulo 360 degrees */ /* reflect in x axis */ if( j > 3)
{
sign = -sign;
j -= 4;
}
x = x - y * 45.0;
x *= PI180; /* multiply by pi/180 to convert to radians */
z = x * x; if( (j==1) || (j==2) )
{ /* y=(((2.4462803166E-5*z -1.3887580023E-3)*z +4.1666650433E-2)*z -4.9999999968E-1)*z +1.0;
*/
/* measured relative error in +/- pi/4 is 7.8e-8 */
y = (( 2.443315711809948E-005 * z
- 1.388731625493765E-003) * z
+ 4.166664568298827E-002) * z * z;
y -= 0.5 * z;
y += 1.0;
} else
{ /* Theoretical relative error = 3.8e-9 in [-pi/4, +pi/4] */
y = ((-1.9515295891E-4 * z
+ 8.3321608736E-3) * z
- 1.6666654611E-1) * z * x;
y += x;
}
if(sign < 0)
y = -y; return( y);
}
/* Single precision circular cosine *testinterval:[-pi/4,+pi/4] *trials:10000 *peakrelativeerror:8.3e-8 *rmsrelativeerror:2.2e-8
*/
#ifdef ANSIC float cosdgf( float xx ) #else float cosdgf(xx) double xx; #endif
{ registerfloat x, y, z; int j, sign;
/* make argument positive */
sign = 1;
x = xx; if( x < 0 )
x = -x;
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.