Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-11-09 14:38:10


On 11/9/05, Cromwell Enage <sponage_at_[hidden]> wrote:
> --- Peder Holt wrote:
> > --- Cromwell Enage wrote:
> > > There's an existing implementation of arctangent
> > > that should work for all real numbers.
>
> Correction: it also only converges for |x| <= 1.
>
> > I didn't notice. I'll check it out an look at its
> > convergence rate.
>
> It's the Maclaurin series, and it's rather slow.
>

I have a series available that converges for X>1. I'll implement it
once the pi<> template is ready.

<snip>
>
> And what did I do instead? I reimplemeted a majority
> of the advanced metafunctions by using
> Boost.Preprocessor to unroll the recursion. (You must
> now #define the corresponding limit macro for each
> metafunction, and you have a hard limit of 255
> depending on the metafunction, but it beats exceeding
> the template instantiation depth.) Best of all,
> euler.cpp compiles and works just fine.

Great job! I did the same for tangent, and compile times for
tangent.cpp dropped from 18 to 12 seconds.

Btw. How about making the syntax a bit clearer by dropping the
BOOST_PP_MUL etc. syntaxt? Why not just:

        typedef typename minus< \
                    int_<1> \
                  , times< \
                        divides< \
                            angle_squared \
                          , int_< \
                                (\
                                    (BOOST_MPL_LIMIT_MATH_SINE_SERIES-x)*2+1\
                                )*\
                                (\
                                    (BOOST_MPL_LIMIT_MATH_SINE_SERIES-x)*2\
                                )\
>\
> \
                      , BOOST_PP_CAT(prefix, x) \
> \
>::type \

I think this is more readable, and less limited (BOOST_PP_MUL(129,2)
exceeds 256, not that it matters much, as we should never have this
long series :)

Have uploaded a version of tangent that uses the preprocessor, plus a
version of arcus_sine and an alternative arcus_tangent that does not
:) to the vault.

Regards,
Peder
>
> Cromwell D. Enage
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> 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