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?
http://en.wikipedia.org/wiki/Logarithm#Change%5Fof%5Fbase
The logarithm
log_b(x)
can be computed from the logarithms ofx
andb
with respect to an arbitrary basek
using the following formula:
log_b(x) = ln(x) / ln(b)