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

*To*: srfi-77@xxxxxxxxxxxxxxxxx*Subject*: Optional base argument for LOG (and friends)*From*: Jorgen Schaefer <forcer@xxxxxxxxx>*Date*: Sat, 13 May 2006 12:38:46 +0200*Delivered-to*: srfi-77@xxxxxxxxxxxxxxxxx*Old-date*: Fri, 12 May 2006 12:56:33 +0200*User-agent*: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.5-b26 (darwin)

Hello everyone! I've recently started a (hopefully useful) debate on comp.lang.scheme on little changes for R6RS (<87r7309irh.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>), and tried to get the ideas rolling with one of my smaller wishes. Michael Sperber was kind enough to remind me that this SRFI exists for arithmetic stuff, so I'll repeat my wish here: 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). In SRFI 77, there's also INLOG and FLLOG, both accepting only a single argument. In the spirit of *ATAN1 and *ATAN2, those would probably be named {IN,FL}LOG{1,2}, though just providing extra {IN,FL}LOG2 would also be sufficient. Regards, -- Jorgen PS. There's apparently a typo in SRFI 77: procedure: flatan1 fl procedure: flatan2 fl1 fl2 [...] `(flatan1 fl1 fl2)' computes the arc tangent of fl1 /fl2. The range of flatan1 and flatan2 lies between -pi/2 and pi/2, both inclusive if -0.0 is distinguished, both exclusive otherwise. Note that FLATAN1 only accepts one arg, I assume the text refers to FLATAN2 there. -- ((email . "forcer@xxxxxxxxx") (www . "http://www.forcix.cx/";) (gpg . "1024D/028AF63C") (irc . "nick forcer on IRCnet"))

**Follow-Ups**:**Re: Optional base argument for LOG (and friends)***From:*Aubrey Jaffer

**Re: Optional base argument for LOG (and friends)***From:*John Cowan

- Prev by Date:
**Re: div and mod.** - Next by Date:
**Re: Optional base argument for LOG (and friends)** - Previous by thread:
**implementations that can't represent infinities or NaNs** - Next by thread:
**Re: Optional base argument for LOG (and friends)** - Index(es):