Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- floating or decimal for currency values
April 25, 2005, 5:51 pm
rate this thread
Isnt it true that floating type can generate rounding errors if the
values are rounded to like the 10th decimal. Since currency is rounded
only to the 2nd decimal why must i worry about using float for currency
decimal is slow and memory hog.
is it true that mysql calculates internally using double float?
Re: floating or decimal for currency values
Floating point calculations *always* generate rounding errors. It's a
limitation we live with in order to gain the efficiency and large dynamic
range that floating point calculations offer.
Because chains of calculation and complex arithmetic (interest
calculations!) that we often use erodes that safety margin rather quickly.
AND many accounting apps. need that last penny accuracy. Even though
working with millions of $ makes pennies seem insignificant - having things
work out to that last penny lends needed confidence to calculations. If you
are skimming the pennies into your personal account - use Float :-) If you
are looking for accounting accuracy, use Decimal.
Well - slower than float - perhaps!
I don't know!
- » know how mangement database , script database tool
- — Next thread in » MySQL Database Forum
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum