File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
typed-racket-test/external Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 2525(define (safe-arithmetic-shift a b)
2626 (if (> b 100000 ) b (arithmetic-shift a b)))
2727
28+ ;; expt with large exact exponents can produce numbers with trillions of digits,
29+ ;; e.g. (expt 2 (expt -19 11)) tries to compute 2^(-116490258898219)
30+ (define (safe-expt a b)
31+ (if (> (abs b) 10000 ) b (expt a b)))
32+
2833(define-language tr-arith
2934 [n real]
3035 ;; randomly generate F, not E, because literal numbers self-evaluate
151156 (sinh E*)
152157 (cosh E*)
153158 (tanh E*)
154- (expt E* E*)]
159+ (safe- expt E* E*)]
155160 [INEQ < <= >= >]
156- [R n (+ R R) (- R R) (* R R) (expt R R)]
161+ [R n (+ R R) (- R R) (* R R) (safe- expt R R)]
157162 [C (let ([x R] [y R]) (if (INEQ x y) x #f ))
158163 (let ([x R] [y R]) (if (INEQ x y) #f x))
159164 (let ([x R] [y R]) (if (INEQ x y) y #f ))
You can’t perform that action at this time.
0 commit comments