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

◆ dlamch()

double precision function dlamch ( character  cmach)

Definition at line 1 of file dlamch.f.

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