Scippy

SoPlex

Sequential object-oriented simPlex

Rational Class Reference

Wrapper for GMP type mpq_class.We wrap mpq_class so that we can replace it by a double type if GMP is not available. More...

#include <rational.h>

Classes

class  Private
 Defines the "Pimpl"-class Private. More...
 

Public Member Functions

 operator double () const
 typecasts Rational to double (allows only explicit typecast) More...
 
 operator long double () const
 typecasts Rational to long double (allows only explicit typecast) More...
 
Rational operator+ (const Rational &r) const
 addition operator More...
 
Rationaloperator+= (const Rational &r)
 addition assignment operator More...
 
Rational operator+ (const double &r) const
 addition operator for doubles More...
 
Rationaloperator+= (const double &r)
 addition assignment operator for doubles More...
 
Rational operator+ (const int &r) const
 addition operator for ints More...
 
Rationaloperator+= (const int &r)
 addition assignment operator for ints More...
 
Rational operator- (const Rational &r) const
 subtraction operator More...
 
Rationaloperator-= (const Rational &r)
 subtraction assignment operator More...
 
Rational operator- (const double &r) const
 subtraction operator for doubles More...
 
Rationaloperator-= (const double &r)
 subtraction assignment operator for doubles More...
 
Rational operator- (const int &r) const
 subtraction operator for ints More...
 
Rationaloperator-= (const int &r)
 subtraction assignment operator for ints More...
 
Rational operator* (const Rational &r) const
 multiplication operator More...
 
Rationaloperator*= (const Rational &r)
 multiplication assignment operator operator More...
 
Rational operator* (const double &r) const
 multiplication operator for doubles More...
 
Rationaloperator*= (const double &r)
 multiplication assignment operator for doubles More...
 
Rational operator* (const int &r) const
 multiplication operator for ints More...
 
Rationaloperator*= (const int &r)
 multiplication assignment operator for ints More...
 
Rational operator/ (const Rational &r) const
 division operator More...
 
Rationaloperator/= (const Rational &r)
 division assignment operator More...
 
Rational operator/ (const double &r) const
 division operator for doubles More...
 
Rationaloperator/= (const double &r)
 division assignment operator for doubles More...
 
Rational operator/ (const int &r) const
 division operator for ints More...
 
Rationaloperator/= (const int &r)
 division assignment operator for ints More...
 
RationaladdProduct (const Rational &r, const Rational &s)
 add product of two rationals More...
 
RationalsubProduct (const Rational &r, const Rational &s)
 subtract product of two rationals More...
 
RationaladdQuotient (const Rational &r, const Rational &s)
 add quotient of two rationals, r divided by s More...
 
RationalsubQuotient (const Rational &r, const Rational &s)
 subtract quotient of two rationals, r divided by s More...
 
Rationalinvert ()
 inversion More...
 
RationalpowRound ()
 round up to next power of two More...
 
bool isNextTo (const double &d)
 checks if d is the closest number that can be represented by double More...
 
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 More...
 
int sizeInBase (const int base=2) const
 Size in specified base (bit size for base 2) More...
 

Static Public Member Functions

static int precision ()
 returns precision of Rational implementation, i.e., number of bits used to store Rational numbers (INT_MAX if exact) More...
 

Private Attributes

Privatedpointer
 

Friends

int compareRational (const Rational &r, const Rational &s)
 comparison operator returning a positive value if r > s, zero if r = s, and a negative value if r < s More...
 
bool operator!= (const Rational &r, const Rational &s)
 inequality operator More...
 
bool operator== (const Rational &r, const Rational &s)
 equality operator More...
 
bool operator< (const Rational &r, const Rational &s)
 less than operator More...
 
bool operator<= (const Rational &r, const Rational &s)
 less than or equal to operator More...
 
bool operator> (const Rational &r, const Rational &s)
 greater than operator More...
 
