Machine Epsilon - How To Determine Machine Epsilon - Approximation Using Prolog

Approximation Using Prolog

An approximation using arithmetic and recursive predicates in Prolog is:

epsilon(X):- Y is (1.0 + X), Y = 1.0, write(X). epsilon(X):- Y is X/2, epsilon(Y).

An example execution in the SWI-Prolog interpreter:

1 ?- epsilon(1.0). 1.1102230246251565e-16 true .

Read more about this topic:  Machine Epsilon, How To Determine Machine Epsilon