cool!

now i understand what the ques was about!

2^64 > 10^18 > 2^51

I completely neglected the 10^18 part in the question!!

On Sep 15, 2:31 am, cyberfish <[email protected]> wrote:
> The floating point version will work for integers up to about 2^51
> (the width of mantissa). Beyond that integers cannot be represented
> with perfect precision and will give youallthe nastiness people have
> pointed out.
>
> A simple O(logn) implementation -
> int64 pow_int64(int64base, int64 pow) {
>      if (pow == 0) return 1;
>      int64 t = pow_int64(base, pow / 2);
>      if (pow % 2 == 1) returnbase*t*t;
>      else return t*t;
>
> }
>
> This is the recursive version. Can easily be converted to iterate
> instead.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to