At some point, someone is going to have to explain why - despite nobody ever wanting this in production code ever, for any reason - the default CSR state for divide by zero on most platforms is fault instead of flush.
-
-
Funnily enough I'm reading this tweet while waiting for an app to compile & start in Debug because I just got a divide-by-zero crash in it. I swear. Uncanny.
-
It is just so silly at this point. Basically all SSE code that does a divide could be trivially extended to make flush-to-zero produce a usable default value with no branching. How is this still a thing??
End of conversation
New conversation -
-
-
Maybe I'm misunderstanding: what would you like the following code to do? int x = 2 / 0; cout << x;
-
It's not what I would like it to do, it's what it _does_ do provided you set MXCSR properly (or the equivalent on other CPUs). With div-by-zero/underflow turned off, and flush-to-zero turned on, 2/0 = 0. So your code would print 0.pic.twitter.com/ju2q6BIfv5
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.