Where can we find the info regardng on the DOUBLE precision 15 or 16? I searched the doc. and unable to locate it.
JDBC mm.mysql-2.0.14-bin.jar + MySQL v3.23.52-MAX on WinNT. Regards, Pae > > CREATE TABLE account (id INTEGER, balance DECIMAL(20, 2), col_double > > DOUBLE(20,2)); > > > > And we insert 6 rows as follows: > > > > INSERT INTO account (id, balance, col_double) VALUES (1, > > 12345678901234567890.56, 12345678901234567890.56); > > INSERT INTO account (id, balance, col_double) VALUES (2, > > 1234567890123456789.56, 1234567890123456789.56); > > INSERT INTO account (id, balance, col_double) VALUES (3, > > 123456789012345678.56, 123456789012345678.56); > > INSERT INTO account (id, balance, col_double) VALUES (4, > > 12345678901234567.56, 12345678901234567.56); > > INSERT INTO account (id, balance, col_double) VALUES (5, > > 1234567890123456.56, 1234567890123456.56); > > INSERT INTO account (id, balance, col_double) VALUES (6, 123456789012345.56, > > 123456789012345.56); > > > > We I have from the table by executing a query as follows; > > > > SELECT * FROM account; > > > > ResultSet: > > ======= > > id balance col_double > > 1 99999999999999999999.99 12345678901234567000.00 > > 2 12345678901234567800.00 12345678901234567800.00 > > 3 123456789012345680.00 123456789012345660.00 > > 4 12345678901234568.00 12345678901234568.00 > > 5 1234567890123456.50 1234567890123456.50 > > 6 123456789012345.56 123456789012345.56 <== Only > > correct one > > > > Is this a feature or bug? > > > > Any comments? Thanks you. > > Note that double floating point values have only a precision of about > 15-16 digits. That explains the behaviour you see with col_double. > I searched the MySQL docuementation and unable to locate the info you mentioned above. Would you provide the specific info to locate it. > The behaviour you see with balance is because you use doubles to > initialize the column. So the precision is already lost after parsing > the insert. Using string constants instead of numbers should work, i.e. > I can see this part if the double uses the precision 15. > INSERT INTO account (balance) VALUES ("12345678901234567890.56") > > Except, of course, for the row with id=1 where the number is bigger > than allowed by DECIMAL(20,2) and therefore set to the max value as > explained in the manual. > > Regards, > > Benjamin. > > > -- > [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php