[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: forcer@xxxxxxxxx*Subject*: Re: Optional base argument for LOG (and friends)*From*: Aubrey Jaffer <agj@xxxxxxxxxxxx>*Date*: Mon, 15 May 2006 22:48:24 -0400 (EDT)*Cc*: srfi-77@xxxxxxxxxxxxxxxxx*Delivered-to*: srfi-77@xxxxxxxxxxxxxxxxx*In-reply-to*: <y9l1wuyqkeh.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx> (message from Jorgen Schaefer on Sat, 13 May 2006 12:38:46 +0200)*References*: <y9l1wuyqkeh.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

| 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)).

**References**:**Optional base argument for LOG (and friends)***From:*Jorgen Schaefer

- Prev by Date:
**Optional base argument for LOG (and friends)** - Next by Date:
**SRFI 77 Revision available** - Previous by thread:
**Optional base argument for LOG (and friends)** - Next by thread:
**Re: Optional base argument for LOG (and friends)** - Index(es):