1 |
"Vladimir G. Ivanovic" <vgivanovic@×××××××.net> skribis: |
2 |
> http://en.wikipedia.org/wiki/Floating_point#Accuracy.2C_and_misconceptions_thereof |
3 |
> "...financial software tends not to use a binary floating-point number |
4 |
> representation. The "decimal" data type of the C# and Java programming |
5 |
> languages, and the IEEE 854 standard, are designed to avoid the problems |
6 |
> of binary floating point, and make the arithmetic always behave as |
7 |
> expected when numbers are printed in decimal." |
8 |
|
9 |
What you really want for financial applications is fixed point |
10 |
decimal, because you can’t throw away any digits except when |
11 |
dividing. For hand calculators you want binary floating point with |
12 |
guard digits. |
13 |
|
14 |
Enough research has gone into writing code for IEEE floating point |
15 |
that I would not try to bypass it without a good reason. It’s there to |
16 |
be your friend. |
17 |
|
18 |
-- |
19 |
Barry.SCHWARTZ at chemoelectric.org http://chemoelectric.org |
20 |
Free stuff / Senpagaj varoj: http://crudfactory.com (PDF) |
21 |
'Democracies don't war; democracies are peaceful countries.' - Bush |
22 |
(http://www.whitehouse.gov/news/releases/2005/12/20051219-2.html) |