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);
}

Need Your Help

crop and Save ROI as new image in OpenCV 2.4.2 using cv::Mat

opencv crop face-detection roi

Working on Face Detection and Recognition, and after successfully detecting a face, i just want to crop the face and save it somewhere in the drive to give it for the recognition code.I am having h...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.