Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think the answer given by willm1 is correct.<br> Let me explain. </p> <p>The following expression:<br> <code>tlf.z &gt;= tlb.z - EPSILON</code><br> is equivalent to:<br> <code>(tlf.z &gt; tlb.z - EPSILON) or (tlf.z == tlb.z - EPSILON)</code></p> <p>If <code>tlf.z &gt; tlb.z</code> is true, even by a difference smaller than EPSILON, then <code>tlf.z &gt; tlb.z - EPSILON</code> will also be true. No matter what the value of EPSILON. Instead, the correct form is:<br> <code>tlf.z &gt; tlb.z + EPSILON</code><br> As for the second expression, <code>tlf.z == tlb.z - EPSILON</code>, it will only be evaluated as true if <code>tlf.z</code> and <code>tlb.z</code> differ exactly by <code>EPSILON</code>, which is not what we want. Instead, we want the difference between them to be less than <code>EPSILON</code>:<br> <code>abs(tlf.z - tlb.z) &lt;= EPSILON</code> </p> <p>Concluding, <code>tlf.z &gt;= tlb.z - EPSILON</code> should be written as:<br> <code>(tlf.z &gt; tlb.z + EPSILON) || (abs(tlf.z - tlb.z) &lt;= EPSILON)</code></p> <p><strong>Update</strong>:<br> I was looking at some code, and all of a sudden I noticed that <code>(tlf.z &gt; tlb.z + EPSILON) || (abs(tlf.z - tlb.z) &lt;= EPSILON)</code> is actually equivalent to <code>tlf.z &gt;= tlb.z - EPSILON</code>.<br> When we're looking for the similarity, <code>abs(tlf.z - tlb.z) &lt;= EPSILON</code>, we want <code>tlb.z</code> to be in the following gray area:<br> <img src="https://dl.dropbox.com/u/8799475/images/sim_2.png" width="400" height="100"><br> When we're looking for <code>tlf.z &gt; tlb.z + EPSILON</code>:<br> <img src="https://dl.dropbox.com/u/8799475/images/greater.png" width="400" height="100"><br> Hence, we're really looking for:<br> <img src="https://dl.dropbox.com/u/8799475/images/result.png" width="400" height="100"><br> Which is the same as <code>tlf.z + EPSILON &gt;= tlb.z</code> (equivalent to <code>tlf.z &gt;= tlb.z - EPSILON</code>).<br> In that case, willm1 was actually right. Sorry :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload