      FUNCTION QAV (X)
C *** SEE R H LANDAU, PROGRAM LPOTT, 1981
      IMPLICIT  REAL*8   (A-H,O-Z)
      COMMON /ENPAUL/ PF,AK,AKD,CSKKD,XI,E,XON
      COMMON /ENQAV/ XIP
C
C     1ST TEST ARGUMENTS
      IF (XIP.LT.1.E-5) GO TO 10
      IF (X.LT.1.E-5) GO TO 10
      IF ((XIP+X).LT.PF) GO TO 10
      IF (ABS(XIP-X).GT.PF) GO TO 10
C
      Y = X+XIP
      Y1 = (Y-PF)*(Y+PF)
      Y = Y1/(4.0*XIP*X)
      QAV = (1.0-Y)
      RETURN
 10   CONTINUE
      PRINT 20, X,XIP,PF
      STOP
C
 20   FORMAT (10H QAV EXIT ,3F20.8)
      END
