      SUBROUTINE MINMAX (A, LGTH, CNST, SMIN, SMAX, IFCN, N)
      DIMENSION A(LGTH), CNST(4)
      SMIN = A(1)
      SMAX = A(1)
      DO 25 I=2,LGTH
      IF (A(I).GT.SMAX)  SMAX = A(I)
      IF (A(I).LT.SMIN)  SMIN = A(I)
25    CONTINUE
C
C     IF IFCN IS EQUAL TO 1, CNST SUPPLIED
C     IF IFCN IS NOT EQUAL TO 1, CNST CALCULATED WITH SMIN AND SMAX
C
      IF (IFCN.EQ.1)  RETURN
      SCALE = ABS(SMAX)
      IF (ABS(SMIN).GT.SCALE)  SCALE = ABS(SMIN)
      IF (SCALE.NE.0.0)  GO TO 1
      CNST(1) = 0.0
      CNST(2) = 0.0
      CNST(3) = 0.0
      CNST(4) = 0.0
      WRITE(6,100) SCALE
100   FORMAT (1H0, 'SCALE = ', E10.3)
      RETURN
1     CONTINUE
      CNST(1) = 0.0
      CNST(2) = 9999./SCALE
      CNST(3) = (SMAX-SMIN)/N * CNST(2)
      CNST(4) = 0.
      RETURN
      END
