@olleharstedt opened this Issue on February 21st 2018

In table log_conversion, revenue has type FLOAT. It should be DECIMAL(11, 2) or similar.

@fdellwing commented on February 21st 2018 Contributor

Why not?

Links to any studies? Performance tests? Other known problems?

@olleharstedt commented on February 21st 2018

Precision. 0.1 + 0.2 != 0.3 in float.

@olleharstedt commented on February 21st 2018

And today I tried to get all conversions with revenue = 0.29, which was not possible in SQL using = 0.29.

@olleharstedt commented on February 21st 2018

Here's a stackoverflow thread about it: https://stackoverflow.com/questions/13030368/best-data-type-to-store-money-values-in-mysql

Since money needs an exact representation don't use data types that are only approximate like float.

@robocoder commented on March 2nd 2018 Contributor

Looks like 4 decimals places (to accommodate Chile) would suffice. https://en.wikipedia.org/wiki/ISO_4217

Powered by GitHub Issue Mirror