title: Rounding large floats to integer
body: <p>In Fortran, I want to be able to round a large double precision float to the nearest integer. I attempt this as follows,</p>
  
  <pre><code>PROGRAM rounding
  IMPLICIT NONE
  INTEGER, PARAMETER :: DP = 8
  REAL(KIND=DP) :: value
  
  value = 12345678987.123456
  
  print *, CEILING(value)
  
  END PROGRAM ROUNDING 
  </code></pre>
  
  <p>However, this does not output the correct answer, but instead gives <code>-2147483648</code>. I appreciate that this is related to the nature and precision of floating points, but rounding a number like this seems a reasonable goal.</p>
  
  <p>Can anyone point me in the right direction?</p>