cpp implementation of Sqrt(x)