2 INTEGER FUNCTION I1MACH (I)
3 c----------------------------------------------------------------------
5 c this is not quit the original one from slatec
6 c unit numbers for input/output/error are provided by calls to routines
7 c from istdio.f change them there if needed!!!
9 c the other constants are not currently used by TISEAN and not checked
10 c for any particular platform
12 c----------------------------------------------------------------------
13 C***BEGIN PROLOGUE I1MACH
14 C***PURPOSE Return integer machine dependent constants.
17 C***TYPE INTEGER (I1MACH-I)
18 C***KEYWORDS MACHINE CONSTANTS
19 C***AUTHOR Fox, P. A., (Bell Labs)
20 C Hall, A. D., (Bell Labs)
21 C Schryer, N. L., (Bell Labs)
24 C I1MACH can be used to obtain machine-dependent parameters for the
25 C local machine environment. It is a function subprogram with one
26 C (input) argument and can be referenced as follows:
30 C where I=1,...,16. The (output) value of K above is determined by
31 C the (input) value of I. The results for various values of I are
35 C I1MACH( 1) = the standard input unit.
36 C I1MACH( 2) = the standard output unit.
37 C I1MACH( 3) = the standard punch unit.
38 C I1MACH( 4) = the standard error message unit.
41 C I1MACH( 5) = the number of bits per integer storage unit.
42 C I1MACH( 6) = the number of characters per integer storage unit.
45 C assume integers are represented in the S-digit, base-A form
47 C sign ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
49 C where 0 .LE. X(I) .LT. A for I=0,...,S-1.
50 C I1MACH( 7) = A, the base.
51 C I1MACH( 8) = S, the number of base-A digits.
52 C I1MACH( 9) = A**S - 1, the largest magnitude.
54 C Floating-Point Numbers:
55 C Assume floating-point numbers are represented in the T-digit,
57 C sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
59 C where 0 .LE. X(I) .LT. B for I=1,...,T,
60 C 0 .LT. X(1), and EMIN .LE. E .LE. EMAX.
61 C I1MACH(10) = B, the base.
64 C I1MACH(11) = T, the number of base-B digits.
65 C I1MACH(12) = EMIN, the smallest exponent E.
66 C I1MACH(13) = EMAX, the largest exponent E.
69 C I1MACH(14) = T, the number of base-B digits.
70 C I1MACH(15) = EMIN, the smallest exponent E.
71 C I1MACH(16) = EMAX, the largest exponent E.
73 C To alter this function for a particular environment, the desired
74 C set of DATA statements should be activated by removing the C from
75 C column 1. Also, the values of I1MACH(1) - I1MACH(4) should be
76 C checked for consistency with the local operating system.
78 C***REFERENCES P. A. Fox, A. D. Hall and N. L. Schryer, Framework for
79 C a portable library, ACM Transactions on Mathematical
80 C Software 4, 2 (June 1978), pp. 177-188.
81 C***ROUTINES CALLED (NONE)
82 C***REVISION HISTORY (YYMMDD)
84 C 891012 Added VAX G-floating constants. (WRB)
85 C 891012 REVISION DATE from Version 3.2
86 C 891214 Prologue converted to Version 4.0 format. (BAB)
87 C 900618 Added DEC RISC constants. (WRB)
88 C 900723 Added IBM RS 6000 constants. (WRB)
89 C 901009 Correct I1MACH(7) for IBM Mainframes. Should be 2 not 16.
91 C 910710 Added HP 730 constants. (SMR)
92 C 911114 Added Convex IEEE constants. (WRB)
93 C 920121 Added SUN -r8 compiler option constants. (WRB)
94 C 920229 Added Touchstone Delta i860 constants. (WRB)
95 C 920501 Reformatted the REFERENCES section. (WRB)
96 C 920625 Added Convex -p8 and -pd8 compiler option constants.
98 C 930201 Added DEC Alpha and SGI constants. (RWC and WRB)
99 C 930618 Corrected I1MACH(5) for Convex -p8 and -pd8 compiler
100 C options. (DWL, RWC and WRB).
101 C***END PROLOGUE I1MACH
103 INTEGER IMACH(16),OUTPUT
105 EQUIVALENCE (IMACH(4),OUTPUT)
111 DATA IMACH( 5) / 32 /
114 DATA IMACH( 8) / 31 /
115 DATA IMACH( 9) / 2147483647 /
117 DATA IMACH(11) / 24 /
118 DATA IMACH(12) / -125 /
119 DATA IMACH(13) / 127 /
120 DATA IMACH(14) / 53 /
121 DATA IMACH(15) / -1021 /
122 DATA IMACH(16) / 1023 /
124 C***FIRST EXECUTABLE STATEMENT I1MACH
130 IF (I .LT. 1 .OR. I .GT. 16) GO TO 10
136 WRITE (UNIT = OUTPUT, FMT = 9000)
137 9000 FORMAT ('1ERROR 1 IN I1MACH - I OUT OF BOUNDS')