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.

int residual :: required primetable size(int b)<br />

returns the number of primes required to represent<br />

signed numbers up to bit length b<br />

<strong>The</strong> following functions have the common precondition that the residual objects a, x<br />

are integral and do not overflow.<br />

integer x.to integer( ) returns the integer equal to x.<br />

long x.length( ) returns the length of the binary representation of<br />

the integer represented by x.<br />

bool x.is long( ) returns true if and only if x fits in the data format<br />

long.<br />

long x.to long( ) returns a long number which is initialized with the<br />

value of x. Precondition: x.is long( ) is true.<br />

double x.to double( ) returns a double floating point approximation of x.<br />

double x.to float( ) as above.<br />

bool x.is zero( ) returns true if and only if x is equal to zero.<br />

bool x.is invertible( ) returns true if and only if x is nonzero and the current<br />

modular representation of x allows to invert x<br />

without loss of information.<br />

int x.sign( ) returns the sign of x.<br />

int x.lagrange sign( ) returns the sign of x using Lagrange’s formula.<br />

int x.garner sign( ) returns the sign of x using Garner’s formula.<br />

string x.to string( ) returns the decimal representation of x.<br />

residual abs(const residual& a) returns the absolute value of a<br />

void x.absolute(const residual& a)<br />

sets x to the absolute value of a.<br />

<strong>The</strong> remaining functions do not have implicit preconditions. Although not explicitly<br />

mentioned, the arithmetic operations +, −, ∗, /, +=, −=, ∗=, /=, ++, −−, the shift<br />

operations, the comparison operations , ≥, ==, != and the stream operations are<br />

available.<br />

residual sqr(const residual& a) returns a ∗ a<br />

residual det2x2(const residual& a, const residual& b, const residual& c,<br />

const residual& d)<br />

returns a ∗ d − b ∗ c

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

Saved successfully!

Ooh no, something went wrong!