top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can pow() function of C output the exact value of a^b without any precision loss?

0 votes
286 views
#include <stdio.h>
#include<math.h>
int main()
{

  printf("%.0f",pow(2,1023));

  return 0;
}

Output: 89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715319737062188883946712432742638151109800623047059726541476042502884419075341171231440736956555270413618581675255342293149119973622969239858152417678164812112068608

Now question is how is it achieved for such a big number?

posted Aug 5, 2017 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

I have a recursive function as below,

void func()
{
       if(counter>10)
              return;
       func();
}

Here, I need to come out of the function when counter reaches specific number(10 as per example).
Now, the condition is, I can't take this counter as global or static or can't pass this counter as parameter.

Any suggestion to solve this given above terms.

...