OnixS C++ CME Streamlined Market Data Handler  1.0.0.4
API documentation
Decimal Type for Manipulating Prices

Manipulating prices as values of double type may lead to calculation mistakes caused by the way real numbers are presented in double values as well as due to the type capacity limits.

Assume the following initialization of a variable of the double type is executed:

const double Price = 100.10;

In spite of exact constant definition, the real value, hold by a defined variable, looks like 100.099999999999998, but not 100.1.

This is because each double value is expressed as X * 2 ^ Y, where X is mantissa and Y is 2-basis exponent.

As a result, each time the price field is accessed, conversion mistakes might happen.

Since recently, CME uses a real number with a fixed decimal exponent. Therefore, the SDK exposes the OnixS::CME::Streamlined::MDH::FixPointDecimal class for a better experience with original data, transmitted by CME, and to avoid issues described above.

In contrast to a double type, available as a native C++ data type, the OnixS::CME::Streamlined::MDH::FixedPointDecimal class presents real numbers with the constant 10-basis exponent. Therefore, each number looks like X * 10 ^ Y, where X is a mantissa and Y is an exponent.