Work around for old Cython on cluster

Doesn’t support isnan or isinf from  the math lib.

Added a real number test instead, which tests numbers are in a given
range. Tested this in C, should show error on NaN or INF