Fixed floating-point error under Windows caused by cos^2 + sin^2 > 1