0

I want to execute logx in C, but I found out that the math library in C, only provides logs with bases e and 10. How is it possible to get a logarithm in some other basis?

Jim Blum
  • 2,656
  • 5
  • 28
  • 37

1 Answers1

2

http://en.wikipedia.org/wiki/Logarithm#Change%5Fof%5Fbase

The logarithm log_b(x) can be computed from the logarithms of x and b with respect to an arbitrary base k using the following formula:

log_b(x) = ln(x) / ln(b)

Pavel
  • 7,436
  • 2
  • 29
  • 42