1       SUBROUTINE DLABAD( SMALL, LARGE )
 2 *
 3 *  -- LAPACK auxiliary routine (version 3.2) --
 4 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
 5 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
 6 *     November 2006
 7 *
 8 *     .. Scalar Arguments ..
 9       DOUBLE PRECISION   LARGE, SMALL
10 *     ..
11 *
12 *  Purpose
13 *  =======
14 *
15 *  DLABAD takes as input the values computed by DLAMCH for underflow and
16 *  overflow, and returns the square root of each of these values if the
17 *  log of LARGE is sufficiently large.  This subroutine is intended to
18 *  identify machines with a large exponent range, such as the Crays, and
19 *  redefine the underflow and overflow limits to be the square roots of
20 *  the values computed by DLAMCH.  This subroutine is needed because
21 *  DLAMCH does not compensate for poor arithmetic in the upper half of
22 *  the exponent range, as is found on a Cray.
23 *
24 *  Arguments
25 *  =========
26 *
27 *  SMALL   (input/output) DOUBLE PRECISION
28 *          On entry, the underflow threshold as computed by DLAMCH.
29 *          On exit, if LOG10(LARGE) is sufficiently large, the square
30 *          root of SMALL, otherwise unchanged.
31 *
32 *  LARGE   (input/output) DOUBLE PRECISION
33 *          On entry, the overflow threshold as computed by DLAMCH.
34 *          On exit, if LOG10(LARGE) is sufficiently large, the square
35 *          root of LARGE, otherwise unchanged.
36 *
37 *  =====================================================================
38 *
39 *     .. Intrinsic Functions ..
40       INTRINSIC          LOG10SQRT
41 *     ..
42 *     .. Executable Statements ..
43 *
44 *     If it looks like we're on a Cray, take the square root of
45 *     SMALL and LARGE to avoid overflow and underflow problems.
46 *
47       IFLOG10( LARGE ).GT.2000.D0 ) THEN
48          SMALL = SQRT( SMALL )
49          LARGE = SQRT( LARGE )
50       END IF
51 *
52       RETURN
53 *
54 *     End of DLABAD
55 *
56       END