From: Cromwell Enage (sponage_at_[hidden])
Date: 2004-06-11 23:00:25
An update of my work is available in the
directory, filename mpl_math.zip
(MSVC 6 SP 5 burped an error when compiling
mpl_fraction.cpp; I didn't bother trying the other two
examples on it.)
--- Cromwell Enage <sponage_at_[hidden]> wrote:
> My current focus with regard to this endeavour is to
> provide a compile-time, arbitrary-precision integer
> that looks like this:
Actually it's called "big_integral" now.
> Once I get it to work, I should be able to roll out
> big_fraction and big_rational the same way I did
> fraction_c and rational_c, after which I'll consider
> building fixed_c on top of big_rational.
The negate, add, and multiply metafunctions are now
operational for big_integral, but I still need to
tackle divide, modulus, greatest_common_divisor, and
least_common_multiple before I can build the other
> Right now I could wrap the digits in a vector_c,
> with the unspecified digits set to -1, then perhaps
> use iter_fold_backward to convert it into a
> little-endian digit sequence so I could process the
> value more easily. I believe the issue there is
> that the user has to #define
> BOOST_MPL_LIMITS_VECTOR_SIZE before
> #including big_integer in order to increase the
> precision beyond 10 digits, right? What should I do
> in this case?
I haven't made the precision completely independent of
BOOST_MPL_LIMITS_VECTOR_SIZE, but I've given the user
the ability to increase the precision by setting the
to whatever value she deems fit. The default value is
4, which when multiplied with
BOOST_MPL_LIMITS_VECTOR_SIZE amounts to a default
precision of 40 digits.
A minor issue with this setup is that when setting
user should also set BOOST_MPL_BIG_INTEGRAL_DIGIT_TYPE
to the appropriate integer type (unsigned int by
default). Should I use MPL's sizeof construct to
remove this potential dependency?
BTW, I'm looking forward to the new MPL docs. Maybe
then I'll learn to use MPL lambda + iterators properly
instead of using Boost.PP as a crutch.
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk