math.sin incorrect result

2019-03-27 11:26发布

>>> import math
>>> math.sin(68)
-0.897927680689

But

sin(68) = 0.927 (3 decimal places)

Any ideas about why I am getting this result?
Thanks.

1条回答
一夜七次
2楼-- · 2019-03-27 11:31
>>> import math
>>> print math.sin.__doc__
sin(x)

Return the sine of x (measured in radians).

math.sin expects its argument to be in radians, not degrees, so:

>>> import math
>>> print math.sin(math.radians(68))
0.927183854567
查看更多
登录 后发表回答