开发者

how to calculate cos , sin , tan in IPhone SDK?

How do you calculate trig functions like cos, sin, tan in the iPh开发者_开发问答one SDK?

i tried tan(45) but it returns wrong output? any help?


Most math libraries use radians, not degrees.


functions like cos, sin and tan are in the standard library and can be used by including math.h. You can get a good overview of these by typing 'man math' in a Terminal window on your Mac. More specific info can be read by typing 'man sin' for example. You will then see that sin() takes a radians arguments, not degrees. Search here on Stack Overflow if you don't know how to convert radians to degrees.


If you get the output in Radians you can convert it to degrees.

Radian * (180/pi)

pi = 3.1415926535897932384626433.......

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