This is cos.c in view mode; [Download] [Up]
static double pid4= 0.7853981633974483096; static double pid2= 1.5707963267948966192; static double pi = 3.1415926535897932384; static double pi2 = 6.2831853071795864769; double jv_cos(x) double x; { double jv_fmod(),x2,sum; int sflag; if ( x < 0 ) x = -x; if ( x >= pi2 ) x = jv_fmod(x,pi2); if ( x > pi ) x = pi2-x; if ( x > pid2 ) { sflag = 1; x = pi - x; } else sflag = 0; /* Now we are in the first quadrant */ if ( x < pid4 ) { x2 = x*x; sum = 0.99999999999999995287+x2*( -0.49999999999999251135+x2*( 0.04166666666647237368+x2*( -0.00138888888699833768+x2*( 0.00002480157854004439+x2*( -0.00000027555234099211+x2*( 0.00000000206304660116)))))); } else { x = pid2 - x; x2 = x*x; sum = x*( 0.99999999999999999685+x2*( -0.16666666666666616691+x2*( 0.00833333333332036780+x2*( -0.00019841269828654287+x2*( 0.00000275573133777316+x2*( -0.00000002505071717794+x2*( 0.00000000015894748309))))))); } if ( sflag ) return(-sum); else return(sum); }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.