NaN problem

Does ROOT (or any standard that ROOT supports) have a way of checking for the NaN value? I have a program that’s producing them like no one’s business, and they’re slipping past all my sentinel checks including a

if(x!=x) one which should catch it. I have tried isnan() but it doesn’t seem to recognize that one.

Thanks for any help in advance.

see TMath::IsNaN
I recommend the use of valgrind to find this kind of problem.


Thanks for the answer… forgive my ignorance, but what is Valgrind?


valgrind is a mem checker, see You could also try gSystem->SetFPEMask(kAllMask). That will cause an exception to be thrown when a floaing point problem is encountered. You can check the possible parameter values in the enum EFpeMask in TSystem.h.

Cheers, Axel.