fix R6RS log to accept 2 arguments

svn: r11197
This commit is contained in:
Matthew Flatt 2008-08-12 00:56:07 +00:00
parent ea8c4b3f38
commit ebb811b491
2 changed files with 8 additions and 1 deletions

View File

@ -66,7 +66,7 @@
numerator denominator
floor ceiling truncate round
rationalize
exp log sin cos tan asin acos atan
exp (rename-out [r6rs:log log]) sin cos tan asin acos atan
sqrt (rename-out [integer-sqrt/remainder exact-integer-sqrt])
expt
make-rectangular make-polar real-part imag-part magnitude
@ -296,6 +296,11 @@
args))
(apply / args))]))
(define r6rs:log
(case-lambda
[(n) (log n)]
[(n m) (/ (log n) (log m))]))
(define (r6rs:angle n)
; because `angle' produces exact 0 for reals:
(if (and (inexact-real? n) (positive? n))

View File

@ -842,6 +842,8 @@
(test/approx (log 2.718281828459045) 1.0)
(test (log +inf.0) +inf.0)
(test (log 0.0) -inf.0)
(test/approx (log 100 10) 2.0)
(test/approx (log 1125899906842624 2) 50.0)
(test/exn (log 0) &assertion)