diff options
Diffstat (limited to 'bench.scm')
-rw-r--r-- | bench.scm | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -1,4 +1,4 @@ -;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. +;; Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc. ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ ;;;; "bench.scm", Scheme benchmark computing digits of pi. ;;; Author: Aubrey Jaffer. -(require (in-vicinity (implementation-vicinity) "pi.scm")) +(load (in-vicinity (implementation-vicinity) "pi.scm")) (require 'transcript) (define isqrt (cond ((provided? 'inexact) sqrt) @@ -51,16 +51,17 @@ (else quotient))) (define around (cond ((provided? 'inexact) - (lambda (x) - (cond ((>= 3000 (abs x) 3) (inexact->exact (round x))) + (lambda (x bnd) + (cond ((>= 99999 (abs x) bnd) (inexact->exact (round x))) + ((> (abs x) 99999) (round x)) (else x)))) - (else identity))) + (else (lambda (x bnd) x)))) (define (time-pi digits) (let ((start-time (get-internal-run-time))) (pi digits 4) (i/ (* 1000 (- (get-internal-run-time) start-time)) - internal-time-units-per-second))) + internal-time-units-per-second))) (define (benchmark . arg) (define file @@ -75,22 +76,21 @@ (let* ((avg (i/ (apply + tl) (length tl))) (dev (isqrt (i/ (apply + (map (lambda (x) (* (- x avg) (- x avg))) - tl)) + tl)) (length tl))))) (and file (transcript-on file)) (for-each display - (list digits " digits took " (around avg) " mSec +/- " - (around dev) " mSec.")) + (list digits " digits took " (around avg 99) + " +/- " (around dev 3) ".ms")) (newline) - (let ((scaled-avg (i/ (* (i/ (* avg 1000) digits) 1000) digits))) + (let ((scaled-avg (i/ (* (i/ (* avg 1000) digits) 1000) digits)) + (scaled-dev (i/ (* (i/ (* dev 1000) digits) 1000) digits))) (for-each display - (list " That is about " scaled-avg - " mSec/k-digit^2 +/- " - (around - (i/ (* 100 (i/ (* (i/ (* dev 1000) digits) - 1000) digits)) - scaled-avg)) - "%.")) + (list " That is about " + (around scaled-avg 99) + " +/- " + (around scaled-dev 3) + ".ms/(kB)^2")) (newline) (and file (transcript-off))) )))))) |