My mysql: 5.6.16
my table info :
CREATE TABLE `xxx` (
`uid` int(11) NOT NULL,
`money` float(10,2) NOT NULL DEFAULT '0.00' ,
`real_money` float(10,2) NOT NULL ,
`available_invoice` float(10,2) DEFAULT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
my table content is :
1 100000.00 0.00 0.01
30 99992560.00 0.03 0.00
61 65216.00 0.03 0.00
79 10.00 0.00 0.00
80 10.00 0.00 0.00
81 -70.00 0.00 0.00
83 60.00 0.00 0.00
100 100.00 50.00 50.00
889 980.00 0.00 0.00
1234 99959040.00 0.00 99999.00
1239 40.00 0.00 0.00
when I execute the sql :
update `xxx` set `money`=`money`-20 where uid = 1234
the result is :
uid money real_money available_invoice
1 100000.00 0.00 0.01
30 99992560.00 0.03 0.00
61 65216.00 0.03 0.00
79 10.00 0.00 0.00
80 10.00 0.00 0.00
81 -70.00 0.00 0.00
83 60.00 0.00 0.00
100 100.00 50.00 50.00
889 980.00 0.00 0.00
1234 99959024.00 0.00 99999.00
1239 40.00 0.00 0.00
it is always miss 4 or 2 whatever I add or subtracts some to a float number which is nearly 100000000, why ?