The left shift is limited by the word size of your processor, either 32 or 64 bits, which limits the maximum value that you can safely use to an undefined result (2 ^ 31 or 2 ^ 63).
The following works for larger exhibitors, but uses floating point arithmetic. If you need accurate results, you should use a math library with infinite precision, such as GMP
#include <math.h>
int main() {
double base = 2;
double exponent = 4;
double result = pow(base, exponent);
return 0;
}
source
share