Hacker News new | ask | show | jobs
by hansvm 2179 days 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).

1 comments

yeah which is precisely what I'm saying (that last part).