www.digitalmars.com         C & C++   DMDScript  

c++.rtl - cpow()

reply Wes <Wes_member pathlink.com> writes:
Also, cpow() does not seem to be working properly.  The imaginary part of the
result is always zero.  For example:

--------------------------
#include <complex.h>
#include <stdio.h>
main()
{
double complex z1, z2, z3;

z1 = 0.1 + 0.2*I;
z2 = 0.3 + 0.4*I;
z3 = cpow(z1, z2);

printf("%f, %f\n", creal(z3), cimag(z3) );

return 0;
}
--------------------------

The output should be 0.395227, -0.108108

but is instead:      0.395227, 0.000000


-Wes Loewer
Jan 17 2006
parent "Walter Bright" <newshound digitalmars.com> writes:
Thanks, I'll investigate. 
Jan 22 2006