3 ms·
Returning 0 for average([]) is useful. Returning a slope of 0 for a vertical linear regression is suspect. Any choice of behavior for x/0 will be wrong in some
by hansvm 6y ago
Returning 0 for average([]) is useful. Returning a slope of 0 for a vertical linear regression is suspect.
Any choice of behavior for x/0 will be wrong in some context, and the question is really about how much help you want from the computer (both from the type system in trying to prevent/model division by 0 and at runtime via errors, via choosing a value for the division, etc).
- Tainnor 6y agoyeah which is precisely what I'm saying (that last part).