1 Aug 2003 07:07
How can I restrict floating point precision?
wang yin <shredder <at> sohu.com>
2003-08-01 05:07:07 GMT
2003-08-01 05:07:07 GMT
Hi,
I'm doing some experiments on Section 3.5.4 of SICP.
I'm trying to get an approximation of e with the following
code:
(define (integral delayed-integrand initial-value dt)
(define int
(cons-stream initial-value
(let ((integrand (force
delayed-integrand)))
(add-streams (scale-stream integrand dt)
int))))
int)
(define (solve f y0 dt)
(define y (integral (delay dy) y0 dt))
(define dy (stream-map f y))
y)
(stream-ref (solve (lambda (y) y) 1 0.001) 1000)
But it seems that Scheme48 has a very high precision
floating point arithmetic. And this integration process is
extremely slow.
How can I tell Scheme48 to use lower precision arithmetic?
--
--
Wang Yin
(Continue reading)
RSS Feed