Re:Why does changing 0.1f to 0 slow down performance by 10x?
by mturmon on Sunday March 11, 2012 @08:10PM
(#3691750)
I think you might have missed something in the OP.
I got the impression that the "+ 0.1" was enough to raise the value of the floating point number being operated on, so that it was not denormalized.
So, the "+ 0.1" version was faster because the numbers it generated were not denormalized. It had nothing to do with the special properties of 0 versus 0.1f (a float).
Neither of the two explanations on the SO post made any assumption about the "theoretical optimizing compiler" that you mention, right?
I got the impression that the "+ 0.1" was enough to raise the value of the floating point number being operated on, so that it was not denormalized.
So, the "+ 0.1" version was faster because the numbers it generated were not denormalized. It had nothing to do with the special properties of 0 versus 0.1f (a float).
Neither of the two explanations on the SO post made any assumption about the "theoretical optimizing compiler" that you mention, right?