# How large are arbitrarily large integers? (Was Re: Bitfield subtlety)

paul zimmermann Paul.Zimmermann at inria.fr
Fri Mar 30 13:01:10 UTC 2018

```> For some reason, I also limited the choices so that either 8 or 16 bits
> are added to the _mp_size field.  That might give a small speedup in
> some cases, perhaps, but the result is that only one balanced
> possibility  remain:
>
> b = 2
> manstissa bits = 10
> exponent bits = 6
>
> Let's abbreviate this as (2,10,6).
>
> This gives an allocation range of almost 2^73 limbs, which is of course
> silly, but (2,11,5) would result in just the range 2^42 limbs.

another possibility is the "unum" type, where some bits are used to define
how many bits are used for the significand and exponent:

https://en.m.wikipedia.org/wiki/Unum_(number_format)

In the limit of unum, you could use only 1 extra bit, say for a 31-bit type
(thus with 30 remaining bits):

1) if 0, the 30 bits are interpreted as a size between 0 and 2^30-1
2) if 1, the 30	bits are split into say 24 significand bits and 6
exponent bits, which would be enough up to 2^87 with an overhead of
less than 1e-6

Paul
```