I came across this code that spews a warning with gcc:
float f;
// Calculate a value for f
if (!f == 0.0)
{
// Handle it being non-zero
}
It was probably just a typo by another team member, and examining the code what was really meant was:
if (f != 0.0)
// OR
if (!(f == 0.0))
I've corrected the code, but I was just wondering what would !NaN evaluate to. We use the f value inside the if, so we don't want NaNs getting past the check.