Re: Testing the reference implementation Michael Sperber 26 Oct 2005 05:47 UTC

Bradley Lucier <xxxxxx@math.purdue.edu> writes:

> I've looked in the Scheme 48 docs and the web page for SRFI-34 and
> tried to get the following program to work.  Unfortunately, in the
> "will" implementation it gives me only the following:
>
> r6rs/will> (load "complex-test.scm")
> complex-test.scm
>
> Error: I'm bored.
>        #{Inf}
>        (&error)

That's a bug with the conversion between exact and inexact numbers
that I found and fixed (along with numerous other errors in the
implementation of R5RS arithmetic in Scheme 48 and Larceny) while
writing the reference implementation.

You can work around it by replacing the definition of /* in
flonum.scm by:

(define (/* a b)
  (cond
   ((not (= b 0.0)) (/ a b))
   ((= a 0.0) r5rs-nan)
   ((positive? a) r5rs-inf+)
   (else r5rs-inf-)))

[Understanding why (= a 0.0) may be intensionally different from
(zero? a) in the naive implementation of ZERO? yields interesting
insights into the workings of R5RS generic arithmetic, BTW.]

(Of course, this will be in the next revision in the SRFI, and the
next version of Scheme 48 will also have fixed the problem.)

--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla