Bug #17742 | Imprecise math: SUM, AVG seem to convert DECIMAL to FLOAT data type | ||
---|---|---|---|
Submitted: | 27 Feb 2006 14:57 | Modified: | 28 Feb 2006 14:14 |
Reporter: | Baron Schwartz (Basic Quality Contributor) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1.14-log | OS: | Linux (Gentoo Linux) |
Assigned to: | CPU Architecture: | Any |
[27 Feb 2006 14:57]
Baron Schwartz
[27 Feb 2006 21:53]
Jorge del Conde
Hi! The results you're experiencing are expected in 4.1 distributions. What's happening is (in 4.1) the SUM() uses floating point (non-precision math) so it's probably comparing 0.00 to 0.00000000000000000000000000000000000000000000001 or something similar. You can read more about this here: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html
[28 Feb 2006 14:14]
Baron Schwartz
Thanks for the explanation. I'd still count that as a bug but I won't argue with you :-) The issue with ORDER BY making the resultset have different rows certainly seems like a bug to me, though. ORDER BY should order the rows in the resultset, never change them. Should I enter that bug separately once I can find a set of data that will reproduce it?