When comparing floating point numbers, you have to allow for some imprecision. It’s better to use an Epsilon to widen the range of acceptable values by a small amount so as to reduce rounding errors.
For example, you might think you have the value 1, but in reality you`re getting 1.000000119209290.
I always wondered, what is the use of a epsilon?
When comparing floating point numbers, you have to allow for some imprecision. It’s better to use an Epsilon to widen the range of acceptable values by a small amount so as to reduce rounding errors.
For example, you might think you have the value 1, but in reality you`re getting 1.000000119209290.