Re: Power function in TMath

From: Alexander Voigt <Alexander.Voigt_at_cern.ch>
Date: Wed, 21 Jul 2010 20:40:37 +0200


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 Wed Jul 21 2010 - 20:40:31 CEST

This archive was generated by hypermail 2.2.0 : Wed Jul 21 2010 - 23:50:02 CEST