Why are you taking the cosine of 100 million radians? I cannot think of any valid reason for doing that.
Amen to that.
To the OP: trigonometric functions are about the most unreliable calculations that you can do on a computer. I think it is just not reasonable to expect very precise results, for such a huge parameter value. Actually, the difference in results between the different implementations is a lot smaller, than I had anticipated.
Floating point in Perl has about 15 significant digits. For a function like cos, the digits before the decimal point don't really matter, as you may just as well use the parameter value modulo 2*PI, and (ideally) expect the same outcome. That means that for this parameter, with 8 digits wasted, you have about 6-7 significant digits left. That is how close you may expect the result of the calculation of cos to be.
I am guessing you just made that parameter up, as a silly test.
In reply to Re^2: cos (100000000.0)
by bart
in thread cos (100000000.0)
by kavehmz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |