Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-09-21 08:53:00

--- In boost_at_[hidden], Beman Dawes <beman_at_e...> wrote:
> At 03:38 PM 9/20/2000 -0600, Dan Nuffer wrote:
> >A few years ago I wrote a class like this. It acts like a signed
> >integer and the range is only limited to the amount of memory you
> >You can download it from:
> >
> >
> >
> >I placed it into the public domain, and anyone is free to use
it. If
> >there is interest, it could be cleaned up and submitted to
boost. It
> >also needs some performance work, as I took the straightforward,
easy to
> >code approach and didn't do any fancy algorithms.
> Dan,
> Did you look at Daryle Walker's
> posting?
> Did your classes have any advantages over Daryle's?

He was responding to my post, and I've seen his bigint before, so I
feel entitled to respond here.

Yes, it has advantages, as well as disadvantages. The two are
distinct types, and I was proposing that we need both types. A
bitint is a fixed size integer, where you specify the bit-size.
While not as fast as built in integer types it is still relatively
fast and allows you to have very large integers as well as
specifically sized integers (such as an int64_t for compilers that
don't have built in 64 bit integers).

Mean while, a bigint is a variably sized integer. As you make
calculations on the bigint it's size (bit-size) will increase to
accomodate the results. So the size starts out minimal to save
space, but if use dictates that it needs to be larger it will scale
up as much as memory will permit. Calculations are much slower on
such a type in comparison to built in types or bitint, but the
flexibility in scaling can be quite important for some cases.

So, they have different advantages/disadvantages and are used to
solve different problems.

Bill Kempf

Boost list run by bdawes at, gregod at, cpdaniel at, john at