I need to calculate x^y where both x and y are Doubles.
I tried using Math.Pow:
  Double result = Math.Pow(24.69, 2/3);
The value of result is 1 where it should be 8.4790 ...
Any idea why?
I need to calculate x^y where both x and y are Doubles.
I tried using Math.Pow:
  Double result = Math.Pow(24.69, 2/3);
The value of result is 1 where it should be 8.4790 ...
Any idea why?
 
    
    For the exponent you are passing in 2 ints which is do integer division. So it is doing:
Math.Pow(24.69, 0)
To fix this use doubles like this:
Double result = Math.Pow(24.69, 2.0/3.0);
