dlamch
C DLAMCH SOURCE PV090527 24/01/19 21:15:03 11827 * * -- LAPACK auxiliary routine (version 2.0) -- * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., * Courant Institute, Argonne National Lab, and Rice University * October 31, 1992 * * * Purpose * ======= * * DLAMCH determines REAL*8 machine parameters. * * Arguments * ========= * * CMACH (input) CHARACTER*1 * Specifies the value to be returned by DLAMCH: * = 'E' or 'e', DLAMCH := eps * = 'S' or 's , DLAMCH := sfmin * = 'B' or 'b', DLAMCH := base * = 'P' or 'p', DLAMCH := eps*base * = 'N' or 'n', DLAMCH := t * = 'R' or 'r', DLAMCH := rnd * = 'M' or 'm', DLAMCH := emin * = 'U' or 'u', DLAMCH := rmin * = 'L' or 'l', DLAMCH := emax * = 'O' or 'o', DLAMCH := 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) * * ===================================================================== ************************************************************************ *Note: la fonction a ete entierement revue pour etre compatible avec le *script compil.sh (utilisation de fonctions intrinsèques au fortran 95) ************************************************************************ IMPLICIT INTEGER(I-N) IMPLICIT REAL*8(A-H,O-Z) -INC CCREEL -INC PPARAM -INC CCOPTIO CHARACTER CMACH REAL*8 SMALL REAL*8 EPS,RND,SFMIN REAL*8 SFMIN1,SFMIN2,SFMIN4,SFMIN10 REAL*8 ONE PARAMETER (ONE = 1.D0) RND=ONE IF (ONE .EQ. RND) THEN c EPS=EPSILON(XZERO)*0.5D0 EPS=XZPREC*0.5D0 ELSE c EPS=EPSILON(XZERO) EPS=XZPREC ENDIF IF (CMACH .EQ. 'E' .OR. CMACH .EQ. 'e') THEN LAMCH=EPS ELSEIF (CMACH .EQ. 'S'.OR. CMACH .EQ. 's') THEN c SFMIN=TINY(XZERO) SFMIN=XPETIT c SMALL = ONE / HUGE(XZERO) SMALL=XPETIT IF (SMALL .GE. SFMIN) THEN SFMIN=SMALL*( ONE + EPS ) c SFMIN=SMALL*( ONE + XZPREC ) ENDIF LAMCH=SFMIN ELSEIF (CMACH .EQ. 'B'.OR. CMACH .EQ. 'b') THEN c LAMCH=RADIX(XZERO) LAMCH=2.D0 ELSEIF (CMACH .EQ. 'P'.OR. CMACH .EQ. 'p') THEN c LAMCH=EPSILON(XZERO)*RADIX(XZERO) LAMCH=XZPREC*2.D0 ************************************************************************ *Les options qui suivent sont mises en commentaire car impliquent du *fortran 95 ************************************************************************ c ELSEIF (CMACH .EQ. 'N'.OR. CMACH .EQ. 'n') THEN c c LAMCH=DIGITS(XZERO) c c ELSEIF (CMACH .EQ. 'R'.OR. CMACH .EQ. 'r') THEN c c LAMCH=MINEXPONENT(XZERO) c c ELSEIF (CMACH .EQ. 'M'.OR. CMACH .EQ. 'm') THEN c c LAMCH=TINY(XZERO) c c ELSEIF (CMACH .EQ. 'U'.OR. CMACH .EQ. 'u') THEN c c LAMCH=MINEXPONENT(XZERO) c c ELSEIF (CMACH .EQ. 'L'.OR. CMACH .EQ. 'l') THEN c c LAMCH=MAXEXPONENT(XZERO) ELSEIF (CMACH .EQ. 'O'.OR. CMACH .EQ. 'o') THEN c LAMCH=HUGE(XZERO) LAMCH=XGRAND ELSE LAMCH=XZERO write(*,*) 'DLAMCH(',CMACH,')= non prévu !' ENDIF DLAMCH=LAMCH RETURN END
© Cast3M 2003 - Tous droits réservés.
Mentions légales