17 * Returns the circular tangent of the radian argument x.
19 * Range reduction is modulo pi/4. A polynomial approximation
20 * is employed in the basic interval [0, pi/4].
27 * arithmetic domain # trials peak rms
28 * IEEE +-4096 100000 3.3e-7 4.5e-8
32 * message condition value returned
33 * tanf total loss x > 2^24 0.0
52 * Returns the circular cotangent of the radian argument x.
53 * A common routine computes either the tangent or cotangent.
60 * arithmetic domain # trials peak rms
61 * IEEE +-4096 100000 3.0e-7 4.5e-8
66 * message condition value returned
67 * cot total loss x > 2^24 0.0
68 * cot singularity x = 0 MAXNUMF
73 Cephes Math Library Release 2.2: June, 1992
74 Copyright 1984, 1987, 1989 by Stephen L. Moshier
75 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
78 /* Single precision circular tangent
79 * test interval: [-pi/4, +pi/4]
81 * peak relative error: 8.7e-8
82 * rms relative error: 2.8e-8
88 static float DP1 = 0.78515625;
89 static float DP2 = 2.4187564849853515625e-4;
90 static float DP3 = 3.77489497744594108e-8;
91 float FOPI = 1.27323954473516; /* 4/pi */
92 static float lossth = 8192.;
93 /*static float T24M1 = 16777215.;*/
97 static float tancotf( float xx, int cotflg )
99 static float tancotf(xx,cotflg)
109 /* make argument positive but save the sign */
124 mtherr( "cotf", TLOSS );
126 mtherr( "tanf", TLOSS );
130 /* compute x mod PIO4 */
131 j = FOPI * x; /* integer part of x/(PI/4) */
134 /* map zeros and singularities to origin */
141 z = ((x - y * DP1) - y * DP2) - y * DP3;
147 /* 1.7e-8 relative error in [-pi/4, +pi/4] */
149 ((((( 9.38540185543E-3 * zz
150 + 3.11992232697E-3) * zz
151 + 2.44301354525E-2) * zz
152 + 5.34112807005E-2) * zz
153 + 1.33387994085E-1) * zz
154 + 3.33331568548E-1) * zz * z
183 float tanf( float x )
190 return( tancotf(x,0) );
194 float cotf( float x )
203 mtherr( "cotf", SING );
206 return( tancotf(x,1) );