3 ms·
You can set fast math (or a subset of it) on a translation unit basis.
by gpderetta 2y ago
You can set fast math (or a subset of it) on a translation unit basis.
- tialaramex 2y agoBecause the language works by textual inclusion and so a "translation unit" isn't really just your code this is much more likely to result in nasty surprises, up to and including ODR violations.
- gpderetta 2y agoYes, if you try hard enough I'm sure you can find ways to screw up. From a practical point of view it is fine.
- cozzyd 2y agoOr even on a per function basis, at least with gcc (no clue about clang...)
- pdw 2y agoThat's not really true. If you link a shared library that was compiled with -ffast-math, that will affect the entire program. https://moyix.blogspot.com/2022/09/someones-been-messing-with-my-subnormals.html https://moyix.blogspot.com/2022/09/someones-been-messing-wit...
- gpderetta 2y agoTo enable this "feature" I believe you have to specify fast math while linking the .so, it is not enough to do it when compiling. It had also been fixed recent GCC versions.