|
Boost : |
Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-01-26 17:38:58
Andrii Sydorchuk wrote:
>The main reason vornoi fixed_int outperforms multiprecision fixed_int is that it doesn't operate with leading bytes if those are not set.
Interesting, do you store the length of your voronoi fixed_int separate from the array? I see no other way to implement the optimization. It isn't a completely obvious thing to do. From your wording it sounds like you may even leave unused bytes in an uninitialized state. Is that the case? Presumably one would set the leading bytes to zero for positive numbers and FF for negative numbers for 2's complement representation. Arithmetic becomes a little more complex as when we run out of bytes in one array we must continue working with just the other until carry resolves itself, but then have the option of early termination and copying over the rest to the result. The common case we should expect is two small numbers or one small and one large number.
Cool,
Luke
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk