Home > Back-end >  Implement pow () function source code
Implement pow () function source code

Time:05-12

CodePudding user response:

Pay attention to the x, y receive may lead to z overflow value of the argument, the need to consider the overflow of ~ 10 ^ 15, for example, int ~ data cannot be loaded

CodePudding user response:

reference 1/f, confident boy reply:
pay attention to the x, y receive may lead to z overflow value of the argument, the need to consider the overflow ~ 10 ^ 15, for example, the condition of type int data cannot be loaded under ~

Well well well, thank you

CodePudding user response:

Power parameter y temporary local variables can be initialized, reducing additional variables, code more compact:
 int pow (int x, int y) 
{
Int z;
For (z=1; Y & gt; 0; - y)
Z *=x;
Return the z;
}

CodePudding user response:

I hope it can help you, looking forward to adopt: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related