Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread John Stanton
b... 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

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread John Stanton
Our solution for the large number problem and escape the floating point jungle was to implement a display format fixed point decimal arithmetic processor with an arbitrary precision. It has add, subtract, multiply and divide plus aggregate functions. A wrapper handles the interface and inte

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Rich Shepard
On Sun, 13 Apr 2008, Rich Shepard wrote: > approach (less elegant but workable) is to add 0.05 to all values with two Oops! Make that 0.005. Mea culpa! Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Rich Shepard
On Sun, 13 Apr 2008, Aladdin Lampé wrote: Thank you Nicolas for your answer. I understand that an int64 certainly gives me enough precision in the general case. Now what am I supposed to do if the user decides to add a virtual 4 decimal digits number to another number which has only 2 decimal di

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Tomas Lee
c." There's a lot of information there about doing decimal arithmetic, both in fixed-size and arbitrary-precision. You can download implementations with very liberal licenses too. >> Date: Sun, 13 Apr 2008 13:41:46 -0500 >> From: [EMAIL PROTECTED] >> To: sqlite-users@sqlite

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Aladdin Lampé
like you suggest. Aladdin > Date: Sun, 13 Apr 2008 13:41:46 -0500 > From: [EMAIL PROTECTED] > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Dealing with monetary huge values in sqlite > > On Sun, Apr 13, 2008 at 07:37:33PM +0200, Aladdin Lampé wrote: >> In my opinio

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Nicolas Williams
On Sun, Apr 13, 2008 at 07:37:33PM +0200, Aladdin Lampé wrote: > 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 operati

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Aladdin Lampé
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 >>

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Dennis Cote
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. This is mostly a test of replying to a post from Yahoo mail, but I

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread BareFeet
> 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. Yes, and you can create views to show the amounts in decimal notation where you need to. I do this (store as integers, show sometimes

Re: [sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Geoff Lane
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 posit

[sqlite] Dealing with monetary huge values in sqlite

2008-04-13 Thread Aladdin Lampé
Hi all! In the application I'm developing, I'm dealing with monetary values that may become *very* huge (but with few decimals), and I have the feeling that the sqlite representation of "REAL" numbers with 8 bytes doubles may not be enough in my case, and I may get overflows (which would obviou