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

*To*: Per Bothner <per@x>*Subject*: Re: [Scheme-reports] editorial: 2-argument log function*From*: Alex Shinn <alexshinn@x>*Date*: Sat, 3 Nov 2012 15:17:08 +0900*Cc*: scheme-reports <scheme-reports@x>*In-reply-to*: <5094B149.8090709@bothner.com>*References*: <5094A0E0.9020903@bothner.com> <CAMMPzYMJaNmgNahD3NEE1EBV5NzbUk17wuGT4CJ_yi75awdb8g@mail.gmail.com> <5094B149.8090709@bothner.com>

On Sat, Nov 3, 2012 at 2:53 PM, Per Bothner <per@x> wrote: > On 11/02/2012 09:52 PM, Alex Shinn wrote: >> >> On Sat, Nov 3, 2012 at 1:43 PM, Per Bothner <per@x> wrote: >>> >>> R6RS has a 2-operand version of the log function: >>> >>> (log zi zii) computes the base-zii logarithm of zi. >>> >>> This function is not in the latest R7RS draft that I've seen, >>> which means it should be listed in the "Incompatibilities with >>> the main R6RS document" section of the NOTES. >> >> >> The two argument log function has already been added. > > > In that case, I guess I need to implement it ... > > Is there a recommended reference implementation? > IIRC mathematically (log a b) is (/ (log a) (log b)), > but that might not provide the best accuracy. That's how I implement it, and neither libc nor the underlying x87 processor have a more accurate alternative (the x87 actually has instructions to push log constants for common conversions from the native log2). In practice b will most often be 2, e or 10, which have well behaved denominators. Except for bases approaching zero I doubt a numerical approach would help. -- Alex _______________________________________________ Scheme-reports mailing list Scheme-reports@x http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

**References**:**[Scheme-reports] editorial: 2-argument log function***From:*Per Bothner <per@x>

**Re: [Scheme-reports] editorial: 2-argument log function***From:*Alex Shinn <alexshinn@x>

**Re: [Scheme-reports] editorial: 2-argument log function***From:*Per Bothner <per@x>

- Prev by Date:
**Re: [Scheme-reports] editorial: 2-argument log function** - Next by Date:
**[Scheme-reports] R7RS 7th draft available** - Previous by thread:
**Re: [Scheme-reports] editorial: 2-argument log function** - Next by thread:
**[Scheme-reports] R7RS 7th draft available** - Index(es):