好吗?
当我使用log()和exp()数学函数时,我在C中遇到问题。
错误是,使用gdb进行调试。
(gdb) step
__log (x = -nan (0x8000000000000)) at w_log.c: 28
28 w_log.c: No such file or directory.
(gdb)
42 in w_log.c
(gdb) step
__ieee754_log_avx (x = -nan (0x8000000000000))
at ../sysdeps/ieee754/dbl-64/e_log.c:78
78 ../sysdeps/ieee754/dbl-64/e_log.c: No such file or directory.
错误发生在代码行中:
Z[t] = A[j] / ( X[t] * B[i] * pow( (2*PI) ,(1/2)) ) * exp( (-1) * ( pow( log(X[t]/C[k]), 2) / (pow( 2 * B[i] ,2)))) +
( (1-A[j]) / ( X[t] * D[ii] * pow( (2*PI) ,(1/2)) ) * exp( (-1) * ( pow( log(X[t]/E[kk]), 2) / (pow( 2 * D[ii] ,2)))));
The mathematical function is this:
" exp()"发生了另一个错误功能,与日志
相同
我的make complie:
COMPILER = gcc
FLAGS = -lm -g
all: atd.exec
@echo "Compiled!"
%.exec: %.o
$(COMPILER) -o $@ $+ $(FLAGS)
%.o: %.c
$(COMPILER) -o $@ -c $< $(FLAGS)
run: atd.exec
./atd.exec
test: atd.exec
./atd.exec > test.txt
clean:
rm -f *.o *.exec
有没有人经历过这个?