/*< REAL FUNCTION SLAMCH( CMACH ) >*/ doublereal slamch_(char *cmach, ftnlen cmach_len) { /* Initialized data */ static logical first = TRUE_; /* runtime-initialized constant */ /* System generated locals */ integer i__1; real ret_val; /* Builtin functions */ double pow_ri(real *, integer *); /* Local variables */ static real t; /* runtime-initialized constant */ integer it; static real rnd, eps, base; /* runtime-initialized constant */ integer beta; static real emin, prec, emax; /* runtime-initialized constant */ integer imin, imax; logical lrnd; static real rmin, rmax; /* runtime-initialized constant */ real rmach=0; extern logical lsame_(const char *, const char *, ftnlen, ftnlen); real small; static real sfmin; /* runtime-initialized constant */ extern /* Subroutine */ int slamc2_(integer *, integer *, logical *, real *, integer *, real *, integer *, real *); (void)cmach_len; /* -- LAPACK auxiliary routine (version 1.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */ /* Courant Institute, Argonne National Lab, and Rice University */ /* October 31, 1992 */ /* .. Scalar Arguments .. */ /*< CHARACTER CMACH >*/ /* .. */ /* Purpose */ /* ======= */ /* SLAMCH determines single precision machine parameters. */ /* Arguments */ /* ========= */ /* CMACH (input) 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) */ /* ===================================================================== */ /* .. Parameters .. */ /*< REAL ONE, ZERO >*/ /*< PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) >*/ /* .. */ /* .. Local Scalars .. */ /*< LOGICAL FIRST, LRND >*/ /*< INTEGER BETA, IMAX, IMIN, IT >*/ /*< >*/ /* .. */ /* .. External Functions .. */ /*< LOGICAL LSAME >*/ /*< EXTERNAL LSAME >*/ /* .. */ /* .. External Subroutines .. */ /*< EXTERNAL SLAMC2 >*/ /* .. */ /* .. Save statement .. */ /*< >*/ /* .. */ /* .. Data statements .. */ /*< DATA FIRST / .TRUE. / >*/ /* .. */ /* .. Executable Statements .. */ /*< IF( FIRST ) THEN >*/ if (first) { /*< FIRST = .FALSE. >*/ first = FALSE_; /*< CALL SLAMC2( BETA, IT, LRND, EPS, IMIN, RMIN, IMAX, RMAX ) >*/ slamc2_(&beta, &it, &lrnd, &eps, &imin, &rmin, &imax, &rmax); /*< BASE = BETA >*/ base = (real) beta; /*< T = IT >*/ t = (real) it; /*< IF( LRND ) THEN >*/ if (lrnd) { /*< RND = ONE >*/ rnd = (float)1.; /*< EPS = ( BASE**( 1-IT ) ) / 2 >*/ i__1 = 1 - it; eps = pow_ri(&base, &i__1) / 2; /*< ELSE >*/ } else { /*< RND = ZERO >*/ rnd = (float)0.; /*< EPS = BASE**( 1-IT ) >*/ i__1 = 1 - it; eps = pow_ri(&base, &i__1); /*< END IF >*/ } /*< PREC = EPS*BASE >*/ prec = eps * base; /*< EMIN = IMIN >*/ emin = (real) imin; /*< EMAX = IMAX >*/ emax = (real) imax; /*< SFMIN = RMIN >*/ sfmin = rmin; /*< SMALL = ONE / RMAX >*/ small = (float)1. / rmax; /*< IF( SMALL.GE.SFMIN ) THEN >*/ if (small >= sfmin) { /* Use SMALL plus a bit, to avoid the possibility of rounding */ /* causing overflow when computing 1/sfmin. */ /*< SFMIN = SMALL*( ONE+EPS ) >*/ sfmin = small * (eps + (float)1.); /*< END IF >*/ } /*< END IF >*/ } /*< IF( LSAME( CMACH, 'E' ) ) THEN >*/ if (lsame_(cmach, "E", (ftnlen)1, (ftnlen)1)) { /*< RMACH = EPS >*/ rmach = eps; /*< ELSE IF( LSAME( CMACH, 'S' ) ) THEN >*/ } else if (lsame_(cmach, "S", (ftnlen)1, (ftnlen)1)) { /*< RMACH = SFMIN >*/ rmach = sfmin; /*< ELSE IF( LSAME( CMACH, 'B' ) ) THEN >*/ } else if (lsame_(cmach, "B", (ftnlen)1, (ftnlen)1)) { /*< RMACH = BASE >*/ rmach = base; /*< ELSE IF( LSAME( CMACH, 'P' ) ) THEN >*/ } else if (lsame_(cmach, "P", (ftnlen)1, (ftnlen)1)) { /*< RMACH = PREC >*/ rmach = prec; /*< ELSE IF( LSAME( CMACH, 'N' ) ) THEN >*/ } else if (lsame_(cmach, "N", (ftnlen)1, (ftnlen)1)) { /*< RMACH = T >*/ rmach = t; /*< ELSE IF( LSAME( CMACH, 'R' ) ) THEN >*/ } else if (lsame_(cmach, "R", (ftnlen)1, (ftnlen)1)) { /*< RMACH = RND >*/ rmach = rnd; /*< ELSE IF( LSAME( CMACH, 'M' ) ) THEN >*/ } else if (lsame_(cmach, "M", (ftnlen)1, (ftnlen)1)) { /*< RMACH = EMIN >*/ rmach = emin; /*< ELSE IF( LSAME( CMACH, 'U' ) ) THEN >*/ } else if (lsame_(cmach, "U", (ftnlen)1, (ftnlen)1)) { /*< RMACH = RMIN >*/ rmach = rmin; /*< ELSE IF( LSAME( CMACH, 'L' ) ) THEN >*/ } else if (lsame_(cmach, "L", (ftnlen)1, (ftnlen)1)) { /*< RMACH = EMAX >*/ rmach = emax; /*< ELSE IF( LSAME( CMACH, 'O' ) ) THEN >*/ } else if (lsame_(cmach, "O", (ftnlen)1, (ftnlen)1)) { /*< RMACH = RMAX >*/ rmach = rmax; /*< END IF >*/ } /*< SLAMCH = RMACH >*/ ret_val = rmach; /*< RETURN >*/ return ret_val; /* End of SLAMCH */ /*< END >*/ } /* slamch_ */
/*! \brief <pre> Purpose ======= SLAMCH determines single precision machine parameters. Arguments ========= CMACH (input) 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) ===================================================================== </pre> */ float slamch_(char *cmach) { /* >>Start of File<< Initialized data */ static int first = TRUE_; /* System generated locals */ int i__1; float ret_val; /* Builtin functions */ double pow_ri(float *, int *); /* Local variables */ static float base; static int beta; static float emin, prec, emax; static int imin, imax; static int lrnd; static float rmin, rmax, t, rmach; extern int lsame_(char *, char *); static float small, sfmin; extern /* Subroutine */ int slamc2_(int *, int *, int *, float *, int *, float *, int *, float *); static int it; static float rnd, eps; if (first) { first = FALSE_; slamc2_(&beta, &it, &lrnd, &eps, &imin, &rmin, &imax, &rmax); base = (float) beta; t = (float) it; if (lrnd) { rnd = 1.f; i__1 = 1 - it; eps = pow_ri(&base, &i__1) / 2; } else { rnd = 0.f; i__1 = 1 - it; eps = pow_ri(&base, &i__1); } prec = eps * base; emin = (float) imin; emax = (float) imax; sfmin = rmin; small = 1.f / rmax; if (small >= sfmin) { /* Use SMALL plus a bit, to avoid the possibility of rou nding causing overflow when computing 1/sfmin. */ sfmin = small * (eps + 1.f); } } if (lsame_(cmach, "E")) { rmach = eps; } else if (lsame_(cmach, "S")) { rmach = sfmin; } else if (lsame_(cmach, "B")) { rmach = base; } else if (lsame_(cmach, "P")) { rmach = prec; } else if (lsame_(cmach, "N")) { rmach = t; } else if (lsame_(cmach, "R")) { rmach = rnd; } else if (lsame_(cmach, "M")) { rmach = emin; } else if (lsame_(cmach, "U")) { rmach = rmin; } else if (lsame_(cmach, "L")) { rmach = emax; } else if (lsame_(cmach, "O")) { rmach = rmax; } ret_val = rmach; return ret_val; /* End of SLAMCH */ } /* slamch_ */
doublereal slamch_(char *cmach) { /* -- 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 ======= SLAMCH determines single precision machine parameters. Arguments ========= CMACH (input) 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) ===================================================================== */ /* >>Start of File<< Initialized data */ static logical first = TRUE_; /* System generated locals */ integer i__1; real ret_val; /* Builtin functions */ double pow_ri(real *, integer *); /* Local variables */ static real base; static integer beta; static real emin, prec, emax; static integer imin, imax; static logical lrnd; static real rmin, rmax, t, rmach; extern logical lsame_(char *, char *); static real small, sfmin; extern /* Subroutine */ int slamc2_(integer *, integer *, logical *, real *, integer *, real *, integer *, real *); static integer it; static real rnd, eps; if (first) { first = FALSE_; slamc2_(&beta, &it, &lrnd, &eps, &imin, &rmin, &imax, &rmax); base = (real) beta; t = (real) it; if (lrnd) { rnd = 1.f; i__1 = 1 - it; eps = pow_ri(&base, &i__1) / 2; } else { rnd = 0.f; i__1 = 1 - it; eps = pow_ri(&base, &i__1); } prec = eps * base; emin = (real) imin; emax = (real) imax; sfmin = rmin; small = 1.f / rmax; if (small >= sfmin) { /* Use SMALL plus a bit, to avoid the possibility of rou nding causing overflow when computing 1/sfmin. */ sfmin = small * (eps + 1.f); } } if (lsame_(cmach, "E")) { rmach = eps; } else if (lsame_(cmach, "S")) { rmach = sfmin; } else if (lsame_(cmach, "B")) { rmach = base; } else if (lsame_(cmach, "P")) { rmach = prec; } else if (lsame_(cmach, "N")) { rmach = t; } else if (lsame_(cmach, "R")) { rmach = rnd; } else if (lsame_(cmach, "M")) { rmach = emin; } else if (lsame_(cmach, "U")) { rmach = rmin; } else if (lsame_(cmach, "L")) { rmach = emax; } else if (lsame_(cmach, "O")) { rmach = rmax; } ret_val = rmach; return ret_val; /* End of SLAMCH */ } /* slamch_ */
doublereal slamch_(char *cmach) { /* Initialized data */ static logical first = TRUE_; /* System generated locals */ integer i__1; real ret_val; /* Builtin functions */ double pow_ri(real *, integer *); /* Local variables */ static real t; integer it; static real rnd, eps, base; integer beta; static real emin, prec, emax; integer imin, imax; logical lrnd; static real rmin, rmax; real rmach; extern logical lsame_(char *, char *); real small; static real sfmin; extern /* Subroutine */ int slamc2_(integer *, integer *, logical *, real *, integer *, real *, integer *, real *); /* -- LAPACK auxiliary routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* SLAMCH determines single precision machine parameters. */ /* Arguments */ /* ========= */ /* CMACH (input) 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) */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Save statement .. */ /* .. */ /* .. Data statements .. */ /* .. */ /* .. Executable Statements .. */ if (first) { slamc2_(&beta, &it, &lrnd, &eps, &imin, &rmin, &imax, &rmax); base = (real) beta; t = (real) it; if (lrnd) { rnd = 1.f; i__1 = 1 - it; eps = pow_ri(&base, &i__1) / 2; } else { rnd = 0.f; i__1 = 1 - it; eps = pow_ri(&base, &i__1); } prec = eps * base; emin = (real) imin; emax = (real) imax; sfmin = rmin; small = 1.f / rmax; if (small >= sfmin) { /* Use SMALL plus a bit, to avoid the possibility of rounding */ /* causing overflow when computing 1/sfmin. */ sfmin = small * (eps + 1.f); } } if (lsame_(cmach, "E")) { rmach = eps; } else if (lsame_(cmach, "S")) { rmach = sfmin; } else if (lsame_(cmach, "B")) { rmach = base; } else if (lsame_(cmach, "P")) { rmach = prec; } else if (lsame_(cmach, "N")) { rmach = t; } else if (lsame_(cmach, "R")) { rmach = rnd; } else if (lsame_(cmach, "M")) { rmach = emin; } else if (lsame_(cmach, "U")) { rmach = rmin; } else if (lsame_(cmach, "L")) { rmach = emax; } else if (lsame_(cmach, "O")) { rmach = rmax; } ret_val = rmach; first = FALSE_; return ret_val; /* End of SLAMCH */ } /* slamch_ */