TMath::AreEqualRel

I am not sure if it is how it is supposed to be, but I think TMath::AreEqualRel does not work for zeroes: TMath::AreEqualRel(0,0, anything). Looking at the sourcecode:

return TMath::Abs(af-bf) < 0.5*relPrec*(TMath::Abs(af)+TMath::Abs(bf));

for two zeroes it returns 0<0, which is always false. <= would solve the problem, however than it is a slightly different comparison :slight_smile: The question is: is it currently how it was supposed to be - the function not working properly for two zeroes?

You are right. I have modified this function in the SVN trunk to use “<=” instead of “<”.
Thanks for noticing this case.

Rene