integer function i1mach(i) c i/o unit numbers. c c i1mach( 1) = the standard input unit. c c i1mach( 2) = the standard output unit. c c i1mach( 3) = the standard punch unit. c c i1mach( 4) = the standard error message unit. c c words. c c i1mach( 5) = the number of bits per word. c c i1mach( 6) = the number of characters per word. c c integers. c c assume integers are represented in the s-digit, base-a form c c sign ( x(s-1)*a**(s-1) + ... + x(1)*a + x(0) ) c c where 0 .le. x(i) .lt. a for i=0,...,s-1. c c i1mach( 7) = a, the base. c c i1mach( 8) = s, the number of base-a digits. c c i1mach( 9) = a**s - 1, the largest magnitude. c c floating-point numbers. c c assume floating-point numbers are represented in the t-digit, c base-b form c c sign (b**e)*( (x(1)/b) + ... + (x(t)/b**t) ) c c where 0 .lt. x(i) .lt. b for i=1,...,t, c 0 .lt. x(1), and emin .le. e .le. emax. c c i1mach(10) = b, the base. c c single-precision c c i1mach(11) = t, the number of base-b digits. c c i1mach(12) = emin, the smallest exponent e. c c i1mach(13) = emax, the largest exponent e. c c double-precision c c i1mach(14) = t, the number of base-b digits. c c i1mach(15) = emin, the smallest exponent e. c c i1mach(16) = emax, the largest exponent e. c c to alter this function for a particular environment, c the desired set of data statements should be activated by c removing the c from column 1. Also, the values of c i1mach(1) - i1mach(4) should be checked for consistency c with the local operating system. c integer imach(16),output c equivalence (imach(4),output) c c machine constants for the honeywell 6000 series. c c data imach( 1) / 5/ c data imach( 2) / 6/ c data imach( 3) / 43/ c data imach( 4) / 6/ c data imach( 5) / 36/ c data imach( 6) / 6/ c data imach( 7) / 2/ c data imach( 8) / 35/ c data imach( 9) /O377777777777/ c data imach(10) / 2/ c data imach(11) / 27/ c data imach(12) /-127/ c data imach(13) / 127/ c data imach(14) / 63/ c data imach(15) /-127/ c data imach(16) / 127/ c c machine constants for the ibm 360 and 370 series, c and the sel systems 85/86. c c data imach( 1) / 5/ c data imach( 2) / 6/ c data imach( 3) / 7/ c data imach( 4) / 6/ c data imach( 5) / 32/ c data imach( 6) / 4/ c data imach( 7) / 2/ c data imach( 8) / 31/ c data imach( 9) /Z7FFFFFFF/ c data imach(10) / 16/ c data imach(11) / 6/ c data imach(12) / -64/ c data imach(13) / 63/ c data imach(14) / 14/ c data imach(15) / -64/ c data imach(16) / 63/ c c machine constants for the cray 1. c c data imach( 1) /5linput / c data imach( 2) /6loutput/ c data imach( 3) /5lpunch / c data imach( 4) /6loutput/ c data imach( 5) / 64 / c data imach( 6) / 8 / c data imach( 7) / 2/ c data imach( 8) / 23/ c data imach( 9) /37777777B / c data imach(10) / 2 / c data imach(11) / 47 / c data imach(12) /-8192 / c data imach(13) / 8191 / c data imach(14) / 95 / c data imach(15) /-8144 / c data imach(16) / 8191 / c c machine constants for the cdc 6000 and 7000 series. c c for imach(2) on a cdc 7600 running ltss, c the initial value should be 3ltty. c c data imach( 1) / 5linput / c data imach( 2) / 6loutput/ c data imach( 3) / 5lpunch / c data imach( 4) / 6loutput / c data imach( 5) / 60/ c data imach( 6) / 10/ c data imach( 7) / 2/ c data imach( 8) / 48/ c data imach( 9) /00007777777777777777B/ c data imach(10) / 2/ c data imach(11) / 48/ c data imach(12) / -974/ c data imach(13) / 1070/ c data imach(14) / 96/ c data imach(15) / -926/ c data imach(16) / 1070/ c c machine constants for the pdp-10 (ka processor). c c data imach( 1) / 5/ c data imach( 2) / 6/ c data imach( 3) / 5/ c data imach( 4) / 6/ c data imach( 5) / 36/ c data imach( 6) / 5/ c data imach( 7) / 2/ c data imach( 8) / 35/ c data imach( 9) / ;377777777777/ c data imach(10) / 2/ c data imach(11) / 27/ c data imach(12) /-128/ c data imach(13) / 127/ c data imach(14) / 54/ c data imach(15) /-128/ c data imach(16)/ 127/ c c machine constants for the pdp-10 (ki processor). c c data imach( 1) / 5/ c data imach( 2) / 6/ c data imach( 3) / 5/ c data imach( 4) / 6/ c data imach( 5) / 36/ c data imach( 6) / 5/ c data imach( 7) / 2/ c data imach( 8) / 35/ c data imach( 9) / ;377777777777/ c data imach(10) / 2/ c data imach(11) / 27/ c data imach(12) /-128/ c data imach(13) / 127/ c data imach(14) / 62/ c data imach(15) /-128/ c data imach(16) / 127/ c c machine constants for the pdp-11. c c data imach( 1) / 5/ c data imach( 2) / 6/ c data imach( 3) / 5/ c data imach( 4) / 6/ c data imach( 5) / 32/ c data imach( 6) / 4/ c data imach( 7) / 2/ c data imach( 8) / 31/ c data imach( 9) / 2147483647/ c data imach(10) / 2/ c data imach(11) / 24/ c data imach(12) / -127/ c data imach(13) / 127/ c data imach(14) / 56/ c data imach(15) / -127/ c data imach(16) / 127/ c c machine constants for the univac 1100 series. c c data imach( 1) / 5/ c data imach( 2) / 6/ c data imach( 3) / 7/ c data imach( 4) / 6/ c data imach( 5) / 36/ c data imach( 6) / 6/ c data imach( 7) / 2/ c data imach( 8) / 35/ c data imach( 9) /O377777777777/ c data imach(10) / 2/ c data imach(11) / 27/ c data imach(12) /-128/ c data imach(13) / 127/ c data imach(14) / 61/ c data imach(15) /-1024/ c data imach(16) / 1023/ c c c machine constants for IBM PC Professional Fortran Compiler c data imach( 1) / 5/ data imach( 2) / 6/ data imach( 3) / 7/ data imach( 4) / 0/ data imach( 5) / 32/ data imach( 6) / 4/ data imach( 7) / 2/ data imach( 8) / 31/ data imach( 9) /2147483647/ data imach(10) / 2/ data imach(11) / 23/ data imach(12) /-125/ data imach(13) / 127/ data imach(14) / 52/ data imach(15) /-1021/ data imach(16) /1023/ c if (i .lt. 1 .or. i .gt. 16) go to 10 c i1mach=imach(i) return c 10 write(output,9000) 9000 format('1error 1 in i1mach - i out of bounds') c c call fdump c stop 'I1MACH bombed' c end c real function r1mach(i) c c single-precision machine constants c c r1mach( 1) = b**(emin-1), the smallest positive magnitude. c c r1mach( 2) = b**emax*(1 - b**(-t)), the largest magnitude. c c r1mach( 3) = b**(-t), the smallest relative spacing. c c r1mach( 4) = b**(1-t), the largest relative spacing. c c r1mach( 5) = log10(b) c c to alter this function for a particular environment, c the desired set of data statements should be activated by c removing the c from column 1. c c where possible, octal or hexadecimal constants have been used c to specify the constants exactly. c real rmach(5) integer output c c machine constants for the honeywell 6000 series. c c data rmach( 1) / O402400000000/ c data rmach( 2) / O376777777777/ c data rmach( 3) / O714400000000/ c data rmach( 4) / O716400000000/ c data rmach( 5) / O776464202324/ c c machine constants for the IBM 360 and 370 series, c and the sel systems 85/86. c c data rmach( 1) /Z00100000/ c data rmach( 2) /Z7FFFFFFF/ c data rmach( 3) /Z3B100000/ c data rmach( 4) /Z3C100000/ c data rmach( 5) /Z41134413/ c c machine constants for the Cray 1. c c data rmach( 1) / 200004000000000000000B / c data rmach( 2) / 577777777777777777777B / c data rmach( 3) / 377224000000000000000B / c data rmach( 4) / 377234000000000000000B / c data rmach( 5) / 0.3010299956 63981195E0 / c rmach(3) = 2**(-47) = 7.10543E-15 c rmach(4) = 2**(-46) = 1.42109E-14 c c machine constants for the CDC 6000 and 7000 series. c c data rmach( 1) / 00014000000000000000B/ c data rmach( 2) / 37767777777777777777B/ c data rmach( 3) / 16404000000000000000B/ c data rmach( 4) / 16414000000000000000B/ c data rmach( 5) / 17164642023241175720B/ c c machine constants for the PDP-10 (KA or KI processor). c c data rmach( 1) / ;000400000000/ c data rmach( 2) / ;377777777777/ c data rmach( 3) / ;146400000000/ c data rmach( 4) / ;147400000000/ c data rmach( 5) / ;177464202324/ c c machine constants for the PDP-11. c c data rmach( 1) / 0.29387358771E-38/ c data rmach( 2) / 0.17014117331E+39/ c data rmach( 3) / 0.59604644775E-07/ c data rmach( 4) / 0.11920928955E-06/ c data rmach( 5) / 0.30102999566 / c c machine constants for the UNIVAC 1100 series. c c data rmach( 1) / O000400000000/ c data rmach( 2) / O377777777777/ c data rmach( 3) / O146400000000/ c data rmach( 4) / O147400000000/ c data rmach( 5) / O177464202324/ c c machine constants for the IBM PC Professional Fortran Compiler c data rmach( 1) / 1.1755E-38/ data rmach( 2) / 3.4028E+38/ data rmach( 3) / 1.1921E-07/ data rmach( 4) / 2.3842E-07/ data rmach( 5) / 3.0103E-01/ c if (i.lt.1 .or. i.gt.5) then output=i1mach(4) write(output,*) ' R1MACH - I out of bounds' stop 'R1MACH bombed' endif c r1mach = rmach(i) return c end double precision function d1mach(i) c c double-precision machine constants c c d1mach( 1) = b**(emin-1), the smallest positive magnitude. c c d1mach( 2) = b**emax*(1 - b**(-t)), the largest magnitude. c c d1mach( 3) = b**(-t), the smallest relative spacing. c c d1mach( 4) = b**(1-t), the largest relative spacing. c c d1mach( 5) = log10(b) c c to alter this function for a particular environment, c the desired set of data statements should be activated by c removing the c from column 1. c c where possible, octal or hexadecimal constants have been used c to specify the constants exactly which has in some cases c required the use of equivalent integer arrays. c integer small(2) integer large(2) integer right(2) integer diver(2) integer log10(2) c double precision dmach(5) integer output c equivalence (dmach(1),small(1)) equivalence (dmach(2),large(1)) equivalence (dmach(3),right(1)) equivalence (dmach(4),diver(1)) equivalence (dmach(5),log10(1)) c c machine constants for the honeywell 6000 series. c c data small(1),small(2) / O402400000000,O000000000000/ c data large(1),large(2) / O376777777777,O777777777777/ c data right(1),right(2) / O604400000000,O000000000000/ c data diver(1),diver(2) / O606400000000,O000000000000/ c data log10(1),log10(2) / O776464202324,O117571775714/ c c machine constants for the IBM 360 and 370 series, c and the sel systems 85/86. c c data small(1),small(2) /Z00100000,Z00000000/ c data large(1),large(2) /Z7FFFFFFF,ZFFFFFFFF/ c data right(1),right(2) /Z3B100000,Z00000000/ c data diver(1),diver(2) /Z3C100000,Z00000000/ c data log10(1),log10(2) /Z41134413,Z509F79FF/ c c machine constants for the Cray 1. c c data small(1),small(2) / 200604000000000000000B,20000000000000 c 10000000B/ c data large(1),large(2) / 577777777777777777777B,57717777777777 c 17777777B/ c data right(1),right(2) / 376424000000000000000B,37562000000000 c 10000000B/ c data diver(1),diver(2) / 376234000000000000000B,37563000000000 c 10000000B/ c data dmach( 5) / 0.3010299956 6398119521 3738894724D+00/ c note that dmach(3)=0.252435D-28 c and dmach(4)=0.5048709793D-28 c c machine constants for the CDC 6000 and 7000 series. c c data small(1),small(2) / 00014000000000000000B, c 1 00010000000000000000B/ c data large(1),large(2) / 37767777777777777777B, c 1 37167777777777777777B/ c data right(1),right(2) / 16404000000000000000B, c 1 15000000000000000000B/ c data diver(1),diver(2) / 16414000000000000000B, c 1 15010000000000000000B/ c data log10(1),log10(2) / 17164642023241175720B, c 1 16367571421742254654B/ c c machine constants for the PDP-10 (KA processor). c c data small(1),small(2) / ;000400000000,;000000000000/ c data large(1),large(2) / ;377777777777,;344777777777/ c data right(1),right(2) / ;146400000000,;000000000000/ c data diver(1),diver(2) / ;147400000000,;000000000000/ c data log10(1),log10(2) / ;177464202324,;144117571776/ c c machine constants for the PDP-10 (KA processor). c c data small(1),small(2) / ;000400000000,;000000000000/ c data large(1),large(2) / ;377777777777,;344777777777/ c data right(1),right(2) / ;103400000000,;000000000000/ c data diver(1),diver(2) / ;104400000000,;000000000000/ c data log10(1),log10(2) / ;177464202324,;476747767461/ c c machine constants for the PDP-11. c c data dmach( 1) / 0.2938735877055719 D-38/ c data dmach( 2) / 0.170141183460469229D+39/ c data dmach( 3) / 0.138777878078144568D-16/ c data dmach( 4) / 0.277555756156289135D-16/ c data dmach( 5) / 0.301029995663981195D+00/ c c machine constants for the UNIVAC 1100 series. c c data small(1),small(2) / O000400000000,O000000000000/ c data large(1),large(2) / O377777777777,O777777777777/ c data right(1),right(2) / O170540000000,O000000000000/ c data diver(1),diver(2) / O170640000000,O000000000000/ c data log10(1),log10(2) / O177746420232,O411757177572/ c c machine constants for the IBM PC Professional Fortran Compiler c data dmach( 1) / 2.23D-308/ data dmach( 2) / 1.79D+308/ data dmach( 3) / 2.2204D-52/ data dmach( 4) / 4.4409D-16/ data dmach( 5) / 3.0103D-01/ c if (i.lt.1 .or. i.gt.5) then output=i1mach(4) write(output,*) ' D1MACH - I out of bounds' stop 'D1MACH bombed' endif c d1mach = dmach(i) return c end