fix more r6rs expt problems on 0 or 0.0 base
svn: r11371
This commit is contained in:
parent
c170f390a7
commit
6c89ae4f09
|
@ -302,12 +302,26 @@
|
||||||
[(n m) (/ (log n) (log m))]))
|
[(n m) (/ (log n) (log m))]))
|
||||||
|
|
||||||
(define (r6rs:expt base power)
|
(define (r6rs:expt base power)
|
||||||
(if (and (or (eq? base 0)
|
(cond
|
||||||
(eq? base 1))
|
[(and (number? base)
|
||||||
|
(zero? base)
|
||||||
|
(number? power))
|
||||||
|
(if (zero? power)
|
||||||
|
(if (and (eq? base 0)
|
||||||
|
(exact? power))
|
||||||
|
1
|
||||||
|
1.0)
|
||||||
|
(if (positive? (real-part power))
|
||||||
|
(if (and (eq? base 0)
|
||||||
|
(exact? power))
|
||||||
|
0
|
||||||
|
0.0)
|
||||||
|
(expt base power)))]
|
||||||
|
[(and (eq? base 1)
|
||||||
(number? power)
|
(number? power)
|
||||||
(inexact? power))
|
(inexact? power))
|
||||||
(expt (exact->inexact base) power)
|
(expt (exact->inexact base) power)]
|
||||||
(expt base power)))
|
[else (expt base power)]))
|
||||||
|
|
||||||
(define (r6rs:angle n)
|
(define (r6rs:angle n)
|
||||||
; because `angle' produces exact 0 for reals:
|
; because `angle' produces exact 0 for reals:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user