title: Math.Pow taking an integer value
body: <p>From <a href="http://msdn.microsoft.com/en-us/library/system.math.pow.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.math.pow.aspx</a></p>
  
  <pre><code>int value = 2;
  for (int power = 0; power &lt;= 32; power++)
      Console.WriteLine("{0}^{1} = {2:N0}",
                        value, power, (long) Math.Pow(value, power));
  </code></pre>
  
  <p>Math.Pow takes doubles as arguments, yet here we are passing in ints.</p>
  
  <p>Question: Is there any danger of floating point rounding errors if there is an implicit conversion to double happening?</p>
  
  <p>If yes, it is better to use something like:</p>
  
  <pre><code>public static int IntPow(int x, uint pow)
  {
      int ret = 1;
      while (pow != 0)
      {
          if ((pow &amp; 1) == 1)
              ret *= x;
          x *= x;
          pow &gt;&gt;= 1;
      }
      return ret;
  }
  </code></pre>