Nick de Voil wrote: >> I have recently found a bizarre situation where numbers are not > calculating correctly when the values are stored in FLOAT data types. > > This is not just a database-related issue - it's found in computer > systems in general. > > Floating point numbers are by definition approximations. This often > surprises people. As you suggested, the DECIMAL type is provided by > many DBMS to get around exactly this problem. DECIMAL numbers are not > approximations. They take up much more space to represent very large > or very small numbers and aren't directly supported in hardware, so > they are less efficient.
In addition, MySQL DECIMAL is broken in everything before version 5. When you get more then a few (8?) decimals it will switch to floats for calculations. Jochem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240790 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54