Bug #12738 DOUBLE type column doesnot store the values as described in the manual
Description:
# This is a bug report from Japanese user group
About the DOUBLE column type, the manual says:
"Allowable values are -1.7976931348623157E+308 to
-2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to
1.7976931348623157E+308."
http://dev.mysql.com/doc/mysql/en/numeric-type-overview.html
But in MySQL 5.0.12 and 4.1.13, -2.2250738585072014E-308
and 2.2250738585072014E-308 becomes 0 when inserted.
mysql> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> insert into t1 values(-1.7976931348623157E+308);
Query OK, 1 row affected (0.01 sec)
mysql> insert into t1 values(-2.2250738585072014E-308);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(2.2250738585072014E-308);
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(1.7976931348623157E+308);
Query OK, 1 row affected (0.00 sec)
mysql> select * from t1;
+------------------------+
| a |
+------------------------+
| -1.79769313486232e+308 |
| 0 |
| 0 |
| 1.79769313486232e+308 |
+------------------------+
4 rows in set (0.01 sec)
Another value also becomes 0.
mysql> insert into t1 values(2.20E-306);
Query OK, 1 row affected (0.05 sec)
mysql> select * from t1;
+------------------------+
| a |
+------------------------+
| -1.79769313486232e+308 |
| 0 |
| 0 |
| 1.79769313486232e+308 |
| 0 |
+------------------------+
5 rows in set (0.00 sec)
In 4.1.10 and 5.0.2, the result was
mysql> select * from t1;
+------------------------+
| a |
+------------------------+
| -1.79769313486232e+308 |
| -2.2250738585072e-308 |
| 2.2250738585072e-308 |
| 1.79769313486232e+308 |
+------------------------+
4 rows in set (0.02 sec)
How to repeat:
See above.
Suggested fix:
According to the manual, the value -2.2250738585072014E-308 and 2.2250738585072014E-308 should be allowable.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.