Re: Power function in TMath

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Thu, 22 Jul 2010 00:00:46 +0200


Hi Alexander,

 I am planning to change in Tmath to use for all basic mathematical function those defined in cmath and not math.h When I'll do this, I will add also TMath::Power(double, int). This will happen probably when I'll be back from vacation in August.

Cheers, Lorenzo

On Jul 21, 2010, at 9:06 PM, Axel Naumann wrote:

> Hi Alexander,
> 
> what's in TMath is independent of what CINT does. So yes, I agree, this
> overload should be added to TMath and I believe Lorenzo is planning on
> doing that. I let him speak for himself, though :-) (He's just back from
> a conference and still catching up with emails, so please give him a day
> or two.)
> 
> Cheers, Axel.
> 
> On 7/21/10 8:40 PM, Alexander Voigt wrote:

>> Hi Benjamin,
>>
>>> So if inside a ROOT macro you say pow(2, 2) or pow(2,2.) you should get
>>> what you want (this doesn't even require you to include cmath since CINT
>>> appears to already know about it).
>>> 
>>> Not that using a ROOT macro probably won't give you the performance
>>> boost seen by in that test since you don't have the full set of
>>> optimizaitons available -- and if you would compile your code with ACLiC
>>> or directly you could just use std::pow from cmath yourself.

>>
>> You are completely right, I could always use std::pow(double,int) for
>> myself. I just thought, that it would be convenient for the users to
>> have a TMath::Power(Double_t,Int_t) function in ROOT which is faster
>> than TMath::Power(Double_t,Double_t) for integer exponents. The latter
>> just encapsulates pow() from math.h, so, why not have
>> std::pow(double,int) encapsulated in TMath? Ok, just a thought. :)
>>
>> Kind regards,
>> Alexander Voigt
>>
>>

> Received on Thu Jul 22 2010 - 00:01:29 CEST

This archive was generated by hypermail 2.2.0 : Thu Jul 22 2010 - 11:50:01 CEST