title: int() function in Fortran 77
body: <p>I have come across a problem when I use the <code>int()</code> function. I have an real array <code>mEL</code> and I want to convert some of its components to integers for comparison with real array <code>COORDS</code>. I have to use <code>int()</code> due to rounding errors in <code>COORDS</code> array, so <code>ZERO</code> is not quite zero is <code>3.D-77</code> or similar:</p>
  
  <pre><code>      DO I = 1,nLines
            IF (int(mEL(I,1)).EQ.int(COORDS(1,1)) .AND.
   1              int(mEL(I,2)).EQ.int(COORDS(2,1)) .AND. 
   2              int(mEL(I,3)).EQ.int(COORDS(3,1))) THEN
  
            .....do something
  </code></pre>
  
  <p>The problem is that during the run the outcome of <code>int(COORDS(1,1))</code> changes but the value of <code>COORDS(1,1)</code> is the same. For example:</p>
  
  <pre><code>COORDS(1,1) = 1829.0000000
  </code></pre>
  
  <p>During 1000 runs I get <code>int(COORDS(1,1))=1829</code>. However, after some runs I get:
  <code>int(COORDS(1,1))=1828</code>! but <code>COORDS(1,1)=1829</code>!</p>
  
  <p>Any ideas why this happens?</p>