Checking not a number value



Hi
I have a variable X, this variable sometimes returns not a number (nan). I want to check this variable if it is a not number or a number and make this variable equal to zero if it is not a number (nan). Anyone can help me plz..
Regards




As I am beginner, can u plz check this code:
if (isnan( double X ))
{
X=0;
}

1
2
3
4
if (std::isnan(X))
{
	X = 0;
}

Don't forget to include <cmath>.
Last edited on
Okay.
Thanks it is working now.
Topic archived. No new replies allowed.