add math. to isnan
x==x instead of isnan(x) in c++