-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
Description
There are basically two way to deal with invalid input. First is to throw exception on invalid input and second is to return NaN. Both methods have advantages and disadvantages. Currently we use first method.
Throwing exception could be good for controlling NaN spread. Error is raised early and hopefully close to place of origin.Indeed finding out where NaN did appear could be time consuming process.
On the other hand returing NaN gives caller chance to deal with error. This is especially important is code is passed as calllback to C function (e.g. minimization routine). In this case exception means immediate program termination.
So only sensible choice is to give user choice. It's hoever unclear how to do so unobtrusively.