bool operator>= (const Rational &r, const Rational &s)
 greater than or equal to operator More...
 
bool operator!= (const Rational &r, const double &s)
 inequality operator for Rational and double More...
 
bool operator== (const Rational &r, const double &s)
 equality operator for Rational and double More...
 
bool operator< (const Rational &r, const double &s)
 less than operator for Rational and double More...
 
bool operator<= (const Rational &r, const double &s)
 less than or equal to operator for Rational and double More...
 
bool operator> (const Rational &r, const double &s)
 greater than operator for Rational and double More...
 
bool operator>= (const Rational &r, const double &s)
 greater than or equal to operator for Rational and double More...
 
bool operator!= (const double &r, const Rational &s)
 inequality operator double and Rational More...
 
bool operator== (const double &r, const Rational &s)
 equality operator for double and Rational More...
 
bool operator< (const double &r, const Rational &s)
 less than operator double and Rational More...
 
bool operator<= (const double &r, const Rational &s)
 less than or equal to operator double and Rational More...
 
bool operator> (const double &r, const Rational &s)
 greater than operator double and Rational More...
 
bool operator>= (const double &r, const Rational &s)
 greater than or equal to operator double and Rational More...
 
bool operator!= (const Rational &r, const long double &s)
 inequality operator for Rational and long double More...
 
bool operator== (const Rational &r, const long double &s)
 equality operator for Rational and long double More...
 
bool operator< (const Rational &r, const long double &s)
 less than operator for Rational and long double More...
 
bool operator<= (const Rational &r, const long double &s)
 less than or equal to operator for Rational and long double More...
 
bool operator> (const Rational &r, const long double &s)
 greater than operator for Rational and long double More...
 
bool operator>= (const Rational &r, const long double &s)
 greater than or equal to operator for Rational and long double More...
 
bool operator!= (const long double &r, const Rational &s)
 inequality operator long double and Rational More...
 
bool operator== (const long double &r, const Rational &s)
 equality operator for long double and Rational More...
 
bool operator< (const long double &r, const Rational &s)
 less than operator long double and Rational More...
 
bool operator<= (const long double &r, const Rational &s)
 less than or equal to operator long double and Rational More...
 
bool operator> (const long double &r, const Rational &s)
 greater than operator long double and Rational More...
 
bool operator>= (const long double &r, const Rational &s)
 greater than or equal to operator long double and Rational More...
 
Rational operator+ (const double &d, const Rational &r)
 addition operator for double and Rational More...
 
Rational operator- (const double &d, const Rational &r)
 subtraction operator for double and Rational More...
 
Rational operator* (const double &d, const Rational &r)
 multiplication operator for double and Rational More...
 
Rational operator/ (const double &d, const Rational &r)
 division operator for double and Rational More...
 
bool operator!= (const Rational &r, const int &s)
 inequality operator for Rational and int More...
 
bool operator== (const Rational &r, const int &s)
 equality operator for Rational and int More...
 
bool operator< (const Rational &r, const int &s)
 less than operator for Rational and int More...
 
bool operator<= (const Rational &r, const int &s)
 less than or equal to operator for Rational and int More...
 
bool operator> (const Rational &r, const int &s)
 greater than operator for Rational and int More...
 
bool operator>= (const Rational &r, const int &s)
 greater than or equal to operator for Rational and int More...
 
bool operator!= (const int &r, const Rational &s)
 inequality operator for int and Rational More...
 
bool operator== (const int &r, const Rational &s)
 equality operator for int and Rational More...
 
bool operator< (const int &r, const Rational &s)
 less than operator for int and Rational More...
 
bool operator<= (const int &r, const Rational &s)
 less than or equal to operator for int and Rational More...
 
bool operator> (const int &r, const Rational &s)
 greater than operator for int and Rational More...
 
bool operator>= (const int &r, const Rational &s)
 greater than or equal to operator for int and Rational More...
 
