mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* In expt, return exact results when possible.
This commit is contained in:
parent
c4da09e2dd
commit
2238100586
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-07-13 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* boot-9.scm (expt): In case of negative integer exponents return
|
||||
an exact result if the input paramters were exact. Thanks to
|
||||
Mikael for the suggestion.
|
||||
|
||||
2000-07-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* boot-9.scm (expt): Make sure that integer-expt is only called
|
||||
|
|
|
@ -793,8 +793,10 @@
|
|||
(define expt
|
||||
(let ((integer-expt integer-expt))
|
||||
(lambda (z1 z2)
|
||||
(cond ((and (integer? z2) (>= z2 0))
|
||||
(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