There's not many optimization flags that people get fine grained with, the exception being floating point because -ffast-math alone is extremely inadvisable
There's not many optimization flags that people get fine grained with, the exception being floating point because -ffast-math alone is extremely inadvisable
Technically, the compilers can choose to make undefined-behavior implementation-defined-behavior instead. But they don't.
That's kind of also how C++ std::span wound up without overflow checks in practice. And my_arr.at(i) just isn't really being used by anybody.
Seems very user-hostile to me.
Tl;dr: python gevent messes up your x87 float registers (yes.)
https://moyix.blogspot.com/2022/09/someones-been-messing-wit...
For example, recursive filters (even the humble averaging filter) will suffer untold pain without enabling DAZ/FTZ mode.
fwiw the linked issue has been remedied in recent compilers and isn't a python problem, it's a gcc problem. Even that said, if your algorithm requires subnormal numbers, for the love of numeric stability, guard your scopes and set the mxcsr register accordingly!
Like with the Java sin() fixes: if you don't care about the results being correct why not constant-fold an arbitrary number? Way faster at run-time.
And yea, the fact that crt1.o being linked into shared libraries fucking up the precision of some computations depending on library dependencies (and the order they're loaded!) was bad.. but it lingered in the entire Linux ecosystem for over a decade. So how bad was it, if it took that long to notice?
If you have a numerical algorithm that requires subnormal arithmetic to converge, a) don't that's super shaky, b) set/unset mxcsr at the top/bottom of your function and ensure you never unwind the stack without resetting it. It's preserved across context switches so you're not going to get blown away by the OS scheduler.
This isn't practical numerical methods in C 101 but it's at least 201. In practice you don't trust floats for bit exact math. Use different types for that.
There are people that do. HPC and the demoscene have numerous examples. Most of the people I met here are capable of reading gcc's manual and picking the optimizations they actually need. And they know how to debug this stuff.
If it's not obvious who gcc's defaults should cater to, then redefine human-friendly until it becomes obvious.
Like, "oh you want faster FP operations? well then surely you have no need to ever be able to detect infinite or NaN values.."
Well yeah, maybe I actually don't.
I mean, I can write my own implementations, but it seems kind of silly that I should need to in the first place.
If you really know (and want to know) what you are doing, turning this stuff off may help. Some people even advocate brute-forcing all 2^32 single floats in your test cases, because it is kind if feasible to do so: https://news.ycombinator.com/item?id=34726919