Rational operator+ (const int &d, const Rational &r)
 addition operator for int and Rational More...
 
Rational operator- (const int &d, const Rational &r)
 subtraction operator for int and Rational More...
 
Rational operator* (const int &d, const Rational &r)
 multiplication operator for int and Rational More...
 
Rational operator/ (const int &d, const Rational &r)
 division operator for int and Rational More...
 
Rational spxAbs (const Rational &r)
 Absolute. More...
 
int sign (const Rational &r)
 Sign function; returns 1 if r > 0, 0 if r = 0, and -1 if r < 0. More...
 
Rational operator- (const Rational &q)
 Negation. More...
 
 Rational ()
 default constructor More...
 
 Rational (const Rational &r)
 copy constructor More...
 
 Rational (const long double &r)
 constructor from long double More...
 
 Rational (const double &r)
 constructor from double More...
 
 Rational (const int &i)
 constructor from int More...
 
 ~Rational ()
 destructor More...
 
Rationaloperator= (const Rational &)
 assignment operator More...
 
Rationaloperator= (const long double &r)
 assignment operator from long double More...
 
Rationaloperator= (const double &r)
 assignment operator from double More...
 
Rationaloperator= (const int &i)
 assignment operator from int More...
 
static void enableListMem ()
 enables list memory More...
 
static void freeListMem ()
 frees the unused rational elements in the memory list More...
 
static void disableListMem ()
 disables list memory More...
 
bool readString (const char *s)
 read Rational from string More...
 
std::string rationalToString (const Rational &r, const int precision)
 convert rational number to string More...
 
bool readStringRational (const char *s, Rational &value)
 read Rational from string More...
 
std::ostream & operator<< (std::ostream &os, const Rational &q)
 print Rational More...
 

Detailed Description

Wrapper for GMP type mpq_class.

We wrap mpq_class so that we can replace it by a double type if GMP is not available.

If compiled with GMP support, Rational is defined as mpq_class.

Definition at line 45 of file rational.h.

Constructor & Destructor Documentation

◆ Rational() [1/5]

Rational ( )

default constructor

Definition at line 2989 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), and soplex::spx_alloc().

◆ Rational() [2/5]

Rational ( const Rational r)

copy constructor

Definition at line 2999 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), and soplex::spx_alloc().

◆ Rational() [3/5]

Rational ( const long double &  r)

constructor from long double

Definition at line 3009 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), and soplex::spx_alloc().

◆ Rational() [4/5]

Rational ( const double &  r)

constructor from double

Definition at line 3019 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), and soplex::spx_alloc().

◆ Rational() [5/5]

Rational ( const int &  i)

constructor from int

Definition at line 3029 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), and soplex::spx_alloc().

◆ ~Rational()

~Rational ( )

destructor

Definition at line 3039 of file rational.cpp.

References Rational::dpointer, and soplex::spx_free().

Member Function Documentation

◆ addProduct()

Rational & addProduct ( const Rational r,
const Rational s 
)

add product of two rationals

Definition at line 3356 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by SoPlex::_computeInfeasBox(), and VectorBase< Real >::operator*().

◆ addQuotient()

Rational & addQuotient ( const Rational r,
const Rational s 
)

add quotient of two rationals, r divided by s

Definition at line 3374 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ disableListMem()

void disableListMem ( )
static

disables list memory

Definition at line 3067 of file rational.cpp.

Referenced by main().

◆ enableListMem()

void enableListMem ( )
static

enables list memory

Definition at line 3047 of file rational.cpp.

◆ freeListMem()

void freeListMem ( )
static

frees the unused rational elements in the memory list

this can be useful when you want to save memory or needed when working with a GMP memory manager like the one in EGlib that frees GMP memory before the destructor of the static memory list is called; in most cases this method is optional; note that this does not free the Rational elements that are currently in use

Definition at line 3059 of file rational.cpp.

◆ invert()

Rational & invert ( )

