<p>In <a href="https://github.com/mlpack/mlpack/pull/650#discussion_r65364427">src/mlpack/tests/split_data_test.cpp</a>:</p>
<pre style='color:#555'>&gt; @@ -41,6 +41,22 @@ void CompareData(const mat&amp; inputData,
&gt;    }
&gt;  }
&gt;  
&gt; +void CheckMatEqual(const mat&amp; inputData,
&gt; +                   const mat&amp; compareData)
&gt; +{
&gt; +  const mat&amp; sortedInput = arma::sort(inputData, &quot;ascend&quot;, 1);
&gt; +  const mat&amp; sortedCompare = arma::sort(compareData, &quot;ascend&quot;, 1);
&gt; +  for (size_t i = 0; i &lt; sortedInput.n_cols; ++i)
&gt; +  {
&gt; +    const mat&amp; lhsCol = sortedInput.col(i);
&gt; +    const mat&amp; rhsCol = sortedCompare.col(i);
&gt; +    for (size_t j = 0; j &lt; lhsCol.n_rows; ++j)
&gt; +    {
&gt; +      BOOST_REQUIRE_CLOSE(lhsCol(j), rhsCol(j), 1e-5);
</pre>
<p>This can fail for very small values, I like to use</p>

<pre><code>if (std::abs(rhsCol(j)) &lt; 1e-5)
  BOOST_REQUIRE_SMALL(lhsCol(j), 1e-5);
else
  BOOST_REQUIRE_CLOSE(lhsCol(j), rhsCol(j), 1e-5);
</code></pre>

<p>This is a nice utility function that we could probably use, though.  Actually now that I am thinking about it more... I wonder what would be necessary for us to be able to write <code>BOOST_REQUIRE_CLOSE(lhs, rhs, 1e-5)</code> and get the comparison here?  I dunno if that is worth taking the time to figure out though :)</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/650/files/8ad3b900bba6c8535ad94b5af31aaab1de0c64d1#r65364427">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFIo1vxgdNEP4oDQc2QDB2ycWedHCks5qHY-_gaJpZM4IneDD">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFMDnrQzrWQGmZqzSiIA13tCDW-VBks5qHY-_gaJpZM4IneDD.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/650/files/8ad3b900bba6c8535ad94b5af31aaab1de0c64d1#r65364427"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>