Bug #17418 DECIMAL(n,0) returns with two places of decimals
Submitted: 15 Feb 2006 9:28 Modified: 15 Feb 2006 12:00
Reporter: Ryusuke Kajiyama Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.19-BK, 5.0.16 OS:n/a
Assigned to: CPU Architecture:Any

[15 Feb 2006 9:28] Ryusuke Kajiyama
Description:
When I use DECIMAL(n, m), m changes dinamically.
I expect it returns without decimals.

How to repeat:
mysql> select cast('123.4567890' AS DECIMAL(4,0));
+-------------------------------------+
| cast('123.4567890' AS DECIMAL(4,0)) |
+-------------------------------------+
|                              123.46 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> select cast('123.4567890' AS DECIMAL(4,1));
+-------------------------------------+
| cast('123.4567890' AS DECIMAL(4,1)) |
+-------------------------------------+
|                               123.5 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> select cast('123.4567890' AS DECIMAL(4,2));
+-------------------------------------+
| cast('123.4567890' AS DECIMAL(4,2)) |
+-------------------------------------+
|                              123.46 |
+-------------------------------------+
1 row in set (0.01 sec)
[15 Feb 2006 12:00] Valeriy Kravchuk
Thank you for a bug report. Looks like a duplicate of bug #16172.