Fixes to the shootout benchmarks to reflect the new weaker promotion

rules.
This commit is contained in:
Vincent St-Amour 2010-06-14 11:28:58 -04:00
parent ff1c3874cc
commit 06eb544fd6
3 changed files with 15 additions and 15 deletions

View File

@ -17,7 +17,7 @@
(: gen_random (Float -> Float))
(define (gen_random max)
(set! LAST (modulo (+ (* LAST IA) IC) IM))
(/ (* max (exact->inexact LAST)) IM))
(/ (* max (exact->inexact LAST)) (exact->inexact IM)))
(: heapsort (Natural (Vectorof Float) -> (U Void True)))
(define (heapsort n ra)

View File

@ -19,7 +19,7 @@
(loop (read-line) (cons num numlist))))))))
(unless (null? numlist)
(let ((n (length numlist)))
(let: ((mean : Float (/ sum n))
(let: ((mean : Float (/ sum (exact->inexact n)))
(average_deviation : Float 0.0)
(standard_deviation : Float 0.0)
(variance : Float 0.0)
@ -43,7 +43,7 @@
(set! standard_deviation (flsqrt variance))
(cond ((> variance 0.0)
(set! skew (/ skew (* n variance standard_deviation)))
(set! skew (exact->inexact (/ skew (* n variance standard_deviation))))
(set! kurtosis (- (/ kurtosis (* n variance variance))
3.0))))
@ -58,8 +58,8 @@
(set! median (car (list-tail numlist mid)))))
(set! standard_deviation (/ (round (* standard_deviation 1000000))
1000000))
(set! standard_deviation (exact->inexact (/ (round (* standard_deviation 1000000))
1000000)))
(for-each display
`("n: " ,n "\n"

View File

@ -14,9 +14,9 @@
(let ((n (exact->inexact (assert (string->number (command-line #:args (n) (assert n string?)))))))
(let: loop : Void
([d : Float 0.0]
(alt : Float 1.0) (d2 : Float 0.0) (d3 : Float 0.0)
(ds : Float 0.0) (dc : Float 0.0)
([d : Integer 0]
(alt : Float 1.0) (d2 : Integer 0) (d3 : Integer 0)
(ds : Real 0.0) (dc : Real 0.0)
(s0 : Float 0.0) (s1 : Float 0.0) (s2 : Float 0.0)
(s3 : Float 0.0) (s4 : Float 0.0) (s5 : Float 0.0)
(s6 : Float 0.0) (s7 : Float 0.0) (s8 : Float 0.0))
@ -35,14 +35,14 @@
(format-result "~a\tAlternating Harmonic\n" s7)
(format-result "~a\tGregory\n" s8))
(let*: ((d : Float (+ d 1))
(d2 : Float (* d d))
(d3 : Float (* d2 d))
(ds : Float (sin d))
(dc : Float (cos d))
(let*: ((d : Integer (+ d 1))
(d2 : Integer (* d d))
(d3 : Integer (* d2 d))
(ds : Real (sin d))
(dc : Real (cos d))
(s0 : Float (+ s0 (assert (expt (/ 2.0 3) (- d 1)) real?)))
(s1 : Float (+ s1 (/ 1 (flsqrt d))))
(s0 : Float (+ s0 (exact->inexact (expt (/ 2.0 3.0) (- d 1)))))
(s1 : Float (+ s1 (/ 1 (flsqrt (exact->inexact d)))))
(s2 : Float (+ s2 (/ 1 (* d (+ d 1)))))
(s3 : Float (+ s3 (/ 1 (* d3 (* ds ds)))))
(s4 : Float (+ s4 (/ 1 (* d3 (* dc dc)))))