Fixes #1924 where numpy 1.17+ would report the (transient) FE_INVALID exception raised for the domain error.