View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005292 | OXID eShop (all versions) | 1.01. Products (product, categories, manufacturer, promotions etc.) | public | 2013-07-15 10:34 | 2023-11-20 14:57 |
Reporter | vschmi | Assigned To | |||
Priority | high | Severity | crash | Reproducibility | sometimes |
Status | resolved | Resolution | duplicate | ||
Product Version | 4.7.6 / 5.0.6 | ||||
Summary | 0005292: OXID uses double for monetary values, leading to problems all over the shop | ||||
Description | Hi, as outlined in issue 0005291, OXID uses double. However, I didn't realize that OXID uses double values all over the place. This leads to rounding problems, especially with MySQL 5.5. DOUBLE is _APPROXIMATE VALUES_, which means that rounding errors will occur. This is expected and not a bug in MySQL, this is just how floating point values work. Read more about this: http://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html http://en.wikipedia.org/wiki/Floating_point In other words: Expressing monetary values like prices or other things like order amounts in double is _wrong_ and _will_ lead to problems. Please fix this ASAP! | ||||
Steps To Reproduce | On MySQL 5.5: CREATE TABLE IF NOT EXISTS `test` ( `test` double NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `test` (`test`) VALUES (0.4), (1), (0.2), (0.5), (1.65), (0.5), (0.4), (1), (0.45); SELECT SUM(test) FROM `test` WHERE 1 The SQL above gives 6.1000000000000005. | ||||
Tags | No tags attached. | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||