Fix optimization on exp of complex numbers.

Found using random testing.

original commit: b808d2809e4856614248b2308d4a21bbca4400f7
This commit is contained in:
Vincent St-Amour 2013-04-02 13:56:16 -04:00
parent e0394683a2
commit a0821131dc
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,12 @@
#;
(
TR opt: complex-exp.rkt 12:8 0 -- float-arg-expr in complex ops
TR opt: complex-exp.rkt 12:3 (exp 0) -- unboxed unary float complex
TR opt: complex-exp.rkt 12:11 1.0+2.0i -- unboxed literal
TR opt: complex-exp.rkt 12:0 (- (exp 0) 1.0+2.0i) -- unboxed binary float complex
0.0-2.0i
)
#lang typed/racket
(- (exp 0) 1.0+2.0i)

View File

@ -305,7 +305,7 @@
#'1.0))
((real-binding) #,(if (syntax->datum #'c.imag-binding)
#'(unsafe-fl* (unsafe-flcos c.imag-binding) scaling-factor)
#'0.0))
#'1.0))
((imag-binding) #,(if (syntax->datum #'c.imag-binding)
#'(unsafe-fl* (unsafe-flsin c.imag-binding) scaling-factor)
#'0.0)))))