CAPD DynSys Library
5.2.0
|
MpReal represents multiple precision real number with controlled rounding. More...
#include <capd/multiPrec/MpReal.h>
Public Types | |
typedef MpPrecision | PrecisionType |
typedef MpRoundingMode | RoundingMode |
Static Public Member Functions | |
static void | setDefaultPrecision (PrecisionType newprec) |
sets default precision for all operations More... | |
static PrecisionType | getDefaultPrecision () |
returns default precision of all operations More... | |
static void | setDefaultRndMode (RoundingMode newrndmode) |
sets default rounding mode for all operations More... | |
static RoundingMode | getDefaultRndMode () |
return default rounding mode More... | |
static void | roundUp () |
sets rounding up mode More... | |
static void | roundDown () |
sets rounding down mode More... | |
static void | roundNearest () |
sets rounding to nearest mode More... | |
static void | roundToZero () |
sets rounding to zero mode More... | |
static void | roundCut () |
static MpReal | pi (RoundingMode rnd=getDefaultRndMode(), PrecisionType prec=getDefaultPrecision()) |
pi constant (3.1415...) with given precision and rounding direction More... | |
static MpReal | log2 (RoundingMode rnd=getDefaultRndMode(), PrecisionType prec=getDefaultPrecision()) |
ln(2) - natural logarithm of 2 constant with given precision and rounding direction More... | |
static MpReal | euler (RoundingMode rnd=getDefaultRndMode(), PrecisionType prec=getDefaultPrecision()) |
euler constant (2.7...) with given precision and rounding direction More... | |
static MpReal | positiveInfinity (PrecisionType prec=getDefaultPrecision()) |
Positive infinity constant. More... | |
static MpReal | negativeInfinity (PrecisionType prec=getDefaultPrecision()) |
Negative infinity constant. More... | |
static void | add (MpReal &res, const MpReal &r1, const MpReal &r2, RoundingMode rnd=getDefaultRndMode()) |
adds r1 and r2 using precision of the res and given rounding mode More... | |
static void | sub (MpReal &res, const MpReal &r1, const MpReal &r2, RoundingMode rnd=getDefaultRndMode()) |
substract r1 and r2 using precision of the res and given rounding mode More... | |
static void | neg (MpReal &res, const MpReal &r, RoundingMode rnd=getDefaultRndMode()) |
static void | mul (MpReal &res, const MpReal &r1, const MpReal &r2, RoundingMode rnd=getDefaultRndMode()) |
multiply r1 and r2 using precision of the res and given rounding mode More... | |
static void | div (MpReal &res, const MpReal &r1, const MpReal &r2, RoundingMode rnd=getDefaultRndMode()) |
divides r1 by r2 using precision of the res and given rounding mode More... | |
static void | fma (MpReal &res, const MpReal &r1, const MpReal &r2, const MpReal &r3, RoundingMode rnd=getDefaultRndMode()) |
fast multiplication and addition res = r1*r2 + r3 More... | |
Static Public Attributes | |
static const RoundingMode | RoundUp =mp_rnd_t(GMP_RNDU) |
static const RoundingMode | RoundDown =mp_rnd_t(GMP_RNDD) |
static const RoundingMode | RoundNearest =mp_rnd_t(GMP_RNDN) |
static const RoundingMode | RoundToZero =mp_rnd_t(GMP_RNDZ) |
Protected Attributes | |
mpfr_t | mpfr_rep |
Friends | |
bool | isinf (const MpReal &r) |
bool | isnan (const MpReal &r) |
MpReal | copysign (const MpReal &x, const MpReal &y) |
Produce a value with the magnitude of x and sign bit of y: (-1)^signbit(y) * abs(x) More... | |
int | signbit (const MpReal &x) |
bool | isZero (const MpReal &r) |
bool | isInf (const MpReal &r) |
bool | isNaN (const MpReal &r) |
bool | isNumber (const MpReal &r) |
bool | isSingular (const MpReal &r) |
int | sign (const MpReal &r) |
int | compare (const MpReal &r1, const MpReal &r2) |
compare two MpReals returns 0 if r1==r2, negative value if r1<r2 and positive value if r1>r2 More... | |
int | compare (const MpReal &r1, const double r2) |
int | compare (const MpReal &r1, const int r2) |
int | compare (const MpReal &r1, const unsigned int r2) |
int | compare (const MpReal &r1, const long int r2) |
int | compare (const MpReal &r1, const unsigned long int r2) |
MpReal | operator+ (const MpReal &r1, const MpReal &r2) |
adds r1 and r2 using default precision and rounding mode More... | |
MpReal | operator- (const MpReal &r1, const MpReal &r2) |
substract r1 and r2 using default precision and rounding mode More... | |
MpReal | operator* (const MpReal &r1, const MpReal &r2) |
multiply r1 and r2 using default precision and rounding mode More... | |
MpReal | operator/ (const MpReal &r1, const MpReal &r2) |
divides r1 by r2 using default precision and rounding mode More... | |
std::istream & | operator>> (std::istream &i, MpReal &r) |
reads number from a stream More... | |
std::ostream & | operator<< (std::ostream &o, const MpReal &r) |
writes number to a stream More... | |
MpReal | round (const MpReal &r) |
MpReal | floor (const MpReal &r) |
MpReal | trunc (const MpReal &r) |
MpReal | ceil (const MpReal &r) |
MpReal | frac (const MpReal &r) |
MpReal represents multiple precision real number with controlled rounding.
It is a C++ wrapper for a C library mpfr
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
capd::multiPrec::MpReal::MpReal | ( | mpz_srcptr | z, |
RoundingMode | rnd = getDefaultRndMode() , |
||
PrecisionType | prec = getDefaultPrecision() |
||
) |
capd::multiPrec::MpReal::MpReal | ( | mpq_srcptr | q, |
RoundingMode | rnd = getDefaultRndMode() , |
||
PrecisionType | prec = getDefaultPrecision() |
||
) |
capd::multiPrec::MpReal::MpReal | ( | mpfr_t | r, |
RoundingMode | rnd = getDefaultRndMode() , |
||
PrecisionType | prec = getDefaultPrecision() |
||
) |
|
inline |
|
inline |
|
inlinestatic |
adds r1 and r2 using precision of the res and given rounding mode
|
inlinestatic |
divides r1 by r2 using precision of the res and given rounding mode
|
inlinestatic |
euler constant (2.7...) with given precision and rounding direction
|
inlinestatic |
fast multiplication and addition res = r1*r2 + r3
res = r1*r2+r3
|
inline |
|
inlinestatic |
returns default precision of all operations
|
inlinestatic |
return default rounding mode
|
inline |
returns precision of a given object
|
inline |
|
inlinestatic |
ln(2) - natural logarithm of 2 constant with given precision and rounding direction
|
inlinestatic |
multiply r1 and r2 using precision of the res and given rounding mode
|
inlinestatic |
|
inlinestatic |
Negative infinity constant.
multiply r using default rounding mode
adds r using default rounding mode
|
inline |
substract r using default rounding mode
divides by r using default rounding mode
|
inlinestatic |
pi constant (3.1415...) with given precision and rounding direction
|
inlinestatic |
Positive infinity constant.
|
inline |
|
inline |
|
inline |
|
inline |
writes to stream given number in the base with given number of digits and rounding mode
void capd::multiPrec::MpReal::random | ( | PrecisionType | prec = getDefaultPrecision() | ) |
|
inline |
|
inlinestatic |
|
inlinestatic |
sets rounding down mode
|
inlinestatic |
sets rounding to nearest mode
|
static |
sets rounding to zero mode
|
inlinestatic |
sets rounding up mode
|
inlinestatic |
sets default precision for all operations
|
inlinestatic |
sets default rounding mode for all operations
|
inline |
Sets precision for given MpReal object.
|
inlinestatic |
substract r1 and r2 using precision of the res and given rounding mode
compare two MpReals returns 0 if r1==r2, negative value if r1<r2 and positive value if r1>r2
[in] | r1,r2 | numbers to be compared |
Produce a value with the magnitude of x and sign bit of y: (-1)^signbit(y) * abs(x)
multiply r1 and r2 using default precision and rounding mode
adds r1 and r2 using default precision and rounding mode
substract r1 and r2 using default precision and rounding mode
divides r1 by r2 using default precision and rounding mode
|
friend |
writes number to a stream
|
friend |
reads number from a stream
|
protected |
|
static |
|
static |
|
static |
|
static |