C++ – g++ power function included in g++ compiler

cg++

can power function be used to calulate the power of very large values like pow(200,200).
also can it be used for long long int values … pow(long long int,long long int).

i am getting this error
/sources/tested.cpp: In function 'int main()':

/sources/tested.cpp:16: error: call of overloaded 'pow(long long int&, long long int&)' is ambiguous

/usr/include/bits/mathcalls.h:154: note: candidates are: double pow(double, double)

/usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/cmath:360:
note: long double std::pow(long double, int)

/usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/cmath:356: note: float std::pow(float, int)

/usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/cmath:352: note: double std::pow(double, int)
/usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/cmath:348: note: long double std::pow(long double, long double)

/usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/cmath:344: note: float std::pow(float, float)

Best Answer

If you're looking to do arbitrary precision math, you'll need to get a library for it. Likely, your platform doesn't have data types large enough to do so natively. Check out GNU MP.

Related Topic