| I don't find this convincing. > 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. |
NaN's are already an option type, although implemented in hardware. The checking comes for free.
> An exception would be much better
You can configure the FPU to cause an Invalid Operation Exception, but I personally don't find that attractive.