Getting huge number while calculating power.
Kth root - using power function gives huge number
if you are using inbuild pow() function
then why you make this function
long long int calPower(long long int x,int y){
if(y==0){
return 1;
}else{
long long int temp = pow(x,y/2); //getting huge number here, how to rectify this
if(y%2==0){
return temp*temp;
}else{
return x*temp*temp;
}
}
}
i think pow function will not create problem
here is my code i have also used it and it worked
but if you want you can build your own function like this
I have taken reference from here - https://www.geeksforgeeks.org/floor-value-kth-root-of-a-number-using-recursive-binary-search/
if you can modify my code accordingly, please do so.
Your Modified Code
alright! you can close this thread.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.