diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog index 6160c876e..5620222bc 100644 --- a/ice-9/ChangeLog +++ b/ice-9/ChangeLog @@ -1,3 +1,9 @@ +2000-07-13 Dirk Herrmann + + * 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 * boot-9.scm (expt): Make sure that integer-expt is only called diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index c1e578494..3735c7948 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -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