c语言中怎么对负数开平方返回相应的复数
c语言中如何对负数开平方返回相应的复数
sqrt()语句当开方值为负数时就会返回一个-1.#IND000,如何解决这个问题
------解决思路----------------------
n1570:
7.3.8.3 The csqrt functions
Synopsis
1 #include <complex.h>
double complex csqrt(double complex z);
float complex csqrtf(float complex z);
long double complex csqrtl(long double complex z);
Description
2 The csqrt functions compute the complex square root of z, with a branch cut along the
negative real axis.
Returns
3 The csqrt functions return the complex square root value, in the range of the right halfplane (including the imaginary axis).
------解决思路----------------------
http://www.cplusplus.com/reference/complex/sqrt/index.html
------解决思路----------------------
楼主问的是用c语言,所以参见http://en.cppreference.com/w/c/numeric/complex/csqrt
sqrt()语句当开方值为负数时就会返回一个-1.#IND000,如何解决这个问题
------解决思路----------------------
n1570:
7.3.8.3 The csqrt functions
Synopsis
1 #include <complex.h>
double complex csqrt(double complex z);
float complex csqrtf(float complex z);
long double complex csqrtl(long double complex z);
Description
2 The csqrt functions compute the complex square root of z, with a branch cut along the
negative real axis.
Returns
3 The csqrt functions return the complex square root value, in the range of the right halfplane (including the imaginary axis).
------解决思路----------------------
http://www.cplusplus.com/reference/complex/sqrt/index.html
------解决思路----------------------
楼主问的是用c语言,所以参见http://en.cppreference.com/w/c/numeric/complex/csqrt