> have pi as 3.14159265358979311600L.
..............................^^^^^
The real value of pi (up to 20th sign) is
3.14159265358979323846
You may write something like this:
double mycos(double x) { // x should be between -360 and 360
int mul = 1;
if (x<0) x = -x; // cos -x = cos x
if (x>180) x = 360-x; // cos (360-x) = cos x
if (x>90) {x = 180-x; mul = -1;} // cos (180-x) = -cos x
if (x>45)
return mul*Sin(90-x);
else
return mul*Cos(x);
}
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com