diff --git a/typed-racket-lib/typed-racket/optimizer/float-complex.rkt b/typed-racket-lib/typed-racket/optimizer/float-complex.rkt index cec315c6..0f4093b9 100644 --- a/typed-racket-lib/typed-racket/optimizer/float-complex.rkt +++ b/typed-racket-lib/typed-racket/optimizer/float-complex.rkt @@ -75,13 +75,16 @@ (define c1 (stx-car cs)) (define o-nf (as-non-float o)) (define c1-nf (as-non-float c1)) - (if (and o-nf c1-nf) + (if (or o-nf c1-nf) ;; can't convert those to floats just yet, or may change ;; the result - (let ([new-o (quasisyntax/loc this-syntax - (#,op #,o-nf #,c1-nf))]) - (loop (mark-as-non-float new-o) - (stx-cdr cs))) + (let ([new-o (mark-as-non-float + (quasisyntax/loc this-syntax + (#,op #,(or o-nf o) #,(or c1-nf c1))))]) + (if (stx-null? (stx-cdr cs)) + new-o + (loop new-o + (stx-cdr cs)))) ;; we've hit floats, can start coercing (n-ary->binary this-syntax unsafe (cons #`(real->double-flonum #,(or o-nf o)) cs))))) diff --git a/typed-racket-test/optimizer/known-bugs.rkt b/typed-racket-test/optimizer/known-bugs.rkt index 5919c734..c04bdbf8 100644 --- a/typed-racket-test/optimizer/known-bugs.rkt +++ b/typed-racket-test/optimizer/known-bugs.rkt @@ -12,6 +12,9 @@ (provide tests) +;; Test suite that makes sure that TR+opt returns the same results as Racket. +;; Historically contained bugs that we knew about, but had not fixed. +;; Now those are all fixed. (define (mk-eval lang) (call-with-trusted-sandbox-configuration @@ -89,7 +92,7 @@ ;; Negation should correctly compute sign of 0.0 (good-opt (- 0.0+0.0i)) - (bad-opt (- 0+0i 0.0+0.0i)) + (good-opt (- 0+0i 0.0+0.0i)) ;; Conjugate should correctly compute sign of 0.0 (good-opt (conjugate 0.0+0.0i))))