SQLite Forum

Decimal128
Login
Repeating something I've stated before in this forum: If distinction is made between precise monetary quantities and the results of calculations which inherently produce minute [a] errors, then integer cents can be stored and computation done with integers where absolute precision **can be preserved** and binary floating point can be used where absolute precision **cannot be expected**. No additional types are needed; adequate discipline alone suffices.

[a. No offense intended here but: The epsilon discussions make me wonder if anybody ever did argue about how many angels could dance upon the head of a pin. After seeing this thread, I doubt it less than before. ]

With a few extension functions to more obviously express operations and conversions among the *exact cents* and *pretty darn close cents* (or whole monetary unit) forms, it is all quite manageable.

Introducing a new type, where number components equal to negative powers of ten can be exactly represented, is not going to eliminate the need for such discipline. It may disguise the need for it a little better.