|
Boost : |
Subject: Re: [boost] Multiprecision Review
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-06-25 06:51:15
> As I've said before, I imagine algorithms that operate on sequences of
> "limbs" (as John calls them), e.g. (PSEUDO-CODE)
>
> template <typename ITER, typename OITER>
> void add(ITER begin1, ITER end1, ITER begin2, ITER end2, OITER result)
> {
> bool carry = false;
> while (begin1!=end1 && begin2!=end2) {
> (carry,*result++) = add_with_carry(*begin1++,*begin2++);
> }
> }
Without wanting to reignite this discussion too much, I'll merely point out
that there are a number of situations where that would break - fixed
precision integers being but one. In most cases the fixes are trivial, as
long as you don't mind the performance hit - except of course you do :-(
Cheers, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk