Fixed unsafe optimization that considered floats as complexes.

original commit: 60bfce14bc0166742fed7675b81d8c5c0dcec2d4
This commit is contained in:
Vincent St-Amour 2010-07-16 15:23:48 -04:00
parent 134fb72de1
commit 40d4840ae1
2 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,14 @@
#lang typed/scheme #:optimize
(require racket/unsafe/ops)
;; from the nbody-generic benchmark.
;; the result of sqrt was an Inexact-Complex, so inexact complex opts kicked
;; in but they resulted in segfaulting code.
;; the problem was that having Float be a subtype of Inexact-Complex was wrong
;; since you can't do unsafe-flreal-part of a float
(let* ([dx (- 0.0 0.0)]
[dist2 (* dx dx)]
[mag (assert (* dist2 (sqrt dist2)) inexact-real?)])
(void))

View File

@ -237,7 +237,6 @@
[((Base: 'Integer _) (Base: 'Number _)) A0]
[((Base: 'Flonum _) (== -Real =t)) A0]
[((Base: 'Integer _) (== -Real =t)) A0]
[((Base: 'Flonum _) (Base: 'InexactComplex _)) A0]
[((Base: 'Flonum _) (Base: 'Number _)) A0]
[((Base: 'Exact-Rational _) (Base: 'Number _)) A0]
[((Base: 'Integer _) (Base: 'Exact-Rational _)) A0]