1 INTEGER FUNCTION I1MACH
(I
)
4 C I1MACH( 1) = THE STANDARD INPUT UNIT.
5 C I1MACH( 2) = THE STANDARD OUTPUT UNIT.
6 C I1MACH( 3) = THE STANDARD PUNCH UNIT.
7 C I1MACH( 4) = THE STANDARD ERROR MESSAGE UNIT.
8 C I1MACH( 5) = THE NUMBER OF BITS PER INTEGER STORAGE UNIT.
9 C I1MACH( 6) = THE NUMBER OF CHARACTERS PER CHARACTER STORAGE UNIT.
10 C INTEGERS HAVE FORM SIGN ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
11 C I1MACH( 7) = A, THE BASE.
12 C I1MACH( 8) = S, THE NUMBER OF BASE-A DIGITS.
13 C I1MACH( 9) = A**S - 1, THE LARGEST MAGNITUDE.
14 C FLOATS HAVE FORM SIGN (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
15 C WHERE EMIN .LE. E .LE. EMAX.
16 C I1MACH(10) = B, THE BASE.
18 C I1MACH(11) = T, THE NUMBER OF BASE-B DIGITS.
19 C I1MACH(12) = EMIN, THE SMALLEST EXPONENT E.
20 C I1MACH(13) = EMAX, THE LARGEST EXPONENT E.
22 C I1MACH(14) = T, THE NUMBER OF BASE-B DIGITS.
23 C I1MACH(15) = EMIN, THE SMALLEST EXPONENT E.
24 C I1MACH(16) = EMAX, THE LARGEST EXPONENT E.
26 INTEGER IMACH
(16), OUTPUT
, SC
, SMALL
(2)
29 EQUIVALENCE
(IMACH
(4),OUTPUT
), (RMACH
,SMALL
(1))
30 INTEGER I3
, J
, K
, T3E
(3)
31 DATA T3E
(1) / 9777664 /
32 DATA T3E
(2) / 5323660 /
34 C THIS VERSION ADAPTS AUTOMATICALLY TO MOST CURRENT MACHINES,
35 C INCLUDING AUTO-DOUBLE COMPILERS.
36 C TO COMPILE ON OLDER MACHINES, ADD A C IN COLUMN 1
39 C AND REMOVE THE C FROM COLUMN 1 IN ONE OF THE SECTIONS BELOW.
40 C CONSTANTS FOR EVEN OLDER MACHINES CAN BE OBTAINED BY
41 C mail netlib@research.bell-labs.com
42 C send old1mach from blas
43 C PLEASE SEND CORRECTIONS TO dmg OR ehg@bell-labs.com.
45 C MACHINE CONSTANTS FOR THE HONEYWELL DPS 8/70 SERIES.
47 C DATA IMACH( 1) / 5 /
48 C DATA IMACH( 2) / 6 /
49 C DATA IMACH( 3) / 43 /
50 C DATA IMACH( 4) / 6 /
51 C DATA IMACH( 5) / 36 /
52 C DATA IMACH( 6) / 4 /
53 C DATA IMACH( 7) / 2 /
54 C DATA IMACH( 8) / 35 /
55 C DATA IMACH( 9) / O377777777777 /
56 C DATA IMACH(10) / 2 /
57 C DATA IMACH(11) / 27 /
58 C DATA IMACH(12) / -127 /
59 C DATA IMACH(13) / 127 /
60 C DATA IMACH(14) / 63 /
61 C DATA IMACH(15) / -127 /
62 C DATA IMACH(16) / 127 /, SC/987/
64 C MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING
65 C 32-BIT INTEGER ARITHMETIC.
67 C DATA IMACH( 1) / 5 /
68 C DATA IMACH( 2) / 6 /
69 C DATA IMACH( 3) / 7 /
70 C DATA IMACH( 4) / 6 /
71 C DATA IMACH( 5) / 32 /
72 C DATA IMACH( 6) / 4 /
73 C DATA IMACH( 7) / 2 /
74 C DATA IMACH( 8) / 31 /
75 C DATA IMACH( 9) / 2147483647 /
76 C DATA IMACH(10) / 2 /
77 C DATA IMACH(11) / 24 /
78 C DATA IMACH(12) / -127 /
79 C DATA IMACH(13) / 127 /
80 C DATA IMACH(14) / 56 /
81 C DATA IMACH(15) / -127 /
82 C DATA IMACH(16) / 127 /, SC/987/
84 C MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES.
86 C NOTE THAT THE PUNCH UNIT, I1MACH(3), HAS BEEN SET TO 7
87 C WHICH IS APPROPRIATE FOR THE UNIVAC-FOR SYSTEM.
88 C IF YOU HAVE THE UNIVAC-FTN SYSTEM, SET IT TO 1.
90 C DATA IMACH( 1) / 5 /
91 C DATA IMACH( 2) / 6 /
92 C DATA IMACH( 3) / 7 /
93 C DATA IMACH( 4) / 6 /
94 C DATA IMACH( 5) / 36 /
95 C DATA IMACH( 6) / 6 /
96 C DATA IMACH( 7) / 2 /
97 C DATA IMACH( 8) / 35 /
98 C DATA IMACH( 9) / O377777777777 /
99 C DATA IMACH(10) / 2 /
100 C DATA IMACH(11) / 27 /
101 C DATA IMACH(12) / -128 /
102 C DATA IMACH(13) / 127 /
103 C DATA IMACH(14) / 60 /
104 C DATA IMACH(15) /-1024 /
105 C DATA IMACH(16) / 1023 /, SC/987/
107 IF (SC
.NE
. 987) THEN
108 * *** CHECK
FOR AUTODOUBLE
***
111 IF (SMALL
(2) .NE
. 0) THEN
112 * *** AUTODOUBLED
***
113 IF ( (SMALL
(1) .EQ
. 1117925532
114 * .AND
. SMALL
(2) .EQ
. -448790528)
115 * .OR
. (SMALL
(2) .EQ
. 1117925532
116 * .AND
. SMALL
(1) .EQ
. -448790528)) THEN
122 ELSE IF ( SMALL
(1) .EQ
. -2065213935
123 * .AND
. SMALL
(2) .EQ
. 10752) THEN
124 * *** VAX WITH D_FLOATING
***
129 ELSE IF ( SMALL
(1) .EQ
. 1267827943
130 * .AND
. SMALL
(2) .EQ
. 704643072) THEN
131 * *** IBM MAINFRAME
***
140 IMACH
(11) = IMACH
(14)
141 IMACH
(12) = IMACH
(15)
142 IMACH
(13) = IMACH
(16)
145 IF (SMALL
(1) .EQ
. 1234613304) THEN
155 ELSE IF (SMALL
(1) .EQ
. -1271379306) THEN
165 ELSE IF (SMALL
(1) .EQ
. 1175639687) THEN
166 * *** IBM MAINFRAME
***
175 ELSE IF (SMALL
(1) .EQ
. 1251390520) THEN
186 J
= SMALL
(1) / 10000000
187 K
= SMALL
(1) - 10000000*J
188 IF (K
.NE
. T3E
(I3
)) GO TO 20
200 CALL I1MCR1
(IMACH
(9), K
, 32767, 16777215, 16777215)
209 20 CALL I1MCR1
(J
, K
, 16405, 9876536, 0)
210 IF (SMALL
(1) .NE
. J
) THEN
214 * *** CRAY
1, XMP
, 2, AND
3 ***
223 CALL I1MCR1
(IMACH
(9), K
, 0, 4194303, 16777215)
242 IMACH
( 9) = 2147483647
245 9010 FORMAT(/' Adjust autodoubled I1MACH by uncommenting data'/
246 * ' statements appropriate for your machine and setting'/
247 * ' IMACH(I) = IMACH(I+3) for I = 11, 12, and 13.')
248 9020 FORMAT(/' Adjust I1MACH by uncommenting data statements'/
249 * ' appropriate for your machine.')
250 IF (I
.LT
. 1 .OR
. I
.GT
. 16) GO TO 40
253 40 WRITE(*,*) 'I1MACH(I): I =',I
,' is out of bounds.'
255 * /* C source
for I1MACH
-- remove the
* in column
1 */
256 * /* Note that some values may need changing
. */
262 *long i1mach_
(long
*i
)
265 * case
1: return 5; /* standard input
*/
266 * case
2: return 6; /* standard output
*/
267 * case
3: return 7; /* standard punch
*/
268 * case
4: return 0; /* standard error
*/
269 * case
5: return 32; /* bits per
integer */
270 * case
6: return sizeof
(int
);
271 * case
7: return 2; /* base
for integers
*/
272 * case
8: return 31; /* digits of
integer base
*/
273 * case
9: return LONG_MAX
;
274 * case
10: return FLT_RADIX
;
275 * case
11: return FLT_MANT_DIG
;
276 * case
12: return FLT_MIN_EXP
;
277 * case
13: return FLT_MAX_EXP
;
278 * case
14: return DBL_MANT_DIG
;
279 * case
15: return DBL_MIN_EXP
;
280 * case
16: return DBL_MAX_EXP
;
282 * fprintf
(stderr
, "invalid argument: i1mach(%ld)\n", *i
);
283 * exit
(1);return 0; /* some compilers demand
return values
*/
286 SUBROUTINE I1MCR1
(A
, A1
, B
, C
, D
)
287 **** SPECIAL COMPUTATION
FOR OLD CRAY MACHINES
****
288 INTEGER A
, A1
, B
, C
, D