On 2014/11/13 19:06, Simon Slavin wrote:

On Thu, Nov 13, 2014 at 3:38 PM, Simon Slavin <slav...@bigfraud.org> wrote:

But he's using the field to store an amount of money in.  So why ask for 
anything with ten places after the decimal point ?  No genuine currency 
requires more than three places.

He mightn't be storing the actual money, but the working factors and figures used in the formulas seeding the money calculations, conversions, etc. which may have a bit higher accuracy required. Though if this is the case, I would suggest getting back to your original suggestion of saving the money as integer cents (or milli-dollars if you like) and storing the factors and figures as good old 64 bit IEEE floats which will give you up to 15 digits after the decimal point accurately, twice the required accuracy - not to mention the luxury of being able to access both types natively in the api /and/ represent it easily in human-readable format in data dumps.

By the way, my Oracle friends should intersect here if need be, but I believe the oracle method of /decimal(n,m)/ is simply a representation directive and constraint, there is no native datatype that actually stores or communicates such a value. Oracle stores it internally in a very specific arrangement of bytes and you need to still interpret it in your software.

Nor do I think the Oracle SQL engine would be able to do (without any add-on 
SELECT (B.Money*B.Factor) FROM BigMoney B;
from said table with Money and Factor both as decimal(38,6) each containing >30 
decimals - or would it?

sqlite-users mailing list

Reply via email to