Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 C 中尝试atan2了大约 10 -14的参数。它给出了一个错误的答案:大约 90 而不是零,例如:
atan2
void main() { double a =3.4e-14; double b=9e-10; atan2(3.4e14,9.0e-9); // returns ~90 instead of zero or Not a number }
您已经在代码中定义了两个变量a,b但随后您使用常量作为atan2.
a
b
a和的值b被忽略。
atan2(a, b);
如您所料,将返回接近零的值。
相同的atan2(3.4e-14,9.0e-9)(注意e-14,不是e14)。
atan2(3.4e-14,9.0e-9)
e-14
e14
看起来您在 3.4*10^14 上调用 atan2,而不是 3.14*10^(-14)?