forked from chrchang/plink-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipmpar.h
433 lines (400 loc) · 9.24 KB
/
ipmpar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
#ifndef __IPMPAR_CPP__
#define __IPMPAR_CPP__
/*
-----------------------------------------------------------------------
IPMPAR PROVIDES THE INTEGER MACHINE CONSTANTS FOR THE COMPUTER
THAT IS USED. IT IS ASSUMED THAT THE ARGUMENT I IS AN INTEGER
HAVING ONE OF THE VALUES 1-10. IPMPAR(I) HAS THE VALUE ...
INTEGERS.
ASSUME INTEGERS ARE REPRESENTED IN THE N-DIGIT, BASE-A FORM
SIGN ( X(N-1)*A**(N-1) + ... + X(1)*A + X(0) )
WHERE 0 .LE. X(I) .LT. A FOR I=0,...,N-1.
IPMPAR(1) = A, THE BASE.
IPMPAR(2) = N, THE NUMBER OF BASE-A DIGITS.
IPMPAR(3) = A**N - 1, THE LARGEST MAGNITUDE.
FLOATING-POINT NUMBERS.
IT IS ASSUMED THAT THE SINGLE AND DOUBLE PRECISION FLOATING
POINT ARITHMETICS HAVE THE SAME BASE, SAY B, AND THAT THE
NONZERO NUMBERS ARE REPRESENTED IN THE FORM
SIGN (B**E) * (X(1)/B + ... + X(M)/B**M)
WHERE X(I) = 0,1,...,B-1 FOR I=1,...,M,
X(1) .GE. 1, AND EMIN .LE. E .LE. EMAX.
IPMPAR(4) = B, THE BASE.
SINGLE-PRECISION
IPMPAR(5) = M, THE NUMBER OF BASE-B DIGITS.
IPMPAR(6) = EMIN, THE SMALLEST EXPONENT E.
IPMPAR(7) = EMAX, THE LARGEST EXPONENT E.
DOUBLE-PRECISION
IPMPAR(8) = M, THE NUMBER OF BASE-B DIGITS.
IPMPAR(9) = EMIN, THE SMALLEST EXPONENT E.
IPMPAR(10) = EMAX, THE LARGEST EXPONENT E.
-----------------------------------------------------------------------
TO DEFINE THIS FUNCTION FOR THE COMPUTER BEING USED REMOVE
THE COMMENT DELIMITORS FROM THE DEFINITIONS DIRECTLY BELOW THE NAME
OF THE MACHINE
-----------------------------------------------------------------------
IPMPAR IS AN ADAPTATION OF THE FUNCTION I1MACH, WRITTEN BY
P.A. FOX, A.D. HALL, AND N.L. SCHRYER (BELL LABORATORIES).
IPMPAR WAS FORMED BY A.H. MORRIS (NSWC). THE CONSTANTS ARE
FROM BELL LABORATORIES, NSWC, AND OTHER SOURCES.
-----------------------------------------------------------------------
.. Scalar Arguments ..
*/
int ipmpar(int *i)
{
static int imach[11];
static int ipmpar;
/* MACHINE CONSTANTS FOR AMDAHL MACHINES. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 16;
imach[5] = 6;
imach[6] = -64;
imach[7] = 63;
imach[8] = 14;
imach[9] = -64;
imach[10] = 63;
*/
/* MACHINE CONSTANTS FOR THE AT&T 3B SERIES, AT&T
PC 7300, AND AT&T 6300. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -125;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
*/
/* MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM. */
/*
imach[1] = 2;
imach[2] = 33;
imach[3] = 8589934591;
imach[4] = 2;
imach[5] = 24;
imach[6] = -256;
imach[7] = 255;
imach[8] = 60;
imach[9] = -256;
imach[10] = 255;
*/
/* MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM. */
/*
imach[1] = 2;
imach[2] = 39;
imach[3] = 549755813887;
imach[4] = 8;
imach[5] = 13;
imach[6] = -50;
imach[7] = 76;
imach[8] = 26;
imach[9] = -50;
imach[10] = 76;
*/
/* MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS. */
/*
imach[1] = 2;
imach[2] = 39;
imach[3] = 549755813887;
imach[4] = 8;
imach[5] = 13;
imach[6] = -50;
imach[7] = 76;
imach[8] = 26;
imach[9] = -32754;
imach[10] = 32780;
*/
/* MACHINE CONSTANTS FOR THE CDC 6000/7000 SERIES
60 BIT ARITHMETIC, AND THE CDC CYBER 995 64 BIT
ARITHMETIC (NOS OPERATING SYSTEM). */
/*
imach[1] = 2;
imach[2] = 48;
imach[3] = 281474976710655;
imach[4] = 2;
imach[5] = 48;
imach[6] = -974;
imach[7] = 1070;
imach[8] = 95;
imach[9] = -926;
imach[10] = 1070;
*/
/* MACHINE CONSTANTS FOR THE CDC CYBER 995 64 BIT
ARITHMETIC (NOS/VE OPERATING SYSTEM). */
/*
imach[1] = 2;
imach[2] = 63;
imach[3] = 9223372036854775807;
imach[4] = 2;
imach[5] = 48;
imach[6] = -4096;
imach[7] = 4095;
imach[8] = 96;
imach[9] = -4096;
imach[10] = 4095;
*/
/* MACHINE CONSTANTS FOR THE CRAY 1, XMP, 2, AND 3. */
/*
imach[1] = 2;
imach[2] = 63;
imach[3] = 9223372036854775807;
imach[4] = 2;
imach[5] = 47;
imach[6] = -8189;
imach[7] = 8190;
imach[8] = 94;
imach[9] = -8099;
imach[10] = 8190;
*/
/* MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200. */
/*
imach[1] = 2;
imach[2] = 15;
imach[3] = 32767;
imach[4] = 16;
imach[5] = 6;
imach[6] = -64;
imach[7] = 63;
imach[8] = 14;
imach[9] = -64;
imach[10] = 63;
*/
/* MACHINE CONSTANTS FOR THE HARRIS 220. */
/*
imach[1] = 2;
imach[2] = 23;
imach[3] = 8388607;
imach[4] = 2;
imach[5] = 23;
imach[6] = -127;
imach[7] = 127;
imach[8] = 38;
imach[9] = -127;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE HONEYWELL 600/6000
AND DPS 8/70 SERIES. */
/*
imach[1] = 2;
imach[2] = 35;
imach[3] = 34359738367;
imach[4] = 2;
imach[5] = 27;
imach[6] = -127;
imach[7] = 127;
imach[8] = 63;
imach[9] = -127;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE HP 2100
3 WORD DOUBLE PRECISION OPTION WITH FTN4 */
/*
imach[1] = 2;
imach[2] = 15;
imach[3] = 32767;
imach[4] = 2;
imach[5] = 23;
imach[6] = -128;
imach[7] = 127;
imach[8] = 39;
imach[9] = -128;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE HP 2100
4 WORD DOUBLE PRECISION OPTION WITH FTN4 */
/*
imach[1] = 2;
imach[2] = 15;
imach[3] = 32767;
imach[4] = 2;
imach[5] = 23;
imach[6] = -128;
imach[7] = 127;
imach[8] = 55;
imach[9] = -128;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE HP 9000. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -126;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
*/
/* MACHINE CONSTANTS FOR THE IBM 360/370 SERIES,
THE ICL 2900, THE ITEL AS/6, THE XEROX SIGMA
5/7/9 AND THE SEL SYSTEMS 85/86. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 16;
imach[5] = 6;
imach[6] = -64;
imach[7] = 63;
imach[8] = 14;
imach[9] = -64;
imach[10] = 63;
*/
/* MACHINE CONSTANTS FOR THE IBM PC. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -125;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
*/
/* MACHINE CONSTANTS FOR THE MACINTOSH II - ABSOFT
MACFORTRAN II. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -125;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
*/
/* MACHINE CONSTANTS FOR THE MICROVAX - VMS FORTRAN. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -127;
imach[7] = 127;
imach[8] = 56;
imach[9] = -127;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR). */
/*
imach[1] = 2;
imach[2] = 35;
imach[3] = 34359738367;
imach[4] = 2;
imach[5] = 27;
imach[6] = -128;
imach[7] = 127;
imach[8] = 54;
imach[9] = -101;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR). */
/*
imach[1] = 2;
imach[2] = 35;
imach[3] = 34359738367;
imach[4] = 2;
imach[5] = 27;
imach[6] = -128;
imach[7] = 127;
imach[8] = 62;
imach[9] = -128;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE PDP-11 FORTRAN SUPPORTING
32-BIT INTEGER ARITHMETIC. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -127;
imach[7] = 127;
imach[8] = 56;
imach[9] = -127;
imach[10] = 127;
*/
/* MACHINE CONSTANTS FOR THE SEQUENT BALANCE 8000. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -125;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
*/
/* MACHINE CONSTANTS FOR THE SILICON GRAPHICS IRIS-4D
SERIES (MIPS R3000 PROCESSOR). */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -125;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
*/
/* MACHINE CONSTANTS FOR IEEE ARITHMETIC MACHINES, SUCH AS THE AT&T
3B SERIES, MOTOROLA 68000 BASED MACHINES (E.G. SUN 3 AND AT&T
PC 7300), AND 8087 BASED MICROS (E.G. IBM PC AND AT&T 6300). */
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -125;
imach[7] = 128;
imach[8] = 53;
imach[9] = -1021;
imach[10] = 1024;
/* MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES. */
/*
imach[1] = 2;
imach[2] = 35;
imach[3] = 34359738367;
imach[4] = 2;
imach[5] = 27;
imach[6] = -128;
imach[7] = 127;
imach[8] = 60;
imach[9] = -1024;
imach[10] = 1023;
*/
/* MACHINE CONSTANTS FOR THE VAX 11/780. */
/*
imach[1] = 2;
imach[2] = 31;
imach[3] = 2147483647;
imach[4] = 2;
imach[5] = 24;
imach[6] = -127;
imach[7] = 127;
imach[8] = 56;
imach[9] = -127;
imach[10] = 127;
*/
ipmpar = imach[*i];
return ipmpar;
}
#endif