Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在文档和网络中找到 -ffinite-math-only 的所有信息是“允许优化浮点算术,假设参数和结果不是 NaN 或 +-Infs。” 这对我来说似乎不会发生。有谁知道这些优化是什么?谢谢
在这个假设下可以优化很多小东西,比如:
x == x
1
x * 1
x
x >= y
!(x < y)
x/x
x != 0
x > y ? x : y
您经常会看到这个假设以及“零符号无关紧要”之类的假设,然后允许执行以下操作:
x - x
0
0 / x
x * 0