how to handle nan situation (MAX31855)

Hi

I have a MAX31855 used for K thermocouple that sometimes send a "nan" instead of a number.
This crashes my program, so I need to handle it and take the right action so my program can continu without crashing.

First I was requesting a

thermocouple.readCelsius();
thermocouple.readInternal();

every 200ms and I thought it was too much despite the 70-100ms request time advise in the datasheet (don't know if this delay time is for 1 request or for both (Tc and internal).
So I requested both every 300ms but the MAX 31855 still sometime send "nan" !

So I need to handle this situation but I don't know how since I declared the variable storing these value as

double temperature_Tc_K = thermocouple.readCelsius();

I would like to update a counter relating to each "nan" and send the last value is case of a "nan"

You write it "NaN" but when it occurred to me I remember it was "nan" !

Isn't it case sensitive ? Sorry for insisting but the error is not easy to catch. I was lucky to notice my program was crashing because of it !

Thanks for your help.

if(someFloat == nan)

gives

exit status 1
'nan' was not declared in this scope
if(someFloat == NaN)

gives :

exit status 1
'NaN' was not declared in this scope
if(someFloat == "nan")

gives :

exit status 1
invalid operands of types 'double' and 'const char [4]' to binary 'operator!='

There is an isnan() function...