Updated ValidNumber to use code from http://www.johndcook.com/IEEE_exceptions_in_cpp.html - seems to be much faster

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>