为什么在VS2010中1.0f小于0.0f?

时间:2013-10-25 07:03:21

标签: c++ assembly floating-point compare

Strange floating point comparision

如图所示,rotCount为1.0f。 但是,将rotCount与0.0f进行比较时, 调试器输入if语句,这不应该发生。

我使用Visual Studio 2010的默认调试模式并优化关闭。 这是这段代码的拆卸。 enter image description here

似乎在fcomp之后,没有生成测试和跳转汇编代码。 这被认为是VS2010中的错误吗?谁知道为什么?

1 个答案:

答案 0 :(得分:31)

if语句末尾有分号,因此if不控制块。删除它