Fixed an infinite loop.

This commit is contained in:
Vincent St-Amour 2010-07-14 17:07:18 -04:00
parent c587038b33
commit f21454e711
4 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,5 @@
#lang typed/scheme #:optimize
(require racket/unsafe/ops)
((lambda: ((t : Integer))
(+ (sin (* t 6.28)) 0.0+0.0i))
1)

View File

@ -0,0 +1,11 @@
#lang typed/scheme #:optimize
(require racket/unsafe/ops)
((lambda: ((t : Integer))
(let* ((unboxed-gensym-1 (exact->inexact (sin (* t 6.28))))
(unboxed-gensym-2 0.0+0.0i)
(unboxed-gensym-3 (unsafe-flreal-part unboxed-gensym-2))
(unboxed-gensym-4 (unsafe-flimag-part unboxed-gensym-2))
(unboxed-gensym-5 (unsafe-fl+ unboxed-gensym-1 unboxed-gensym-3))
(unboxed-gensym-6 unboxed-gensym-4))
(unsafe-make-flrectangular unboxed-gensym-5 unboxed-gensym-6)))
1)

View File

@ -0,0 +1,5 @@
#lang typed/scheme
(require racket/unsafe/ops)
((lambda: ((t : Integer))
(+ (sin (* t 6.28)) 0.0+0.0i))
1)

View File

@ -206,7 +206,18 @@
#:with real-part (unboxed-gensym)
#:with imag-part #f
#:with (bindings ...)
#`((real-part (->fl #,((optimize) #'e))))))
#`((real-part (->fl #,((optimize) #'e)))))
(pattern e:expr
#:when (isoftype? #'e -Real)
#:with real-part (unboxed-gensym)
#:with imag-part #f
#:with (bindings ...)
#`((real-part (exact->inexact #,((optimize) #'e)))))
(pattern e:expr
#:with (bindings ...)
(error "non exhaustive pattern match")
#:with real-part #f
#:with imag-part #f))
(define-syntax-class inexact-complex-unary-op
(pattern (~or (~literal real-part) (~literal flreal-part)) #:with unsafe #'unsafe-flreal-part)