Is it possible to assign a double to NaN in c++ like:
Suggestions welcome...Code:double number = NaN;
Printable View
Is it possible to assign a double to NaN in c++ like:
Suggestions welcome...Code:double number = NaN;
Try typing it into a compiler and seeing if it compiles/runs correctly.
If you want to go down to that level and as your code will now not be portable among architectures, you might as well use inline assembler....Quote:
Originally posted by Hardboy
Is it possible to assign a double to NaN in c++ like:
Suggestions welcome...Code:double number = NaN;
Code:__asm
{
//your instructions here
}
Exercise for hardboy:
double NaN = 0.0 / 0;
double NaN = 1.0 / 0; // this one for infinite and NaN
and
int _isnan( double NaN );
int _finite( double NaN );
these two for testing the infinity or NaN characteristics
But before you begin, turn off hardware exceptions (you need not to do it in Win32, they are turned off already)