NaN comparison

Dear Expert,

When I compare two double numbers, if they are NaN, the result is false.

root [0] double a = 0./0;
root [1] double b = 0./0;
root [2] a
root [3] b
root [4] a == b

So, is this expected?



I don’t know if CINT makes exception, but it seems to be the expected behaviour: … alues-in-c

Yes, it is expected, see:

To check if a number is a NaN you can do:

root [3] TMath::IsNaN(a)

Knowing that you can adapt your code and make a more appropriate testing procedure.

1 Like