in reply to Simple addition/subtraction not working
If you are dealing with a budget work in cents and the issue will go away. The problem is that most decimal fractions can't be represented as finite binary fractions and computers tend to have finite representations for numbers.
There are various other ways to deal with the problem depending on your application. But if you are dealing with money to the nearest cent then working in cents avoids the problem entirely because you are then working with integers which are exactly represented in binary or decimal.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simple addition/subtraction not working
by JavaFan (Canon) on Dec 02, 2011 at 00:33 UTC | |
by BrowserUk (Patriarch) on Dec 02, 2011 at 00:55 UTC | |
by JavaFan (Canon) on Dec 02, 2011 at 09:59 UTC | |
by CountZero (Bishop) on Dec 02, 2011 at 13:22 UTC |