Redian新闻
>
帮我看看这个C语言错误
avatar
帮我看看这个C语言错误# Computation - 科学计算
g*s
1
我的程序一运行就显示:
Floating point error: Overflow
然后运行就中断了,甚至后面的printf()都不再执行了。
我想问一下,可能是哪方面的错误,是我在该用double的地方用成float 了吗?
我查了一下,float数值的范围已经远远超过我问题里函数的range了.
avatar
r*y
2
Most likely, somewhere you divided a number by zero.

【在 g***s 的大作中提到】
: 我的程序一运行就显示:
: Floating point error: Overflow
: 然后运行就中断了,甚至后面的printf()都不再执行了。
: 我想问一下,可能是哪方面的错误,是我在该用double的地方用成float 了吗?
: 我查了一下,float数值的范围已经远远超过我问题里函数的range了.

avatar
g*s
3
Thank you very much.
I have found the wrong place.
I made a mistake. I want to look for the minimum of a function. I use an
algorithm which is to find the maximum of the function.
So I need to put a negative sign before the objective function.
But unfortunately I forgot to do so.
So finally the calculation goes out of the range of the "float type".

likely
instead
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。