I have the following power function which operates on integers and it works fine:
int ipow( int base, int exp ) { int result = 1; while( exp ) {
Your base variable is too small. Change it to unsigned long long int, like the others, since it holds numbers greater than 2^32.
base
unsigned long long int
2^32