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

(double)nan

root [3] b

(double)nan

root [4] a == b

(int)0

So, is this expected?

Thanks

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

(double)nan

root [3] b

(double)nan

root [4] a == b

(int)0

So, is this expected?

Thanks

Hi,

I don’t know if CINT makes exception, but it seems to be the expected behaviour:

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

```
root [3] TMath::IsNaN(a)
(Int_t)1
```

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

1 Like