      REAL FUNCTION XREAL ( CLINE, NBEG, NLEN, IERR)
C
C     CONVERT A NUMERIC STRING OF CHARACTERS TO A REAL NUMBER
C     EXPONENTIAL NUMBERS ALLOWED (BUT BE CAREFUL)
C
C     INPUT:
C         NBEG - BEGINNING CHARACTER LOCATION
C         NLEN - NUMBER OF CHARACTERS TO BE CONVERTED
C         IERR - STATUS; 0 = OK, -1 = ERROR OCCURED
C
C     OUTPUT:
C         XREAL - REAL NUMBER FOUND (-1.0 IF ERROR)
C
      CHARACTER CLINE*(*), CFORMT*7
C
C
      IERR = 0
C
C     CHECK FOR ERROR CONDITION
      IF ((NBEG.LE.0).OR.(NLEN.LT.0).OR.(NLEN.GT.99)) GO TO 900
C
      IF (NLEN.LT.10) THEN
      WRITE ( CFORMT, 10, ERR=900) NLEN
 10   FORMAT (I3)
      CFORMT(4:7) = '.0) '
      ELSE
      WRITE ( CFORMT, 20, ERR=900) NLEN
 20   FORMAT (I4)
      CFORMT(5:7) = '.0)'
      ENDIF
      CFORMT(1:2) = '(F'
C
      NEND = NBEG + NLEN - 1
      READ ( CLINE(NBEG:NEND), CFORMT, ERR=900) XREAL
      RETURN
C
 900  CONTINUE
      IERR = -1
      XREAL = -1.0
      RETURN
      END
