next up previous contents
Next: Dyadic digit representation Up: General Issues Previous: General Issues

Use of fixed and arbitrary length integers

There are many functions which appear in the implementation which take integers as arguments and where the integer may in theory be arbitrarily large. If, for example, we need a function which prints out a specified number of digits, the integer specifying the number of digits might be arbitrarily large. For the purposes of implementation, however, there are a large number of cases when a fixed length (eg. word length, 32-bit) integer will suffice. For example it is highly unlikely that the user would ever require more than say 2147483648 ( = 231) digits, and if they did the time and space requirements would be so enormous that the program would never be able to supply them anyway.

The advantage of avoiding arbitrary precision integers where possible is that the code becomes slightly more efficient. The decision as to whether to use a 32-bit integer instead of an arbitrary length one must be made on a function by function basis and is not always an acceptable optimisation.

Martin Escardo