On 2018-12-17 02:41, Simon Slavin wrote:
On 16 Dec 2018, at 2:54pm, Wout Mertens <wout.mert...@gmail.com> wrote:

imagine having to handle the Zimbabwean Dollar, which ended up having 100 trillion dollar notes. Good way to overflow your integers.

Indeed.  But when the crisis started in the early 2000s, the currency
was devalued by 1000.  Then ten zeros were wiped out at a stroke.  And
then another twelve zeros were slashed to make the "fourth Zimbabwe
dollar".

So if you were going to keep track of an account with Z$1 old and Z$1
new you'd need a precision capable of keeping track through 3+10+12 =
25 zeros, or amounts like

10,000,000,000,000,000,000,000,001

The precision of double-precision floats, 52-bit significand, is 2^52
= 4.5e15.  Just to store one new Z$.  If someone has ten new dollars
in their account you could no longer keep their account even in
double-precision floating point.  You would have needed quad-precision
(2^112 = 5.2e33), and banks weren't using that at the time even to do
calculations.  (I don't know what they use now, I'm not in the
industry.)


Banks still use, as they have for a very long time, Binary Coded Decimal, or some equivalent that does not suffer from a loss of accuracy, so all this foofaraw to do with floating point representation of various amounts of currency does not apply to the real world.

        Cheers,
                Gary    B-)
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to