BOOST_CHECK_CLOSE和BOOST_CHECK_CLOSE_FRACTION之间的区别? [英] Difference between BOOST_CHECK_CLOSE and BOOST_CHECK_CLOSE_FRACTION?

查看:382
本文介绍了BOOST_CHECK_CLOSE和BOOST_CHECK_CLOSE_FRACTION之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能描述 BOOST_CHECK_CLOSE 之间的行为差​​异和 BOOST_CHECK_CLOSE_FRACTION ? <一href=\"http://www.boost.org/doc/libs/1%5F39%5F0/libs/test/doc/html/utf/testing-tools/reference.html\">The文档意味着这两个宏对待他们的第三个参数完全相同,这使我怀疑的文件是错误的。

Can anyone describe the difference in behavior between BOOST_CHECK_CLOSE and BOOST_CHECK_CLOSE_FRACTION? The documentation implies the that both macros treat their third parameter identically, which makes me suspect the documentation is wrong.

在特别 BOOST_CHECK_CLOSE_FRACTION 给我一些奇怪的妆效:

In particular, BOOST_CHECK_CLOSE_FRACTION gives me some odd looking results:

error in "...": difference between *expected{0} and *actual{-1.7763568394002506e-16} exceeds 9.9999999999999995e-07

是否有疑难杂症,因为我想到一个零的结果?我没有在通过底层宏观声明读了成功。请注意 BOOST_CHECK_SMALL 是不适合我的用例(一个线性代数操作后,比较两个向量)。

Is there a gotcha because I expect a zero result? I've not been successful at reading through the underlying macro declarations. Please note BOOST_CHECK_SMALL isn't appropriate for my use case (comparing two vectors after a linear algebra operation).

推荐答案

这个讨论,一( BOOST_CHECK_CLOSE )把pssing百分比第三个参数为前$ p $,而其他( BOOST_CHECK_CLOSE_FRACTION )会将其作为前pressing一小部分。因此,0.01的第一应相当于在第二0.0001。

According to this discussion, one (BOOST_CHECK_CLOSE) treats the third parameter as expressing a percent, while the other (BOOST_CHECK_CLOSE_FRACTION) treats it as expressing a fraction. So, .01 in the first should be equivalent to .0001 in the second.

不能确定,说明你的问题 - 你得到与 BOOST_CHECK_CLOSE 同样奇怪的结果呢?我也不会感到震惊,如果0导致的一个问题 - 但我没有与宏的第一手经验。

Not certain if that explains your problem -- do you get the same odd result with BOOST_CHECK_CLOSE? I wouldn't be shocked if the 0 caused an issue -- but I don't have first hand experience with the macros.

这篇关于BOOST_CHECK_CLOSE和BOOST_CHECK_CLOSE_FRACTION之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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