> NaN/infinity values can propagate and cause chaos NaN is the most misunderstood feature of IEEE floating point. Most people react to a NaN like they'd react to the dentist telling them they need a root canal. But NaN is actually a very valuable and useful tool! NaN is just a value that represents an invalid floating point value. The result of any operation on a NaN is a NaN. This means that NaNs propagate from the…
> What do you return for an index into the array?
An option/maybe type would solve this much better.
> Yes, I know, it can be clumsy to trace it back to its source
An exception would be much better, alerting you to the exact spot where the problem occurred.