The class Fraction models a mathematical fraction.
The following invariants are always maintained:
Definition at line 61 of file fraction.h.
OSB_LIB::Fraction::Fraction | ( | ) | [inline] |
Constructor with nominator and optional denominator.
double OSB_LIB::Fraction::dbl | ( | ) | const [inline] |
Convert to double.
Definition at line 78 of file fraction.h.
References denominator_, and nominator_.
long OSB_LIB::Fraction::denominator | ( | ) | const [inline] |
Get the denominator.
Definition at line 76 of file fraction.h.
References denominator_.
Referenced by OSB_LIB::operator==().
long OSB_LIB::Fraction::nominator | ( | ) | const [inline] |
Get the nominator.
Definition at line 74 of file fraction.h.
References nominator_.
Referenced by OSB_LIB::operator==().
Fraction & OSB_LIB::Fraction::operator- | ( | ) | [inline] |
void OSB_LIB::Fraction::reduce | ( | ) | [private] |
Reduce the fraction to its lowest term.
std::string OSB_LIB::Fraction::str | ( | ) | const |
Convert to string: n/d.
long OSB_LIB::Fraction::denominator_ [private] |
The denominator of the fraction.
Definition at line 109 of file fraction.h.
Referenced by dbl(), and denominator().
long OSB_LIB::Fraction::nominator_ [private] |
The nominator of the fraction.
Definition at line 107 of file fraction.h.
Referenced by dbl(), nominator(), and operator-().