On Thu, Nov 12, 2009 at 11:40:23PM +0000, Simon Slavin wrote:
> There's still some possibility for confusion, however: how many places
> of decimals do you use for each currency ?  As far as I know, no
> currently traded currency uses more than two digits of precision.
                                           ^^^^^^^^^^^^^^^^^^^^^^^
They use integer math to avoid floating point rounding issues, but
logically those integers are still real (or at least rational) numbers,
and so we can speak of base, mantissa and exponent.  The precision
required is pretty large, much more than two digits.

Consider U.S. dollars, where we need to express from some fraction of
pennies to tens of trillions of dollars.  That's at least 16 digits of
precision.  You need to use larger than 32-bit integers for this,
meaning, in practice, 64-bit integers.  Besides, 100 years ago 16 digits
of precision for counting money would probably have seemed farfeteched,
so use 64-bit integers, which gets you a bit less than 20 digits of
precision.  (Hmmm, 19 digits looks a bit small now!)

Nico
-- 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to