If a double variable is NaN?

Hi, folks,
I wrote a statistics program to do some parameter estimation. It involves at least 100.000 loops. Some of the results are reported as -1.#IND00. But I don't know in which loop it went wrong. So I wish to chase the error down with an if expression, conditioning on an double variable x_tr_x becoming -1#IND00. How can I do this? First thought :
if (x_tr_x == "-1#IND00")
{do something}

It did not work due to different variable types.
Second thought:
if (x_tr_x == -1#IND00)
{do something}

doesn't work either.

Please help me out. How can I hunt down a variable turning to -1.#IND00? Thank you!

Last edited on
if a variable is -1.#IND, then this expression will be true: variable != variable

http://www.cplusplus.com/forum/general/6288/#msg28783
thank you for the suggestion. I will try it.
Thank you Bazzy. It did work to solve the problem. Gott bless this forum!
Topic archived. No new replies allowed.