Re: Testing the reference implementation
Bradley Lucier 20 Nov 2005 19:18 UTC
On Nov 20, 2005, at 9:04 AM, Michael Sperber wrote:
> This error is due to
>
> (/ (make-rectangular (r5rs->number 0) (r5rs->number 1)) (r5rs-
> >number 0))
>
> raising an exception. Your program converts the result into
> ("ERROR"), which your program then feeds to =. (In PRINT-NUMBER,
> expression (= x x).) The error message is admittedly obscure---it
> means that there's no way to convert the arguments of = into suitable
> numbers.
Mike:
Thanks for the fix to number->string.
Otherwise, something is really fishy here.
First, I ran the code in Gambit-C 4.0b15 after defining r5rs->number
to be values, and it ran to completion.
Then I looked more closely at the output from scheme-48. It begins with
r6rs/will> (load "complex-test.scm")
complex-test.scm
(+ +0+0i +0+0i) => +0+0i
(- +0+0i +0+0i) => +0+0i
(* +0+0i +0+0i) => +0+0i
(/ +0+0i +0+0i) => ERROR
So in this case it had no problem seeing that there was an error and
reporting it correctly. After a while we get
(/ +0+0i +NAN.+NAN.i) => +NAN.+NAN.i ;;; cycled
through all values for second argument
(+ +0+0i +0+0i) => +0+0i ;;; first
argument should be +0+1i from here down
(- +0+0i +0+0i) => +0+0i
(* +0+0i +0+0i) => +0+0i
(/ +0+0i +0+0i) =>
Error: contagion error
("ERROR")
("ERROR")
#{Procedure 9414 (=/2 in generic-arithmetic/will)}
(&error)
1 r6rs/will>
First of all, the first argument here is supposed to be +0+1i; why
it's printing as +0+0i I don't know.
Secondly, I don't know why the result of the expression does not
compare eq? to error-object; ("ERROR") shouldn't be passed to print-
number in any case. I get the same results when I test it with equal?.
Brad