SoPlex
|
#include <rational.h>
Public Member Functions | |
Construction and destruction | |
void | rationalErrorMessage () const |
Rational () | |
default constructor | |
Rational (const Rational &r) | |
copy constructor | |
Rational (const long double &r) | |
constructor from long double | |
Rational (const double &r) | |
constructor from double | |
Rational (const int &i) | |
constructor from int | |
Rational (const Integer &num, const Integer &den) | |
constructor from Integer fraction pair | |
Rational (const mpq_t &q) | |
constructor from mpq_t (GMP only) | |
~Rational () | |
destructor | |
Rational & | operator= (const Rational &) |
copy assignment | |
Rational & | operator= (const long double &r) |
assignment from long double | |
Rational & | operator= (const double &r) |
assignment from double | |
Rational & | operator= (const int &i) |
assignment from int | |
Rational & | operator= (const mpq_t &q) |
assignment from mpq_t (GMP only) | |
void | assign (const Rational &) |
void | assign (const long double &r) |
void | assign (const double &r) |
void | assign (const int &i) |
Typecasts | |
operator double () const | |
operator long double () const | |
operator float () const | |
Arithmetic operators | |
Rational | operator+ (const Rational &r) const |
addition operator | |
Rational | operator+= (const Rational &r) |
addition assignment operator | |
Rational | operator+ (const double &r) const |
addition operator for doubles | |
Rational | operator+= (const double &r) |
addition assignment operator for doubles | |
Rational | operator+ (const int &r) const |
addition operator for ints | |
Rational | operator+= (const int &r) |
addition assignment operator for ints | |
Rational | operator- (const Rational &r) const |
subtraction operator | |
Rational | operator-= (const Rational &r) |
subtraction assignment operator | |
Rational | operator- (const double &r) const |
subtraction operator for doubles | |
Rational | operator-= (const double &r) |
subtraction assignment operator for doubles | |
Rational | operator- (const int &r) const |
subtraction operator for ints | |
Rational | operator-= (const int &r) |
subtraction assignment operator for ints | |
Rational | operator* (const Rational &r) const |
multiplication operator | |
Rational | operator*= (const Rational &r) |
multiplication assignment operator operator | |
Rational | operator* (const double &r) const |
multiplication operator for doubles | |
Rational | operator*= (const double &r) |
multiplication assignment operator for doubles | |
Rational | operator* (const int &r) const |
multiplication operator for ints | |
Rational | operator*= (const int &r) |
multiplication assignment operator for ints | |
Rational | operator/ (const Rational &r) const |
division operator | |
Rational | operator/= (const Rational &r) |
division assignment operator | |
Rational | operator/ (const double &r) const |
division operator for doubles | |
Rational | operator/= (const double &r) |
division assignment operator for doubles | |
Rational | operator/ (const int &r) const |
division operator for ints | |
Rational | operator/= (const int &r) |
division assignment operator for ints | |
Rational & | addProduct (const Rational &r, const Rational &s) |
add product of two rationals | |
Rational & | subProduct (const Rational &r, const Rational &s) |
subtract product of two rationals | |
Rational & | addQuotient (const Rational &r, const Rational &s) |
add quotient of two rationals, r divided by s | |
Rational & | subQuotient (const Rational &r, const Rational &s) |
subtract quotient of two rationals, r divided by s | |
Methods for checking exactness of doubles | |
bool | isAdjacentTo (const double &d) const |
checks if d is exactly equal to the Rational and if not, if it is one of the two adjacent doubles | |
Methods for querying size | |
int | sizeInBase (const int base=2) const |
Size in specified base (bit size for base 2) | |
Friends | |
Friends | |
int | compareRational (const Rational &r, const Rational &s) |
bool | operator!= (const Rational &r, const Rational &s) |
bool | operator== (const Rational &r, const Rational &s) |
bool | operator< (const Rational &r, const Rational &s) |
bool | operator<= (const Rational &r, const Rational &s) |
bool | operator> (const Rational &r, const Rational &s) |
bool | operator>= (const Rational &r, const Rational &s) |
bool | operator!= (const Rational &r, const double &s) |
bool | operator== (const Rational &r, const double &s) |
bool | operator< (const Rational &r, const double &s) |
bool | operator<= (const Rational &r, const double &s) |
bool | operator> (const Rational &r, const double &s) |
bool | operator>= (const Rational &r, const double &s) |
bool | operator!= (const double &r, const Rational &s) |
bool | operator== (const double &r, const Rational &s) |
bool | operator< (const double &r, const Rational &s) |
bool | operator<= (const double &r, const Rational &s) |
bool | operator> (const double &r, const Rational &s) |
bool | operator>= (const double &r, const Rational &s) |
bool | operator!= (const Rational &r, const long double &s) |
bool | operator== (const Rational &r, const long double &s) |
bool | operator< (const Rational &r, const long double &s) |
bool | operator<= (const Rational &r, const long double &s) |
bool | operator> (const Rational &r, const long double &s) |
bool | operator>= (const Rational &r, const long double &s) |
bool | operator!= (const long double &r, const Rational &s) |
bool | operator== (const long double &r, const Rational &s) |
bool | operator< (const long double &r, const Rational &s) |
bool | operator<= (const long double &r, const Rational &s) |
bool | operator> (const long double &r, const Rational &s) |
bool | operator>= (const long double &r, const Rational &s) |
bool | operator!= (const Rational &r, const float &s) |
bool | operator== (const Rational &r, const float &s) |
bool | operator< (const Rational &r, const float &s) |
bool | operator<= (const Rational &r, const float &s) |
bool | operator> (const Rational &r, const float &s) |
bool | operator>= (const Rational &r, const float &s) |
bool | operator!= (const float &r, const Rational &s) |
bool | operator== (const float &r, const Rational &s) |
bool | operator< (const float &r, const Rational &s) |
bool | operator<= (const float &r, const Rational &s) |
bool | operator> (const float &r, const Rational &s) |
bool | operator>= (const float &r, const Rational &s) |
Rational | operator+ (const double &d, const Rational &r) |
Rational | operator- (const double &d, const Rational &r) |
Rational | operator* (const double &d, const Rational &r) |
Rational | operator/ (const double &d, const Rational &r) |
bool | operator!= (const Rational &r, const int &s) |
bool | operator== (const Rational &r, const int &s) |
bool | operator< (const Rational &r, const int &s) |
bool | operator<= (const Rational &r, const int &s) |
bool | operator> (const Rational &r, const int &s) |
bool | operator>= (const Rational &r, const int &s) |
bool | operator!= (const int &r, const Rational &s) |
bool | operator== (const int &r, const Rational &s) |
bool | operator< (const int &r, const Rational &s) |
bool | operator<= (const int &r, const Rational &s) |
bool | operator> (const int &r, const Rational &s) |
bool | operator>= (const int &r, const Rational &s) |
Rational | operator+ (const int &d, const Rational &r) |
Rational | operator- (const int &d, const Rational &r) |
Rational | operator* (const int &d, const Rational &r) |
Rational | operator/ (const int &d, const Rational &r) |
Rational | spxAbs (const Rational &r) |
int | sign (const Rational &r) |
Rational | operator- (const Rational &q) |
Conversion from and to String | |
std::string | str () const |
std::ostream & | operator<< (std::ostream &os, const Rational &r) |
Definition at line 254 of file rational.h.
Rational | ( | ) |
default constructor
Definition at line 269 of file rational.h.
Referenced by addProduct(), addQuotient(), assign(), compareRational, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator*, operator*(), operator*, operator*(), operator*(), operator*=(), operator*=(), operator*=(), operator+, operator+(), operator+, operator+(), operator+(), operator+=(), operator+=(), operator+=(), operator-, operator-(), operator-, operator-(), operator-, operator-(), operator-=(), operator-=(), operator-=(), operator/, operator/(), operator/, operator/(), operator/(), operator/=(), operator/=(), operator/=(), operator<, operator<, operator<, operator<, operator<, operator<, operator<, operator<, operator<, operator<<, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator=(), operator=(), operator=(), operator=(), operator=(), operator==, operator==, operator==, operator==, operator==, operator==, operator==, operator==, operator==, operator>, operator>, operator>, operator>, operator>, operator>, operator>, operator>, operator>, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, Rational(), sign, spxAbs, subProduct(), and subQuotient().
Rational | ( | const long double & | r | ) |
constructor from long double
Definition at line 277 of file rational.h.
Rational | ( | const double & | r | ) |
constructor from double
Definition at line 281 of file rational.h.
Rational | ( | const int & | i | ) |
constructor from int
Definition at line 285 of file rational.h.
constructor from Integer fraction pair
Definition at line 289 of file rational.h.
Rational | ( | const mpq_t & | q | ) |
constructor from mpq_t (GMP only)
Definition at line 294 of file rational.h.
~Rational | ( | ) |
destructor
Definition at line 307 of file rational.h.
add product of two rationals
Definition at line 546 of file rational.h.
References Rational(), and rationalErrorMessage().
add quotient of two rationals, r divided by s
Definition at line 560 of file rational.h.
References Rational(), and rationalErrorMessage().
void assign | ( | const double & | r | ) |
Definition at line 347 of file rational.h.
References rationalErrorMessage().
void assign | ( | const int & | i | ) |
Definition at line 351 of file rational.h.
References rationalErrorMessage().
void assign | ( | const long double & | r | ) |
Definition at line 343 of file rational.h.
References rationalErrorMessage().
void assign | ( | const Rational & | ) |
Definition at line 339 of file rational.h.
References Rational(), and rationalErrorMessage().
bool isAdjacentTo | ( | const double & | d | ) | const |
checks if d
is exactly equal to the Rational and if not, if it is one of the two adjacent doubles
Definition at line 580 of file rational.h.
References rationalErrorMessage().
operator double | ( | ) | const |
Definition at line 359 of file rational.h.
operator float | ( | ) | const |
Definition at line 367 of file rational.h.
operator long double | ( | ) | const |
Definition at line 363 of file rational.h.
Rational operator* | ( | const double & | r | ) | const |
multiplication operator for doubles
Definition at line 486 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator* | ( | const int & | r | ) | const |
multiplication operator for ints
Definition at line 498 of file rational.h.
References Rational(), and rationalErrorMessage().
multiplication operator
Definition at line 474 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator*= | ( | const double & | r | ) |
multiplication assignment operator for doubles
Definition at line 492 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator*= | ( | const int & | r | ) |
multiplication assignment operator for ints
Definition at line 504 of file rational.h.
References Rational(), and rationalErrorMessage().
multiplication assignment operator operator
Definition at line 480 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator+ | ( | const double & | r | ) | const |
addition operator for doubles
Definition at line 414 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator+ | ( | const int & | r | ) | const |
addition operator for ints
Definition at line 426 of file rational.h.
References Rational(), and rationalErrorMessage().
addition operator
Definition at line 402 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator+= | ( | const double & | r | ) |
addition assignment operator for doubles
Definition at line 420 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator+= | ( | const int & | r | ) |
addition assignment operator for ints
Definition at line 432 of file rational.h.
References Rational(), and rationalErrorMessage().
addition assignment operator
Definition at line 408 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator- | ( | const double & | r | ) | const |
subtraction operator for doubles
Definition at line 450 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator- | ( | const int & | r | ) | const |
subtraction operator for ints
Definition at line 462 of file rational.h.
References Rational(), and rationalErrorMessage().
subtraction operator
Definition at line 438 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator-= | ( | const double & | r | ) |
subtraction assignment operator for doubles
Definition at line 456 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator-= | ( | const int & | r | ) |
subtraction assignment operator for ints
Definition at line 468 of file rational.h.
References Rational(), and rationalErrorMessage().
subtraction assignment operator
Definition at line 444 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator/ | ( | const double & | r | ) | const |
division operator for doubles
Definition at line 522 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator/ | ( | const int & | r | ) | const |
division operator for ints
Definition at line 534 of file rational.h.
References Rational(), and rationalErrorMessage().
division operator
Definition at line 510 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator/= | ( | const double & | r | ) |
division assignment operator for doubles
Definition at line 528 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational operator/= | ( | const int & | r | ) |
division assignment operator for ints
Definition at line 540 of file rational.h.
References Rational(), and rationalErrorMessage().
division assignment operator
Definition at line 516 of file rational.h.
References Rational(), and rationalErrorMessage().
Rational & operator= | ( | const double & | r | ) |
Rational & operator= | ( | const int & | i | ) |
Rational & operator= | ( | const long double & | r | ) |
Rational & operator= | ( | const mpq_t & | q | ) |
void rationalErrorMessage | ( | ) | const |
Definition at line 262 of file rational.h.
References SPX_MSG_ERROR.
Referenced by addProduct(), addQuotient(), assign(), assign(), assign(), assign(), compareRational, denominator(), invert(), isAdjacentTo(), numerator(), operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator!=, operator*, operator*(), operator*, operator*(), operator*(), operator*=(), operator*=(), operator*=(), operator+, operator+(), operator+, operator+(), operator+(), operator+=(), operator+=(), operator+=(), operator-, operator-(), operator-, operator-(), operator-, operator-(), operator-=(), operator-=(), operator-=(), operator/, operator/(), operator/, operator/(), operator/(), operator/=(), operator/=(), operator/=(), operator<, operator<, operator<, operator<, operator<, operator<, operator<, operator<, operator<, operator<<, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator<=, operator==, operator==, operator==, operator==, operator==, operator==, operator==, operator==, operator==, operator>, operator>, operator>, operator>, operator>, operator>, operator>, operator>, operator>, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, operator>=, orderOfMagnitude(), powRound(), sign, sizeInBase(), spxAbs, str(), subProduct(), and subQuotient().
int sizeInBase | ( | const int | base = 2 | ) | const |
Size in specified base (bit size for base 2)
Definition at line 593 of file rational.h.
References rationalErrorMessage().
std::string str | ( | ) | const |
Definition at line 609 of file rational.h.
References rationalErrorMessage().
subtract product of two rationals
Definition at line 553 of file rational.h.
References Rational(), and rationalErrorMessage().
subtract quotient of two rationals, r divided by s
Definition at line 567 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 619 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 686 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 810 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 893 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 748 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 655 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 779 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 862 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 717 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 624 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 851 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 934 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 841 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 924 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 846 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 929 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 955 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 856 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 939 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 696 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 820 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 903 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 758 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 665 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 789 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 872 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 727 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 634 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 604 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 701 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 825 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 908 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 763 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 670 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 794 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 877 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 732 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 639 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 691 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 815 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 898 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 753 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 660 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 784 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 867 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 722 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 629 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 706 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 830 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 913 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 768 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 675 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 799 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 882 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 737 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 644 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 711 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 835 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 918 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 773 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 680 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 804 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 887 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 742 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 649 of file rational.h.
References Rational(), and rationalErrorMessage().
|
friend |
Definition at line 950 of file rational.h.
References Rational(), and rationalErrorMessage().
Definition at line 945 of file rational.h.
References Rational(), and rationalErrorMessage().