|
|
| Rational (const Rational &b) |
| | Constructors.
|
|
| Rational (const mpq_t &b) |
| | Copy the value from a third party.
|
| | Rational (mpq_t &&b) noexcept |
|
| Rational (const Integer &b) |
| | Create a Rational from an integral number.
|
|
| Rational (const mpz_t &b) |
| | Copy the numerator value from a third party.
|
| | Rational (mpz_t &&b) |
|
| Rational (const Integer &num, const Integer &den) |
| | Create a Rational as the quotient of two integrals, represented as Integer, long, or int.
|
|
| Rational (const mpz_t &num, const mpz_t &den) |
| | Copy or steal numerator and denominator values from a third party.
|
|
| Rational (const char *s) |
| | Parse a string "num/den", "num", or "±inf".
|
|
Rational & | operator= (const Rational &b) |
| | Assignment.
|
|
Rational & | copy_from (mpq_srcptr src) |
| | Assign a copy of data obtained from a third party.
|
|
Rational & | set (const Integer &num, const Integer &den) |
| | Assign numerator and denominator from separate sources.
|
|
void | swap (Rational &b) |
| | Exchange the values.
|
|
| operator double () const |
| | Cast to simpler types.
|
|
Rational & | operator++ () |
| | Increment.
|
|
Rational & | negate () |
| | In-place negation.
|
|
Rational & | operator+= (const Rational &b) |
| | Addition.
|
|
Rational & | operator-= (const Rational &b) |
| | Subtraction.
|
|
Rational & | operator*= (const Rational &b) |
| | Multiplication.
|
|
Rational & | operator/= (const Rational &b) |
| | Division.
|
|
Rational & | operator<<= (long k) |
| | Multiply with or divide through 2**k.
|
|
Rational & | operator>>= (long k) |
| | Divide through or multiply with 2**k.
|
|
Integer | floor () const |
| | The closest integral not greater than this.
|
|
Integer | ceil () const |
| | The closest integral not smaller than the given value.
|
|
Integer | trunc () const |
| | Truncation toward zero.
|
|
bool | is_zero () const noexcept |
| | fast comparison with 0
|
| bool | is_integral () const noexcept |
| Int | compare (const Rational &b) const |
|
Int | compare (double b) const |
| | Comparison.
|
Rational number with unlimited precision.
Powered by GMP