inversion

Definition at line 3392 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by SoPlex::_performOptIRStable().

◆ isAdjacentTo()

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

checks if d is exactly equal to the Rational and if not, if it is one of the two adjacent doubles

Definition at line 3418 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ isNextTo()

bool isNextTo ( const double &  d)

checks if d is the closest number that can be represented by double

checks if d is the closest possible double

Definition at line 3410 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator double()

operator double ( ) const

typecasts Rational to double (allows only explicit typecast)

Definition at line 3111 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator long double()

operator long double ( ) const

typecasts Rational to long double (allows only explicit typecast)

Definition at line 3119 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*() [1/3]

Rational operator* ( const Rational r) const

multiplication operator

Definition at line 3242 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*() [2/3]

Rational operator* ( const double &  r) const

multiplication operator for doubles

Definition at line 3261 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*() [3/3]

Rational operator* ( const int &  r) const

multiplication operator for ints

Definition at line 3280 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*=() [1/3]

Rational & operator*= ( const Rational r)

multiplication assignment operator operator

multiplication assignment operator

Definition at line 3252 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*=() [2/3]

Rational & operator*= ( const double &  r)

multiplication assignment operator for doubles

Definition at line 3271 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*=() [3/3]

Rational & operator*= ( const int &  r)

multiplication assignment operator for ints

Definition at line 3290 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+() [1/3]

Rational operator+ ( const Rational r) const

addition operator

Definition at line 3128 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+() [2/3]

Rational operator+ ( const double &  r) const

addition operator for doubles

Definition at line 3147 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+() [3/3]

Rational operator+ ( const int &  r) const

addition operator for ints

Definition at line 3166 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+=() [1/3]

Rational & operator+= ( const Rational r)

addition assignment operator

Definition at line 3138 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+=() [2/3]

Rational & operator+= ( const double &  r)

addition assignment operator for doubles

Definition at line 3157 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+=() [3/3]

Rational & operator+= ( const int &  r)

addition assignment operator for ints

Definition at line 3176 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-() [1/3]

Rational operator- ( const Rational r) const

subtraction operator

Definition at line 3185 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-() [2/3]

Rational operator- ( const double &  r) const

subtraction operator for doubles

Definition at line 3204 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-() [3/3]

Rational operator- ( const int &  r) const

subtraction operator for ints

Definition at line 3223 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-=() [1/3]

Rational & operator-= ( const Rational r)

subtraction assignment operator

Definition at line 3195 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-=() [2/3]

Rational & operator-= ( const double &  r)

subtraction assignment operator for doubles

Definition at line 3214 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-=() [3/3]

Rational & operator-= ( const int &  r)

subtraction assignment operator for ints

Definition at line 3233 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/() [1/3]

Rational operator/ ( const Rational r) const

division operator

Definition at line 3299 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/() [2/3]

Rational operator/ ( const double &  r) const

division operator for doubles

Definition at line 3318 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/() [3/3]

Rational operator/ ( const int &  r) const

division operator for ints

Definition at line 3337 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/=() [1/3]

Rational & operator/= ( const Rational r)

division assignment operator

Definition at line 3309 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/=() [2/3]

Rational & operator/= ( const double &  r)

division assignment operator for doubles

Definition at line 3328 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/=() [3/3]

Rational & operator/= ( const int &  r)

division assignment operator for ints

Definition at line 3347 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator=() [1/4]

Rational & operator= ( const Rational r)

assignment operator

Definition at line 3075 of file rational.cpp.

References Rational::dpointer.

◆ operator=() [2/4]

Rational & operator= ( const long double &  r)

assignment operator from long double

Definition at line 3084 of file rational.cpp.

References Rational::dpointer.

◆ operator=() [3/4]

Rational & operator= ( const double &  r)

assignment operator from double

Definition at line 3093 of file rational.cpp.

References Rational::dpointer.

