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
210 SUBROUTINE slamc1( BETA, T, RND, IEEE1 )
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 ) )
316 t1 = slamc3( b / 2, 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 )
491 b = slamc3( b, sixth )
500 IF( ( leps.GT.b ) .AND. ( b.GT.zero ) )
THEN
502 c = slamc3( half*leps, ( two**5 )*( leps**2 ) )
503 c = slamc3( half, -c )
504 b = slamc3( half, c )
505 c = slamc3( half, -b )
506 b = slamc3( half, c )
523 small = slamc3( small*rbase, zero )
525 a = slamc3( one, small )
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.', / )
646 REAL FUNCTION slamc3( A, B )
693 SUBROUTINE slamc4( EMIN, START, BASE )
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 )
subroutine slamc2(BETA, T, RND, EPS, EMIN, RMIN, EMAX, RMAX)
SLAMC2
subroutine slamc1(BETA, T, RND, IEEE1)
SLAMC1
subroutine slamc4(EMIN, START, BASE)
SLAMC4
real function slamc3(A, B)
SLAMC3
subroutine slamc5(BETA, P, EMIN, IEEE, EMAX, RMAX)
SLAMC5
real function slamch(CMACH)
SLAMCH
logical function lsame(CA, CB)
LSAME