# A C++ implementation of log that one can specify the base for?

I've been playing around with some math recently and I would like to know if anyone has written/seen a C++ implementation of log that one can specify the base (root..?) for? As in:

Obviously I would prefer giving the base as an argument: double d = log(b,x);

Thank you for your time and any answers are much appreciated. :}

EDIT: Also, I take it would use Taylor Series?

## Answers

log_b_(x) = log(x) / log(b). Just do this:

double log(double base, double x) { return std::log(x) / std::log(base); }