Re: [ROOT] Modifications to TMath

From: cstrato (cstrato@aon.at)
Date: Wed Apr 28 2004 - 23:33:02 MEST


Dear Rene

Thank you for this info.

Best regards
Christian

Rene Brun wrote:

> Hi Christian,
> 
> I will make these functions inline. On my machine, I tested
> that you can call TMath::Floor 10 million times in 0.3 seconds
> 
> Rene Brun
> 
> On Wed, 28 
> Apr 
> 2004, cstrato wrote:
> 
> 
>>Dear Rene
>>
>>I have also a question regarding TMath:
>>I have a method, where I call floor or ceiling more than
>>500,000 times. Is there a reason why TMath::Ceil and
>>TMath::Floor are not defined as inline methods?
>>Would calling TMath::Floor instead of floor increase
>>the execution time?
>>
>>Best regards
>>Christian
>>
>>Rene Brun wrote:
>>
>>
>>>Hi F.X,
>>>
>>>I have protected TMath::Acos and ASin in the CVS version.
>>>
>>>Rene Brun
>>>
>>>On Wed, 28 Apr 
>>>2004, GENTIT Francois-Xavier  DAPNIA wrote:
>>>
>>>
>>>
>>>>Hello Rooters,
>>>>
>>>>
>>>>
>>>>Concerning the discussion about modifications in TMath, I want to report
>>>>about a problem I had recently. Try the following (in CINT or in compile
>>>>mode, it does not matter)
>>>>
>>>>
>>>>
>>>>--> Double_t a = 1.0;
>>>>
>>>>--> Double_t b = 4.0e-16;
>>>>
>>>>--> a += b ;
>>>>
>>>>--> Double_t c = TMath ::ACos(a)
>>>>
>>>>
>>>>
>>>> c is now equal to -1.#IND. If you are a purist, you will say ok, nothing
>>>>wrong, because the ACos of a value bigger than 1 does not make sense. But
>>>>such a small error as 4.0e-16 is normal when calculating in double
>>>>precision. So that it happens! For me, it happened when doing the scalar
>>>>product of 2 unit vectors which were parallel. And it does not crash the
>>>>program, but the program continues delivering wrong results!
>>>>
>>>> This is a nasty problem which obliged me to derive a new ACos (and ASin)
>>>>function with protections.
>>>>
>>>>
>>>>
>>>>F.X.Gentit
>>>>
>>>>DAPNIA/SPP CEA Saclay
>>>>
>>>>http://gentit.home.cern.ch/gentit/
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
> 
> 
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET