Advertisement
Guest User

Untitled

a guest
Apr 14th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. function<float> power(float base, int exp)
  2. {
  3. var<float> res = 1;
  4.  
  5. while (exp > 0)
  6. {
  7. if (exp&1)
  8. res *= base;
  9. base *= base;
  10.  
  11. exp >>= 1;
  12. }
  13.  
  14. return res;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement