Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-11-09 01:52:39


On 11/9/05, Cromwell Enage <sponage_at_[hidden]> wrote:
> --- Peder Holt wrote:
> > I have implemented the compile-time inverse_sine and
> > inverse_tangent (the latter only for x<=1)
>
> Are those arcsine and arctangent metafunctions?
> There's an existing implementation of arctangent that
> should work for all real numbers.

I didn't notice. I'll check it out an look at its convergence rate.

>
> > but have a bit of a problem with arcus_cosine, which
> > is defined as pi/2-inverse_sine.
>
> A problem, indeed.
>
> > So far, all implementations of math metafunctions
> > should work with both double_ and your mixed_number
> > etc. types, but once we introduce a constant, the
> > result type is given, unless there is some clever
> way
> > of defining the constant several times for all the
> > different input types.
>
> Looks like we'll need a pi<> metafunction that takes
> in a numeric tag such as double_tag and an integral
> constant defining a series limit. Since your double
> has a fixed precision, pi<double_tag> can return a
> simple typedef and ignore the series limit, while the
> primary definition of pi<> has to return the result of
> the series. We're not making a "constants library" in
> the usual sense, so maybe we can get away with it.
>
> If all interested parties agree with this plan, the
> next question is, where should we put pi<>? So far, I
> have two candidates:
>
> * boost::mpl::math, since zero<> also resides there
> * boost::mpl::math::constants

boost::mpl::math, then probably.

>
> > Also, I have managed to squeeze more performance out
> > of the compiler by replacing integral operations in
> > the metafunctions with BOOST_STATIC_CONSTANT.
>
> Yeah, I've discovered this with big_integral, too.
> Only backward-compatibility concerns have held me back
> from employing this technique elsewhere. (I don't
> have a Class B compiler on-hand though, so I don't
> know if my fears are unjustified.)

Don't think this is an issue.
MSVC6.5 at least prefers BOOST_STATIC_CONSTANT, as they are much
easier to handle than excessive template instantiations.

>
> [snip code]
>
> > I think it should be possible to only use 4
> > arithmetic meta-operation per term, typically
> > (a+b*x*next)/c where a,b and c are calculated using
> > BOOST_STATIC_CONSTANT
>
> I'll #ifdef 0 out the code to be replaced.

Ok.

Regards
Peder

>
> Cromwell D. Enage
>
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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