LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ slamch()

real function slamch ( character  cmach)

SLAMCH

Purpose:
 SLAMCH determines single precision machine parameters.
Parameters
[in]CMACH
          CMACH is CHARACTER*1
          Specifies the value to be returned by SLAMCH:
          = 'E' or 'e',   SLAMCH := eps
          = 'S' or 's ,   SLAMCH := sfmin
          = 'B' or 'b',   SLAMCH := base
          = 'P' or 'p',   SLAMCH := eps*base
          = 'N' or 'n',   SLAMCH := t
          = 'R' or 'r',   SLAMCH := rnd
          = 'M' or 'm',   SLAMCH := emin
          = 'U' or 'u',   SLAMCH := rmin
          = 'L' or 'l',   SLAMCH := emax
          = 'O' or 'o',   SLAMCH := rmax
          where
          eps   = relative machine precision
          sfmin = safe minimum, such that 1/sfmin does not overflow
          base  = base of the machine
          prec  = eps*base
          t     = number of (base) digits in the mantissa
          rnd   = 1.0 when rounding occurs in addition, 0.0 otherwise
          emin  = minimum exponent before (gradual) underflow
          rmin  = underflow threshold - base**(emin-1)
          emax  = largest exponent before overflow
          rmax  = overflow threshold  - (base**emax)*(1-eps)
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 67 of file slamch.f.

68*
69* -- LAPACK auxiliary routine --
70* -- LAPACK is a software package provided by Univ. of Tennessee, --
71* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
72*
73* .. Scalar Arguments ..
74 CHARACTER CMACH
75* ..
76*
77* =====================================================================
78*
79* .. Parameters ..
80 REAL ONE, ZERO
81 parameter( one = 1.0e+0, zero = 0.0e+0 )
82* ..
83* .. Local Scalars ..
84 REAL RND, EPS, SFMIN, SMALL, RMACH
85* ..
86* .. External Functions ..
87 LOGICAL LSAME
88 EXTERNAL lsame
89* ..
90* .. Intrinsic Functions ..
91 INTRINSIC digits, epsilon, huge, maxexponent,
92 $ minexponent, radix, tiny
93* ..
94* .. Executable Statements ..
95*
96*
97* Assume rounding, not chopping. Always.
98*
99 rnd = one
100*
101 IF( one.EQ.rnd ) THEN
102 eps = epsilon(zero) * 0.5
103 ELSE
104 eps = epsilon(zero)
105 END IF
106*
107 IF( lsame( cmach, 'E' ) ) THEN
108 rmach = eps
109 ELSE IF( lsame( cmach, 'S' ) ) THEN
110 sfmin = tiny(zero)
111 small = one / huge(zero)
112 IF( small.GE.sfmin ) THEN
113*
114* Use SMALL plus a bit, to avoid the possibility of rounding
115* causing overflow when computing 1/sfmin.
116*
117 sfmin = small*( one+eps )
118 END IF
119 rmach = sfmin
120 ELSE IF( lsame( cmach, 'B' ) ) THEN
121 rmach = radix(zero)
122 ELSE IF( lsame( cmach, 'P' ) ) THEN
123 rmach = eps * radix(zero)
124 ELSE IF( lsame( cmach, 'N' ) ) THEN
125 rmach = digits(zero)
126 ELSE IF( lsame( cmach, 'R' ) ) THEN
127 rmach = rnd
128 ELSE IF( lsame( cmach, 'M' ) ) THEN
129 rmach = minexponent(zero)
130 ELSE IF( lsame( cmach, 'U' ) ) THEN
131 rmach = tiny(zero)
132 ELSE IF( lsame( cmach, 'L' ) ) THEN
133 rmach = maxexponent(zero)
134 ELSE IF( lsame( cmach, 'O' ) ) THEN
135 rmach = huge(zero)
136 ELSE
137 rmach = zero
138 END IF
139*
140 slamch = rmach
141 RETURN
142*
143* End of SLAMCH
144*
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function: