
25 Jun
2012
25 Jun
'12
10:51 a.m.
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.