From deda2c0fd8689349fea2a900199a76ff7ecb319e Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:26 -0800 Subject: Import Upstream version 5d6 --- bench.scm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'bench.scm') diff --git a/bench.scm b/bench.scm index 12d7f4b..2d1cc07 100644 --- a/bench.scm +++ b/bench.scm @@ -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))) )))))) -- cgit v1.2.3