I've added appropriate comments. -- Fons George Heintzelman wrote: > > > root [315] TMath::Nint(0.50) > > (Int_t)0 > > root [316] TMath::Nint(1.50) > > (Int_t)2 > > root [317] TMath::Nint(2.50) > > (Int_t)2 > > root [318] TMath::Nint(3.50) > > (Int_t)4 > > root [319] TMath::Nint(4.50) > > (Int_t)4 > > root [320] TMath::Nint(5.50) > > (Int_t)6 > > root [321] TMath::Nint(6.50) > > (Int_t)6 > > root [322] > > > > May be the problem is in the representation of floats. > > I tried also double precision with the same result. > > In any case it would be fine to have regular behavior > > with rounding either up or down. > > This is a regular behavior, known as the 'banker's round' -- round > half-integers to the nearest even number. Otherwise the rounding does > not preserve averages when applied to data sets with quantized values > including exactly half-integral numbers. > > However I would think having some documentation on this in TMath::Nint > would be useful. > > George Heintzelman > gah@bnl.gov -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET