1 REAL FUNCTION SLAMCH( CMACH )
50 parameter( one = 1.0e+0, zero = 0.0e+0 )
54 INTEGER beta, imax, imin, it
55 REAL base, emax, emin, eps, prec, rmach, rmax, rmin,
56 $ rnd, sfmin, small, t
66 SAVE first, eps, sfmin, base, t, rnd, emin, rmin,
76 CALL slamc2( beta, it, lrnd, eps, imin, rmin, imax, rmax )
81 eps = ( base**( 1-it ) ) / 2
91 IF( small.GE.sfmin )
THEN
96 sfmin = small*( one+eps )
100 IF( lsame( cmach,
'E' ) )
THEN
102 ELSE IF( lsame( cmach,
'S' ) )
THEN
104 ELSE IF( lsame( cmach,
'B' ) )
THEN
106 ELSE IF( lsame( cmach,
'P' ) )
THEN
108 ELSE IF( lsame( cmach,
'N' ) )
THEN
110 ELSE IF( lsame( cmach,
'R' ) )
THEN
112 ELSE IF( lsame( cmach,
'M' ) )
THEN
114 ELSE IF( lsame( cmach,
'U' ) )
THEN
116 ELSE IF( lsame( cmach,
'L' ) )
THEN
118 ELSE IF( lsame( cmach,
'O' ) )
THEN
131 SUBROUTINE slamc1( BETA, T, RND, IEEE1 )
184 LOGICAL FIRST, LIEEE1, LRND
186 REAL A, B, C, F, ONE, QTR, SAVEC, T1, T2
193 SAVE first, lieee1, lbeta, lrnd, lt
196 DATA first / .true. /
260 f = slamc3( b / 2, -b / 100 )
267 f = slamc3( b / 2, b / 100 )
269 IF( ( lrnd ) .AND. ( c.EQ.a ) )
278 t1 = slamc3( b / 2, a )
279 t2 = slamc3( b / 2, savec )
280 lieee1 = ( t1.EQ.a ) .AND. ( t2.GT.savec ) .AND. lrnd
318 SUBROUTINE slamc2( BETA, T, RND, EPS, EMIN, RMIN, EMAX, RMAX )
327 INTEGER BETA, EMAX, EMIN, T
384 LOGICAL FIRST, IEEE, IWARN, LIEEE1, LRND
385 INTEGER GNMIN, GPMIN, I, LBETA, LEMAX, LEMIN, LT,
387 REAL A, B, C, HALF, LEPS, LRMAX, LRMIN, ONE, RBASE,
388 $ SIXTH, SMALL, THIRD, TWO, ZERO
401 SAVE first, iwarn, lbeta, lemax, lemin, leps, lrmax,
405 DATA first / .true. / , iwarn / .false. /
424 CALL slamc1( lbeta, lt, lrnd, lieee1 )
436 sixth = slamc3( b, -half )
437 third = slamc3( sixth, sixth )
438 b = slamc3( third, -half )
439 b = slamc3( b, sixth )
448 IF( ( leps.GT.b ) .AND. ( b.GT.zero ) )
THEN
450 c = slamc3( half*leps, ( two**5 )*( leps**2 ) )
451 c = slamc3( half, -c )
452 b = slamc3( half, c )
453 c = slamc3( half, -b )
454 b = slamc3( half, c )
471 small = slamc3( small*rbase, zero )
473 a = slamc3( one, small )
474 CALL slamc4( ngpmin, one, lbeta )
475 CALL slamc4( ngnmin, -one, lbeta )
476 CALL slamc4( gpmin, a, lbeta )
477 CALL slamc4( gnmin, -a, lbeta )
480 IF( ( ngpmin.EQ.ngnmin ) .AND. ( gpmin.EQ.gnmin ) )
THEN
481 IF( ngpmin.EQ.gpmin )
THEN
485 ELSE IF( ( gpmin-ngpmin ).EQ.3 )
THEN
486 lemin = ngpmin - 1 + lt
491 lemin =
min( ngpmin, gpmin )
496 ELSE IF( ( ngpmin.EQ.gpmin ) .AND. ( ngnmin.EQ.gnmin ) )
THEN
497 IF( abs( ngpmin-ngnmin ).EQ.1 )
THEN
498 lemin =
max( ngpmin, ngnmin )
502 lemin =
min( ngpmin, ngnmin )
507 ELSE IF( ( abs( ngpmin-ngnmin ).EQ.1 ) .AND.
508 $ ( gpmin.EQ.gnmin ) )
THEN
509 IF( ( gpmin-
min( ngpmin, ngnmin ) ).EQ.3 )
THEN
510 lemin =
max( ngpmin, ngnmin ) - 1 + lt
514 lemin =
min( ngpmin, ngnmin )
520 lemin =
min( ngpmin, ngnmin, gpmin, gnmin )
528 WRITE( 6, fmt = 9999 )lemin
537 ieee = ieee .OR. lieee1
544 DO 30 i = 1, 1 - lemin
545 lrmin = slamc3( lrmin*rbase, zero )
550 CALL slamc5( lbeta, lt, lemin, ieee, lemax, lrmax )
564 9999
FORMAT( / /
' WARNING. The value EMIN may be incorrect:-',
566 $
' If, after inspection, the value EMIN looks',
567 $
' acceptable please comment out ',
568 $ /
' the IF block as marked within the code of routine',
569 $
' SLAMC2,', /
' otherwise supply EMIN explicitly.', / )
577 REAL FUNCTION SLAMC3( A, B )
615 SUBROUTINE slamc4( EMIN, START, BASE )
650 REAL A, B1, B2, C1, C2, D1, D2, ONE, RBASE, ZERO
663 b1 = slamc3( a*rbase, zero )
671 IF( ( c1.EQ.a ) .AND. ( c2.EQ.a ) .AND. ( d1.EQ.a ) .AND.
675 b1 = slamc3( a / base, zero )
676 c1 = slamc3( b1*base, zero )
681 b2 = slamc3( a*rbase, zero )
682 c2 = slamc3( b2 / rbase, zero )
699 SUBROUTINE slamc5( BETA, P, EMIN, IEEE, EMAX, RMAX )
708 INTEGER BETA, EMAX, EMIN, P
749 parameter( zero = 0.0e0, one = 1.0e0 )
752 INTEGER EXBITS, EXPSUM, I, LEXP, NBITS, TRY, UEXP
753 REAL OLDY, RECBAS, Y, Z
773 IF( try.LE.( -emin ) )
THEN
778 IF( lexp.EQ.-emin )
THEN
789 IF( ( uexp+emin ).GT.( -lexp-emin ) )
THEN
798 emax = expsum + emin - 1
799 nbits = 1 + exbits + p
804 IF( ( mod( nbits, 2 ).EQ.1 ) .AND. ( beta.EQ.2 ) )
THEN
849 y = slamc3( y*beta, zero )