All the info I can find in documentation and the web for -ffinite-math-only is "Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs." This does not seem forthcoming to me. Does anyone know exactly what those optimizations are?
Lots of little things can be optimized under that assumption, like:
x == x
--> 1
x * 1
--> x
x >= y
--> !(x < y)
and similar.x/x
--> 1
if the compiler can prove x != 0
.x > y ? x : y
.You often see this assumption together with assumptions like "sign of zero doesn't matter", which then allows things like:
x - x
--> 0
0 / x
--> 0
x * 0
--> 0