This really is a problem with using floating-point arithmetic. Programs which deal with prices should really use decimal arithmetic to get exact results. Or, equivalently, express prices as integers in the lowest possible units. For example, express prices in cents instead of dollars.
Here's a page which describes other reasons why and when decimal arithmetic is preferred: http://www2.hursley.ibm.com/decimal/decifaq.html