title: Should you use '>=' instead of '==' to be extra safe when coding with other types than float?
body: <p>When working with floating-points one should use</p>
  
  <pre><code>a &lt;= 0.0
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>a == 0.0
  </code></pre>
  
  <p>to make sure that you get the desired behaviour, as there is the problem with <a href="https://en.wikipedia.org/wiki/Round-off_error" rel="nofollow noreferrer">round-off errors</a> when using floating-point variables.</p>
  
  <hr>
  
  <p>But when using other variable types like <code>int</code> could it be useful to do the same? Like you have a for loop iterating over an <code>int</code> variable (like an index) and when it gets to a number it should do something. Should you then set the comparison to be <code>&gt;=</code> instead of <code>==</code> when it should result in the same output? Like could there ever be a case where the <code>==</code> is not evaluated in the following case:</p>
  
  <pre><code>for (int i = 0; i &lt; 10; i++)
  {
      if (i == 5)
      {
          break;
      }
  }
  </code></pre>
  
  <p>And that it would be "safer" to do the following instead:</p>
  
  <pre><code>for (int i = 0; i &lt; 10; i++)
  {
      if (i &gt;= 5)
      {
          break;
      }
  }
  </code></pre>
  
  <p>If there is no difference between the two when it comes to coding "safe" is there any performance or readability difference or other thing that can make one choose between the ways to code?</p>
  
  <p>Tried to google this but couldn't find anything stating either way. But that might have to do with the problem with searching for operators.</p>
  
  <p>Am I too paranoid for asking this?</p>