当前位置: 动力学知识库 > 问答 > 编程问答 >

Why are my two computers running linux producing different results from C code

问题描述:

So I'm running some C code on a few different machines and on all of them except one I'm getting the same results. But on one machine, I am getting an incorrect value for Zth.

On my machine I get the correct value. On the other machine I get 0.000 + 0.000 which is not right. I'm guessing it has something to do with complex.h but I am not sure how to fix this.

网友答案:

Break the expression down into smaller and smaller pieces until you find the problem.

Double check your compiler command and make sure it isn't using a different set of options for the build, such as -ffast-math.

网友答案:

The floating point precision on different CPU models changes.

You should try using sizeof on float, double, long double and see if the results are the same.

分享给朋友:
您可能感兴趣的文章:
随机阅读: