How to Calculate Epsilon

Epsilon, or machine epsilon, is an important number in computing. Machine epsilon gives the distance between 1 and the next largest floating point number on your computer. This is important to calculate, as the size of the floating point number may lead to round-off errors for certain calculations. Calculating machine epsilon can be done a number of ways, and many programming languages have built-in functions that can determine this value. However, it also can be determined algorithmically with a fairly simple routine.

...
Machine epsilon provides information about the computations that computers can make.

Step

Choose a programming language to program the algorithm in. Make sure you understand the language's syntax well enough to make a simple program within the language.

Step

Initialize a variable to be equal to 1. In pseudocode, this will look like

Step

x -> 1.

Step

Divide the initialized value by 2, and add that to 1. In pseudocode, this looks like

Step

y -> x/2 + 1.

Step

Add a conditional statement, such that if y is less than 2, set

Step

x -> x/2,

Step

and repeat the step

Step

y -> x/2 + 1.

Step

Once the condition that y is greater than 2 is met, the resulting number is machine epsilon.