math.sin错误的结果 [英] math.sin incorrect result

查看:133
本文介绍了math.sin错误的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

但是

sin(68) = 0.927 (3 decimal places)

关于为什么我得到这个结果的任何想法吗?
谢谢.

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

推荐答案

>>> import math
>>> print math.sin.__doc__
sin(x)

Return the sine of x (measured in radians).

math.sin期望其参数以弧度而不是度为单位,所以:

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

>>> import math
>>> print math.sin(math.radians(68))
0.927183854567

这篇关于math.sin错误的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