SQLite Forum

> ...Float64 representation is insufficient...

Separate issue. If someone wants to start advocating for [extended precision floats][1], then I wouldn't oppose that at all, simply because it's built into the FPU on many processors.

Whether doing so is *advisable* is a separate matter, since it's likely to make your DB non-portable. Still, if you have a problem big enough that it requires extended precision FP arithmetic, you're probably sufficiently grown up to accept this limitation.

What we're discussing in this thread is a) going straight to 128 bits, rather than something more moderate like 80 or 96 bit; and b) decimal representation, which is better for countable things rather than measurable things, which brings us back to questions of the maximum number of tightly-packed dust particles in the visible universe.

> If the domain is Financial...

...then something on the order of 10<sup>15</sup> should suffice to account for [all of the money in the world][2], to the precision of pennies.

...which no one bank actually does, there being more than one global-scale bank, so no one has all the marbles.

> ...a decimal representation makes sense [for financial applications]

Yes. But whether DECIMAL is good for money is an entirely separate matter from whether you need a 34-digit significand.

> world-scale numbers start to come very close to running out of precision (you only get 16 digits)

Floating-point was made for measurable quantities, where 16 digits likely exceeds the accuracy of your instrument by orders of magnitude. Very few measurement instruments go to 9 digits. Most run out of useful precision in the 3-5 digit range.

Thus 32, 24, and 16-bit FP.  They often suffice.

If you're doing discrete math with countable objects, then you probably shouldn't be using FP at all.

> And Decimal64 isn't that much of a help, as SQLite doesn't support it either

Certainly, but it'd be much easier to make a case for having it than for Decimal128.

[1]: https://en.wikipedia.org/wiki/Extended_precision
[2]: https://money.howstuffworks.com/how-much-money-is-in-the-world1.htm