mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 21:10:27 +02:00
(expt): Fix bug: Handle negative exponents correctly.
This commit is contained in:
parent
c8219cb002
commit
61d520098e
1 changed files with 59 additions and 57 deletions
|
@ -793,8 +793,10 @@
|
|||
(define expt
|
||||
(let ((integer-expt integer-expt))
|
||||
(lambda (z1 z2)
|
||||
(cond ((exact? z2)
|
||||
(integer-expt z1 z2))
|
||||
(cond ((integer? z2)
|
||||
(if (>= z2 0)
|
||||
(integer-expt z1 z2)
|
||||
(/ 1 (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