gpt4 book ai didi

c++ - 为什么这些 double 的返回值是 -1.#IND?

转载 作者:IT老高 更新时间:2023-10-28 22:19:32 25 4
gpt4 key购买 nike

我有:

double score = cvMatchContourTrees( CT1, CT2, CV_CONTOUR_TREES_MATCH_I1, 0.0 );
cout<<score<<endl;

返回值为 -1.#IND。除此之外,正值是正常的,例如 1.34543。

为什么会这样?我该如何解决?

最佳答案

正如 Frederic 所说,这是 ' Not a Number 的结果' 由在 Windows 上使用 Visual Studio 构建的应用程序进行格式化。约翰 D 库克有一个 excellent reference :

Windows displays a NaN as -1.#IND ("IND" for "indeterminate") while Linux displays nan.

...

In short, if you get 1.#INF or inf, look for overflow or division by zero. If you get 1.#IND or nan, look for illegal operations.

如果您对字符串进行任何类型的格式化,请注意截断;我遇到了related issues自己处理这类错误时。

关于c++ - 为什么这些 double 的返回值是 -1.#IND?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7476177/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com