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

The reason for writing out all of the x multiplications like that is that I was hoping the compiler detect such a pattern perform an optimization for me. Mat Godbolt's "Advent of Compiler Optimizations" series mentions some of these cases where the compiler can do more auto-optimizations for the developer.


Horner's form is typically also more accurate, or at least, it is not bit-identical, so the compiler won't do it unless you pass -funsafe-math, and maybe not even then.




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

Search: