[Pdx-pm] log base 10
Thomas J Keller
kellert at ohsu.edu
Fri Apr 9 12:18:27 CDT 2004
Hey! I learn a lot from the footnotes and asides people toss in.
and review of first principles is always good.
pdx-pm is a great group. Thanks all.
On Apr 8, 2004, at 8:15 PM, darthsmily wrote:
> He didn't specify a language, so I thought I'd be a smart ass and toss
> out some basic code.
> Tkil wrote:
>>>>>>> "DS" == darthsmily <darthsmily at verizon.net> writes:
>> DS> Log10 = Log(number) / 2.30258509299405
>> For the people who wonder where the magic number comes from: the
>> logarithm of x in base b can be calculated by dividing the natural log
>> of x by the natural log of b. In formula form (so far as ascii art
>> ln x
>> log x = ----
>> b ln b
>> I don't remember enough math to tell you what the appropriate domains
>> would be, but for simple calculations, this should be sufficient.
>> In this case, b is 10, so we have
>> log10(x) = ln(x) / ln(10)
>> And ln(10) is 2.30258509299404568402, at least according to M_LN10 in
>> /usr/include/math.h. :)
>> Pdx-pm-list mailing list
>> Pdx-pm-list at mail.pm.org
> Pdx-pm-list mailing list
> Pdx-pm-list at mail.pm.org
More information about the Pdx-pm-list