Edit this page on github
Frequently asked questions on comdb2

Decimal 32/64/128 datatype

Comdb2 implements the decimal format for real numbers, as described in IEEE 754-2008 standard, published in August 2008. The decimal format avoids the pitfall of floating point representation to provide error-less arithmetic using real numbers.

Comdb2 provides three datatypes, decimal32, decimal64, and decimal128, providing single, double and quad precision, respectively. Each number is represented as a triplet (sign, significand, exponent), and the number value is ((-1)^sign)significand(10^exponent).

These are the limitations of each datatype:

Note: the decimal representation allows for un-normalized significand values. This makes decimal manipulation a slower operation compared to binarty floating point. Since comdb2 allows decimal types to be used as part of the key, it was paramount that a simple binary comparison is enough to determine the ordering of two decimal values. Comdb2 chose to normalize the significand and reduce the range of the numbers by the size of the significand.