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.

ounding modes bigfloat :: get rounding mode( )<br />

returns the currently active global rounding mode<br />

output modes bigfloat :: set output mode(output modes o mode)<br />

sets the output mode to o mode and returns the old<br />

output mode<br />

A bigfloat x can be rounded by the call round(x, prec, mode, is exact). <strong>The</strong> optional<br />

boolean variable is exact is set to true if and only if the rounding operation did not<br />

change the value of x.<br />

integer to integer(rounding modes rmode = TO NEAREST ,<br />

bool& is exact = bigfloat :: dbool)<br />

returns the integer value next to x (in the given rounding<br />

mode)<br />

integer to integer(const bigfloat& x, rounding modes rmode = TO NEAREST ,<br />

bool& is exact = bigfloat :: dbool)<br />

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

3. Operations<br />

<strong>The</strong> arithmetical operators +, −, ∗, /, +=, −=, ∗=, /=, sqrt, the comparison operators<br />

, ≥ , =, ≠ and the stream operators are available. Addition, subtraction, multiplication,<br />

division, square root and power are implemented by the functions add, sub,<br />

mul, div, sqrt and power respectively. For example, the call<br />

add(x, y, prec, mode, is exact)<br />

computes the sum of bigfloats x and y with prec binary digits, in rounding mode mode,<br />

and returns it. <strong>The</strong> optional last parameter is exact is a boolean variable that is set<br />

to true if and only if the returned bigfloat exactly equals the sum of x and y. <strong>The</strong><br />

parameters prec and mode are also optional and have the global default values global prec<br />

and round mode respectively, that is, the three calls add(x, y, global prec, round mode),<br />

add(x, y, global prec), and add(x, y) are all equivalent. <strong>The</strong> syntax for functions sub,<br />

mul, div, and sqrt is analogous.<br />

<strong>The</strong> operators +, −, ∗, and / are implemented by their counterparts among the functions<br />

add, sub, mul and div. For example, the call x + y is equivalent to add(x, y).<br />

bool isNaN(const bigfloat& x)<br />

bool isnInf(const bigfloat& x)<br />

returns true if and only if x is in special state NaN<br />

returns true if and only if x is in special state nInf

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

Saved successfully!

Ooh no, something went wrong!