Use `assert' for casts in typed benchmarks.

This commit is contained in:
Sam Tobin-Hochstadt 2010-06-08 12:00:37 -04:00
parent 0f4db44be3
commit 9fc7a1eca4
2 changed files with 11 additions and 10 deletions

View File

@ -1,3 +1,4 @@
#lang typed/racket
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; File: fft.cl
; Description: FFT benchmark from the Gabriel tests.
@ -47,9 +48,9 @@
(set! ar areal)
(set! ai aimag)
(set! n (vector-length ar))
(set! n (abs (- n 1))) ; abs is to appease the typechecker
(set! n (assert (- n 1) exact-nonnegative-integer?))
(set! nv2 (quotient n 2))
(set! nm1 (abs (- n 1))) ; abs is to appease the typechecker
(set! nm1 (assert (- n 1) exact-nonnegative-integer?))
(set! m 0) ;compute m = log(n)
(set! i 1)
(let loop ()
@ -74,7 +75,7 @@
(set! k nv2)
(let l6 ()
(cond ((< k j)
(set! j (abs (- j k))) ; abs is to appease the typechecker
(set! j (assert (- j k) exact-nonnegative-integer?)) ; abs is to appease the typechecker
(set! k (quotient k 2))
(l6))))
(set! j (+ j k))

View File

@ -155,9 +155,9 @@
(if (< nc2 nc1)
(loop1 lst
(- nc1 1))
(loop2 (cons (vector (abs nc1)
(abs nc2)
(abs (- m (+ nc1 nc2)))) ; abs is to appease the typechecker
(loop2 (cons (vector nc1
nc2
(assert (- m (+ nc1 nc2)) exact-nonnegative-integer?))
lst)
(- nc2 1)))))))
@ -178,10 +178,10 @@
(nc3 (quotient (- m (+ nc1 nc2)) 2)))
(if (< nc3 start)
(loop2 lst (- nc2 1))
(loop3 (cons (vector (abs nc1)
(abs nc2)
(abs nc3)
(abs (- m (+ nc1 (+ nc2 nc3))))) ; abs is to appease the typechecker
(loop3 (cons (vector nc1
nc2
nc3
(assert (- m (+ nc1 (+ nc2 nc3))) exact-nonnegative-integer?))
lst)
(- nc3 1))))))))))