Search code examples
c++c++11mathvisual-c++logarithm

How to write this mathematical formula in C++?


I have a simple formula and I want to use it in C++ application. Not sure how to rewrite in C++.

enter image description here


Solution

  • logn(5, abs((a*b - d*c) / (tan(c) + sin(d))))
    

    where logn is:

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

    and the header cmath is included for the other functions.