This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.
| From: Jorgen Schaefer <forcer@xxxxxxxxx> | Date: Sat, 13 May 2006 12:38:46 +0200 | | It would be nice if the LOG procedure of R5RS would allow an | optional second argument, BASE, for the basis to which the | logarithm is calculated. This is the behavior from Common Lisp, and | the implementation is trivial - but I don't see a reason why the | base procedure shouldn't accept a BASE argument. | | The implementation for R5RS is trivial, of course: | | (define log | (let ((ln log)) | (lambda (x . basel) | (if (null? basel) | (ln x) | (/ (ln x) | (ln (car basel))))))) | | Taylor Campbell noted that it would be cleaner to have the base as | the first argument, and provide a more "intuitively" named LN | procedure for the natural logarithm, i.e. (LOG B Z) and (LN Z). (LOG B X) is more consistent with mathematical usage, but breaks Scheme precedent. To break the tie I would look to Common-Lisp and have the second argument be the base. Also, (log x base) == (/ (log x) (log base)) has the same orientation of division as (atan x1 x2) == (atan (/ x1 x2)).