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:
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.800000000001
Defining the field as text made no difference, and in fact the best way was to put in the number without the decimal, to guarantee it will be treated as an integer (i think) instead of a float. But this could be confusing to the end user who doesn't understand the details of floating point arithmetic..
Is there a work around to accurately add fixed point numbers? Or
more generally, has this been addressed before? I couldn't find any
reference to it on the FAQ or web site..
This problem becomes more obvious when the 1.2 is interpreted as $1.20
Thank you
Randall Fox
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]