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.
Let's assume the following initialization of a variable of the double type is executed:
Despite the constant definition, the value actually stored is approximately 100.0999999999999943, not 100.1.
The reason is the following: each double value is expressed as X * 2 ^ Y, where X is mantissa and Y is 2-basis exponent.
As a result, conversion mistakes might happen each time the price field is accessed.
CME MDP 3.0 uses real numbers with a fixed decimal exponent. The SDK exposes the OnixS::CME::MDH::Messaging::Decimal class to match the data transmitted by MDP and avoid the issues described above.
The OnixS::CME::MDH::Messaging::Decimal class represents real numbers with a base-10 exponent. Therefore, each number looks like X * 10 ^ Y, where X is a mantissa and Y is an exponent.