Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-10-31 13:42:18

On 10/31/05, Cromwell Enage <sponage_at_[hidden]> wrote:
> I've now added a BOOST_MPL_CFC_NO_MATH_DOUBLE macro
> that is defined in
> <boost/mpl/aux_/config/math_double.hpp> when it is
> known that BOOST_MPL_MATH_DOUBLE won't compile.
> Please send me your compiler-platform configuration if
> BOOST_MPL_MATH_DOUBLE doesn't work for you.
> Peder, The double_::aux::get_value function still
> returns a number 2^16 times too big on MSVC 7.1 when
> the input is a whole number.

I do not observe this on my VC7.1 compiler. What I see, is another effect:
Using setprecision(40) causes some overflow in the iostream formatting
of double, so that
800.0 is outputted as 8000000. This error is only present for whole numbers.
Reducing setprecision to 36 eliminates the problem, and for every
extra digit of precision you specify, you get another 0 appended.

Also, BOOST_MPL_MATH_DOUBLE is very unstable on VC7.1, For whole
numbers between 10 and 100 it ICE's (Not so for negative whole numbers
between -100 and -10)
Adding a . at the end of the number, prevents the ICE.
typedef BOOST_MPL_MATH_DOUBLE(56) type; <-ICE
typedef BOOST_MPL_MATH_DOUBLE(56.) type; <-OK

I also found a continued fraction representation for tangent that
converges much faster (and better) than any of the series
representation I have found:

Here is an implementation of this series. It is much faster on the
tangent.cpp test file, and doesn't give warnings for double_....
Works in the range -pi/2,pi/2
(Remove the double/tangent.hpp overload first :)

    template <typename NumericTag>
    struct tangent_impl
         * Continued fraction representation
        template <
            typename AngleSquare
          , typename I
          , typename FractionCount
        struct fraction
            typedef typename eval_if<
                      , fraction<AngleSquare,plus<int_<1>,I>,FractionCount>
                      , mpl::int_<1>

            typedef typename minus<
                      , divides<AngleSquare,next_term>

        template <
            typename Angle
          , typename SeriesCount
        struct apply
          : divides<Angle,typename
             * Metafunction class return type.
            typedef typename divides<
                      , typename


> Cromwell D. Enage
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at