<p>In <a href="https://github.com/mlpack/mlpack/pull/684#discussion_r66637007">src/mlpack/tests/test_tools.hpp</a>:</p>
<pre style='color:#555'>&gt; @@ -35,4 +34,9 @@
&gt;  
&gt;  #endif
&gt;  
&gt; +// Require the approximation L to be within a relative error of E respect to the
&gt; +// actual value R.
&gt; +#define REQUIRE_RELATIVE_ERR( L, R, E ) \
&gt; +    BOOST_REQUIRE_LE( abs((R) - (L)), (E) * (R))
</pre>
<p>Yes it will fail when R is negative. But for distances we don't have to deal with negative R values... so, do you mean that this could be confussing for futures users? I should have defined it as:</p>

<pre><code>  BOOST_REQUIRE_LE( abs((R) - (L)), (E) * abs(R))
</code></pre>

<p>(replace R by abs(R))</p>

<p>About strong/weak conditions, I have considered them before but, as we need strong condition for KNN and weak conditions for KFN, I thought it would be clearer to have a general macro for both of them.<br>
I mean:</p>

<p>BOOST_REQUIRE_CLOSE imposes strong condition:</p>

<pre><code>| R - L | &lt;= E * |L|     &amp;&amp;     | R - L | &lt;= E * |R|
</code></pre>

<p>As you suggested, we could use boost::test_tools::check_is_close to create another macro to impose weak condition, let's call it BOOST_REQUIRE_WEAK_CLOSE:</p>

<pre><code>| R - L | &lt;= E * |L|     ||    | R - L | &lt;= E * |R|
</code></pre>

<p>But none of them is enough for both KNN and KFN.... we should use BOOST_REQUIRE_CLOSE for KNN and BOOST_REQUIRE_WEAK_CLOSE for KFN.</p>

<p>So, if you agree, I can replace R by abs(R) in the definition of REQUIRE_RELATIVE_ERR, and continue using it...</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/684/files/07879a2cc79b35b10d7fae687d6e27ad90a9f2d7#r66637007">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFEEj4D8iKCPfmPdaZf_4BpAGCtTdks5qKYhogaJpZM4IvhJu">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFIQBafDLxCTLh-Wl9Bpd_un9QkDxks5qKYhogaJpZM4IvhJu.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/684/files/07879a2cc79b35b10d7fae687d6e27ad90a9f2d7#r66637007"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>