SQLite Forum

Decimal128
Login
You do realize that the Decimal Floating-Point format stores the mantissa as a binary number, (not BCD encoded) and are generally based on the fact that 2^10 is just slightly bigger than 10^3, so 10 bits can store a number between 0 and 999, with a few unused coded, and 50 bits can store numbers between 0 and 999,999,999,999,999 with a few unused codes, so all the arithmetic being done in Decimal Floating-Point is done with the normal binary hardware. The only extra work is in the normalization, where we need multiplication by powers of 10 vs powers of 2 (a shift). (There also is a small decoder to convert 5 bits into the upper digit of the mantissa and the two upper bits of the exponent limited to 0, 1, 2, )

It is a very different format than the old Decimal Fixed Point notation that stored numbers as packed BCD digits.