Bug #78418 Inserted data in "col float" is truncated to 6 digits in "select * from t1"
Submitted: 12 Sep 2015 12:34 Modified: 13 Sep 2015 19:59
Reporter: Su Dylan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.22 OS:Any
Assigned to: CPU Architecture:Any

[12 Sep 2015 12:34] Su Dylan
Description:

Output:
=======
mysql> drop table if exists t1;
Query OK, 0 rows affected (0.00 sec)

mysql> create table t1(c1 float);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values(123456789);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
+-----------+
| c1        |
+-----------+
| 123457000 |
+-----------+
1 row in set (0.00 sec)

mysql> select round(c1,1) from t1;
+-------------+
| round(c1,1) |
+-------------+
| 123456792.0 |
+-------------+
1 row in set (0.00 sec)

mysql>
mysql> select version();
+------------+
| version()  |
+------------+
| 5.6.22-log |
+------------+
1 row in set (0.00 sec)

Problem:
========
In the above result, since the more accurate value(123456792) is stored, the display result for "select * from t1" is truncated to be 123457000.
Is this a bug?

How to repeat:

drop table if exists t1;
create table t1(c1 float);
insert into t1 values(123456789);
select * from t1;
select round(c1,1) from t1;

Suggested fix:
"select * from t1" returns 123456792.
[13 Sep 2015 19:59] Miguel Solorzano
Thank you for the bug report. This is a known and documented issue please read:

https://dev.mysql.com/doc/refman/5.6/en/problems-with-float.html

Thanks.