> > Hi, > I try, and try, and try, ... to understand what the TMath::Nint function > does, but I can't. I have the feeling that someone tries to swindle me. > Any help appreciated, > Jacek. > inline Int_t TMath::Nint(Float_t x) { int i = int(x + 0.5); if (x + 0.5 == Float_t(i) && i & 1) i--; return i; } This makes sense if one wants to count something essential (like money for example). The rounding rule getting the biggest value when x - [x] == 0.5 exactly causes the systematical error. The present approach allows eliminate that systematical error by shifting it into opposite directions between odd and even numbers. I hope you feel better yourself now. Valery
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET