Change Eclipse configuration
[jabaws.git] / website / archive / binaries / mac / src / disembl / Tisean_3.0.1 / source_f / slatec / i1mach.f
1 *DECK I1MACH
2       INTEGER FUNCTION I1MACH (I)
3 c----------------------------------------------------------------------
4 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!!!
8 c
9 c the other constants are not currently used by TISEAN and not checked
10 c for any particular platform
11 c
12 c----------------------------------------------------------------------
13 C***BEGIN PROLOGUE  I1MACH
14 C***PURPOSE  Return integer machine dependent constants.
15 C***LIBRARY   SLATEC
16 C***CATEGORY  R1
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)
22 C***DESCRIPTION
23 C
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:
27 C
28 C        K = I1MACH(I)
29 C
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
32 C   discussed below.
33 C
34 C   I/O unit numbers:
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.
39 C
40 C   Words:
41 C     I1MACH( 5) = the number of bits per integer storage unit.
42 C     I1MACH( 6) = the number of characters per integer storage unit.
43 C
44 C   Integers:
45 C     assume integers are represented in the S-digit, base-A form
46 C
47 C                sign ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
48 C
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.
53 C
54 C   Floating-Point Numbers:
55 C     Assume floating-point numbers are represented in the T-digit,
56 C     base-B form
57 C                sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
58 C
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.
62 C
63 C   Single-Precision:
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.
67 C
68 C   Double-Precision:
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.
72 C
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.
77 C
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)
83 C   750101  DATE WRITTEN
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.
90 C           (RWC)
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.
97 C           (BKS, WRB)
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
102 C
103       INTEGER IMACH(16),OUTPUT
104       SAVE IMACH
105       EQUIVALENCE (IMACH(4),OUTPUT)
106
107       DATA IMACH( 1) /          5 /
108       DATA IMACH( 2) /          6 /
109       DATA IMACH( 3) /          0 /
110       DATA IMACH( 4) /          0 /
111       DATA IMACH( 5) /         32 /
112       DATA IMACH( 6) /          4 /
113       DATA IMACH( 7) /          2 /
114       DATA IMACH( 8) /         31 /
115       DATA IMACH( 9) / 2147483647 /
116       DATA IMACH(10) /          2 /
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 /
123
124 C***FIRST EXECUTABLE STATEMENT  I1MACH
125       IMACH(1)=ISTDIN()
126       IMACH(2)=ISTDOUT()
127       IMACH(3)=ISTDERR()
128       IMACH(4)=ISTDERR()
129
130       IF (I .LT. 1  .OR.  I .GT. 16) GO TO 10
131 C
132       I1MACH = IMACH(I)
133       RETURN
134 C
135    10 CONTINUE
136       WRITE (UNIT = OUTPUT, FMT = 9000)
137  9000 FORMAT ('1ERROR    1 IN I1MACH - I OUT OF BOUNDS')
138 C
139 C     CALL FDUMP
140 C
141       STOP
142       END