31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5<br />

Number Types and Linear Algebra<br />

5.1 Integers of Arbitrary Length ( integer )<br />

1. Definition<br />

An instance of the data type integer is an integer number of arbitrary length. <strong>The</strong> internal<br />

representation of an integer consists of a vector of so-called digits and a sign bit. A digit<br />

is an unsigned long integer (type unsigned long).<br />

#include < <strong>LEDA</strong>/numbers/integer.h ><br />

2. Creation<br />

integer a; creates an instance a of type integer and initializes it with zero.<br />

integer a(int n); creates an instance a of type integer and initializes it with the value<br />

of n.<br />

integer<br />

a(unsigned int i);<br />

creates an instance a of type integer and initializes it with the value<br />

of i.<br />

integer a(long l); creates an instance a of type integer and initializes it with the value<br />

of l.<br />

integer<br />

integer<br />

a(unsigned long i);<br />

creates an instance a of type integer and initializes it with the value<br />

of i.<br />

a(double x); creates an instance a of type integer and initializes it with the<br />

integral part of x.<br />

integer a(unsigned int sz, const digit ∗ vec, int sign = 1);<br />

creates an instance a of type integer and initializes it with the value<br />

represented by the first sz digits vec and the sign.<br />

65

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!