how do you find this? i tried this:

but i came up with this:Code:

fyards = (area ^ (1/3)); //cube root

63 C:\Dev-Cpp\program2.cpp invalid operands of types `float' and `int' to binary `operator^'

help?

Printable View

- 11-13-2005gunshipoliticocube root
how do you find this? i tried this:

Code:

fyards = (area ^ (1/3)); //cube root

63 C:\Dev-Cpp\program2.cpp invalid operands of types `float' and `int' to binary `operator^'

help? - 11-13-2005Enahs
The power function is in the library <cmath>

And it goes like this:

Code:

variable = pow(x,y);

//Where x is what you want and y is the power

double temp = pow(8,(1.0/3.0) ); //Will get you 2

- 11-14-2005grumpy
Alternative, if area is guaranteed to be greater than zero, would be;

Code:`fyards = exp(log(area)/3.0);`

- 11-14-2005Rashakil FolQuote:

Originally Posted by**grumpy**

- 11-16-2005grumpy
Mathematically it is equivalent. As to it being what the pow() function actually does: that's implementation dependent. I suggest pow() will also do a few other things, otherwise it wouldn't work if the first argument is negative.

- 11-16-2005arjunajay
^ is the XOR operator by the way...

- 11-17-2005grumpyQuote:

Originally Posted by**arjunajay**

But the way the question was asked he was using x^y as a notation for "x raised to the power of y".