- added two argument version of log

- handled (/ flonum complexnum)
This commit is contained in:
Abdulaziz Ghuloum 2008-08-08 08:21:23 -07:00
parent 53cc48d23c
commit b7d9c0cf1f
2 changed files with 43 additions and 36 deletions

View File

@ -1174,6 +1174,7 @@
[(fixnum? y) ($fl/ x ($fixnum->flonum y))]
[(bignum? y) ($fl/ x (bignum->flonum y))]
[(ratnum? y) ($fl/ x (ratnum->flonum y))]
[(or (cflonum? y) (compnum? y)) (x/compy x y)]
[else (err '/ y)])]
[(fixnum? x)
(cond
@ -2756,7 +2757,8 @@
[else x])))
(define log
(lambda (x)
(case-lambda
[(x)
(cond
[(fixnum? x)
(cond
@ -2791,7 +2793,12 @@
(make-rectangular
(/ (ln (+ (* xr xr) (* xi xi))) 2)
(atan xi xr))))]
[else (die 'log "not a number" x)])))
[else (die 'log "not a number" x)])]
[(x y)
(let ([ly (log y)])
(if (eqv? ly 0)
(die 'log "invalid arguments" x y)
(/ (log x) ly)))]))
(define (random n)
(if (fixnum? n)

View File

@ -1 +1 @@
1574
1575