|
Boost : |
From: Cromwell Enage (sponage_at_[hidden])
Date: 2005-07-17 16:46:26
--- Peder Holt <peder.holt_at_[hidden]> wrote:
> To test the accuracy, I have tested it against
> Cromwell's sine-implementation (which by the way had
> a bug: Instead of
> 1-(angle*angle*/((2*i+2)*(2*i+3))*next_term it had
> (angle*angle*/((2*i+2)*(2*i+3))*next_term-1)
Muy bien, jefe, I will fix it for my next version.
> There are four ways to construct a double:
> integral_to_double<mpl::int_<-355> > or
> integral_c_to_double<int,-355>::type
>
string_c_to_double<3,'.',1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4,3,3,8,3,2,7,9>
> typedef
>
BOOST_DOUBLE(3.141592653589793238462643383279502884197169399375105820974944592)
> pi;
> double_<mantissa<0x6487ed51,0x085a3000>,1,0>
> <-Equivalent of pi.
>
> 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).
> 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.
> 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.
> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk