▲ | epcoa 3 days ago | |||||||
If dividing by zero has a well defined result that doesn’t abort execution what exactly does “can’t” even mean? Operations on those sentinel values are also defined. This can affect when checking needs to be done in optimized code. | ||||||||
▲ | bee_rider 2 days ago | parent [-] | |||||||
I believe divide-by-zero produces an exception. The machine can either be configured to mask that exception, or not. Personally, I am lazy, so I don’t check the mxcsr register before I start running my programs. Maybe gcc does something by default, I don’t know. IMO legitimate division by zero is rare but not impossible, so if you do it, the onus is on you to make sure the flags are set up right. | ||||||||
|