I inserted different values of pi
3.14
3.14159265359
3.14159
3.1415
And I'm not seeing the difference in how the different floating point types handle the same values.
mysql>
The only thing I can see here is when creating the table, the field with numeric type used decimal shown by the describe table command.
Would somebody give me an example that shows the differences between FLOAT, DECIMAL and DOUBLE?
3.14
3.14159265359
3.14159
3.1415
And I'm not seeing the difference in how the different floating point types handle the same values.
Code:
mysql> select * from types;
+---------+---------+---------+----------+
| flo | dub | deci | noomeric |
+---------+---------+---------+----------+
| 3.14000 | 3.14000 | 3.14000 | 3.14000 |
| 3.14159 | 3.14159 | 3.14159 | 3.14159 |
| 3.14159 | 3.14159 | 3.14159 | 3.14159 |
| 3.14150 | 3.14150 | 3.14150 | 3.14150 |
| 3.14150 | 3.14150 | 3.14150 | 3.14150 |
+---------+---------+---------+----------+
5 rows in set (0.00 sec)
mysql> describe types;
+----------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------+------+-----+---------+-------+
| flo | float(10,5) | YES | | NULL | |
| dub | double(10,5) | YES | | NULL | |
| deci | decimal(10,5) | YES | | NULL | |
| noomeric | decimal(10,5) | YES | | NULL | |
+----------+---------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
The only thing I can see here is when creating the table, the field with numeric type used decimal shown by the describe table command.
Would somebody give me an example that shows the differences between FLOAT, DECIMAL and DOUBLE?