A C++ implementation with pow(double, int) function