OnixS SGX Derivatives Handler for C++  2.17.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
Rational Struct Reference

Rational number representation. More...

Public Types

enum  { INVALID = ~0u }
 

Public Member Functions

 Rational (int64 numeratorValue=0, uint64 denominatorValue=INVALID)
 Creates exemplar of Rational initializing numerator and denominator.
 
bool valid () const
 Checks if value is valid.
 
template<typename 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 number
 

Public Attributes

int64 numerator
 Rational number numerator.
 
uint64 denominator
 Rational number denominator.
 

Detailed Description

Rational number representation.

Member Function Documentation

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 price = exchangePrice.convertTo<decimal>()