      DOUBLE PRECISION FUNCTION ROUND (X)
      IMPLICIT NONE
C
      DOUBLE PRECISION X
C
      DOUBLE PRECISION Y, Z, E, H
C
      DATA H / 1.0D9 /
C
C
      Z = DABS (X)
      Y = Z+1.0D0
      IF (Y.EQ.Z) GO TO 40
      Y = 0.0D0
      E = H
10    CONTINUE
      IF (E.GE.Z) GO TO 20
      E = 2.0D0*E
      GO TO 10
C
20    CONTINUE
      IF (E.LE.H) GO TO 30
      IF (E.LE.Z) Y = Y+E
      IF (E.LE.Z) Z = Z-E
      E = E/2.0D0
      GO TO 20
C
30    CONTINUE
      Z = IDINT (Z+0.5D0)
      Y = Y+Z
      IF (X.LT.0.0D0) Y = -Y
      ROUND = Y
      RETURN
C
40    CONTINUE
      ROUND = X
C
      RETURN
      END
