Cos result is incorrect

I import "math.h".

I can use the cos function, but when I execute the cos(0.321139585333178) result0.948876

If I use a calculator on a Mac or use a regular calculator, the result will be 0.999984292347418

Can someone help me solve this problem?

+3
source share
1 answer

You confuse degrees with radians .

cos (0.321139585333178 degrees) = 0.999984292

cos (0.321139585333178 radians) = 0.948876326

  • To convert from radians to degrees, multiply by 180 / π.
  • To convert from degrees to radians, multiply by π / 180.
+19
source

Source: https://habr.com/ru/post/1749889/


All Articles