为什么这些双打的返回值是-1.#IND? [英] Why are the return values of these doubles -1.#IND?

查看:134
本文介绍了为什么这些双打的返回值是-1.#IND?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有:

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

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

There are values returned as -1.#IND. Other than that, the positive values are normal, like 1.34543.

为什么会这样?我该怎么解决?

Why does this happen? How do I solve it?

推荐答案

正如弗雷德里克(Frederic)所说,这是"出色的参考书:

As Frederic says, it's the result of a 'Not a Number' being formatted by an application built with visual studio on windows. John D Cook has an excellent reference:

Windows将NaN显示为-1.#IND("IND"表示不确定"),而Linux显示nan.

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

...

简而言之,如果得到1.#INF或inf,则查找溢出或被零除.如果得到1.#IND或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.

如果对字符串进行任何格式的格式化,请当心截断;处理这些问题时,我遇到了相关问题自己的错误.

Watch out for truncations if you do any sort of formatting with your string; I've encountered related issues when handling these sorts of errors myself.

这篇关于为什么这些双打的返回值是-1.#IND?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