On 2014/11/13 15:01, Dinesh Navsupe wrote:
My need is 23 decimal digits of precision. We work on complex payout
calculation engine where in formula outputs are quite large numbers and
clients do not want to round off.
I do not think that re-stating your need suffices as a good enough argument. We heard you the first time and understand the need and
understand exactly that you are working with numbers in that precision so you would like to be able to store them efficiently.
SQLite does not do this in binary terms (it can produce 64 bit Integers/Reals at best in accordance with IEEE as some others already
explained). No other Engine does this natively either (meaning that in your code there is no way to exchange that size number with
the prepared statement/api/object within a standard C data type other than a string or blob). Using strings is preferable because
they will be human readable in DB dumps, but you will need to use a BigInt type library or create your own conversion routines to
actually translate those numbers to and from strings for the purposes of communicating it to/from any DB engine, SQLite included.
We want to use SQLite for local disk data store and calculations.
That's a good decision, but it comes with a bit of work, same as any other
As an aside, do you really need that precision? You can accurately state the American National Debt in dollars and cents within 16
digits of precision (That's 18 trillion dollars btw, or 18^12). I can't imagine a payout ever needing to be much higher than that,
or by another 8 or so digits more precise? (well, that would allow you to express the entire World's collective national debts in
Zimbabwe dollars). 16 digits can very well be represented by a Float in SQLite and transferred to your program in standard 64-bit
floats via the API. Above that you will need to make the routines.
sqlite-users mailing list