Return NaN instead of DomainError

Basically as I said above, “if a 3rd-party library calls C (or other) function or external program” - so you have a C library Foo, a Julia wrapper Foo.jl which just ccall’s the C code and performs some postprocessing calculations. If you as the package user want to evaluate function from Foo.jl in a region they are not defined, all you get is an exception instead of e.g. an array where only the out-of-bounds values are NaN’s.

This is an actual case I have in Python now, and there it obviously works fine - all NaNs propagate straight to the final result. Was looking for simplest ways to port and the library to julia.

Another issue with using this approach is that it’s significantly slower - NaNMath is about 2x slower for me compared to Base math functions.