cmath/math.h の標準 cos 関数に奇妙な問題があります。明らかに、状況によっては、間違った値または単に未定義の値が返されます。
#include <cmath>
#include <iostream>
int main()
{
double foo = 8.0 * 0.19634955; // 1.5707964
double bla = std::cos(foo); // should be 0.9996242168245
std::cout << bla << std::endl; // cos returns -7.32051e-008
return 0;
}
たとえば、cos の入力値が 1.5707964 の場合、cos は -7.32051e-008 を返します (double を使用する場合、float では -4.XYZe-009 になります)。
ここで本当に基本的で単純なものが欠けていますか...?