Bug #5059 float multiplication
Submitted: 15 Aug 2004 12:27 Modified: 16 Aug 2004 19:44
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.16 and 4.0.20a-nt OS:both fbsd and winxp
Assigned to: Dean Ellis CPU Architecture:Any

[15 Aug 2004 12:27] [ name withheld ]
Description:
mysql> select a,b,a*b from tmp;
+-------+-------+-----------------+
| a     | b     | a*b             |
+-------+-------+-----------------+
| 26.82 | 746.9 | 20031.858426849 |
+-------+-------+-----------------+

congratulations.

How to repeat:
just create a table with two float fields, insert those values and type that select.

Suggested fix:
rewrite the whole code.
[16 Aug 2004 19:44] Dean Ellis
This is a simple precision error, which is common when dealing with floating point numbers.  You could use DOUBLE/DECIMAL/NUMERIC or restrict the apparent final precision with ROUND().  Also, see: http://dev.mysql.com/doc/mysql/en/Problems_with_float.html