如何使用Math.cos()& Math.sin()? [英] How to use Math.cos() & Math.sin()?
本文介绍了如何使用Math.cos()& Math.sin()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Math.cos
和 Math.sin
,但它会返回我意想不到的结果:
I'm using Math.cos
and Math.sin
but it returns me unexpected results like these:
Angle Sin Cos
354 0.8414 -0.5403
352 0.1411 0.98998
350 -0.958 -0.2836
为什么我得到这些结果?
Why I get these results?
推荐答案
您是否尝试使用学位?请记住, sin
和 cos
期待弧度。
Are you trying to use degrees? Keep in mind that sin
and cos
are expecting radians.
Math.cos(Math.toRadians(354))
这篇关于如何使用Math.cos()& Math.sin()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文