`epsilon.0`constantThe smallest flonum that can be added to 1.0 to yield a larger number, or the magnitude of the least significant bit in 1.0.

Examples:

> epsilon.0 2.220446049250313e-16 > (fpulp 1.0) 2.220446049250313e-16

Epsilon is often used in stopping conditions for iterative or additive approximation methods. For example, the following function uses it to stop Newtonâ€™s method to compute square roots. (Please do not assume this example is robust.)

(define (newton-sqrt x) (let loop ([y (* 0.5 x)]) (define dy (/ (- x (sqr y)) (* 2.0 y))) (if (<= (abs dy) (abs (* 0.5 epsilon.0 y))) (+ y dy) (loop (+ y dy)))))

When

`(<= (abs dy) (abs (* 0.5 epsilon.0 y)))`, adding dy to y rarely results in a different flonum. The value 0.5 can be changed to allow looser approximations. This is a good idea when the approximation does not have to be as close as possible (e.g. it is only a starting point for another approximation method), or when the computation of dy is known to be inaccurate.Approximation error is often understood in terms of relative error in epsilons. Number of epsilons relative error roughly corresponds with error in ulps, except when the approximation is subnormal.