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.

True laziness is hard work

Comment onRe: Simple addition/subtraction not working