Rational number representation. More...
Public Member Functions | |
Rational () | |
Constructs default instance. | |
Rational (SInt64 numerator, UInt32 denominator) | |
Create initialized instance. | |
Rational (const Rational &other, unsigned int newDenominator) | |
Converts some Rational value to another denominator. | |
bool | noValue () const |
Indicates if Rational has no value. | |
template<typename T > | |
T | convertTo () const |
Converts Rational representation to needed number type. More... | |
operator float () const | |
Implicit conversion to float number type. | |
operator double () const | |
Implicit conversion to double number type. | |
std::string | toString () const |
string representation of Rational | |
bool | operator== (const Rational &right) const |
Rational comparison. | |
bool | operator!= (const Rational &right) const |
bool | operator< (const Rational &right) const |
bool | operator> (const Rational &right) const |
bool | operator<= (const Rational &right) const |
bool | operator>= (const Rational &right) const |
Public Attributes | |
SInt64 | numerator |
Numerator. | |
UInt32 | denominator |
Denominator. | |
Static Public Attributes | |
static const SInt64 | NO_VALUE |
This value indicates that value is in not set. | |
Rational number representation.
|
inline |
Converts Rational representation to needed number type.
Target number type should have accessible constructor from int type, and should have visible operator/.