      DOUBLE PRECISION FUNCTION D1MACH(I)
      INTEGER SMALL(4)
      INTEGER LARGE(4)
      INTEGER RIGHT(4)
      INTEGER DIVER(4)
      INTEGER LOG10(4)
      DOUBLE PRECISION DMACH(5)
      EQUIVALENCE (DMACH(1),SMALL(1))
      EQUIVALENCE (DMACH(2),LARGE(1))
      EQUIVALENCE (DMACH(3),RIGHT(1))
      EQUIVALENCE (DMACH(4),DIVER(1))
      EQUIVALENCE (DMACH(5),LOG10(1))
      DATA SMALL(1), SMALL(2) / Z'00100000', Z'00000000' /
      DATA LARGE(1), LARGE(2) / Z'7FEFFFFF', Z'FFFFFFFF' /
      DATA RIGHT(1), RIGHT(2) / Z'3CA00000', Z'00000000' /
      DATA DIVER(1), DIVER(2) / Z'3CB00000', Z'00000000' /
      DATA LOG10(1), LOG10(2) / Z'3FD34413', Z'509F79FF' /
      IF(I .LT. 1  .OR.  I .GT. 5)THEN
        CALL ErrWrt ( ' !! Illegal argument ot D1MACH' )
        STOP 'd1mach'
      ENDIF
      LARGE(1)=HUGE(1.D0)
      DMACH(2)=HUGE(1.D0)
      D1MACH = DMACH(I)
      RETURN
      END
