source: LMDZ5/trunk/libf/bibio/i1mach.F @ 1972

Last change on this file since 1972 was 1907, checked in by lguez, 11 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
Name of program: LMDZ
Creation date: 1984
Version: LMDZ5
License: CeCILL version 2
Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
See the license file in the root directory

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 4.4 KB
Line 
1*DECK I1MACH
2      INTEGER FUNCTION I1MACH (I)
3C***BEGIN PROLOGUE  I1MACH
4C***PURPOSE  Return integer machine dependent constants.
5C***LIBRARY   SLATEC
6C***CATEGORY  R1
7C***TYPE      INTEGER (I1MACH-I)
8C***KEYWORDS  MACHINE CONSTANTS
9C***AUTHOR  Fox, P. A., (Bell Labs)
10C           Hall, A. D., (Bell Labs)
11C           Schryer, N. L., (Bell Labs)
12C***DESCRIPTION
13C
14C   I1MACH can be used to obtain machine-dependent parameters for the
15C   local machine environment.  It is a function subprogram with one
16C   (input) argument and can be referenced as follows:
17C
18C        K = I1MACH(I)
19C
20C   where I=1,...,16.  The (output) value of K above is determined by
21C   the (input) value of I.  The results for various values of I are
22C   discussed below.
23C
24C   I/O unit numbers:
25C     I1MACH( 1) = the standard input unit.
26C     I1MACH( 2) = the standard output unit.
27C     I1MACH( 3) = the standard punch unit.
28C     I1MACH( 4) = the standard error message unit.
29C
30C   Words:
31C     I1MACH( 5) = the number of bits per integer storage unit.
32C     I1MACH( 6) = the number of characters per integer storage unit.
33C
34C   Integers:
35C     assume integers are represented in the S-digit, base-A form
36C
37C                sign ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
38C
39C                where 0 .LE. X(I) .LT. A for I=0,...,S-1.
40C     I1MACH( 7) = A, the base.
41C     I1MACH( 8) = S, the number of base-A digits.
42C     I1MACH( 9) = A**S - 1, the largest magnitude.
43C
44C   Floating-Point Numbers:
45C     Assume floating-point numbers are represented in the T-digit,
46C     base-B form
47C                sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
48C
49C                where 0 .LE. X(I) .LT. B for I=1,...,T,
50C                0 .LT. X(1), and EMIN .LE. E .LE. EMAX.
51C     I1MACH(10) = B, the base.
52C
53C   Single-Precision:
54C     I1MACH(11) = T, the number of base-B digits.
55C     I1MACH(12) = EMIN, the smallest exponent E.
56C     I1MACH(13) = EMAX, the largest exponent E.
57C
58C   Double-Precision:
59C     I1MACH(14) = T, the number of base-B digits.
60C     I1MACH(15) = EMIN, the smallest exponent E.
61C     I1MACH(16) = EMAX, the largest exponent E.
62C
63C   To alter this function for a particular environment, the desired
64C   set of DATA statements should be activated by removing the C from
65C   column 1.  Also, the values of I1MACH(1) - I1MACH(4) should be
66C   checked for consistency with the local operating system.
67C
68C***REFERENCES  P. A. Fox, A. D. Hall and N. L. Schryer, Framework for
69C                 a portable library, ACM Transactions on Mathematical
70C                 Software 4, 2 (June 1978), pp. 177-188.
71C***ROUTINES CALLED  (NONE)
72C***REVISION HISTORY  (YYMMDD)
73C   750101  DATE WRITTEN
74C   891012  Added VAX G-floating constants.  (WRB)
75C   891012  REVISION DATE from Version 3.2
76C   891214  Prologue converted to Version 4.0 format.  (BAB)
77C   900618  Added DEC RISC constants.  (WRB)
78C   900723  Added IBM RS 6000 constants.  (WRB)
79C   901009  Correct I1MACH(7) for IBM Mainframes. Should be 2 not 16.
80C           (RWC)
81C   910710  Added HP 730 constants.  (SMR)
82C   911114  Added Convex IEEE constants.  (WRB)
83C   920121  Added SUN -r8 compiler option constants.  (WRB)
84C   920229  Added Touchstone Delta i860 constants.  (WRB)
85C   920501  Reformatted the REFERENCES section.  (WRB)
86C   920625  Added Convex -p8 and -pd8 compiler option constants.
87C           (BKS, WRB)
88C   930201  Added DEC Alpha and SGI constants.  (RWC and WRB)
89C   930618  Corrected I1MACH(5) for Convex -p8 and -pd8 compiler
90C           options.  (DWL, RWC and WRB).
91C   100623  Use Fortran 95 intrinsic functions (Lionel GUEZ)
92C***END PROLOGUE  I1MACH
93C
94      INTEGER IMACH(16),OUTPUT
95      SAVE IMACH
96      EQUIVALENCE (IMACH(4),OUTPUT)
97C***FIRST EXECUTABLE STATEMENT  I1MACH
98      IMACH( 1) =         5
99      IMACH( 2) =         6
100      IMACH( 3) =         6
101      IMACH( 4) =         6
102      IMACH( 5) =        bit_size(0)
103      IMACH( 6) =         IMACH( 5) / 8
104      IMACH( 7) =         radix(0)
105      IMACH( 8) =        digits(0)
106      IMACH( 9) =     huge(0)
107      IMACH(10) =         radix(0.)
108      IMACH(11) =        digits(0.)
109      IMACH(12) =      minexponent(0.)
110      IMACH(13) =       maxexponent(0.)
111      IMACH(14) =        digits(0d0)
112      IMACH(15) =      minexponent(0d0)
113      IMACH(16) =       maxexponent(0d0)
114      IF (I .LT. 1  .OR.  I .GT. 16) GO TO 10
115C
116      I1MACH = IMACH(I)
117      RETURN
118C
119   10 CONTINUE
120      WRITE (UNIT = OUTPUT, FMT = 9000)
121 9000 FORMAT ('1ERROR    1 IN I1MACH - I OUT OF BOUNDS')
122C
123C     CALL FDUMP
124C
125      STOP
126      END
Note: See TracBrowser for help on using the repository browser.