This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

在C语言程序里,计算浮点数出现精度问题。1.0f / 0.001f = 999.9999.

#define F32 float
F32 GetRatio(F32 f1, F32 f2)
{
 return (f1 / f2);
}
当f1 = 1, f2 = 0.001时,返回值为999.9999。
希望返回值为1000,对于这种情况,请问有没有好的建议?
非常感谢!