Algorithmic Solutions > LEDA > LEDA Guide > Number Types > Integers of Arbitrary Length

## Integers of Arbitrary Length

The data type integer represents an integer number of arbitrary length. Integers are used heavily in LEDA's geometric algorithms

### Example

The following program shows how to use integer to compute the factorial of an int n. (Notice: With int usually only 32! would be possible)
```#include <LEDA/numbers/integer.h>

leda::integer factorial(int n)
{
leda::integer fac=1;
int i;
for (i=2; i<=n; i++) fac=fac*i;
return fac;
}

int main()
{
int i;
for (i=0;i<100;i++) {
std::cout << "factorial(" << i << ")="
<< factorial(i) << std::endl;
}

return 0;
} ```

### Strengths

• no overflow/underflow like built-in type int
• always yields exact result
• can be used like int and together with built-in number types
• many arithmetic operations, like square root, greatest common divisor,… , predefined
• efficient implementation
• space efficient (no intermediate results are stored)

• about 30-100 times slower than double

### Tips

• Use integers if you need exact arithmetic
• Use integers if you can not afford overflow/underflow
• Use integers if you do not know how big your (interger) numbers will become

Algebraic Real Numbers

Rational Numbers

Interval Arithmetic

Vectors and Matrices with Integer Entries

Vectors and Matrices with Double Entries

Rational Vectors

Functions of numerical analysis

Manual Entries:

Manual Page Integers of Arbitrary Length