Boost logo

Boost :

Subject: Re: [boost] returning floating point values from a metafunction
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-01 15:03:45


On Fri, Jul 1, 2011 at 10:39 AM, Kenny Riddile <kfriddile_at_[hidden]> wrote:
[...]

> I was just trying it for fun. I already had a preprocessor macro solution,
> but wanted to see how feasible a pure TMP solution would be. This is fairly
> accurate though:
>
> http://pastebin.com/jz69vxYn
>

Just a quick suggestion: you can replace the x * x * ... * x's with
boost::math::pow<n>(x):

http://www.boost.org/libs/math/doc/sf_and_dist/html/math_toolkit/special/powers/ct_pow.html

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk