```001:       SUBROUTINE SRSCL( N, SA, SX, INCX )
002: *
003: *  -- LAPACK auxiliary routine (version 3.2) --
004: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
005: *     November 2006
006: *
007: *     .. Scalar Arguments ..
008:       INTEGER            INCX, N
009:       REAL               SA
010: *     ..
011: *     .. Array Arguments ..
012:       REAL               SX( * )
013: *     ..
014: *
015: *  Purpose
016: *  =======
017: *
018: *  SRSCL multiplies an n-element real vector x by the real scalar 1/a.
019: *  This is done without overflow or underflow as long as
020: *  the final result x/a does not overflow or underflow.
021: *
022: *  Arguments
023: *  =========
024: *
025: *  N       (input) INTEGER
026: *          The number of components of the vector x.
027: *
028: *  SA      (input) REAL
029: *          The scalar a which is used to divide each component of x.
030: *          SA must be >= 0, or the subroutine will divide by zero.
031: *
032: *  SX      (input/output) REAL array, dimension
033: *                         (1+(N-1)*abs(INCX))
034: *          The n-element vector x.
035: *
036: *  INCX    (input) INTEGER
037: *          The increment between successive values of the vector SX.
038: *          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
039: *
040: * =====================================================================
041: *
042: *     .. Parameters ..
043:       REAL               ONE, ZERO
044:       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
045: *     ..
046: *     .. Local Scalars ..
047:       LOGICAL            DONE
048:       REAL               BIGNUM, CDEN, CDEN1, CNUM, CNUM1, MUL, SMLNUM
049: *     ..
050: *     .. External Functions ..
051:       REAL               SLAMCH
052:       EXTERNAL           SLAMCH
053: *     ..
054: *     .. External Subroutines ..
056: *     ..
057: *     .. Intrinsic Functions ..
058:       INTRINSIC          ABS
059: *     ..
060: *     .. Executable Statements ..
061: *
062: *     Quick return if possible
063: *
064:       IF( N.LE.0 )
065:      \$   RETURN
066: *
067: *     Get machine parameters
068: *
069:       SMLNUM = SLAMCH( 'S' )
070:       BIGNUM = ONE / SMLNUM
071:       CALL SLABAD( SMLNUM, BIGNUM )
072: *
073: *     Initialize the denominator to SA and the numerator to 1.
074: *
075:       CDEN = SA
076:       CNUM = ONE
077: *
078:    10 CONTINUE
079:       CDEN1 = CDEN*SMLNUM
080:       CNUM1 = CNUM / BIGNUM
081:       IF( ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) THEN
082: *
083: *        Pre-multiply X by SMLNUM if CDEN is large compared to CNUM.
084: *
085:          MUL = SMLNUM
086:          DONE = .FALSE.
087:          CDEN = CDEN1
088:       ELSE IF( ABS( CNUM1 ).GT.ABS( CDEN ) ) THEN
089: *
090: *        Pre-multiply X by BIGNUM if CDEN is small compared to CNUM.
091: *
092:          MUL = BIGNUM
093:          DONE = .FALSE.
094:          CNUM = CNUM1
095:       ELSE
096: *
097: *        Multiply X by CNUM / CDEN and return.
098: *
099:          MUL = CNUM / CDEN
100:          DONE = .TRUE.
101:       END IF
102: *
103: *     Scale the vector X by MUL
104: *
105:       CALL SSCAL( N, MUL, SX, INCX )
106: *
107:       IF( .NOT.DONE )
108:      \$   GO TO 10
109: *
110:       RETURN
111: *
112: *     End of SRSCL
113: *
114:       END
115: ```