Fixed bug 159865: Expt fails on floats and rationals.
This commit is contained in:
parent
e4e9418dae
commit
81f6439b3c
|
@ -307,6 +307,7 @@
|
||||||
(if (flonum? x)
|
(if (flonum? x)
|
||||||
(if (flonum? y)
|
(if (flonum? y)
|
||||||
(let ([y^ ($flonum->exact y)])
|
(let ([y^ ($flonum->exact y)])
|
||||||
|
;;; FIXME: performance bottleneck?
|
||||||
(cond
|
(cond
|
||||||
[(fixnum? y^) (inexact (expt x y^))]
|
[(fixnum? y^) (inexact (expt x y^))]
|
||||||
[(bignum? y^) (inexact (expt x y^))]
|
[(bignum? y^) (inexact (expt x y^))]
|
||||||
|
@ -1668,6 +1669,8 @@
|
||||||
(/ 1 (expt n (- m))))]
|
(/ 1 (expt n (- m))))]
|
||||||
[else
|
[else
|
||||||
(error 'expt "result is too big to compute" n m)])]
|
(error 'expt "result is too big to compute" n m)])]
|
||||||
|
[(flonum? m) (flexpt (inexact n) m)]
|
||||||
|
[(ratnum? m) (flexpt (inexact n) (inexact m))]
|
||||||
[else (error 'expt "not a number" m)])))
|
[else (error 'expt "not a number" m)])))
|
||||||
|
|
||||||
(define quotient
|
(define quotient
|
||||||
|
|
Loading…
Reference in New Issue