You may even have problems testing for equality on rounded numbers due to the nature of floating point, though it depends how your rounding function works I suppose. For instance you might find 1.345 rounds to 1.35 at two decimal places but a very slightly smaller value will round to 1.34. How about
If Abs(x1#-x2#)<Epsilon# Then...
as a quick test to see if two values are within a defined epsilon of each other. You can experiment with values for epsilon, but you can set it quite small and still erradicate the sort of precision errors you might get.
If Abs(x1#-x2#)<Epsilon# Then...
as a quick test to see if two values are within a defined epsilon of each other. You can experiment with values for epsilon, but you can set it quite small and still erradicate the sort of precision errors you might get.