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

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.

*To*: srfi-77@xxxxxxxxxxxxxxxxx*Subject*: Testing the reference implementation*From*: Bradley Lucier <lucier@xxxxxxxxxxxxxxx>*Date*: Sat, 22 Oct 2005 22:59:07 -0500*Cc*: Bradley Lucier <lucier@xxxxxxxxxxxxxxx>*Delivered-to*: srfi-77@xxxxxxxxxxxxxxxxx

r6rs/will> (load "complex-test.scm") complex-test.scm Error: I'm bored. #{Inf} (&error) Might someone help me with modifying this code so it will work? Brad

;;; for your scheme, it may work there, too.

;;; had much luck getting it to run yet.

;;; are represented on your scheme system.

;;; I'd like to hear about it: lucier at math dot purdue dot edu (define plus-infinity (let loop ((x (r5rs->number 2.0))) (let ((two-x (* (r5rs->number 2.0) x))) (if (= x two-x) x (loop two-x))))) (define minus-infinity (- plus-infinity)) (define plus-zero (/ (r5rs->number 1.0) plus-infinity)) (define minus-zero (/ (r5rs->number 1.0) minus-infinity)) (define not-a-number (/ plus-zero plus-zero)) (define arguments (list (r5rs->number 0) (r5rs->number 1) (r5rs->number -1) plus-zero minus-zero (r5rs->number 1.) (r5rs->number -1.) plus-infinity minus-infinity not-a-number)) (define operations+names (list (list + '+) (list - '-) (list * '*) (list / '/))) (define error-object (list "ERROR")) (define (print-result name first-arg second-arg result) (define (print-arg arg) (define (print-number x) (cond ((exact? x) (if (>= x (r5rs->number 0)) (display "+")) (display x)) ((not (= x x)) (display "+NAN.")) ((zero? x) (if (> (/ (r5rs->number 1.0) x) (r5rs->number 0.)) (display "+0.") (display "-0."))) ((= (+ x x) x) (if (> x (r5rs->number 0.)) (display "+INF.") (display "-INF."))) (else (if (>= x (r5rs->number 0.)) (display "+")) (display x)))) (if (eq? arg error-object) (display "ERROR") (begin (print-number (real-part arg)) (print-number (imag-part arg)) (display "i")))) (display "(") (display name) (display " ") (print-arg first-arg) (display " ") (print-arg second-arg) (display ") => ") (print-arg result) (newline)) (with-output-to-file "results" (lambda () (for-each (lambda (arg1) (for-each (lambda (arg2) (for-each (lambda (arg3) (for-each (lambda (arg4) (for-each (lambda (operation+name) (let ((operation (car operation+name)) (name (cadr operation+name))

(let ((result (with-exception-handler (lambda (args) error-object) (lambda ()

operations+names)) arguments)) arguments)) arguments)) arguments)))

**Follow-Ups**:**Re: Testing the reference implementation***From:*Michael Sperber

- Prev by Date:
**Re: arithmetic issues** - Next by Date:
**Re: +nan.0 problems** - Previous by thread:
**Re: Exactness** - Next by thread:
**Re: Testing the reference implementation** - Index(es):