Boost logo

Boost Users :

From: Daryle Walker (darylew_at_[hidden])
Date: 2002-06-12 19:16:37

on 6/12/02 12:11 AM, ravioli_at_[hidden] wrote:

> Is there an interest into having a power() template calculating the N-th power
> of any number, when N is known at compile-time ?t uses the algorithm of the
> STL power function(), and runs between two or three times faster, and maybe
> could be of interest in the " <boost/math/common_factor.hpp> which provides
> run-time and compile-time evaluation of the greatest common divisor (GCD) or
> least common multiple (LCM)

Proposals for new libraries usually go to the regular Boost list, not this
one. Besides that:

What would this have to do with the common-factor library?

I've never heard of a function called "power". Is it a STL function that
didn't get into the standard? Are there any docs for it? How do you know
what algorithm it uses?

> It simply works this way, for example to have PI at exponent three :
> double a = power_const<3>( 3.14159)
> As the single include file is very short, please apologize if I give it
> straight on, just to save your time and to have an idea how badly you judge my
> poor code ;)

I don't think your implementation will work for negative exponents.

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at