Randall Fox wrote:
After reading the FAQ and type information over, I went and tried the
following:
CREATE TABLE M (A numeric, B text);
INSERT INTO M VALUES (1.2);
INSERT INTO M VALUES (1.2);
INSERT INTO M VALUES (1.2);
.
.
; did this about 45 times
.
.
SELECT SUM(A) FROM M;
result was 52.8000
Welcome to the wonderful world of floating point numbers :-)
I always store money values as cents (or as integers, what ever your
currency might call it) and move the decimal to format for display..
Randall Fox wrote:
After reading the FAQ and type information over, I went and tried the
following
On Fri, 04 Jun 2004 20:39:45 -0700, you wrote:
>You mean like rounding once in a while to the number of significant
>decimal places? Once every few billion additions like those above should
>suffice.
That defeats the purpose of being able to "SELECT SUM(X) FROM ... "
The aggregate query sum(x)
On Fri, 04 Jun 2004 23:46:06 -0400, you wrote:
>Welcome to the wonderful world of floating point numbers :-)
>
>I always store money values as cents (or as integers, what ever your
>currency might call it) and move the decimal to format for display..
Yes, I took a closer look at floating point a
Randall Fox wrote:
> On Fri, 04 Jun 2004 23:46:06 -0400, you wrote:
>
> I was worried that once the number got put into a floating point notation,
> the error would still creep up...
>
The value 1.2 cannot be represented exactly in a (finite-length)
binary number. On my machine, 1.2 gets stored as
for
the reasons you suffer from.) Floating point is damn near useless IMHO.
Fred
> -Original Message-
> From: Randall Fox [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 05, 2004 5:20 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [sqlite] Adding and subtracting decimals
Hi,
Is this a problem with all database systems or is it only unique to SQLite?
__
Raymond Irving
"D. Richard Hipp" <[EMAIL PROTECTED]> wrote:
The value 1.2 cannot be represented exactly in a (finite-length)
binary number. On my machine, 1.2 gets stored as
1.1999555910790149937383
On Sun, 6 Jun 2004, Raymond Irving wrote:
>Hi,
>
>Is this a problem with all database systems or is it only unique to SQLite?
Most database systems have a seperate money type precisely for this
problem, which is often BCD to allow arbitrary length values. Rounding
errors are simply not an option
On Mon, 7 Jun 2004 12:31:37 +0100 (BST), Christian Smith
<[EMAIL PROTECTED]> wrote:
>
> Most database systems have a seperate money type precisely for this
> problem, which is often BCD to allow arbitrary length values. Rounding
> errors are simply not an option for financial institutions.
Intern
9 matches
Mail list logo