Hi Minjeong,
You must be very careful with the C++ function abs in math.h.
This function is for integers and returns an integer. If you want to use
math.h, you should use fabs for floats.
If you use TMath::Abs function, this function will work for all
data types. So you cannot get your reported behaviour for TMath::Abs.
Please confirm.
Rene Brun
On Thu, 11 May 2000, Minjeong Kim wrote:
>
> Hi Rooters,
>
> I work with ROOT 23/11 version on KCC. While I am debugging my analysis
> codes, I discovered one mysterious thing. It looks like a bug, but I am
> not so sure. If this is a bug, I hope it can be fixed in later version
> since this is important in order to prevent big mistake sometimes. This
> doesn't show error message and if we don't have any expectation on
> analysis results, it might induce wrong interpretation of analysis.
>
> I tried next two cases to fill histogram.
>
> Case 1 :
>
> When I fill abs(aaa-bbb) from my ntuple in this way :
> MyTree->Draw("abs(aaa-bbb)>>MyHistogram",MyCut,"goff");
> My histogram was O.K.
>
> Case 2 :
>
> When I did calculation first to fill my histogram in this way :
>
> Float_t diff;
> diff = abs(aaa-bbb) ; or diff = TMath::Abs(aaa-bbb);
> MyHistogram->Fill(diff);
>
> My histogram was so strange and I checked numbers with printing.
> All numbers(diff) were changed into integers. Of course aaa and
> bbb were also defined as Float_t.
>
> Does anyone have the same experience as mine?
>
> Minjeong
> ================================
> Min Jeong Kim (CDF/KHCL)
> E-mail : mjkim@fnal.gov
> Office : CDF 137-B (X8473)
> ================================
>
>
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:25 MET