◆ operator=() [4/4]

Rational & operator= ( const int &  i)

assignment operator from int

Definition at line 3102 of file rational.cpp.

References Rational::dpointer.

◆ powRound()

Rational & powRound ( )

round up to next power of two

Todo:
implement

Definition at line 3401 of file rational.cpp.

Referenced by SoPlex::_performOptIRStable().

◆ precision()

int precision ( )
static

returns precision of Rational implementation, i.e., number of bits used to store Rational numbers (INT_MAX if exact)

Definition at line 3435 of file rational.cpp.

Referenced by Rational::sizeInBase().

◆ readString()

bool readString ( const char *  s)

◆ sizeInBase()

int sizeInBase ( const int  base = 2) const

Size in specified base (bit size for base 2)

Todo:
this is only correct for base 2

Definition at line 3426 of file rational.cpp.

References Rational::precision().

Referenced by soplex::totalSizeRational().

◆ subProduct()

Rational & subProduct ( const Rational r,
const Rational s 
)

subtract product of two rationals

Definition at line 3365 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by SoPlex::_computeInfeasBox().

◆ subQuotient()

Rational & subQuotient ( const Rational r,
const Rational s 
)

subtract quotient of two rationals, r divided by s

Definition at line 3383 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Friends And Related Function Documentation

◆ compareRational

int compareRational ( const Rational r,
const Rational s 
)
friend

comparison operator returning a positive value if r > s, zero if r = s, and a negative value if r < s

Definition at line 3479 of file rational.cpp.

◆ operator!= [1/7]

bool operator!= ( const Rational r,
const Rational s 
)
friend

inequality operator

Definition at line 3500 of file rational.cpp.

◆ operator!= [2/7]

bool operator!= ( const Rational r,
const double &  s 
)
friend

inequality operator for Rational and double

Definition at line 3549 of file rational.cpp.

◆ operator!= [3/7]

bool operator!= ( const double &  r,
const Rational s 
)
friend

inequality operator double and Rational

inequality operator for double and Rational

Definition at line 3599 of file rational.cpp.

◆ operator!= [4/7]

bool operator!= ( const Rational r,
const long double &  s 
)
friend

inequality operator for Rational and long double

Definition at line 3650 of file rational.cpp.

◆ operator!= [5/7]

bool operator!= ( const long double &  r,
const Rational s 
)
friend

inequality operator long double and Rational

inequality operator for long double and Rational

Definition at line 3700 of file rational.cpp.

◆ operator!= [6/7]

bool operator!= ( const Rational r,
const int &  s 
)
friend

inequality operator for Rational and int

Definition at line 3749 of file rational.cpp.

◆ operator!= [7/7]

bool operator!= ( const int &  r,
const Rational s 
)
friend

inequality operator for int and Rational

Definition at line 3797 of file rational.cpp.

◆ operator* [1/2]

Rational operator* ( const double &  d,
const Rational r 
)
friend

multiplication operator for double and Rational

Definition at line 3857 of file rational.cpp.

◆ operator* [2/2]

Rational operator* ( const int &  d,
const Rational r 
)
friend

multiplication operator for int and Rational

Definition at line 3893 of file rational.cpp.

◆ operator+ [1/2]

Rational operator+ ( const double &  d,
const Rational r 
)
friend

addition operator for double and Rational

Definition at line 3837 of file rational.cpp.

◆ operator+ [2/2]

Rational operator+ ( const int &  d,
const Rational r 
)
friend

addition operator for int and Rational

Definition at line 3877 of file rational.cpp.

◆ operator- [1/3]

Rational operator- ( const double &  d,
const Rational r 
)
friend

subtraction operator for double and Rational

Definition at line 3847 of file rational.cpp.

◆ operator- [2/3]

Rational operator- ( const int &  d,
const Rational r 
)
friend

subtraction operator for int and Rational

Definition at line 3885 of file rational.cpp.

