title: OpenMP Working Precision
body: <p>I am having an issue with the simple code bellow. I am trying to use OpenMP with GFortran. The Results of the code bellow for <code>x</code> should be the same with AND without <code>!$OMP</code> statements, since the parallel code and serial code should output the same result.</p>
  
  <pre><code>program test
  implicit none
  !INCLUDE 'omp_lib.h'
  integer i,j
  Real(8) :: x,t1,t2
  
  x=0.0d0
  !$OMP PARALLEL DO PRIVATE(i,j) shared(X)
  Do i=1,3
     Write(*,*) I
     !pause
     Do j=1,10000000
     !$OMP ATOMIC
      X=X+2.d0*Cos(i*j*1.0d0)
     end do
  end do
  !$OMP END PARALLEL Do
  
  write(*,*) x    
  end program test
  </code></pre>
  
  <p>But strangely I am getting the following results for <code>x</code>:</p>
  
  <p>Parallel:<code>-3.17822355415XXXXX</code></p>
  
  <p>Serial:  <code>-3.1782235541569084</code>  </p>
  
  <p>where <code>XXXXX</code> is some random digits. Every time I run the serial code, I get the same result (-3.1782235541569084). How can i fix it? Is this problem due to some OpenMP working precision option?</p>