SQLite Forum

Decimal128
Login
Actually the value of Epsilon (the machine precision) is a constant.  It is stunningly simple to decide within "how many epsilons" two number are of each other, you simply subtract them from each other and compute how many "scaled epsilon" they are apart.  

Easy peasy lemon squeezy.  

Then you decide what your tolerance for error is in "scaled epsilon".  If the number is less than this threshhold, then the two original number are equal.  If the threshhold is exceeded, then they are not equal.

This is easy to do because, low and behold, IEEE floating point arithmetic makes certain guarantees as to the accuracy of the numbers is uses and the accuracy of its calculations.