Change float optimizations to not warn on projections.

original commit: b89a56e0ec4e561ae70b823be3140b860be3d34c
This commit is contained in:
Eric Dobson 2014-02-22 14:55:24 -08:00
parent 8b6c27cf1d
commit 758a055b0b
4 changed files with 11 additions and 7 deletions

View File

@ -23,11 +23,17 @@
;; unlike binary-float-ops
#'make-rectangular #'unsafe-make-flrectangular
#'make-flrectangular #'unsafe-make-flrectangular))
(define unary-float-ops
(dict-set*
(define unary-float-math-ops
(dict-set
(mk-float-tbl (list #'abs #'sin #'cos #'tan #'asin #'acos #'atan #'log #'exp
#'sqrt #'round #'floor #'ceiling #'truncate))
#'magnitude #'unsafe-flabs
#'magnitude #'unsafe-flabs))
(define unary-float-ops
(dict-set*
unary-float-math-ops
#'real-part #'#%expression
#'flreal-part #'#%expression
#'unsafe-flreal-part #'#%experession))
@ -57,6 +63,7 @@
(define-syntax-class/specialize int-expr (subtyped-expr -Integer))
(define-syntax-class/specialize real-expr (subtyped-expr -Real))
(define-syntax-class/specialize unary-float-op (float-op unary-float-ops))
(define-syntax-class/specialize unary-float-math-op (float-op unary-float-math-ops))
(define-syntax-class/specialize binary-float-op (float-op binary-float-ops))
(define-syntax-class/specialize binary-float-comp (float-op binary-float-comps))
@ -284,7 +291,7 @@
#:when (andmap maybe-exact-rational? (syntax->list #'(n ...)))
#:do [(log-opt-info "possible exact real arith")]
#:with opt #'(op n.opt ...))
(pattern (#%plain-app op:unary-float-op n:opt-expr ...)
(pattern (#%plain-app op:unary-float-math-op n:opt-expr ...)
#:when (maybe-exact-rational? this-syntax)
#:do [(log-opt-info "possible exact real arith")]
#:with opt #'(op n.opt ...))

View File

@ -1,6 +1,5 @@
#;#;
#<<END
TR info: expt.rkt 6:2 (real-part (expt (sin 0.25) 1.0)) -- possible exact real arith
TR missed opt: expt.rkt 6:13 (expt (sin 0.25) 1.0) -- unexpected complex type
TR opt: expt.rkt 6:19 (sin 0.25) -- unary float
END

View File

@ -1,6 +1,5 @@
#;#;
#<<END
TR info: invalid-inexact-complex-parts.rkt 1:0 (real-part 1+2i) -- possible exact real arith
END
#<<END
1

View File

@ -1,6 +1,5 @@
#;#;
#<<END
TR info: invalid-log-complex.rkt 2:0 (real-part (log (ann 2.0 Float))) -- possible exact real arith
TR missed opt: invalid-log-complex.rkt 2:11 (log (ann 2.0 Float)) -- unexpected complex type
END
#<<END