Compiling C code in Visual Studio 2013 with complex.h library

被刻印的时光 ゝ 提交于 2019-11-27 23:05:44

In case anyone is searching a year later, try

_Dcomplex dc1 = {3.0, 2.0};

for the variable declaration.

From looking inside VS2013's "complex.h" header, it seems that Microsoft decided on their own implementation for C complex numbers. You'll have to implement your own arithmetical operators using the real() and imag() functions, i.e.:

double real_part = real(dc1) + real(dc2);
double imag_part = imag(dc1) + imag(dc2);
_Dcomplex result = {real_part, imag_part};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!