Strictly speaking the domain of division includes only non-zero denominators but we cannot always tell at compile time whether the value of expression may be zero; so, we expand the range of division to allow any number as the denominator for practicality.
Consider the function f(a,b,c) = a/(b - c)
. This function is undefined when b == c
even if b
and c
were non-zero on function entry. Thus this is a partial function.
Having a type system or static analysis that can encode the concept that this function must not be called when b == c
is impractical today; even requiring a parameter to be non-zero complicates matters greatly.