68 REAL FUNCTION slamch( CMACH )
80 parameter( one = 1.0e+0, zero = 0.0e+0 )
84 INTEGER beta, imax, imin, it
85 REAL base, emax, emin, eps, prec, rmach, rmax, rmin,
86 $ rnd, sfmin, small, t
96 SAVE first, eps, sfmin, base, t, rnd, emin, rmin,
100 DATA first / .true. /
105 CALL
slamc2( beta, it, lrnd, eps, imin, rmin, imax, rmax )
110 eps = ( base**( 1-it ) ) / 2
120 IF( small.GE.sfmin )
THEN
125 sfmin = small*( one+eps )
129 IF(
lsame( cmach,
'E' ) )
THEN
131 ELSE IF(
lsame( cmach,
'S' ) )
THEN
133 ELSE IF(
lsame( cmach,
'B' ) )
THEN
135 ELSE IF(
lsame( cmach,
'P' ) )
THEN
137 ELSE IF(
lsame( cmach,
'N' ) )
THEN
139 ELSE IF(
lsame( cmach,
'R' ) )
THEN
141 ELSE IF(
lsame( cmach,
'M' ) )
THEN
143 ELSE IF(
lsame( cmach,
'U' ) )
THEN
145 ELSE IF(
lsame( cmach,
'L' ) )
THEN
147 ELSE IF(
lsame( cmach,
'O' ) )
THEN
223 LOGICAL first, lieee1, lrnd
225 REAL a, b, c, f, one, qtr, savec, t1, t2
232 SAVE first, lieee1, lbeta, lrnd, lt
235 DATA first / .true. /
298 f =
slamc3( b / 2, -b / 100 )
305 f =
slamc3( b / 2, b / 100 )
307 IF( ( lrnd ) .AND. ( c.EQ.a ) )
317 t2 =
slamc3( b / 2, savec )
318 lieee1 = ( t1.EQ.a ) .AND. ( t2.GT.savec ) .AND. lrnd
423 SUBROUTINE slamc2( BETA, T, RND, EPS, EMIN, RMIN, EMAX, RMAX )
431 INTEGER beta, emax, emin, t
437 LOGICAL first, ieee, iwarn, lieee1, lrnd
438 INTEGER gnmin, gpmin, i, lbeta, lemax, lemin, lt,
440 REAL a, b, c, half, leps, lrmax, lrmin, one, rbase,
441 $ sixth, small, third, two, zero
451 INTRINSIC abs, max, min
454 SAVE first, iwarn, lbeta, lemax, lemin, leps, lrmax,
458 DATA first / .true. / , iwarn / .false. /
476 CALL
slamc1( lbeta, lt, lrnd, lieee1 )
488 sixth =
slamc3( b, -half )
489 third =
slamc3( sixth, sixth )
490 b =
slamc3( third, -half )
500 IF( ( leps.GT.b ) .AND. ( b.GT.zero ) )
THEN
502 c =
slamc3( half*leps, ( two**5 )*( leps**2 ) )
523 small =
slamc3( small*rbase, zero )
526 CALL
slamc4( ngpmin, one, lbeta )
527 CALL
slamc4( ngnmin, -one, lbeta )
528 CALL
slamc4( gpmin, a, lbeta )
529 CALL
slamc4( gnmin, -a, lbeta )
532 IF( ( ngpmin.EQ.ngnmin ) .AND. ( gpmin.EQ.gnmin ) )
THEN
533 IF( ngpmin.EQ.gpmin )
THEN
537 ELSE IF( ( gpmin-ngpmin ).EQ.3 )
THEN
538 lemin = ngpmin - 1 + lt
543 lemin = min( ngpmin, gpmin )
548 ELSE IF( ( ngpmin.EQ.gpmin ) .AND. ( ngnmin.EQ.gnmin ) )
THEN
549 IF( abs( ngpmin-ngnmin ).EQ.1 )
THEN
550 lemin = max( ngpmin, ngnmin )
554 lemin = min( ngpmin, ngnmin )
559 ELSE IF( ( abs( ngpmin-ngnmin ).EQ.1 ) .AND.
560 $ ( gpmin.EQ.gnmin ) )
THEN
561 IF( ( gpmin-min( ngpmin, ngnmin ) ).EQ.3 )
THEN
562 lemin = max( ngpmin, ngnmin ) - 1 + lt
566 lemin = min( ngpmin, ngnmin )
572 lemin = min( ngpmin, ngnmin, gpmin, gnmin )
581 WRITE( 6, fmt = 9999 )lemin
590 ieee = ieee .OR. lieee1
597 DO 30 i = 1, 1 - lemin
598 lrmin =
slamc3( lrmin*rbase, zero )
603 CALL
slamc5( lbeta, lt, lemin, ieee, lemax, lrmax )
617 9999 format( / /
' WARNING. The value EMIN may be incorrect:-',
619 $
' If, after inspection, the value EMIN looks',
620 $
' acceptable please comment out ',
621 $ /
' the IF block as marked within the code of routine',
622 $
' SLAMC2,', /
' otherwise supply EMIN explicitly.', / )
708 REAL a, b1, b2, c1, c2, d1, d2, one, rbase, zero
721 b1 =
slamc3( a*rbase, zero )
729 IF( ( c1.EQ.a ) .AND. ( c2.EQ.a ) .AND. ( d1.EQ.a ) .AND.
733 b1 =
slamc3( a / base, zero )
734 c1 =
slamc3( b1*base, zero )
739 b2 =
slamc3( a*rbase, zero )
740 c2 =
slamc3( b2 / rbase, zero )
801 SUBROUTINE slamc5( BETA, P, EMIN, IEEE, EMAX, RMAX )
809 INTEGER beta, emax, emin, p
816 parameter( zero = 0.0e0, one = 1.0e0 )
819 INTEGER exbits, expsum, i, lexp, nbits, try, uexp
820 REAL oldy, recbas, y, z
840 IF( try.LE.( -emin ) )
THEN
845 IF( lexp.EQ.-emin )
THEN
856 IF( ( uexp+emin ).GT.( -lexp-emin ) )
THEN
865 emax = expsum + emin - 1
866 nbits = 1 + exbits + p
871 IF( ( mod( nbits, 2 ).EQ.1 ) .AND. ( beta.EQ.2 ) )
THEN
916 y =
slamc3( y*beta, zero )