[plt-scheme] Numerical precision
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