While translating some Fortran to Scheme/Racket I have come across the function:
; EPSILON(X) The least positive number that added
; to 1 returns a number that is greater than 1
How do I find the number in Scheme?
#lang racket/base
;; http://en.wikipedia.org/wiki/Machine_epsilon
;; approximates the machine epsilon
(require racket/flonum)
(define (compute-machine-epsilon)
(let loop ([n 1.0])
(define next-n (fl/ n 2.0))
(if (fl= 1.0 (fl+ 1.0 next-n))
n
(loop next-n))))