plll
1.0
|
Represents an arbitrary precision floating point value. More...
#include <arithmetic-gmp.hpp>
Classes | |
struct | PrecisionInit |
Public Types | |
typedef RealContext | Context |
The context type. | |
Public Member Functions | |
long | getApproxExponent () const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Returns approximate e such that |x| is approximately . More... | |
Real & | operator= (const Real &r) |
Assigns the given floating point number r to this floating point number. More... | |
template<class A , template< typename, typename > class O> | |
Real & | operator= (const expressions::Expression< RealContext, A, O > &E) |
Assigns the floating point expression E to this floating point number. More... | |
unsigned long | precision () const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Retrieves the precision of this floating point number. More... | |
Real () | |
Creates a new floating point number. More... | |
Real (const RealContext &rc) | |
Creates a real with the precision given by the context. More... | |
Real (const Real &r, bool clone=true) | |
Creates a copy of the given floating point number. More... | |
Real (const Real &r, const RealContext &rc) | |
Creates a copy of the given floating point number with the given context's precision. More... | |
Real (long i) | |
Creates a new floating point number from the given native integer. More... | |
Real (long i, const RealContext &rc) | |
Creates a new floating point number from the given native integer with the given context's precision. More... | |
Real (unsigned long i) | |
Creates a new floating point number from the given native integer. More... | |
Real (unsigned long i, const RealContext &rc) | |
Creates a new floating point number from the given native integer with the given context's precision. More... | |
Real (long long i) | |
Creates a new floating point number from the given native integer. More... | |
Real (long long i, const RealContext &rc) | |
Creates a new floating point number from the given native integer with the given context's precision. More... | |
Real (double d) | |
Creates a new floating point number from the given native floating point number. More... | |
Real (double d, const RealContext &rc) | |
Creates a new floating point number from the given native floating point number with the given context's precision. More... | |
Real (long double d) | |
Creates a new floating point number from the given native floating point number. More... | |
Real (long double d, const RealContext &rc) | |
Creates a new floating point number from the given native floating point number with the given context's precision. More... | |
Real (const Integer &i) | |
Creates a new floating point number from the given arbitrary precision integer. More... | |
Real (const Integer &i, const RealContext &rc) | |
Creates a new floating point number from the given arbitrary precision integer with the given context's precision. More... | |
template<class A , template< typename, typename > class O> | |
Real (const expressions::Expression< RealContext, A, O > &E) | |
Creates a floating point number from the given floating point expression. More... | |
template<class A , template< typename, typename > class O> | |
Real (const expressions::Expression< RealContext, A, O > &E, const RealContext &rc) | |
Creates a floating point number from the given floating point expression and Real context. More... | |
void | setContext (const RealContext &rc) |
Adjusts the precision of this floating point number to the given context's precision. More... | |
~Real () PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE | |
Releases the memory used by the arbitrary precision floating point number. | |
Friends | |
void | abs (Real &r, const Real &a) |
Takes the absolute value of a and stores the result in r . More... | |
void | acos (Real &res, const Real &a) |
Computes the arccosine of a and stores the result in res . More... | |
void | add (Real &r, const Real &a, const Real &b) |
Adds a and b and stores the result in r . More... | |
void | addmul (Real &r, const Real &a, const Real &b) |
Multiplies a and b and adds the result to r . More... | |
void | asin (Real &res, const Real &a) |
Computes the arcsine of a and stores the result in res . More... | |
void | atan (Real &res, const Real &a) |
Computes the arctangent of a and stores the result in res . More... | |
void | atan2 (Real &res, const Real &y, const Real &x) |
Computes the arctangent of and stores the result in res. The signs of xand y` are used to determine the quadrant and yield a result in . More... | |
int | compare (const Real &a, const Real &b) |
Compares the two floating point numbers. More... | |
int | compareAbsValues (const Real &a, const Real &b) |
Compares the two floating point numbers in absolute value. More... | |
void | cos (Real &res, const Real &a) |
Computes the cosine of a and stores the result in res . More... | |
void | decrement (Real &r, const Real &a) |
Decrements a by one and stores the result in r . More... | |
void | div (Real &r, const Real &a, const Real &b) |
Divides a by b and stores the result in r . More... | |
void | divmod (Real &q, Real &r, const Real &a, const Real &b) |
Stores quotient and remainder of the division of a by b in q respectively r . More... | |
void | exp (Real &res, const Real &a) |
Computes the exponential function at a and stores the result in res . More... | |
void | gamma (Real &res, const Real &a) |
Computes the Gamma function at a and stores the result in res . More... | |
void | increment (Real &r, const Real &a) |
Increments a by one and stores the result in r . More... | |
bool | isNegative (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Tests the given plll::arithmetic::Real object for being strictly negative. More... | |
bool | isNonNegative (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Tests the given plll::arithmetic::Real object for being positive or zero. More... | |
bool | isNonPositive (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Tests the given plll::arithmetic::Real object for being negative or zero. More... | |
bool | isOne (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Tests the given plll::arithmetic::Real object for being one. More... | |
bool | isPositive (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Tests the given plll::arithmetic::Real object for being strictly positive. More... | |
bool | isZero (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Tests the given plll::arithmetic::Real object for being zero. More... | |
void | lgamma (Real &res, const Real &a) |
Computes the logarithm of the absolute value of the Gamma function at a and stores the result in res . More... | |
void | lgamma (Real &res, int &sign, const Real &a) |
Computes the logarithm of the absolute value of the Gamma function at a and stores the result in res . The sign of the Gamma function at a is stored in sign . More... | |
void | log (Real &res, const Real &a) |
Computes the natural logarithm of a and stores the result in res . More... | |
void | log10 (Real &res, const Real &a) |
Computes the logarithm of a to base 10 and stores the result in res . More... | |
void | log2 (Real &res, const Real &a) |
Computes the logarithm of a to base 2 and stores the result in res . More... | |
void | makeAbs (Real &a) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Makes the operand non-negative. More... | |
void | mod (Real &r, const Real &a, const Real &b) |
Takes the remainder of the division of a by b and stores it in r . More... | |
void | mul (Real &r, const Real &a, const Real &b) |
Multiplies a with b and stores the result in r . More... | |
void | neg (Real &r, const Real &a) |
Negates a and stores the result in r . More... | |
bool | operator!= (const Real &a, const Real &b) |
Compares the two floating point numbers a and b for inequality. More... | |
bool | operator< (const Real &a, const Real &b) |
Compares the two floating point numbers a and b . More... | |
std::ostream & | operator<< (std::ostream &s, const Real &r) |
Outputs the floating point number on the given output stream. | |
bool | operator<= (const Real &a, const Real &b) |
Compares the two floating point numbers a and b . More... | |
bool | operator== (const Real &a, const Real &b) |
Compares the two floating point numbers a and b for equality. More... | |
bool | operator> (const Real &a, const Real &b) |
Compares the two floating point numbers a and b . More... | |
bool | operator>= (const Real &a, const Real &b) |
Compares the two floating point numbers a and b . More... | |
std::istream & | operator>> (std::istream &s, Real &r) |
Reads the floating point number from the given input stream. | |
void | power (Real &res, const Real &a, const Integer &b) |
Raises a to the power b and stores the result in res . More... | |
void | power (Real &res, const Real &a, const Real &b) |
Raises a to the power b and stores the result in res . More... | |
void | setInfinity (Real &r, bool sign) |
Sets the given floating point number to . More... | |
void | setNaN (Real &r) |
Sets the given floating point number to Not a Number . | |
void | setOne (Real &r) |
Sets the given floating point number to one. | |
void | setZero (Real &r, bool sign) |
Sets the given floating point number to . More... | |
void | shl (Real &r, const Real &a, const Real &b) |
Multiplies a by and stores the result in r . More... | |
void | shl (Real &r, const Real &a, long b) |
Multiplies a by and stores the result in r . More... | |
void | shr (Real &r, const Real &a, const Real &b) |
Multiplies a by and stores the result in r . More... | |
void | shr (Real &r, const Real &a, long b) |
Multiplies a by and stores the result in r . More... | |
int | sign (const Real &r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE |
Returns the sign of the given floating point number. More... | |
void | sin (Real &res, const Real &a) |
Computes the sine of a and stores the result in res . More... | |
void | sqrt (Real &res, const Real &a) |
Computes the square root of a and stores the result in res . More... | |
void | square (Real &r, const Real &a) |
Computes the square of a and stores the result in r . More... | |
void | sub (Real &r, const Real &a, const Real &b) |
Subtracts b from a and stores the result in r . More... | |
void | submul (Real &r, const Real &a, const Real &b) |
Multiplies a and b and subtracts the result from r . More... | |
void | tan (Real &res, const Real &a) |
Computes the tangent of a and stores the result in res . More... | |
Represents an arbitrary precision floating point value.
Definition at line 2036 of file arithmetic-gmp.hpp.
|
inline |
Creates a new floating point number.
NaN
and not zero! Definition at line 2093 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a real with the precision given by the context.
rc | A context. |
Definition at line 2140 of file arithmetic-gmp.hpp.
|
inline |
Creates a copy of the given floating point number.
r | The floating point number to copy. |
clone | If true , creates a copy with the same precision. If false , creates a copy of the default precision. |
Definition at line 2152 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a copy of the given floating point number with the given context's precision.
r | The floating point number to copy. |
rc | The context whose precision to use for the result. |
Definition at line 2170 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native integer.
i | The native integer whose value to take. |
Definition at line 2209 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native integer with the given context's precision.
i | The native integer whose value to take. |
rc | The context whose precision to take. |
Definition at line 2221 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native integer.
i | The native integer whose value to take. |
Definition at line 2232 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native integer with the given context's precision.
i | The native integer whose value to take. |
rc | The context whose precision to take. |
Definition at line 2244 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native integer.
i | The native integer whose value to take. |
Definition at line 2255 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native integer with the given context's precision.
i | The native integer whose value to take. |
rc | The context whose precision to take. |
Definition at line 2268 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native floating point number.
d | The native floating point number whose value to take. |
Definition at line 2280 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native floating point number with the given context's precision.
d | The native floating point number whose value to take. |
rc | The context whose precision to take. |
Definition at line 2292 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native floating point number.
d | The native floating point number whose value to take. |
Definition at line 2304 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given native floating point number with the given context's precision.
d | The native floating point number whose value to take. |
rc | The context whose precision to take. |
Definition at line 2316 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given arbitrary precision integer.
i | The arbitrary precision integer whose value to take. |
Definition at line 2328 of file arithmetic-gmp.hpp.
|
inlineexplicit |
Creates a new floating point number from the given arbitrary precision integer with the given context's precision.
i | The arbitrary precision integer whose value to take. |
rc | The context whose precision to take. |
Definition at line 2340 of file arithmetic-gmp.hpp.
|
inline |
Creates a floating point number from the given floating point expression.
E | The expression used to create this floating point number. |
Definition at line 2352 of file arithmetic-gmp.hpp.
|
inline |
Creates a floating point number from the given floating point expression and Real context.
E | The expression used to create this floating point number. |
rc | The context whose precision to take. |
Definition at line 2366 of file arithmetic-gmp.hpp.
|
inline |
Returns approximate e
such that |x| is approximately .
The value of e
should be OK up to +-2.
Definition at line 3215 of file arithmetic-gmp.hpp.
Assigns the given floating point number r
to this floating point number.
r | The floating point number to assign to this floating point number. |
Definition at line 2378 of file arithmetic-gmp.hpp.
|
inline |
Assigns the floating point expression E
to this floating point number.
E | The floating point expression. |
Definition at line 2395 of file arithmetic-gmp.hpp.
|
inline |
Retrieves the precision of this floating point number.
Definition at line 2181 of file arithmetic-gmp.hpp.
|
inline |
Adjusts the precision of this floating point number to the given context's precision.
rc | A context whose precision to use. |
Definition at line 2192 of file arithmetic-gmp.hpp.
Takes the absolute value of a
and stores the result in r
.
r | The result. |
a | The operand. |
Definition at line 2902 of file arithmetic-gmp.hpp.
Computes the arccosine of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3064 of file arithmetic-gmp.hpp.
Adds a
and b
and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2444 of file arithmetic-gmp.hpp.
Multiplies a
and b
and adds the result to r
.
r | The accumulator. |
a | The first operand. |
b | The second operand. |
Definition at line 2588 of file arithmetic-gmp.hpp.
Computes the arcsine of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3055 of file arithmetic-gmp.hpp.
Computes the arctangent of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3073 of file arithmetic-gmp.hpp.
Computes the arctangent of and stores the result in
res. The signs of
xand
y` are used to determine the quadrant and yield a result in .
res | The result. |
y | The numerator of the fraction the function is evaluated at. |
x | The denominator of the fraction the function is evaluated at. |
Definition at line 3082 of file arithmetic-gmp.hpp.
Compares the two floating point numbers.
a | The first operand. |
b | The second operand. |
Definition at line 2950 of file arithmetic-gmp.hpp.
Compares the two floating point numbers in absolute value.
a | The first operand. |
b | The second operand. |
Definition at line 3002 of file arithmetic-gmp.hpp.
Computes the cosine of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3037 of file arithmetic-gmp.hpp.
Decrements a
by one and stores the result in r
.
r | The result. |
a | The operand. |
Definition at line 2884 of file arithmetic-gmp.hpp.
Divides a
by b
and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2693 of file arithmetic-gmp.hpp.
Stores quotient and remainder of the division of a
by b
in q
respectively r
.
q | The quotient. |
r | The remainder. |
a | The first operand. |
b | The second operand. |
Definition at line 2787 of file arithmetic-gmp.hpp.
Computes the exponential function at a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3094 of file arithmetic-gmp.hpp.
Computes the Gamma function at a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3139 of file arithmetic-gmp.hpp.
Increments a
by one and stores the result in r
.
r | The result. |
a | The operand. |
Definition at line 2875 of file arithmetic-gmp.hpp.
|
friend |
Tests the given plll::arithmetic::Real
object for being strictly negative.
true
if and only if the argument is strictly negative. Definition at line 2432 of file arithmetic-gmp.hpp.
|
friend |
Tests the given plll::arithmetic::Real
object for being positive or zero.
true
if and only if the argument is positive or zero. Definition at line 2426 of file arithmetic-gmp.hpp.
|
friend |
Tests the given plll::arithmetic::Real
object for being negative or zero.
true
if and only if the argument is negative or zero. Definition at line 2438 of file arithmetic-gmp.hpp.
|
friend |
Tests the given plll::arithmetic::Real
object for being one.
true
if and only if the argument is one. Definition at line 2414 of file arithmetic-gmp.hpp.
|
friend |
Tests the given plll::arithmetic::Real
object for being strictly positive.
true
if and only if the argument is strictly positive. Definition at line 2420 of file arithmetic-gmp.hpp.
|
friend |
Tests the given plll::arithmetic::Real
object for being zero.
true
if and only if the argument is zero. Definition at line 2408 of file arithmetic-gmp.hpp.
Computes the logarithm of the absolute value of the Gamma function at a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3148 of file arithmetic-gmp.hpp.
Computes the logarithm of the absolute value of the Gamma function at a
and stores the result in res
. The sign of the Gamma function at a
is stored in sign
.
res | The result. |
sign | Will be set to 1 if and -1 otherwise. |
a | The value the function is evaluated at. |
Definition at line 3158 of file arithmetic-gmp.hpp.
Computes the natural logarithm of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3103 of file arithmetic-gmp.hpp.
Computes the logarithm of a
to base 10 and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3121 of file arithmetic-gmp.hpp.
Computes the logarithm of a
to base 2 and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3112 of file arithmetic-gmp.hpp.
|
friend |
Makes the operand non-negative.
a | The operand. |
Definition at line 2911 of file arithmetic-gmp.hpp.
Takes the remainder of the division of a
by b
and stores it in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2775 of file arithmetic-gmp.hpp.
Multiplies a
with b
and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2641 of file arithmetic-gmp.hpp.
Negates a
and stores the result in r
.
r | The result. |
a | The operand. |
Definition at line 2893 of file arithmetic-gmp.hpp.
Compares the two floating point numbers a
and b
for inequality.
a | The first operand. |
b | The second operand. |
true
if and only if a
does not equal b
. Definition at line 944 of file arithmetic-gmp-rops.hpp.
Compares the two floating point numbers a
and b
.
a | The first operand. |
b | The second operand. |
true
if and only if a
is less than b
. Definition at line 980 of file arithmetic-gmp-rops.hpp.
Compares the two floating point numbers a
and b
.
a | The first operand. |
b | The second operand. |
true
if and only if a
is less than or equal to b
. Definition at line 956 of file arithmetic-gmp-rops.hpp.
Compares the two floating point numbers a
and b
for equality.
a | The first operand. |
b | The second operand. |
true
if and only if a
equals b
. Definition at line 932 of file arithmetic-gmp-rops.hpp.
Compares the two floating point numbers a
and b
.
a | The first operand. |
b | The second operand. |
true
if and only if a
is greater than b
. Definition at line 992 of file arithmetic-gmp-rops.hpp.
Compares the two floating point numbers a
and b
.
a | The first operand. |
b | The second operand. |
true
if and only if a
is greater than or equal to b
. Definition at line 968 of file arithmetic-gmp-rops.hpp.
Raises a
to the power b
and stores the result in res
.
res | The result. |
a | The base. |
b | The exponent. |
Definition at line 3185 of file arithmetic-gmp.hpp.
Raises a
to the power b
and stores the result in res
.
res | The result. |
a | The base. |
b | The exponent. |
Definition at line 3194 of file arithmetic-gmp.hpp.
|
friend |
Sets the given floating point number to .
r | The floating point variable to set to infinity. |
sign | If true , the number is set to , and otherwise to . The default value is true . |
Definition at line 2927 of file arithmetic-gmp.hpp.
|
friend |
Sets the given floating point number to .
r | The floating point variable to set to zero. |
sign | If true , the number is set to , and otherwise to . The default value is true . |
Definition at line 2932 of file arithmetic-gmp.hpp.
Multiplies a
by and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2825 of file arithmetic-gmp.hpp.
Multiplies a
by and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2857 of file arithmetic-gmp.hpp.
Multiplies a
by and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2841 of file arithmetic-gmp.hpp.
Multiplies a
by and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2866 of file arithmetic-gmp.hpp.
|
friend |
Returns the sign of the given floating point number.
Definition at line 3013 of file arithmetic-gmp.hpp.
Computes the sine of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3028 of file arithmetic-gmp.hpp.
Computes the square root of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3130 of file arithmetic-gmp.hpp.
Computes the square of a
and stores the result in r
.
r | The result. |
a | The operand. |
Definition at line 3019 of file arithmetic-gmp.hpp.
Subtracts b
from a
and stores the result in r
.
r | The result. |
a | The first operand. |
b | The second operand. |
Definition at line 2496 of file arithmetic-gmp.hpp.
Multiplies a
and b
and subtracts the result from r
.
r | The accumulator. |
a | The first operand. |
b | The second operand. |
Definition at line 2614 of file arithmetic-gmp.hpp.
Computes the tangent of a
and stores the result in res
.
res | The result. |
a | The value the function is evaluated at. |
Definition at line 3046 of file arithmetic-gmp.hpp.