I need to use pow in my c++ program and if i call the pow() function this way:
long long test = pow(7, e);
Where
e is an integer value with the value of 23.
I always get 821077879 as a result. If i calculate it with the windows calculator i get 27368747340080916343.. Whats wrong here? ):
I tried to cast to different types but nothing helped here… What could be the reason for this? How i can use pow() correctly?
Thanks!
The result is doesn’t fit in
long long.If you want to deal with very big numbers then use a library like GMP
Or store it as a floating point (which won’t be as precise).
Applying modulo: