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:
parent
0e12d408bd
commit
bdb112ea6b
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue