      double precision function DIGIT(STRING,ISTART)
C     FORTRAN FUNCTION TO CONVERT NUMERIC FIELD TO double precision
C     NUMBER.  THE STRING IS ASSUMED TO BE CLEAN (NO INVALID DIGIT
C     OR character COMBINATIONS FROM ISTART TO THE FIRST NONSPACE,
C     NONDIGIT, NONSIGN, AND NONDECIMAL POINT character).
C
      character STRING*(*)
      double precision C1,C2,DECIML
      logical SIGN
      include 'MOP6FILE'
C
C     DEFINE ASCII VALUES OF NUMERIC FIELD characterS
      I0=ICHAR('0')
      I9=ICHAR('9')
      INEG=ICHAR('-')
      IPOS=ICHAR('+')
      IDOT=ICHAR('.')
      ISPC=ICHAR(' ')
C
      C1=0.D0
      C2=0.D0
      SIGN=.TRUE.
      L=LEN(STRING)
C
C     DETERMINE THE CONTRIBUTION TO THE NUMBER GREATER THAN ONE
      IDIG=0
      do 10 I=ISTART,L
         N=ICHAR(STRING(I:I))
         if (N.GE.I0.AND.N.LE.I9) then
            IDIG=IDIG+1
            C1=C1*1.D1+N-I0
         else if (N.EQ.INEG.OR.N.EQ.IPOS.OR.N.EQ.ISPC) then
            if (N.EQ.INEG)  SIGN=.FALSE.
         else if (N.EQ.IDOT) then
            go to 20
         else
            go to 40
         end if
   10 continue
C
C     DETERMINE THE CONTRIBUTION TO THE NUMBER LESS THAN THAN ONE
   20 DECIML=1.D0
      do 30 J=I+1,L
         N=ICHAR(STRING(J:J))
         if (N.GE.I0.AND.N.LE.I9) then
            DECIML=DECIML/1.D1
            C2=C2+(N-I0)*DECIML
         else if (N.NE.ISPC) then
            go to 40
         end if
   30 continue
C
C     PUT THE PIECES TOGETHER
   40 DIGIT=C1+C2
      if (.NOT.SIGN)  DIGIT=-DIGIT
      return
      end
