Because of the performance penalty, it is probably also a good idea to only do something different if the dtype can hold a NAN, i.e. only for floating point types.