title: Find Cube root of a number Using System.Math.Pow() method in C#
body: <p>While writing a program I came across finding the cube root of a number in one of my functions.</p>
  
  <p>when I used the below code, I was getting an incorrect value for the cube root (<code>1</code> was getting printed for <code>n = 64</code>).</p>
  
  <pre><code>public static void cubicPairs(double n)
  {
      double root = (System.Math.Pow(n, (1/3)));
      Console.WriteLine(root);
  }
  </code></pre>
  
  <p>Now after I changed the code slightly to this,</p>
  
  <pre><code>public static void cubicPairs(double n)
  {
      double root = (System.Math.Pow(n, (1.0/3.0))); //Changed how second parameter is passed
      Console.WriteLine(root);
  }
  </code></pre>
  
  <p>I got <code>root = 3.9999999999999996</code> (while debugging) but the method was printing <code>4</code> (which is correct). </p>
  
  <p>Why is there a difference between the two values and if this has to do with the second parameter to the <code>System.Math.Pow()</code> method (i.e, <code>1.0/3.0</code> which is a recursive value), what should I use to find cube root so that I get <code>4</code> (while debugging) rather than <code>3.9999999999999996</code>?</p>