/[ascend]/trunk/linpack/d1mach.f
ViewVC logotype

Contents of /trunk/linpack/d1mach.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download)
Fri Oct 29 20:54:12 2004 UTC (15 years, 8 months ago) by aw0a
File size: 14079 byte(s)
Setting up web subdirectory in repository
1 DOUBLE PRECISION FUNCTION D1MACH(I)
2 C
3 C DOUBLE-PRECISION MACHINE CONSTANTS
4 C
5 C D1MACH( 1) = B**(EMIN-1), THE SMALLEST POSITIVE MAGNITUDE.
6 C
7 C D1MACH( 2) = B**EMAX*(1 - B**(-T)), THE LARGEST MAGNITUDE.
8 C
9 C D1MACH( 3) = B**(-T), THE SMALLEST RELATIVE SPACING.
10 C
11 C D1MACH( 4) = B**(1-T), THE LARGEST RELATIVE SPACING.
12 C
13 C D1MACH( 5) = LOG10(B)
14 C
15 C TO ALTER THIS FUNCTION FOR A PARTICULAR ENVIRONMENT,
16 C THE DESIRED SET OF DATA STATEMENTS SHOULD BE ACTIVATED BY
17 C REMOVING THE C FROM COLUMN 1.
18 C ON RARE MACHINES A STATIC STATEMENT MAY NEED TO BE ADDED.
19 C (BUT PROBABLY MORE SYSTEMS PROHIBIT IT THAN REQUIRE IT.)
20 C
21 C FOR IEEE-ARITHMETIC MACHINES (BINARY STANDARD), ONE OF THE FIRST
22 C TWO SETS OF CONSTANTS BELOW SHOULD BE APPROPRIATE. IF YOU DO NOT
23 C KNOW WHICH SET TO USE, TRY BOTH AND SEE WHICH GIVES PLAUSIBLE
24 C VALUES.
25 C
26 C WHERE POSSIBLE, DECIMAL, OCTAL OR HEXADECIMAL CONSTANTS ARE USED
27 C TO SPECIFY THE CONSTANTS EXACTLY. SOMETIMES THIS REQUIRES USING
28 C EQUIVALENT INTEGER ARRAYS. IF YOUR COMPILER USES HALF-WORD
29 C INTEGERS BY DEFAULT (SOMETIMES CALLED INTEGER*2), YOU MAY NEED TO
30 C CHANGE INTEGER TO INTEGER*4 OR OTHERWISE INSTRUCT YOUR COMPILER
31 C TO USE FULL-WORD INTEGERS IN THE NEXT 5 DECLARATIONS.
32 C
33 C COMMENTS JUST BEFORE THE END STATEMENT (LINES STARTING WITH *)
34 C GIVE C SOURCE FOR D1MACH.
35 C
36 INTEGER SMALL(2)
37 INTEGER LARGE(2)
38 INTEGER RIGHT(2)
39 INTEGER DIVER(2)
40 INTEGER LOG10(2)
41 INTEGER SC
42 C
43 DOUBLE PRECISION DMACH(5)
44 C
45 EQUIVALENCE (DMACH(1),SMALL(1))
46 EQUIVALENCE (DMACH(2),LARGE(1))
47 EQUIVALENCE (DMACH(3),RIGHT(1))
48 EQUIVALENCE (DMACH(4),DIVER(1))
49 EQUIVALENCE (DMACH(5),LOG10(1))
50 C
51 C MACHINE CONSTANTS FOR BIG-ENDIAN IEEE ARITHMETIC (BINARY FORMAT)
52 C MACHINES IN WHICH THE MOST SIGNIFICANT BYTE IS STORED FIRST,
53 C SUCH AS THE AT&T 3B SERIES, MOTOROLA 68000 BASED MACHINES (E.G.
54 C SUN 3), AND MACHINES THAT USE SPARC, HP, OR IBM RISC CHIPS.
55 C
56 c DATA SMALL(1),SMALL(2) / 1048576, 0 /
57 c DATA LARGE(1),LARGE(2) / 2146435071, -1 /
58 c DATA RIGHT(1),RIGHT(2) / 1017118720, 0 /
59 c DATA DIVER(1),DIVER(2) / 1018167296, 0 /
60 c DATA LOG10(1),LOG10(2) / 1070810131, 1352628735 /, SC/987/
61 C
62 C MACHINE CONSTANTS FOR LITTLE-ENDIAN (BINARY) IEEE ARITHMETIC
63 C MACHINES IN WHICH THE LEAST SIGNIFICANT BYTE IS STORED FIRST,
64 C E.G. IBM PCS AND OTHER MACHINES THAT USE INTEL 80X87 OR DEC
65 C ALPHA CHIPS.
66 C
67 DATA SMALL(1),SMALL(2) / 0, 1048576 /
68 DATA LARGE(1),LARGE(2) / -1, 2146435071 /
69 DATA RIGHT(1),RIGHT(2) / 0, 1017118720 /
70 DATA DIVER(1),DIVER(2) / 0, 1018167296 /
71 DATA LOG10(1),LOG10(2) / 1352628735, 1070810131 /, SC/987/
72 C
73 C MACHINE CONSTANTS FOR AMDAHL MACHINES.
74 C
75 C DATA SMALL(1),SMALL(2) / 1048576, 0 /
76 C DATA LARGE(1),LARGE(2) / 2147483647, -1 /
77 C DATA RIGHT(1),RIGHT(2) / 856686592, 0 /
78 C DATA DIVER(1),DIVER(2) / 873463808, 0 /
79 C DATA LOG10(1),LOG10(2) / 1091781651, 1352628735 /, SC/987/
80 C
81 C MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM.
82 C
83 C DATA SMALL(1) / ZC00800000 /
84 C DATA SMALL(2) / Z000000000 /
85 C
86 C DATA LARGE(1) / ZDFFFFFFFF /
87 C DATA LARGE(2) / ZFFFFFFFFF /
88 C
89 C DATA RIGHT(1) / ZCC5800000 /
90 C DATA RIGHT(2) / Z000000000 /
91 C
92 C DATA DIVER(1) / ZCC6800000 /
93 C DATA DIVER(2) / Z000000000 /
94 C
95 C DATA LOG10(1) / ZD00E730E7 /
96 C DATA LOG10(2) / ZC77800DC0 /, SC/987/
97 C
98 C MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM.
99 C
100 C DATA SMALL(1) / O1771000000000000 /
101 C DATA SMALL(2) / O0000000000000000 /
102 C
103 C DATA LARGE(1) / O0777777777777777 /
104 C DATA LARGE(2) / O0007777777777777 /
105 C
106 C DATA RIGHT(1) / O1461000000000000 /
107 C DATA RIGHT(2) / O0000000000000000 /
108 C
109 C DATA DIVER(1) / O1451000000000000 /
110 C DATA DIVER(2) / O0000000000000000 /
111 C
112 C DATA LOG10(1) / O1157163034761674 /
113 C DATA LOG10(2) / O0006677466732724 /, SC/987/
114 C
115 C MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS.
116 C
117 C DATA SMALL(1) / O1771000000000000 /
118 C DATA SMALL(2) / O7770000000000000 /
119 C
120 C DATA LARGE(1) / O0777777777777777 /
121 C DATA LARGE(2) / O7777777777777777 /
122 C
123 C DATA RIGHT(1) / O1461000000000000 /
124 C DATA RIGHT(2) / O0000000000000000 /
125 C
126 C DATA DIVER(1) / O1451000000000000 /
127 C DATA DIVER(2) / O0000000000000000 /
128 C
129 C DATA LOG10(1) / O1157163034761674 /
130 C DATA LOG10(2) / O0006677466732724 /, SC/987/
131 C
132 C MACHINE CONSTANTS FOR FTN4 ON THE CDC 6000/7000 SERIES.
133 C
134 C DATA SMALL(1) / 00564000000000000000B /
135 C DATA SMALL(2) / 00000000000000000000B /
136 C
137 C DATA LARGE(1) / 37757777777777777777B /
138 C DATA LARGE(2) / 37157777777777777774B /
139 C
140 C DATA RIGHT(1) / 15624000000000000000B /
141 C DATA RIGHT(2) / 00000000000000000000B /
142 C
143 C DATA DIVER(1) / 15634000000000000000B /
144 C DATA DIVER(2) / 00000000000000000000B /
145 C
146 C DATA LOG10(1) / 17164642023241175717B /
147 C DATA LOG10(2) / 16367571421742254654B /, SC/987/
148 C
149 C MACHINE CONSTANTS FOR FTN5 ON THE CDC 6000/7000 SERIES.
150 C
151 C DATA SMALL(1) / O"00564000000000000000" /
152 C DATA SMALL(2) / O"00000000000000000000" /
153 C
154 C DATA LARGE(1) / O"37757777777777777777" /
155 C DATA LARGE(2) / O"37157777777777777774" /
156 C
157 C DATA RIGHT(1) / O"15624000000000000000" /
158 C DATA RIGHT(2) / O"00000000000000000000" /
159 C
160 C DATA DIVER(1) / O"15634000000000000000" /
161 C DATA DIVER(2) / O"00000000000000000000" /
162 C
163 C DATA LOG10(1) / O"17164642023241175717" /
164 C DATA LOG10(2) / O"16367571421742254654" /, SC/987/
165 C
166 C MACHINE CONSTANTS FOR CONVEX C-1
167 C
168 C DATA SMALL(1),SMALL(2) / '00100000'X, '00000000'X /
169 C DATA LARGE(1),LARGE(2) / '7FFFFFFF'X, 'FFFFFFFF'X /
170 C DATA RIGHT(1),RIGHT(2) / '3CC00000'X, '00000000'X /
171 C DATA DIVER(1),DIVER(2) / '3CD00000'X, '00000000'X /
172 C DATA LOG10(1),LOG10(2) / '3FF34413'X, '509F79FF'X /, SC/987/
173 C
174 C MACHINE CONSTANTS FOR THE CRAY 1, XMP, 2, AND 3.
175 C
176 C DATA SMALL(1) / 201354000000000000000B /
177 C DATA SMALL(2) / 000000000000000000000B /
178 C
179 C DATA LARGE(1) / 577767777777777777777B /
180 C DATA LARGE(2) / 000007777777777777776B /
181 C
182 C DATA RIGHT(1) / 376434000000000000000B /
183 C DATA RIGHT(2) / 000000000000000000000B /
184 C
185 C DATA DIVER(1) / 376444000000000000000B /
186 C DATA DIVER(2) / 000000000000000000000B /
187 C
188 C DATA LOG10(1) / 377774642023241175717B /
189 C DATA LOG10(2) / 000007571421742254654B /, SC/987/
190 C
191 C MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200
192 C
193 C SMALL, LARGE, RIGHT, DIVER, LOG10 SHOULD BE DECLARED
194 C INTEGER SMALL(4), LARGE(4), RIGHT(4), DIVER(4), LOG10(4)
195 C
196 C NOTE - IT MAY BE APPROPRIATE TO INCLUDE THE FOLLOWING LINE -
197 C STATIC DMACH(5)
198 C
199 C DATA SMALL/20K,3*0/,LARGE/77777K,3*177777K/
200 C DATA RIGHT/31420K,3*0/,DIVER/32020K,3*0/
201 C DATA LOG10/40423K,42023K,50237K,74776K/, SC/987/
202 C
203 C MACHINE CONSTANTS FOR THE HARRIS SLASH 6 AND SLASH 7
204 C
205 C DATA SMALL(1),SMALL(2) / '20000000, '00000201 /
206 C DATA LARGE(1),LARGE(2) / '37777777, '37777577 /
207 C DATA RIGHT(1),RIGHT(2) / '20000000, '00000333 /
208 C DATA DIVER(1),DIVER(2) / '20000000, '00000334 /
209 C DATA LOG10(1),LOG10(2) / '23210115, '10237777 /, SC/987/
210 C
211 C MACHINE CONSTANTS FOR THE HONEYWELL DPS 8/70 SERIES.
212 C
213 C DATA SMALL(1),SMALL(2) / O402400000000, O000000000000 /
214 C DATA LARGE(1),LARGE(2) / O376777777777, O777777777777 /
215 C DATA RIGHT(1),RIGHT(2) / O604400000000, O000000000000 /
216 C DATA DIVER(1),DIVER(2) / O606400000000, O000000000000 /
217 C DATA LOG10(1),LOG10(2) / O776464202324, O117571775714 /, SC/987/
218 C
219 C MACHINE CONSTANTS FOR THE IBM 360/370 SERIES,
220 C THE XEROX SIGMA 5/7/9 AND THE SEL SYSTEMS 85/86.
221 C
222 C DATA SMALL(1),SMALL(2) / Z00100000, Z00000000 /
223 C DATA LARGE(1),LARGE(2) / Z7FFFFFFF, ZFFFFFFFF /
224 C DATA RIGHT(1),RIGHT(2) / Z33100000, Z00000000 /
225 C DATA DIVER(1),DIVER(2) / Z34100000, Z00000000 /
226 C DATA LOG10(1),LOG10(2) / Z41134413, Z509F79FF /, SC/987/
227 C
228 C MACHINE CONSTANTS FOR THE INTERDATA 8/32
229 C WITH THE UNIX SYSTEM FORTRAN 77 COMPILER.
230 C
231 C FOR THE INTERDATA FORTRAN VII COMPILER REPLACE
232 C THE Z'S SPECIFYING HEX CONSTANTS WITH Y'S.
233 C
234 C DATA SMALL(1),SMALL(2) / Z'00100000', Z'00000000' /
235 C DATA LARGE(1),LARGE(2) / Z'7EFFFFFF', Z'FFFFFFFF' /
236 C DATA RIGHT(1),RIGHT(2) / Z'33100000', Z'00000000' /
237 C DATA DIVER(1),DIVER(2) / Z'34100000', Z'00000000' /
238 C DATA LOG10(1),LOG10(2) / Z'41134413', Z'509F79FF' /, SC/987/
239 C
240 C MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR).
241 C
242 C DATA SMALL(1),SMALL(2) / "033400000000, "000000000000 /
243 C DATA LARGE(1),LARGE(2) / "377777777777, "344777777777 /
244 C DATA RIGHT(1),RIGHT(2) / "113400000000, "000000000000 /
245 C DATA DIVER(1),DIVER(2) / "114400000000, "000000000000 /
246 C DATA LOG10(1),LOG10(2) / "177464202324, "144117571776 /, SC/987/
247 C
248 C MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR).
249 C
250 C DATA SMALL(1),SMALL(2) / "000400000000, "000000000000 /
251 C DATA LARGE(1),LARGE(2) / "377777777777, "377777777777 /
252 C DATA RIGHT(1),RIGHT(2) / "103400000000, "000000000000 /
253 C DATA DIVER(1),DIVER(2) / "104400000000, "000000000000 /
254 C DATA LOG10(1),LOG10(2) / "177464202324, "047674776746 /, SC/987/
255 C
256 C MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING
257 C 32-BIT INTEGERS (EXPRESSED IN INTEGER AND OCTAL).
258 C
259 C DATA SMALL(1),SMALL(2) / 8388608, 0 /
260 C DATA LARGE(1),LARGE(2) / 2147483647, -1 /
261 C DATA RIGHT(1),RIGHT(2) / 612368384, 0 /
262 C DATA DIVER(1),DIVER(2) / 620756992, 0 /
263 C DATA LOG10(1),LOG10(2) / 1067065498, -2063872008 /, SC/987/
264 C
265 C DATA SMALL(1),SMALL(2) / O00040000000, O00000000000 /
266 C DATA LARGE(1),LARGE(2) / O17777777777, O37777777777 /
267 C DATA RIGHT(1),RIGHT(2) / O04440000000, O00000000000 /
268 C DATA DIVER(1),DIVER(2) / O04500000000, O00000000000 /
269 C DATA LOG10(1),LOG10(2) / O07746420232, O20476747770 /, SC/987/
270 C
271 C MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING
272 C 16-BIT INTEGERS (EXPRESSED IN INTEGER AND OCTAL).
273 C
274 C SMALL, LARGE, RIGHT, DIVER, LOG10 SHOULD BE DECLARED
275 C INTEGER SMALL(4), LARGE(4), RIGHT(4), DIVER(4), LOG10(4)
276 C
277 C DATA SMALL(1),SMALL(2) / 128, 0 /
278 C DATA SMALL(3),SMALL(4) / 0, 0 /
279 C
280 C DATA LARGE(1),LARGE(2) / 32767, -1 /
281 C DATA LARGE(3),LARGE(4) / -1, -1 /
282 C
283 C DATA RIGHT(1),RIGHT(2) / 9344, 0 /
284 C DATA RIGHT(3),RIGHT(4) / 0, 0 /
285 C
286 C DATA DIVER(1),DIVER(2) / 9472, 0 /
287 C DATA DIVER(3),DIVER(4) / 0, 0 /
288 C
289 C DATA LOG10(1),LOG10(2) / 16282, 8346 /
290 C DATA LOG10(3),LOG10(4) / -31493, -12296 /, SC/987/
291 C
292 C DATA SMALL(1),SMALL(2) / O000200, O000000 /
293 C DATA SMALL(3),SMALL(4) / O000000, O000000 /
294 C
295 C DATA LARGE(1),LARGE(2) / O077777, O177777 /
296 C DATA LARGE(3),LARGE(4) / O177777, O177777 /
297 C
298 C DATA RIGHT(1),RIGHT(2) / O022200, O000000 /
299 C DATA RIGHT(3),RIGHT(4) / O000000, O000000 /
300 C
301 C DATA DIVER(1),DIVER(2) / O022400, O000000 /
302 C DATA DIVER(3),DIVER(4) / O000000, O000000 /
303 C
304 C DATA LOG10(1),LOG10(2) / O037632, O020232 /
305 C DATA LOG10(3),LOG10(4) / O102373, O147770 /, SC/987/
306 C
307 C MACHINE CONSTANTS FOR THE PRIME 50 SERIES SYSTEMS
308 C WITH 32-BIT INTEGERS AND 64V MODE INSTRUCTIONS,
309 C SUPPLIED BY IGOR BRAY.
310 C
311 C DATA SMALL(1),SMALL(2) / :10000000000, :00000100001 /
312 C DATA LARGE(1),LARGE(2) / :17777777777, :37777677775 /
313 C DATA RIGHT(1),RIGHT(2) / :10000000000, :00000000122 /
314 C DATA DIVER(1),DIVER(2) / :10000000000, :00000000123 /
315 C DATA LOG10(1),LOG10(2) / :11504046501, :07674600177 /, SC/987/
316 C
317 C MACHINE CONSTANTS FOR THE SEQUENT BALANCE 8000
318 C
319 C DATA SMALL(1),SMALL(2) / $00000000, $00100000 /
320 C DATA LARGE(1),LARGE(2) / $FFFFFFFF, $7FEFFFFF /
321 C DATA RIGHT(1),RIGHT(2) / $00000000, $3CA00000 /
322 C DATA DIVER(1),DIVER(2) / $00000000, $3CB00000 /
323 C DATA LOG10(1),LOG10(2) / $509F79FF, $3FD34413 /, SC/987/
324 C
325 C MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES.
326 C
327 C DATA SMALL(1),SMALL(2) / O000040000000, O000000000000 /
328 C DATA LARGE(1),LARGE(2) / O377777777777, O777777777777 /
329 C DATA RIGHT(1),RIGHT(2) / O170540000000, O000000000000 /
330 C DATA DIVER(1),DIVER(2) / O170640000000, O000000000000 /
331 C DATA LOG10(1),LOG10(2) / O177746420232, O411757177572 /, SC/987/
332 C
333 C MACHINE CONSTANTS FOR THE VAX UNIX F77 COMPILER
334 C
335 C DATA SMALL(1),SMALL(2) / 128, 0 /
336 C DATA LARGE(1),LARGE(2) / -32769, -1 /
337 C DATA RIGHT(1),RIGHT(2) / 9344, 0 /
338 C DATA DIVER(1),DIVER(2) / 9472, 0 /
339 C DATA LOG10(1),LOG10(2) / 546979738, -805796613 /, SC/987/
340 C
341 C MACHINE CONSTANTS FOR THE VAX-11 WITH
342 C FORTRAN IV-PLUS COMPILER
343 C
344 C DATA SMALL(1),SMALL(2) / Z00000080, Z00000000 /
345 C DATA LARGE(1),LARGE(2) / ZFFFF7FFF, ZFFFFFFFF /
346 C DATA RIGHT(1),RIGHT(2) / Z00002480, Z00000000 /
347 C DATA DIVER(1),DIVER(2) / Z00002500, Z00000000 /
348 C DATA LOG10(1),LOG10(2) / Z209A3F9A, ZCFF884FB /, SC/987/
349 C
350 C MACHINE CONSTANTS FOR VAX/VMS VERSION 2.2
351 C
352 C DATA SMALL(1),SMALL(2) / '80'X, '0'X /
353 C DATA LARGE(1),LARGE(2) / 'FFFF7FFF'X, 'FFFFFFFF'X /
354 C DATA RIGHT(1),RIGHT(2) / '2480'X, '0'X /
355 C DATA DIVER(1),DIVER(2) / '2500'X, '0'X /
356 C DATA LOG10(1),LOG10(2) / '209A3F9A'X, 'CFF884FB'X /, SC/987/
357 C
358 C *** ISSUE STOP 779 IF ALL DATA STATEMENTS ARE COMMENTED...
359 IF (SC .NE. 987) STOP 779
360 C *** ISSUE STOP 778 IF ALL DATA STATEMENTS ARE OBVIOUSLY WRONG...
361 IF (DMACH(4) .GE. 1.0D0) STOP 778
362 IF (I .LT. 1 .OR. I .GT. 5) GOTO 999
363 D1MACH = DMACH(I)
364 RETURN
365 999 WRITE(*,1999) I
366 1999 FORMAT(' D1MACH - I OUT OF BOUNDS',I10)
367 STOP
368 END

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22