Antoine Dubourg - 2015-09-09 07:17:05
For storing prices, it is not advised to use float because of the possible rounding errors.
For example, storing a price like 3.5 can be stored in a float like 3.4999999.
This will be rounded to 3.5 without any problem with number formating functions.
Still, if you multiply this amount by a large value say 10000, you'll end with a total price of 34999.99 which is off by one cent...
Not a big deal but that's not what's is expected at all. Missing cents can be hard to explain to management as well...
Store prices as INTEGER in cents.