The IEEE floating point people thought this through, and a NaN is generated when there's no meaningful numeric value for a result. But they were just doing the floating point unit, which, at the time, wasn't even part of the main CPU. This led to a problem.
In IEEE floating point, the possible results of comparing two values are "greater", "less", "equal", and "none of the above". Any comparison involving a Not a Number is a "none of the above".
When "a > b" has no meaning, the hardware returns False. If a or b is a NaN, "a > b", "a < b", and "a == b" are all false. Most programmers don't expect that.
Booleans and branching don't handle this. There's no "not a boolean" value. A few languages throw an exception on if statements where the condition is undefined, but that's seldom hooked to floating point.
If you compute with non-signalling NaNs, don't compare the results until you've checked with "isnan()" that it's meaningful to do so.