(PeteCresswell) said:
Per Dirk Goldgar:
That's kind of what I was thinking.
If that's true, then I'd guess that most applications that do
comparisons should have some sort of Round() function coded and only
compare the results of that function.
It depends what you're comparing, of course, but when comparing
floating-point numbers, you do have to allow for the imprecision. What
people usually do is subtract one value from the other and see if the
absolute value of the difference is greater than some value "epsilon".
If so, the values are considered equal; if not, they're the same for
all practical purposes. It's up to you to pick a suitable epsilon.
If you're dealing with numbers that represent currency, it's best to use
the Currency data type, rather than any floating-point type, and perform
rounding when you multiply or divide so as to ensure proper results. Be
aware that the built-in Round function uses "banker's rounding" to
minimize rounding bias. That may not always give you the result you
expect, if you're used to always rounding a terminal digit of 5 upward.