diff --git a/mats/5_3.ms b/mats/5_3.ms index ace926700c..29f1a16305 100644 --- a/mats/5_3.ms +++ b/mats/5_3.ms @@ -2477,6 +2477,10 @@ (cfl~= (expt 7.7-11.11i -2.0) (* (/ 1.0 7.7-11.11i) (/ 1.0 7.7-11.11i))) (~= (expt 11 1/2) (sqrt 11)) (fl~= (expt 1.5e-20 0.5) (sqrt 1.5e-20)) + (cfl~= -0.0+0.0i (expt -0.1 1000000000000001/3)) ; inexact approx of second arg is non-integer + (eqv? +inf.0+inf.0i (expt -0.1 -1000000000000001/3)) ; inexact approx of second arg is non-integer + (cfl~= -0.0+0.0i (expt -0.1 100000000000000000001/3)) ; inexact approx of second arg is integer + (eqv? -inf.0-inf.0i (expt -0.1 -100000000000000000001/3)) ; inexact approx of second arg is integer ; test cp0 handling of expt (begin (define $probably-should-not-use diff --git a/s/5_3.ss b/s/5_3.ss index 13288beee9..ee253bb158 100644 --- a/s/5_3.ss +++ b/s/5_3.ss @@ -1519,7 +1519,16 @@ 0 ($impoops 'expt "undefined for values ~s and ~s" x y))] [(eq? x 1) 1] - [(floatable? y) (expt x (inexact y))] + [(and (floatable? y) + (let ([y (inexact y)]) + ;; Don't use this case if `(inexact y)` loses + ;; precision and becomes an an integer, in which + ;; case the result would be real (but should be + ;; non-real complex) + (and (not (and (flonum? y) + ($flinteger? y))) + y))) + => (lambda (y) (expt x y))] [else (exp (* y (log x)))])] [else (nonnumber-error 'expt y)])))