6 ms·
Maybe division by zero should just not exist. If you actually write 1/0 in a manner that can be discovered through static analysis, that could just be a compil
by bee_rider 2y ago
Maybe division by zero should just not exist.
If you actually write 1/0 in a manner that can be discovered through static analysis, that could just be a compile time error.
If you compute a zero, and then divide by it… I dunno. Probably what happened was the denominator rounded or truncated to zero. So, you actually have 1/(0+-e), for some type-dependent e. You have an interval which contains a ton of valid values, why pick the one very specific invalid value?
- worik 2y ago> Maybe division by zero should just not exist. It does not. It is undefined
- ChadNauseam 2y agoI think it would be possible and practical to use refinement types to statically prevent all divisions by 0. I think you could also do this to detect and prevent integer overflow.
- throwawaymaths 2y agoNot really. You could divide by the subtraction result of two positive integers.
- ChadNauseam 2y agoYou would just have to prove that the integers are not equal, right?