Actually return a NaN when non-finite results happen in debug mode.