1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00

(expt): Only call integer-expt for an exact integer exponent, not for

an inexact integer one.  Also, let integer-expt handle negative
exponents instead of doing it here.
This commit is contained in:
Marius Vollmer 2004-09-08 14:34:51 +00:00
parent 0e12d408bd
commit bdb112ea6b

View file

@ -780,10 +780,8 @@
(define expt
(let ((integer-expt integer-expt))
(lambda (z1 z2)
(cond ((integer? z2)
(if (negative? z2)
(/ 1 (integer-expt z1 (- z2)))
(integer-expt z1 z2)))
(cond ((and (exact? z2) (integer? z2))
(integer-expt z1 z2))
((and (real? z2) (real? z1) (>= z1 0))
($expt z1 z2))
(else