[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing the reference implementation

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.

Bradley Lucier <lucier@xxxxxxxxxxxxxxx> 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)
   ((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