Problems with Double_t

Hi - I’m using ROOT 4.00/08.

I have a compiled class called cutManager. Here’s an example:

cutManager * MESManager = new cutManager(“MES”,80,5.14,5.3)

Now the 5.3 you see above is used to initialize a Double_t member variable called _highBin. Now, if you print out the value of _highBin to 20 decimal places, it comes out as 5.2999999999999998224

This is causing problems when I book histos and the bin edges are slightly off. Then TH1::FindBin() doesn’t quite work properly.

Is this a known problem, and is there a way around this? Thanks.

Hello.

I think, this “problem” is not a ROOT specific problem. May be you should read about floating point arithmetic. Fo example, look here

docs.sun.com/source/806-3568/ncg_goldberg.html