Bug #47355 | Cannot compute sum of values with 1 or 2 decimal place if type is Float. | ||
---|---|---|---|
Submitted: | 16 Sep 2009 8:53 | Modified: | 16 Sep 2009 9:19 |
Reporter: | Reuben S. Valaydon Pillay | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | mySQL server 4.1 | OS: | Windows (SP2) |
Assigned to: | CPU Architecture: | Any | |
Tags: | FLOAT, sum |
[16 Sep 2009 8:53]
Reuben S. Valaydon Pillay
[16 Sep 2009 9:19]
Valeriy Kravchuk
This is not a bug. Flating-point values are approximate. Check http://dev.mysql.com/doc/refman/4.1/en/problems-with-float.html. If you'll try to check more decimal places you will see the reason for SUM() result: mysql> select wl*1000000 from test; +------------------+ | wl*1000000 | +------------------+ | 2099999.90463257 | | 2900000.09536743 | | 2599999.90463257 | | 400000.005960464 | +------------------+ 4 rows in set (0.03 sec)