From 788b0465497087f0da49c9b27d8266fa3e2b83d1 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 13 Oct 2012 22:23:33 -0700 Subject: [PATCH] Make expt type more correct. Closes PR13170. --- collects/tests/typed-racket/unit-tests/typecheck-tests.rkt | 3 ++- collects/typed-racket/base-env/base-env-numeric.rkt | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt index cb5650ef26..e24e55b588 100644 --- a/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/collects/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -203,7 +203,8 @@ (tc-e (lcm (ann 3 Integer) -1/2) -NonNegRat) (tc-e (expt 0.5 0.3) -PosFlonum) (tc-e (expt 0.5 2) -PosFlonum) - (tc-e (expt 0.5 0) -PosFlonum) + (tc-e (expt 0.5 0) -One) + (tc-e (expt -1/2 -1/2) N) (tc-e (flexpt 0.5 0.3) -NonNegFlonum) (tc-e (flexpt 0.00000000001 100000000000.0) -NonNegFlonum) (tc-e (flexpt -2.0 -0.5) -Flonum) ; NaN diff --git a/collects/typed-racket/base-env/base-env-numeric.rkt b/collects/typed-racket/base-env/base-env-numeric.rkt index 58aad2d2f9..a9714c8081 100644 --- a/collects/typed-racket/base-env/base-env-numeric.rkt +++ b/collects/typed-racket/base-env/base-env-numeric.rkt @@ -1624,7 +1624,7 @@ (map binop (list -NonNegReal -NonPosReal -Real)))] [expt (from-cases (-> -One -Rat -One) - (map (lambda (t) (-> t -Zero t)) all-int-types) ; will error if negative + (map (lambda (t) (-> t -Zero -One)) all-number-types) ; will error if negative (-PosInt -Nat . -> . -PosInt) (-Nat -Nat . -> . -Nat) (-Int -Nat . -> . -Int) @@ -1648,7 +1648,6 @@ (-InexactReal (Un -NegInt -PosInt) . -> . -InexactReal) (-Real (Un -NegInt -PosInt) . -> . -Real) (-InexactReal -InexactReal . -> . (Un -InexactReal -InexactComplex)) - (-ExactNumber -ExactNumber . -> . -ExactNumber) (-FloatComplex (Un -InexactComplex -InexactReal) . -> . -FloatComplex) (-SingleFlonumComplex (Un -SingleFlonum -SingleFlonumComplex) . -> . -SingleFlonumComplex) ((Un -InexactReal -InexactComplex) -InexactComplex . -> . -InexactComplex)