c++ - cos returns wrong values? -


I have a strange problem with the standard cos function of the boundary / Math H. Apparently under certain circumstances it gives incorrect or just undefined values.

  #include & lt; Cmath & gt; # Include & lt; Iostream & gt; Int main () {double foo = 8.0 * 0.19634 9 55; // 1.5707964 double bla = std :: cos (foo); // should be 0.9996242168245 std :: cout & lt; & Lt; Bla & lt; & Lt; Std :: endl; // cos-7.32051e-008 return 0; }  

For example, if the input value for COS is 1.5707964, then COS-7.32051-008 Returns (when Doubles are used, this flats -4.XYZe-009) .

Am I really missing something original and simple ...?

This is giving the degree multiplied by your input value to 3.1415 9/180, and the correct answer will get.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -