Web lists-archives.com

Re: mysql float data type




On 16.12.2014 15:16, xiangdongzou wrote:

>  Can anyone tell me why 531808.11 has been changed to 531808.12 ?

typical decimal->binary->decimal conversion/rounding error.



If you want exact decimals you need to stick with the
DECIMAL type which doesn't have this problem, at the
cost of slower calculations though.

see also:

  http://dev.mysql.com/doc/refman/5.5/en/problems-with-float.html

-- 
Hartmut Holzgraefe, Principal Support Engineer (EMEA)
MariaDB Corporation | http://www.mariadb.com/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql