see if float is nan c++ code example
Example 1: C++ is nan
doubel a = 0 ;
bool isnan_a = std::isnan(a) || std::isnan(-a);
Example 2: c++ double is nan
/* isnan example */
#include <stdio.h> /* printf */
#include <math.h> /* isnan, sqrt */
int main()
{
printf ("isnan(0.0) : %d\n",isnan(0.0));
printf ("isnan(1.0/0.0) : %d\n",isnan(1.0/0.0));
printf ("isnan(-1.0/0.0) : %d\n",isnan(-1.0/0.0));
printf ("isnan(sqrt(-1.0)): %d\n",isnan(sqrt(-1.0)));
return 0;
}