Bug #12738 DOUBLE type column doesnot store the values as described in the manual
Submitted: 23 Aug 2005 0:09 Modified: 1 Sep 2005 17:43
Reporter: Shuichi Tamagawa Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:> 4.1.10, > 5.0.2 OS:Linux (Linux/Windows)
Assigned to: Paul DuBois CPU Architecture:Any

[23 Aug 2005 0:09] Shuichi Tamagawa
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.
[23 Aug 2005 13:13] MySQL Verification Team
Thank you for the bug report.
[1 Sep 2005 17:43] Paul DuBois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).