dlamch.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 877 行 · 第 1/5 页
HTML
877 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dlamch.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
DOUBLE PRECISION FUNCTION <a name="DLAMCH.1"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( CMACH )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER CMACH
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="DLAMCH.14"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> determines double precision machine parameters.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> CMACH (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies the value to be returned by <a name="DLAMCH.20"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>:
</span><span class="comment">*</span><span class="comment"> = 'E' or 'e', <a name="DLAMCH.21"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := eps
</span><span class="comment">*</span><span class="comment"> = 'S' or 's , <a name="DLAMCH.22"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := sfmin
</span><span class="comment">*</span><span class="comment"> = 'B' or 'b', <a name="DLAMCH.23"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := base
</span><span class="comment">*</span><span class="comment"> = 'P' or 'p', <a name="DLAMCH.24"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := eps*base
</span><span class="comment">*</span><span class="comment"> = 'N' or 'n', <a name="DLAMCH.25"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := t
</span><span class="comment">*</span><span class="comment"> = 'R' or 'r', <a name="DLAMCH.26"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := rnd
</span><span class="comment">*</span><span class="comment"> = 'M' or 'm', <a name="DLAMCH.27"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := emin
</span><span class="comment">*</span><span class="comment"> = 'U' or 'u', <a name="DLAMCH.28"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := rmin
</span><span class="comment">*</span><span class="comment"> = 'L' or 'l', <a name="DLAMCH.29"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := emax
</span><span class="comment">*</span><span class="comment"> = 'O' or 'o', <a name="DLAMCH.30"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> := rmax
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> eps = relative machine precision
</span><span class="comment">*</span><span class="comment"> sfmin = safe minimum, such that 1/sfmin does not overflow
</span><span class="comment">*</span><span class="comment"> base = base of the machine
</span><span class="comment">*</span><span class="comment"> prec = eps*base
</span><span class="comment">*</span><span class="comment"> t = number of (base) digits in the mantissa
</span><span class="comment">*</span><span class="comment"> rnd = 1.0 when rounding occurs in addition, 0.0 otherwise
</span><span class="comment">*</span><span class="comment"> emin = minimum exponent before (gradual) underflow
</span><span class="comment">*</span><span class="comment"> rmin = underflow threshold - base**(emin-1)
</span><span class="comment">*</span><span class="comment"> emax = largest exponent before overflow
</span><span class="comment">*</span><span class="comment"> rmax = overflow threshold - (base**emax)*(1-eps)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> DOUBLE PRECISION ONE, ZERO
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL FIRST, LRND
INTEGER BETA, IMAX, IMIN, IT
DOUBLE PRECISION BASE, EMAX, EMIN, EPS, PREC, RMACH, RMAX, RMIN,
$ RND, SFMIN, SMALL, T
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.58"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.59"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="DLAMC2.62"></a><a href="dlamch.f.html#DLAMC2.316">DLAMC2</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Save statement ..
</span> SAVE FIRST, EPS, SFMIN, BASE, T, RND, EMIN, RMIN,
$ EMAX, RMAX, PREC
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Data statements ..
</span> DATA FIRST / .TRUE. /
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span> IF( FIRST ) THEN
CALL <a name="DLAMC2.74"></a><a href="dlamch.f.html#DLAMC2.316">DLAMC2</a>( BETA, IT, LRND, EPS, IMIN, RMIN, IMAX, RMAX )
BASE = BETA
T = IT
IF( LRND ) THEN
RND = ONE
EPS = ( BASE**( 1-IT ) ) / 2
ELSE
RND = ZERO
EPS = BASE**( 1-IT )
END IF
PREC = EPS*BASE
EMIN = IMIN
EMAX = IMAX
SFMIN = RMIN
SMALL = ONE / RMAX
IF( SMALL.GE.SFMIN ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use SMALL plus a bit, to avoid the possibility of rounding
</span><span class="comment">*</span><span class="comment"> causing overflow when computing 1/sfmin.
</span><span class="comment">*</span><span class="comment">
</span> SFMIN = SMALL*( ONE+EPS )
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( <a name="LSAME.98"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'E'</span> ) ) THEN
RMACH = EPS
ELSE IF( <a name="LSAME.100"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'S'</span> ) ) THEN
RMACH = SFMIN
ELSE IF( <a name="LSAME.102"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'B'</span> ) ) THEN
RMACH = BASE
ELSE IF( <a name="LSAME.104"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'P'</span> ) ) THEN
RMACH = PREC
ELSE IF( <a name="LSAME.106"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'N'</span> ) ) THEN
RMACH = T
ELSE IF( <a name="LSAME.108"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'R'</span> ) ) THEN
RMACH = RND
ELSE IF( <a name="LSAME.110"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'M'</span> ) ) THEN
RMACH = EMIN
ELSE IF( <a name="LSAME.112"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'U'</span> ) ) THEN
RMACH = RMIN
ELSE IF( <a name="LSAME.114"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'L'</span> ) ) THEN
RMACH = EMAX
ELSE IF( <a name="LSAME.116"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( CMACH, <span class="string">'O'</span> ) ) THEN
RMACH = RMAX
END IF
<span class="comment">*</span><span class="comment">
</span> <a name="DLAMCH.120"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a> = RMACH
FIRST = .FALSE.
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="DLAMCH.124"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>
</span><span class="comment">*</span><span class="comment">
</span> END
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">***********************************************************************
</span><span class="comment">*</span><span class="comment">
</span><a name="DLAMC1.130"></a> SUBROUTINE <a name="DLAMC1.130"></a><a href="dlamch.f.html#DLAMC1.130">DLAMC1</a>( BETA, T, RND, IEEE1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> LOGICAL IEEE1, RND
INTEGER BETA, T
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="DLAMC1.144"></a><a href="dlamch.f.html#DLAMC1.130">DLAMC1</a> determines the machine parameters given by BETA, T, RND, and
</span><span class="comment">*</span><span class="comment"> IEEE1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> BETA (output) INTEGER
</span><span class="comment">*</span><span class="comment"> The base of the machine.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> T (output) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of ( BETA ) digits in the mantissa.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RND (output) LOGICAL
</span><span class="comment">*</span><span class="comment"> Specifies whether proper rounding ( RND = .TRUE. ) or
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?