From ebb811b491e990f67afaab9725ce2d9cc4ff5e86 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 12 Aug 2008 00:56:07 +0000 Subject: [PATCH] fix R6RS log to accept 2 arguments svn: r11197 --- collects/rnrs/base-6.ss | 7 ++++++- collects/tests/r6rs/base.sls | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/collects/rnrs/base-6.ss b/collects/rnrs/base-6.ss index 551f19b3cf..f46b2136c8 100644 --- a/collects/rnrs/base-6.ss +++ b/collects/rnrs/base-6.ss @@ -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)) diff --git a/collects/tests/r6rs/base.sls b/collects/tests/r6rs/base.sls index a345f98240..bd8bf77646 100644 --- a/collects/tests/r6rs/base.sls +++ b/collects/tests/r6rs/base.sls @@ -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)