Integers of Arbitrary LengthThe data type integer represents an integer number of arbitrary length. Integers are used heavily in LEDA's geometric algorithmsExampleThe 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
Disadvantages
Tips
|
See also:Vectors and Matrices with Integer Entries Vectors and Matrices with Double Entries Functions of numerical analysis Manual Entries: Manual Page Integers of Arbitrary Length
|