How do I use the sin()
, cos()
, and tan()
functions in iOS application? When I use them I don't get the correct value. Example:
如何在iOS应用程序中使用sin(),cos()和tan()函数?当我使用它们时,我没有得到正确的值。例:
double value=sin(90);
I got value: 0.893997 but expected value: 1. How can I fix this?
我有价值:0.893997但预期值:1。我该如何解决这个问题?
1 个解决方案
#1
16
The problem is that it's taking the sine of 90 radians, not degrees. Try sin(M_PI_2)
for 90°.
问题是它的正弦值为90弧度,而不是度数。尝试sin(M_PI_2)90°。
#1
16
The problem is that it's taking the sine of 90 radians, not degrees. Try sin(M_PI_2)
for 90°.
问题是它的正弦值为90弧度,而不是度数。尝试sin(M_PI_2)90°。