◆ operator- [3/3]

Rational operator- ( const Rational q)
friend

Negation.

Definition at line 3930 of file rational.cpp.

◆ operator/ [1/2]

Rational operator/ ( const double &  d,
const Rational r 
)
friend

division operator for double and Rational

Definition at line 3867 of file rational.cpp.

◆ operator/ [2/2]

Rational operator/ ( const int &  d,
const Rational r 
)
friend

division operator for int and Rational

Definition at line 3901 of file rational.cpp.

◆ operator< [1/7]

bool operator< ( const Rational r,
const Rational s 
)
friend

less than operator

Definition at line 3508 of file rational.cpp.

◆ operator< [2/7]

bool operator< ( const Rational r,
const double &  s 
)
friend

less than operator for Rational and double

Definition at line 3558 of file rational.cpp.

◆ operator< [3/7]

bool operator< ( const double &  r,
const Rational s 
)
friend

less than operator double and Rational

less than operator for double and Rational

Definition at line 3608 of file rational.cpp.

◆ operator< [4/7]

bool operator< ( const Rational r,
const long double &  s 
)
friend

less than operator for Rational and long double

Definition at line 3659 of file rational.cpp.

◆ operator< [5/7]

bool operator< ( const long double &  r,
const Rational s 
)
friend

less than operator long double and Rational

less than operator for long double and Rational

Definition at line 3709 of file rational.cpp.

◆ operator< [6/7]

bool operator< ( const Rational r,
const int &  s 
)
friend

less than operator for Rational and int

Definition at line 3757 of file rational.cpp.

◆ operator< [7/7]

bool operator< ( const int &  r,
const Rational s 
)
friend

less than operator for int and Rational

Definition at line 3805 of file rational.cpp.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Rational q 
)
friend

print Rational

Definition at line 3470 of file rational.cpp.

◆ operator<= [1/7]

bool operator<= ( const Rational r,
const Rational s 
)
friend

less than or equal to operator

Definition at line 3516 of file rational.cpp.

◆ operator<= [2/7]

bool operator<= ( const Rational r,
const double &  s 
)
friend

less than or equal to operator for Rational and double

Definition at line 3566 of file rational.cpp.

◆ operator<= [3/7]

bool operator<= ( const double &  r,
const Rational s 
)
friend

less than or equal to operator double and Rational

less than or equal to operator for double and Rational

Definition at line 3616 of file rational.cpp.

◆ operator<= [4/7]

bool operator<= ( const Rational r,
const long double &  s 
)
friend

less than or equal to operator for Rational and long double

Definition at line 3667 of file rational.cpp.

◆ operator<= [5/7]

bool operator<= ( const long double &  r,
const Rational s 
)
friend

less than or equal to operator long double and Rational

less than or equal to operator for long double and Rational

Definition at line 3717 of file rational.cpp.

◆ operator<= [6/7]

bool operator<= ( const Rational r,
const int &  s 
)
friend

less than or equal to operator for Rational and int

Definition at line 3765 of file rational.cpp.

◆ operator<= [7/7]

bool operator<= ( const int &  r,
const Rational s 
)
friend

less than or equal to operator for int and Rational

Definition at line 3813 of file rational.cpp.

◆ operator== [1/7]

bool operator== ( const Rational r,
const Rational s 
)
friend

equality operator

Definition at line 3492 of file rational.cpp.

◆ operator== [2/7]

bool operator== ( const Rational r,
const double &  s 
)
friend

equality operator for Rational and double

Definition at line 3540 of file rational.cpp.

◆ operator== [3/7]

bool operator== ( const double &  r,
const Rational s 
)
friend

equality operator for double and Rational

Definition at line 3590 of file rational.cpp.

◆ operator== [4/7]

bool operator== ( const Rational r,
const long double &  s 
)
friend

equality operator for Rational and long double

Definition at line 3641 of file rational.cpp.

