Rational number in our representation is just numerator and denominator. ICE provides information about prices using numerators only. To get a real price you need to get the denominator from a product definition and then divide the numerator on the denominator. To simplify this we decided to use our own representation and always keep the denominator together with the numerator.
For more details please see OnixS::ICE::iMpact::MarketData::RationalNumber
.
We support only limited operations for RationalNumber
. There are no arithmetic operations for this class at all. You can only use the following:
float
or double
).==
, !=
, <
, >
, <=
, >=
).In case you want to make basic arithmetic operations on rational numbers please use numerators but make sure denominators are the same. For example, if you want to calculate a sum of two prices represented as rational numbers, it's completely OK to create a rational number with a numerator equal to the sum of numerators of these rational numbers and keep the denominator the same:
\[ \frac{1}{100} + \frac{2}{100} = \frac{1 + 2}{100} = \frac{3}{100} \]