float f = (float)\'a\';
if(f < 0){
}
else if(f == 0){
}
else if(f > 0){
}
else{
printf(\"NaN\\n\");
Following C program will produce a NaN. The second statement will result in a NaN.
#include
#include
#include "math.h"
int _tmain(int argc, _TCHAR* argv[])
{
double dSQRTValue = sqrt( -1.00 );
double dResult = -dSQRTValue; // This statement will result in a NaN.
printf( "\n %lf", dResult );
return 0;
}
Following will be the output of the program.
1.#QNAN0