◆ operator== [5/7]

bool operator== ( const long double &  r,
const Rational s 
)
friend

equality operator for long double and Rational

Definition at line 3691 of file rational.cpp.

◆ operator== [6/7]

bool operator== ( const Rational r,
const int &  s 
)
friend

equality operator for Rational and int

Definition at line 3741 of file rational.cpp.

◆ operator== [7/7]

bool operator== ( const int &  r,
const Rational s 
)
friend

equality operator for int and Rational

Definition at line 3789 of file rational.cpp.

◆ operator> [1/7]

bool operator> ( const Rational r,
const Rational s 
)
friend

greater than operator

Definition at line 3524 of file rational.cpp.

◆ operator> [2/7]

bool operator> ( const Rational r,
const double &  s 
)
friend

greater than operator for Rational and double

Definition at line 3574 of file rational.cpp.

◆ operator> [3/7]

bool operator> ( const double &  r,
const Rational s 
)
friend

greater than operator double and Rational

greater than operator for double and Rational

Definition at line 3624 of file rational.cpp.

◆ operator> [4/7]

bool operator> ( const Rational r,
const long double &  s 
)
friend

greater than operator for Rational and long double

Definition at line 3675 of file rational.cpp.

◆ operator> [5/7]

bool operator> ( const long double &  r,
const Rational s 
)
friend

greater than operator long double and Rational

greater than operator for long double and Rational

Definition at line 3725 of file rational.cpp.

◆ operator> [6/7]

bool operator> ( const Rational r,
const int &  s 
)
friend

greater than operator for Rational and int

Definition at line 3773 of file rational.cpp.

◆ operator> [7/7]

bool operator> ( const int &  r,
const Rational s 
)
friend

greater than operator for int and Rational

Definition at line 3821 of file rational.cpp.

◆ operator>= [1/7]

bool operator>= ( const Rational r,
const Rational s 
)
friend

greater than or equal to operator

Definition at line 3532 of file rational.cpp.

◆ operator>= [2/7]

bool operator>= ( const Rational r,
const double &  s 
)
friend

greater than or equal to operator for Rational and double

Definition at line 3582 of file rational.cpp.

◆ operator>= [3/7]

bool operator>= ( const double &  r,
const Rational s 
)
friend

greater than or equal to operator double and Rational

greater than or equal to operator for double and Rational

Definition at line 3632 of file rational.cpp.

◆ operator>= [4/7]

bool operator>= ( const Rational r,
const long double &  s 
)
friend

greater than or equal to operator for Rational and long double

Definition at line 3683 of file rational.cpp.

◆ operator>= [5/7]

bool operator>= ( const long double &  r,
const Rational s 
)
friend

greater than or equal to operator long double and Rational

greater than or equal to operator for long double and Rational

Definition at line 3733 of file rational.cpp.

◆ operator>= [6/7]

bool operator>= ( const Rational r,
const int &  s 
)
friend

greater than or equal to operator for Rational and int

Definition at line 3781 of file rational.cpp.

◆ operator>= [7/7]

bool operator>= ( const int &  r,
const Rational s 
)
friend

greater than or equal to operator for int and Rational

Definition at line 3829 of file rational.cpp.

◆ rationalToString

std::string rationalToString ( const Rational r,
const int  precision 
)
friend

convert rational number to string

Definition at line 3452 of file rational.cpp.

◆ readStringRational

bool readStringRational ( const char *  s,
Rational value 
)
friend

read Rational from string

Definition at line 3462 of file rational.cpp.

◆ sign

int sign ( const Rational r)
friend

Sign function; returns 1 if r > 0, 0 if r = 0, and -1 if r < 0.

Definition at line 3922 of file rational.cpp.

◆ spxAbs

Rational spxAbs ( const Rational r)
friend

Absolute.

absolute function

Definition at line 3909 of file rational.cpp.

Member Data Documentation

◆ dpointer