Doxygen Source Code Documentation
cdf_80.c
Go to the documentation of this file.00001 #include "cdflib.h" 00002 int ipmpar(int *i) 00003 /* 00004 ----------------------------------------------------------------------- 00005 00006 IPMPAR PROVIDES THE INTEGER MACHINE CONSTANTS FOR THE COMPUTER 00007 THAT IS USED. IT IS ASSUMED THAT THE ARGUMENT I IS AN INTEGER 00008 HAVING ONE OF THE VALUES 1-10. IPMPAR(I) HAS THE VALUE ... 00009 00010 INTEGERS. 00011 00012 ASSUME INTEGERS ARE REPRESENTED IN THE N-DIGIT, BASE-A FORM 00013 00014 SIGN ( X(N-1)*A**(N-1) + ... + X(1)*A + X(0) ) 00015 00016 WHERE 0 .LE. X(I) .LT. A FOR I=0,...,N-1. 00017 00018 IPMPAR(1) = A, THE BASE. 00019 00020 IPMPAR(2) = N, THE NUMBER OF BASE-A DIGITS. 00021 00022 IPMPAR(3) = A**N - 1, THE LARGEST MAGNITUDE. 00023 00024 FLOATING-POINT NUMBERS. 00025 00026 IT IS ASSUMED THAT THE SINGLE AND DOUBLE PRECISION FLOATING 00027 POINT ARITHMETICS HAVE THE SAME BASE, SAY B, AND THAT THE 00028 NONZERO NUMBERS ARE REPRESENTED IN THE FORM 00029 00030 SIGN (B**E) * (X(1)/B + ... + X(M)/B**M) 00031 00032 WHERE X(I) = 0,1,...,B-1 FOR I=1,...,M, 00033 X(1) .GE. 1, AND EMIN .LE. E .LE. EMAX. 00034 00035 IPMPAR(4) = B, THE BASE. 00036 00037 SINGLE-PRECISION 00038 00039 IPMPAR(5) = M, THE NUMBER OF BASE-B DIGITS. 00040 00041 IPMPAR(6) = EMIN, THE SMALLEST EXPONENT E. 00042 00043 IPMPAR(7) = EMAX, THE LARGEST EXPONENT E. 00044 00045 DOUBLE-PRECISION 00046 00047 IPMPAR(8) = M, THE NUMBER OF BASE-B DIGITS. 00048 00049 IPMPAR(9) = EMIN, THE SMALLEST EXPONENT E. 00050 00051 IPMPAR(10) = EMAX, THE LARGEST EXPONENT E. 00052 00053 ----------------------------------------------------------------------- 00054 00055 TO DEFINE THIS FUNCTION FOR THE COMPUTER BEING USED REMOVE 00056 THE COMMENT DELIMITORS FROM THE DEFINITIONS DIRECTLY BELOW THE NAME 00057 OF THE MACHINE 00058 00059 *** RWCox: at this time, the IEEE parameters are enabled. 00060 00061 ----------------------------------------------------------------------- 00062 00063 IPMPAR IS AN ADAPTATION OF THE FUNCTION I1MACH, WRITTEN BY 00064 P.A. FOX, A.D. HALL, AND N.L. SCHRYER (BELL LABORATORIES). 00065 IPMPAR WAS FORMED BY A.H. MORRIS (NSWC). THE CONSTANTS ARE 00066 FROM BELL LABORATORIES, NSWC, AND OTHER SOURCES. 00067 00068 ----------------------------------------------------------------------- 00069 .. Scalar Arguments .. 00070 */ 00071 { 00072 static int imach[11]; 00073 static int outval ; 00074 /* MACHINE CONSTANTS FOR AMDAHL MACHINES. */ 00075 /* 00076 imach[1] = 2; 00077 imach[2] = 31; 00078 imach[3] = 2147483647; 00079 imach[4] = 16; 00080 imach[5] = 6; 00081 imach[6] = -64; 00082 imach[7] = 63; 00083 imach[8] = 14; 00084 imach[9] = -64; 00085 imach[10] = 63; 00086 */ 00087 /* MACHINE CONSTANTS FOR THE AT&T 3B SERIES, AT&T 00088 PC 7300, AND AT&T 6300. */ 00089 /* 00090 imach[1] = 2; 00091 imach[2] = 31; 00092 imach[3] = 2147483647; 00093 imach[4] = 2; 00094 imach[5] = 24; 00095 imach[6] = -125; 00096 imach[7] = 128; 00097 imach[8] = 53; 00098 imach[9] = -1021; 00099 imach[10] = 1024; 00100 */ 00101 /* MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM. */ 00102 /* 00103 imach[1] = 2; 00104 imach[2] = 33; 00105 imach[3] = 8589934591; 00106 imach[4] = 2; 00107 imach[5] = 24; 00108 imach[6] = -256; 00109 imach[7] = 255; 00110 imach[8] = 60; 00111 imach[9] = -256; 00112 imach[10] = 255; 00113 */ 00114 /* MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM. */ 00115 /* 00116 imach[1] = 2; 00117 imach[2] = 39; 00118 imach[3] = 549755813887; 00119 imach[4] = 8; 00120 imach[5] = 13; 00121 imach[6] = -50; 00122 imach[7] = 76; 00123 imach[8] = 26; 00124 imach[9] = -50; 00125 imach[10] = 76; 00126 */ 00127 /* MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS. */ 00128 /* 00129 imach[1] = 2; 00130 imach[2] = 39; 00131 imach[3] = 549755813887; 00132 imach[4] = 8; 00133 imach[5] = 13; 00134 imach[6] = -50; 00135 imach[7] = 76; 00136 imach[8] = 26; 00137 imach[9] = -32754; 00138 imach[10] = 32780; 00139 */ 00140 /* MACHINE CONSTANTS FOR THE CDC 6000/7000 SERIES 00141 60 BIT ARITHMETIC, AND THE CDC CYBER 995 64 BIT 00142 ARITHMETIC (NOS OPERATING SYSTEM). */ 00143 /* 00144 imach[1] = 2; 00145 imach[2] = 48; 00146 imach[3] = 281474976710655; 00147 imach[4] = 2; 00148 imach[5] = 48; 00149 imach[6] = -974; 00150 imach[7] = 1070; 00151 imach[8] = 95; 00152 imach[9] = -926; 00153 imach[10] = 1070; 00154 */ 00155 /* MACHINE CONSTANTS FOR THE CDC CYBER 995 64 BIT 00156 ARITHMETIC (NOS/VE OPERATING SYSTEM). */ 00157 /* 00158 imach[1] = 2; 00159 imach[2] = 63; 00160 imach[3] = 9223372036854775807; 00161 imach[4] = 2; 00162 imach[5] = 48; 00163 imach[6] = -4096; 00164 imach[7] = 4095; 00165 imach[8] = 96; 00166 imach[9] = -4096; 00167 imach[10] = 4095; 00168 */ 00169 /* MACHINE CONSTANTS FOR THE CRAY 1, XMP, 2, AND 3. */ 00170 /* 00171 imach[1] = 2; 00172 imach[2] = 63; 00173 imach[3] = 9223372036854775807; 00174 imach[4] = 2; 00175 imach[5] = 47; 00176 imach[6] = -8189; 00177 imach[7] = 8190; 00178 imach[8] = 94; 00179 imach[9] = -8099; 00180 imach[10] = 8190; 00181 */ 00182 /* MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200. */ 00183 /* 00184 imach[1] = 2; 00185 imach[2] = 15; 00186 imach[3] = 32767; 00187 imach[4] = 16; 00188 imach[5] = 6; 00189 imach[6] = -64; 00190 imach[7] = 63; 00191 imach[8] = 14; 00192 imach[9] = -64; 00193 imach[10] = 63; 00194 */ 00195 /* MACHINE CONSTANTS FOR THE HARRIS 220. */ 00196 /* 00197 imach[1] = 2; 00198 imach[2] = 23; 00199 imach[3] = 8388607; 00200 imach[4] = 2; 00201 imach[5] = 23; 00202 imach[6] = -127; 00203 imach[7] = 127; 00204 imach[8] = 38; 00205 imach[9] = -127; 00206 imach[10] = 127; 00207 */ 00208 /* MACHINE CONSTANTS FOR THE HONEYWELL 600/6000 00209 AND DPS 8/70 SERIES. */ 00210 /* 00211 imach[1] = 2; 00212 imach[2] = 35; 00213 imach[3] = 34359738367; 00214 imach[4] = 2; 00215 imach[5] = 27; 00216 imach[6] = -127; 00217 imach[7] = 127; 00218 imach[8] = 63; 00219 imach[9] = -127; 00220 imach[10] = 127; 00221 */ 00222 /* MACHINE CONSTANTS FOR THE HP 2100 00223 3 WORD DOUBLE PRECISION OPTION WITH FTN4 */ 00224 /* 00225 imach[1] = 2; 00226 imach[2] = 15; 00227 imach[3] = 32767; 00228 imach[4] = 2; 00229 imach[5] = 23; 00230 imach[6] = -128; 00231 imach[7] = 127; 00232 imach[8] = 39; 00233 imach[9] = -128; 00234 imach[10] = 127; 00235 */ 00236 /* MACHINE CONSTANTS FOR THE HP 2100 00237 4 WORD DOUBLE PRECISION OPTION WITH FTN4 */ 00238 /* 00239 imach[1] = 2; 00240 imach[2] = 15; 00241 imach[3] = 32767; 00242 imach[4] = 2; 00243 imach[5] = 23; 00244 imach[6] = -128; 00245 imach[7] = 127; 00246 imach[8] = 55; 00247 imach[9] = -128; 00248 imach[10] = 127; 00249 */ 00250 /* MACHINE CONSTANTS FOR THE HP 9000. */ 00251 /* 00252 imach[1] = 2; 00253 imach[2] = 31; 00254 imach[3] = 2147483647; 00255 imach[4] = 2; 00256 imach[5] = 24; 00257 imach[6] = -126; 00258 imach[7] = 128; 00259 imach[8] = 53; 00260 imach[9] = -1021; 00261 imach[10] = 1024; 00262 */ 00263 /* MACHINE CONSTANTS FOR THE IBM 360/370 SERIES, 00264 THE ICL 2900, THE ITEL AS/6, THE XEROX SIGMA 00265 5/7/9 AND THE SEL SYSTEMS 85/86. */ 00266 /* 00267 imach[1] = 2; 00268 imach[2] = 31; 00269 imach[3] = 2147483647; 00270 imach[4] = 16; 00271 imach[5] = 6; 00272 imach[6] = -64; 00273 imach[7] = 63; 00274 imach[8] = 14; 00275 imach[9] = -64; 00276 imach[10] = 63; 00277 */ 00278 /* MACHINE CONSTANTS FOR THE IBM PC. */ 00279 /* 00280 imach[1] = 2; 00281 imach[2] = 31; 00282 imach[3] = 2147483647; 00283 imach[4] = 2; 00284 imach[5] = 24; 00285 imach[6] = -125; 00286 imach[7] = 128; 00287 imach[8] = 53; 00288 imach[9] = -1021; 00289 imach[10] = 1024; 00290 */ 00291 /* MACHINE CONSTANTS FOR THE MACINTOSH II - ABSOFT 00292 MACFORTRAN II. */ 00293 /* 00294 imach[1] = 2; 00295 imach[2] = 31; 00296 imach[3] = 2147483647; 00297 imach[4] = 2; 00298 imach[5] = 24; 00299 imach[6] = -125; 00300 imach[7] = 128; 00301 imach[8] = 53; 00302 imach[9] = -1021; 00303 imach[10] = 1024; 00304 */ 00305 /* MACHINE CONSTANTS FOR THE MICROVAX - VMS FORTRAN. */ 00306 /* 00307 imach[1] = 2; 00308 imach[2] = 31; 00309 imach[3] = 2147483647; 00310 imach[4] = 2; 00311 imach[5] = 24; 00312 imach[6] = -127; 00313 imach[7] = 127; 00314 imach[8] = 56; 00315 imach[9] = -127; 00316 imach[10] = 127; 00317 */ 00318 /* MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR). */ 00319 /* 00320 imach[1] = 2; 00321 imach[2] = 35; 00322 imach[3] = 34359738367; 00323 imach[4] = 2; 00324 imach[5] = 27; 00325 imach[6] = -128; 00326 imach[7] = 127; 00327 imach[8] = 54; 00328 imach[9] = -101; 00329 imach[10] = 127; 00330 */ 00331 /* MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR). */ 00332 /* 00333 imach[1] = 2; 00334 imach[2] = 35; 00335 imach[3] = 34359738367; 00336 imach[4] = 2; 00337 imach[5] = 27; 00338 imach[6] = -128; 00339 imach[7] = 127; 00340 imach[8] = 62; 00341 imach[9] = -128; 00342 imach[10] = 127; 00343 */ 00344 /* MACHINE CONSTANTS FOR THE PDP-11 FORTRAN SUPPORTING 00345 32-BIT INTEGER ARITHMETIC. */ 00346 /* 00347 imach[1] = 2; 00348 imach[2] = 31; 00349 imach[3] = 2147483647; 00350 imach[4] = 2; 00351 imach[5] = 24; 00352 imach[6] = -127; 00353 imach[7] = 127; 00354 imach[8] = 56; 00355 imach[9] = -127; 00356 imach[10] = 127; 00357 */ 00358 /* MACHINE CONSTANTS FOR THE SEQUENT BALANCE 8000. */ 00359 /* 00360 imach[1] = 2; 00361 imach[2] = 31; 00362 imach[3] = 2147483647; 00363 imach[4] = 2; 00364 imach[5] = 24; 00365 imach[6] = -125; 00366 imach[7] = 128; 00367 imach[8] = 53; 00368 imach[9] = -1021; 00369 imach[10] = 1024; 00370 */ 00371 /* MACHINE CONSTANTS FOR THE SILICON GRAPHICS IRIS-4D 00372 SERIES (MIPS R3000 PROCESSOR). */ 00373 /* 00374 imach[1] = 2; 00375 imach[2] = 31; 00376 imach[3] = 2147483647; 00377 imach[4] = 2; 00378 imach[5] = 24; 00379 imach[6] = -125; 00380 imach[7] = 128; 00381 imach[8] = 53; 00382 imach[9] = -1021; 00383 imach[10] = 1024; 00384 */ 00385 /* MACHINE CONSTANTS FOR IEEE ARITHMETIC MACHINES, SUCH AS THE AT&T 00386 3B SERIES, MOTOROLA 68000 BASED MACHINES (E.G. SUN 3 AND AT&T 00387 PC 7300), AND 8087 BASED MICROS (E.G. IBM PC AND AT&T 6300). */ 00388 00389 imach[1] = 2; 00390 imach[2] = 31; 00391 imach[3] = 2147483647; 00392 imach[4] = 2; 00393 imach[5] = 24; 00394 imach[6] = -125; 00395 imach[7] = 128; 00396 imach[8] = 53; 00397 imach[9] = -1021; 00398 imach[10] = 1024; 00399 00400 /* MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES. */ 00401 /* 00402 imach[1] = 2; 00403 imach[2] = 35; 00404 imach[3] = 34359738367; 00405 imach[4] = 2; 00406 imach[5] = 27; 00407 imach[6] = -128; 00408 imach[7] = 127; 00409 imach[8] = 60; 00410 imach[9] = -1024; 00411 imach[10] = 1023; 00412 */ 00413 /* MACHINE CONSTANTS FOR THE VAX 11/780. */ 00414 /* 00415 imach[1] = 2; 00416 imach[2] = 31; 00417 imach[3] = 2147483647; 00418 imach[4] = 2; 00419 imach[5] = 24; 00420 imach[6] = -127; 00421 imach[7] = 127; 00422 imach[8] = 56; 00423 imach[9] = -127; 00424 imach[10] = 127; 00425 */ 00426 outval = imach[*i]; 00427 return outval ; 00428 }