Comparing a text string to text output (DHT22)
A "float" number has multiple possible states, besides just being a number (It never, though, can be compared to a string):


A real floating point number
Infinity
Something that isn't a valid number


The latter is what you want - that is, the internal data of the float variable doesn't represent a valid number.

There are two functions in the standard math library that deal with this for you.


Is the number infinity? ininf(x)
Is the number invalid? isnan(x)


To use it:

if (isnan(temp)) {
    lcd.print("Invalid");
}