diff --git a/collects/tests/typed-scheme/optimizer/close-calls/precision-loss.rkt b/collects/tests/typed-scheme/optimizer/close-calls/precision-loss.rkt index 33c9cc9212..28d0bfdc09 100644 --- a/collects/tests/typed-scheme/optimizer/close-calls/precision-loss.rkt +++ b/collects/tests/typed-scheme/optimizer/close-calls/precision-loss.rkt @@ -1,8 +1,11 @@ #; ( -precision-loss.rkt 13:3 (#%app * (quote 3/4) (quote 2/3)) -- exact arithmetic subexpression inside a float expression, extra precision discarded -- caused by: 13:0 (#%app + (#%app * (quote 3/4) (quote 2/3)) (quote 2.0)) +precision-loss.rkt 16:3 (#%app * (quote 3/4) (quote 2/3)) -- exact arithmetic subexpression inside a float expression, extra precision discarded -- caused by: 16:0 (#%app + (#%app * (quote 3/4) (quote 2/3)) (quote 2.0)) +precision-loss.rkt 20:3 (#%app - (quote 3/4)) -- exact arithmetic subexpression inside a float expression, extra precision discarded -- caused by: 20:0 (#%app + (#%app - (quote 3/4)) (quote 2.0)) 2.5 2.75 +1.25 +2.5 ) #lang typed/racket @@ -14,3 +17,7 @@ precision-loss.rkt 13:3 (#%app * (quote 3/4) (quote 2/3)) -- exact arithmetic su 2.0) ; extra precision lost (+ 3/4 2.0) ; here, since the exact subexpression is atomic, it will get ;; coerced anyway, so there's not much need for a warning +(+ (- 3/4) ; should work on unary exprs too + 2.0) +(+ (vector-ref '#(2/3 1/2 3/4) (assert (+ 1/4 3/4) exact-integer?)) ; and this is not an arith expr + 2.0) diff --git a/collects/typed-scheme/optimizer/float.rkt b/collects/typed-scheme/optimizer/float.rkt index b8c7a303ce..9e2bcee8fb 100644 --- a/collects/typed-scheme/optimizer/float.rkt +++ b/collects/typed-scheme/optimizer/float.rkt @@ -117,7 +117,7 @@ ;; be coerced anyway, or about things like: ;; (vector-ref vector-of-rationals x) ;; which don't perform arithmetic despite returning numbers. - [(#%plain-app (~var op (float-op binary-float-ops)) xs ...) + [e:arith-expr (log-close-call "exact arithmetic subexpression inside a float expression, extra precision discarded" subexpr this-syntax)]