誰能告訴我爲什麼第9行和第11行的計算似乎是相同的,會產生兩個不同的輸出。我知道它們之間的差異並不是那麼好,但我正在使用這些值與OpenGL繪製線條,差別很明顯。從看似相同的計算中獲取不同的輸出
#include <iostream>
#include <cmath>
int main()
{
int ypos=400;
/// Output: 410.
std::cout << 400+(sin((90*3.14159)/180)*10) << std::endl;
ypos=ypos+(sin((90*3.14159)/180)*10);
/// Output: 409.
std::cout << ypos << std::endl;
return 0;
}
謝謝你的回覆。 – Aluthren