User Tools

Site Tools


root:nanfinite

This is an old revision of the document!


Treatment of non-real numbers

Idea

If the result of a calculation in your code is an infinite number or an imaginary number, this may lead to problems (when drawing histograms, etc.). The following two methods help to catch these cases.

Infinity

Include TMath.h in your header-file, and in the code write

if(!TMath::Finite(myexpression)){
...
}

to catch the cases where myexpression becomes infinite.

Imaginary number

Include TMath.h in your header-file, and in the code write

if(TMath::IsNaN(myexpression)){
...
}

to catch the cases where myexpression becomes a non-real number.

root/nanfinite.1234948204.txt.gz · Last modified: 2009/02/18 10:10 by decianm