gpt4 book ai didi

java - Math.atan() 返回输入

转载 作者:行者123 更新时间:2023-11-30 06:36:10 26 4
gpt4 key购买 nike

我遇到 Math.atan 返回与输入相同的值的问题。

public double inchToMOA( double in, double range){
double rangeIn = 36*range;
double atan = (in / rangeIn) * -1.0;
double deg = Math.atan(atan);
double moa = deg * 60;
return moa;
}

我把所有这些都放在一行中,但我将其分解为不同的变量,看看是否能找出它不起作用的原因。如果 in = -10 且 range = 300,则 atan 约为 -.00094。角度应该约为 -.053 度,但 math.atan 返回 -.00094,与输入相同。

我的数字对 math.atan 来说太小了吗?

最佳答案

这里描述了反正切:

http://mathworld.wolfram.com/InverseTangent.html

我不认为你的论点是这里的问题。

当然,您知道计算机触发函数处理的是弧度而不是度数,对吧?

关于java - Math.atan() 返回输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5162636/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com