From a0ef6b1d8ce9190e196cfd63d5cbf324069c091e Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Thu, 5 Nov 2015 14:23:56 -0600 Subject: [PATCH] Fix type of expt. Found using random testing. Found 10 times. --- .../typed-racket/base-env/base-env-numeric.rkt | 10 +++++++--- typed-racket-test/unit-tests/typecheck-tests.rkt | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt b/typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt index b0ce0485..1ff8157a 100644 --- a/typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt +++ b/typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt @@ -1613,12 +1613,16 @@ (-Flonum (Un -NegInt -PosInt) . -> . -Flonum) (-Flonum -Int . -> . (Un -Flonum -One)) (-Flonum -Flonum . -> . (Un -Flonum -FloatComplex)) - (-NonNegSingleFlonum (Un -NonNegSingleFlonum -NegRat -PosRat) . -> . -NonNegSingleFlonum) + ;; 1st arg can't be non-neg, -0.0 gives the wrong sign + (-PosSingleFlonum (Un -NonNegSingleFlonum -NegRat -PosRat) . -> . -NonNegSingleFlonum) + (-NonNegSingleFlonum (Un -NonNegSingleFlonum -NegRat -PosRat) . -> . -SingleFlonum) (-SingleFlonum (Un -NegInt -PosInt) . -> . -SingleFlonum) (-SingleFlonum -Int . -> . (Un -SingleFlonum -One)) (-SingleFlonum -SingleFlonum . -> . (Un -SingleFlonum -SingleFlonumComplex)) - (-NonNegInexactReal (Un -NegReal -PosReal) . -> . -NonNegInexactReal) - (-NonNegReal -Real . -> . -NonNegReal) + (-PosInexactReal (Un -NegReal -PosReal) . -> . -NonNegInexactReal) + (-NonNegInexactReal (Un -NegReal -PosReal) . -> . -InexactReal) + (-PosReal -Real . -> . -NonNegReal) + (-NonNegReal -Real . -> . -Real) (-InexactReal (Un -NegInt -PosInt) . -> . -InexactReal) (-InexactReal -InexactReal . -> . (Un -InexactReal -InexactComplex)) (-Real -Int . -> . -Real) diff --git a/typed-racket-test/unit-tests/typecheck-tests.rkt b/typed-racket-test/unit-tests/typecheck-tests.rkt index fc9f7fa3..c9e75fbc 100644 --- a/typed-racket-test/unit-tests/typecheck-tests.rkt +++ b/typed-racket-test/unit-tests/typecheck-tests.rkt @@ -456,6 +456,7 @@ (tc-e (/ (round (exact-round -2.7393196f0)) (real->double-flonum (inexact->exact (real->single-flonum -0.0)))) -Real) (tc-e (bitwise-and (exact-round 1.7976931348623157e+308) (exact-round -29)) -Int) (tc-e (flexpt -0.0 -1.0) -Flonum) + (tc-e (expt -0.0f0 -3.0) -InexactReal) (tc-e (exact->inexact 3) -PosFlonum) (tc-e (exact->inexact -3) -NegFlonum) (tc-e (real->double-flonum 0.0) -FlonumPosZero)