Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-07-18 03:36:06


On 7/17/05, Cromwell Enage <sponage_at_[hidden]> wrote:

<snip>

> > The algorithm behind string_c_to_double is not very
> > efficient, so if anyone has a better idea for an
> > implementation, feel free to contribute :)
>
> string_c_to_double looks interesting, perhaps I can
> use the underlying mechanisms to implement
> big_integral (which currently takes too many resources
> to compile, so "not very efficent" is better in this
> case).

I think the implementation of divide_double_double is a better pattern
to follow. It uses a minimum of template instantiations internally,
but a pletorum of compile time constants. From my experience, this is
much faster compile-time wise than the opposite.

Ideally I would like to employ the same technique in string_c_to_double.

>
> > On the upside, this implementation uses a 61 bit
> > mantissa, so it is possible to utilize the full
> > mantissa without rounding when calculating e.g.
> sine.
> > This is done using
> >
> boost::metamath::detail::plus_double_double<a,b>::type
> >
> boost::metamath::detail::times_double_double<a,b>::type
> >
> boost::metamath::detail::divides_double_double<a,b>::type
>
> Would an MPL inner namespace be more appropriate?
> Say, boost::mpl::aux::double::plus<>,
> boost::mpl::aux::double::times, etc.

Maybe.

>
> > The user should then deal with rounding before
> > returning the final value:
> > boost::metamath::detail::round<a>::type;
> > or
> > boost::metamath::detail::cutoff<a>::type;
> > if no rounding is wanted.
>
> Would it be more practical to pass two arguments to
> each metafunction? Users don't always want to round
> to the nearest integer; e.g. for trigonometric apps
> one might need to round to the nearest PI/8.

Sorry. Bad explanation of what rounding means in this context:
Rounding and cutoff here means fitting a 61 bit mantissa into a 52 bit
mantissa by taking the 53'rd bit of the mantissa into account
(rounding) or not (cutoff)

Regards,
Peder

>
> > The source is available from the vault:
> > http://boost-sandbox.sourceforge.net/vault/
> > <metamath.zip>
>
> Cool, I'll study it further when I get the chance.
>
> Cromwell D. Enage
>
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
> _______________________________________________
> 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