snippet by ashrafp


									There are two different data types to represent decimal numbers:

      Dec32: Decimal numbers with single precision.
      Dec64: Decimal numbers with double precision.

Both decimal number data types have the following features:

      In order to support exact representation of decimals without precision
       loss a base-10 exponent is used.
      A decimal value comprises two parts, the mantissa and the exponent:

       Mantissa    Exponent
       4 or 8 byte 1 byte

– Mantissa: A 4-byte or 8-byte signed integer (SInt32 or SInt64) that defines
the mantissa of the decimal value.
- Exponent: A single-byte signed integer (SInt8) that defines the exponent of
the decimal value.

      Only decimal values are supported, fractions are not supported.
      The actual value of the decimal number is calculated using the formula:

       value = mantissa.10exponent

The data representation for the mantissa and the exponent is defined by the
representation of the used data types, i.e. SInt32 and SInt8 for the mantissa
and the exponent, respectively. (SInt8 for the exponent respectively SInt32 or
SInt64 for the mantissa) fully described in subsection 7.3.3. Little-endian byte
order is used to encode the mantissa.

The following table lists the decimal number data types with additional encoding

Data Type   Num. of Bytes       Exponent Range   Mantissa Range
Dec32       5(1+4)              -127 - 127       -2139062143 - 2147483647
Dec64       9(1+8)              -127 - 127       -9187201950435737471 -

So the minimal and maximal values of Dec32 are -2139062143.10127 and
2147483647.10127 and the the minimal and maximal values of Dec64 are
-9187201950435737471.10127 and 9223372036854775807.10127. Note: The ranges of the
decimal number types Dec32 and Dec64 are not symmetrical.

To top