B
Blair
could someone PLEASE tell me why this doesn't work...
-----------------------------------------
#include <complex>
using namespace std;
typedef complex<long double> cld;
void main()
{
cld cmplx, temp;
cmplx = cld(-1.0, 0.0);
temp = pow(cmplx, 0.5);
}
--------------------------------------------
the square root of -1 is j (or i) but why I debug this code temp is given as
(1,0).
or
if I do this...
void main()
{
cld cmplx, temp;
cmplx = cld(-1.0, 0.0);
temp = pow(cmplx, 0.5);
}
I get the same results. temp=(1, 0) when the real is 1 and the imaginary is
0.
So, what is wrong with the pow function? Why can't I use fractions as the
exponent? (BTW, I need to find cube-roots. That's why I'm not using
sqrt(...) )
Thanks, Blair
-----------------------------------------
#include <complex>
using namespace std;
typedef complex<long double> cld;
void main()
{
cld cmplx, temp;
cmplx = cld(-1.0, 0.0);
temp = pow(cmplx, 0.5);
}
--------------------------------------------
the square root of -1 is j (or i) but why I debug this code temp is given as
(1,0).
or
if I do this...
void main()
{
cld cmplx, temp;
cmplx = cld(-1.0, 0.0);
temp = pow(cmplx, 0.5);
}
I get the same results. temp=(1, 0) when the real is 1 and the imaginary is
0.
So, what is wrong with the pow function? Why can't I use fractions as the
exponent? (BTW, I need to find cube-roots. That's why I'm not using
sqrt(...) )
Thanks, Blair