Say we create a table as follows:

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.

Regards,


Pae


Under the section, 6.2 Column Types in the MySQL Documentation stated as
follows:

6.2 Column Types

<snip/>

DOUBLE[(M,D)] [ZEROFILL]
A normal-size (double-precision) floating-point number. Cannot be unsigned.
Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308,
0, and 2.2250738585072014E-308 to 1.7976931348623157E+308. The M is the
display width and D is the number of decimals. DOUBLE without an argument or
FLOAT(X) where 25 <= X <= 53 stands for a double-precision floating-point
number.

DECIMAL[(M[,D])] [ZEROFILL]
An unpacked floating-point number. Cannot be unsigned. Behaves like a CHAR
column: ``unpacked'' means the number is stored as a string, using one
character for each digit of the value. The decimal point and, for negative
numbers, the `-' sign, are not counted in M (but space for these are
reserved). If D is 0, values will have no decimal point or fractional part.
The maximum range of DECIMAL values is the same as for DOUBLE, but the
actual range for a given DECIMAL column may be constrained by the choice of
M and D. If D is left out it's set to 0. If M is left out it's set to 10.
Note that in MySQL Version 3.22 the M argument had to includes the space
needed for the sign and the decimal point.


---------------------------------------------------------------------
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

Reply via email to