Debian Codegraph @

mathext/internal/amos/amoslib/i1mach.f

raw symbols SCIP
1 *DECK I1MACH
2 INTEGER FUNCTION I1MACH(I)
3 C***BEGIN PROLOGUE I1MACH
4 C***DATE WRITTEN 750101 (YYMMDD)
5 C***REVISION DATE 890213 (YYMMDD)
6 C***CATEGORY NO. R1
7 C***KEYWORDS LIBRARY=SLATEC,TYPE=INTEGER(I1MACH-I),MACHINE CONSTANTS
8 C***AUTHOR FOX, P. A., (BELL LABS)
9 C HALL, A. D., (BELL LABS)
10 C SCHRYER, N. L., (BELL LABS)
11 C***PURPOSE Returns integer machine dependent constants
12 C***DESCRIPTION
13 C
14 C I1MACH can be used to obtain machine-dependent parameters
15 C for the local machine environment. It is a function
16 C subroutine with one (input) argument, and can be called
17 C as follows, for example
18 C
19 C K = I1MACH(I)
20 C
21 C where I=1,...,16. The (output) value of K above is
22 C determined by the (input) value of I. The results for
23 C various values of I are discussed below.
24 C
25 C I/O unit numbers.
26 C I1MACH( 1) = the standard input unit.
27 C I1MACH( 2) = the standard output unit.
28 C I1MACH( 3) = the standard punch unit.
29 C I1MACH( 4) = the standard error message unit.
30 C
31 C Words.
32 C I1MACH( 5) = the number of bits per integer storage unit.
33 C I1MACH( 6) = the number of characters per integer storage unit.
34 C
35 C Integers.
36 C assume integers are represented in the S-digit, base-A form
37 C
38 C sign ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
39 C
40 C where 0 .LE. X(I) .LT. A for I=0,...,S-1.
41 C I1MACH( 7) = A, the base.
42 C I1MACH( 8) = S, the number of base-A digits.
43 C I1MACH( 9) = A**S - 1, the largest magnitude.
44 C
45 C Floating-Point Numbers.
46 C Assume floating-point numbers are represented in the T-digit,
47 C base-B form
48 C sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
49 C
50 C where 0 .LE. X(I) .LT. B for I=1,...,T,
51 C 0 .LT. X(1), and EMIN .LE. E .LE. EMAX.
52 C I1MACH(10) = B, the base.
53 C
54 C Single-Precision
55 C I1MACH(11) = T, the number of base-B digits.
56 C I1MACH(12) = EMIN, the smallest exponent E.
57 C I1MACH(13) = EMAX, the largest exponent E.
58 C
59 C Double-Precision
60 C I1MACH(14) = T, the number of base-B digits.
61 C I1MACH(15) = EMIN, the smallest exponent E.
62 C I1MACH(16) = EMAX, the largest exponent E.
63 C
64 C To alter this function for a particular environment,
65 C the desired set of DATA statements should be activated by
66 C removing the C from column 1. Also, the values of
67 C I1MACH(1) - I1MACH(4) should be checked for consistency
68 C with the local operating system.
69 C
70 C***REFERENCES FOX P.A., HALL A.D., SCHRYER N.L.,*FRAMEWORK FOR A
71 C PORTABLE LIBRARY*, ACM TRANSACTIONS ON MATHEMATICAL
72 C SOFTWARE, VOL. 4, NO. 2, JUNE 1978, PP. 177-188.
73 C***ROUTINES CALLED (NONE)
74 C***END PROLOGUE I1MACH
75 C
76 INTEGER IMACH(16),OUTPUT
77 SAVE IMACH
78 EQUIVALENCE (IMACH(4),OUTPUT)
79 C
80 C MACHINE CONSTANTS FOR THE IBM PC
81 C
82 DATA IMACH( 1) / 5 /
83 DATA IMACH( 2) / 6 /
84 DATA IMACH( 3) / 0 /
85 DATA IMACH( 4) / 0 /
86 DATA IMACH( 5) / 32 /
87 DATA IMACH( 6) / 4 /
88 DATA IMACH( 7) / 2 /
89 DATA IMACH( 8) / 31 /
90 DATA IMACH( 9) / 2147483647 /
91 DATA IMACH(10) / 2 /
92 DATA IMACH(11) / 24 /
93 DATA IMACH(12) / -125 /
94 DATA IMACH(13) / 127 /
95 DATA IMACH(14) / 53 /
96 DATA IMACH(15) / -1021 /
97 DATA IMACH(16) / 1023 /
98 C
99 C***FIRST EXECUTABLE STATEMENT I1MACH
100 IF (I .LT. 1 .OR. I .GT. 16) GO TO 10
101 C
102 I1MACH = IMACH(I)
103 RETURN
104 C
105 10 CONTINUE
106 WRITE (UNIT = OUTPUT, FMT = 9000)
107 9000 FORMAT ('1ERROR 1 IN I1MACH - I OUT OF BOUNDS')
108 C
109 C CALL FDUMP
110 C
111 C
112 STOP
113 END