[ROOT] TMath::Nint

From: Martin Veselsky (martin@orion1.tamu.edu)
Date: Mon Nov 27 2000 - 18:46:05 MET


Hi
there is some irregularity in behavior of TMath::Nint() function when
half-integer numbers are specified. See example in interactive session
( the same applies also to macros ):

root [315]
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. The Root version used
was 2.25/03 on RedHat Linux 6.0 and 6.2, one binary installation
and the other one compiled from source rpm.
with best regards

Martin



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET