In my opinion (please tell me if I'm wrong), your method only works if you want to *display* the values in your column, and if the decimal precision doesn't change form line to line. I would like to be able to perform operations (+, /, %, etc.) and to store intermediary results into other columns (such as x% of the value, etc.), which may have an arbitrary precision, and - only at the end - round the result to cents/pennies etc. This is required into the technical specifications provided by my client, because high precision matters for them. Indeed, an error of 0.01$ on 10,000,000 lines would lead to a significant error at the end... Any help appreciated. I really wouldn't have to propose another software than SQLite for this job... even if I have to reimplement from scratch BCD numbers for the sqlite engine! ;-) Aladdin
> Date: Sun, 13 Apr 2008 17:20:03 +0100 > From: [EMAIL PROTECTED] > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Dealing with monetary huge values in sqlite > > On Sun, Apr 13, 2008 at 06:13:04PM +0200, Aladdin Lampé wrote: >> Maybe I could also implement my own floating point format, based for >> instance on an int64 and a way to tell where the decimal point is. But in >> this case I would need to reimplement addition, division, etc. to deal >> with the position of the decimal point, and this may have a negative >> impact on performance and a storage overhead. > > Why not just express all money values in terms of the smallest division of > the currency? For example, for dollars, use cents, for pounds use pennies. > > Sqlite has up to 8 byte integers which would allow for all reasonable > values. > > -- > Two hands working can do more than a thousand clasped in prayer > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _________________________________________________________________ Recevez tous vos e-mails sur un seul compte ! Créez une adresse Hotmail ! http://www.windowslive.fr/hotmail/default.asp _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users