Reputation: 1028
If I add a table like this in MySQL:
CREATE TABLE `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`value` float NOT NULL,
PRIMARY KEY (`id`)
);
and add an entry:
INSERT INTO `test` (`value`) VALUES ('123.45');
and do a SUM on it like this:
SELECT SUM( value )
FROM `test`
why does it return 123.449996948242 and not 123.45?
Upvotes: 0
Views: 2130
Reputation: 29912
Because a floating point number has some precision "problems" about:
Upvotes: 0