Fixed a bug with exact complexes.
This commit is contained in:
parent
7cdb5787e5
commit
4803eafa67
|
@ -0,0 +1,5 @@
|
|||
#lang typed/scheme #:optimize
|
||||
|
||||
(require racket/unsafe/ops)
|
||||
|
||||
(+ 1.0+2.0i 2+4i)
|
|
@ -0,0 +1,14 @@
|
|||
#lang racket
|
||||
|
||||
(require racket/unsafe/ops)
|
||||
|
||||
(let* ((unboxed-gensym-1 1.0+2.0i)
|
||||
(unboxed-gensym-2 (unsafe-flreal-part unboxed-gensym-1))
|
||||
(unboxed-gensym-3 (unsafe-flimag-part unboxed-gensym-1))
|
||||
(unboxed-gensym-4 2+4i)
|
||||
(unboxed-gensym-5 (exact->inexact (real-part unboxed-gensym-4)))
|
||||
(unboxed-gensym-6 (exact->inexact (imag-part unboxed-gensym-4)))
|
||||
(unboxed-gensym-7 (unsafe-fl+ unboxed-gensym-2 unboxed-gensym-5))
|
||||
(unboxed-gensym-8 (unsafe-fl+ unboxed-gensym-3 unboxed-gensym-6)))
|
||||
(unsafe-make-flrectangular unboxed-gensym-7 unboxed-gensym-8))
|
||||
(void)
|
|
@ -0,0 +1,5 @@
|
|||
#lang typed/scheme
|
||||
|
||||
(require racket/unsafe/ops)
|
||||
|
||||
(+ 1.0+2.0i 2+4i)
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user