C++ (Qt)template <class T>T approx_func2(const T & x){ static const T r = 1.33; const T y0 = log(1 + x)/r; const T a = 0.5 / (y0*y0); const T b = -(1 + 1.0/y0); const T c = log(x/y0) - y0; return y0 + (-b - sqrt(b*b - 4*a*c))/(2*a);}