4 ms·
Division by zero isn't necessarily a runtime error. You could define your division operation to only admit divisors that are statically known not to equal zero.
by clhodapp 8y ago
Division by zero isn't necessarily a runtime error. You could define your division operation to only admit divisors that are statically known not to equal zero. You just need a type system that is strong enough to track whether a number has been confirmed not to equal zero.
- kazinator 8y ago(Only problem is that such a type system is unwieldy compared to mathematics itself.)
- 0db532a0 8y agoI suppose we’d better get you in contact with with all those silly mathematicians who like to use proof assistants to add rigour to their work.
- kazinator 8y agoIn run of the mill mathematics, I've never seen zero treated as a special type. In derivations, a restriction against zero (because some variable appeared in a denominator) is usually carried as a logical assertion that is attached to subsequent derivations, like "<.. equation ...>, x /= 0".