Create a 5 cent variance + - in bigdecimal comparison
<p>We are calculating totals from percentages that must match up to the original total. However do to floating points, the the totals never match. </p>

<p>Example. </p>

<p>Total percentage is calculated from 327.81</p>

<p>Example of non rounded amounts</p>

<pre><code>30%     98.343
20%     65.562
30%     98.343
20%     65.562
Total  327.81 
</code></pre>

<p>Example of rounded amounts</p>

<pre><code>30% 98.34
20% 65.56
30% 98.34
20% 65.56
Total 327.80 
</code></pre>

<p>My amounts need to be rounded to a currency format, however you'll notice the rounded amount is 1 cent off 327.80 from being equal to our original amount of 327.81</p>

<p>In the end, I need to validate these two amounts are equal to each other - which obviously isn't going to validate. I've been told by management to add a .05 variance to my logic. I'm able to compare to values equal to each other, however I'm not certain how to add the variance into the equation. Could someone help me to figure out how to add this into my condition. </p>

<p>This is my current code comparing that they are equal to each other. </p>

<pre><code>if (   this.pr.getRequisitionTotal() != null 
    &amp;&amp; this.pr.getRequisitionTotal().compareTo(lineItemTotal) != 0
    &amp;&amp; this.reviewedAuditActions()) 
{
    this.form.recordError("Requisition total must equal line item running total.");
}
</code></pre>
