It doesn't fail -- you've just run into the limits of precision that are inherent in any representation of floating point arithmetic on a computer. For comparison, I just tried the same subtraction in an interactive Python shell:
>>> a = 1671.37
>>> b = 871.37
>>> a - b
799.9999999999999
The solution is to either accept the limits of floating point math, and round off your answers to a desired precision; or, switch to a different kind of numerical representation. For instance, since these values use two decimal places (dollars and cents?), you could multiply them by 100, and use integers (dividing by 100 only for display purposes, if and when necessary). Then there's binary-coded decimal, and arbitrary precision... I don't know offhand how you'd do those in Delphi, but they're probably overkill, depending on your application.