64 DOUBLE PRECISION FUNCTION dlamch( CMACH )
75 DOUBLE PRECISION one, zero
76 parameter( one = 1.0d+0, zero = 0.0d+0 )
80 INTEGER beta, imax, imin, it
81 DOUBLE PRECISION base, emax, emin, eps, prec, rmach, rmax, rmin,
82 $ rnd, sfmin, small, t
92 SAVE first, eps, sfmin, base, t, rnd, emin, rmin,
101 CALL
dlamc2( beta, it, lrnd, eps, imin, rmin, imax, rmax )
106 eps = ( base**( 1-it ) ) / 2
116 IF( small.GE.sfmin )
THEN
121 sfmin = small*( one+eps )
125 IF(
lsame( cmach,
'E' ) )
THEN
127 ELSE IF(
lsame( cmach,
'S' ) )
THEN
129 ELSE IF(
lsame( cmach,
'B' ) )
THEN
131 ELSE IF(
lsame( cmach,
'P' ) )
THEN
133 ELSE IF(
lsame( cmach,
'N' ) )
THEN
135 ELSE IF(
lsame( cmach,
'R' ) )
THEN
137 ELSE IF(
lsame( cmach,
'M' ) )
THEN
139 ELSE IF(
lsame( cmach,
'U' ) )
THEN
141 ELSE IF(
lsame( cmach,
'L' ) )
THEN
143 ELSE IF(
lsame( cmach,
'O' ) )
THEN
219 LOGICAL first, lieee1, lrnd
221 DOUBLE PRECISION a, b, c, f, one, qtr, savec, t1, t2
228 SAVE first, lieee1, lbeta, lrnd, lt
231 DATA first / .true. /
294 f =
dlamc3( b / 2, -b / 100 )
301 f =
dlamc3( b / 2, b / 100 )
303 IF( ( lrnd ) .AND. ( c.EQ.a ) )
313 t2 =
dlamc3( b / 2, savec )
314 lieee1 = ( t1.EQ.a ) .AND. ( t2.GT.savec ) .AND. lrnd
419 SUBROUTINE dlamc2( BETA, T, RND, EPS, EMIN, RMIN, EMAX, RMAX )
427 INTEGER beta, emax, emin, t
428 DOUBLE PRECISION eps, rmax, rmin
433 LOGICAL first, ieee, iwarn, lieee1, lrnd
434 INTEGER gnmin, gpmin, i, lbeta, lemax, lemin, lt,
436 DOUBLE PRECISION a, b, c, half, leps, lrmax, lrmin, one, rbase,
437 $ sixth, small, third, two, zero
447 INTRINSIC abs, max, min
450 SAVE first, iwarn, lbeta, lemax, lemin, leps, lrmax,
454 DATA first / .true. / , iwarn / .false. /
472 CALL
dlamc1( lbeta, lt, lrnd, lieee1 )
484 sixth =
dlamc3( b, -half )
485 third =
dlamc3( sixth, sixth )
486 b =
dlamc3( third, -half )
496 IF( ( leps.GT.b ) .AND. ( b.GT.zero ) )
THEN
498 c =
dlamc3( half*leps, ( two**5 )*( leps**2 ) )
519 small =
dlamc3( small*rbase, zero )
522 CALL
dlamc4( ngpmin, one, lbeta )
523 CALL
dlamc4( ngnmin, -one, lbeta )
524 CALL
dlamc4( gpmin, a, lbeta )
525 CALL
dlamc4( gnmin, -a, lbeta )
528 IF( ( ngpmin.EQ.ngnmin ) .AND. ( gpmin.EQ.gnmin ) )
THEN
529 IF( ngpmin.EQ.gpmin )
THEN
533 ELSE IF( ( gpmin-ngpmin ).EQ.3 )
THEN
534 lemin = ngpmin - 1 + lt
539 lemin = min( ngpmin, gpmin )
544 ELSE IF( ( ngpmin.EQ.gpmin ) .AND. ( ngnmin.EQ.gnmin ) )
THEN
545 IF( abs( ngpmin-ngnmin ).EQ.1 )
THEN
546 lemin = max( ngpmin, ngnmin )
550 lemin = min( ngpmin, ngnmin )
555 ELSE IF( ( abs( ngpmin-ngnmin ).EQ.1 ) .AND.
556 $ ( gpmin.EQ.gnmin ) )
THEN
557 IF( ( gpmin-min( ngpmin, ngnmin ) ).EQ.3 )
THEN
558 lemin = max( ngpmin, ngnmin ) - 1 + lt
562 lemin = min( ngpmin, ngnmin )
568 lemin = min( ngpmin, ngnmin, gpmin, gnmin )
577 WRITE( 6, fmt = 9999 )lemin
586 ieee = ieee .OR. lieee1
593 DO 30 i = 1, 1 - lemin
594 lrmin =
dlamc3( lrmin*rbase, zero )
599 CALL
dlamc5( lbeta, lt, lemin, ieee, lemax, lrmax )
613 9999 format( / /
' WARNING. The value EMIN may be incorrect:-',
615 $
' If, after inspection, the value EMIN looks',
616 $
' acceptable please comment out ',
617 $ /
' the IF block as marked within the code of routine',
618 $
' DLAMC2,', /
' otherwise supply EMIN explicitly.', / )
649 DOUBLE PRECISION a, b
697 DOUBLE PRECISION start
703 DOUBLE PRECISION a, b1, b2, c1, c2, d1, d2, one, rbase, zero
716 b1 =
dlamc3( a*rbase, zero )
724 IF( ( c1.EQ.a ) .AND. ( c2.EQ.a ) .AND. ( d1.EQ.a ) .AND.
728 b1 =
dlamc3( a / base, zero )
729 c1 =
dlamc3( b1*base, zero )
734 b2 =
dlamc3( a*rbase, zero )
735 c2 =
dlamc3( b2 / rbase, zero )
796 SUBROUTINE dlamc5( BETA, P, EMIN, IEEE, EMAX, RMAX )
804 INTEGER beta, emax, emin, p
805 DOUBLE PRECISION rmax
810 DOUBLE PRECISION zero, one
811 parameter( zero = 0.0d0, one = 1.0d0 )
814 INTEGER exbits, expsum, i, lexp, nbits, try, uexp
815 DOUBLE PRECISION oldy, recbas, y, z
835 IF( try.LE.( -emin ) )
THEN
840 IF( lexp.EQ.-emin )
THEN
851 IF( ( uexp+emin ).GT.( -lexp-emin ) )
THEN
860 emax = expsum + emin - 1
861 nbits = 1 + exbits + p
866 IF( ( mod( nbits, 2 ).EQ.1 ) .AND. ( beta.EQ.2 ) )
THEN
911 y =
dlamc3( y*beta, zero )