4 ms·
This isn't about undefined behavior. It's about ignoring the way that floating point math works like real numbers. That lets you assume things like addition are
by ori_b 10y ago
This isn't about undefined behavior. It's about ignoring the way that floating point math works like real numbers. That lets you assume things like addition are commutative, which enables things like loop invariant code motion, reordering of operations, and generally doing
- nickpsecurity 10y agoThe parent of my original comment gave it as an example of undefined behavior improving performance. I don't know enough to say whether that's true or not but was responding to correctness issues in that. So, now you're saying that the floating point optimizations sacrificing accuracy don't use any undefined behavior? That the parent just gave a bad example?
- ori_b 10y agoI'm saying that it violates the spec if you enable it. It's not undefined behavior in the spec. If you want a good example of undefined behavior enabling optimizations, you can eliminate loop bounds checks by assuming that integers will never overflow.
- nickpsecurity 10y agoGotcha. Thanks.