SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dlamch()

double precision function dlamch ( character  cmach)

Definition at line 9 of file tools.f.

10*
11* -- LAPACK auxiliary routine (version 2.0) --
12* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
13* Courant Institute, Argonne National Lab, and Rice University
14* October 31, 1992
15*
16* .. Scalar Arguments ..
17 CHARACTER CMACH
18* ..
19*
20* Purpose
21* =======
22*
23* DLAMCH determines double precision machine parameters.
24*
25* Arguments
26* =========
27*
28* CMACH (input) CHARACTER*1
29* Specifies the value to be returned by DLAMCH:
30* = 'E' or 'e', DLAMCH := eps
31* = 'S' or 's , DLAMCH := sfmin
32* = 'B' or 'b', DLAMCH := base
33* = 'P' or 'p', DLAMCH := eps*base
34* = 'N' or 'n', DLAMCH := t
35* = 'R' or 'r', DLAMCH := rnd
36* = 'M' or 'm', DLAMCH := emin
37* = 'U' or 'u', DLAMCH := rmin
38* = 'L' or 'l', DLAMCH := emax
39* = 'O' or 'o', DLAMCH := rmax
40*
41* where
42*
43* eps = relative machine precision
44* sfmin = safe minimum, such that 1/sfmin does not overflow
45* base = base of the machine
46* prec = eps*base
47* t = number of (base) digits in the mantissa
48* rnd = 1.0 when rounding occurs in addition, 0.0 otherwise
49* emin = minimum exponent before (gradual) underflow
50* rmin = underflow threshold - base**(emin-1)
51* emax = largest exponent before overflow
52* rmax = overflow threshold - (base**emax)*(1-eps)
53*
54* =====================================================================
55*
56* .. Parameters ..
57 DOUBLE PRECISION ONE, ZERO
58 parameter( one = 1.0d+0, zero = 0.0d+0 )
59* ..
60* .. Local Scalars ..
61 LOGICAL FIRST, LRND
62 INTEGER BETA, IMAX, IMIN, IT
63 DOUBLE PRECISION BASE, EMAX, EMIN, EPS, PREC, RMACH, RMAX, RMIN,
64 $ RND, SFMIN, SMALL, T
65* ..
66* .. External Functions ..
67 LOGICAL LSAME
68 EXTERNAL lsame
69* ..
70* .. External Subroutines ..
71 EXTERNAL dlamc2
72* ..
73* .. Save statement ..
74 SAVE first, eps, sfmin, base, t, rnd, emin, rmin,
75 $ emax, rmax, prec
76* ..
77* .. Data statements ..
78 DATA first / .true. /
79* ..
80* .. Executable Statements ..
81*
82 IF( first ) THEN
83 first = .false.
84 CALL dlamc2( beta, it, lrnd, eps, imin, rmin, imax, rmax )
85 base = beta
86 t = it
87 IF( lrnd ) THEN
88 rnd = one
89 eps = ( base**( 1-it ) ) / 2
90 ELSE
91 rnd = zero
92 eps = base**( 1-it )
93 END IF
94 prec = eps*base
95 emin = imin
96 emax = imax
97 sfmin = rmin
98 small = one / rmax
99 IF( small.GE.sfmin ) THEN
100*
101* Use SMALL plus a bit, to avoid the possibility of rounding
102* causing overflow when computing 1/sfmin.
103*
104 sfmin = small*( one+eps )
105 END IF
106 END IF
107*
108 IF( lsame( cmach, 'E' ) ) THEN
109 rmach = eps
110 ELSE IF( lsame( cmach, 'S' ) ) THEN
111 rmach = sfmin
112 ELSE IF( lsame( cmach, 'B' ) ) THEN
113 rmach = base
114 ELSE IF( lsame( cmach, 'P' ) ) THEN
115 rmach = prec
116 ELSE IF( lsame( cmach, 'N' ) ) THEN
117 rmach = t
118 ELSE IF( lsame( cmach, 'R' ) ) THEN
119 rmach = rnd
120 ELSE IF( lsame( cmach, 'M' ) ) THEN
121 rmach = emin
122 ELSE IF( lsame( cmach, 'U' ) ) THEN
123 rmach = rmin
124 ELSE IF( lsame( cmach, 'L' ) ) THEN
125 rmach = emax
126 ELSE IF( lsame( cmach, 'O' ) ) THEN
127 rmach = rmax
128 END IF
129*
130 dlamch = rmach
131 RETURN
132*
133* End of DLAMCH
134*
logical function lsame(ca, cb)
Definition tools.f:1724
double precision function dlamch(cmach)
Definition tools.f:10
subroutine dlamc2(beta, t, rnd, eps, emin, rmin, emax, rmax)
Definition tools.f:327
Here is the call graph for this function:
Here is the caller graph for this function: