[plt-scheme] Numerical precision

From: Henk Boom (henk at henk.ca)
Date: Wed Mar 11 16:35:27 EDT 2009

2009/3/11 Jaime Vargas <jev at mac.com>:
> Agreed. I would like to have this computations to happen only once. But
> reactive to changes in the numerical-precision parameter.

; not tested, just for demonstration

(define numerical-precision (make-parameter 2))
(define N (make-parameter (expt 10 (numerical-precision))))
(define 1/N (make-parameter (/ 1 (N))))

(define (call-with-precision p thunk)
  (parameterize* ([numerical-precision p]
                  [N (expt 10 (numerical-precision))]
                  [1/N (/ 1 (N))])
    (thunk)))

    Henk


Posted on the users mailing list.