title: Fast floating-point numbers equality comparison in Fortran
body: <p>I'm using gfortran and I'm starting to write a new program that I know will have billions and billions of float equality checks (think "Monte-Carlo simulation"). And I need to know if two real numbers are "close enough". </p>
  
  <p>It could be a simple number (<code>a == b</code>) or 2D/3D points, and even complex numbers. (I'll mostly do simple numbers, however.)</p>
  
  <p>Are you aware of a gfortran intrinsic that could help me here, or a perhaps a function in BLAS/LAPACK that could do the trick. Or maybe some neat (possibly non portable) trick for blazing fast comparison? 
  An epsilon of 0.0001 should be enough for me, but maybe there is a magic number that gfortran on x86_64 could optimize with bitwise operation.</p>
  
  <p>I don't really know and google couldn't find a solution for me. Can you ?</p>
  
  <p>If you're not aware of a neat trick, what do you think would be the fastest implementation of the traditional <code>abs(a-b) &lt;= epsilon</code>? Or is it simply the fastest and there is nothing I can do about it? (luckily it's a "pure" function so it will probably be inlined)</p>