0

I found _isnan() in float.h for VS2008, but I would like to SET a variable to a NaN intentionally, not check if it is one.

Is this possible?

Thanks,

David

3
Contributors
3
Replies
5
Views
9 Years
Discussion Span
Last Post by daviddoria
0

>Is this possible?
Yes, but it's not the most brilliant of ideas. What exactly are you trying to do that prompted this question?

0

I found quite_NaN and it seems to work well - i'm surprised there is no "isnan" function included though!
you can write a simple one though

bool isnan(double x)
{
return (x!=x);
}
which utilizes the fact that NaN's are not equal to anything, even themselves.

I have a big grid of numbers that I am reading in, but sometimes instead of a number i get a "blank" that i need to put something in to recognize that there was infact nothing there.  How else would I do that without nan's if the possible values of these numbers range from -inf to inf?

Thanks,

Dave
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.