Machine Epsilon describes the round-off error for a floating-point number with a certain amount of precision. It is the upper bound on the relative approximated error caused due to rounding off floating numbers. It is also defined as the gap between the number 1 and the next largest floating point number.
Note: Machine epsilon is also called macheps and represented by
.
The reason why machine epsilon is important is that no matter how carefully we do operations like addition, subtraction, multiplication, or division with floating point numbers, we end up making an error when we round off our answer. That is what machine epsilon measures.
A code example of how we can find
import numpy as npepss = np.finfo(np.float32).epsprint("Machine epeilon for single precision : ",epss)epsd = np.finfo(np.float64).epsprint("Machine epeilon for double precision : ",epsd)
In the above code, we calculate the
Free Resources