OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.18.0
API documentation
Loading...
Searching...
No Matches
Rational Struct Reference

Public Member Functions

 Rational ()
 Rational (long long numerator, unsigned int denominator)
 Rational (const Rational &other, unsigned int newDenominator)
bool noValue () const
template<typename T>
convertTo () const
 operator float () const
 operator double () const
std::string toString () 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
bool operator<= (const Rational &right) const
bool operator>= (const Rational &right) const

Public Attributes

long long numerator
unsigned int denominator

Static Public Attributes

static const long long NO_VALUE

Detailed Description

Definition at line 30 of file Rational.h.

Constructor & Destructor Documentation

◆ Rational() [1/3]

Rational ( )
inline

Constructs default instance.

Definition at line 86 of file Rational.h.

◆ Rational() [2/3]

Rational ( long long numerator,
unsigned int denominator )
inline

Create initialized instance.

Definition at line 92 of file Rational.h.

◆ Rational() [3/3]

Rational ( const Rational & other,
unsigned int newDenominator )
inline

Converts some Rational value to another denominator.

Definition at line 98 of file Rational.h.

Member Function Documentation

◆ convertTo()

template<typename T>
T convertTo ( ) const
inline

Converts Rational representation to needed number type.

Target number type should have accessible constructor from int type, and should have visible operator/.

Decimal d = rational.convertTo<Decimal>()

Definition at line 110 of file Rational.h.

◆ noValue()

bool noValue ( ) const
inline

Indicates if Rational has no value.

Definition at line 104 of file Rational.h.

◆ operator double()

operator double ( ) const
inline

Implicit conversion to double number type.

Definition at line 120 of file Rational.h.

◆ operator float()

operator float ( ) const
inline

Implicit conversion to float number type.

Definition at line 115 of file Rational.h.

◆ operator!=()

bool operator!= ( const Rational & right) const
inline

Definition at line 135 of file Rational.h.

◆ operator<()

bool operator< ( const Rational & right) const
inline

Definition at line 140 of file Rational.h.

◆ operator<=()

bool operator<= ( const Rational & right) const
inline

Definition at line 155 of file Rational.h.

◆ operator==()

bool operator== ( const Rational & right) const
inline

Rational comparison.

Definition at line 125 of file Rational.h.

◆ operator>()

bool operator> ( const Rational & right) const
inline

Definition at line 150 of file Rational.h.

◆ operator>=()

bool operator>= ( const Rational & right) const
inline

Definition at line 160 of file Rational.h.

◆ toString()

std::string toString ( ) const

string representation of Rational

Member Data Documentation

◆ denominator

unsigned int denominator

Denominator.

Definition at line 39 of file Rational.h.

◆ NO_VALUE

const long long NO_VALUE
static

This value indicates that value is in not set.

Definition at line 33 of file Rational.h.

◆ numerator

long long numerator

Numerator.

Definition at line 36 of file Rational.h.