Fixed a bug with exact complexes.

original commit: 4803eafa6722acfdf0d37dab3782660d22665b84
This commit is contained in:
Vincent St-Amour 2010-07-25 22:01:50 -04:00
parent 6473855e45
commit c625d547ca
2 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,5 @@
#lang typed/scheme #:optimize
(require racket/unsafe/ops)
(+ 1.0+2.0i 2+4i)

View File

@ -254,11 +254,13 @@
#`((real-binding (exact->inexact #,((optimize) #'e)))))
(pattern e:expr
#:when (isoftype? #'e -Number) ; complex, maybe exact, maybe not
#:with e* (unboxed-gensym)
#:with real-binding (unboxed-gensym)
#:with imag-binding (unboxed-gensym)
#:with (bindings ...)
#`((real-binding (real-part #,((optimize) #'e)))
(imag-binding (imag-part #,((optimize) #'e)))))
#`((e* #,((optimize) #'e))
(real-binding (exact->inexact (real-part e*)))
(imag-binding (exact->inexact (imag-part e*)))))
(pattern e:expr
#:with (bindings ...)
(error "non exhaustive pattern match")