Newton Raphson Method Cpp Performance