5 c floating-point coredump exception floating-point-exceptions
我有一个很长的程序,它由一个头文件和两个源文件组成,在第一个我编写了函数的实现,在第二个(我的主要),我调用并执行它们.虽然,有一次我收到一条错误信息
浮点异常(核心转储)
程序停止了.
正如我所说,有很多行代码,因此,我无法在此发布我的整个源代码,但我会发布最相关的部分,以及发生错误的地方.
当我尝试调用此函数时出现我的错误(下面你可以找到它的实现):
void chest_first(Complex* FFTInput, Complex* IFFTOutput, Complex* HFirst)
{
int i;
for(i = 0; i < 64; i++)
{
HFirst[i].real = FFTInput[i].real / IFFTOutput[i].real;
HFirst[i].imag = FFTInput[i].imag / IFFTOutput[i].imag;
}
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,Complex是我定义的类型定义.
typedef struct {
int real, imag;
} Complex;
Run Code Online (Sandbox Code Playgroud)
这是main的部分,调用此函数.
Complex HFirst[64];
if((strcmp(channel, "LS") == 0) || (strcmp(channel, "ls") == 0))
{
if(i == 1)
chest_first(fft_input, ifft_bpsk_output, HFirst);
.
.
.
}
Run Code Online (Sandbox Code Playgroud)
我之前调用了一些其他函数,它将值放到fft_input和ifft_bpsk_output,它们都是64个元素的复杂数组.