Is there somewhere in ROOT a method that would compare two floating point values (either Float_t or Double_t) for equality ?
I’m know there are various tricks to get such a (trivial) function to work properly in all cases (i.e. near zero), so I’d better not reinvent the wheel here and cook my own…
yes, use the C++ operator “==”. That’s all that anyone can provide you with - everything else depends on the details of your calculation (e.g. what error do you expect etc). The euqality operator compares two doubles / floats and checks that they are equal up to their precision. If you know that two equal numbers a, b will differ by <d due to e.g. rounding errors in your calculation then use
if ((a-b)(a-b)<dd) then std::cout << “equal!” << std::endl;