finding cube root in C++?
Strange things happen when i try to find the cube root of a number. The following code returns me undefined. In cmd : -1.#IND cout<<pow(( double )(20.0*(-3.2) + 30.0),( double )1/3) While this one works perfectly fine. In cmd : 4.93242414866094 cout<<pow(( double )(20.0*4.5 + 30.0),( double )1/3) From mathematical way it must work since we can have the cube root from a negative number. Pow is from Visual C++ 2010 math.h library. Any ideas? pow(x, y) from <cmath> does NOT work if x is negative and y is non-integral. This is a limitation of std::pow , as documented in the C standard and on