Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wrong guess; the algebraic optimization you might be thinking of is simply not allowed.

The expression is likely subject to an optimization known as constant folding: the compiler calculates the value of the constant expression, and substitutes that value into the code.

However, that constant-folding calculation has to produce the same result as what would happen at run-time: the 56.999999999999992895... approximation of 57.

Constant-folding having to produce the same results as run-time creates a challenge in cross-compiling situations, when the host machine's math is different from the target machine's math. The compiler must emulate the target machine math.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: