Bug #69604 Incorrect mathematic output with quoted numeric values
Submitted: 27 Jun 2013 16:56 Modified: 27 Jun 2013 19:06
Reporter: Jed Tucker Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.5.31-1 OS:Linux (Debian)
Assigned to: CPU Architecture:Any

[27 Jun 2013 16:56] Jed Tucker
Description:
Certain simple arithmetic using quoted values returns invalid results.

How to repeat:
SELECT 564.82 * '100'; 
56482.0000000001 
(incorrect)

SELECT 564.82 * 100; 
56482.00
(correct)
[27 Jun 2013 19:06] MySQL Verification Team
Thank you for the bug report. 
Verified as described.
[28 Jun 2013 9:07] Hartmut Holzgraefe
... and welcome to the wonderful world of binary floating point to decimal conversion ... (in the PHP bug system we even have a canned response for that)

See e.g.: 
http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
[28 Jun 2013 10:05] Hartmut Holzgraefe
Ok, i have to confess that i've seen the quotes on the 564.82, not on the 100 ...

But there's still no exact binary fraction representation of 564.82, and changing the sequence of operations in calculating the expression may lead to have the inherent imprecision flip to either side ...
[16 Dec 2020 18:49] Bear Limvere
This is still a bug in MySQL Server: 5.6.42-84.2 and MySQL Server: 5.7.18-15