1 |
285 |
jeremybenn |
@ignore
|
2 |
|
|
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
This is part of the GNU Fortran manual.
|
5 |
|
|
For copying conditions, see the file gfortran.texi.
|
6 |
|
|
|
7 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
8 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
9 |
|
|
any later version published by the Free Software Foundation; with the
|
10 |
|
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
11 |
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
12 |
|
|
(see below). A copy of the license is included in the gfdl(7) man page.
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
Some basic guidelines for editing this document:
|
16 |
|
|
|
17 |
|
|
(1) The intrinsic procedures are to be listed in alphabetical order.
|
18 |
|
|
(2) The generic name is to be used.
|
19 |
|
|
(3) The specific names are included in the function index and in a
|
20 |
|
|
table at the end of the node (See ABS entry).
|
21 |
|
|
(4) Try to maintain the same style for each entry.
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
@end ignore
|
25 |
|
|
|
26 |
|
|
@tex
|
27 |
|
|
\gdef\acos{\mathop{\rm acos}\nolimits}
|
28 |
|
|
\gdef\asin{\mathop{\rm asin}\nolimits}
|
29 |
|
|
\gdef\atan{\mathop{\rm atan}\nolimits}
|
30 |
|
|
\gdef\acosh{\mathop{\rm acosh}\nolimits}
|
31 |
|
|
\gdef\asinh{\mathop{\rm asinh}\nolimits}
|
32 |
|
|
\gdef\atanh{\mathop{\rm atanh}\nolimits}
|
33 |
|
|
@end tex
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
@node Intrinsic Procedures
|
37 |
|
|
@chapter Intrinsic Procedures
|
38 |
|
|
@cindex intrinsic procedures
|
39 |
|
|
|
40 |
|
|
@menu
|
41 |
|
|
* Introduction: Introduction to Intrinsics
|
42 |
|
|
* @code{ABORT}: ABORT, Abort the program
|
43 |
|
|
* @code{ABS}: ABS, Absolute value
|
44 |
|
|
* @code{ACCESS}: ACCESS, Checks file access modes
|
45 |
|
|
* @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
|
46 |
|
|
* @code{ACOS}: ACOS, Arccosine function
|
47 |
378 |
julius |
* @code{ACOSH}: ACOSH, Inverse hyperbolic cosine function
|
48 |
285 |
jeremybenn |
* @code{ADJUSTL}: ADJUSTL, Left adjust a string
|
49 |
|
|
* @code{ADJUSTR}: ADJUSTR, Right adjust a string
|
50 |
|
|
* @code{AIMAG}: AIMAG, Imaginary part of complex number
|
51 |
|
|
* @code{AINT}: AINT, Truncate to a whole number
|
52 |
|
|
* @code{ALARM}: ALARM, Set an alarm clock
|
53 |
|
|
* @code{ALL}: ALL, Determine if all values are true
|
54 |
|
|
* @code{ALLOCATED}: ALLOCATED, Status of allocatable entity
|
55 |
|
|
* @code{AND}: AND, Bitwise logical AND
|
56 |
|
|
* @code{ANINT}: ANINT, Nearest whole number
|
57 |
|
|
* @code{ANY}: ANY, Determine if any values are true
|
58 |
|
|
* @code{ASIN}: ASIN, Arcsine function
|
59 |
378 |
julius |
* @code{ASINH}: ASINH, Inverse hyperbolic sine function
|
60 |
285 |
jeremybenn |
* @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
|
61 |
|
|
* @code{ATAN}: ATAN, Arctangent function
|
62 |
|
|
* @code{ATAN2}: ATAN2, Arctangent function
|
63 |
378 |
julius |
* @code{ATANH}: ATANH, Inverse hyperbolic tangent function
|
64 |
285 |
jeremybenn |
* @code{BESSEL_J0}: BESSEL_J0, Bessel function of the first kind of order 0
|
65 |
|
|
* @code{BESSEL_J1}: BESSEL_J1, Bessel function of the first kind of order 1
|
66 |
|
|
* @code{BESSEL_JN}: BESSEL_JN, Bessel function of the first kind
|
67 |
|
|
* @code{BESSEL_Y0}: BESSEL_Y0, Bessel function of the second kind of order 0
|
68 |
|
|
* @code{BESSEL_Y1}: BESSEL_Y1, Bessel function of the second kind of order 1
|
69 |
|
|
* @code{BESSEL_YN}: BESSEL_YN, Bessel function of the second kind
|
70 |
|
|
* @code{BIT_SIZE}: BIT_SIZE, Bit size inquiry function
|
71 |
|
|
* @code{BTEST}: BTEST, Bit test function
|
72 |
|
|
* @code{C_ASSOCIATED}: C_ASSOCIATED, Status of a C pointer
|
73 |
|
|
* @code{C_F_POINTER}: C_F_POINTER, Convert C into Fortran pointer
|
74 |
|
|
* @code{C_F_PROCPOINTER}: C_F_PROCPOINTER, Convert C into Fortran procedure pointer
|
75 |
|
|
* @code{C_FUNLOC}: C_FUNLOC, Obtain the C address of a procedure
|
76 |
|
|
* @code{C_LOC}: C_LOC, Obtain the C address of an object
|
77 |
|
|
* @code{C_SIZEOF}: C_SIZEOF, Size in bytes of an expression
|
78 |
|
|
* @code{CEILING}: CEILING, Integer ceiling function
|
79 |
|
|
* @code{CHAR}: CHAR, Integer-to-character conversion function
|
80 |
|
|
* @code{CHDIR}: CHDIR, Change working directory
|
81 |
|
|
* @code{CHMOD}: CHMOD, Change access permissions of files
|
82 |
|
|
* @code{CMPLX}: CMPLX, Complex conversion function
|
83 |
|
|
* @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Get number of command line arguments
|
84 |
|
|
* @code{COMPLEX}: COMPLEX, Complex conversion function
|
85 |
|
|
* @code{CONJG}: CONJG, Complex conjugate function
|
86 |
|
|
* @code{COS}: COS, Cosine function
|
87 |
|
|
* @code{COSH}: COSH, Hyperbolic cosine function
|
88 |
|
|
* @code{COUNT}: COUNT, Count occurrences of TRUE in an array
|
89 |
|
|
* @code{CPU_TIME}: CPU_TIME, CPU time subroutine
|
90 |
|
|
* @code{CSHIFT}: CSHIFT, Circular shift elements of an array
|
91 |
|
|
* @code{CTIME}: CTIME, Subroutine (or function) to convert a time into a string
|
92 |
|
|
* @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
|
93 |
|
|
* @code{DBLE}: DBLE, Double precision conversion function
|
94 |
|
|
* @code{DCMPLX}: DCMPLX, Double complex conversion function
|
95 |
|
|
* @code{DFLOAT}: DFLOAT, Double precision conversion function
|
96 |
|
|
* @code{DIGITS}: DIGITS, Significant digits function
|
97 |
|
|
* @code{DIM}: DIM, Positive difference
|
98 |
|
|
* @code{DOT_PRODUCT}: DOT_PRODUCT, Dot product function
|
99 |
|
|
* @code{DPROD}: DPROD, Double product function
|
100 |
|
|
* @code{DREAL}: DREAL, Double real part function
|
101 |
|
|
* @code{DTIME}: DTIME, Execution time subroutine (or function)
|
102 |
|
|
* @code{EOSHIFT}: EOSHIFT, End-off shift elements of an array
|
103 |
|
|
* @code{EPSILON}: EPSILON, Epsilon function
|
104 |
|
|
* @code{ERF}: ERF, Error function
|
105 |
|
|
* @code{ERFC}: ERFC, Complementary error function
|
106 |
|
|
* @code{ERFC_SCALED}: ERFC_SCALED, Exponentially-scaled complementary error function
|
107 |
|
|
* @code{ETIME}: ETIME, Execution time subroutine (or function)
|
108 |
|
|
* @code{EXIT}: EXIT, Exit the program with status.
|
109 |
|
|
* @code{EXP}: EXP, Exponential function
|
110 |
|
|
* @code{EXPONENT}: EXPONENT, Exponent function
|
111 |
|
|
* @code{FDATE}: FDATE, Subroutine (or function) to get the current time as a string
|
112 |
|
|
* @code{FGET}: FGET, Read a single character in stream mode from stdin
|
113 |
|
|
* @code{FGETC}: FGETC, Read a single character in stream mode
|
114 |
|
|
* @code{FLOAT}: FLOAT, Convert integer to default real
|
115 |
|
|
* @code{FLOOR}: FLOOR, Integer floor function
|
116 |
|
|
* @code{FLUSH}: FLUSH, Flush I/O unit(s)
|
117 |
|
|
* @code{FNUM}: FNUM, File number function
|
118 |
|
|
* @code{FPUT}: FPUT, Write a single character in stream mode to stdout
|
119 |
|
|
* @code{FPUTC}: FPUTC, Write a single character in stream mode
|
120 |
|
|
* @code{FRACTION}: FRACTION, Fractional part of the model representation
|
121 |
|
|
* @code{FREE}: FREE, Memory de-allocation subroutine
|
122 |
|
|
* @code{FSEEK}: FSEEK, Low level file positioning subroutine
|
123 |
|
|
* @code{FSTAT}: FSTAT, Get file status
|
124 |
|
|
* @code{FTELL}: FTELL, Current stream position
|
125 |
|
|
* @code{GAMMA}: GAMMA, Gamma function
|
126 |
|
|
* @code{GERROR}: GERROR, Get last system error message
|
127 |
|
|
* @code{GETARG}: GETARG, Get command line arguments
|
128 |
|
|
* @code{GET_COMMAND}: GET_COMMAND, Get the entire command line
|
129 |
|
|
* @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Get command line arguments
|
130 |
|
|
* @code{GETCWD}: GETCWD, Get current working directory
|
131 |
|
|
* @code{GETENV}: GETENV, Get an environmental variable
|
132 |
|
|
* @code{GET_ENVIRONMENT_VARIABLE}: GET_ENVIRONMENT_VARIABLE, Get an environmental variable
|
133 |
|
|
* @code{GETGID}: GETGID, Group ID function
|
134 |
|
|
* @code{GETLOG}: GETLOG, Get login name
|
135 |
|
|
* @code{GETPID}: GETPID, Process ID function
|
136 |
|
|
* @code{GETUID}: GETUID, User ID function
|
137 |
|
|
* @code{GMTIME}: GMTIME, Convert time to GMT info
|
138 |
|
|
* @code{HOSTNM}: HOSTNM, Get system host name
|
139 |
|
|
* @code{HUGE}: HUGE, Largest number of a kind
|
140 |
|
|
* @code{HYPOT}: HYPOT, Euclidian distance function
|
141 |
|
|
* @code{IACHAR}: IACHAR, Code in @acronym{ASCII} collating sequence
|
142 |
|
|
* @code{IAND}: IAND, Bitwise logical and
|
143 |
|
|
* @code{IARGC}: IARGC, Get the number of command line arguments
|
144 |
|
|
* @code{IBCLR}: IBCLR, Clear bit
|
145 |
|
|
* @code{IBITS}: IBITS, Bit extraction
|
146 |
|
|
* @code{IBSET}: IBSET, Set bit
|
147 |
|
|
* @code{ICHAR}: ICHAR, Character-to-integer conversion function
|
148 |
|
|
* @code{IDATE}: IDATE, Current local time (day/month/year)
|
149 |
|
|
* @code{IEOR}: IEOR, Bitwise logical exclusive or
|
150 |
|
|
* @code{IERRNO}: IERRNO, Function to get the last system error number
|
151 |
|
|
* @code{INDEX}: INDEX intrinsic, Position of a substring within a string
|
152 |
|
|
* @code{INT}: INT, Convert to integer type
|
153 |
|
|
* @code{INT2}: INT2, Convert to 16-bit integer type
|
154 |
|
|
* @code{INT8}: INT8, Convert to 64-bit integer type
|
155 |
|
|
* @code{IOR}: IOR, Bitwise logical or
|
156 |
|
|
* @code{IRAND}: IRAND, Integer pseudo-random number
|
157 |
|
|
* @code{IS_IOSTAT_END}: IS_IOSTAT_END, Test for end-of-file value
|
158 |
|
|
* @code{IS_IOSTAT_EOR}: IS_IOSTAT_EOR, Test for end-of-record value
|
159 |
|
|
* @code{ISATTY}: ISATTY, Whether a unit is a terminal device
|
160 |
|
|
* @code{ISHFT}: ISHFT, Shift bits
|
161 |
|
|
* @code{ISHFTC}: ISHFTC, Shift bits circularly
|
162 |
|
|
* @code{ISNAN}: ISNAN, Tests for a NaN
|
163 |
|
|
* @code{ITIME}: ITIME, Current local time (hour/minutes/seconds)
|
164 |
|
|
* @code{KILL}: KILL, Send a signal to a process
|
165 |
|
|
* @code{KIND}: KIND, Kind of an entity
|
166 |
|
|
* @code{LBOUND}: LBOUND, Lower dimension bounds of an array
|
167 |
|
|
* @code{LEADZ}: LEADZ, Number of leading zero bits of an integer
|
168 |
|
|
* @code{LEN}: LEN, Length of a character entity
|
169 |
|
|
* @code{LEN_TRIM}: LEN_TRIM, Length of a character entity without trailing blank characters
|
170 |
|
|
* @code{LGE}: LGE, Lexical greater than or equal
|
171 |
|
|
* @code{LGT}: LGT, Lexical greater than
|
172 |
|
|
* @code{LINK}: LINK, Create a hard link
|
173 |
|
|
* @code{LLE}: LLE, Lexical less than or equal
|
174 |
|
|
* @code{LLT}: LLT, Lexical less than
|
175 |
|
|
* @code{LNBLNK}: LNBLNK, Index of the last non-blank character in a string
|
176 |
|
|
* @code{LOC}: LOC, Returns the address of a variable
|
177 |
|
|
* @code{LOG}: LOG, Logarithm function
|
178 |
|
|
* @code{LOG10}: LOG10, Base 10 logarithm function
|
179 |
|
|
* @code{LOG_GAMMA}: LOG_GAMMA, Logarithm of the Gamma function
|
180 |
|
|
* @code{LOGICAL}: LOGICAL, Convert to logical type
|
181 |
|
|
* @code{LONG}: LONG, Convert to integer type
|
182 |
|
|
* @code{LSHIFT}: LSHIFT, Left shift bits
|
183 |
|
|
* @code{LSTAT}: LSTAT, Get file status
|
184 |
|
|
* @code{LTIME}: LTIME, Convert time to local time info
|
185 |
|
|
* @code{MALLOC}: MALLOC, Dynamic memory allocation function
|
186 |
|
|
* @code{MATMUL}: MATMUL, matrix multiplication
|
187 |
|
|
* @code{MAX}: MAX, Maximum value of an argument list
|
188 |
|
|
* @code{MAXEXPONENT}: MAXEXPONENT, Maximum exponent of a real kind
|
189 |
|
|
* @code{MAXLOC}: MAXLOC, Location of the maximum value within an array
|
190 |
|
|
* @code{MAXVAL}: MAXVAL, Maximum value of an array
|
191 |
|
|
* @code{MCLOCK}: MCLOCK, Time function
|
192 |
|
|
* @code{MCLOCK8}: MCLOCK8, Time function (64-bit)
|
193 |
|
|
* @code{MERGE}: MERGE, Merge arrays
|
194 |
|
|
* @code{MIN}: MIN, Minimum value of an argument list
|
195 |
|
|
* @code{MINEXPONENT}: MINEXPONENT, Minimum exponent of a real kind
|
196 |
|
|
* @code{MINLOC}: MINLOC, Location of the minimum value within an array
|
197 |
|
|
* @code{MINVAL}: MINVAL, Minimum value of an array
|
198 |
|
|
* @code{MOD}: MOD, Remainder function
|
199 |
|
|
* @code{MODULO}: MODULO, Modulo function
|
200 |
|
|
* @code{MOVE_ALLOC}: MOVE_ALLOC, Move allocation from one object to another
|
201 |
|
|
* @code{MVBITS}: MVBITS, Move bits from one integer to another
|
202 |
|
|
* @code{NEAREST}: NEAREST, Nearest representable number
|
203 |
|
|
* @code{NEW_LINE}: NEW_LINE, New line character
|
204 |
|
|
* @code{NINT}: NINT, Nearest whole number
|
205 |
|
|
* @code{NOT}: NOT, Logical negation
|
206 |
|
|
* @code{NULL}: NULL, Function that returns an disassociated pointer
|
207 |
|
|
* @code{OR}: OR, Bitwise logical OR
|
208 |
|
|
* @code{PACK}: PACK, Pack an array into an array of rank one
|
209 |
|
|
* @code{PERROR}: PERROR, Print system error message
|
210 |
|
|
* @code{PRECISION}: PRECISION, Decimal precision of a real kind
|
211 |
|
|
* @code{PRESENT}: PRESENT, Determine whether an optional dummy argument is specified
|
212 |
|
|
* @code{PRODUCT}: PRODUCT, Product of array elements
|
213 |
|
|
* @code{RADIX}: RADIX, Base of a data model
|
214 |
|
|
* @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number
|
215 |
|
|
* @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence
|
216 |
|
|
* @code{RAND}: RAND, Real pseudo-random number
|
217 |
|
|
* @code{RANGE}: RANGE, Decimal exponent range
|
218 |
|
|
* @code{RAN}: RAN, Real pseudo-random number
|
219 |
|
|
* @code{REAL}: REAL, Convert to real type
|
220 |
|
|
* @code{RENAME}: RENAME, Rename a file
|
221 |
|
|
* @code{REPEAT}: REPEAT, Repeated string concatenation
|
222 |
|
|
* @code{RESHAPE}: RESHAPE, Function to reshape an array
|
223 |
|
|
* @code{RRSPACING}: RRSPACING, Reciprocal of the relative spacing
|
224 |
|
|
* @code{RSHIFT}: RSHIFT, Right shift bits
|
225 |
|
|
* @code{SCALE}: SCALE, Scale a real value
|
226 |
|
|
* @code{SCAN}: SCAN, Scan a string for the presence of a set of characters
|
227 |
|
|
* @code{SECNDS}: SECNDS, Time function
|
228 |
|
|
* @code{SECOND}: SECOND, CPU time function
|
229 |
|
|
* @code{SELECTED_CHAR_KIND}: SELECTED_CHAR_KIND, Choose character kind
|
230 |
|
|
* @code{SELECTED_INT_KIND}: SELECTED_INT_KIND, Choose integer kind
|
231 |
|
|
* @code{SELECTED_REAL_KIND}: SELECTED_REAL_KIND, Choose real kind
|
232 |
|
|
* @code{SET_EXPONENT}: SET_EXPONENT, Set the exponent of the model
|
233 |
|
|
* @code{SHAPE}: SHAPE, Determine the shape of an array
|
234 |
|
|
* @code{SIGN}: SIGN, Sign copying function
|
235 |
|
|
* @code{SIGNAL}: SIGNAL, Signal handling subroutine (or function)
|
236 |
|
|
* @code{SIN}: SIN, Sine function
|
237 |
|
|
* @code{SINH}: SINH, Hyperbolic sine function
|
238 |
|
|
* @code{SIZE}: SIZE, Function to determine the size of an array
|
239 |
|
|
* @code{SIZEOF}: SIZEOF, Determine the size in bytes of an expression
|
240 |
|
|
* @code{SLEEP}: SLEEP, Sleep for the specified number of seconds
|
241 |
|
|
* @code{SNGL}: SNGL, Convert double precision real to default real
|
242 |
|
|
* @code{SPACING}: SPACING, Smallest distance between two numbers of a given type
|
243 |
|
|
* @code{SPREAD}: SPREAD, Add a dimension to an array
|
244 |
|
|
* @code{SQRT}: SQRT, Square-root function
|
245 |
|
|
* @code{SRAND}: SRAND, Reinitialize the random number generator
|
246 |
|
|
* @code{STAT}: STAT, Get file status
|
247 |
|
|
* @code{SUM}: SUM, Sum of array elements
|
248 |
|
|
* @code{SYMLNK}: SYMLNK, Create a symbolic link
|
249 |
|
|
* @code{SYSTEM}: SYSTEM, Execute a shell command
|
250 |
|
|
* @code{SYSTEM_CLOCK}: SYSTEM_CLOCK, Time function
|
251 |
|
|
* @code{TAN}: TAN, Tangent function
|
252 |
|
|
* @code{TANH}: TANH, Hyperbolic tangent function
|
253 |
|
|
* @code{TIME}: TIME, Time function
|
254 |
|
|
* @code{TIME8}: TIME8, Time function (64-bit)
|
255 |
|
|
* @code{TINY}: TINY, Smallest positive number of a real kind
|
256 |
|
|
* @code{TRAILZ}: TRAILZ, Number of trailing zero bits of an integer
|
257 |
|
|
* @code{TRANSFER}: TRANSFER, Transfer bit patterns
|
258 |
|
|
* @code{TRANSPOSE}: TRANSPOSE, Transpose an array of rank two
|
259 |
|
|
* @code{TRIM}: TRIM, Remove trailing blank characters of a string
|
260 |
|
|
* @code{TTYNAM}: TTYNAM, Get the name of a terminal device.
|
261 |
|
|
* @code{UBOUND}: UBOUND, Upper dimension bounds of an array
|
262 |
|
|
* @code{UMASK}: UMASK, Set the file creation mask
|
263 |
|
|
* @code{UNLINK}: UNLINK, Remove a file from the file system
|
264 |
|
|
* @code{UNPACK}: UNPACK, Unpack an array of rank one into an array
|
265 |
|
|
* @code{VERIFY}: VERIFY, Scan a string for the absence of a set of characters
|
266 |
|
|
* @code{XOR}: XOR, Bitwise logical exclusive or
|
267 |
|
|
@end menu
|
268 |
|
|
|
269 |
|
|
@node Introduction to Intrinsics
|
270 |
|
|
@section Introduction to intrinsic procedures
|
271 |
|
|
|
272 |
|
|
The intrinsic procedures provided by GNU Fortran include all of the
|
273 |
|
|
intrinsic procedures required by the Fortran 95 standard, a set of
|
274 |
|
|
intrinsic procedures for backwards compatibility with G77, and a
|
275 |
|
|
selection of intrinsic procedures from the Fortran 2003 and Fortran 2008
|
276 |
|
|
standards. Any conflict between a description here and a description in
|
277 |
|
|
either the Fortran 95 standard, the Fortran 2003 standard or the Fortran
|
278 |
|
|
2008 standard is unintentional, and the standard(s) should be considered
|
279 |
|
|
authoritative.
|
280 |
|
|
|
281 |
|
|
The enumeration of the @code{KIND} type parameter is processor defined in
|
282 |
|
|
the Fortran 95 standard. GNU Fortran defines the default integer type and
|
283 |
|
|
default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
|
284 |
|
|
respectively. The standard mandates that both data types shall have
|
285 |
|
|
another kind, which have more precision. On typical target architectures
|
286 |
|
|
supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
|
287 |
|
|
Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
|
288 |
|
|
In the description of generic intrinsic procedures, the kind type parameter
|
289 |
|
|
will be specified by @code{KIND=*}, and in the description of specific
|
290 |
|
|
names for an intrinsic procedure the kind type parameter will be explicitly
|
291 |
|
|
given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
|
292 |
|
|
brevity the optional @code{KIND=} syntax will be omitted.
|
293 |
|
|
|
294 |
|
|
Many of the intrinsic procedures take one or more optional arguments.
|
295 |
|
|
This document follows the convention used in the Fortran 95 standard,
|
296 |
|
|
and denotes such arguments by square brackets.
|
297 |
|
|
|
298 |
|
|
GNU Fortran offers the @option{-std=f95} and @option{-std=gnu} options,
|
299 |
|
|
which can be used to restrict the set of intrinsic procedures to a
|
300 |
|
|
given standard. By default, @command{gfortran} sets the @option{-std=gnu}
|
301 |
|
|
option, and so all intrinsic procedures described here are accepted. There
|
302 |
|
|
is one caveat. For a select group of intrinsic procedures, @command{g77}
|
303 |
|
|
implemented both a function and a subroutine. Both classes
|
304 |
|
|
have been implemented in @command{gfortran} for backwards compatibility
|
305 |
|
|
with @command{g77}. It is noted here that these functions and subroutines
|
306 |
|
|
cannot be intermixed in a given subprogram. In the descriptions that follow,
|
307 |
|
|
the applicable standard for each intrinsic procedure is noted.
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
@node ABORT
|
312 |
|
|
@section @code{ABORT} --- Abort the program
|
313 |
|
|
@fnindex ABORT
|
314 |
|
|
@cindex program termination, with core dump
|
315 |
|
|
@cindex terminate program, with core dump
|
316 |
|
|
@cindex core, dump
|
317 |
|
|
|
318 |
|
|
@table @asis
|
319 |
|
|
@item @emph{Description}:
|
320 |
|
|
@code{ABORT} causes immediate termination of the program. On operating
|
321 |
|
|
systems that support a core dump, @code{ABORT} will produce a core dump even if
|
322 |
|
|
the option @option{-fno-dump-core} is in effect, which is suitable for debugging
|
323 |
|
|
purposes.
|
324 |
|
|
@c TODO: Check if this (with -fno-dump-core) is correct.
|
325 |
|
|
|
326 |
|
|
@item @emph{Standard}:
|
327 |
|
|
GNU extension
|
328 |
|
|
|
329 |
|
|
@item @emph{Class}:
|
330 |
|
|
Subroutine
|
331 |
|
|
|
332 |
|
|
@item @emph{Syntax}:
|
333 |
|
|
@code{CALL ABORT}
|
334 |
|
|
|
335 |
|
|
@item @emph{Return value}:
|
336 |
|
|
Does not return.
|
337 |
|
|
|
338 |
|
|
@item @emph{Example}:
|
339 |
|
|
@smallexample
|
340 |
|
|
program test_abort
|
341 |
|
|
integer :: i = 1, j = 2
|
342 |
|
|
if (i /= j) call abort
|
343 |
|
|
end program test_abort
|
344 |
|
|
@end smallexample
|
345 |
|
|
|
346 |
|
|
@item @emph{See also}:
|
347 |
|
|
@ref{EXIT}, @ref{KILL}
|
348 |
|
|
|
349 |
|
|
@end table
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
@node ABS
|
354 |
|
|
@section @code{ABS} --- Absolute value
|
355 |
|
|
@fnindex ABS
|
356 |
|
|
@fnindex CABS
|
357 |
|
|
@fnindex DABS
|
358 |
|
|
@fnindex IABS
|
359 |
|
|
@fnindex ZABS
|
360 |
|
|
@fnindex CDABS
|
361 |
|
|
@cindex absolute value
|
362 |
|
|
|
363 |
|
|
@table @asis
|
364 |
|
|
@item @emph{Description}:
|
365 |
|
|
@code{ABS(A)} computes the absolute value of @code{A}.
|
366 |
|
|
|
367 |
|
|
@item @emph{Standard}:
|
368 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
369 |
|
|
|
370 |
|
|
@item @emph{Class}:
|
371 |
|
|
Elemental function
|
372 |
|
|
|
373 |
|
|
@item @emph{Syntax}:
|
374 |
|
|
@code{RESULT = ABS(A)}
|
375 |
|
|
|
376 |
|
|
@item @emph{Arguments}:
|
377 |
|
|
@multitable @columnfractions .15 .70
|
378 |
|
|
@item @var{A} @tab The type of the argument shall be an @code{INTEGER},
|
379 |
|
|
@code{REAL}, or @code{COMPLEX}.
|
380 |
|
|
@end multitable
|
381 |
|
|
|
382 |
|
|
@item @emph{Return value}:
|
383 |
|
|
The return value is of the same type and
|
384 |
|
|
kind as the argument except the return value is @code{REAL} for a
|
385 |
|
|
@code{COMPLEX} argument.
|
386 |
|
|
|
387 |
|
|
@item @emph{Example}:
|
388 |
|
|
@smallexample
|
389 |
|
|
program test_abs
|
390 |
|
|
integer :: i = -1
|
391 |
|
|
real :: x = -1.e0
|
392 |
|
|
complex :: z = (-1.e0,0.e0)
|
393 |
|
|
i = abs(i)
|
394 |
|
|
x = abs(x)
|
395 |
|
|
x = abs(z)
|
396 |
|
|
end program test_abs
|
397 |
|
|
@end smallexample
|
398 |
|
|
|
399 |
|
|
@item @emph{Specific names}:
|
400 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
401 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
402 |
|
|
@item @code{CABS(A)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab Fortran 77 and later
|
403 |
|
|
@item @code{DABS(A)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
404 |
|
|
@item @code{IABS(A)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab Fortran 77 and later
|
405 |
|
|
@item @code{ZABS(A)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
|
406 |
|
|
@item @code{CDABS(A)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
|
407 |
|
|
@end multitable
|
408 |
|
|
@end table
|
409 |
|
|
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
@node ACCESS
|
413 |
|
|
@section @code{ACCESS} --- Checks file access modes
|
414 |
|
|
@fnindex ACCESS
|
415 |
|
|
@cindex file system, access mode
|
416 |
|
|
|
417 |
|
|
@table @asis
|
418 |
|
|
@item @emph{Description}:
|
419 |
|
|
@code{ACCESS(NAME, MODE)} checks whether the file @var{NAME}
|
420 |
|
|
exists, is readable, writable or executable. Except for the
|
421 |
|
|
executable check, @code{ACCESS} can be replaced by
|
422 |
|
|
Fortran 95's @code{INQUIRE}.
|
423 |
|
|
|
424 |
|
|
@item @emph{Standard}:
|
425 |
|
|
GNU extension
|
426 |
|
|
|
427 |
|
|
@item @emph{Class}:
|
428 |
|
|
Inquiry function
|
429 |
|
|
|
430 |
|
|
@item @emph{Syntax}:
|
431 |
|
|
@code{RESULT = ACCESS(NAME, MODE)}
|
432 |
|
|
|
433 |
|
|
@item @emph{Arguments}:
|
434 |
|
|
@multitable @columnfractions .15 .70
|
435 |
|
|
@item @var{NAME} @tab Scalar @code{CHARACTER} of default kind with the
|
436 |
|
|
file name. Tailing blank are ignored unless the character @code{achar(0)}
|
437 |
|
|
is present, then all characters up to and excluding @code{achar(0)} are
|
438 |
|
|
used as file name.
|
439 |
|
|
@item @var{MODE} @tab Scalar @code{CHARACTER} of default kind with the
|
440 |
|
|
file access mode, may be any concatenation of @code{"r"} (readable),
|
441 |
|
|
@code{"w"} (writable) and @code{"x"} (executable), or @code{" "} to check
|
442 |
|
|
for existence.
|
443 |
|
|
@end multitable
|
444 |
|
|
|
445 |
|
|
@item @emph{Return value}:
|
446 |
|
|
Returns a scalar @code{INTEGER}, which is @code{0} if the file is
|
447 |
|
|
accessible in the given mode; otherwise or if an invalid argument
|
448 |
|
|
has been given for @code{MODE} the value @code{1} is returned.
|
449 |
|
|
|
450 |
|
|
@item @emph{Example}:
|
451 |
|
|
@smallexample
|
452 |
|
|
program access_test
|
453 |
|
|
implicit none
|
454 |
|
|
character(len=*), parameter :: file = 'test.dat'
|
455 |
|
|
character(len=*), parameter :: file2 = 'test.dat '//achar(0)
|
456 |
|
|
if(access(file,' ') == 0) print *, trim(file),' is exists'
|
457 |
|
|
if(access(file,'r') == 0) print *, trim(file),' is readable'
|
458 |
|
|
if(access(file,'w') == 0) print *, trim(file),' is writable'
|
459 |
|
|
if(access(file,'x') == 0) print *, trim(file),' is executable'
|
460 |
|
|
if(access(file2,'rwx') == 0) &
|
461 |
|
|
print *, trim(file2),' is readable, writable and executable'
|
462 |
|
|
end program access_test
|
463 |
|
|
@end smallexample
|
464 |
|
|
@item @emph{Specific names}:
|
465 |
|
|
@item @emph{See also}:
|
466 |
|
|
|
467 |
|
|
@end table
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
@node ACHAR
|
472 |
|
|
@section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
|
473 |
|
|
@fnindex ACHAR
|
474 |
|
|
@cindex @acronym{ASCII} collating sequence
|
475 |
|
|
@cindex collating sequence, @acronym{ASCII}
|
476 |
|
|
|
477 |
|
|
@table @asis
|
478 |
|
|
@item @emph{Description}:
|
479 |
|
|
@code{ACHAR(I)} returns the character located at position @code{I}
|
480 |
|
|
in the @acronym{ASCII} collating sequence.
|
481 |
|
|
|
482 |
|
|
@item @emph{Standard}:
|
483 |
|
|
Fortran 77 and later, with @var{KIND} argument Fortran 2003 and later
|
484 |
|
|
|
485 |
|
|
@item @emph{Class}:
|
486 |
|
|
Elemental function
|
487 |
|
|
|
488 |
|
|
@item @emph{Syntax}:
|
489 |
|
|
@code{RESULT = ACHAR(I [, KIND])}
|
490 |
|
|
|
491 |
|
|
@item @emph{Arguments}:
|
492 |
|
|
@multitable @columnfractions .15 .70
|
493 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
494 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
495 |
|
|
expression indicating the kind parameter of the result.
|
496 |
|
|
@end multitable
|
497 |
|
|
|
498 |
|
|
@item @emph{Return value}:
|
499 |
|
|
The return value is of type @code{CHARACTER} with a length of one.
|
500 |
|
|
If the @var{KIND} argument is present, the return value is of the
|
501 |
|
|
specified kind and of the default kind otherwise.
|
502 |
|
|
|
503 |
|
|
@item @emph{Example}:
|
504 |
|
|
@smallexample
|
505 |
|
|
program test_achar
|
506 |
|
|
character c
|
507 |
|
|
c = achar(32)
|
508 |
|
|
end program test_achar
|
509 |
|
|
@end smallexample
|
510 |
|
|
|
511 |
|
|
@item @emph{Note}:
|
512 |
|
|
See @ref{ICHAR} for a discussion of converting between numerical values
|
513 |
|
|
and formatted string representations.
|
514 |
|
|
|
515 |
|
|
@item @emph{See also}:
|
516 |
|
|
@ref{CHAR}, @ref{IACHAR}, @ref{ICHAR}
|
517 |
|
|
|
518 |
|
|
@end table
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
|
522 |
|
|
@node ACOS
|
523 |
|
|
@section @code{ACOS} --- Arccosine function
|
524 |
|
|
@fnindex ACOS
|
525 |
|
|
@fnindex DACOS
|
526 |
|
|
@cindex trigonometric function, cosine, inverse
|
527 |
|
|
@cindex cosine, inverse
|
528 |
|
|
|
529 |
|
|
@table @asis
|
530 |
|
|
@item @emph{Description}:
|
531 |
|
|
@code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
|
532 |
|
|
|
533 |
|
|
@item @emph{Standard}:
|
534 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
535 |
|
|
|
536 |
|
|
@item @emph{Class}:
|
537 |
|
|
Elemental function
|
538 |
|
|
|
539 |
|
|
@item @emph{Syntax}:
|
540 |
|
|
@code{RESULT = ACOS(X)}
|
541 |
|
|
|
542 |
|
|
@item @emph{Arguments}:
|
543 |
|
|
@multitable @columnfractions .15 .70
|
544 |
|
|
@item @var{X} @tab The type shall either be @code{REAL} with a magnitude that is
|
545 |
|
|
less than or equal to one - or the type shall be @code{COMPLEX}.
|
546 |
|
|
@end multitable
|
547 |
|
|
|
548 |
|
|
@item @emph{Return value}:
|
549 |
|
|
The return value is of the same type and kind as @var{X}.
|
550 |
|
|
The real part of the result is in radians and lies in the range
|
551 |
|
|
@math{0 \leq \Re \acos(x) \leq \pi}.
|
552 |
|
|
|
553 |
|
|
@item @emph{Example}:
|
554 |
|
|
@smallexample
|
555 |
|
|
program test_acos
|
556 |
|
|
real(8) :: x = 0.866_8
|
557 |
|
|
x = acos(x)
|
558 |
|
|
end program test_acos
|
559 |
|
|
@end smallexample
|
560 |
|
|
|
561 |
|
|
@item @emph{Specific names}:
|
562 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
563 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
564 |
|
|
@item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
565 |
|
|
@end multitable
|
566 |
|
|
|
567 |
|
|
@item @emph{See also}:
|
568 |
|
|
Inverse function: @ref{COS}
|
569 |
|
|
|
570 |
|
|
@end table
|
571 |
|
|
|
572 |
|
|
|
573 |
|
|
|
574 |
|
|
@node ACOSH
|
575 |
378 |
julius |
@section @code{ACOSH} --- Inverse hyperbolic cosine function
|
576 |
285 |
jeremybenn |
@fnindex ACOSH
|
577 |
|
|
@fnindex DACOSH
|
578 |
|
|
@cindex area hyperbolic cosine
|
579 |
378 |
julius |
@cindex inverse hyperbolic cosine
|
580 |
285 |
jeremybenn |
@cindex hyperbolic function, cosine, inverse
|
581 |
|
|
@cindex cosine, hyperbolic, inverse
|
582 |
|
|
|
583 |
|
|
@table @asis
|
584 |
|
|
@item @emph{Description}:
|
585 |
378 |
julius |
@code{ACOSH(X)} computes the inverse hyperbolic cosine of @var{X}.
|
586 |
285 |
jeremybenn |
|
587 |
|
|
@item @emph{Standard}:
|
588 |
|
|
Fortran 2008 and later
|
589 |
|
|
|
590 |
|
|
@item @emph{Class}:
|
591 |
|
|
Elemental function
|
592 |
|
|
|
593 |
|
|
@item @emph{Syntax}:
|
594 |
|
|
@code{RESULT = ACOSH(X)}
|
595 |
|
|
|
596 |
|
|
@item @emph{Arguments}:
|
597 |
|
|
@multitable @columnfractions .15 .70
|
598 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
599 |
|
|
@end multitable
|
600 |
|
|
|
601 |
|
|
@item @emph{Return value}:
|
602 |
|
|
The return value has the same type and kind as @var{X}. If @var{X} is
|
603 |
|
|
complex, the imaginary part of the result is in radians and lies between
|
604 |
|
|
@math{ 0 \leq \Im \acosh(x) \leq \pi}.
|
605 |
|
|
|
606 |
|
|
@item @emph{Example}:
|
607 |
|
|
@smallexample
|
608 |
|
|
PROGRAM test_acosh
|
609 |
|
|
REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
|
610 |
|
|
WRITE (*,*) ACOSH(x)
|
611 |
|
|
END PROGRAM
|
612 |
|
|
@end smallexample
|
613 |
|
|
|
614 |
|
|
@item @emph{Specific names}:
|
615 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
616 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
617 |
|
|
@item @code{DACOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
618 |
|
|
@end multitable
|
619 |
|
|
|
620 |
|
|
@item @emph{See also}:
|
621 |
|
|
Inverse function: @ref{COSH}
|
622 |
|
|
@end table
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
@node ADJUSTL
|
627 |
|
|
@section @code{ADJUSTL} --- Left adjust a string
|
628 |
|
|
@fnindex ADJUSTL
|
629 |
|
|
@cindex string, adjust left
|
630 |
|
|
@cindex adjust string
|
631 |
|
|
|
632 |
|
|
@table @asis
|
633 |
|
|
@item @emph{Description}:
|
634 |
|
|
@code{ADJUSTL(STRING)} will left adjust a string by removing leading spaces.
|
635 |
|
|
Spaces are inserted at the end of the string as needed.
|
636 |
|
|
|
637 |
|
|
@item @emph{Standard}:
|
638 |
|
|
Fortran 90 and later
|
639 |
|
|
|
640 |
|
|
@item @emph{Class}:
|
641 |
|
|
Elemental function
|
642 |
|
|
|
643 |
|
|
@item @emph{Syntax}:
|
644 |
|
|
@code{RESULT = ADJUSTL(STRING)}
|
645 |
|
|
|
646 |
|
|
@item @emph{Arguments}:
|
647 |
|
|
@multitable @columnfractions .15 .70
|
648 |
|
|
@item @var{STRING} @tab The type shall be @code{CHARACTER}.
|
649 |
|
|
@end multitable
|
650 |
|
|
|
651 |
|
|
@item @emph{Return value}:
|
652 |
|
|
The return value is of type @code{CHARACTER} and of the same kind as
|
653 |
|
|
@var{STRING} where leading spaces are removed and the same number of
|
654 |
|
|
spaces are inserted on the end of @var{STRING}.
|
655 |
|
|
|
656 |
|
|
@item @emph{Example}:
|
657 |
|
|
@smallexample
|
658 |
|
|
program test_adjustl
|
659 |
|
|
character(len=20) :: str = ' gfortran'
|
660 |
|
|
str = adjustl(str)
|
661 |
|
|
print *, str
|
662 |
|
|
end program test_adjustl
|
663 |
|
|
@end smallexample
|
664 |
|
|
|
665 |
|
|
@item @emph{See also}:
|
666 |
|
|
@ref{ADJUSTR}, @ref{TRIM}
|
667 |
|
|
@end table
|
668 |
|
|
|
669 |
|
|
|
670 |
|
|
|
671 |
|
|
@node ADJUSTR
|
672 |
|
|
@section @code{ADJUSTR} --- Right adjust a string
|
673 |
|
|
@fnindex ADJUSTR
|
674 |
|
|
@cindex string, adjust right
|
675 |
|
|
@cindex adjust string
|
676 |
|
|
|
677 |
|
|
@table @asis
|
678 |
|
|
@item @emph{Description}:
|
679 |
|
|
@code{ADJUSTR(STRING)} will right adjust a string by removing trailing spaces.
|
680 |
|
|
Spaces are inserted at the start of the string as needed.
|
681 |
|
|
|
682 |
|
|
@item @emph{Standard}:
|
683 |
|
|
Fortran 95 and later
|
684 |
|
|
|
685 |
|
|
@item @emph{Class}:
|
686 |
|
|
Elemental function
|
687 |
|
|
|
688 |
|
|
@item @emph{Syntax}:
|
689 |
|
|
@code{RESULT = ADJUSTR(STRING)}
|
690 |
|
|
|
691 |
|
|
@item @emph{Arguments}:
|
692 |
|
|
@multitable @columnfractions .15 .70
|
693 |
|
|
@item @var{STR} @tab The type shall be @code{CHARACTER}.
|
694 |
|
|
@end multitable
|
695 |
|
|
|
696 |
|
|
@item @emph{Return value}:
|
697 |
|
|
The return value is of type @code{CHARACTER} and of the same kind as
|
698 |
|
|
@var{STRING} where trailing spaces are removed and the same number of
|
699 |
|
|
spaces are inserted at the start of @var{STRING}.
|
700 |
|
|
|
701 |
|
|
@item @emph{Example}:
|
702 |
|
|
@smallexample
|
703 |
|
|
program test_adjustr
|
704 |
|
|
character(len=20) :: str = 'gfortran'
|
705 |
|
|
str = adjustr(str)
|
706 |
|
|
print *, str
|
707 |
|
|
end program test_adjustr
|
708 |
|
|
@end smallexample
|
709 |
|
|
|
710 |
|
|
@item @emph{See also}:
|
711 |
|
|
@ref{ADJUSTL}, @ref{TRIM}
|
712 |
|
|
@end table
|
713 |
|
|
|
714 |
|
|
|
715 |
|
|
|
716 |
|
|
@node AIMAG
|
717 |
|
|
@section @code{AIMAG} --- Imaginary part of complex number
|
718 |
|
|
@fnindex AIMAG
|
719 |
|
|
@fnindex DIMAG
|
720 |
|
|
@fnindex IMAG
|
721 |
|
|
@fnindex IMAGPART
|
722 |
|
|
@cindex complex numbers, imaginary part
|
723 |
|
|
|
724 |
|
|
@table @asis
|
725 |
|
|
@item @emph{Description}:
|
726 |
|
|
@code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
|
727 |
|
|
The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
|
728 |
|
|
for compatibility with @command{g77}, and their use in new code is
|
729 |
|
|
strongly discouraged.
|
730 |
|
|
|
731 |
|
|
@item @emph{Standard}:
|
732 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
733 |
|
|
|
734 |
|
|
@item @emph{Class}:
|
735 |
|
|
Elemental function
|
736 |
|
|
|
737 |
|
|
@item @emph{Syntax}:
|
738 |
|
|
@code{RESULT = AIMAG(Z)}
|
739 |
|
|
|
740 |
|
|
@item @emph{Arguments}:
|
741 |
|
|
@multitable @columnfractions .15 .70
|
742 |
|
|
@item @var{Z} @tab The type of the argument shall be @code{COMPLEX}.
|
743 |
|
|
@end multitable
|
744 |
|
|
|
745 |
|
|
@item @emph{Return value}:
|
746 |
|
|
The return value is of type @code{REAL} with the
|
747 |
|
|
kind type parameter of the argument.
|
748 |
|
|
|
749 |
|
|
@item @emph{Example}:
|
750 |
|
|
@smallexample
|
751 |
|
|
program test_aimag
|
752 |
|
|
complex(4) z4
|
753 |
|
|
complex(8) z8
|
754 |
|
|
z4 = cmplx(1.e0_4, 0.e0_4)
|
755 |
|
|
z8 = cmplx(0.e0_8, 1.e0_8)
|
756 |
|
|
print *, aimag(z4), dimag(z8)
|
757 |
|
|
end program test_aimag
|
758 |
|
|
@end smallexample
|
759 |
|
|
|
760 |
|
|
@item @emph{Specific names}:
|
761 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
762 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
763 |
|
|
@item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab GNU extension
|
764 |
|
|
@item @code{IMAG(Z)} @tab @code{COMPLEX Z} @tab @code{REAL} @tab GNU extension
|
765 |
|
|
@item @code{IMAGPART(Z)} @tab @code{COMPLEX Z} @tab @code{REAL} @tab GNU extension
|
766 |
|
|
@end multitable
|
767 |
|
|
@end table
|
768 |
|
|
|
769 |
|
|
|
770 |
|
|
|
771 |
|
|
@node AINT
|
772 |
|
|
@section @code{AINT} --- Truncate to a whole number
|
773 |
|
|
@fnindex AINT
|
774 |
|
|
@fnindex DINT
|
775 |
|
|
@cindex floor
|
776 |
|
|
@cindex rounding, floor
|
777 |
|
|
|
778 |
|
|
@table @asis
|
779 |
|
|
@item @emph{Description}:
|
780 |
|
|
@code{AINT(A [, KIND])} truncates its argument to a whole number.
|
781 |
|
|
|
782 |
|
|
@item @emph{Standard}:
|
783 |
|
|
Fortran 77 and later
|
784 |
|
|
|
785 |
|
|
@item @emph{Class}:
|
786 |
|
|
Elemental function
|
787 |
|
|
|
788 |
|
|
@item @emph{Syntax}:
|
789 |
|
|
@code{RESULT = AINT(A [, KIND])}
|
790 |
|
|
|
791 |
|
|
@item @emph{Arguments}:
|
792 |
|
|
@multitable @columnfractions .15 .70
|
793 |
|
|
@item @var{A} @tab The type of the argument shall be @code{REAL}.
|
794 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
795 |
|
|
expression indicating the kind parameter of the result.
|
796 |
|
|
@end multitable
|
797 |
|
|
|
798 |
|
|
@item @emph{Return value}:
|
799 |
|
|
The return value is of type @code{REAL} with the kind type parameter of the
|
800 |
|
|
argument if the optional @var{KIND} is absent; otherwise, the kind
|
801 |
|
|
type parameter will be given by @var{KIND}. If the magnitude of
|
802 |
|
|
@var{X} is less than one, @code{AINT(X)} returns zero. If the
|
803 |
|
|
magnitude is equal to or greater than one then it returns the largest
|
804 |
|
|
whole number that does not exceed its magnitude. The sign is the same
|
805 |
|
|
as the sign of @var{X}.
|
806 |
|
|
|
807 |
|
|
@item @emph{Example}:
|
808 |
|
|
@smallexample
|
809 |
|
|
program test_aint
|
810 |
|
|
real(4) x4
|
811 |
|
|
real(8) x8
|
812 |
|
|
x4 = 1.234E0_4
|
813 |
|
|
x8 = 4.321_8
|
814 |
|
|
print *, aint(x4), dint(x8)
|
815 |
|
|
x8 = aint(x4,8)
|
816 |
|
|
end program test_aint
|
817 |
|
|
@end smallexample
|
818 |
|
|
|
819 |
|
|
@item @emph{Specific names}:
|
820 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
821 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
822 |
|
|
@item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
823 |
|
|
@end multitable
|
824 |
|
|
@end table
|
825 |
|
|
|
826 |
|
|
|
827 |
|
|
|
828 |
|
|
@node ALARM
|
829 |
|
|
@section @code{ALARM} --- Execute a routine after a given delay
|
830 |
|
|
@fnindex ALARM
|
831 |
|
|
@cindex delayed execution
|
832 |
|
|
|
833 |
|
|
@table @asis
|
834 |
|
|
@item @emph{Description}:
|
835 |
|
|
@code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
|
836 |
|
|
to be executed after a delay of @var{SECONDS} by using @code{alarm(2)} to
|
837 |
|
|
set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
|
838 |
|
|
supplied, it will be returned with the number of seconds remaining until
|
839 |
|
|
any previously scheduled alarm was due to be delivered, or zero if there
|
840 |
|
|
was no previously scheduled alarm.
|
841 |
|
|
|
842 |
|
|
@item @emph{Standard}:
|
843 |
|
|
GNU extension
|
844 |
|
|
|
845 |
|
|
@item @emph{Class}:
|
846 |
|
|
Subroutine
|
847 |
|
|
|
848 |
|
|
@item @emph{Syntax}:
|
849 |
|
|
@code{CALL ALARM(SECONDS, HANDLER [, STATUS])}
|
850 |
|
|
|
851 |
|
|
@item @emph{Arguments}:
|
852 |
|
|
@multitable @columnfractions .15 .70
|
853 |
|
|
@item @var{SECONDS} @tab The type of the argument shall be a scalar
|
854 |
|
|
@code{INTEGER}. It is @code{INTENT(IN)}.
|
855 |
|
|
@item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
|
856 |
|
|
@code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar. The scalar
|
857 |
|
|
values may be either @code{SIG_IGN=1} to ignore the alarm generated
|
858 |
|
|
or @code{SIG_DFL=0} to set the default action. It is @code{INTENT(IN)}.
|
859 |
|
|
@item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
|
860 |
|
|
variable of the default @code{INTEGER} kind. It is @code{INTENT(OUT)}.
|
861 |
|
|
@end multitable
|
862 |
|
|
|
863 |
|
|
@item @emph{Example}:
|
864 |
|
|
@smallexample
|
865 |
|
|
program test_alarm
|
866 |
|
|
external handler_print
|
867 |
|
|
integer i
|
868 |
|
|
call alarm (3, handler_print, i)
|
869 |
|
|
print *, i
|
870 |
|
|
call sleep(10)
|
871 |
|
|
end program test_alarm
|
872 |
|
|
@end smallexample
|
873 |
|
|
This will cause the external routine @var{handler_print} to be called
|
874 |
|
|
after 3 seconds.
|
875 |
|
|
@end table
|
876 |
|
|
|
877 |
|
|
|
878 |
|
|
|
879 |
|
|
@node ALL
|
880 |
|
|
@section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
|
881 |
|
|
@fnindex ALL
|
882 |
|
|
@cindex array, apply condition
|
883 |
|
|
@cindex array, condition testing
|
884 |
|
|
|
885 |
|
|
@table @asis
|
886 |
|
|
@item @emph{Description}:
|
887 |
|
|
@code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
|
888 |
|
|
in the array along dimension @var{DIM}.
|
889 |
|
|
|
890 |
|
|
@item @emph{Standard}:
|
891 |
|
|
Fortran 95 and later
|
892 |
|
|
|
893 |
|
|
@item @emph{Class}:
|
894 |
|
|
Transformational function
|
895 |
|
|
|
896 |
|
|
@item @emph{Syntax}:
|
897 |
|
|
@code{RESULT = ALL(MASK [, DIM])}
|
898 |
|
|
|
899 |
|
|
@item @emph{Arguments}:
|
900 |
|
|
@multitable @columnfractions .15 .70
|
901 |
|
|
@item @var{MASK} @tab The type of the argument shall be @code{LOGICAL} and
|
902 |
|
|
it shall not be scalar.
|
903 |
|
|
@item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
|
904 |
|
|
with a value that lies between one and the rank of @var{MASK}.
|
905 |
|
|
@end multitable
|
906 |
|
|
|
907 |
|
|
@item @emph{Return value}:
|
908 |
|
|
@code{ALL(MASK)} returns a scalar value of type @code{LOGICAL} where
|
909 |
|
|
the kind type parameter is the same as the kind type parameter of
|
910 |
|
|
@var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
|
911 |
|
|
an array with the rank of @var{MASK} minus 1. The shape is determined from
|
912 |
|
|
the shape of @var{MASK} where the @var{DIM} dimension is elided.
|
913 |
|
|
|
914 |
|
|
@table @asis
|
915 |
|
|
@item (A)
|
916 |
|
|
@code{ALL(MASK)} is true if all elements of @var{MASK} are true.
|
917 |
|
|
It also is true if @var{MASK} has zero size; otherwise, it is false.
|
918 |
|
|
@item (B)
|
919 |
|
|
If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
|
920 |
|
|
to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
|
921 |
|
|
is determined by applying @code{ALL} to the array sections.
|
922 |
|
|
@end table
|
923 |
|
|
|
924 |
|
|
@item @emph{Example}:
|
925 |
|
|
@smallexample
|
926 |
|
|
program test_all
|
927 |
|
|
logical l
|
928 |
|
|
l = all((/.true., .true., .true./))
|
929 |
|
|
print *, l
|
930 |
|
|
call section
|
931 |
|
|
contains
|
932 |
|
|
subroutine section
|
933 |
|
|
integer a(2,3), b(2,3)
|
934 |
|
|
a = 1
|
935 |
|
|
b = 1
|
936 |
|
|
b(2,2) = 2
|
937 |
|
|
print *, all(a .eq. b, 1)
|
938 |
|
|
print *, all(a .eq. b, 2)
|
939 |
|
|
end subroutine section
|
940 |
|
|
end program test_all
|
941 |
|
|
@end smallexample
|
942 |
|
|
@end table
|
943 |
|
|
|
944 |
|
|
|
945 |
|
|
|
946 |
|
|
@node ALLOCATED
|
947 |
|
|
@section @code{ALLOCATED} --- Status of an allocatable entity
|
948 |
|
|
@fnindex ALLOCATED
|
949 |
|
|
@cindex allocation, status
|
950 |
|
|
|
951 |
|
|
@table @asis
|
952 |
|
|
@item @emph{Description}:
|
953 |
|
|
@code{ALLOCATED(ARRAY)} checks the status of whether @var{X} is allocated.
|
954 |
|
|
|
955 |
|
|
@item @emph{Standard}:
|
956 |
|
|
Fortran 95 and later
|
957 |
|
|
|
958 |
|
|
@item @emph{Class}:
|
959 |
|
|
Inquiry function
|
960 |
|
|
|
961 |
|
|
@item @emph{Syntax}:
|
962 |
|
|
@code{RESULT = ALLOCATED(ARRAY)}
|
963 |
|
|
|
964 |
|
|
@item @emph{Arguments}:
|
965 |
|
|
@multitable @columnfractions .15 .70
|
966 |
|
|
@item @var{ARRAY} @tab The argument shall be an @code{ALLOCATABLE} array.
|
967 |
|
|
@end multitable
|
968 |
|
|
|
969 |
|
|
@item @emph{Return value}:
|
970 |
|
|
The return value is a scalar @code{LOGICAL} with the default logical
|
971 |
|
|
kind type parameter. If @var{ARRAY} is allocated, @code{ALLOCATED(ARRAY)}
|
972 |
|
|
is @code{.TRUE.}; otherwise, it returns @code{.FALSE.}
|
973 |
|
|
|
974 |
|
|
@item @emph{Example}:
|
975 |
|
|
@smallexample
|
976 |
|
|
program test_allocated
|
977 |
|
|
integer :: i = 4
|
978 |
|
|
real(4), allocatable :: x(:)
|
979 |
|
|
if (.not. allocated(x)) allocate(x(i))
|
980 |
|
|
end program test_allocated
|
981 |
|
|
@end smallexample
|
982 |
|
|
@end table
|
983 |
|
|
|
984 |
|
|
|
985 |
|
|
|
986 |
|
|
@node AND
|
987 |
|
|
@section @code{AND} --- Bitwise logical AND
|
988 |
|
|
@fnindex AND
|
989 |
|
|
@cindex bitwise logical and
|
990 |
|
|
@cindex logical and, bitwise
|
991 |
|
|
|
992 |
|
|
@table @asis
|
993 |
|
|
@item @emph{Description}:
|
994 |
|
|
Bitwise logical @code{AND}.
|
995 |
|
|
|
996 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
997 |
|
|
GNU Fortran 77. For integer arguments, programmers should consider
|
998 |
|
|
the use of the @ref{IAND} intrinsic defined by the Fortran standard.
|
999 |
|
|
|
1000 |
|
|
@item @emph{Standard}:
|
1001 |
|
|
GNU extension
|
1002 |
|
|
|
1003 |
|
|
@item @emph{Class}:
|
1004 |
|
|
Function
|
1005 |
|
|
|
1006 |
|
|
@item @emph{Syntax}:
|
1007 |
|
|
@code{RESULT = AND(I, J)}
|
1008 |
|
|
|
1009 |
|
|
@item @emph{Arguments}:
|
1010 |
|
|
@multitable @columnfractions .15 .70
|
1011 |
|
|
@item @var{I} @tab The type shall be either a scalar @code{INTEGER}
|
1012 |
|
|
type or a scalar @code{LOGICAL} type.
|
1013 |
|
|
@item @var{J} @tab The type shall be the same as the type of @var{I}.
|
1014 |
|
|
@end multitable
|
1015 |
|
|
|
1016 |
|
|
@item @emph{Return value}:
|
1017 |
|
|
The return type is either a scalar @code{INTEGER} or a scalar
|
1018 |
|
|
@code{LOGICAL}. If the kind type parameters differ, then the
|
1019 |
|
|
smaller kind type is implicitly converted to larger kind, and the
|
1020 |
|
|
return has the larger kind.
|
1021 |
|
|
|
1022 |
|
|
@item @emph{Example}:
|
1023 |
|
|
@smallexample
|
1024 |
|
|
PROGRAM test_and
|
1025 |
|
|
LOGICAL :: T = .TRUE., F = .FALSE.
|
1026 |
|
|
INTEGER :: a, b
|
1027 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
1028 |
|
|
|
1029 |
|
|
WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
|
1030 |
|
|
WRITE (*,*) AND(a, b)
|
1031 |
|
|
END PROGRAM
|
1032 |
|
|
@end smallexample
|
1033 |
|
|
|
1034 |
|
|
@item @emph{See also}:
|
1035 |
|
|
Fortran 95 elemental function: @ref{IAND}
|
1036 |
|
|
@end table
|
1037 |
|
|
|
1038 |
|
|
|
1039 |
|
|
|
1040 |
|
|
@node ANINT
|
1041 |
|
|
@section @code{ANINT} --- Nearest whole number
|
1042 |
|
|
@fnindex ANINT
|
1043 |
|
|
@fnindex DNINT
|
1044 |
|
|
@cindex ceiling
|
1045 |
|
|
@cindex rounding, ceiling
|
1046 |
|
|
|
1047 |
|
|
@table @asis
|
1048 |
|
|
@item @emph{Description}:
|
1049 |
|
|
@code{ANINT(A [, KIND])} rounds its argument to the nearest whole number.
|
1050 |
|
|
|
1051 |
|
|
@item @emph{Standard}:
|
1052 |
|
|
Fortran 77 and later
|
1053 |
|
|
|
1054 |
|
|
@item @emph{Class}:
|
1055 |
|
|
Elemental function
|
1056 |
|
|
|
1057 |
|
|
@item @emph{Syntax}:
|
1058 |
|
|
@code{RESULT = ANINT(A [, KIND])}
|
1059 |
|
|
|
1060 |
|
|
@item @emph{Arguments}:
|
1061 |
|
|
@multitable @columnfractions .15 .70
|
1062 |
|
|
@item @var{A} @tab The type of the argument shall be @code{REAL}.
|
1063 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
1064 |
|
|
expression indicating the kind parameter of the result.
|
1065 |
|
|
@end multitable
|
1066 |
|
|
|
1067 |
|
|
@item @emph{Return value}:
|
1068 |
|
|
The return value is of type real with the kind type parameter of the
|
1069 |
|
|
argument if the optional @var{KIND} is absent; otherwise, the kind
|
1070 |
|
|
type parameter will be given by @var{KIND}. If @var{A} is greater than
|
1071 |
|
|
zero, @code{ANINT(A)} returns @code{AINT(X+0.5)}. If @var{A} is
|
1072 |
|
|
less than or equal to zero then it returns @code{AINT(X-0.5)}.
|
1073 |
|
|
|
1074 |
|
|
@item @emph{Example}:
|
1075 |
|
|
@smallexample
|
1076 |
|
|
program test_anint
|
1077 |
|
|
real(4) x4
|
1078 |
|
|
real(8) x8
|
1079 |
|
|
x4 = 1.234E0_4
|
1080 |
|
|
x8 = 4.321_8
|
1081 |
|
|
print *, anint(x4), dnint(x8)
|
1082 |
|
|
x8 = anint(x4,8)
|
1083 |
|
|
end program test_anint
|
1084 |
|
|
@end smallexample
|
1085 |
|
|
|
1086 |
|
|
@item @emph{Specific names}:
|
1087 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1088 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1089 |
|
|
@item @code{DNINT(A)} @tab @code{REAL(8) A} @tab @code{REAL(8)} @tab Fortran 77 and later
|
1090 |
|
|
@end multitable
|
1091 |
|
|
@end table
|
1092 |
|
|
|
1093 |
|
|
|
1094 |
|
|
|
1095 |
|
|
@node ANY
|
1096 |
|
|
@section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
|
1097 |
|
|
@fnindex ANY
|
1098 |
|
|
@cindex array, apply condition
|
1099 |
|
|
@cindex array, condition testing
|
1100 |
|
|
|
1101 |
|
|
@table @asis
|
1102 |
|
|
@item @emph{Description}:
|
1103 |
|
|
@code{ANY(MASK [, DIM])} determines if any of the values in the logical array
|
1104 |
|
|
@var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
|
1105 |
|
|
|
1106 |
|
|
@item @emph{Standard}:
|
1107 |
|
|
Fortran 95 and later
|
1108 |
|
|
|
1109 |
|
|
@item @emph{Class}:
|
1110 |
|
|
Transformational function
|
1111 |
|
|
|
1112 |
|
|
@item @emph{Syntax}:
|
1113 |
|
|
@code{RESULT = ANY(MASK [, DIM])}
|
1114 |
|
|
|
1115 |
|
|
@item @emph{Arguments}:
|
1116 |
|
|
@multitable @columnfractions .15 .70
|
1117 |
|
|
@item @var{MASK} @tab The type of the argument shall be @code{LOGICAL} and
|
1118 |
|
|
it shall not be scalar.
|
1119 |
|
|
@item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
|
1120 |
|
|
with a value that lies between one and the rank of @var{MASK}.
|
1121 |
|
|
@end multitable
|
1122 |
|
|
|
1123 |
|
|
@item @emph{Return value}:
|
1124 |
|
|
@code{ANY(MASK)} returns a scalar value of type @code{LOGICAL} where
|
1125 |
|
|
the kind type parameter is the same as the kind type parameter of
|
1126 |
|
|
@var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
|
1127 |
|
|
an array with the rank of @var{MASK} minus 1. The shape is determined from
|
1128 |
|
|
the shape of @var{MASK} where the @var{DIM} dimension is elided.
|
1129 |
|
|
|
1130 |
|
|
@table @asis
|
1131 |
|
|
@item (A)
|
1132 |
|
|
@code{ANY(MASK)} is true if any element of @var{MASK} is true;
|
1133 |
|
|
otherwise, it is false. It also is false if @var{MASK} has zero size.
|
1134 |
|
|
@item (B)
|
1135 |
|
|
If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
|
1136 |
|
|
to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
|
1137 |
|
|
is determined by applying @code{ANY} to the array sections.
|
1138 |
|
|
@end table
|
1139 |
|
|
|
1140 |
|
|
@item @emph{Example}:
|
1141 |
|
|
@smallexample
|
1142 |
|
|
program test_any
|
1143 |
|
|
logical l
|
1144 |
|
|
l = any((/.true., .true., .true./))
|
1145 |
|
|
print *, l
|
1146 |
|
|
call section
|
1147 |
|
|
contains
|
1148 |
|
|
subroutine section
|
1149 |
|
|
integer a(2,3), b(2,3)
|
1150 |
|
|
a = 1
|
1151 |
|
|
b = 1
|
1152 |
|
|
b(2,2) = 2
|
1153 |
|
|
print *, any(a .eq. b, 1)
|
1154 |
|
|
print *, any(a .eq. b, 2)
|
1155 |
|
|
end subroutine section
|
1156 |
|
|
end program test_any
|
1157 |
|
|
@end smallexample
|
1158 |
|
|
@end table
|
1159 |
|
|
|
1160 |
|
|
|
1161 |
|
|
|
1162 |
|
|
@node ASIN
|
1163 |
|
|
@section @code{ASIN} --- Arcsine function
|
1164 |
|
|
@fnindex ASIN
|
1165 |
|
|
@fnindex DASIN
|
1166 |
|
|
@cindex trigonometric function, sine, inverse
|
1167 |
|
|
@cindex sine, inverse
|
1168 |
|
|
|
1169 |
|
|
@table @asis
|
1170 |
|
|
@item @emph{Description}:
|
1171 |
|
|
@code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
|
1172 |
|
|
|
1173 |
|
|
@item @emph{Standard}:
|
1174 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
1175 |
|
|
|
1176 |
|
|
@item @emph{Class}:
|
1177 |
|
|
Elemental function
|
1178 |
|
|
|
1179 |
|
|
@item @emph{Syntax}:
|
1180 |
|
|
@code{RESULT = ASIN(X)}
|
1181 |
|
|
|
1182 |
|
|
@item @emph{Arguments}:
|
1183 |
|
|
@multitable @columnfractions .15 .70
|
1184 |
|
|
@item @var{X} @tab The type shall be either @code{REAL} and a magnitude that is
|
1185 |
|
|
less than or equal to one - or be @code{COMPLEX}.
|
1186 |
|
|
@end multitable
|
1187 |
|
|
|
1188 |
|
|
@item @emph{Return value}:
|
1189 |
|
|
The return value is of the same type and kind as @var{X}.
|
1190 |
|
|
The real part of the result is in radians and lies in the range
|
1191 |
|
|
@math{-\pi/2 \leq \Re \asin(x) \leq \pi/2}.
|
1192 |
|
|
|
1193 |
|
|
@item @emph{Example}:
|
1194 |
|
|
@smallexample
|
1195 |
|
|
program test_asin
|
1196 |
|
|
real(8) :: x = 0.866_8
|
1197 |
|
|
x = asin(x)
|
1198 |
|
|
end program test_asin
|
1199 |
|
|
@end smallexample
|
1200 |
|
|
|
1201 |
|
|
@item @emph{Specific names}:
|
1202 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1203 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1204 |
|
|
@item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
1205 |
|
|
@end multitable
|
1206 |
|
|
|
1207 |
|
|
@item @emph{See also}:
|
1208 |
|
|
Inverse function: @ref{SIN}
|
1209 |
|
|
|
1210 |
|
|
@end table
|
1211 |
|
|
|
1212 |
|
|
|
1213 |
|
|
|
1214 |
|
|
@node ASINH
|
1215 |
378 |
julius |
@section @code{ASINH} --- Inverse hyperbolic sine function
|
1216 |
285 |
jeremybenn |
@fnindex ASINH
|
1217 |
|
|
@fnindex DASINH
|
1218 |
|
|
@cindex area hyperbolic sine
|
1219 |
378 |
julius |
@cindex inverse hyperbolic sine
|
1220 |
285 |
jeremybenn |
@cindex hyperbolic function, sine, inverse
|
1221 |
|
|
@cindex sine, hyperbolic, inverse
|
1222 |
|
|
|
1223 |
|
|
@table @asis
|
1224 |
|
|
@item @emph{Description}:
|
1225 |
378 |
julius |
@code{ASINH(X)} computes the inverse hyperbolic sine of @var{X}.
|
1226 |
285 |
jeremybenn |
|
1227 |
|
|
@item @emph{Standard}:
|
1228 |
|
|
Fortran 2008 and later
|
1229 |
|
|
|
1230 |
|
|
@item @emph{Class}:
|
1231 |
|
|
Elemental function
|
1232 |
|
|
|
1233 |
|
|
@item @emph{Syntax}:
|
1234 |
|
|
@code{RESULT = ASINH(X)}
|
1235 |
|
|
|
1236 |
|
|
@item @emph{Arguments}:
|
1237 |
|
|
@multitable @columnfractions .15 .70
|
1238 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
1239 |
|
|
@end multitable
|
1240 |
|
|
|
1241 |
|
|
@item @emph{Return value}:
|
1242 |
|
|
The return value is of the same type and kind as @var{X}. If @var{X} is
|
1243 |
|
|
complex, the imaginary part of the result is in radians and lies between
|
1244 |
|
|
@math{-\pi/2 \leq \Im \asinh(x) \leq \pi/2}.
|
1245 |
|
|
|
1246 |
|
|
@item @emph{Example}:
|
1247 |
|
|
@smallexample
|
1248 |
|
|
PROGRAM test_asinh
|
1249 |
|
|
REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
|
1250 |
|
|
WRITE (*,*) ASINH(x)
|
1251 |
|
|
END PROGRAM
|
1252 |
|
|
@end smallexample
|
1253 |
|
|
|
1254 |
|
|
@item @emph{Specific names}:
|
1255 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1256 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1257 |
|
|
@item @code{DASINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension.
|
1258 |
|
|
@end multitable
|
1259 |
|
|
|
1260 |
|
|
@item @emph{See also}:
|
1261 |
|
|
Inverse function: @ref{SINH}
|
1262 |
|
|
@end table
|
1263 |
|
|
|
1264 |
|
|
|
1265 |
|
|
|
1266 |
|
|
@node ASSOCIATED
|
1267 |
|
|
@section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
|
1268 |
|
|
@fnindex ASSOCIATED
|
1269 |
|
|
@cindex pointer, status
|
1270 |
|
|
@cindex association status
|
1271 |
|
|
|
1272 |
|
|
@table @asis
|
1273 |
|
|
@item @emph{Description}:
|
1274 |
|
|
@code{ASSOCIATED(POINTER [, TARGET])} determines the status of the pointer
|
1275 |
|
|
@var{POINTER} or if @var{POINTER} is associated with the target @var{TARGET}.
|
1276 |
|
|
|
1277 |
|
|
@item @emph{Standard}:
|
1278 |
|
|
Fortran 95 and later
|
1279 |
|
|
|
1280 |
|
|
@item @emph{Class}:
|
1281 |
|
|
Inquiry function
|
1282 |
|
|
|
1283 |
|
|
@item @emph{Syntax}:
|
1284 |
|
|
@code{RESULT = ASSOCIATED(POINTER [, TARGET])}
|
1285 |
|
|
|
1286 |
|
|
@item @emph{Arguments}:
|
1287 |
|
|
@multitable @columnfractions .15 .70
|
1288 |
|
|
@item @var{POINTER} @tab @var{POINTER} shall have the @code{POINTER} attribute
|
1289 |
|
|
and it can be of any type.
|
1290 |
|
|
@item @var{TARGET} @tab (Optional) @var{TARGET} shall be a pointer or
|
1291 |
|
|
a target. It must have the same type, kind type parameter, and
|
1292 |
|
|
array rank as @var{POINTER}.
|
1293 |
|
|
@end multitable
|
1294 |
|
|
The association status of neither @var{POINTER} nor @var{TARGET} shall be
|
1295 |
|
|
undefined.
|
1296 |
|
|
|
1297 |
|
|
@item @emph{Return value}:
|
1298 |
|
|
@code{ASSOCIATED(POINTER)} returns a scalar value of type @code{LOGICAL(4)}.
|
1299 |
|
|
There are several cases:
|
1300 |
|
|
@table @asis
|
1301 |
|
|
@item (A) When the optional @var{TARGET} is not present then
|
1302 |
|
|
@code{ASSOCIATED(POINTER)} is true if @var{POINTER} is associated with a target; otherwise, it returns false.
|
1303 |
|
|
@item (B) If @var{TARGET} is present and a scalar target, the result is true if
|
1304 |
|
|
@var{TARGET} is not a zero-sized storage sequence and the target associated with @var{POINTER} occupies the same storage units. If @var{POINTER} is
|
1305 |
|
|
disassociated, the result is false.
|
1306 |
|
|
@item (C) If @var{TARGET} is present and an array target, the result is true if
|
1307 |
|
|
@var{TARGET} and @var{POINTER} have the same shape, are not zero-sized arrays,
|
1308 |
|
|
are arrays whose elements are not zero-sized storage sequences, and
|
1309 |
|
|
@var{TARGET} and @var{POINTER} occupy the same storage units in array element
|
1310 |
|
|
order.
|
1311 |
|
|
As in case(B), the result is false, if @var{POINTER} is disassociated.
|
1312 |
|
|
@item (D) If @var{TARGET} is present and an scalar pointer, the result is true
|
1313 |
|
|
if @var{TARGET} is associated with @var{POINTER}, the target associated with
|
1314 |
|
|
@var{TARGET} are not zero-sized storage sequences and occupy the same storage
|
1315 |
|
|
units.
|
1316 |
|
|
The result is false, if either @var{TARGET} or @var{POINTER} is disassociated.
|
1317 |
|
|
@item (E) If @var{TARGET} is present and an array pointer, the result is true if
|
1318 |
|
|
target associated with @var{POINTER} and the target associated with @var{TARGET}
|
1319 |
|
|
have the same shape, are not zero-sized arrays, are arrays whose elements are
|
1320 |
|
|
not zero-sized storage sequences, and @var{TARGET} and @var{POINTER} occupy
|
1321 |
|
|
the same storage units in array element order.
|
1322 |
|
|
The result is false, if either @var{TARGET} or @var{POINTER} is disassociated.
|
1323 |
|
|
@end table
|
1324 |
|
|
|
1325 |
|
|
@item @emph{Example}:
|
1326 |
|
|
@smallexample
|
1327 |
|
|
program test_associated
|
1328 |
|
|
implicit none
|
1329 |
|
|
real, target :: tgt(2) = (/1., 2./)
|
1330 |
|
|
real, pointer :: ptr(:)
|
1331 |
|
|
ptr => tgt
|
1332 |
|
|
if (associated(ptr) .eqv. .false.) call abort
|
1333 |
|
|
if (associated(ptr,tgt) .eqv. .false.) call abort
|
1334 |
|
|
end program test_associated
|
1335 |
|
|
@end smallexample
|
1336 |
|
|
|
1337 |
|
|
@item @emph{See also}:
|
1338 |
|
|
@ref{NULL}
|
1339 |
|
|
@end table
|
1340 |
|
|
|
1341 |
|
|
|
1342 |
|
|
|
1343 |
|
|
@node ATAN
|
1344 |
|
|
@section @code{ATAN} --- Arctangent function
|
1345 |
|
|
@fnindex ATAN
|
1346 |
|
|
@fnindex DATAN
|
1347 |
|
|
@cindex trigonometric function, tangent, inverse
|
1348 |
|
|
@cindex tangent, inverse
|
1349 |
|
|
|
1350 |
|
|
@table @asis
|
1351 |
|
|
@item @emph{Description}:
|
1352 |
|
|
@code{ATAN(X)} computes the arctangent of @var{X}.
|
1353 |
|
|
|
1354 |
|
|
@item @emph{Standard}:
|
1355 |
|
|
Fortran 77 and later, for a complex argument and for two arguments
|
1356 |
|
|
Fortran 2008 or later
|
1357 |
|
|
|
1358 |
|
|
@item @emph{Class}:
|
1359 |
|
|
Elemental function
|
1360 |
|
|
|
1361 |
|
|
@item @emph{Syntax}:
|
1362 |
|
|
@code{RESULT = ATAN(X)}
|
1363 |
|
|
@code{RESULT = ATAN(Y, X)}
|
1364 |
|
|
|
1365 |
|
|
@item @emph{Arguments}:
|
1366 |
|
|
@multitable @columnfractions .15 .70
|
1367 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX};
|
1368 |
|
|
if @var{Y} is present, @var{X} shall be REAL.
|
1369 |
|
|
@item @var{Y} shall be of the same type and kind as @var{X}.
|
1370 |
|
|
@end multitable
|
1371 |
|
|
|
1372 |
|
|
@item @emph{Return value}:
|
1373 |
|
|
The return value is of the same type and kind as @var{X}.
|
1374 |
|
|
If @var{Y} is present, the result is identical to @code{ATAN2(Y,X)}.
|
1375 |
|
|
Otherwise, it the arcus tangent of @var{X}, where the real part of
|
1376 |
|
|
the result is in radians and lies in the range
|
1377 |
|
|
@math{-\pi/2 \leq \Re \atan(x) \leq \pi/2}.
|
1378 |
|
|
|
1379 |
|
|
@item @emph{Example}:
|
1380 |
|
|
@smallexample
|
1381 |
|
|
program test_atan
|
1382 |
|
|
real(8) :: x = 2.866_8
|
1383 |
|
|
x = atan(x)
|
1384 |
|
|
end program test_atan
|
1385 |
|
|
@end smallexample
|
1386 |
|
|
|
1387 |
|
|
@item @emph{Specific names}:
|
1388 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1389 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1390 |
|
|
@item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
1391 |
|
|
@end multitable
|
1392 |
|
|
|
1393 |
|
|
@item @emph{See also}:
|
1394 |
|
|
Inverse function: @ref{TAN}
|
1395 |
|
|
|
1396 |
|
|
@end table
|
1397 |
|
|
|
1398 |
|
|
|
1399 |
|
|
|
1400 |
|
|
@node ATAN2
|
1401 |
|
|
@section @code{ATAN2} --- Arctangent function
|
1402 |
|
|
@fnindex ATAN2
|
1403 |
|
|
@fnindex DATAN2
|
1404 |
|
|
@cindex trigonometric function, tangent, inverse
|
1405 |
|
|
@cindex tangent, inverse
|
1406 |
|
|
|
1407 |
|
|
@table @asis
|
1408 |
|
|
@item @emph{Description}:
|
1409 |
|
|
@code{ATAN2(Y, X)} computes the principal value of the argument
|
1410 |
|
|
function of the complex number @math{X + i Y}. This function can
|
1411 |
|
|
be used to transform from carthesian into polar coordinates and
|
1412 |
|
|
allows to determine the angle in the correct quadrant.
|
1413 |
|
|
|
1414 |
|
|
@item @emph{Standard}:
|
1415 |
|
|
Fortran 77 and later
|
1416 |
|
|
|
1417 |
|
|
@item @emph{Class}:
|
1418 |
|
|
Elemental function
|
1419 |
|
|
|
1420 |
|
|
@item @emph{Syntax}:
|
1421 |
|
|
@code{RESULT = ATAN2(Y, X)}
|
1422 |
|
|
|
1423 |
|
|
@item @emph{Arguments}:
|
1424 |
|
|
@multitable @columnfractions .15 .70
|
1425 |
|
|
@item @var{Y} @tab The type shall be @code{REAL}.
|
1426 |
|
|
@item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
|
1427 |
|
|
If @var{Y} is zero, then @var{X} must be nonzero.
|
1428 |
|
|
@end multitable
|
1429 |
|
|
|
1430 |
|
|
@item @emph{Return value}:
|
1431 |
|
|
The return value has the same type and kind type parameter as @var{Y}.
|
1432 |
|
|
It is the principal value of the complex number @math{X + i Y}. If
|
1433 |
|
|
@var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
|
1434 |
|
|
The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
|
1435 |
|
|
the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
|
1436 |
|
|
is negative. Finally, if @var{X} is zero, then the magnitude of the result
|
1437 |
|
|
is @math{\pi/2}.
|
1438 |
|
|
|
1439 |
|
|
@item @emph{Example}:
|
1440 |
|
|
@smallexample
|
1441 |
|
|
program test_atan2
|
1442 |
|
|
real(4) :: x = 1.e0_4, y = 0.5e0_4
|
1443 |
|
|
x = atan2(y,x)
|
1444 |
|
|
end program test_atan2
|
1445 |
|
|
@end smallexample
|
1446 |
|
|
|
1447 |
|
|
@item @emph{Specific names}:
|
1448 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1449 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1450 |
|
|
@item @code{DATAN2(X, Y)} @tab @code{REAL(8) X}, @code{REAL(8) Y} @tab @code{REAL(8)} @tab Fortran 77 and later
|
1451 |
|
|
@end multitable
|
1452 |
|
|
@end table
|
1453 |
|
|
|
1454 |
|
|
|
1455 |
|
|
|
1456 |
|
|
@node ATANH
|
1457 |
378 |
julius |
@section @code{ATANH} --- Inverse hyperbolic tangent function
|
1458 |
|
|
@fnindex ATANH
|
1459 |
|
|
@fnindex DATANH
|
1460 |
285 |
jeremybenn |
@cindex area hyperbolic tangent
|
1461 |
378 |
julius |
@cindex inverse hyperbolic tangent
|
1462 |
285 |
jeremybenn |
@cindex hyperbolic function, tangent, inverse
|
1463 |
|
|
@cindex tangent, hyperbolic, inverse
|
1464 |
|
|
|
1465 |
|
|
@table @asis
|
1466 |
|
|
@item @emph{Description}:
|
1467 |
378 |
julius |
@code{ATANH(X)} computes the inverse hyperbolic tangent of @var{X}.
|
1468 |
285 |
jeremybenn |
|
1469 |
|
|
@item @emph{Standard}:
|
1470 |
|
|
Fortran 2008 and later
|
1471 |
|
|
|
1472 |
|
|
@item @emph{Class}:
|
1473 |
|
|
Elemental function
|
1474 |
|
|
|
1475 |
|
|
@item @emph{Syntax}:
|
1476 |
|
|
@code{RESULT = ATANH(X)}
|
1477 |
|
|
|
1478 |
|
|
@item @emph{Arguments}:
|
1479 |
|
|
@multitable @columnfractions .15 .70
|
1480 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
1481 |
|
|
@end multitable
|
1482 |
|
|
|
1483 |
|
|
@item @emph{Return value}:
|
1484 |
|
|
The return value has same type and kind as @var{X}. If @var{X} is
|
1485 |
|
|
complex, the imaginary part of the result is in radians and lies between
|
1486 |
|
|
@math{-\pi/2 \leq \Im \atanh(x) \leq \pi/2}.
|
1487 |
|
|
|
1488 |
|
|
@item @emph{Example}:
|
1489 |
|
|
@smallexample
|
1490 |
|
|
PROGRAM test_atanh
|
1491 |
|
|
REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
|
1492 |
|
|
WRITE (*,*) ATANH(x)
|
1493 |
|
|
END PROGRAM
|
1494 |
|
|
@end smallexample
|
1495 |
|
|
|
1496 |
|
|
@item @emph{Specific names}:
|
1497 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1498 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1499 |
|
|
@item @code{DATANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
1500 |
|
|
@end multitable
|
1501 |
|
|
|
1502 |
|
|
@item @emph{See also}:
|
1503 |
|
|
Inverse function: @ref{TANH}
|
1504 |
|
|
@end table
|
1505 |
|
|
|
1506 |
|
|
|
1507 |
|
|
|
1508 |
|
|
@node BESSEL_J0
|
1509 |
|
|
@section @code{BESSEL_J0} --- Bessel function of the first kind of order 0
|
1510 |
|
|
@fnindex BESSEL_J0
|
1511 |
|
|
@fnindex BESJ0
|
1512 |
|
|
@fnindex DBESJ0
|
1513 |
|
|
@cindex Bessel function, first kind
|
1514 |
|
|
|
1515 |
|
|
@table @asis
|
1516 |
|
|
@item @emph{Description}:
|
1517 |
|
|
@code{BESSEL_J0(X)} computes the Bessel function of the first kind of
|
1518 |
|
|
order 0 of @var{X}. This function is available under the name
|
1519 |
|
|
@code{BESJ0} as a GNU extension.
|
1520 |
|
|
|
1521 |
|
|
@item @emph{Standard}:
|
1522 |
|
|
Fortran 2008 and later
|
1523 |
|
|
|
1524 |
|
|
@item @emph{Class}:
|
1525 |
|
|
Elemental function
|
1526 |
|
|
|
1527 |
|
|
@item @emph{Syntax}:
|
1528 |
|
|
@code{RESULT = BESSEL_J0(X)}
|
1529 |
|
|
|
1530 |
|
|
@item @emph{Arguments}:
|
1531 |
|
|
@multitable @columnfractions .15 .70
|
1532 |
|
|
@item @var{X} @tab The type shall be @code{REAL}, and it shall be scalar.
|
1533 |
|
|
@end multitable
|
1534 |
|
|
|
1535 |
|
|
@item @emph{Return value}:
|
1536 |
|
|
The return value is of type @code{REAL} and lies in the
|
1537 |
|
|
range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}. It has the same
|
1538 |
|
|
kind as @var{X}.
|
1539 |
|
|
|
1540 |
|
|
@item @emph{Example}:
|
1541 |
|
|
@smallexample
|
1542 |
|
|
program test_besj0
|
1543 |
|
|
real(8) :: x = 0.0_8
|
1544 |
|
|
x = bessel_j0(x)
|
1545 |
|
|
end program test_besj0
|
1546 |
|
|
@end smallexample
|
1547 |
|
|
|
1548 |
|
|
@item @emph{Specific names}:
|
1549 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1550 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1551 |
|
|
@item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
1552 |
|
|
@end multitable
|
1553 |
|
|
@end table
|
1554 |
|
|
|
1555 |
|
|
|
1556 |
|
|
|
1557 |
|
|
@node BESSEL_J1
|
1558 |
|
|
@section @code{BESSEL_J1} --- Bessel function of the first kind of order 1
|
1559 |
|
|
@fnindex BESSEL_J1
|
1560 |
|
|
@fnindex BESJ1
|
1561 |
|
|
@fnindex DBESJ1
|
1562 |
|
|
@cindex Bessel function, first kind
|
1563 |
|
|
|
1564 |
|
|
@table @asis
|
1565 |
|
|
@item @emph{Description}:
|
1566 |
|
|
@code{BESSEL_J1(X)} computes the Bessel function of the first kind of
|
1567 |
|
|
order 1 of @var{X}. This function is available under the name
|
1568 |
|
|
@code{BESJ1} as a GNU extension.
|
1569 |
|
|
|
1570 |
|
|
@item @emph{Standard}:
|
1571 |
|
|
Fortran 2008
|
1572 |
|
|
|
1573 |
|
|
@item @emph{Class}:
|
1574 |
|
|
Elemental function
|
1575 |
|
|
|
1576 |
|
|
@item @emph{Syntax}:
|
1577 |
|
|
@code{RESULT = BESSEL_J1(X)}
|
1578 |
|
|
|
1579 |
|
|
@item @emph{Arguments}:
|
1580 |
|
|
@multitable @columnfractions .15 .70
|
1581 |
|
|
@item @var{X} @tab The type shall be @code{REAL}, and it shall be scalar.
|
1582 |
|
|
@end multitable
|
1583 |
|
|
|
1584 |
|
|
@item @emph{Return value}:
|
1585 |
|
|
The return value is of type @code{REAL} and it lies in the
|
1586 |
|
|
range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }. It has the same
|
1587 |
|
|
kind as @var{X}.
|
1588 |
|
|
|
1589 |
|
|
@item @emph{Example}:
|
1590 |
|
|
@smallexample
|
1591 |
|
|
program test_besj1
|
1592 |
|
|
real(8) :: x = 1.0_8
|
1593 |
|
|
x = bessel_j1(x)
|
1594 |
|
|
end program test_besj1
|
1595 |
|
|
@end smallexample
|
1596 |
|
|
|
1597 |
|
|
@item @emph{Specific names}:
|
1598 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1599 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1600 |
|
|
@item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
1601 |
|
|
@end multitable
|
1602 |
|
|
@end table
|
1603 |
|
|
|
1604 |
|
|
|
1605 |
|
|
|
1606 |
|
|
@node BESSEL_JN
|
1607 |
|
|
@section @code{BESSEL_JN} --- Bessel function of the first kind
|
1608 |
|
|
@fnindex BESSEL_JN
|
1609 |
|
|
@fnindex BESJN
|
1610 |
|
|
@fnindex DBESJN
|
1611 |
|
|
@cindex Bessel function, first kind
|
1612 |
|
|
|
1613 |
|
|
@table @asis
|
1614 |
|
|
@item @emph{Description}:
|
1615 |
|
|
@code{BESSEL_JN(N, X)} computes the Bessel function of the first kind of
|
1616 |
|
|
order @var{N} of @var{X}. This function is available under the name
|
1617 |
|
|
@code{BESJN} as a GNU extension.
|
1618 |
|
|
|
1619 |
|
|
If both arguments are arrays, their ranks and shapes shall conform.
|
1620 |
|
|
|
1621 |
|
|
@item @emph{Standard}:
|
1622 |
|
|
Fortran 2008 and later
|
1623 |
|
|
|
1624 |
|
|
@item @emph{Class}:
|
1625 |
|
|
Elemental function
|
1626 |
|
|
|
1627 |
|
|
@item @emph{Syntax}:
|
1628 |
|
|
@code{RESULT = BESSEL_JN(N, X)}
|
1629 |
|
|
|
1630 |
|
|
@item @emph{Arguments}:
|
1631 |
|
|
@multitable @columnfractions .15 .70
|
1632 |
|
|
@item @var{N} @tab Shall be a scalar or an array of type @code{INTEGER}.
|
1633 |
|
|
@item @var{X} @tab Shall be a scalar or an array of type @code{REAL}.
|
1634 |
|
|
@end multitable
|
1635 |
|
|
|
1636 |
|
|
@item @emph{Return value}:
|
1637 |
|
|
The return value is a scalar of type @code{REAL}. It has the same
|
1638 |
|
|
kind as @var{X}.
|
1639 |
|
|
|
1640 |
|
|
@item @emph{Example}:
|
1641 |
|
|
@smallexample
|
1642 |
|
|
program test_besjn
|
1643 |
|
|
real(8) :: x = 1.0_8
|
1644 |
|
|
x = bessel_jn(5,x)
|
1645 |
|
|
end program test_besjn
|
1646 |
|
|
@end smallexample
|
1647 |
|
|
|
1648 |
|
|
@item @emph{Specific names}:
|
1649 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1650 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1651 |
|
|
@item @code{DBESJN(N, X)} @tab @code{INTEGER N} @tab @code{REAL(8)} @tab GNU extension
|
1652 |
|
|
@item @tab @code{REAL(8) X} @tab @tab
|
1653 |
|
|
@end multitable
|
1654 |
|
|
@end table
|
1655 |
|
|
|
1656 |
|
|
|
1657 |
|
|
|
1658 |
|
|
@node BESSEL_Y0
|
1659 |
|
|
@section @code{BESSEL_Y0} --- Bessel function of the second kind of order 0
|
1660 |
|
|
@fnindex BESSEL_Y0
|
1661 |
|
|
@fnindex BESY0
|
1662 |
|
|
@fnindex DBESY0
|
1663 |
|
|
@cindex Bessel function, second kind
|
1664 |
|
|
|
1665 |
|
|
@table @asis
|
1666 |
|
|
@item @emph{Description}:
|
1667 |
|
|
@code{BESSEL_Y0(X)} computes the Bessel function of the second kind of
|
1668 |
|
|
order 0 of @var{X}. This function is available under the name
|
1669 |
|
|
@code{BESY0} as a GNU extension.
|
1670 |
|
|
|
1671 |
|
|
@item @emph{Standard}:
|
1672 |
|
|
Fortran 2008 and later
|
1673 |
|
|
|
1674 |
|
|
@item @emph{Class}:
|
1675 |
|
|
Elemental function
|
1676 |
|
|
|
1677 |
|
|
@item @emph{Syntax}:
|
1678 |
|
|
@code{RESULT = BESSEL_Y0(X)}
|
1679 |
|
|
|
1680 |
|
|
@item @emph{Arguments}:
|
1681 |
|
|
@multitable @columnfractions .15 .70
|
1682 |
|
|
@item @var{X} @tab The type shall be @code{REAL}, and it shall be scalar.
|
1683 |
|
|
@end multitable
|
1684 |
|
|
|
1685 |
|
|
@item @emph{Return value}:
|
1686 |
|
|
The return value is a scalar of type @code{REAL}. It has the same
|
1687 |
|
|
kind as @var{X}.
|
1688 |
|
|
|
1689 |
|
|
@item @emph{Example}:
|
1690 |
|
|
@smallexample
|
1691 |
|
|
program test_besy0
|
1692 |
|
|
real(8) :: x = 0.0_8
|
1693 |
|
|
x = bessel_y0(x)
|
1694 |
|
|
end program test_besy0
|
1695 |
|
|
@end smallexample
|
1696 |
|
|
|
1697 |
|
|
@item @emph{Specific names}:
|
1698 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1699 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1700 |
|
|
@item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
1701 |
|
|
@end multitable
|
1702 |
|
|
@end table
|
1703 |
|
|
|
1704 |
|
|
|
1705 |
|
|
|
1706 |
|
|
@node BESSEL_Y1
|
1707 |
|
|
@section @code{BESSEL_Y1} --- Bessel function of the second kind of order 1
|
1708 |
|
|
@fnindex BESSEL_Y1
|
1709 |
|
|
@fnindex BESY1
|
1710 |
|
|
@fnindex DBESY1
|
1711 |
|
|
@cindex Bessel function, second kind
|
1712 |
|
|
|
1713 |
|
|
@table @asis
|
1714 |
|
|
@item @emph{Description}:
|
1715 |
|
|
@code{BESSEL_Y1(X)} computes the Bessel function of the second kind of
|
1716 |
|
|
order 1 of @var{X}. This function is available under the name
|
1717 |
|
|
@code{BESY1} as a GNU extension.
|
1718 |
|
|
|
1719 |
|
|
@item @emph{Standard}:
|
1720 |
|
|
Fortran 2008 and later
|
1721 |
|
|
|
1722 |
|
|
@item @emph{Class}:
|
1723 |
|
|
Elemental function
|
1724 |
|
|
|
1725 |
|
|
@item @emph{Syntax}:
|
1726 |
|
|
@code{RESULT = BESSEL_Y1(X)}
|
1727 |
|
|
|
1728 |
|
|
@item @emph{Arguments}:
|
1729 |
|
|
@multitable @columnfractions .15 .70
|
1730 |
|
|
@item @var{X} @tab The type shall be @code{REAL}, and it shall be scalar.
|
1731 |
|
|
@end multitable
|
1732 |
|
|
|
1733 |
|
|
@item @emph{Return value}:
|
1734 |
|
|
The return value is a scalar of type @code{REAL}. It has the same
|
1735 |
|
|
kind as @var{X}.
|
1736 |
|
|
|
1737 |
|
|
@item @emph{Example}:
|
1738 |
|
|
@smallexample
|
1739 |
|
|
program test_besy1
|
1740 |
|
|
real(8) :: x = 1.0_8
|
1741 |
|
|
x = bessel_y1(x)
|
1742 |
|
|
end program test_besy1
|
1743 |
|
|
@end smallexample
|
1744 |
|
|
|
1745 |
|
|
@item @emph{Specific names}:
|
1746 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1747 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1748 |
|
|
@item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
1749 |
|
|
@end multitable
|
1750 |
|
|
@end table
|
1751 |
|
|
|
1752 |
|
|
|
1753 |
|
|
|
1754 |
|
|
@node BESSEL_YN
|
1755 |
|
|
@section @code{BESSEL_YN} --- Bessel function of the second kind
|
1756 |
|
|
@fnindex BESSEL_YN
|
1757 |
|
|
@fnindex BESYN
|
1758 |
|
|
@fnindex DBESYN
|
1759 |
|
|
@cindex Bessel function, second kind
|
1760 |
|
|
|
1761 |
|
|
@table @asis
|
1762 |
|
|
@item @emph{Description}:
|
1763 |
|
|
@code{BESSEL_YN(N, X)} computes the Bessel function of the second kind of
|
1764 |
|
|
order @var{N} of @var{X}. This function is available under the name
|
1765 |
|
|
@code{BESYN} as a GNU extension.
|
1766 |
|
|
|
1767 |
|
|
If both arguments are arrays, their ranks and shapes shall conform.
|
1768 |
|
|
|
1769 |
|
|
@item @emph{Standard}:
|
1770 |
|
|
Fortran 2008 and later
|
1771 |
|
|
|
1772 |
|
|
@item @emph{Class}:
|
1773 |
|
|
Elemental function
|
1774 |
|
|
|
1775 |
|
|
@item @emph{Syntax}:
|
1776 |
|
|
@code{RESULT = BESSEL_YN(N, X)}
|
1777 |
|
|
|
1778 |
|
|
@item @emph{Arguments}:
|
1779 |
|
|
@multitable @columnfractions .15 .70
|
1780 |
|
|
@item @var{N} @tab Shall be a scalar or an array of type @code{INTEGER}.
|
1781 |
|
|
@item @var{X} @tab Shall be a scalar or an array of type @code{REAL}.
|
1782 |
|
|
@end multitable
|
1783 |
|
|
|
1784 |
|
|
@item @emph{Return value}:
|
1785 |
|
|
The return value is a scalar of type @code{REAL}. It has the same
|
1786 |
|
|
kind as @var{X}.
|
1787 |
|
|
|
1788 |
|
|
@item @emph{Example}:
|
1789 |
|
|
@smallexample
|
1790 |
|
|
program test_besyn
|
1791 |
|
|
real(8) :: x = 1.0_8
|
1792 |
|
|
x = bessel_yn(5,x)
|
1793 |
|
|
end program test_besyn
|
1794 |
|
|
@end smallexample
|
1795 |
|
|
|
1796 |
|
|
@item @emph{Specific names}:
|
1797 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
1798 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
1799 |
|
|
@item @code{DBESYN(N,X)} @tab @code{INTEGER N} @tab @code{REAL(8)} @tab GNU extension
|
1800 |
|
|
@item @tab @code{REAL(8) X} @tab @tab
|
1801 |
|
|
@end multitable
|
1802 |
|
|
@end table
|
1803 |
|
|
|
1804 |
|
|
|
1805 |
|
|
|
1806 |
|
|
@node BIT_SIZE
|
1807 |
|
|
@section @code{BIT_SIZE} --- Bit size inquiry function
|
1808 |
|
|
@fnindex BIT_SIZE
|
1809 |
|
|
@cindex bits, number of
|
1810 |
|
|
@cindex size of a variable, in bits
|
1811 |
|
|
|
1812 |
|
|
@table @asis
|
1813 |
|
|
@item @emph{Description}:
|
1814 |
|
|
@code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
|
1815 |
|
|
represented by the type of @var{I}. The result of @code{BIT_SIZE(I)} is
|
1816 |
|
|
independent of the actual value of @var{I}.
|
1817 |
|
|
|
1818 |
|
|
@item @emph{Standard}:
|
1819 |
|
|
Fortran 95 and later
|
1820 |
|
|
|
1821 |
|
|
@item @emph{Class}:
|
1822 |
|
|
Inquiry function
|
1823 |
|
|
|
1824 |
|
|
@item @emph{Syntax}:
|
1825 |
|
|
@code{RESULT = BIT_SIZE(I)}
|
1826 |
|
|
|
1827 |
|
|
@item @emph{Arguments}:
|
1828 |
|
|
@multitable @columnfractions .15 .70
|
1829 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
1830 |
|
|
@end multitable
|
1831 |
|
|
|
1832 |
|
|
@item @emph{Return value}:
|
1833 |
|
|
The return value is of type @code{INTEGER}
|
1834 |
|
|
|
1835 |
|
|
@item @emph{Example}:
|
1836 |
|
|
@smallexample
|
1837 |
|
|
program test_bit_size
|
1838 |
|
|
integer :: i = 123
|
1839 |
|
|
integer :: size
|
1840 |
|
|
size = bit_size(i)
|
1841 |
|
|
print *, size
|
1842 |
|
|
end program test_bit_size
|
1843 |
|
|
@end smallexample
|
1844 |
|
|
@end table
|
1845 |
|
|
|
1846 |
|
|
|
1847 |
|
|
|
1848 |
|
|
@node BTEST
|
1849 |
|
|
@section @code{BTEST} --- Bit test function
|
1850 |
|
|
@fnindex BTEST
|
1851 |
|
|
@cindex bits, testing
|
1852 |
|
|
|
1853 |
|
|
@table @asis
|
1854 |
|
|
@item @emph{Description}:
|
1855 |
|
|
@code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
|
1856 |
|
|
in @var{I} is set. The counting of the bits starts at 0.
|
1857 |
|
|
|
1858 |
|
|
@item @emph{Standard}:
|
1859 |
|
|
Fortran 95 and later
|
1860 |
|
|
|
1861 |
|
|
@item @emph{Class}:
|
1862 |
|
|
Elemental function
|
1863 |
|
|
|
1864 |
|
|
@item @emph{Syntax}:
|
1865 |
|
|
@code{RESULT = BTEST(I, POS)}
|
1866 |
|
|
|
1867 |
|
|
@item @emph{Arguments}:
|
1868 |
|
|
@multitable @columnfractions .15 .70
|
1869 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
1870 |
|
|
@item @var{POS} @tab The type shall be @code{INTEGER}.
|
1871 |
|
|
@end multitable
|
1872 |
|
|
|
1873 |
|
|
@item @emph{Return value}:
|
1874 |
|
|
The return value is of type @code{LOGICAL}
|
1875 |
|
|
|
1876 |
|
|
@item @emph{Example}:
|
1877 |
|
|
@smallexample
|
1878 |
|
|
program test_btest
|
1879 |
|
|
integer :: i = 32768 + 1024 + 64
|
1880 |
|
|
integer :: pos
|
1881 |
|
|
logical :: bool
|
1882 |
|
|
do pos=0,16
|
1883 |
|
|
bool = btest(i, pos)
|
1884 |
|
|
print *, pos, bool
|
1885 |
|
|
end do
|
1886 |
|
|
end program test_btest
|
1887 |
|
|
@end smallexample
|
1888 |
|
|
@end table
|
1889 |
|
|
|
1890 |
|
|
|
1891 |
|
|
@node C_ASSOCIATED
|
1892 |
|
|
@section @code{C_ASSOCIATED} --- Status of a C pointer
|
1893 |
|
|
@fnindex C_ASSOCIATED
|
1894 |
|
|
@cindex association status, C pointer
|
1895 |
|
|
@cindex pointer, C association status
|
1896 |
|
|
|
1897 |
|
|
@table @asis
|
1898 |
|
|
@item @emph{Description}:
|
1899 |
|
|
@code{C_ASSOCIATED(c_prt_1[, c_ptr_2])} determines the status of the C pointer
|
1900 |
|
|
@var{c_ptr_1} or if @var{c_ptr_1} is associated with the target @var{c_ptr_2}.
|
1901 |
|
|
|
1902 |
|
|
@item @emph{Standard}:
|
1903 |
|
|
Fortran 2003 and later
|
1904 |
|
|
|
1905 |
|
|
@item @emph{Class}:
|
1906 |
|
|
Inquiry function
|
1907 |
|
|
|
1908 |
|
|
@item @emph{Syntax}:
|
1909 |
|
|
@code{RESULT = C_ASSOCIATED(c_prt_1[, c_ptr_2])}
|
1910 |
|
|
|
1911 |
|
|
@item @emph{Arguments}:
|
1912 |
|
|
@multitable @columnfractions .15 .70
|
1913 |
|
|
@item @var{c_ptr_1} @tab Scalar of the type @code{C_PTR} or @code{C_FUNPTR}.
|
1914 |
|
|
@item @var{c_ptr_2} @tab (Optional) Scalar of the same type as @var{c_ptr_1}.
|
1915 |
|
|
@end multitable
|
1916 |
|
|
|
1917 |
|
|
@item @emph{Return value}:
|
1918 |
|
|
The return value is of type @code{LOGICAL}; it is @code{.false.} if either
|
1919 |
|
|
@var{c_ptr_1} is a C NULL pointer or if @var{c_ptr1} and @var{c_ptr_2}
|
1920 |
|
|
point to different addresses.
|
1921 |
|
|
|
1922 |
|
|
@item @emph{Example}:
|
1923 |
|
|
@smallexample
|
1924 |
|
|
subroutine association_test(a,b)
|
1925 |
|
|
use iso_c_binding, only: c_associated, c_loc, c_ptr
|
1926 |
|
|
implicit none
|
1927 |
|
|
real, pointer :: a
|
1928 |
|
|
type(c_ptr) :: b
|
1929 |
|
|
if(c_associated(b, c_loc(a))) &
|
1930 |
|
|
stop 'b and a do not point to same target'
|
1931 |
|
|
end subroutine association_test
|
1932 |
|
|
@end smallexample
|
1933 |
|
|
|
1934 |
|
|
@item @emph{See also}:
|
1935 |
|
|
@ref{C_LOC}, @ref{C_FUNLOC}
|
1936 |
|
|
@end table
|
1937 |
|
|
|
1938 |
|
|
|
1939 |
|
|
@node C_FUNLOC
|
1940 |
|
|
@section @code{C_FUNLOC} --- Obtain the C address of a procedure
|
1941 |
|
|
@fnindex C_FUNLOC
|
1942 |
|
|
@cindex pointer, C address of procedures
|
1943 |
|
|
|
1944 |
|
|
@table @asis
|
1945 |
|
|
@item @emph{Description}:
|
1946 |
|
|
@code{C_FUNLOC(x)} determines the C address of the argument.
|
1947 |
|
|
|
1948 |
|
|
@item @emph{Standard}:
|
1949 |
|
|
Fortran 2003 and later
|
1950 |
|
|
|
1951 |
|
|
@item @emph{Class}:
|
1952 |
|
|
Inquiry function
|
1953 |
|
|
|
1954 |
|
|
@item @emph{Syntax}:
|
1955 |
|
|
@code{RESULT = C_FUNLOC(x)}
|
1956 |
|
|
|
1957 |
|
|
@item @emph{Arguments}:
|
1958 |
|
|
@multitable @columnfractions .15 .70
|
1959 |
|
|
@item @var{x} @tab Interoperable function or pointer to such function.
|
1960 |
|
|
@end multitable
|
1961 |
|
|
|
1962 |
|
|
@item @emph{Return value}:
|
1963 |
|
|
The return value is of type @code{C_FUNPTR} and contains the C address
|
1964 |
|
|
of the argument.
|
1965 |
|
|
|
1966 |
|
|
@item @emph{Example}:
|
1967 |
|
|
@smallexample
|
1968 |
|
|
module x
|
1969 |
|
|
use iso_c_binding
|
1970 |
|
|
implicit none
|
1971 |
|
|
contains
|
1972 |
|
|
subroutine sub(a) bind(c)
|
1973 |
|
|
real(c_float) :: a
|
1974 |
|
|
a = sqrt(a)+5.0
|
1975 |
|
|
end subroutine sub
|
1976 |
|
|
end module x
|
1977 |
|
|
program main
|
1978 |
|
|
use iso_c_binding
|
1979 |
|
|
use x
|
1980 |
|
|
implicit none
|
1981 |
|
|
interface
|
1982 |
|
|
subroutine my_routine(p) bind(c,name='myC_func')
|
1983 |
|
|
import :: c_funptr
|
1984 |
|
|
type(c_funptr), intent(in) :: p
|
1985 |
|
|
end subroutine
|
1986 |
|
|
end interface
|
1987 |
|
|
call my_routine(c_funloc(sub))
|
1988 |
|
|
end program main
|
1989 |
|
|
@end smallexample
|
1990 |
|
|
|
1991 |
|
|
@item @emph{See also}:
|
1992 |
|
|
@ref{C_ASSOCIATED}, @ref{C_LOC}, @ref{C_F_POINTER}, @ref{C_F_PROCPOINTER}
|
1993 |
|
|
@end table
|
1994 |
|
|
|
1995 |
|
|
|
1996 |
|
|
@node C_F_PROCPOINTER
|
1997 |
|
|
@section @code{C_F_PROCPOINTER} --- Convert C into Fortran procedure pointer
|
1998 |
|
|
@fnindex C_F_PROCPOINTER
|
1999 |
|
|
@cindex pointer, C address of pointers
|
2000 |
|
|
|
2001 |
|
|
@table @asis
|
2002 |
|
|
@item @emph{Description}:
|
2003 |
|
|
@code{C_F_PROCPOINTER(CPTR, FPTR)} Assign the target of the C function pointer
|
2004 |
|
|
@var{CPTR} to the Fortran procedure pointer @var{FPTR}.
|
2005 |
|
|
|
2006 |
|
|
@item @emph{Standard}:
|
2007 |
|
|
Fortran 2003 and later
|
2008 |
|
|
|
2009 |
|
|
@item @emph{Class}:
|
2010 |
|
|
Subroutine
|
2011 |
|
|
|
2012 |
|
|
@item @emph{Syntax}:
|
2013 |
|
|
@code{CALL C_F_PROCPOINTER(cptr, fptr)}
|
2014 |
|
|
|
2015 |
|
|
@item @emph{Arguments}:
|
2016 |
|
|
@multitable @columnfractions .15 .70
|
2017 |
|
|
@item @var{CPTR} @tab scalar of the type @code{C_FUNPTR}. It is
|
2018 |
|
|
@code{INTENT(IN)}.
|
2019 |
|
|
@item @var{FPTR} @tab procedure pointer interoperable with @var{cptr}. It is
|
2020 |
|
|
@code{INTENT(OUT)}.
|
2021 |
|
|
@end multitable
|
2022 |
|
|
|
2023 |
|
|
@item @emph{Example}:
|
2024 |
|
|
@smallexample
|
2025 |
|
|
program main
|
2026 |
|
|
use iso_c_binding
|
2027 |
|
|
implicit none
|
2028 |
|
|
abstract interface
|
2029 |
|
|
function func(a)
|
2030 |
|
|
import :: c_float
|
2031 |
|
|
real(c_float), intent(in) :: a
|
2032 |
|
|
real(c_float) :: func
|
2033 |
|
|
end function
|
2034 |
|
|
end interface
|
2035 |
|
|
interface
|
2036 |
|
|
function getIterFunc() bind(c,name="getIterFunc")
|
2037 |
|
|
import :: c_funptr
|
2038 |
|
|
type(c_funptr) :: getIterFunc
|
2039 |
|
|
end function
|
2040 |
|
|
end interface
|
2041 |
|
|
type(c_funptr) :: cfunptr
|
2042 |
|
|
procedure(func), pointer :: myFunc
|
2043 |
|
|
cfunptr = getIterFunc()
|
2044 |
|
|
call c_f_procpointer(cfunptr, myFunc)
|
2045 |
|
|
end program main
|
2046 |
|
|
@end smallexample
|
2047 |
|
|
|
2048 |
|
|
@item @emph{See also}:
|
2049 |
|
|
@ref{C_LOC}, @ref{C_F_POINTER}
|
2050 |
|
|
@end table
|
2051 |
|
|
|
2052 |
|
|
|
2053 |
|
|
@node C_F_POINTER
|
2054 |
|
|
@section @code{C_F_POINTER} --- Convert C into Fortran pointer
|
2055 |
|
|
@fnindex C_F_POINTER
|
2056 |
|
|
@cindex pointer, convert C to Fortran
|
2057 |
|
|
|
2058 |
|
|
@table @asis
|
2059 |
|
|
@item @emph{Description}:
|
2060 |
|
|
@code{C_F_POINTER(CPTR, FPTR[, SHAPE])} Assign the target the C pointer
|
2061 |
|
|
@var{CPTR} to the Fortran pointer @var{FPTR} and specify its
|
2062 |
|
|
shape.
|
2063 |
|
|
|
2064 |
|
|
@item @emph{Standard}:
|
2065 |
|
|
Fortran 2003 and later
|
2066 |
|
|
|
2067 |
|
|
@item @emph{Class}:
|
2068 |
|
|
Subroutine
|
2069 |
|
|
|
2070 |
|
|
@item @emph{Syntax}:
|
2071 |
|
|
@code{CALL C_F_POINTER(CPTR, FPTR[, SHAPE])}
|
2072 |
|
|
|
2073 |
|
|
@item @emph{Arguments}:
|
2074 |
|
|
@multitable @columnfractions .15 .70
|
2075 |
|
|
@item @var{CPTR} @tab scalar of the type @code{C_PTR}. It is
|
2076 |
|
|
@code{INTENT(IN)}.
|
2077 |
|
|
@item @var{FPTR} @tab pointer interoperable with @var{cptr}. It is
|
2078 |
|
|
@code{INTENT(OUT)}.
|
2079 |
|
|
@item @var{SHAPE} @tab (Optional) Rank-one array of type @code{INTEGER}
|
2080 |
|
|
with @code{INTENT(IN)}. It shall be present
|
2081 |
|
|
if and only if @var{fptr} is an array. The size
|
2082 |
|
|
must be equal to the rank of @var{fptr}.
|
2083 |
|
|
@end multitable
|
2084 |
|
|
|
2085 |
|
|
@item @emph{Example}:
|
2086 |
|
|
@smallexample
|
2087 |
|
|
program main
|
2088 |
|
|
use iso_c_binding
|
2089 |
|
|
implicit none
|
2090 |
|
|
interface
|
2091 |
|
|
subroutine my_routine(p) bind(c,name='myC_func')
|
2092 |
|
|
import :: c_ptr
|
2093 |
|
|
type(c_ptr), intent(out) :: p
|
2094 |
|
|
end subroutine
|
2095 |
|
|
end interface
|
2096 |
|
|
type(c_ptr) :: cptr
|
2097 |
|
|
real,pointer :: a(:)
|
2098 |
|
|
call my_routine(cptr)
|
2099 |
|
|
call c_f_pointer(cptr, a, [12])
|
2100 |
|
|
end program main
|
2101 |
|
|
@end smallexample
|
2102 |
|
|
|
2103 |
|
|
@item @emph{See also}:
|
2104 |
|
|
@ref{C_LOC}, @ref{C_F_PROCPOINTER}
|
2105 |
|
|
@end table
|
2106 |
|
|
|
2107 |
|
|
|
2108 |
|
|
@node C_LOC
|
2109 |
|
|
@section @code{C_LOC} --- Obtain the C address of an object
|
2110 |
|
|
@fnindex C_LOC
|
2111 |
|
|
@cindex procedure pointer, convert C to Fortran
|
2112 |
|
|
|
2113 |
|
|
@table @asis
|
2114 |
|
|
@item @emph{Description}:
|
2115 |
|
|
@code{C_LOC(X)} determines the C address of the argument.
|
2116 |
|
|
|
2117 |
|
|
@item @emph{Standard}:
|
2118 |
|
|
Fortran 2003 and later
|
2119 |
|
|
|
2120 |
|
|
@item @emph{Class}:
|
2121 |
|
|
Inquiry function
|
2122 |
|
|
|
2123 |
|
|
@item @emph{Syntax}:
|
2124 |
|
|
@code{RESULT = C_LOC(X)}
|
2125 |
|
|
|
2126 |
|
|
@item @emph{Arguments}:
|
2127 |
|
|
@multitable @columnfractions .15 .70
|
2128 |
|
|
@item @var{X} @tab Associated scalar pointer or interoperable scalar
|
2129 |
|
|
or allocated allocatable variable with @code{TARGET} attribute.
|
2130 |
|
|
@end multitable
|
2131 |
|
|
|
2132 |
|
|
@item @emph{Return value}:
|
2133 |
|
|
The return value is of type @code{C_PTR} and contains the C address
|
2134 |
|
|
of the argument.
|
2135 |
|
|
|
2136 |
|
|
@item @emph{Example}:
|
2137 |
|
|
@smallexample
|
2138 |
|
|
subroutine association_test(a,b)
|
2139 |
|
|
use iso_c_binding, only: c_associated, c_loc, c_ptr
|
2140 |
|
|
implicit none
|
2141 |
|
|
real, pointer :: a
|
2142 |
|
|
type(c_ptr) :: b
|
2143 |
|
|
if(c_associated(b, c_loc(a))) &
|
2144 |
|
|
stop 'b and a do not point to same target'
|
2145 |
|
|
end subroutine association_test
|
2146 |
|
|
@end smallexample
|
2147 |
|
|
|
2148 |
|
|
@item @emph{See also}:
|
2149 |
|
|
@ref{C_ASSOCIATED}, @ref{C_FUNLOC}, @ref{C_F_POINTER}, @ref{C_F_PROCPOINTER}
|
2150 |
|
|
@end table
|
2151 |
|
|
|
2152 |
|
|
|
2153 |
|
|
@node C_SIZEOF
|
2154 |
|
|
@section @code{C_SIZEOF} --- Size in bytes of an expression
|
2155 |
|
|
@fnindex C_SIZEOF
|
2156 |
|
|
@cindex expression size
|
2157 |
|
|
@cindex size of an expression
|
2158 |
|
|
|
2159 |
|
|
@table @asis
|
2160 |
|
|
@item @emph{Description}:
|
2161 |
|
|
@code{C_SIZEOF(X)} calculates the number of bytes of storage the
|
2162 |
|
|
expression @code{X} occupies.
|
2163 |
|
|
|
2164 |
|
|
@item @emph{Standard}:
|
2165 |
|
|
Fortran 2008
|
2166 |
|
|
|
2167 |
|
|
@item @emph{Class}:
|
2168 |
|
|
Intrinsic function
|
2169 |
|
|
|
2170 |
|
|
@item @emph{Syntax}:
|
2171 |
|
|
@code{N = C_SIZEOF(X)}
|
2172 |
|
|
|
2173 |
|
|
@item @emph{Arguments}:
|
2174 |
|
|
@multitable @columnfractions .15 .70
|
2175 |
|
|
@item @var{X} @tab The argument shall be of any type, rank or shape.
|
2176 |
|
|
@end multitable
|
2177 |
|
|
|
2178 |
|
|
@item @emph{Return value}:
|
2179 |
|
|
The return value is of type integer and of the system-dependent kind
|
2180 |
|
|
@var{C_SIZE_T} (from the @var{ISO_C_BINDING} module). Its value is the
|
2181 |
|
|
number of bytes occupied by the argument. If the argument has the
|
2182 |
|
|
@code{POINTER} attribute, the number of bytes of the storage area pointed
|
2183 |
|
|
to is returned. If the argument is of a derived type with @code{POINTER}
|
2184 |
|
|
or @code{ALLOCATABLE} components, the return value doesn't account for
|
2185 |
|
|
the sizes of the data pointed to by these components.
|
2186 |
|
|
|
2187 |
|
|
@item @emph{Example}:
|
2188 |
|
|
@smallexample
|
2189 |
|
|
use iso_c_binding
|
2190 |
|
|
integer(c_int) :: i
|
2191 |
|
|
real(c_float) :: r, s(5)
|
2192 |
|
|
print *, (c_sizeof(s)/c_sizeof(r) == 5)
|
2193 |
|
|
end
|
2194 |
|
|
@end smallexample
|
2195 |
|
|
The example will print @code{.TRUE.} unless you are using a platform
|
2196 |
|
|
where default @code{REAL} variables are unusually padded.
|
2197 |
|
|
|
2198 |
|
|
@item @emph{See also}:
|
2199 |
|
|
@ref{SIZEOF}
|
2200 |
|
|
@end table
|
2201 |
|
|
|
2202 |
|
|
|
2203 |
|
|
@node CEILING
|
2204 |
|
|
@section @code{CEILING} --- Integer ceiling function
|
2205 |
|
|
@fnindex CEILING
|
2206 |
|
|
@cindex ceiling
|
2207 |
|
|
@cindex rounding, ceiling
|
2208 |
|
|
|
2209 |
|
|
@table @asis
|
2210 |
|
|
@item @emph{Description}:
|
2211 |
|
|
@code{CEILING(A)} returns the least integer greater than or equal to @var{A}.
|
2212 |
|
|
|
2213 |
|
|
@item @emph{Standard}:
|
2214 |
|
|
Fortran 95 and later
|
2215 |
|
|
|
2216 |
|
|
@item @emph{Class}:
|
2217 |
|
|
Elemental function
|
2218 |
|
|
|
2219 |
|
|
@item @emph{Syntax}:
|
2220 |
|
|
@code{RESULT = CEILING(A [, KIND])}
|
2221 |
|
|
|
2222 |
|
|
@item @emph{Arguments}:
|
2223 |
|
|
@multitable @columnfractions .15 .70
|
2224 |
|
|
@item @var{A} @tab The type shall be @code{REAL}.
|
2225 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
2226 |
|
|
expression indicating the kind parameter of the result.
|
2227 |
|
|
@end multitable
|
2228 |
|
|
|
2229 |
|
|
@item @emph{Return value}:
|
2230 |
|
|
The return value is of type @code{INTEGER(KIND)} if @var{KIND} is present
|
2231 |
|
|
and a default-kind @code{INTEGER} otherwise.
|
2232 |
|
|
|
2233 |
|
|
@item @emph{Example}:
|
2234 |
|
|
@smallexample
|
2235 |
|
|
program test_ceiling
|
2236 |
|
|
real :: x = 63.29
|
2237 |
|
|
real :: y = -63.59
|
2238 |
|
|
print *, ceiling(x) ! returns 64
|
2239 |
|
|
print *, ceiling(y) ! returns -63
|
2240 |
|
|
end program test_ceiling
|
2241 |
|
|
@end smallexample
|
2242 |
|
|
|
2243 |
|
|
@item @emph{See also}:
|
2244 |
|
|
@ref{FLOOR}, @ref{NINT}
|
2245 |
|
|
|
2246 |
|
|
@end table
|
2247 |
|
|
|
2248 |
|
|
|
2249 |
|
|
|
2250 |
|
|
@node CHAR
|
2251 |
|
|
@section @code{CHAR} --- Character conversion function
|
2252 |
|
|
@fnindex CHAR
|
2253 |
|
|
@cindex conversion, to character
|
2254 |
|
|
|
2255 |
|
|
@table @asis
|
2256 |
|
|
@item @emph{Description}:
|
2257 |
|
|
@code{CHAR(I [, KIND])} returns the character represented by the integer @var{I}.
|
2258 |
|
|
|
2259 |
|
|
@item @emph{Standard}:
|
2260 |
|
|
Fortran 77 and later
|
2261 |
|
|
|
2262 |
|
|
@item @emph{Class}:
|
2263 |
|
|
Elemental function
|
2264 |
|
|
|
2265 |
|
|
@item @emph{Syntax}:
|
2266 |
|
|
@code{RESULT = CHAR(I [, KIND])}
|
2267 |
|
|
|
2268 |
|
|
@item @emph{Arguments}:
|
2269 |
|
|
@multitable @columnfractions .15 .70
|
2270 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
2271 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
2272 |
|
|
expression indicating the kind parameter of the result.
|
2273 |
|
|
@end multitable
|
2274 |
|
|
|
2275 |
|
|
@item @emph{Return value}:
|
2276 |
|
|
The return value is of type @code{CHARACTER(1)}
|
2277 |
|
|
|
2278 |
|
|
@item @emph{Example}:
|
2279 |
|
|
@smallexample
|
2280 |
|
|
program test_char
|
2281 |
|
|
integer :: i = 74
|
2282 |
|
|
character(1) :: c
|
2283 |
|
|
c = char(i)
|
2284 |
|
|
print *, i, c ! returns 'J'
|
2285 |
|
|
end program test_char
|
2286 |
|
|
@end smallexample
|
2287 |
|
|
|
2288 |
|
|
@item @emph{Note}:
|
2289 |
|
|
See @ref{ICHAR} for a discussion of converting between numerical values
|
2290 |
|
|
and formatted string representations.
|
2291 |
|
|
|
2292 |
|
|
@item @emph{See also}:
|
2293 |
|
|
@ref{ACHAR}, @ref{IACHAR}, @ref{ICHAR}
|
2294 |
|
|
|
2295 |
|
|
@end table
|
2296 |
|
|
|
2297 |
|
|
|
2298 |
|
|
|
2299 |
|
|
@node CHDIR
|
2300 |
|
|
@section @code{CHDIR} --- Change working directory
|
2301 |
|
|
@fnindex CHDIR
|
2302 |
|
|
@cindex system, working directory
|
2303 |
|
|
|
2304 |
|
|
@table @asis
|
2305 |
|
|
@item @emph{Description}:
|
2306 |
|
|
Change current working directory to a specified path.
|
2307 |
|
|
|
2308 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
2309 |
|
|
only one form can be used in any given program unit.
|
2310 |
|
|
|
2311 |
|
|
@item @emph{Standard}:
|
2312 |
|
|
GNU extension
|
2313 |
|
|
|
2314 |
|
|
@item @emph{Class}:
|
2315 |
|
|
Subroutine, function
|
2316 |
|
|
|
2317 |
|
|
@item @emph{Syntax}:
|
2318 |
|
|
@multitable @columnfractions .80
|
2319 |
|
|
@item @code{CALL CHDIR(NAME [, STATUS])}
|
2320 |
|
|
@item @code{STATUS = CHDIR(NAME)}
|
2321 |
|
|
@end multitable
|
2322 |
|
|
|
2323 |
|
|
@item @emph{Arguments}:
|
2324 |
|
|
@multitable @columnfractions .15 .70
|
2325 |
|
|
@item @var{NAME} @tab The type shall be @code{CHARACTER} of default
|
2326 |
|
|
kind and shall specify a valid path within the file system.
|
2327 |
|
|
@item @var{STATUS} @tab (Optional) @code{INTEGER} status flag of the default
|
2328 |
|
|
kind. Returns 0 on success, and a system specific and nonzero error code
|
2329 |
|
|
otherwise.
|
2330 |
|
|
@end multitable
|
2331 |
|
|
|
2332 |
|
|
@item @emph{Example}:
|
2333 |
|
|
@smallexample
|
2334 |
|
|
PROGRAM test_chdir
|
2335 |
|
|
CHARACTER(len=255) :: path
|
2336 |
|
|
CALL getcwd(path)
|
2337 |
|
|
WRITE(*,*) TRIM(path)
|
2338 |
|
|
CALL chdir("/tmp")
|
2339 |
|
|
CALL getcwd(path)
|
2340 |
|
|
WRITE(*,*) TRIM(path)
|
2341 |
|
|
END PROGRAM
|
2342 |
|
|
@end smallexample
|
2343 |
|
|
|
2344 |
|
|
@item @emph{See also}:
|
2345 |
|
|
@ref{GETCWD}
|
2346 |
|
|
@end table
|
2347 |
|
|
|
2348 |
|
|
|
2349 |
|
|
|
2350 |
|
|
@node CHMOD
|
2351 |
|
|
@section @code{CHMOD} --- Change access permissions of files
|
2352 |
|
|
@fnindex CHMOD
|
2353 |
|
|
@cindex file system, change access mode
|
2354 |
|
|
|
2355 |
|
|
@table @asis
|
2356 |
|
|
@item @emph{Description}:
|
2357 |
|
|
@code{CHMOD} changes the permissions of a file. This function invokes
|
2358 |
|
|
@code{/bin/chmod} and might therefore not work on all platforms.
|
2359 |
|
|
|
2360 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
2361 |
|
|
only one form can be used in any given program unit.
|
2362 |
|
|
|
2363 |
|
|
@item @emph{Standard}:
|
2364 |
|
|
GNU extension
|
2365 |
|
|
|
2366 |
|
|
@item @emph{Class}:
|
2367 |
|
|
Subroutine, function
|
2368 |
|
|
|
2369 |
|
|
@item @emph{Syntax}:
|
2370 |
|
|
@multitable @columnfractions .80
|
2371 |
|
|
@item @code{CALL CHMOD(NAME, MODE[, STATUS])}
|
2372 |
|
|
@item @code{STATUS = CHMOD(NAME, MODE)}
|
2373 |
|
|
@end multitable
|
2374 |
|
|
|
2375 |
|
|
@item @emph{Arguments}:
|
2376 |
|
|
@multitable @columnfractions .15 .70
|
2377 |
|
|
|
2378 |
|
|
@item @var{NAME} @tab Scalar @code{CHARACTER} of default kind with the
|
2379 |
|
|
file name. Trailing blanks are ignored unless the character
|
2380 |
|
|
@code{achar(0)} is present, then all characters up to and excluding
|
2381 |
|
|
@code{achar(0)} are used as the file name.
|
2382 |
|
|
|
2383 |
|
|
@item @var{MODE} @tab Scalar @code{CHARACTER} of default kind giving the
|
2384 |
|
|
file permission. @var{MODE} uses the same syntax as the @var{MODE}
|
2385 |
|
|
argument of @code{/bin/chmod}.
|
2386 |
|
|
|
2387 |
|
|
@item @var{STATUS} @tab (optional) scalar @code{INTEGER}, which is
|
2388 |
|
|
@code{0} on success and nonzero otherwise.
|
2389 |
|
|
@end multitable
|
2390 |
|
|
|
2391 |
|
|
@item @emph{Return value}:
|
2392 |
|
|
In either syntax, @var{STATUS} is set to @code{0} on success and nonzero
|
2393 |
|
|
otherwise.
|
2394 |
|
|
|
2395 |
|
|
@item @emph{Example}:
|
2396 |
|
|
@code{CHMOD} as subroutine
|
2397 |
|
|
@smallexample
|
2398 |
|
|
program chmod_test
|
2399 |
|
|
implicit none
|
2400 |
|
|
integer :: status
|
2401 |
|
|
call chmod('test.dat','u+x',status)
|
2402 |
|
|
print *, 'Status: ', status
|
2403 |
|
|
end program chmod_test
|
2404 |
|
|
@end smallexample
|
2405 |
|
|
@code{CHMOD} as function:
|
2406 |
|
|
@smallexample
|
2407 |
|
|
program chmod_test
|
2408 |
|
|
implicit none
|
2409 |
|
|
integer :: status
|
2410 |
|
|
status = chmod('test.dat','u+x')
|
2411 |
|
|
print *, 'Status: ', status
|
2412 |
|
|
end program chmod_test
|
2413 |
|
|
@end smallexample
|
2414 |
|
|
|
2415 |
|
|
@end table
|
2416 |
|
|
|
2417 |
|
|
|
2418 |
|
|
|
2419 |
|
|
@node CMPLX
|
2420 |
|
|
@section @code{CMPLX} --- Complex conversion function
|
2421 |
|
|
@fnindex CMPLX
|
2422 |
|
|
@cindex complex numbers, conversion to
|
2423 |
|
|
@cindex conversion, to complex
|
2424 |
|
|
|
2425 |
|
|
@table @asis
|
2426 |
|
|
@item @emph{Description}:
|
2427 |
|
|
@code{CMPLX(X [, Y [, KIND]])} returns a complex number where @var{X} is converted to
|
2428 |
|
|
the real component. If @var{Y} is present it is converted to the imaginary
|
2429 |
|
|
component. If @var{Y} is not present then the imaginary component is set to
|
2430 |
|
|
0.0. If @var{X} is complex then @var{Y} must not be present.
|
2431 |
|
|
|
2432 |
|
|
@item @emph{Standard}:
|
2433 |
|
|
Fortran 77 and later
|
2434 |
|
|
|
2435 |
|
|
@item @emph{Class}:
|
2436 |
|
|
Elemental function
|
2437 |
|
|
|
2438 |
|
|
@item @emph{Syntax}:
|
2439 |
|
|
@code{RESULT = CMPLX(X [, Y [, KIND]])}
|
2440 |
|
|
|
2441 |
|
|
@item @emph{Arguments}:
|
2442 |
|
|
@multitable @columnfractions .15 .70
|
2443 |
|
|
@item @var{X} @tab The type may be @code{INTEGER}, @code{REAL},
|
2444 |
|
|
or @code{COMPLEX}.
|
2445 |
|
|
@item @var{Y} @tab (Optional; only allowed if @var{X} is not
|
2446 |
|
|
@code{COMPLEX}.) May be @code{INTEGER} or @code{REAL}.
|
2447 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
2448 |
|
|
expression indicating the kind parameter of the result.
|
2449 |
|
|
@end multitable
|
2450 |
|
|
|
2451 |
|
|
@item @emph{Return value}:
|
2452 |
|
|
The return value is of @code{COMPLEX} type, with a kind equal to
|
2453 |
|
|
@var{KIND} if it is specified. If @var{KIND} is not specified, the
|
2454 |
|
|
result is of the default @code{COMPLEX} kind, regardless of the kinds of
|
2455 |
|
|
@var{X} and @var{Y}.
|
2456 |
|
|
|
2457 |
|
|
@item @emph{Example}:
|
2458 |
|
|
@smallexample
|
2459 |
|
|
program test_cmplx
|
2460 |
|
|
integer :: i = 42
|
2461 |
|
|
real :: x = 3.14
|
2462 |
|
|
complex :: z
|
2463 |
|
|
z = cmplx(i, x)
|
2464 |
|
|
print *, z, cmplx(x)
|
2465 |
|
|
end program test_cmplx
|
2466 |
|
|
@end smallexample
|
2467 |
|
|
|
2468 |
|
|
@item @emph{See also}:
|
2469 |
|
|
@ref{COMPLEX}
|
2470 |
|
|
@end table
|
2471 |
|
|
|
2472 |
|
|
|
2473 |
|
|
|
2474 |
|
|
@node COMMAND_ARGUMENT_COUNT
|
2475 |
|
|
@section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
|
2476 |
|
|
@fnindex COMMAND_ARGUMENT_COUNT
|
2477 |
|
|
@cindex command-line arguments
|
2478 |
|
|
@cindex command-line arguments, number of
|
2479 |
|
|
@cindex arguments, to program
|
2480 |
|
|
|
2481 |
|
|
@table @asis
|
2482 |
|
|
@item @emph{Description}:
|
2483 |
|
|
@code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
|
2484 |
|
|
command line when the containing program was invoked.
|
2485 |
|
|
|
2486 |
|
|
@item @emph{Standard}:
|
2487 |
|
|
Fortran 2003 and later
|
2488 |
|
|
|
2489 |
|
|
@item @emph{Class}:
|
2490 |
|
|
Inquiry function
|
2491 |
|
|
|
2492 |
|
|
@item @emph{Syntax}:
|
2493 |
|
|
@code{RESULT = COMMAND_ARGUMENT_COUNT()}
|
2494 |
|
|
|
2495 |
|
|
@item @emph{Arguments}:
|
2496 |
|
|
@multitable @columnfractions .15 .70
|
2497 |
|
|
@item None
|
2498 |
|
|
@end multitable
|
2499 |
|
|
|
2500 |
|
|
@item @emph{Return value}:
|
2501 |
|
|
The return value is an @code{INTEGER} of default kind.
|
2502 |
|
|
|
2503 |
|
|
@item @emph{Example}:
|
2504 |
|
|
@smallexample
|
2505 |
|
|
program test_command_argument_count
|
2506 |
|
|
integer :: count
|
2507 |
|
|
count = command_argument_count()
|
2508 |
|
|
print *, count
|
2509 |
|
|
end program test_command_argument_count
|
2510 |
|
|
@end smallexample
|
2511 |
|
|
|
2512 |
|
|
@item @emph{See also}:
|
2513 |
|
|
@ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
|
2514 |
|
|
@end table
|
2515 |
|
|
|
2516 |
|
|
|
2517 |
|
|
|
2518 |
|
|
@node COMPLEX
|
2519 |
|
|
@section @code{COMPLEX} --- Complex conversion function
|
2520 |
|
|
@fnindex COMPLEX
|
2521 |
|
|
@cindex complex numbers, conversion to
|
2522 |
|
|
@cindex conversion, to complex
|
2523 |
|
|
|
2524 |
|
|
@table @asis
|
2525 |
|
|
@item @emph{Description}:
|
2526 |
|
|
@code{COMPLEX(X, Y)} returns a complex number where @var{X} is converted
|
2527 |
|
|
to the real component and @var{Y} is converted to the imaginary
|
2528 |
|
|
component.
|
2529 |
|
|
|
2530 |
|
|
@item @emph{Standard}:
|
2531 |
|
|
GNU extension
|
2532 |
|
|
|
2533 |
|
|
@item @emph{Class}:
|
2534 |
|
|
Elemental function
|
2535 |
|
|
|
2536 |
|
|
@item @emph{Syntax}:
|
2537 |
|
|
@code{RESULT = COMPLEX(X, Y)}
|
2538 |
|
|
|
2539 |
|
|
@item @emph{Arguments}:
|
2540 |
|
|
@multitable @columnfractions .15 .70
|
2541 |
|
|
@item @var{X} @tab The type may be @code{INTEGER} or @code{REAL}.
|
2542 |
|
|
@item @var{Y} @tab The type may be @code{INTEGER} or @code{REAL}.
|
2543 |
|
|
@end multitable
|
2544 |
|
|
|
2545 |
|
|
@item @emph{Return value}:
|
2546 |
|
|
If @var{X} and @var{Y} are both of @code{INTEGER} type, then the return
|
2547 |
|
|
value is of default @code{COMPLEX} type.
|
2548 |
|
|
|
2549 |
|
|
If @var{X} and @var{Y} are of @code{REAL} type, or one is of @code{REAL}
|
2550 |
|
|
type and one is of @code{INTEGER} type, then the return value is of
|
2551 |
|
|
@code{COMPLEX} type with a kind equal to that of the @code{REAL}
|
2552 |
|
|
argument with the highest precision.
|
2553 |
|
|
|
2554 |
|
|
@item @emph{Example}:
|
2555 |
|
|
@smallexample
|
2556 |
|
|
program test_complex
|
2557 |
|
|
integer :: i = 42
|
2558 |
|
|
real :: x = 3.14
|
2559 |
|
|
print *, complex(i, x)
|
2560 |
|
|
end program test_complex
|
2561 |
|
|
@end smallexample
|
2562 |
|
|
|
2563 |
|
|
@item @emph{See also}:
|
2564 |
|
|
@ref{CMPLX}
|
2565 |
|
|
@end table
|
2566 |
|
|
|
2567 |
|
|
|
2568 |
|
|
|
2569 |
|
|
@node CONJG
|
2570 |
|
|
@section @code{CONJG} --- Complex conjugate function
|
2571 |
|
|
@fnindex CONJG
|
2572 |
|
|
@fnindex DCONJG
|
2573 |
|
|
@cindex complex conjugate
|
2574 |
|
|
|
2575 |
|
|
@table @asis
|
2576 |
|
|
@item @emph{Description}:
|
2577 |
|
|
@code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
|
2578 |
|
|
then the result is @code{(x, -y)}
|
2579 |
|
|
|
2580 |
|
|
@item @emph{Standard}:
|
2581 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
2582 |
|
|
|
2583 |
|
|
@item @emph{Class}:
|
2584 |
|
|
Elemental function
|
2585 |
|
|
|
2586 |
|
|
@item @emph{Syntax}:
|
2587 |
|
|
@code{Z = CONJG(Z)}
|
2588 |
|
|
|
2589 |
|
|
@item @emph{Arguments}:
|
2590 |
|
|
@multitable @columnfractions .15 .70
|
2591 |
|
|
@item @var{Z} @tab The type shall be @code{COMPLEX}.
|
2592 |
|
|
@end multitable
|
2593 |
|
|
|
2594 |
|
|
@item @emph{Return value}:
|
2595 |
|
|
The return value is of type @code{COMPLEX}.
|
2596 |
|
|
|
2597 |
|
|
@item @emph{Example}:
|
2598 |
|
|
@smallexample
|
2599 |
|
|
program test_conjg
|
2600 |
|
|
complex :: z = (2.0, 3.0)
|
2601 |
|
|
complex(8) :: dz = (2.71_8, -3.14_8)
|
2602 |
|
|
z= conjg(z)
|
2603 |
|
|
print *, z
|
2604 |
|
|
dz = dconjg(dz)
|
2605 |
|
|
print *, dz
|
2606 |
|
|
end program test_conjg
|
2607 |
|
|
@end smallexample
|
2608 |
|
|
|
2609 |
|
|
@item @emph{Specific names}:
|
2610 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
2611 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
2612 |
|
|
@item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
|
2613 |
|
|
@end multitable
|
2614 |
|
|
@end table
|
2615 |
|
|
|
2616 |
|
|
|
2617 |
|
|
|
2618 |
|
|
@node COS
|
2619 |
|
|
@section @code{COS} --- Cosine function
|
2620 |
|
|
@fnindex COS
|
2621 |
|
|
@fnindex DCOS
|
2622 |
|
|
@fnindex CCOS
|
2623 |
|
|
@fnindex ZCOS
|
2624 |
|
|
@fnindex CDCOS
|
2625 |
|
|
@cindex trigonometric function, cosine
|
2626 |
|
|
@cindex cosine
|
2627 |
|
|
|
2628 |
|
|
@table @asis
|
2629 |
|
|
@item @emph{Description}:
|
2630 |
|
|
@code{COS(X)} computes the cosine of @var{X}.
|
2631 |
|
|
|
2632 |
|
|
@item @emph{Standard}:
|
2633 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
2634 |
|
|
|
2635 |
|
|
@item @emph{Class}:
|
2636 |
|
|
Elemental function
|
2637 |
|
|
|
2638 |
|
|
@item @emph{Syntax}:
|
2639 |
|
|
@code{RESULT = COS(X)}
|
2640 |
|
|
|
2641 |
|
|
@item @emph{Arguments}:
|
2642 |
|
|
@multitable @columnfractions .15 .70
|
2643 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or
|
2644 |
|
|
@code{COMPLEX}.
|
2645 |
|
|
@end multitable
|
2646 |
|
|
|
2647 |
|
|
@item @emph{Return value}:
|
2648 |
|
|
The return value is of the same type and kind as @var{X}. The real part
|
2649 |
|
|
of the result is in radians. If @var{X} is of the type @code{REAL},
|
2650 |
|
|
the return value lies in the range @math{ -1 \leq \cos (x) \leq 1}.
|
2651 |
|
|
|
2652 |
|
|
@item @emph{Example}:
|
2653 |
|
|
@smallexample
|
2654 |
|
|
program test_cos
|
2655 |
|
|
real :: x = 0.0
|
2656 |
|
|
x = cos(x)
|
2657 |
|
|
end program test_cos
|
2658 |
|
|
@end smallexample
|
2659 |
|
|
|
2660 |
|
|
@item @emph{Specific names}:
|
2661 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
2662 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
2663 |
|
|
@item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
2664 |
|
|
@item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab Fortran 77 and later
|
2665 |
|
|
@item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
|
2666 |
|
|
@item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
|
2667 |
|
|
@end multitable
|
2668 |
|
|
|
2669 |
|
|
@item @emph{See also}:
|
2670 |
|
|
Inverse function: @ref{ACOS}
|
2671 |
|
|
|
2672 |
|
|
@end table
|
2673 |
|
|
|
2674 |
|
|
|
2675 |
|
|
|
2676 |
|
|
@node COSH
|
2677 |
|
|
@section @code{COSH} --- Hyperbolic cosine function
|
2678 |
|
|
@fnindex COSH
|
2679 |
|
|
@fnindex DCOSH
|
2680 |
|
|
@cindex hyperbolic cosine
|
2681 |
|
|
@cindex hyperbolic function, cosine
|
2682 |
|
|
@cindex cosine, hyperbolic
|
2683 |
|
|
|
2684 |
|
|
@table @asis
|
2685 |
|
|
@item @emph{Description}:
|
2686 |
|
|
@code{COSH(X)} computes the hyperbolic cosine of @var{X}.
|
2687 |
|
|
|
2688 |
|
|
@item @emph{Standard}:
|
2689 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
2690 |
|
|
|
2691 |
|
|
@item @emph{Class}:
|
2692 |
|
|
Elemental function
|
2693 |
|
|
|
2694 |
|
|
@item @emph{Syntax}:
|
2695 |
|
|
@code{X = COSH(X)}
|
2696 |
|
|
|
2697 |
|
|
@item @emph{Arguments}:
|
2698 |
|
|
@multitable @columnfractions .15 .70
|
2699 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
2700 |
|
|
@end multitable
|
2701 |
|
|
|
2702 |
|
|
@item @emph{Return value}:
|
2703 |
|
|
The return value has same type and kind as @var{X}. If @var{X} is
|
2704 |
|
|
complex, the imaginary part of the result is in radians. If @var{X}
|
2705 |
|
|
is @code{REAL}, the return value has a lower bound of one,
|
2706 |
|
|
@math{\cosh (x) \geq 1}.
|
2707 |
|
|
|
2708 |
|
|
@item @emph{Example}:
|
2709 |
|
|
@smallexample
|
2710 |
|
|
program test_cosh
|
2711 |
|
|
real(8) :: x = 1.0_8
|
2712 |
|
|
x = cosh(x)
|
2713 |
|
|
end program test_cosh
|
2714 |
|
|
@end smallexample
|
2715 |
|
|
|
2716 |
|
|
@item @emph{Specific names}:
|
2717 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
2718 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
2719 |
|
|
@item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
2720 |
|
|
@end multitable
|
2721 |
|
|
|
2722 |
|
|
@item @emph{See also}:
|
2723 |
|
|
Inverse function: @ref{ACOSH}
|
2724 |
|
|
|
2725 |
|
|
@end table
|
2726 |
|
|
|
2727 |
|
|
|
2728 |
|
|
|
2729 |
|
|
@node COUNT
|
2730 |
|
|
@section @code{COUNT} --- Count function
|
2731 |
|
|
@fnindex COUNT
|
2732 |
|
|
@cindex array, conditionally count elements
|
2733 |
|
|
@cindex array, element counting
|
2734 |
|
|
@cindex array, number of elements
|
2735 |
|
|
|
2736 |
|
|
@table @asis
|
2737 |
|
|
@item @emph{Description}:
|
2738 |
|
|
|
2739 |
|
|
Counts the number of @code{.TRUE.} elements in a logical @var{MASK},
|
2740 |
|
|
or, if the @var{DIM} argument is supplied, counts the number of
|
2741 |
|
|
elements along each row of the array in the @var{DIM} direction.
|
2742 |
|
|
If the array has zero size, or all of the elements of @var{MASK} are
|
2743 |
|
|
@code{.FALSE.}, then the result is @code{0}.
|
2744 |
|
|
|
2745 |
|
|
@item @emph{Standard}:
|
2746 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
2747 |
|
|
|
2748 |
|
|
@item @emph{Class}:
|
2749 |
|
|
Transformational function
|
2750 |
|
|
|
2751 |
|
|
@item @emph{Syntax}:
|
2752 |
|
|
@code{RESULT = COUNT(MASK [, DIM, KIND])}
|
2753 |
|
|
|
2754 |
|
|
@item @emph{Arguments}:
|
2755 |
|
|
@multitable @columnfractions .15 .70
|
2756 |
|
|
@item @var{MASK} @tab The type shall be @code{LOGICAL}.
|
2757 |
|
|
@item @var{DIM} @tab (Optional) The type shall be @code{INTEGER}.
|
2758 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
2759 |
|
|
expression indicating the kind parameter of the result.
|
2760 |
|
|
@end multitable
|
2761 |
|
|
|
2762 |
|
|
@item @emph{Return value}:
|
2763 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
2764 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
2765 |
|
|
If @var{DIM} is present, the result is an array with a rank one less
|
2766 |
|
|
than the rank of @var{ARRAY}, and a size corresponding to the shape
|
2767 |
|
|
of @var{ARRAY} with the @var{DIM} dimension removed.
|
2768 |
|
|
|
2769 |
|
|
@item @emph{Example}:
|
2770 |
|
|
@smallexample
|
2771 |
|
|
program test_count
|
2772 |
|
|
integer, dimension(2,3) :: a, b
|
2773 |
|
|
logical, dimension(2,3) :: mask
|
2774 |
|
|
a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
|
2775 |
|
|
b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
|
2776 |
|
|
print '(3i3)', a(1,:)
|
2777 |
|
|
print '(3i3)', a(2,:)
|
2778 |
|
|
print *
|
2779 |
|
|
print '(3i3)', b(1,:)
|
2780 |
|
|
print '(3i3)', b(2,:)
|
2781 |
|
|
print *
|
2782 |
|
|
mask = a.ne.b
|
2783 |
|
|
print '(3l3)', mask(1,:)
|
2784 |
|
|
print '(3l3)', mask(2,:)
|
2785 |
|
|
print *
|
2786 |
|
|
print '(3i3)', count(mask)
|
2787 |
|
|
print *
|
2788 |
|
|
print '(3i3)', count(mask, 1)
|
2789 |
|
|
print *
|
2790 |
|
|
print '(3i3)', count(mask, 2)
|
2791 |
|
|
end program test_count
|
2792 |
|
|
@end smallexample
|
2793 |
|
|
@end table
|
2794 |
|
|
|
2795 |
|
|
|
2796 |
|
|
|
2797 |
|
|
@node CPU_TIME
|
2798 |
|
|
@section @code{CPU_TIME} --- CPU elapsed time in seconds
|
2799 |
|
|
@fnindex CPU_TIME
|
2800 |
|
|
@cindex time, elapsed
|
2801 |
|
|
|
2802 |
|
|
@table @asis
|
2803 |
|
|
@item @emph{Description}:
|
2804 |
|
|
Returns a @code{REAL} value representing the elapsed CPU time in
|
2805 |
|
|
seconds. This is useful for testing segments of code to determine
|
2806 |
|
|
execution time.
|
2807 |
|
|
|
2808 |
|
|
If a time source is available, time will be reported with microsecond
|
2809 |
|
|
resolution. If no time source is available, @var{TIME} is set to
|
2810 |
|
|
@code{-1.0}.
|
2811 |
|
|
|
2812 |
|
|
Note that @var{TIME} may contain a, system dependent, arbitrary offset
|
2813 |
|
|
and may not start with @code{0.0}. For @code{CPU_TIME}, the absolute
|
2814 |
|
|
value is meaningless, only differences between subsequent calls to
|
2815 |
|
|
this subroutine, as shown in the example below, should be used.
|
2816 |
|
|
|
2817 |
|
|
|
2818 |
|
|
@item @emph{Standard}:
|
2819 |
|
|
Fortran 95 and later
|
2820 |
|
|
|
2821 |
|
|
@item @emph{Class}:
|
2822 |
|
|
Subroutine
|
2823 |
|
|
|
2824 |
|
|
@item @emph{Syntax}:
|
2825 |
|
|
@code{CALL CPU_TIME(TIME)}
|
2826 |
|
|
|
2827 |
|
|
@item @emph{Arguments}:
|
2828 |
|
|
@multitable @columnfractions .15 .70
|
2829 |
|
|
@item @var{TIME} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
|
2830 |
|
|
@end multitable
|
2831 |
|
|
|
2832 |
|
|
@item @emph{Return value}:
|
2833 |
|
|
None
|
2834 |
|
|
|
2835 |
|
|
@item @emph{Example}:
|
2836 |
|
|
@smallexample
|
2837 |
|
|
program test_cpu_time
|
2838 |
|
|
real :: start, finish
|
2839 |
|
|
call cpu_time(start)
|
2840 |
|
|
! put code to test here
|
2841 |
|
|
call cpu_time(finish)
|
2842 |
|
|
print '("Time = ",f6.3," seconds.")',finish-start
|
2843 |
|
|
end program test_cpu_time
|
2844 |
|
|
@end smallexample
|
2845 |
|
|
|
2846 |
|
|
@item @emph{See also}:
|
2847 |
|
|
@ref{SYSTEM_CLOCK}, @ref{DATE_AND_TIME}
|
2848 |
|
|
@end table
|
2849 |
|
|
|
2850 |
|
|
|
2851 |
|
|
|
2852 |
|
|
@node CSHIFT
|
2853 |
|
|
@section @code{CSHIFT} --- Circular shift elements of an array
|
2854 |
|
|
@fnindex CSHIFT
|
2855 |
|
|
@cindex array, shift circularly
|
2856 |
|
|
@cindex array, permutation
|
2857 |
|
|
@cindex array, rotate
|
2858 |
|
|
|
2859 |
|
|
@table @asis
|
2860 |
|
|
@item @emph{Description}:
|
2861 |
|
|
@code{CSHIFT(ARRAY, SHIFT [, DIM])} performs a circular shift on elements of
|
2862 |
|
|
@var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
|
2863 |
|
|
taken to be @code{1}. @var{DIM} is a scalar of type @code{INTEGER} in the
|
2864 |
|
|
range of @math{1 \leq DIM \leq n)} where @math{n} is the rank of @var{ARRAY}.
|
2865 |
|
|
If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
|
2866 |
|
|
by @var{SHIFT} places. If rank is greater than one, then all complete rank one
|
2867 |
|
|
sections of @var{ARRAY} along the given dimension are shifted. Elements
|
2868 |
|
|
shifted out one end of each rank one section are shifted back in the other end.
|
2869 |
|
|
|
2870 |
|
|
@item @emph{Standard}:
|
2871 |
|
|
Fortran 95 and later
|
2872 |
|
|
|
2873 |
|
|
@item @emph{Class}:
|
2874 |
|
|
Transformational function
|
2875 |
|
|
|
2876 |
|
|
@item @emph{Syntax}:
|
2877 |
|
|
@code{RESULT = CSHIFT(ARRAY, SHIFT [, DIM])}
|
2878 |
|
|
|
2879 |
|
|
@item @emph{Arguments}:
|
2880 |
|
|
@multitable @columnfractions .15 .70
|
2881 |
|
|
@item @var{ARRAY} @tab Shall be an array of any type.
|
2882 |
|
|
@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
|
2883 |
|
|
@item @var{DIM} @tab The type shall be @code{INTEGER}.
|
2884 |
|
|
@end multitable
|
2885 |
|
|
|
2886 |
|
|
@item @emph{Return value}:
|
2887 |
|
|
Returns an array of same type and rank as the @var{ARRAY} argument.
|
2888 |
|
|
|
2889 |
|
|
@item @emph{Example}:
|
2890 |
|
|
@smallexample
|
2891 |
|
|
program test_cshift
|
2892 |
|
|
integer, dimension(3,3) :: a
|
2893 |
|
|
a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
|
2894 |
|
|
print '(3i3)', a(1,:)
|
2895 |
|
|
print '(3i3)', a(2,:)
|
2896 |
|
|
print '(3i3)', a(3,:)
|
2897 |
|
|
a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
|
2898 |
|
|
print *
|
2899 |
|
|
print '(3i3)', a(1,:)
|
2900 |
|
|
print '(3i3)', a(2,:)
|
2901 |
|
|
print '(3i3)', a(3,:)
|
2902 |
|
|
end program test_cshift
|
2903 |
|
|
@end smallexample
|
2904 |
|
|
@end table
|
2905 |
|
|
|
2906 |
|
|
|
2907 |
|
|
|
2908 |
|
|
@node CTIME
|
2909 |
|
|
@section @code{CTIME} --- Convert a time into a string
|
2910 |
|
|
@fnindex CTIME
|
2911 |
|
|
@cindex time, conversion to string
|
2912 |
|
|
@cindex conversion, to string
|
2913 |
|
|
|
2914 |
|
|
@table @asis
|
2915 |
|
|
@item @emph{Description}:
|
2916 |
|
|
@code{CTIME} converts a system time value, such as returned by
|
2917 |
|
|
@code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14 1995}.
|
2918 |
|
|
|
2919 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
2920 |
|
|
only one form can be used in any given program unit.
|
2921 |
|
|
|
2922 |
|
|
@item @emph{Standard}:
|
2923 |
|
|
GNU extension
|
2924 |
|
|
|
2925 |
|
|
@item @emph{Class}:
|
2926 |
|
|
Subroutine, function
|
2927 |
|
|
|
2928 |
|
|
@item @emph{Syntax}:
|
2929 |
|
|
@multitable @columnfractions .80
|
2930 |
|
|
@item @code{CALL CTIME(TIME, RESULT)}.
|
2931 |
|
|
@item @code{RESULT = CTIME(TIME)}, (not recommended).
|
2932 |
|
|
@end multitable
|
2933 |
|
|
|
2934 |
|
|
@item @emph{Arguments}:
|
2935 |
|
|
@multitable @columnfractions .15 .70
|
2936 |
|
|
@item @var{TIME} @tab The type shall be of type @code{INTEGER(KIND=8)}.
|
2937 |
|
|
@item @var{RESULT} @tab The type shall be of type @code{CHARACTER} and
|
2938 |
|
|
of default kind.
|
2939 |
|
|
@end multitable
|
2940 |
|
|
|
2941 |
|
|
@item @emph{Return value}:
|
2942 |
|
|
The converted date and time as a string.
|
2943 |
|
|
|
2944 |
|
|
@item @emph{Example}:
|
2945 |
|
|
@smallexample
|
2946 |
|
|
program test_ctime
|
2947 |
|
|
integer(8) :: i
|
2948 |
|
|
character(len=30) :: date
|
2949 |
|
|
i = time8()
|
2950 |
|
|
|
2951 |
|
|
! Do something, main part of the program
|
2952 |
|
|
|
2953 |
|
|
call ctime(i,date)
|
2954 |
|
|
print *, 'Program was started on ', date
|
2955 |
|
|
end program test_ctime
|
2956 |
|
|
@end smallexample
|
2957 |
|
|
|
2958 |
|
|
@item @emph{See Also}:
|
2959 |
|
|
@ref{GMTIME}, @ref{LTIME}, @ref{TIME}, @ref{TIME8}
|
2960 |
|
|
@end table
|
2961 |
|
|
|
2962 |
|
|
|
2963 |
|
|
|
2964 |
|
|
@node DATE_AND_TIME
|
2965 |
|
|
@section @code{DATE_AND_TIME} --- Date and time subroutine
|
2966 |
|
|
@fnindex DATE_AND_TIME
|
2967 |
|
|
@cindex date, current
|
2968 |
|
|
@cindex current date
|
2969 |
|
|
@cindex time, current
|
2970 |
|
|
@cindex current time
|
2971 |
|
|
|
2972 |
|
|
@table @asis
|
2973 |
|
|
@item @emph{Description}:
|
2974 |
|
|
@code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
|
2975 |
|
|
time information from the real-time system clock. @var{DATE} is
|
2976 |
|
|
@code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
|
2977 |
|
|
has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
|
2978 |
|
|
representing the difference with respect to Coordinated Universal Time (UTC).
|
2979 |
|
|
Unavailable time and date parameters return blanks.
|
2980 |
|
|
|
2981 |
|
|
@var{VALUES} is @code{INTENT(OUT)} and provides the following:
|
2982 |
|
|
|
2983 |
|
|
@multitable @columnfractions .15 .30 .40
|
2984 |
|
|
@item @tab @code{VALUE(1)}: @tab The year
|
2985 |
|
|
@item @tab @code{VALUE(2)}: @tab The month
|
2986 |
|
|
@item @tab @code{VALUE(3)}: @tab The day of the month
|
2987 |
|
|
@item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
|
2988 |
|
|
@item @tab @code{VALUE(5)}: @tab The hour of the day
|
2989 |
|
|
@item @tab @code{VALUE(6)}: @tab The minutes of the hour
|
2990 |
|
|
@item @tab @code{VALUE(7)}: @tab The seconds of the minute
|
2991 |
|
|
@item @tab @code{VALUE(8)}: @tab The milliseconds of the second
|
2992 |
|
|
@end multitable
|
2993 |
|
|
|
2994 |
|
|
@item @emph{Standard}:
|
2995 |
|
|
Fortran 95 and later
|
2996 |
|
|
|
2997 |
|
|
@item @emph{Class}:
|
2998 |
|
|
Subroutine
|
2999 |
|
|
|
3000 |
|
|
@item @emph{Syntax}:
|
3001 |
|
|
@code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
|
3002 |
|
|
|
3003 |
|
|
@item @emph{Arguments}:
|
3004 |
|
|
@multitable @columnfractions .15 .70
|
3005 |
|
|
@item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(LEN=8)}
|
3006 |
|
|
or larger, and of default kind.
|
3007 |
|
|
@item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(LEN=10)}
|
3008 |
|
|
or larger, and of default kind.
|
3009 |
|
|
@item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(LEN=5)}
|
3010 |
|
|
or larger, and of default kind.
|
3011 |
|
|
@item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
|
3012 |
|
|
@end multitable
|
3013 |
|
|
|
3014 |
|
|
@item @emph{Return value}:
|
3015 |
|
|
None
|
3016 |
|
|
|
3017 |
|
|
@item @emph{Example}:
|
3018 |
|
|
@smallexample
|
3019 |
|
|
program test_time_and_date
|
3020 |
|
|
character(8) :: date
|
3021 |
|
|
character(10) :: time
|
3022 |
|
|
character(5) :: zone
|
3023 |
|
|
integer,dimension(8) :: values
|
3024 |
|
|
! using keyword arguments
|
3025 |
|
|
call date_and_time(date,time,zone,values)
|
3026 |
|
|
call date_and_time(DATE=date,ZONE=zone)
|
3027 |
|
|
call date_and_time(TIME=time)
|
3028 |
|
|
call date_and_time(VALUES=values)
|
3029 |
|
|
print '(a,2x,a,2x,a)', date, time, zone
|
3030 |
|
|
print '(8i5))', values
|
3031 |
|
|
end program test_time_and_date
|
3032 |
|
|
@end smallexample
|
3033 |
|
|
|
3034 |
|
|
@item @emph{See also}:
|
3035 |
|
|
@ref{CPU_TIME}, @ref{SYSTEM_CLOCK}
|
3036 |
|
|
@end table
|
3037 |
|
|
|
3038 |
|
|
|
3039 |
|
|
|
3040 |
|
|
@node DBLE
|
3041 |
|
|
@section @code{DBLE} --- Double conversion function
|
3042 |
|
|
@fnindex DBLE
|
3043 |
|
|
@cindex conversion, to real
|
3044 |
|
|
|
3045 |
|
|
@table @asis
|
3046 |
|
|
@item @emph{Description}:
|
3047 |
|
|
@code{DBLE(A)} Converts @var{A} to double precision real type.
|
3048 |
|
|
|
3049 |
|
|
@item @emph{Standard}:
|
3050 |
|
|
Fortran 77 and later
|
3051 |
|
|
|
3052 |
|
|
@item @emph{Class}:
|
3053 |
|
|
Elemental function
|
3054 |
|
|
|
3055 |
|
|
@item @emph{Syntax}:
|
3056 |
|
|
@code{RESULT = DBLE(A)}
|
3057 |
|
|
|
3058 |
|
|
@item @emph{Arguments}:
|
3059 |
|
|
@multitable @columnfractions .15 .70
|
3060 |
|
|
@item @var{A} @tab The type shall be @code{INTEGER}, @code{REAL},
|
3061 |
|
|
or @code{COMPLEX}.
|
3062 |
|
|
@end multitable
|
3063 |
|
|
|
3064 |
|
|
@item @emph{Return value}:
|
3065 |
|
|
The return value is of type double precision real.
|
3066 |
|
|
|
3067 |
|
|
@item @emph{Example}:
|
3068 |
|
|
@smallexample
|
3069 |
|
|
program test_dble
|
3070 |
|
|
real :: x = 2.18
|
3071 |
|
|
integer :: i = 5
|
3072 |
|
|
complex :: z = (2.3,1.14)
|
3073 |
|
|
print *, dble(x), dble(i), dble(z)
|
3074 |
|
|
end program test_dble
|
3075 |
|
|
@end smallexample
|
3076 |
|
|
|
3077 |
|
|
@item @emph{See also}:
|
3078 |
|
|
@ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
|
3079 |
|
|
@end table
|
3080 |
|
|
|
3081 |
|
|
|
3082 |
|
|
|
3083 |
|
|
@node DCMPLX
|
3084 |
|
|
@section @code{DCMPLX} --- Double complex conversion function
|
3085 |
|
|
@fnindex DCMPLX
|
3086 |
|
|
@cindex complex numbers, conversion to
|
3087 |
|
|
@cindex conversion, to complex
|
3088 |
|
|
|
3089 |
|
|
@table @asis
|
3090 |
|
|
@item @emph{Description}:
|
3091 |
|
|
@code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
|
3092 |
|
|
converted to the real component. If @var{Y} is present it is converted to the
|
3093 |
|
|
imaginary component. If @var{Y} is not present then the imaginary component is
|
3094 |
|
|
set to 0.0. If @var{X} is complex then @var{Y} must not be present.
|
3095 |
|
|
|
3096 |
|
|
@item @emph{Standard}:
|
3097 |
|
|
GNU extension
|
3098 |
|
|
|
3099 |
|
|
@item @emph{Class}:
|
3100 |
|
|
Elemental function
|
3101 |
|
|
|
3102 |
|
|
@item @emph{Syntax}:
|
3103 |
|
|
@code{RESULT = DCMPLX(X [, Y])}
|
3104 |
|
|
|
3105 |
|
|
@item @emph{Arguments}:
|
3106 |
|
|
@multitable @columnfractions .15 .70
|
3107 |
|
|
@item @var{X} @tab The type may be @code{INTEGER}, @code{REAL},
|
3108 |
|
|
or @code{COMPLEX}.
|
3109 |
|
|
@item @var{Y} @tab (Optional if @var{X} is not @code{COMPLEX}.) May be
|
3110 |
|
|
@code{INTEGER} or @code{REAL}.
|
3111 |
|
|
@end multitable
|
3112 |
|
|
|
3113 |
|
|
@item @emph{Return value}:
|
3114 |
|
|
The return value is of type @code{COMPLEX(8)}
|
3115 |
|
|
|
3116 |
|
|
@item @emph{Example}:
|
3117 |
|
|
@smallexample
|
3118 |
|
|
program test_dcmplx
|
3119 |
|
|
integer :: i = 42
|
3120 |
|
|
real :: x = 3.14
|
3121 |
|
|
complex :: z
|
3122 |
|
|
z = cmplx(i, x)
|
3123 |
|
|
print *, dcmplx(i)
|
3124 |
|
|
print *, dcmplx(x)
|
3125 |
|
|
print *, dcmplx(z)
|
3126 |
|
|
print *, dcmplx(x,i)
|
3127 |
|
|
end program test_dcmplx
|
3128 |
|
|
@end smallexample
|
3129 |
|
|
@end table
|
3130 |
|
|
|
3131 |
|
|
|
3132 |
|
|
|
3133 |
|
|
@node DFLOAT
|
3134 |
|
|
@section @code{DFLOAT} --- Double conversion function
|
3135 |
|
|
@fnindex DFLOAT
|
3136 |
|
|
@cindex conversion, to real
|
3137 |
|
|
|
3138 |
|
|
@table @asis
|
3139 |
|
|
@item @emph{Description}:
|
3140 |
|
|
@code{DFLOAT(A)} Converts @var{A} to double precision real type.
|
3141 |
|
|
|
3142 |
|
|
@item @emph{Standard}:
|
3143 |
|
|
GNU extension
|
3144 |
|
|
|
3145 |
|
|
@item @emph{Class}:
|
3146 |
|
|
Elemental function
|
3147 |
|
|
|
3148 |
|
|
@item @emph{Syntax}:
|
3149 |
|
|
@code{RESULT = DFLOAT(A)}
|
3150 |
|
|
|
3151 |
|
|
@item @emph{Arguments}:
|
3152 |
|
|
@multitable @columnfractions .15 .70
|
3153 |
|
|
@item @var{A} @tab The type shall be @code{INTEGER}.
|
3154 |
|
|
@end multitable
|
3155 |
|
|
|
3156 |
|
|
@item @emph{Return value}:
|
3157 |
|
|
The return value is of type double precision real.
|
3158 |
|
|
|
3159 |
|
|
@item @emph{Example}:
|
3160 |
|
|
@smallexample
|
3161 |
|
|
program test_dfloat
|
3162 |
|
|
integer :: i = 5
|
3163 |
|
|
print *, dfloat(i)
|
3164 |
|
|
end program test_dfloat
|
3165 |
|
|
@end smallexample
|
3166 |
|
|
|
3167 |
|
|
@item @emph{See also}:
|
3168 |
|
|
@ref{DBLE}, @ref{FLOAT}, @ref{REAL}
|
3169 |
|
|
@end table
|
3170 |
|
|
|
3171 |
|
|
|
3172 |
|
|
|
3173 |
|
|
@node DIGITS
|
3174 |
|
|
@section @code{DIGITS} --- Significant binary digits function
|
3175 |
|
|
@fnindex DIGITS
|
3176 |
|
|
@cindex model representation, significant digits
|
3177 |
|
|
|
3178 |
|
|
@table @asis
|
3179 |
|
|
@item @emph{Description}:
|
3180 |
|
|
@code{DIGITS(X)} returns the number of significant binary digits of the internal
|
3181 |
|
|
model representation of @var{X}. For example, on a system using a 32-bit
|
3182 |
|
|
floating point representation, a default real number would likely return 24.
|
3183 |
|
|
|
3184 |
|
|
@item @emph{Standard}:
|
3185 |
|
|
Fortran 95 and later
|
3186 |
|
|
|
3187 |
|
|
@item @emph{Class}:
|
3188 |
|
|
Inquiry function
|
3189 |
|
|
|
3190 |
|
|
@item @emph{Syntax}:
|
3191 |
|
|
@code{RESULT = DIGITS(X)}
|
3192 |
|
|
|
3193 |
|
|
@item @emph{Arguments}:
|
3194 |
|
|
@multitable @columnfractions .15 .70
|
3195 |
|
|
@item @var{X} @tab The type may be @code{INTEGER} or @code{REAL}.
|
3196 |
|
|
@end multitable
|
3197 |
|
|
|
3198 |
|
|
@item @emph{Return value}:
|
3199 |
|
|
The return value is of type @code{INTEGER}.
|
3200 |
|
|
|
3201 |
|
|
@item @emph{Example}:
|
3202 |
|
|
@smallexample
|
3203 |
|
|
program test_digits
|
3204 |
|
|
integer :: i = 12345
|
3205 |
|
|
real :: x = 3.143
|
3206 |
|
|
real(8) :: y = 2.33
|
3207 |
|
|
print *, digits(i)
|
3208 |
|
|
print *, digits(x)
|
3209 |
|
|
print *, digits(y)
|
3210 |
|
|
end program test_digits
|
3211 |
|
|
@end smallexample
|
3212 |
|
|
@end table
|
3213 |
|
|
|
3214 |
|
|
|
3215 |
|
|
|
3216 |
|
|
@node DIM
|
3217 |
|
|
@section @code{DIM} --- Positive difference
|
3218 |
|
|
@fnindex DIM
|
3219 |
|
|
@fnindex IDIM
|
3220 |
|
|
@fnindex DDIM
|
3221 |
|
|
@cindex positive difference
|
3222 |
|
|
|
3223 |
|
|
@table @asis
|
3224 |
|
|
@item @emph{Description}:
|
3225 |
|
|
@code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
|
3226 |
|
|
otherwise returns zero.
|
3227 |
|
|
|
3228 |
|
|
@item @emph{Standard}:
|
3229 |
|
|
Fortran 77 and later
|
3230 |
|
|
|
3231 |
|
|
@item @emph{Class}:
|
3232 |
|
|
Elemental function
|
3233 |
|
|
|
3234 |
|
|
@item @emph{Syntax}:
|
3235 |
|
|
@code{RESULT = DIM(X, Y)}
|
3236 |
|
|
|
3237 |
|
|
@item @emph{Arguments}:
|
3238 |
|
|
@multitable @columnfractions .15 .70
|
3239 |
|
|
@item @var{X} @tab The type shall be @code{INTEGER} or @code{REAL}
|
3240 |
|
|
@item @var{Y} @tab The type shall be the same type and kind as @var{X}.
|
3241 |
|
|
@end multitable
|
3242 |
|
|
|
3243 |
|
|
@item @emph{Return value}:
|
3244 |
|
|
The return value is of type @code{INTEGER} or @code{REAL}.
|
3245 |
|
|
|
3246 |
|
|
@item @emph{Example}:
|
3247 |
|
|
@smallexample
|
3248 |
|
|
program test_dim
|
3249 |
|
|
integer :: i
|
3250 |
|
|
real(8) :: x
|
3251 |
|
|
i = dim(4, 15)
|
3252 |
|
|
x = dim(4.345_8, 2.111_8)
|
3253 |
|
|
print *, i
|
3254 |
|
|
print *, x
|
3255 |
|
|
end program test_dim
|
3256 |
|
|
@end smallexample
|
3257 |
|
|
|
3258 |
|
|
@item @emph{Specific names}:
|
3259 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
3260 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
3261 |
|
|
@item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab Fortran 77 and later
|
3262 |
|
|
@item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab Fortran 77 and later
|
3263 |
|
|
@end multitable
|
3264 |
|
|
@end table
|
3265 |
|
|
|
3266 |
|
|
|
3267 |
|
|
|
3268 |
|
|
@node DOT_PRODUCT
|
3269 |
|
|
@section @code{DOT_PRODUCT} --- Dot product function
|
3270 |
|
|
@fnindex DOT_PRODUCT
|
3271 |
|
|
@cindex dot product
|
3272 |
|
|
@cindex vector product
|
3273 |
|
|
@cindex product, vector
|
3274 |
|
|
|
3275 |
|
|
@table @asis
|
3276 |
|
|
@item @emph{Description}:
|
3277 |
|
|
@code{DOT_PRODUCT(VECTOR_A, VECTOR_B)} computes the dot product multiplication
|
3278 |
|
|
of two vectors @var{VECTOR_A} and @var{VECTOR_B}. The two vectors may be
|
3279 |
|
|
either numeric or logical and must be arrays of rank one and of equal size. If
|
3280 |
|
|
the vectors are @code{INTEGER} or @code{REAL}, the result is
|
3281 |
|
|
@code{SUM(VECTOR_A*VECTOR_B)}. If the vectors are @code{COMPLEX}, the result
|
3282 |
|
|
is @code{SUM(CONJG(VECTOR_A)*VECTOR_B)}. If the vectors are @code{LOGICAL},
|
3283 |
|
|
the result is @code{ANY(VECTOR_A .AND. VECTOR_B)}.
|
3284 |
|
|
|
3285 |
|
|
@item @emph{Standard}:
|
3286 |
|
|
Fortran 95 and later
|
3287 |
|
|
|
3288 |
|
|
@item @emph{Class}:
|
3289 |
|
|
Transformational function
|
3290 |
|
|
|
3291 |
|
|
@item @emph{Syntax}:
|
3292 |
|
|
@code{RESULT = DOT_PRODUCT(VECTOR_A, VECTOR_B)}
|
3293 |
|
|
|
3294 |
|
|
@item @emph{Arguments}:
|
3295 |
|
|
@multitable @columnfractions .15 .70
|
3296 |
|
|
@item @var{VECTOR_A} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
|
3297 |
|
|
@item @var{VECTOR_B} @tab The type shall be numeric if @var{VECTOR_A} is of numeric type or @code{LOGICAL} if @var{VECTOR_A} is of type @code{LOGICAL}. @var{VECTOR_B} shall be a rank-one array.
|
3298 |
|
|
@end multitable
|
3299 |
|
|
|
3300 |
|
|
@item @emph{Return value}:
|
3301 |
|
|
If the arguments are numeric, the return value is a scalar of numeric type,
|
3302 |
|
|
@code{INTEGER}, @code{REAL}, or @code{COMPLEX}. If the arguments are
|
3303 |
|
|
@code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
|
3304 |
|
|
|
3305 |
|
|
@item @emph{Example}:
|
3306 |
|
|
@smallexample
|
3307 |
|
|
program test_dot_prod
|
3308 |
|
|
integer, dimension(3) :: a, b
|
3309 |
|
|
a = (/ 1, 2, 3 /)
|
3310 |
|
|
b = (/ 4, 5, 6 /)
|
3311 |
|
|
print '(3i3)', a
|
3312 |
|
|
print *
|
3313 |
|
|
print '(3i3)', b
|
3314 |
|
|
print *
|
3315 |
|
|
print *, dot_product(a,b)
|
3316 |
|
|
end program test_dot_prod
|
3317 |
|
|
@end smallexample
|
3318 |
|
|
@end table
|
3319 |
|
|
|
3320 |
|
|
|
3321 |
|
|
|
3322 |
|
|
@node DPROD
|
3323 |
|
|
@section @code{DPROD} --- Double product function
|
3324 |
|
|
@fnindex DPROD
|
3325 |
|
|
@cindex product, double-precision
|
3326 |
|
|
|
3327 |
|
|
@table @asis
|
3328 |
|
|
@item @emph{Description}:
|
3329 |
|
|
@code{DPROD(X,Y)} returns the product @code{X*Y}.
|
3330 |
|
|
|
3331 |
|
|
@item @emph{Standard}:
|
3332 |
|
|
Fortran 77 and later
|
3333 |
|
|
|
3334 |
|
|
@item @emph{Class}:
|
3335 |
|
|
Elemental function
|
3336 |
|
|
|
3337 |
|
|
@item @emph{Syntax}:
|
3338 |
|
|
@code{RESULT = DPROD(X, Y)}
|
3339 |
|
|
|
3340 |
|
|
@item @emph{Arguments}:
|
3341 |
|
|
@multitable @columnfractions .15 .70
|
3342 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
3343 |
|
|
@item @var{Y} @tab The type shall be @code{REAL}.
|
3344 |
|
|
@end multitable
|
3345 |
|
|
|
3346 |
|
|
@item @emph{Return value}:
|
3347 |
|
|
The return value is of type @code{REAL(8)}.
|
3348 |
|
|
|
3349 |
|
|
@item @emph{Example}:
|
3350 |
|
|
@smallexample
|
3351 |
|
|
program test_dprod
|
3352 |
|
|
real :: x = 5.2
|
3353 |
|
|
real :: y = 2.3
|
3354 |
|
|
real(8) :: d
|
3355 |
|
|
d = dprod(x,y)
|
3356 |
|
|
print *, d
|
3357 |
|
|
end program test_dprod
|
3358 |
|
|
@end smallexample
|
3359 |
|
|
@end table
|
3360 |
|
|
|
3361 |
|
|
|
3362 |
|
|
|
3363 |
|
|
@node DREAL
|
3364 |
|
|
@section @code{DREAL} --- Double real part function
|
3365 |
|
|
@fnindex DREAL
|
3366 |
|
|
@cindex complex numbers, real part
|
3367 |
|
|
|
3368 |
|
|
@table @asis
|
3369 |
|
|
@item @emph{Description}:
|
3370 |
|
|
@code{DREAL(Z)} returns the real part of complex variable @var{Z}.
|
3371 |
|
|
|
3372 |
|
|
@item @emph{Standard}:
|
3373 |
|
|
GNU extension
|
3374 |
|
|
|
3375 |
|
|
@item @emph{Class}:
|
3376 |
|
|
Elemental function
|
3377 |
|
|
|
3378 |
|
|
@item @emph{Syntax}:
|
3379 |
|
|
@code{RESULT = DREAL(A)}
|
3380 |
|
|
|
3381 |
|
|
@item @emph{Arguments}:
|
3382 |
|
|
@multitable @columnfractions .15 .70
|
3383 |
|
|
@item @var{A} @tab The type shall be @code{COMPLEX(8)}.
|
3384 |
|
|
@end multitable
|
3385 |
|
|
|
3386 |
|
|
@item @emph{Return value}:
|
3387 |
|
|
The return value is of type @code{REAL(8)}.
|
3388 |
|
|
|
3389 |
|
|
@item @emph{Example}:
|
3390 |
|
|
@smallexample
|
3391 |
|
|
program test_dreal
|
3392 |
|
|
complex(8) :: z = (1.3_8,7.2_8)
|
3393 |
|
|
print *, dreal(z)
|
3394 |
|
|
end program test_dreal
|
3395 |
|
|
@end smallexample
|
3396 |
|
|
|
3397 |
|
|
@item @emph{See also}:
|
3398 |
|
|
@ref{AIMAG}
|
3399 |
|
|
|
3400 |
|
|
@end table
|
3401 |
|
|
|
3402 |
|
|
|
3403 |
|
|
|
3404 |
|
|
@node DTIME
|
3405 |
|
|
@section @code{DTIME} --- Execution time subroutine (or function)
|
3406 |
|
|
@fnindex DTIME
|
3407 |
|
|
@cindex time, elapsed
|
3408 |
|
|
@cindex elapsed time
|
3409 |
|
|
|
3410 |
|
|
@table @asis
|
3411 |
|
|
@item @emph{Description}:
|
3412 |
|
|
@code{DTIME(VALUES, TIME)} initially returns the number of seconds of runtime
|
3413 |
|
|
since the start of the process's execution in @var{TIME}. @var{VALUES}
|
3414 |
|
|
returns the user and system components of this time in @code{VALUES(1)} and
|
3415 |
|
|
@code{VALUES(2)} respectively. @var{TIME} is equal to @code{VALUES(1) +
|
3416 |
|
|
VALUES(2)}.
|
3417 |
|
|
|
3418 |
|
|
Subsequent invocations of @code{DTIME} return values accumulated since the
|
3419 |
|
|
previous invocation.
|
3420 |
|
|
|
3421 |
|
|
On some systems, the underlying timings are represented using types with
|
3422 |
|
|
sufficiently small limits that overflows (wrap around) are possible, such as
|
3423 |
|
|
32-bit types. Therefore, the values returned by this intrinsic might be, or
|
3424 |
|
|
become, negative, or numerically less than previous values, during a single
|
3425 |
|
|
run of the compiled program.
|
3426 |
|
|
|
3427 |
|
|
Please note, that this implementation is thread safe if used within OpenMP
|
3428 |
|
|
directives, i.e., its state will be consistent while called from multiple
|
3429 |
|
|
threads. However, if @code{DTIME} is called from multiple threads, the result
|
3430 |
|
|
is still the time since the last invocation. This may not give the intended
|
3431 |
|
|
results. If possible, use @code{CPU_TIME} instead.
|
3432 |
|
|
|
3433 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
3434 |
|
|
only one form can be used in any given program unit.
|
3435 |
|
|
|
3436 |
|
|
@var{VALUES} and @var{TIME} are @code{INTENT(OUT)} and provide the following:
|
3437 |
|
|
|
3438 |
|
|
@multitable @columnfractions .15 .30 .40
|
3439 |
|
|
@item @tab @code{VALUES(1)}: @tab User time in seconds.
|
3440 |
|
|
@item @tab @code{VALUES(2)}: @tab System time in seconds.
|
3441 |
|
|
@item @tab @code{TIME}: @tab Run time since start in seconds.
|
3442 |
|
|
@end multitable
|
3443 |
|
|
|
3444 |
|
|
@item @emph{Standard}:
|
3445 |
|
|
GNU extension
|
3446 |
|
|
|
3447 |
|
|
@item @emph{Class}:
|
3448 |
|
|
Subroutine, function
|
3449 |
|
|
|
3450 |
|
|
@item @emph{Syntax}:
|
3451 |
|
|
@multitable @columnfractions .80
|
3452 |
|
|
@item @code{CALL DTIME(VALUES, TIME)}.
|
3453 |
|
|
@item @code{TIME = DTIME(VALUES)}, (not recommended).
|
3454 |
|
|
@end multitable
|
3455 |
|
|
|
3456 |
|
|
@item @emph{Arguments}:
|
3457 |
|
|
@multitable @columnfractions .15 .70
|
3458 |
|
|
@item @var{VALUES}@tab The type shall be @code{REAL(4), DIMENSION(2)}.
|
3459 |
|
|
@item @var{TIME}@tab The type shall be @code{REAL(4)}.
|
3460 |
|
|
@end multitable
|
3461 |
|
|
|
3462 |
|
|
@item @emph{Return value}:
|
3463 |
|
|
Elapsed time in seconds since the last invocation or since the start of program
|
3464 |
|
|
execution if not called before.
|
3465 |
|
|
|
3466 |
|
|
@item @emph{Example}:
|
3467 |
|
|
@smallexample
|
3468 |
|
|
program test_dtime
|
3469 |
|
|
integer(8) :: i, j
|
3470 |
|
|
real, dimension(2) :: tarray
|
3471 |
|
|
real :: result
|
3472 |
|
|
call dtime(tarray, result)
|
3473 |
|
|
print *, result
|
3474 |
|
|
print *, tarray(1)
|
3475 |
|
|
print *, tarray(2)
|
3476 |
|
|
do i=1,100000000 ! Just a delay
|
3477 |
|
|
j = i * i - i
|
3478 |
|
|
end do
|
3479 |
|
|
call dtime(tarray, result)
|
3480 |
|
|
print *, result
|
3481 |
|
|
print *, tarray(1)
|
3482 |
|
|
print *, tarray(2)
|
3483 |
|
|
end program test_dtime
|
3484 |
|
|
@end smallexample
|
3485 |
|
|
|
3486 |
|
|
@item @emph{See also}:
|
3487 |
|
|
@ref{CPU_TIME}
|
3488 |
|
|
|
3489 |
|
|
@end table
|
3490 |
|
|
|
3491 |
|
|
|
3492 |
|
|
|
3493 |
|
|
@node EOSHIFT
|
3494 |
|
|
@section @code{EOSHIFT} --- End-off shift elements of an array
|
3495 |
|
|
@fnindex EOSHIFT
|
3496 |
|
|
@cindex array, shift
|
3497 |
|
|
|
3498 |
|
|
@table @asis
|
3499 |
|
|
@item @emph{Description}:
|
3500 |
|
|
@code{EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])} performs an end-off shift on
|
3501 |
|
|
elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
|
3502 |
|
|
omitted it is taken to be @code{1}. @var{DIM} is a scalar of type
|
3503 |
|
|
@code{INTEGER} in the range of @math{1 \leq DIM \leq n)} where @math{n} is the
|
3504 |
|
|
rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
|
3505 |
|
|
@var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
|
3506 |
|
|
then all complete rank one sections of @var{ARRAY} along the given dimension are
|
3507 |
|
|
shifted. Elements shifted out one end of each rank one section are dropped. If
|
3508 |
|
|
@var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
|
3509 |
|
|
is copied back in the other end. If @var{BOUNDARY} is not present then the
|
3510 |
|
|
following are copied in depending on the type of @var{ARRAY}.
|
3511 |
|
|
|
3512 |
|
|
@multitable @columnfractions .15 .80
|
3513 |
|
|
@item @emph{Array Type} @tab @emph{Boundary Value}
|
3514 |
|
|
@item Numeric @tab 0 of the type and kind of @var{ARRAY}.
|
3515 |
|
|
@item Logical @tab @code{.FALSE.}.
|
3516 |
|
|
@item Character(@var{len}) @tab @var{len} blanks.
|
3517 |
|
|
@end multitable
|
3518 |
|
|
|
3519 |
|
|
@item @emph{Standard}:
|
3520 |
|
|
Fortran 95 and later
|
3521 |
|
|
|
3522 |
|
|
@item @emph{Class}:
|
3523 |
|
|
Transformational function
|
3524 |
|
|
|
3525 |
|
|
@item @emph{Syntax}:
|
3526 |
|
|
@code{RESULT = EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])}
|
3527 |
|
|
|
3528 |
|
|
@item @emph{Arguments}:
|
3529 |
|
|
@multitable @columnfractions .15 .70
|
3530 |
|
|
@item @var{ARRAY} @tab May be any type, not scalar.
|
3531 |
|
|
@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
|
3532 |
|
|
@item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
|
3533 |
|
|
@item @var{DIM} @tab The type shall be @code{INTEGER}.
|
3534 |
|
|
@end multitable
|
3535 |
|
|
|
3536 |
|
|
@item @emph{Return value}:
|
3537 |
|
|
Returns an array of same type and rank as the @var{ARRAY} argument.
|
3538 |
|
|
|
3539 |
|
|
@item @emph{Example}:
|
3540 |
|
|
@smallexample
|
3541 |
|
|
program test_eoshift
|
3542 |
|
|
integer, dimension(3,3) :: a
|
3543 |
|
|
a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
|
3544 |
|
|
print '(3i3)', a(1,:)
|
3545 |
|
|
print '(3i3)', a(2,:)
|
3546 |
|
|
print '(3i3)', a(3,:)
|
3547 |
|
|
a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
|
3548 |
|
|
print *
|
3549 |
|
|
print '(3i3)', a(1,:)
|
3550 |
|
|
print '(3i3)', a(2,:)
|
3551 |
|
|
print '(3i3)', a(3,:)
|
3552 |
|
|
end program test_eoshift
|
3553 |
|
|
@end smallexample
|
3554 |
|
|
@end table
|
3555 |
|
|
|
3556 |
|
|
|
3557 |
|
|
|
3558 |
|
|
@node EPSILON
|
3559 |
|
|
@section @code{EPSILON} --- Epsilon function
|
3560 |
|
|
@fnindex EPSILON
|
3561 |
|
|
@cindex model representation, epsilon
|
3562 |
|
|
|
3563 |
|
|
@table @asis
|
3564 |
|
|
@item @emph{Description}:
|
3565 |
|
|
@code{EPSILON(X)} returns the smallest number @var{E} of the same kind
|
3566 |
|
|
as @var{X} such that @math{1 + E > 1}.
|
3567 |
|
|
|
3568 |
|
|
@item @emph{Standard}:
|
3569 |
|
|
Fortran 95 and later
|
3570 |
|
|
|
3571 |
|
|
@item @emph{Class}:
|
3572 |
|
|
Inquiry function
|
3573 |
|
|
|
3574 |
|
|
@item @emph{Syntax}:
|
3575 |
|
|
@code{RESULT = EPSILON(X)}
|
3576 |
|
|
|
3577 |
|
|
@item @emph{Arguments}:
|
3578 |
|
|
@multitable @columnfractions .15 .70
|
3579 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
3580 |
|
|
@end multitable
|
3581 |
|
|
|
3582 |
|
|
@item @emph{Return value}:
|
3583 |
|
|
The return value is of same type as the argument.
|
3584 |
|
|
|
3585 |
|
|
@item @emph{Example}:
|
3586 |
|
|
@smallexample
|
3587 |
|
|
program test_epsilon
|
3588 |
|
|
real :: x = 3.143
|
3589 |
|
|
real(8) :: y = 2.33
|
3590 |
|
|
print *, EPSILON(x)
|
3591 |
|
|
print *, EPSILON(y)
|
3592 |
|
|
end program test_epsilon
|
3593 |
|
|
@end smallexample
|
3594 |
|
|
@end table
|
3595 |
|
|
|
3596 |
|
|
|
3597 |
|
|
|
3598 |
|
|
@node ERF
|
3599 |
|
|
@section @code{ERF} --- Error function
|
3600 |
|
|
@fnindex ERF
|
3601 |
|
|
@cindex error function
|
3602 |
|
|
|
3603 |
|
|
@table @asis
|
3604 |
|
|
@item @emph{Description}:
|
3605 |
|
|
@code{ERF(X)} computes the error function of @var{X}.
|
3606 |
|
|
|
3607 |
|
|
@item @emph{Standard}:
|
3608 |
|
|
Fortran 2008 and later
|
3609 |
|
|
|
3610 |
|
|
@item @emph{Class}:
|
3611 |
|
|
Elemental function
|
3612 |
|
|
|
3613 |
|
|
@item @emph{Syntax}:
|
3614 |
|
|
@code{RESULT = ERF(X)}
|
3615 |
|
|
|
3616 |
|
|
@item @emph{Arguments}:
|
3617 |
|
|
@multitable @columnfractions .15 .70
|
3618 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
3619 |
|
|
@end multitable
|
3620 |
|
|
|
3621 |
|
|
@item @emph{Return value}:
|
3622 |
|
|
The return value is of type @code{REAL}, of the same kind as
|
3623 |
|
|
@var{X} and lies in the range @math{-1 \leq erf (x) \leq 1 }.
|
3624 |
|
|
|
3625 |
|
|
@item @emph{Example}:
|
3626 |
|
|
@smallexample
|
3627 |
|
|
program test_erf
|
3628 |
|
|
real(8) :: x = 0.17_8
|
3629 |
|
|
x = erf(x)
|
3630 |
|
|
end program test_erf
|
3631 |
|
|
@end smallexample
|
3632 |
|
|
|
3633 |
|
|
@item @emph{Specific names}:
|
3634 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
3635 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
3636 |
|
|
@item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
3637 |
|
|
@end multitable
|
3638 |
|
|
@end table
|
3639 |
|
|
|
3640 |
|
|
|
3641 |
|
|
|
3642 |
|
|
@node ERFC
|
3643 |
|
|
@section @code{ERFC} --- Error function
|
3644 |
|
|
@fnindex ERFC
|
3645 |
|
|
@cindex error function, complementary
|
3646 |
|
|
|
3647 |
|
|
@table @asis
|
3648 |
|
|
@item @emph{Description}:
|
3649 |
|
|
@code{ERFC(X)} computes the complementary error function of @var{X}.
|
3650 |
|
|
|
3651 |
|
|
@item @emph{Standard}:
|
3652 |
|
|
Fortran 2008 and later
|
3653 |
|
|
|
3654 |
|
|
@item @emph{Class}:
|
3655 |
|
|
Elemental function
|
3656 |
|
|
|
3657 |
|
|
@item @emph{Syntax}:
|
3658 |
|
|
@code{RESULT = ERFC(X)}
|
3659 |
|
|
|
3660 |
|
|
@item @emph{Arguments}:
|
3661 |
|
|
@multitable @columnfractions .15 .70
|
3662 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
3663 |
|
|
@end multitable
|
3664 |
|
|
|
3665 |
|
|
@item @emph{Return value}:
|
3666 |
|
|
The return value is of type @code{REAL} and of the same kind as @var{X}.
|
3667 |
|
|
It lies in the range @math{ 0 \leq erfc (x) \leq 2 }.
|
3668 |
|
|
|
3669 |
|
|
@item @emph{Example}:
|
3670 |
|
|
@smallexample
|
3671 |
|
|
program test_erfc
|
3672 |
|
|
real(8) :: x = 0.17_8
|
3673 |
|
|
x = erfc(x)
|
3674 |
|
|
end program test_erfc
|
3675 |
|
|
@end smallexample
|
3676 |
|
|
|
3677 |
|
|
@item @emph{Specific names}:
|
3678 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
3679 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
3680 |
|
|
@item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
|
3681 |
|
|
@end multitable
|
3682 |
|
|
@end table
|
3683 |
|
|
|
3684 |
|
|
|
3685 |
|
|
|
3686 |
|
|
@node ERFC_SCALED
|
3687 |
|
|
@section @code{ERFC_SCALED} --- Error function
|
3688 |
|
|
@fnindex ERFC_SCALED
|
3689 |
|
|
@cindex error function, complementary, exponentially-scaled
|
3690 |
|
|
|
3691 |
|
|
@table @asis
|
3692 |
|
|
@item @emph{Description}:
|
3693 |
|
|
@code{ERFC_SCALED(X)} computes the exponentially-scaled complementary
|
3694 |
|
|
error function of @var{X}.
|
3695 |
|
|
|
3696 |
|
|
@item @emph{Standard}:
|
3697 |
|
|
Fortran 2008 and later
|
3698 |
|
|
|
3699 |
|
|
@item @emph{Class}:
|
3700 |
|
|
Elemental function
|
3701 |
|
|
|
3702 |
|
|
@item @emph{Syntax}:
|
3703 |
|
|
@code{RESULT = ERFC_SCALED(X)}
|
3704 |
|
|
|
3705 |
|
|
@item @emph{Arguments}:
|
3706 |
|
|
@multitable @columnfractions .15 .70
|
3707 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
3708 |
|
|
@end multitable
|
3709 |
|
|
|
3710 |
|
|
@item @emph{Return value}:
|
3711 |
|
|
The return value is of type @code{REAL} and of the same kind as @var{X}.
|
3712 |
|
|
|
3713 |
|
|
@item @emph{Example}:
|
3714 |
|
|
@smallexample
|
3715 |
|
|
program test_erfc_scaled
|
3716 |
|
|
real(8) :: x = 0.17_8
|
3717 |
|
|
x = erfc_scaled(x)
|
3718 |
|
|
end program test_erfc_scaled
|
3719 |
|
|
@end smallexample
|
3720 |
|
|
@end table
|
3721 |
|
|
|
3722 |
|
|
|
3723 |
|
|
|
3724 |
|
|
@node ETIME
|
3725 |
|
|
@section @code{ETIME} --- Execution time subroutine (or function)
|
3726 |
|
|
@fnindex ETIME
|
3727 |
|
|
@cindex time, elapsed
|
3728 |
|
|
|
3729 |
|
|
@table @asis
|
3730 |
|
|
@item @emph{Description}:
|
3731 |
|
|
@code{ETIME(VALUES, TIME)} returns the number of seconds of runtime
|
3732 |
|
|
since the start of the process's execution in @var{TIME}. @var{VALUES}
|
3733 |
|
|
returns the user and system components of this time in @code{VALUES(1)} and
|
3734 |
|
|
@code{VALUES(2)} respectively. @var{TIME} is equal to @code{VALUES(1) + VALUES(2)}.
|
3735 |
|
|
|
3736 |
|
|
On some systems, the underlying timings are represented using types with
|
3737 |
|
|
sufficiently small limits that overflows (wrap around) are possible, such as
|
3738 |
|
|
32-bit types. Therefore, the values returned by this intrinsic might be, or
|
3739 |
|
|
become, negative, or numerically less than previous values, during a single
|
3740 |
|
|
run of the compiled program.
|
3741 |
|
|
|
3742 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
3743 |
|
|
only one form can be used in any given program unit.
|
3744 |
|
|
|
3745 |
|
|
@var{VALUES} and @var{TIME} are @code{INTENT(OUT)} and provide the following:
|
3746 |
|
|
|
3747 |
|
|
@multitable @columnfractions .15 .30 .60
|
3748 |
|
|
@item @tab @code{VALUES(1)}: @tab User time in seconds.
|
3749 |
|
|
@item @tab @code{VALUES(2)}: @tab System time in seconds.
|
3750 |
|
|
@item @tab @code{TIME}: @tab Run time since start in seconds.
|
3751 |
|
|
@end multitable
|
3752 |
|
|
|
3753 |
|
|
@item @emph{Standard}:
|
3754 |
|
|
GNU extension
|
3755 |
|
|
|
3756 |
|
|
@item @emph{Class}:
|
3757 |
|
|
Subroutine, function
|
3758 |
|
|
|
3759 |
|
|
@item @emph{Syntax}:
|
3760 |
|
|
@multitable @columnfractions .80
|
3761 |
|
|
@item @code{CALL ETIME(VALUES, TIME)}.
|
3762 |
|
|
@item @code{TIME = ETIME(VALUES)}, (not recommended).
|
3763 |
|
|
@end multitable
|
3764 |
|
|
|
3765 |
|
|
@item @emph{Arguments}:
|
3766 |
|
|
@multitable @columnfractions .15 .70
|
3767 |
|
|
@item @var{VALUES}@tab The type shall be @code{REAL(4), DIMENSION(2)}.
|
3768 |
|
|
@item @var{TIME}@tab The type shall be @code{REAL(4)}.
|
3769 |
|
|
@end multitable
|
3770 |
|
|
|
3771 |
|
|
@item @emph{Return value}:
|
3772 |
|
|
Elapsed time in seconds since the start of program execution.
|
3773 |
|
|
|
3774 |
|
|
@item @emph{Example}:
|
3775 |
|
|
@smallexample
|
3776 |
|
|
program test_etime
|
3777 |
|
|
integer(8) :: i, j
|
3778 |
|
|
real, dimension(2) :: tarray
|
3779 |
|
|
real :: result
|
3780 |
|
|
call ETIME(tarray, result)
|
3781 |
|
|
print *, result
|
3782 |
|
|
print *, tarray(1)
|
3783 |
|
|
print *, tarray(2)
|
3784 |
|
|
do i=1,100000000 ! Just a delay
|
3785 |
|
|
j = i * i - i
|
3786 |
|
|
end do
|
3787 |
|
|
call ETIME(tarray, result)
|
3788 |
|
|
print *, result
|
3789 |
|
|
print *, tarray(1)
|
3790 |
|
|
print *, tarray(2)
|
3791 |
|
|
end program test_etime
|
3792 |
|
|
@end smallexample
|
3793 |
|
|
|
3794 |
|
|
@item @emph{See also}:
|
3795 |
|
|
@ref{CPU_TIME}
|
3796 |
|
|
|
3797 |
|
|
@end table
|
3798 |
|
|
|
3799 |
|
|
|
3800 |
|
|
|
3801 |
|
|
@node EXIT
|
3802 |
|
|
@section @code{EXIT} --- Exit the program with status.
|
3803 |
|
|
@fnindex EXIT
|
3804 |
|
|
@cindex program termination
|
3805 |
|
|
@cindex terminate program
|
3806 |
|
|
|
3807 |
|
|
@table @asis
|
3808 |
|
|
@item @emph{Description}:
|
3809 |
|
|
@code{EXIT} causes immediate termination of the program with status. If status
|
3810 |
|
|
is omitted it returns the canonical @emph{success} for the system. All Fortran
|
3811 |
|
|
I/O units are closed.
|
3812 |
|
|
|
3813 |
|
|
@item @emph{Standard}:
|
3814 |
|
|
GNU extension
|
3815 |
|
|
|
3816 |
|
|
@item @emph{Class}:
|
3817 |
|
|
Subroutine
|
3818 |
|
|
|
3819 |
|
|
@item @emph{Syntax}:
|
3820 |
|
|
@code{CALL EXIT([STATUS])}
|
3821 |
|
|
|
3822 |
|
|
@item @emph{Arguments}:
|
3823 |
|
|
@multitable @columnfractions .15 .70
|
3824 |
|
|
@item @var{STATUS} @tab Shall be an @code{INTEGER} of the default kind.
|
3825 |
|
|
@end multitable
|
3826 |
|
|
|
3827 |
|
|
@item @emph{Return value}:
|
3828 |
|
|
@code{STATUS} is passed to the parent process on exit.
|
3829 |
|
|
|
3830 |
|
|
@item @emph{Example}:
|
3831 |
|
|
@smallexample
|
3832 |
|
|
program test_exit
|
3833 |
|
|
integer :: STATUS = 0
|
3834 |
|
|
print *, 'This program is going to exit.'
|
3835 |
|
|
call EXIT(STATUS)
|
3836 |
|
|
end program test_exit
|
3837 |
|
|
@end smallexample
|
3838 |
|
|
|
3839 |
|
|
@item @emph{See also}:
|
3840 |
|
|
@ref{ABORT}, @ref{KILL}
|
3841 |
|
|
@end table
|
3842 |
|
|
|
3843 |
|
|
|
3844 |
|
|
|
3845 |
|
|
@node EXP
|
3846 |
|
|
@section @code{EXP} --- Exponential function
|
3847 |
|
|
@fnindex EXP
|
3848 |
|
|
@fnindex DEXP
|
3849 |
|
|
@fnindex CEXP
|
3850 |
|
|
@fnindex ZEXP
|
3851 |
|
|
@fnindex CDEXP
|
3852 |
|
|
@cindex exponential function
|
3853 |
|
|
@cindex logarithmic function, inverse
|
3854 |
|
|
|
3855 |
|
|
@table @asis
|
3856 |
|
|
@item @emph{Description}:
|
3857 |
|
|
@code{EXP(X)} computes the base @math{e} exponential of @var{X}.
|
3858 |
|
|
|
3859 |
|
|
@item @emph{Standard}:
|
3860 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
3861 |
|
|
|
3862 |
|
|
@item @emph{Class}:
|
3863 |
|
|
Elemental function
|
3864 |
|
|
|
3865 |
|
|
@item @emph{Syntax}:
|
3866 |
|
|
@code{RESULT = EXP(X)}
|
3867 |
|
|
|
3868 |
|
|
@item @emph{Arguments}:
|
3869 |
|
|
@multitable @columnfractions .15 .70
|
3870 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or
|
3871 |
|
|
@code{COMPLEX}.
|
3872 |
|
|
@end multitable
|
3873 |
|
|
|
3874 |
|
|
@item @emph{Return value}:
|
3875 |
|
|
The return value has same type and kind as @var{X}.
|
3876 |
|
|
|
3877 |
|
|
@item @emph{Example}:
|
3878 |
|
|
@smallexample
|
3879 |
|
|
program test_exp
|
3880 |
|
|
real :: x = 1.0
|
3881 |
|
|
x = exp(x)
|
3882 |
|
|
end program test_exp
|
3883 |
|
|
@end smallexample
|
3884 |
|
|
|
3885 |
|
|
@item @emph{Specific names}:
|
3886 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
3887 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
3888 |
|
|
@item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
3889 |
|
|
@item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab Fortran 77 and later
|
3890 |
|
|
@item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
|
3891 |
|
|
@item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
|
3892 |
|
|
@end multitable
|
3893 |
|
|
@end table
|
3894 |
|
|
|
3895 |
|
|
|
3896 |
|
|
|
3897 |
|
|
@node EXPONENT
|
3898 |
|
|
@section @code{EXPONENT} --- Exponent function
|
3899 |
|
|
@fnindex EXPONENT
|
3900 |
|
|
@cindex real number, exponent
|
3901 |
|
|
@cindex floating point, exponent
|
3902 |
|
|
|
3903 |
|
|
@table @asis
|
3904 |
|
|
@item @emph{Description}:
|
3905 |
|
|
@code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
|
3906 |
|
|
is zero the value returned is zero.
|
3907 |
|
|
|
3908 |
|
|
@item @emph{Standard}:
|
3909 |
|
|
Fortran 95 and later
|
3910 |
|
|
|
3911 |
|
|
@item @emph{Class}:
|
3912 |
|
|
Elemental function
|
3913 |
|
|
|
3914 |
|
|
@item @emph{Syntax}:
|
3915 |
|
|
@code{RESULT = EXPONENT(X)}
|
3916 |
|
|
|
3917 |
|
|
@item @emph{Arguments}:
|
3918 |
|
|
@multitable @columnfractions .15 .70
|
3919 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
3920 |
|
|
@end multitable
|
3921 |
|
|
|
3922 |
|
|
@item @emph{Return value}:
|
3923 |
|
|
The return value is of type default @code{INTEGER}.
|
3924 |
|
|
|
3925 |
|
|
@item @emph{Example}:
|
3926 |
|
|
@smallexample
|
3927 |
|
|
program test_exponent
|
3928 |
|
|
real :: x = 1.0
|
3929 |
|
|
integer :: i
|
3930 |
|
|
i = exponent(x)
|
3931 |
|
|
print *, i
|
3932 |
|
|
print *, exponent(0.0)
|
3933 |
|
|
end program test_exponent
|
3934 |
|
|
@end smallexample
|
3935 |
|
|
@end table
|
3936 |
|
|
|
3937 |
|
|
|
3938 |
|
|
|
3939 |
|
|
@node FDATE
|
3940 |
|
|
@section @code{FDATE} --- Get the current time as a string
|
3941 |
|
|
@fnindex FDATE
|
3942 |
|
|
@cindex time, current
|
3943 |
|
|
@cindex current time
|
3944 |
|
|
@cindex date, current
|
3945 |
|
|
@cindex current date
|
3946 |
|
|
|
3947 |
|
|
@table @asis
|
3948 |
|
|
@item @emph{Description}:
|
3949 |
|
|
@code{FDATE(DATE)} returns the current date (using the same format as
|
3950 |
|
|
@code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
|
3951 |
|
|
TIME())}.
|
3952 |
|
|
|
3953 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
3954 |
|
|
only one form can be used in any given program unit.
|
3955 |
|
|
|
3956 |
|
|
@var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable of the
|
3957 |
|
|
default kind.
|
3958 |
|
|
|
3959 |
|
|
@item @emph{Standard}:
|
3960 |
|
|
GNU extension
|
3961 |
|
|
|
3962 |
|
|
@item @emph{Class}:
|
3963 |
|
|
Subroutine, function
|
3964 |
|
|
|
3965 |
|
|
@item @emph{Syntax}:
|
3966 |
|
|
@multitable @columnfractions .80
|
3967 |
|
|
@item @code{CALL FDATE(DATE)}.
|
3968 |
|
|
@item @code{DATE = FDATE()}, (not recommended).
|
3969 |
|
|
@end multitable
|
3970 |
|
|
|
3971 |
|
|
@item @emph{Arguments}:
|
3972 |
|
|
@multitable @columnfractions .15 .70
|
3973 |
|
|
@item @var{DATE}@tab The type shall be of type @code{CHARACTER} of the
|
3974 |
|
|
default kind
|
3975 |
|
|
@end multitable
|
3976 |
|
|
|
3977 |
|
|
@item @emph{Return value}:
|
3978 |
|
|
The current date as a string.
|
3979 |
|
|
|
3980 |
|
|
@item @emph{Example}:
|
3981 |
|
|
@smallexample
|
3982 |
|
|
program test_fdate
|
3983 |
|
|
integer(8) :: i, j
|
3984 |
|
|
character(len=30) :: date
|
3985 |
|
|
call fdate(date)
|
3986 |
|
|
print *, 'Program started on ', date
|
3987 |
|
|
do i = 1, 100000000 ! Just a delay
|
3988 |
|
|
j = i * i - i
|
3989 |
|
|
end do
|
3990 |
|
|
call fdate(date)
|
3991 |
|
|
print *, 'Program ended on ', date
|
3992 |
|
|
end program test_fdate
|
3993 |
|
|
@end smallexample
|
3994 |
|
|
@end table
|
3995 |
|
|
|
3996 |
|
|
|
3997 |
|
|
|
3998 |
|
|
@node FLOAT
|
3999 |
|
|
@section @code{FLOAT} --- Convert integer to default real
|
4000 |
|
|
@fnindex FLOAT
|
4001 |
|
|
@cindex conversion, to real
|
4002 |
|
|
|
4003 |
|
|
@table @asis
|
4004 |
|
|
@item @emph{Description}:
|
4005 |
|
|
@code{FLOAT(A)} converts the integer @var{A} to a default real value.
|
4006 |
|
|
|
4007 |
|
|
@item @emph{Standard}:
|
4008 |
|
|
Fortran 77 and later
|
4009 |
|
|
|
4010 |
|
|
@item @emph{Class}:
|
4011 |
|
|
Elemental function
|
4012 |
|
|
|
4013 |
|
|
@item @emph{Syntax}:
|
4014 |
|
|
@code{RESULT = FLOAT(A)}
|
4015 |
|
|
|
4016 |
|
|
@item @emph{Arguments}:
|
4017 |
|
|
@multitable @columnfractions .15 .70
|
4018 |
|
|
@item @var{A} @tab The type shall be @code{INTEGER}.
|
4019 |
|
|
@end multitable
|
4020 |
|
|
|
4021 |
|
|
@item @emph{Return value}:
|
4022 |
|
|
The return value is of type default @code{REAL}.
|
4023 |
|
|
|
4024 |
|
|
@item @emph{Example}:
|
4025 |
|
|
@smallexample
|
4026 |
|
|
program test_float
|
4027 |
|
|
integer :: i = 1
|
4028 |
|
|
if (float(i) /= 1.) call abort
|
4029 |
|
|
end program test_float
|
4030 |
|
|
@end smallexample
|
4031 |
|
|
|
4032 |
|
|
@item @emph{See also}:
|
4033 |
|
|
@ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
|
4034 |
|
|
@end table
|
4035 |
|
|
|
4036 |
|
|
|
4037 |
|
|
|
4038 |
|
|
@node FGET
|
4039 |
|
|
@section @code{FGET} --- Read a single character in stream mode from stdin
|
4040 |
|
|
@fnindex FGET
|
4041 |
|
|
@cindex read character, stream mode
|
4042 |
|
|
@cindex stream mode, read character
|
4043 |
|
|
@cindex file operation, read character
|
4044 |
|
|
|
4045 |
|
|
@table @asis
|
4046 |
|
|
@item @emph{Description}:
|
4047 |
|
|
Read a single character in stream mode from stdin by bypassing normal
|
4048 |
|
|
formatted output. Stream I/O should not be mixed with normal record-oriented
|
4049 |
|
|
(formatted or unformatted) I/O on the same unit; the results are unpredictable.
|
4050 |
|
|
|
4051 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4052 |
|
|
only one form can be used in any given program unit.
|
4053 |
|
|
|
4054 |
|
|
Note that the @code{FGET} intrinsic is provided for backwards compatibility with
|
4055 |
|
|
@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
|
4056 |
|
|
Programmers should consider the use of new stream IO feature in new code
|
4057 |
|
|
for future portability. See also @ref{Fortran 2003 status}.
|
4058 |
|
|
|
4059 |
|
|
@item @emph{Standard}:
|
4060 |
|
|
GNU extension
|
4061 |
|
|
|
4062 |
|
|
@item @emph{Class}:
|
4063 |
|
|
Subroutine, function
|
4064 |
|
|
|
4065 |
|
|
@item @emph{Syntax}:
|
4066 |
|
|
@code{CALL FGET(C [, STATUS])}
|
4067 |
|
|
|
4068 |
|
|
@item @emph{Arguments}:
|
4069 |
|
|
@multitable @columnfractions .15 .70
|
4070 |
|
|
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
|
4071 |
|
|
kind.
|
4072 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
|
4073 |
|
|
Returns 0 on success, -1 on end-of-file, and a system specific positive
|
4074 |
|
|
error code otherwise.
|
4075 |
|
|
@end multitable
|
4076 |
|
|
|
4077 |
|
|
@item @emph{Example}:
|
4078 |
|
|
@smallexample
|
4079 |
|
|
PROGRAM test_fget
|
4080 |
|
|
INTEGER, PARAMETER :: strlen = 100
|
4081 |
|
|
INTEGER :: status, i = 1
|
4082 |
|
|
CHARACTER(len=strlen) :: str = ""
|
4083 |
|
|
|
4084 |
|
|
WRITE (*,*) 'Enter text:'
|
4085 |
|
|
DO
|
4086 |
|
|
CALL fget(str(i:i), status)
|
4087 |
|
|
if (status /= 0 .OR. i > strlen) exit
|
4088 |
|
|
i = i + 1
|
4089 |
|
|
END DO
|
4090 |
|
|
WRITE (*,*) TRIM(str)
|
4091 |
|
|
END PROGRAM
|
4092 |
|
|
@end smallexample
|
4093 |
|
|
|
4094 |
|
|
@item @emph{See also}:
|
4095 |
|
|
@ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
|
4096 |
|
|
@end table
|
4097 |
|
|
|
4098 |
|
|
|
4099 |
|
|
|
4100 |
|
|
@node FGETC
|
4101 |
|
|
@section @code{FGETC} --- Read a single character in stream mode
|
4102 |
|
|
@fnindex FGETC
|
4103 |
|
|
@cindex read character, stream mode
|
4104 |
|
|
@cindex stream mode, read character
|
4105 |
|
|
@cindex file operation, read character
|
4106 |
|
|
|
4107 |
|
|
@table @asis
|
4108 |
|
|
@item @emph{Description}:
|
4109 |
|
|
Read a single character in stream mode by bypassing normal formatted output.
|
4110 |
|
|
Stream I/O should not be mixed with normal record-oriented (formatted or
|
4111 |
|
|
unformatted) I/O on the same unit; the results are unpredictable.
|
4112 |
|
|
|
4113 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4114 |
|
|
only one form can be used in any given program unit.
|
4115 |
|
|
|
4116 |
|
|
Note that the @code{FGET} intrinsic is provided for backwards compatibility
|
4117 |
|
|
with @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
|
4118 |
|
|
Programmers should consider the use of new stream IO feature in new code
|
4119 |
|
|
for future portability. See also @ref{Fortran 2003 status}.
|
4120 |
|
|
|
4121 |
|
|
@item @emph{Standard}:
|
4122 |
|
|
GNU extension
|
4123 |
|
|
|
4124 |
|
|
@item @emph{Class}:
|
4125 |
|
|
Subroutine, function
|
4126 |
|
|
|
4127 |
|
|
@item @emph{Syntax}:
|
4128 |
|
|
@code{CALL FGETC(UNIT, C [, STATUS])}
|
4129 |
|
|
|
4130 |
|
|
@item @emph{Arguments}:
|
4131 |
|
|
@multitable @columnfractions .15 .70
|
4132 |
|
|
@item @var{UNIT} @tab The type shall be @code{INTEGER}.
|
4133 |
|
|
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
|
4134 |
|
|
kind.
|
4135 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
|
4136 |
|
|
Returns 0 on success, -1 on end-of-file and a system specific positive
|
4137 |
|
|
error code otherwise.
|
4138 |
|
|
@end multitable
|
4139 |
|
|
|
4140 |
|
|
@item @emph{Example}:
|
4141 |
|
|
@smallexample
|
4142 |
|
|
PROGRAM test_fgetc
|
4143 |
|
|
INTEGER :: fd = 42, status
|
4144 |
|
|
CHARACTER :: c
|
4145 |
|
|
|
4146 |
|
|
OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
|
4147 |
|
|
DO
|
4148 |
|
|
CALL fgetc(fd, c, status)
|
4149 |
|
|
IF (status /= 0) EXIT
|
4150 |
|
|
call fput(c)
|
4151 |
|
|
END DO
|
4152 |
|
|
CLOSE(UNIT=fd)
|
4153 |
|
|
END PROGRAM
|
4154 |
|
|
@end smallexample
|
4155 |
|
|
|
4156 |
|
|
@item @emph{See also}:
|
4157 |
|
|
@ref{FGET}, @ref{FPUT}, @ref{FPUTC}
|
4158 |
|
|
@end table
|
4159 |
|
|
|
4160 |
|
|
|
4161 |
|
|
|
4162 |
|
|
@node FLOOR
|
4163 |
|
|
@section @code{FLOOR} --- Integer floor function
|
4164 |
|
|
@fnindex FLOOR
|
4165 |
|
|
@cindex floor
|
4166 |
|
|
@cindex rounding, floor
|
4167 |
|
|
|
4168 |
|
|
@table @asis
|
4169 |
|
|
@item @emph{Description}:
|
4170 |
|
|
@code{FLOOR(A)} returns the greatest integer less than or equal to @var{X}.
|
4171 |
|
|
|
4172 |
|
|
@item @emph{Standard}:
|
4173 |
|
|
Fortran 95 and later
|
4174 |
|
|
|
4175 |
|
|
@item @emph{Class}:
|
4176 |
|
|
Elemental function
|
4177 |
|
|
|
4178 |
|
|
@item @emph{Syntax}:
|
4179 |
|
|
@code{RESULT = FLOOR(A [, KIND])}
|
4180 |
|
|
|
4181 |
|
|
@item @emph{Arguments}:
|
4182 |
|
|
@multitable @columnfractions .15 .70
|
4183 |
|
|
@item @var{A} @tab The type shall be @code{REAL}.
|
4184 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
4185 |
|
|
expression indicating the kind parameter of the result.
|
4186 |
|
|
@end multitable
|
4187 |
|
|
|
4188 |
|
|
@item @emph{Return value}:
|
4189 |
|
|
The return value is of type @code{INTEGER(KIND)} if @var{KIND} is present
|
4190 |
|
|
and of default-kind @code{INTEGER} otherwise.
|
4191 |
|
|
|
4192 |
|
|
@item @emph{Example}:
|
4193 |
|
|
@smallexample
|
4194 |
|
|
program test_floor
|
4195 |
|
|
real :: x = 63.29
|
4196 |
|
|
real :: y = -63.59
|
4197 |
|
|
print *, floor(x) ! returns 63
|
4198 |
|
|
print *, floor(y) ! returns -64
|
4199 |
|
|
end program test_floor
|
4200 |
|
|
@end smallexample
|
4201 |
|
|
|
4202 |
|
|
@item @emph{See also}:
|
4203 |
|
|
@ref{CEILING}, @ref{NINT}
|
4204 |
|
|
|
4205 |
|
|
@end table
|
4206 |
|
|
|
4207 |
|
|
|
4208 |
|
|
|
4209 |
|
|
@node FLUSH
|
4210 |
|
|
@section @code{FLUSH} --- Flush I/O unit(s)
|
4211 |
|
|
@fnindex FLUSH
|
4212 |
|
|
@cindex file operation, flush
|
4213 |
|
|
|
4214 |
|
|
@table @asis
|
4215 |
|
|
@item @emph{Description}:
|
4216 |
|
|
Flushes Fortran unit(s) currently open for output. Without the optional
|
4217 |
|
|
argument, all units are flushed, otherwise just the unit specified.
|
4218 |
|
|
|
4219 |
|
|
@item @emph{Standard}:
|
4220 |
|
|
GNU extension
|
4221 |
|
|
|
4222 |
|
|
@item @emph{Class}:
|
4223 |
|
|
Subroutine
|
4224 |
|
|
|
4225 |
|
|
@item @emph{Syntax}:
|
4226 |
|
|
@code{CALL FLUSH(UNIT)}
|
4227 |
|
|
|
4228 |
|
|
@item @emph{Arguments}:
|
4229 |
|
|
@multitable @columnfractions .15 .70
|
4230 |
|
|
@item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
|
4231 |
|
|
@end multitable
|
4232 |
|
|
|
4233 |
|
|
@item @emph{Note}:
|
4234 |
|
|
Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
|
4235 |
|
|
statement that should be preferred over the @code{FLUSH} intrinsic.
|
4236 |
|
|
|
4237 |
|
|
@end table
|
4238 |
|
|
|
4239 |
|
|
|
4240 |
|
|
|
4241 |
|
|
@node FNUM
|
4242 |
|
|
@section @code{FNUM} --- File number function
|
4243 |
|
|
@fnindex FNUM
|
4244 |
|
|
@cindex file operation, file number
|
4245 |
|
|
|
4246 |
|
|
@table @asis
|
4247 |
|
|
@item @emph{Description}:
|
4248 |
|
|
@code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
|
4249 |
|
|
open Fortran I/O unit @code{UNIT}.
|
4250 |
|
|
|
4251 |
|
|
@item @emph{Standard}:
|
4252 |
|
|
GNU extension
|
4253 |
|
|
|
4254 |
|
|
@item @emph{Class}:
|
4255 |
|
|
Function
|
4256 |
|
|
|
4257 |
|
|
@item @emph{Syntax}:
|
4258 |
|
|
@code{RESULT = FNUM(UNIT)}
|
4259 |
|
|
|
4260 |
|
|
@item @emph{Arguments}:
|
4261 |
|
|
@multitable @columnfractions .15 .70
|
4262 |
|
|
@item @var{UNIT} @tab The type shall be @code{INTEGER}.
|
4263 |
|
|
@end multitable
|
4264 |
|
|
|
4265 |
|
|
@item @emph{Return value}:
|
4266 |
|
|
The return value is of type @code{INTEGER}
|
4267 |
|
|
|
4268 |
|
|
@item @emph{Example}:
|
4269 |
|
|
@smallexample
|
4270 |
|
|
program test_fnum
|
4271 |
|
|
integer :: i
|
4272 |
|
|
open (unit=10, status = "scratch")
|
4273 |
|
|
i = fnum(10)
|
4274 |
|
|
print *, i
|
4275 |
|
|
close (10)
|
4276 |
|
|
end program test_fnum
|
4277 |
|
|
@end smallexample
|
4278 |
|
|
@end table
|
4279 |
|
|
|
4280 |
|
|
|
4281 |
|
|
|
4282 |
|
|
@node FPUT
|
4283 |
|
|
@section @code{FPUT} --- Write a single character in stream mode to stdout
|
4284 |
|
|
@fnindex FPUT
|
4285 |
|
|
@cindex write character, stream mode
|
4286 |
|
|
@cindex stream mode, write character
|
4287 |
|
|
@cindex file operation, write character
|
4288 |
|
|
|
4289 |
|
|
@table @asis
|
4290 |
|
|
@item @emph{Description}:
|
4291 |
|
|
Write a single character in stream mode to stdout by bypassing normal
|
4292 |
|
|
formatted output. Stream I/O should not be mixed with normal record-oriented
|
4293 |
|
|
(formatted or unformatted) I/O on the same unit; the results are unpredictable.
|
4294 |
|
|
|
4295 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4296 |
|
|
only one form can be used in any given program unit.
|
4297 |
|
|
|
4298 |
|
|
Note that the @code{FGET} intrinsic is provided for backwards compatibility with
|
4299 |
|
|
@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
|
4300 |
|
|
Programmers should consider the use of new stream IO feature in new code
|
4301 |
|
|
for future portability. See also @ref{Fortran 2003 status}.
|
4302 |
|
|
|
4303 |
|
|
@item @emph{Standard}:
|
4304 |
|
|
GNU extension
|
4305 |
|
|
|
4306 |
|
|
@item @emph{Class}:
|
4307 |
|
|
Subroutine, function
|
4308 |
|
|
|
4309 |
|
|
@item @emph{Syntax}:
|
4310 |
|
|
@code{CALL FPUT(C [, STATUS])}
|
4311 |
|
|
|
4312 |
|
|
@item @emph{Arguments}:
|
4313 |
|
|
@multitable @columnfractions .15 .70
|
4314 |
|
|
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
|
4315 |
|
|
kind.
|
4316 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
|
4317 |
|
|
Returns 0 on success, -1 on end-of-file and a system specific positive
|
4318 |
|
|
error code otherwise.
|
4319 |
|
|
@end multitable
|
4320 |
|
|
|
4321 |
|
|
@item @emph{Example}:
|
4322 |
|
|
@smallexample
|
4323 |
|
|
PROGRAM test_fput
|
4324 |
|
|
CHARACTER(len=10) :: str = "gfortran"
|
4325 |
|
|
INTEGER :: i
|
4326 |
|
|
DO i = 1, len_trim(str)
|
4327 |
|
|
CALL fput(str(i:i))
|
4328 |
|
|
END DO
|
4329 |
|
|
END PROGRAM
|
4330 |
|
|
@end smallexample
|
4331 |
|
|
|
4332 |
|
|
@item @emph{See also}:
|
4333 |
|
|
@ref{FPUTC}, @ref{FGET}, @ref{FGETC}
|
4334 |
|
|
@end table
|
4335 |
|
|
|
4336 |
|
|
|
4337 |
|
|
|
4338 |
|
|
@node FPUTC
|
4339 |
|
|
@section @code{FPUTC} --- Write a single character in stream mode
|
4340 |
|
|
@fnindex FPUTC
|
4341 |
|
|
@cindex write character, stream mode
|
4342 |
|
|
@cindex stream mode, write character
|
4343 |
|
|
@cindex file operation, write character
|
4344 |
|
|
|
4345 |
|
|
@table @asis
|
4346 |
|
|
@item @emph{Description}:
|
4347 |
|
|
Write a single character in stream mode by bypassing normal formatted
|
4348 |
|
|
output. Stream I/O should not be mixed with normal record-oriented
|
4349 |
|
|
(formatted or unformatted) I/O on the same unit; the results are unpredictable.
|
4350 |
|
|
|
4351 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4352 |
|
|
only one form can be used in any given program unit.
|
4353 |
|
|
|
4354 |
|
|
Note that the @code{FGET} intrinsic is provided for backwards compatibility with
|
4355 |
|
|
@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
|
4356 |
|
|
Programmers should consider the use of new stream IO feature in new code
|
4357 |
|
|
for future portability. See also @ref{Fortran 2003 status}.
|
4358 |
|
|
|
4359 |
|
|
@item @emph{Standard}:
|
4360 |
|
|
GNU extension
|
4361 |
|
|
|
4362 |
|
|
@item @emph{Class}:
|
4363 |
|
|
Subroutine, function
|
4364 |
|
|
|
4365 |
|
|
@item @emph{Syntax}:
|
4366 |
|
|
@code{CALL FPUTC(UNIT, C [, STATUS])}
|
4367 |
|
|
|
4368 |
|
|
@item @emph{Arguments}:
|
4369 |
|
|
@multitable @columnfractions .15 .70
|
4370 |
|
|
@item @var{UNIT} @tab The type shall be @code{INTEGER}.
|
4371 |
|
|
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
|
4372 |
|
|
kind.
|
4373 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
|
4374 |
|
|
Returns 0 on success, -1 on end-of-file and a system specific positive
|
4375 |
|
|
error code otherwise.
|
4376 |
|
|
@end multitable
|
4377 |
|
|
|
4378 |
|
|
@item @emph{Example}:
|
4379 |
|
|
@smallexample
|
4380 |
|
|
PROGRAM test_fputc
|
4381 |
|
|
CHARACTER(len=10) :: str = "gfortran"
|
4382 |
|
|
INTEGER :: fd = 42, i
|
4383 |
|
|
|
4384 |
|
|
OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
|
4385 |
|
|
DO i = 1, len_trim(str)
|
4386 |
|
|
CALL fputc(fd, str(i:i))
|
4387 |
|
|
END DO
|
4388 |
|
|
CLOSE(fd)
|
4389 |
|
|
END PROGRAM
|
4390 |
|
|
@end smallexample
|
4391 |
|
|
|
4392 |
|
|
@item @emph{See also}:
|
4393 |
|
|
@ref{FPUT}, @ref{FGET}, @ref{FGETC}
|
4394 |
|
|
@end table
|
4395 |
|
|
|
4396 |
|
|
|
4397 |
|
|
|
4398 |
|
|
@node FRACTION
|
4399 |
|
|
@section @code{FRACTION} --- Fractional part of the model representation
|
4400 |
|
|
@fnindex FRACTION
|
4401 |
|
|
@cindex real number, fraction
|
4402 |
|
|
@cindex floating point, fraction
|
4403 |
|
|
|
4404 |
|
|
@table @asis
|
4405 |
|
|
@item @emph{Description}:
|
4406 |
|
|
@code{FRACTION(X)} returns the fractional part of the model
|
4407 |
|
|
representation of @code{X}.
|
4408 |
|
|
|
4409 |
|
|
@item @emph{Standard}:
|
4410 |
|
|
Fortran 95 and later
|
4411 |
|
|
|
4412 |
|
|
@item @emph{Class}:
|
4413 |
|
|
Elemental function
|
4414 |
|
|
|
4415 |
|
|
@item @emph{Syntax}:
|
4416 |
|
|
@code{Y = FRACTION(X)}
|
4417 |
|
|
|
4418 |
|
|
@item @emph{Arguments}:
|
4419 |
|
|
@multitable @columnfractions .15 .70
|
4420 |
|
|
@item @var{X} @tab The type of the argument shall be a @code{REAL}.
|
4421 |
|
|
@end multitable
|
4422 |
|
|
|
4423 |
|
|
@item @emph{Return value}:
|
4424 |
|
|
The return value is of the same type and kind as the argument.
|
4425 |
|
|
The fractional part of the model representation of @code{X} is returned;
|
4426 |
|
|
it is @code{X * RADIX(X)**(-EXPONENT(X))}.
|
4427 |
|
|
|
4428 |
|
|
@item @emph{Example}:
|
4429 |
|
|
@smallexample
|
4430 |
|
|
program test_fraction
|
4431 |
|
|
real :: x
|
4432 |
|
|
x = 178.1387e-4
|
4433 |
|
|
print *, fraction(x), x * radix(x)**(-exponent(x))
|
4434 |
|
|
end program test_fraction
|
4435 |
|
|
@end smallexample
|
4436 |
|
|
|
4437 |
|
|
@end table
|
4438 |
|
|
|
4439 |
|
|
|
4440 |
|
|
|
4441 |
|
|
@node FREE
|
4442 |
|
|
@section @code{FREE} --- Frees memory
|
4443 |
|
|
@fnindex FREE
|
4444 |
|
|
@cindex pointer, cray
|
4445 |
|
|
|
4446 |
|
|
@table @asis
|
4447 |
|
|
@item @emph{Description}:
|
4448 |
|
|
Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
|
4449 |
|
|
intrinsic is an extension intended to be used with Cray pointers, and is
|
4450 |
|
|
provided in GNU Fortran to allow user to compile legacy code. For
|
4451 |
|
|
new code using Fortran 95 pointers, the memory de-allocation intrinsic is
|
4452 |
|
|
@code{DEALLOCATE}.
|
4453 |
|
|
|
4454 |
|
|
@item @emph{Standard}:
|
4455 |
|
|
GNU extension
|
4456 |
|
|
|
4457 |
|
|
@item @emph{Class}:
|
4458 |
|
|
Subroutine
|
4459 |
|
|
|
4460 |
|
|
@item @emph{Syntax}:
|
4461 |
|
|
@code{CALL FREE(PTR)}
|
4462 |
|
|
|
4463 |
|
|
@item @emph{Arguments}:
|
4464 |
|
|
@multitable @columnfractions .15 .70
|
4465 |
|
|
@item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
|
4466 |
|
|
location of the memory that should be de-allocated.
|
4467 |
|
|
@end multitable
|
4468 |
|
|
|
4469 |
|
|
@item @emph{Return value}:
|
4470 |
|
|
None
|
4471 |
|
|
|
4472 |
|
|
@item @emph{Example}:
|
4473 |
|
|
See @code{MALLOC} for an example.
|
4474 |
|
|
|
4475 |
|
|
@item @emph{See also}:
|
4476 |
|
|
@ref{MALLOC}
|
4477 |
|
|
@end table
|
4478 |
|
|
|
4479 |
|
|
|
4480 |
|
|
|
4481 |
|
|
@node FSEEK
|
4482 |
|
|
@section @code{FSEEK} --- Low level file positioning subroutine
|
4483 |
|
|
@fnindex FSEEK
|
4484 |
|
|
@cindex file operation, seek
|
4485 |
|
|
@cindex file operation, position
|
4486 |
|
|
|
4487 |
|
|
@table @asis
|
4488 |
|
|
@item @emph{Description}:
|
4489 |
|
|
Moves @var{UNIT} to the specified @var{OFFSET}. If @var{WHENCE}
|
4490 |
|
|
is set to 0, the @var{OFFSET} is taken as an absolute value @code{SEEK_SET},
|
4491 |
|
|
if set to 1, @var{OFFSET} is taken to be relative to the current position
|
4492 |
|
|
@code{SEEK_CUR}, and if set to 2 relative to the end of the file @code{SEEK_END}.
|
4493 |
|
|
On error, @var{STATUS} is set to a nonzero value. If @var{STATUS} the seek
|
4494 |
|
|
fails silently.
|
4495 |
|
|
|
4496 |
|
|
This intrinsic routine is not fully backwards compatible with @command{g77}.
|
4497 |
|
|
In @command{g77}, the @code{FSEEK} takes a statement label instead of a
|
4498 |
|
|
@var{STATUS} variable. If FSEEK is used in old code, change
|
4499 |
|
|
@smallexample
|
4500 |
|
|
CALL FSEEK(UNIT, OFFSET, WHENCE, *label)
|
4501 |
|
|
@end smallexample
|
4502 |
|
|
to
|
4503 |
|
|
@smallexample
|
4504 |
|
|
INTEGER :: status
|
4505 |
|
|
CALL FSEEK(UNIT, OFFSET, WHENCE, status)
|
4506 |
|
|
IF (status /= 0) GOTO label
|
4507 |
|
|
@end smallexample
|
4508 |
|
|
|
4509 |
|
|
Please note that GNU Fortran provides the Fortran 2003 Stream facility.
|
4510 |
|
|
Programmers should consider the use of new stream IO feature in new code
|
4511 |
|
|
for future portability. See also @ref{Fortran 2003 status}.
|
4512 |
|
|
|
4513 |
|
|
@item @emph{Standard}:
|
4514 |
|
|
GNU extension
|
4515 |
|
|
|
4516 |
|
|
@item @emph{Class}:
|
4517 |
|
|
Subroutine
|
4518 |
|
|
|
4519 |
|
|
@item @emph{Syntax}:
|
4520 |
|
|
@code{CALL FSEEK(UNIT, OFFSET, WHENCE[, STATUS])}
|
4521 |
|
|
|
4522 |
|
|
@item @emph{Arguments}:
|
4523 |
|
|
@multitable @columnfractions .15 .70
|
4524 |
|
|
@item @var{UNIT} @tab Shall be a scalar of type @code{INTEGER}.
|
4525 |
|
|
@item @var{OFFSET} @tab Shall be a scalar of type @code{INTEGER}.
|
4526 |
|
|
@item @var{WHENCE} @tab Shall be a scalar of type @code{INTEGER}.
|
4527 |
|
|
Its value shall be either 0, 1 or 2.
|
4528 |
|
|
@item @var{STATUS} @tab (Optional) shall be a scalar of type
|
4529 |
|
|
@code{INTEGER(4)}.
|
4530 |
|
|
@end multitable
|
4531 |
|
|
|
4532 |
|
|
@item @emph{Example}:
|
4533 |
|
|
@smallexample
|
4534 |
|
|
PROGRAM test_fseek
|
4535 |
|
|
INTEGER, PARAMETER :: SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2
|
4536 |
|
|
INTEGER :: fd, offset, ierr
|
4537 |
|
|
|
4538 |
|
|
ierr = 0
|
4539 |
|
|
offset = 5
|
4540 |
|
|
fd = 10
|
4541 |
|
|
|
4542 |
|
|
OPEN(UNIT=fd, FILE="fseek.test")
|
4543 |
|
|
CALL FSEEK(fd, offset, SEEK_SET, ierr) ! move to OFFSET
|
4544 |
|
|
print *, FTELL(fd), ierr
|
4545 |
|
|
|
4546 |
|
|
CALL FSEEK(fd, 0, SEEK_END, ierr) ! move to end
|
4547 |
|
|
print *, FTELL(fd), ierr
|
4548 |
|
|
|
4549 |
|
|
CALL FSEEK(fd, 0, SEEK_SET, ierr) ! move to beginning
|
4550 |
|
|
print *, FTELL(fd), ierr
|
4551 |
|
|
|
4552 |
|
|
CLOSE(UNIT=fd)
|
4553 |
|
|
END PROGRAM
|
4554 |
|
|
@end smallexample
|
4555 |
|
|
|
4556 |
|
|
@item @emph{See also}:
|
4557 |
|
|
@ref{FTELL}
|
4558 |
|
|
@end table
|
4559 |
|
|
|
4560 |
|
|
|
4561 |
|
|
|
4562 |
|
|
@node FSTAT
|
4563 |
|
|
@section @code{FSTAT} --- Get file status
|
4564 |
|
|
@fnindex FSTAT
|
4565 |
|
|
@cindex file system, file status
|
4566 |
|
|
|
4567 |
|
|
@table @asis
|
4568 |
|
|
@item @emph{Description}:
|
4569 |
|
|
@code{FSTAT} is identical to @ref{STAT}, except that information about an
|
4570 |
|
|
already opened file is obtained.
|
4571 |
|
|
|
4572 |
|
|
The elements in @code{VALUES} are the same as described by @ref{STAT}.
|
4573 |
|
|
|
4574 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4575 |
|
|
only one form can be used in any given program unit.
|
4576 |
|
|
|
4577 |
|
|
@item @emph{Standard}:
|
4578 |
|
|
GNU extension
|
4579 |
|
|
|
4580 |
|
|
@item @emph{Class}:
|
4581 |
|
|
Subroutine, function
|
4582 |
|
|
|
4583 |
|
|
@item @emph{Syntax}:
|
4584 |
|
|
@code{CALL FSTAT(UNIT, VALUES [, STATUS])}
|
4585 |
|
|
|
4586 |
|
|
@item @emph{Arguments}:
|
4587 |
|
|
@multitable @columnfractions .15 .70
|
4588 |
|
|
@item @var{UNIT} @tab An open I/O unit number of type @code{INTEGER}.
|
4589 |
|
|
@item @var{VALUES} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
|
4590 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
|
4591 |
|
|
on success and a system specific error code otherwise.
|
4592 |
|
|
@end multitable
|
4593 |
|
|
|
4594 |
|
|
@item @emph{Example}:
|
4595 |
|
|
See @ref{STAT} for an example.
|
4596 |
|
|
|
4597 |
|
|
@item @emph{See also}:
|
4598 |
|
|
To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
|
4599 |
|
|
@end table
|
4600 |
|
|
|
4601 |
|
|
|
4602 |
|
|
|
4603 |
|
|
@node FTELL
|
4604 |
|
|
@section @code{FTELL} --- Current stream position
|
4605 |
|
|
@fnindex FTELL
|
4606 |
|
|
@cindex file operation, position
|
4607 |
|
|
|
4608 |
|
|
@table @asis
|
4609 |
|
|
@item @emph{Description}:
|
4610 |
|
|
Retrieves the current position within an open file.
|
4611 |
|
|
|
4612 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4613 |
|
|
only one form can be used in any given program unit.
|
4614 |
|
|
|
4615 |
|
|
@item @emph{Standard}:
|
4616 |
|
|
GNU extension
|
4617 |
|
|
|
4618 |
|
|
@item @emph{Class}:
|
4619 |
|
|
Subroutine, function
|
4620 |
|
|
|
4621 |
|
|
@item @emph{Syntax}:
|
4622 |
|
|
@multitable @columnfractions .80
|
4623 |
|
|
@item @code{CALL FTELL(UNIT, OFFSET)}
|
4624 |
|
|
@item @code{OFFSET = FTELL(UNIT)}
|
4625 |
|
|
@end multitable
|
4626 |
|
|
|
4627 |
|
|
@item @emph{Arguments}:
|
4628 |
|
|
@multitable @columnfractions .15 .70
|
4629 |
|
|
@item @var{OFFSET} @tab Shall of type @code{INTEGER}.
|
4630 |
|
|
@item @var{UNIT} @tab Shall of type @code{INTEGER}.
|
4631 |
|
|
@end multitable
|
4632 |
|
|
|
4633 |
|
|
@item @emph{Return value}:
|
4634 |
|
|
In either syntax, @var{OFFSET} is set to the current offset of unit
|
4635 |
|
|
number @var{UNIT}, or to @math{-1} if the unit is not currently open.
|
4636 |
|
|
|
4637 |
|
|
@item @emph{Example}:
|
4638 |
|
|
@smallexample
|
4639 |
|
|
PROGRAM test_ftell
|
4640 |
|
|
INTEGER :: i
|
4641 |
|
|
OPEN(10, FILE="temp.dat")
|
4642 |
|
|
CALL ftell(10,i)
|
4643 |
|
|
WRITE(*,*) i
|
4644 |
|
|
END PROGRAM
|
4645 |
|
|
@end smallexample
|
4646 |
|
|
|
4647 |
|
|
@item @emph{See also}:
|
4648 |
|
|
@ref{FSEEK}
|
4649 |
|
|
@end table
|
4650 |
|
|
|
4651 |
|
|
|
4652 |
|
|
|
4653 |
|
|
@node GAMMA
|
4654 |
|
|
@section @code{GAMMA} --- Gamma function
|
4655 |
|
|
@fnindex GAMMA
|
4656 |
|
|
@fnindex DGAMMA
|
4657 |
|
|
@cindex Gamma function
|
4658 |
|
|
@cindex Factorial function
|
4659 |
|
|
|
4660 |
|
|
@table @asis
|
4661 |
|
|
@item @emph{Description}:
|
4662 |
|
|
@code{GAMMA(X)} computes Gamma (@math{\Gamma}) of @var{X}. For positive,
|
4663 |
|
|
integer values of @var{X} the Gamma function simplifies to the factorial
|
4664 |
|
|
function @math{\Gamma(x)=(x-1)!}.
|
4665 |
|
|
|
4666 |
|
|
@tex
|
4667 |
|
|
$$
|
4668 |
|
|
\Gamma(x) = \int_0^\infty t^{x-1}{\rm e}^{-t}\,{\rm d}t
|
4669 |
|
|
$$
|
4670 |
|
|
@end tex
|
4671 |
|
|
|
4672 |
|
|
@item @emph{Standard}:
|
4673 |
|
|
Fortran 2008 and later
|
4674 |
|
|
|
4675 |
|
|
@item @emph{Class}:
|
4676 |
|
|
Elemental function
|
4677 |
|
|
|
4678 |
|
|
@item @emph{Syntax}:
|
4679 |
|
|
@code{X = GAMMA(X)}
|
4680 |
|
|
|
4681 |
|
|
@item @emph{Arguments}:
|
4682 |
|
|
@multitable @columnfractions .15 .70
|
4683 |
|
|
@item @var{X} @tab Shall be of type @code{REAL} and neither zero
|
4684 |
|
|
nor a negative integer.
|
4685 |
|
|
@end multitable
|
4686 |
|
|
|
4687 |
|
|
@item @emph{Return value}:
|
4688 |
|
|
The return value is of type @code{REAL} of the same kind as @var{X}.
|
4689 |
|
|
|
4690 |
|
|
@item @emph{Example}:
|
4691 |
|
|
@smallexample
|
4692 |
|
|
program test_gamma
|
4693 |
|
|
real :: x = 1.0
|
4694 |
|
|
x = gamma(x) ! returns 1.0
|
4695 |
|
|
end program test_gamma
|
4696 |
|
|
@end smallexample
|
4697 |
|
|
|
4698 |
|
|
@item @emph{Specific names}:
|
4699 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
4700 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
4701 |
|
|
@item @code{GAMMA(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab GNU Extension
|
4702 |
|
|
@item @code{DGAMMA(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU Extension
|
4703 |
|
|
@end multitable
|
4704 |
|
|
|
4705 |
|
|
@item @emph{See also}:
|
4706 |
|
|
Logarithm of the Gamma function: @ref{LOG_GAMMA}
|
4707 |
|
|
|
4708 |
|
|
@end table
|
4709 |
|
|
|
4710 |
|
|
|
4711 |
|
|
|
4712 |
|
|
@node GERROR
|
4713 |
|
|
@section @code{GERROR} --- Get last system error message
|
4714 |
|
|
@fnindex GERROR
|
4715 |
|
|
@cindex system, error handling
|
4716 |
|
|
|
4717 |
|
|
@table @asis
|
4718 |
|
|
@item @emph{Description}:
|
4719 |
|
|
Returns the system error message corresponding to the last system error.
|
4720 |
|
|
This resembles the functionality of @code{strerror(3)} in C.
|
4721 |
|
|
|
4722 |
|
|
@item @emph{Standard}:
|
4723 |
|
|
GNU extension
|
4724 |
|
|
|
4725 |
|
|
@item @emph{Class}:
|
4726 |
|
|
Subroutine
|
4727 |
|
|
|
4728 |
|
|
@item @emph{Syntax}:
|
4729 |
|
|
@code{CALL GERROR(RESULT)}
|
4730 |
|
|
|
4731 |
|
|
@item @emph{Arguments}:
|
4732 |
|
|
@multitable @columnfractions .15 .70
|
4733 |
|
|
@item @var{RESULT} @tab Shall of type @code{CHARACTER} and of default
|
4734 |
|
|
@end multitable
|
4735 |
|
|
|
4736 |
|
|
@item @emph{Example}:
|
4737 |
|
|
@smallexample
|
4738 |
|
|
PROGRAM test_gerror
|
4739 |
|
|
CHARACTER(len=100) :: msg
|
4740 |
|
|
CALL gerror(msg)
|
4741 |
|
|
WRITE(*,*) msg
|
4742 |
|
|
END PROGRAM
|
4743 |
|
|
@end smallexample
|
4744 |
|
|
|
4745 |
|
|
@item @emph{See also}:
|
4746 |
|
|
@ref{IERRNO}, @ref{PERROR}
|
4747 |
|
|
@end table
|
4748 |
|
|
|
4749 |
|
|
|
4750 |
|
|
|
4751 |
|
|
@node GETARG
|
4752 |
|
|
@section @code{GETARG} --- Get command line arguments
|
4753 |
|
|
@fnindex GETARG
|
4754 |
|
|
@cindex command-line arguments
|
4755 |
|
|
@cindex arguments, to program
|
4756 |
|
|
|
4757 |
|
|
@table @asis
|
4758 |
|
|
@item @emph{Description}:
|
4759 |
|
|
Retrieve the @var{POS}-th argument that was passed on the
|
4760 |
|
|
command line when the containing program was invoked.
|
4761 |
|
|
|
4762 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
4763 |
|
|
GNU Fortran 77. In new code, programmers should consider the use of
|
4764 |
|
|
the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003
|
4765 |
|
|
standard.
|
4766 |
|
|
|
4767 |
|
|
@item @emph{Standard}:
|
4768 |
|
|
GNU extension
|
4769 |
|
|
|
4770 |
|
|
@item @emph{Class}:
|
4771 |
|
|
Subroutine
|
4772 |
|
|
|
4773 |
|
|
@item @emph{Syntax}:
|
4774 |
|
|
@code{CALL GETARG(POS, VALUE)}
|
4775 |
|
|
|
4776 |
|
|
@item @emph{Arguments}:
|
4777 |
|
|
@multitable @columnfractions .15 .70
|
4778 |
|
|
@item @var{POS} @tab Shall be of type @code{INTEGER} and not wider than
|
4779 |
|
|
the default integer kind; @math{@var{POS} \geq 0}
|
4780 |
|
|
@item @var{VALUE} @tab Shall be of type @code{CHARACTER} and of default
|
4781 |
|
|
kind.
|
4782 |
|
|
@item @var{VALUE} @tab Shall be of type @code{CHARACTER}.
|
4783 |
|
|
@end multitable
|
4784 |
|
|
|
4785 |
|
|
@item @emph{Return value}:
|
4786 |
|
|
After @code{GETARG} returns, the @var{VALUE} argument holds the
|
4787 |
|
|
@var{POS}th command line argument. If @var{VALUE} can not hold the
|
4788 |
|
|
argument, it is truncated to fit the length of @var{VALUE}. If there are
|
4789 |
|
|
less than @var{POS} arguments specified at the command line, @var{VALUE}
|
4790 |
|
|
will be filled with blanks. If @math{@var{POS} = 0}, @var{VALUE} is set
|
4791 |
|
|
to the name of the program (on systems that support this feature).
|
4792 |
|
|
|
4793 |
|
|
@item @emph{Example}:
|
4794 |
|
|
@smallexample
|
4795 |
|
|
PROGRAM test_getarg
|
4796 |
|
|
INTEGER :: i
|
4797 |
|
|
CHARACTER(len=32) :: arg
|
4798 |
|
|
|
4799 |
|
|
DO i = 1, iargc()
|
4800 |
|
|
CALL getarg(i, arg)
|
4801 |
|
|
WRITE (*,*) arg
|
4802 |
|
|
END DO
|
4803 |
|
|
END PROGRAM
|
4804 |
|
|
@end smallexample
|
4805 |
|
|
|
4806 |
|
|
@item @emph{See also}:
|
4807 |
|
|
GNU Fortran 77 compatibility function: @ref{IARGC}
|
4808 |
|
|
|
4809 |
|
|
Fortran 2003 functions and subroutines: @ref{GET_COMMAND},
|
4810 |
|
|
@ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
|
4811 |
|
|
@end table
|
4812 |
|
|
|
4813 |
|
|
|
4814 |
|
|
|
4815 |
|
|
@node GET_COMMAND
|
4816 |
|
|
@section @code{GET_COMMAND} --- Get the entire command line
|
4817 |
|
|
@fnindex GET_COMMAND
|
4818 |
|
|
@cindex command-line arguments
|
4819 |
|
|
@cindex arguments, to program
|
4820 |
|
|
|
4821 |
|
|
@table @asis
|
4822 |
|
|
@item @emph{Description}:
|
4823 |
|
|
Retrieve the entire command line that was used to invoke the program.
|
4824 |
|
|
|
4825 |
|
|
@item @emph{Standard}:
|
4826 |
|
|
Fortran 2003 and later
|
4827 |
|
|
|
4828 |
|
|
@item @emph{Class}:
|
4829 |
|
|
Subroutine
|
4830 |
|
|
|
4831 |
|
|
@item @emph{Syntax}:
|
4832 |
|
|
@code{CALL GET_COMMAND([COMMAND, LENGTH, STATUS])}
|
4833 |
|
|
|
4834 |
|
|
@item @emph{Arguments}:
|
4835 |
|
|
@multitable @columnfractions .15 .70
|
4836 |
|
|
@item @var{COMMAND} @tab (Optional) shall be of type @code{CHARACTER} and
|
4837 |
|
|
of default kind.
|
4838 |
|
|
@item @var{LENGTH} @tab (Optional) Shall be of type @code{INTEGER} and of
|
4839 |
|
|
default kind.
|
4840 |
|
|
@item @var{STATUS} @tab (Optional) Shall be of type @code{INTEGER} and of
|
4841 |
|
|
default kind.
|
4842 |
|
|
@end multitable
|
4843 |
|
|
|
4844 |
|
|
@item @emph{Return value}:
|
4845 |
|
|
If @var{COMMAND} is present, stores the entire command line that was used
|
4846 |
|
|
to invoke the program in @var{COMMAND}. If @var{LENGTH} is present, it is
|
4847 |
|
|
assigned the length of the command line. If @var{STATUS} is present, it
|
4848 |
|
|
is assigned 0 upon success of the command, -1 if @var{COMMAND} is too
|
4849 |
|
|
short to store the command line, or a positive value in case of an error.
|
4850 |
|
|
|
4851 |
|
|
@item @emph{Example}:
|
4852 |
|
|
@smallexample
|
4853 |
|
|
PROGRAM test_get_command
|
4854 |
|
|
CHARACTER(len=255) :: cmd
|
4855 |
|
|
CALL get_command(cmd)
|
4856 |
|
|
WRITE (*,*) TRIM(cmd)
|
4857 |
|
|
END PROGRAM
|
4858 |
|
|
@end smallexample
|
4859 |
|
|
|
4860 |
|
|
@item @emph{See also}:
|
4861 |
|
|
@ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
|
4862 |
|
|
@end table
|
4863 |
|
|
|
4864 |
|
|
|
4865 |
|
|
|
4866 |
|
|
@node GET_COMMAND_ARGUMENT
|
4867 |
|
|
@section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
|
4868 |
|
|
@fnindex GET_COMMAND_ARGUMENT
|
4869 |
|
|
@cindex command-line arguments
|
4870 |
|
|
@cindex arguments, to program
|
4871 |
|
|
|
4872 |
|
|
@table @asis
|
4873 |
|
|
@item @emph{Description}:
|
4874 |
|
|
Retrieve the @var{NUMBER}-th argument that was passed on the
|
4875 |
|
|
command line when the containing program was invoked.
|
4876 |
|
|
|
4877 |
|
|
@item @emph{Standard}:
|
4878 |
|
|
Fortran 2003 and later
|
4879 |
|
|
|
4880 |
|
|
@item @emph{Class}:
|
4881 |
|
|
Subroutine
|
4882 |
|
|
|
4883 |
|
|
@item @emph{Syntax}:
|
4884 |
|
|
@code{CALL GET_COMMAND_ARGUMENT(NUMBER [, VALUE, LENGTH, STATUS])}
|
4885 |
|
|
|
4886 |
|
|
@item @emph{Arguments}:
|
4887 |
|
|
@multitable @columnfractions .15 .70
|
4888 |
|
|
@item @var{NUMBER} @tab Shall be a scalar of type @code{INTEGER} and of
|
4889 |
|
|
default kind, @math{@var{NUMBER} \geq 0}
|
4890 |
|
|
@item @var{VALUE} @tab Shall be a scalar of type @code{CHARACTER}
|
4891 |
|
|
and of default kind.
|
4892 |
|
|
@item @var{LENGTH} @tab (Option) Shall be a scalar of type @code{INTEGER}
|
4893 |
|
|
and of default kind.
|
4894 |
|
|
@item @var{STATUS} @tab (Option) Shall be a scalar of type @code{INTEGER}
|
4895 |
|
|
and of default kind.
|
4896 |
|
|
@end multitable
|
4897 |
|
|
|
4898 |
|
|
@item @emph{Return value}:
|
4899 |
|
|
After @code{GET_COMMAND_ARGUMENT} returns, the @var{VALUE} argument holds the
|
4900 |
|
|
@var{NUMBER}-th command line argument. If @var{VALUE} can not hold the argument, it is
|
4901 |
|
|
truncated to fit the length of @var{VALUE}. If there are less than @var{NUMBER}
|
4902 |
|
|
arguments specified at the command line, @var{VALUE} will be filled with blanks.
|
4903 |
|
|
If @math{@var{NUMBER} = 0}, @var{VALUE} is set to the name of the program (on
|
4904 |
|
|
systems that support this feature). The @var{LENGTH} argument contains the
|
4905 |
|
|
length of the @var{NUMBER}-th command line argument. If the argument retrieval
|
4906 |
|
|
fails, @var{STATUS} is a positive number; if @var{VALUE} contains a truncated
|
4907 |
|
|
command line argument, @var{STATUS} is -1; and otherwise the @var{STATUS} is
|
4908 |
|
|
zero.
|
4909 |
|
|
|
4910 |
|
|
@item @emph{Example}:
|
4911 |
|
|
@smallexample
|
4912 |
|
|
PROGRAM test_get_command_argument
|
4913 |
|
|
INTEGER :: i
|
4914 |
|
|
CHARACTER(len=32) :: arg
|
4915 |
|
|
|
4916 |
|
|
i = 0
|
4917 |
|
|
DO
|
4918 |
|
|
CALL get_command_argument(i, arg)
|
4919 |
|
|
IF (LEN_TRIM(arg) == 0) EXIT
|
4920 |
|
|
|
4921 |
|
|
WRITE (*,*) TRIM(arg)
|
4922 |
|
|
i = i+1
|
4923 |
|
|
END DO
|
4924 |
|
|
END PROGRAM
|
4925 |
|
|
@end smallexample
|
4926 |
|
|
|
4927 |
|
|
@item @emph{See also}:
|
4928 |
|
|
@ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
|
4929 |
|
|
@end table
|
4930 |
|
|
|
4931 |
|
|
|
4932 |
|
|
|
4933 |
|
|
@node GETCWD
|
4934 |
|
|
@section @code{GETCWD} --- Get current working directory
|
4935 |
|
|
@fnindex GETCWD
|
4936 |
|
|
@cindex system, working directory
|
4937 |
|
|
|
4938 |
|
|
@table @asis
|
4939 |
|
|
@item @emph{Description}:
|
4940 |
|
|
Get current working directory.
|
4941 |
|
|
|
4942 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
4943 |
|
|
only one form can be used in any given program unit.
|
4944 |
|
|
|
4945 |
|
|
@item @emph{Standard}:
|
4946 |
|
|
GNU extension
|
4947 |
|
|
|
4948 |
|
|
@item @emph{Class}:
|
4949 |
|
|
Subroutine, function
|
4950 |
|
|
|
4951 |
|
|
@item @emph{Syntax}:
|
4952 |
|
|
@code{CALL GETCWD(C [, STATUS])}
|
4953 |
|
|
|
4954 |
|
|
@item @emph{Arguments}:
|
4955 |
|
|
@multitable @columnfractions .15 .70
|
4956 |
|
|
@item @var{C} @tab The type shall be @code{CHARACTER} and of default kind.
|
4957 |
|
|
@item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
|
4958 |
|
|
a system specific and nonzero error code otherwise.
|
4959 |
|
|
@end multitable
|
4960 |
|
|
|
4961 |
|
|
@item @emph{Example}:
|
4962 |
|
|
@smallexample
|
4963 |
|
|
PROGRAM test_getcwd
|
4964 |
|
|
CHARACTER(len=255) :: cwd
|
4965 |
|
|
CALL getcwd(cwd)
|
4966 |
|
|
WRITE(*,*) TRIM(cwd)
|
4967 |
|
|
END PROGRAM
|
4968 |
|
|
@end smallexample
|
4969 |
|
|
|
4970 |
|
|
@item @emph{See also}:
|
4971 |
|
|
@ref{CHDIR}
|
4972 |
|
|
@end table
|
4973 |
|
|
|
4974 |
|
|
|
4975 |
|
|
|
4976 |
|
|
@node GETENV
|
4977 |
|
|
@section @code{GETENV} --- Get an environmental variable
|
4978 |
|
|
@fnindex GETENV
|
4979 |
|
|
@cindex environment variable
|
4980 |
|
|
|
4981 |
|
|
@table @asis
|
4982 |
|
|
@item @emph{Description}:
|
4983 |
|
|
Get the @var{VALUE} of the environmental variable @var{NAME}.
|
4984 |
|
|
|
4985 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
4986 |
|
|
GNU Fortran 77. In new code, programmers should consider the use of
|
4987 |
|
|
the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
|
4988 |
|
|
2003 standard.
|
4989 |
|
|
|
4990 |
|
|
@item @emph{Standard}:
|
4991 |
|
|
GNU extension
|
4992 |
|
|
|
4993 |
|
|
@item @emph{Class}:
|
4994 |
|
|
Subroutine
|
4995 |
|
|
|
4996 |
|
|
@item @emph{Syntax}:
|
4997 |
|
|
@code{CALL GETENV(NAME, VALUE)}
|
4998 |
|
|
|
4999 |
|
|
@item @emph{Arguments}:
|
5000 |
|
|
@multitable @columnfractions .15 .70
|
5001 |
|
|
@item @var{NAME} @tab Shall be of type @code{CHARACTER} and of default kind.
|
5002 |
|
|
@item @var{VALUE} @tab Shall be of type @code{CHARACTER} and of default kind.
|
5003 |
|
|
@end multitable
|
5004 |
|
|
|
5005 |
|
|
@item @emph{Return value}:
|
5006 |
|
|
Stores the value of @var{NAME} in @var{VALUE}. If @var{VALUE} is
|
5007 |
|
|
not large enough to hold the data, it is truncated. If @var{NAME}
|
5008 |
|
|
is not set, @var{VALUE} will be filled with blanks.
|
5009 |
|
|
|
5010 |
|
|
@item @emph{Example}:
|
5011 |
|
|
@smallexample
|
5012 |
|
|
PROGRAM test_getenv
|
5013 |
|
|
CHARACTER(len=255) :: homedir
|
5014 |
|
|
CALL getenv("HOME", homedir)
|
5015 |
|
|
WRITE (*,*) TRIM(homedir)
|
5016 |
|
|
END PROGRAM
|
5017 |
|
|
@end smallexample
|
5018 |
|
|
|
5019 |
|
|
@item @emph{See also}:
|
5020 |
|
|
@ref{GET_ENVIRONMENT_VARIABLE}
|
5021 |
|
|
@end table
|
5022 |
|
|
|
5023 |
|
|
|
5024 |
|
|
|
5025 |
|
|
@node GET_ENVIRONMENT_VARIABLE
|
5026 |
|
|
@section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
|
5027 |
|
|
@fnindex GET_ENVIRONMENT_VARIABLE
|
5028 |
|
|
@cindex environment variable
|
5029 |
|
|
|
5030 |
|
|
@table @asis
|
5031 |
|
|
@item @emph{Description}:
|
5032 |
|
|
Get the @var{VALUE} of the environmental variable @var{NAME}.
|
5033 |
|
|
|
5034 |
|
|
@item @emph{Standard}:
|
5035 |
|
|
Fortran 2003 and later
|
5036 |
|
|
|
5037 |
|
|
@item @emph{Class}:
|
5038 |
|
|
Subroutine
|
5039 |
|
|
|
5040 |
|
|
@item @emph{Syntax}:
|
5041 |
|
|
@code{CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS, TRIM_NAME)}
|
5042 |
|
|
|
5043 |
|
|
@item @emph{Arguments}:
|
5044 |
|
|
@multitable @columnfractions .15 .70
|
5045 |
|
|
@item @var{NAME} @tab Shall be a scalar of type @code{CHARACTER}
|
5046 |
|
|
and of default kind.
|
5047 |
|
|
@item @var{VALUE} @tab Shall be a scalar of type @code{CHARACTER}
|
5048 |
|
|
and of default kind.
|
5049 |
|
|
@item @var{LENGTH} @tab Shall be a scalar of type @code{INTEGER}
|
5050 |
|
|
and of default kind.
|
5051 |
|
|
@item @var{STATUS} @tab Shall be a scalar of type @code{INTEGER}
|
5052 |
|
|
and of default kind.
|
5053 |
|
|
@item @var{TRIM_NAME} @tab Shall be a scalar of type @code{LOGICAL}
|
5054 |
|
|
and of default kind.
|
5055 |
|
|
@end multitable
|
5056 |
|
|
|
5057 |
|
|
@item @emph{Return value}:
|
5058 |
|
|
Stores the value of @var{NAME} in @var{VALUE}. If @var{VALUE} is
|
5059 |
|
|
not large enough to hold the data, it is truncated. If @var{NAME}
|
5060 |
|
|
is not set, @var{VALUE} will be filled with blanks. Argument @var{LENGTH}
|
5061 |
|
|
contains the length needed for storing the environment variable @var{NAME}
|
5062 |
|
|
or zero if it is not present. @var{STATUS} is -1 if @var{VALUE} is present
|
5063 |
|
|
but too short for the environment variable; it is 1 if the environment
|
5064 |
|
|
variable does not exist and 2 if the processor does not support environment
|
5065 |
|
|
variables; in all other cases @var{STATUS} is zero. If @var{TRIM_NAME} is
|
5066 |
|
|
present with the value @code{.FALSE.}, the trailing blanks in @var{NAME}
|
5067 |
|
|
are significant; otherwise they are not part of the environment variable
|
5068 |
|
|
name.
|
5069 |
|
|
|
5070 |
|
|
@item @emph{Example}:
|
5071 |
|
|
@smallexample
|
5072 |
|
|
PROGRAM test_getenv
|
5073 |
|
|
CHARACTER(len=255) :: homedir
|
5074 |
|
|
CALL get_environment_variable("HOME", homedir)
|
5075 |
|
|
WRITE (*,*) TRIM(homedir)
|
5076 |
|
|
END PROGRAM
|
5077 |
|
|
@end smallexample
|
5078 |
|
|
@end table
|
5079 |
|
|
|
5080 |
|
|
|
5081 |
|
|
|
5082 |
|
|
@node GETGID
|
5083 |
|
|
@section @code{GETGID} --- Group ID function
|
5084 |
|
|
@fnindex GETGID
|
5085 |
|
|
@cindex system, group id
|
5086 |
|
|
|
5087 |
|
|
@table @asis
|
5088 |
|
|
@item @emph{Description}:
|
5089 |
|
|
Returns the numerical group ID of the current process.
|
5090 |
|
|
|
5091 |
|
|
@item @emph{Standard}:
|
5092 |
|
|
GNU extension
|
5093 |
|
|
|
5094 |
|
|
@item @emph{Class}:
|
5095 |
|
|
Function
|
5096 |
|
|
|
5097 |
|
|
@item @emph{Syntax}:
|
5098 |
|
|
@code{RESULT = GETGID()}
|
5099 |
|
|
|
5100 |
|
|
@item @emph{Return value}:
|
5101 |
|
|
The return value of @code{GETGID} is an @code{INTEGER} of the default
|
5102 |
|
|
kind.
|
5103 |
|
|
|
5104 |
|
|
|
5105 |
|
|
@item @emph{Example}:
|
5106 |
|
|
See @code{GETPID} for an example.
|
5107 |
|
|
|
5108 |
|
|
@item @emph{See also}:
|
5109 |
|
|
@ref{GETPID}, @ref{GETUID}
|
5110 |
|
|
@end table
|
5111 |
|
|
|
5112 |
|
|
|
5113 |
|
|
|
5114 |
|
|
@node GETLOG
|
5115 |
|
|
@section @code{GETLOG} --- Get login name
|
5116 |
|
|
@fnindex GETLOG
|
5117 |
|
|
@cindex system, login name
|
5118 |
|
|
@cindex login name
|
5119 |
|
|
|
5120 |
|
|
@table @asis
|
5121 |
|
|
@item @emph{Description}:
|
5122 |
|
|
Gets the username under which the program is running.
|
5123 |
|
|
|
5124 |
|
|
@item @emph{Standard}:
|
5125 |
|
|
GNU extension
|
5126 |
|
|
|
5127 |
|
|
@item @emph{Class}:
|
5128 |
|
|
Subroutine
|
5129 |
|
|
|
5130 |
|
|
@item @emph{Syntax}:
|
5131 |
|
|
@code{CALL GETLOG(C)}
|
5132 |
|
|
|
5133 |
|
|
@item @emph{Arguments}:
|
5134 |
|
|
@multitable @columnfractions .15 .70
|
5135 |
|
|
@item @var{C} @tab Shall be of type @code{CHARACTER} and of default kind.
|
5136 |
|
|
@end multitable
|
5137 |
|
|
|
5138 |
|
|
@item @emph{Return value}:
|
5139 |
|
|
Stores the current user name in @var{LOGIN}. (On systems where POSIX
|
5140 |
|
|
functions @code{geteuid} and @code{getpwuid} are not available, and
|
5141 |
|
|
the @code{getlogin} function is not implemented either, this will
|
5142 |
|
|
return a blank string.)
|
5143 |
|
|
|
5144 |
|
|
@item @emph{Example}:
|
5145 |
|
|
@smallexample
|
5146 |
|
|
PROGRAM TEST_GETLOG
|
5147 |
|
|
CHARACTER(32) :: login
|
5148 |
|
|
CALL GETLOG(login)
|
5149 |
|
|
WRITE(*,*) login
|
5150 |
|
|
END PROGRAM
|
5151 |
|
|
@end smallexample
|
5152 |
|
|
|
5153 |
|
|
@item @emph{See also}:
|
5154 |
|
|
@ref{GETUID}
|
5155 |
|
|
@end table
|
5156 |
|
|
|
5157 |
|
|
|
5158 |
|
|
|
5159 |
|
|
@node GETPID
|
5160 |
|
|
@section @code{GETPID} --- Process ID function
|
5161 |
|
|
@fnindex GETPID
|
5162 |
|
|
@cindex system, process id
|
5163 |
|
|
@cindex process id
|
5164 |
|
|
|
5165 |
|
|
@table @asis
|
5166 |
|
|
@item @emph{Description}:
|
5167 |
|
|
Returns the numerical process identifier of the current process.
|
5168 |
|
|
|
5169 |
|
|
@item @emph{Standard}:
|
5170 |
|
|
GNU extension
|
5171 |
|
|
|
5172 |
|
|
@item @emph{Class}:
|
5173 |
|
|
Function
|
5174 |
|
|
|
5175 |
|
|
@item @emph{Syntax}:
|
5176 |
|
|
@code{RESULT = GETPID()}
|
5177 |
|
|
|
5178 |
|
|
@item @emph{Return value}:
|
5179 |
|
|
The return value of @code{GETPID} is an @code{INTEGER} of the default
|
5180 |
|
|
kind.
|
5181 |
|
|
|
5182 |
|
|
|
5183 |
|
|
@item @emph{Example}:
|
5184 |
|
|
@smallexample
|
5185 |
|
|
program info
|
5186 |
|
|
print *, "The current process ID is ", getpid()
|
5187 |
|
|
print *, "Your numerical user ID is ", getuid()
|
5188 |
|
|
print *, "Your numerical group ID is ", getgid()
|
5189 |
|
|
end program info
|
5190 |
|
|
@end smallexample
|
5191 |
|
|
|
5192 |
|
|
@item @emph{See also}:
|
5193 |
|
|
@ref{GETGID}, @ref{GETUID}
|
5194 |
|
|
@end table
|
5195 |
|
|
|
5196 |
|
|
|
5197 |
|
|
|
5198 |
|
|
@node GETUID
|
5199 |
|
|
@section @code{GETUID} --- User ID function
|
5200 |
|
|
@fnindex GETUID
|
5201 |
|
|
@cindex system, user id
|
5202 |
|
|
@cindex user id
|
5203 |
|
|
|
5204 |
|
|
@table @asis
|
5205 |
|
|
@item @emph{Description}:
|
5206 |
|
|
Returns the numerical user ID of the current process.
|
5207 |
|
|
|
5208 |
|
|
@item @emph{Standard}:
|
5209 |
|
|
GNU extension
|
5210 |
|
|
|
5211 |
|
|
@item @emph{Class}:
|
5212 |
|
|
Function
|
5213 |
|
|
|
5214 |
|
|
@item @emph{Syntax}:
|
5215 |
|
|
@code{RESULT = GETUID()}
|
5216 |
|
|
|
5217 |
|
|
@item @emph{Return value}:
|
5218 |
|
|
The return value of @code{GETUID} is an @code{INTEGER} of the default
|
5219 |
|
|
kind.
|
5220 |
|
|
|
5221 |
|
|
|
5222 |
|
|
@item @emph{Example}:
|
5223 |
|
|
See @code{GETPID} for an example.
|
5224 |
|
|
|
5225 |
|
|
@item @emph{See also}:
|
5226 |
|
|
@ref{GETPID}, @ref{GETLOG}
|
5227 |
|
|
@end table
|
5228 |
|
|
|
5229 |
|
|
|
5230 |
|
|
|
5231 |
|
|
@node GMTIME
|
5232 |
|
|
@section @code{GMTIME} --- Convert time to GMT info
|
5233 |
|
|
@fnindex GMTIME
|
5234 |
|
|
@cindex time, conversion to GMT info
|
5235 |
|
|
|
5236 |
|
|
@table @asis
|
5237 |
|
|
@item @emph{Description}:
|
5238 |
|
|
Given a system time value @var{TIME} (as provided by the @code{TIME8()}
|
5239 |
|
|
intrinsic), fills @var{VALUES} with values extracted from it appropriate
|
5240 |
|
|
to the UTC time zone (Universal Coordinated Time, also known in some
|
5241 |
|
|
countries as GMT, Greenwich Mean Time), using @code{gmtime(3)}.
|
5242 |
|
|
|
5243 |
|
|
@item @emph{Standard}:
|
5244 |
|
|
GNU extension
|
5245 |
|
|
|
5246 |
|
|
@item @emph{Class}:
|
5247 |
|
|
Subroutine
|
5248 |
|
|
|
5249 |
|
|
@item @emph{Syntax}:
|
5250 |
|
|
@code{CALL GMTIME(TIME, VALUES)}
|
5251 |
|
|
|
5252 |
|
|
@item @emph{Arguments}:
|
5253 |
|
|
@multitable @columnfractions .15 .70
|
5254 |
|
|
@item @var{TIME} @tab An @code{INTEGER} scalar expression
|
5255 |
|
|
corresponding to a system time, with @code{INTENT(IN)}.
|
5256 |
|
|
@item @var{VALUES} @tab A default @code{INTEGER} array with 9 elements,
|
5257 |
|
|
with @code{INTENT(OUT)}.
|
5258 |
|
|
@end multitable
|
5259 |
|
|
|
5260 |
|
|
@item @emph{Return value}:
|
5261 |
|
|
The elements of @var{VALUES} are assigned as follows:
|
5262 |
|
|
@enumerate
|
5263 |
|
|
@item Seconds after the minute, range 0--59 or 0--61 to allow for leap
|
5264 |
|
|
seconds
|
5265 |
|
|
@item Minutes after the hour, range 0--59
|
5266 |
|
|
@item Hours past midnight, range 0--23
|
5267 |
|
|
@item Day of month, range 0--31
|
5268 |
|
|
@item Number of months since January, range 0--12
|
5269 |
|
|
@item Years since 1900
|
5270 |
|
|
@item Number of days since Sunday, range 0--6
|
5271 |
|
|
@item Days since January 1
|
5272 |
|
|
@item Daylight savings indicator: positive if daylight savings is in
|
5273 |
|
|
effect, zero if not, and negative if the information is not available.
|
5274 |
|
|
@end enumerate
|
5275 |
|
|
|
5276 |
|
|
@item @emph{See also}:
|
5277 |
|
|
@ref{CTIME}, @ref{LTIME}, @ref{TIME}, @ref{TIME8}
|
5278 |
|
|
|
5279 |
|
|
@end table
|
5280 |
|
|
|
5281 |
|
|
|
5282 |
|
|
|
5283 |
|
|
@node HOSTNM
|
5284 |
|
|
@section @code{HOSTNM} --- Get system host name
|
5285 |
|
|
@fnindex HOSTNM
|
5286 |
|
|
@cindex system, host name
|
5287 |
|
|
|
5288 |
|
|
@table @asis
|
5289 |
|
|
@item @emph{Description}:
|
5290 |
|
|
Retrieves the host name of the system on which the program is running.
|
5291 |
|
|
|
5292 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
5293 |
|
|
only one form can be used in any given program unit.
|
5294 |
|
|
|
5295 |
|
|
@item @emph{Standard}:
|
5296 |
|
|
GNU extension
|
5297 |
|
|
|
5298 |
|
|
@item @emph{Class}:
|
5299 |
|
|
Subroutine, function
|
5300 |
|
|
|
5301 |
|
|
@item @emph{Syntax}:
|
5302 |
|
|
@multitable @columnfractions .80
|
5303 |
|
|
@item @code{CALL HOSTNM(C [, STATUS])}
|
5304 |
|
|
@item @code{STATUS = HOSTNM(NAME)}
|
5305 |
|
|
@end multitable
|
5306 |
|
|
|
5307 |
|
|
@item @emph{Arguments}:
|
5308 |
|
|
@multitable @columnfractions .15 .70
|
5309 |
|
|
@item @var{C} @tab Shall of type @code{CHARACTER} and of default kind.
|
5310 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
|
5311 |
|
|
Returns 0 on success, or a system specific error code otherwise.
|
5312 |
|
|
@end multitable
|
5313 |
|
|
|
5314 |
|
|
@item @emph{Return value}:
|
5315 |
|
|
In either syntax, @var{NAME} is set to the current hostname if it can
|
5316 |
|
|
be obtained, or to a blank string otherwise.
|
5317 |
|
|
|
5318 |
|
|
@end table
|
5319 |
|
|
|
5320 |
|
|
|
5321 |
|
|
|
5322 |
|
|
@node HUGE
|
5323 |
|
|
@section @code{HUGE} --- Largest number of a kind
|
5324 |
|
|
@fnindex HUGE
|
5325 |
|
|
@cindex limits, largest number
|
5326 |
|
|
@cindex model representation, largest number
|
5327 |
|
|
|
5328 |
|
|
@table @asis
|
5329 |
|
|
@item @emph{Description}:
|
5330 |
|
|
@code{HUGE(X)} returns the largest number that is not an infinity in
|
5331 |
|
|
the model of the type of @code{X}.
|
5332 |
|
|
|
5333 |
|
|
@item @emph{Standard}:
|
5334 |
|
|
Fortran 95 and later
|
5335 |
|
|
|
5336 |
|
|
@item @emph{Class}:
|
5337 |
|
|
Inquiry function
|
5338 |
|
|
|
5339 |
|
|
@item @emph{Syntax}:
|
5340 |
|
|
@code{RESULT = HUGE(X)}
|
5341 |
|
|
|
5342 |
|
|
@item @emph{Arguments}:
|
5343 |
|
|
@multitable @columnfractions .15 .70
|
5344 |
|
|
@item @var{X} @tab Shall be of type @code{REAL} or @code{INTEGER}.
|
5345 |
|
|
@end multitable
|
5346 |
|
|
|
5347 |
|
|
@item @emph{Return value}:
|
5348 |
|
|
The return value is of the same type and kind as @var{X}
|
5349 |
|
|
|
5350 |
|
|
@item @emph{Example}:
|
5351 |
|
|
@smallexample
|
5352 |
|
|
program test_huge_tiny
|
5353 |
|
|
print *, huge(0), huge(0.0), huge(0.0d0)
|
5354 |
|
|
print *, tiny(0.0), tiny(0.0d0)
|
5355 |
|
|
end program test_huge_tiny
|
5356 |
|
|
@end smallexample
|
5357 |
|
|
@end table
|
5358 |
|
|
|
5359 |
|
|
|
5360 |
|
|
|
5361 |
|
|
@node HYPOT
|
5362 |
|
|
@section @code{HYPOT} --- Euclidean distance function
|
5363 |
|
|
@fnindex HYPOT
|
5364 |
|
|
@cindex Euclidean distance
|
5365 |
|
|
|
5366 |
|
|
@table @asis
|
5367 |
|
|
@item @emph{Description}:
|
5368 |
|
|
@code{HYPOT(X,Y)} is the Euclidean distance function. It is equal to
|
5369 |
|
|
@math{\sqrt{X^2 + Y^2}}, without undue underflow or overflow.
|
5370 |
|
|
|
5371 |
|
|
@item @emph{Standard}:
|
5372 |
|
|
Fortran 2008 and later
|
5373 |
|
|
|
5374 |
|
|
@item @emph{Class}:
|
5375 |
|
|
Elemental function
|
5376 |
|
|
|
5377 |
|
|
@item @emph{Syntax}:
|
5378 |
|
|
@code{RESULT = HYPOT(X, Y)}
|
5379 |
|
|
|
5380 |
|
|
@item @emph{Arguments}:
|
5381 |
|
|
@multitable @columnfractions .15 .70
|
5382 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
5383 |
|
|
@item @var{Y} @tab The type and kind type parameter shall be the same as
|
5384 |
|
|
@var{X}.
|
5385 |
|
|
@end multitable
|
5386 |
|
|
|
5387 |
|
|
@item @emph{Return value}:
|
5388 |
|
|
The return value has the same type and kind type parameter as @var{X}.
|
5389 |
|
|
|
5390 |
|
|
@item @emph{Example}:
|
5391 |
|
|
@smallexample
|
5392 |
|
|
program test_hypot
|
5393 |
|
|
real(4) :: x = 1.e0_4, y = 0.5e0_4
|
5394 |
|
|
x = hypot(x,y)
|
5395 |
|
|
end program test_hypot
|
5396 |
|
|
@end smallexample
|
5397 |
|
|
@end table
|
5398 |
|
|
|
5399 |
|
|
|
5400 |
|
|
|
5401 |
|
|
@node IACHAR
|
5402 |
|
|
@section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence
|
5403 |
|
|
@fnindex IACHAR
|
5404 |
|
|
@cindex @acronym{ASCII} collating sequence
|
5405 |
|
|
@cindex collating sequence, @acronym{ASCII}
|
5406 |
|
|
@cindex conversion, to integer
|
5407 |
|
|
|
5408 |
|
|
@table @asis
|
5409 |
|
|
@item @emph{Description}:
|
5410 |
|
|
@code{IACHAR(C)} returns the code for the @acronym{ASCII} character
|
5411 |
|
|
in the first character position of @code{C}.
|
5412 |
|
|
|
5413 |
|
|
@item @emph{Standard}:
|
5414 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
5415 |
|
|
|
5416 |
|
|
@item @emph{Class}:
|
5417 |
|
|
Elemental function
|
5418 |
|
|
|
5419 |
|
|
@item @emph{Syntax}:
|
5420 |
|
|
@code{RESULT = IACHAR(C [, KIND])}
|
5421 |
|
|
|
5422 |
|
|
@item @emph{Arguments}:
|
5423 |
|
|
@multitable @columnfractions .15 .70
|
5424 |
|
|
@item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
|
5425 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
5426 |
|
|
expression indicating the kind parameter of the result.
|
5427 |
|
|
@end multitable
|
5428 |
|
|
|
5429 |
|
|
@item @emph{Return value}:
|
5430 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
5431 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
5432 |
|
|
|
5433 |
|
|
@item @emph{Example}:
|
5434 |
|
|
@smallexample
|
5435 |
|
|
program test_iachar
|
5436 |
|
|
integer i
|
5437 |
|
|
i = iachar(' ')
|
5438 |
|
|
end program test_iachar
|
5439 |
|
|
@end smallexample
|
5440 |
|
|
|
5441 |
|
|
@item @emph{Note}:
|
5442 |
|
|
See @ref{ICHAR} for a discussion of converting between numerical values
|
5443 |
|
|
and formatted string representations.
|
5444 |
|
|
|
5445 |
|
|
@item @emph{See also}:
|
5446 |
|
|
@ref{ACHAR}, @ref{CHAR}, @ref{ICHAR}
|
5447 |
|
|
|
5448 |
|
|
@end table
|
5449 |
|
|
|
5450 |
|
|
|
5451 |
|
|
|
5452 |
|
|
@node IAND
|
5453 |
|
|
@section @code{IAND} --- Bitwise logical and
|
5454 |
|
|
@fnindex IAND
|
5455 |
|
|
@cindex bitwise logical and
|
5456 |
|
|
@cindex logical and, bitwise
|
5457 |
|
|
|
5458 |
|
|
@table @asis
|
5459 |
|
|
@item @emph{Description}:
|
5460 |
|
|
Bitwise logical @code{AND}.
|
5461 |
|
|
|
5462 |
|
|
@item @emph{Standard}:
|
5463 |
|
|
Fortran 95 and later
|
5464 |
|
|
|
5465 |
|
|
@item @emph{Class}:
|
5466 |
|
|
Elemental function
|
5467 |
|
|
|
5468 |
|
|
@item @emph{Syntax}:
|
5469 |
|
|
@code{RESULT = IAND(I, J)}
|
5470 |
|
|
|
5471 |
|
|
@item @emph{Arguments}:
|
5472 |
|
|
@multitable @columnfractions .15 .70
|
5473 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
5474 |
|
|
@item @var{J} @tab The type shall be @code{INTEGER}, of the same
|
5475 |
|
|
kind as @var{I}. (As a GNU extension, different kinds are also
|
5476 |
|
|
permitted.)
|
5477 |
|
|
@end multitable
|
5478 |
|
|
|
5479 |
|
|
@item @emph{Return value}:
|
5480 |
|
|
The return type is @code{INTEGER}, of the same kind as the
|
5481 |
|
|
arguments. (If the argument kinds differ, it is of the same kind as
|
5482 |
|
|
the larger argument.)
|
5483 |
|
|
|
5484 |
|
|
@item @emph{Example}:
|
5485 |
|
|
@smallexample
|
5486 |
|
|
PROGRAM test_iand
|
5487 |
|
|
INTEGER :: a, b
|
5488 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
5489 |
|
|
WRITE (*,*) IAND(a, b)
|
5490 |
|
|
END PROGRAM
|
5491 |
|
|
@end smallexample
|
5492 |
|
|
|
5493 |
|
|
@item @emph{See also}:
|
5494 |
|
|
@ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
|
5495 |
|
|
|
5496 |
|
|
@end table
|
5497 |
|
|
|
5498 |
|
|
|
5499 |
|
|
|
5500 |
|
|
@node IARGC
|
5501 |
|
|
@section @code{IARGC} --- Get the number of command line arguments
|
5502 |
|
|
@fnindex IARGC
|
5503 |
|
|
@cindex command-line arguments
|
5504 |
|
|
@cindex command-line arguments, number of
|
5505 |
|
|
@cindex arguments, to program
|
5506 |
|
|
|
5507 |
|
|
@table @asis
|
5508 |
|
|
@item @emph{Description}:
|
5509 |
|
|
@code{IARGC()} returns the number of arguments passed on the
|
5510 |
|
|
command line when the containing program was invoked.
|
5511 |
|
|
|
5512 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
5513 |
|
|
GNU Fortran 77. In new code, programmers should consider the use of
|
5514 |
|
|
the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003
|
5515 |
|
|
standard.
|
5516 |
|
|
|
5517 |
|
|
@item @emph{Standard}:
|
5518 |
|
|
GNU extension
|
5519 |
|
|
|
5520 |
|
|
@item @emph{Class}:
|
5521 |
|
|
Function
|
5522 |
|
|
|
5523 |
|
|
@item @emph{Syntax}:
|
5524 |
|
|
@code{RESULT = IARGC()}
|
5525 |
|
|
|
5526 |
|
|
@item @emph{Arguments}:
|
5527 |
|
|
None.
|
5528 |
|
|
|
5529 |
|
|
@item @emph{Return value}:
|
5530 |
|
|
The number of command line arguments, type @code{INTEGER(4)}.
|
5531 |
|
|
|
5532 |
|
|
@item @emph{Example}:
|
5533 |
|
|
See @ref{GETARG}
|
5534 |
|
|
|
5535 |
|
|
@item @emph{See also}:
|
5536 |
|
|
GNU Fortran 77 compatibility subroutine: @ref{GETARG}
|
5537 |
|
|
|
5538 |
|
|
Fortran 2003 functions and subroutines: @ref{GET_COMMAND},
|
5539 |
|
|
@ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
|
5540 |
|
|
@end table
|
5541 |
|
|
|
5542 |
|
|
|
5543 |
|
|
|
5544 |
|
|
@node IBCLR
|
5545 |
|
|
@section @code{IBCLR} --- Clear bit
|
5546 |
|
|
@fnindex IBCLR
|
5547 |
|
|
@cindex bits, unset
|
5548 |
|
|
@cindex bits, clear
|
5549 |
|
|
|
5550 |
|
|
@table @asis
|
5551 |
|
|
@item @emph{Description}:
|
5552 |
|
|
@code{IBCLR} returns the value of @var{I} with the bit at position
|
5553 |
|
|
@var{POS} set to zero.
|
5554 |
|
|
|
5555 |
|
|
@item @emph{Standard}:
|
5556 |
|
|
Fortran 95 and later
|
5557 |
|
|
|
5558 |
|
|
@item @emph{Class}:
|
5559 |
|
|
Elemental function
|
5560 |
|
|
|
5561 |
|
|
@item @emph{Syntax}:
|
5562 |
|
|
@code{RESULT = IBCLR(I, POS)}
|
5563 |
|
|
|
5564 |
|
|
@item @emph{Arguments}:
|
5565 |
|
|
@multitable @columnfractions .15 .70
|
5566 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
5567 |
|
|
@item @var{POS} @tab The type shall be @code{INTEGER}.
|
5568 |
|
|
@end multitable
|
5569 |
|
|
|
5570 |
|
|
@item @emph{Return value}:
|
5571 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
5572 |
|
|
@var{I}.
|
5573 |
|
|
|
5574 |
|
|
@item @emph{See also}:
|
5575 |
|
|
@ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}, @ref{MVBITS}
|
5576 |
|
|
|
5577 |
|
|
@end table
|
5578 |
|
|
|
5579 |
|
|
|
5580 |
|
|
|
5581 |
|
|
@node IBITS
|
5582 |
|
|
@section @code{IBITS} --- Bit extraction
|
5583 |
|
|
@fnindex IBITS
|
5584 |
|
|
@cindex bits, get
|
5585 |
|
|
@cindex bits, extract
|
5586 |
|
|
|
5587 |
|
|
@table @asis
|
5588 |
|
|
@item @emph{Description}:
|
5589 |
|
|
@code{IBITS} extracts a field of length @var{LEN} from @var{I},
|
5590 |
|
|
starting from bit position @var{POS} and extending left for @var{LEN}
|
5591 |
|
|
bits. The result is right-justified and the remaining bits are
|
5592 |
|
|
zeroed. The value of @code{POS+LEN} must be less than or equal to the
|
5593 |
|
|
value @code{BIT_SIZE(I)}.
|
5594 |
|
|
|
5595 |
|
|
@item @emph{Standard}:
|
5596 |
|
|
Fortran 95 and later
|
5597 |
|
|
|
5598 |
|
|
@item @emph{Class}:
|
5599 |
|
|
Elemental function
|
5600 |
|
|
|
5601 |
|
|
@item @emph{Syntax}:
|
5602 |
|
|
@code{RESULT = IBITS(I, POS, LEN)}
|
5603 |
|
|
|
5604 |
|
|
@item @emph{Arguments}:
|
5605 |
|
|
@multitable @columnfractions .15 .70
|
5606 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
5607 |
|
|
@item @var{POS} @tab The type shall be @code{INTEGER}.
|
5608 |
|
|
@item @var{LEN} @tab The type shall be @code{INTEGER}.
|
5609 |
|
|
@end multitable
|
5610 |
|
|
|
5611 |
|
|
@item @emph{Return value}:
|
5612 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
5613 |
|
|
@var{I}.
|
5614 |
|
|
|
5615 |
|
|
@item @emph{See also}:
|
5616 |
|
|
@ref{BIT_SIZE}, @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
|
5617 |
|
|
@end table
|
5618 |
|
|
|
5619 |
|
|
|
5620 |
|
|
|
5621 |
|
|
@node IBSET
|
5622 |
|
|
@section @code{IBSET} --- Set bit
|
5623 |
|
|
@fnindex IBSET
|
5624 |
|
|
@cindex bits, set
|
5625 |
|
|
|
5626 |
|
|
@table @asis
|
5627 |
|
|
@item @emph{Description}:
|
5628 |
|
|
@code{IBSET} returns the value of @var{I} with the bit at position
|
5629 |
|
|
@var{POS} set to one.
|
5630 |
|
|
|
5631 |
|
|
@item @emph{Standard}:
|
5632 |
|
|
Fortran 95 and later
|
5633 |
|
|
|
5634 |
|
|
@item @emph{Class}:
|
5635 |
|
|
Elemental function
|
5636 |
|
|
|
5637 |
|
|
@item @emph{Syntax}:
|
5638 |
|
|
@code{RESULT = IBSET(I, POS)}
|
5639 |
|
|
|
5640 |
|
|
@item @emph{Arguments}:
|
5641 |
|
|
@multitable @columnfractions .15 .70
|
5642 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
5643 |
|
|
@item @var{POS} @tab The type shall be @code{INTEGER}.
|
5644 |
|
|
@end multitable
|
5645 |
|
|
|
5646 |
|
|
@item @emph{Return value}:
|
5647 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
5648 |
|
|
@var{I}.
|
5649 |
|
|
|
5650 |
|
|
@item @emph{See also}:
|
5651 |
|
|
@ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}, @ref{MVBITS}
|
5652 |
|
|
|
5653 |
|
|
@end table
|
5654 |
|
|
|
5655 |
|
|
|
5656 |
|
|
|
5657 |
|
|
@node ICHAR
|
5658 |
|
|
@section @code{ICHAR} --- Character-to-integer conversion function
|
5659 |
|
|
@fnindex ICHAR
|
5660 |
|
|
@cindex conversion, to integer
|
5661 |
|
|
|
5662 |
|
|
@table @asis
|
5663 |
|
|
@item @emph{Description}:
|
5664 |
|
|
@code{ICHAR(C)} returns the code for the character in the first character
|
5665 |
|
|
position of @code{C} in the system's native character set.
|
5666 |
|
|
The correspondence between characters and their codes is not necessarily
|
5667 |
|
|
the same across different GNU Fortran implementations.
|
5668 |
|
|
|
5669 |
|
|
@item @emph{Standard}:
|
5670 |
|
|
Fortan 95 and later, with @var{KIND} argument Fortran 2003 and later
|
5671 |
|
|
|
5672 |
|
|
@item @emph{Class}:
|
5673 |
|
|
Elemental function
|
5674 |
|
|
|
5675 |
|
|
@item @emph{Syntax}:
|
5676 |
|
|
@code{RESULT = ICHAR(C [, KIND])}
|
5677 |
|
|
|
5678 |
|
|
@item @emph{Arguments}:
|
5679 |
|
|
@multitable @columnfractions .15 .70
|
5680 |
|
|
@item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
|
5681 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
5682 |
|
|
expression indicating the kind parameter of the result.
|
5683 |
|
|
@end multitable
|
5684 |
|
|
|
5685 |
|
|
@item @emph{Return value}:
|
5686 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
5687 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
5688 |
|
|
|
5689 |
|
|
@item @emph{Example}:
|
5690 |
|
|
@smallexample
|
5691 |
|
|
program test_ichar
|
5692 |
|
|
integer i
|
5693 |
|
|
i = ichar(' ')
|
5694 |
|
|
end program test_ichar
|
5695 |
|
|
@end smallexample
|
5696 |
|
|
|
5697 |
|
|
@item @emph{Note}:
|
5698 |
|
|
No intrinsic exists to convert between a numeric value and a formatted
|
5699 |
|
|
character string representation -- for instance, given the
|
5700 |
|
|
@code{CHARACTER} value @code{'154'}, obtaining an @code{INTEGER} or
|
5701 |
|
|
@code{REAL} value with the value 154, or vice versa. Instead, this
|
5702 |
|
|
functionality is provided by internal-file I/O, as in the following
|
5703 |
|
|
example:
|
5704 |
|
|
@smallexample
|
5705 |
|
|
program read_val
|
5706 |
|
|
integer value
|
5707 |
|
|
character(len=10) string, string2
|
5708 |
|
|
string = '154'
|
5709 |
|
|
|
5710 |
|
|
! Convert a string to a numeric value
|
5711 |
|
|
read (string,'(I10)') value
|
5712 |
|
|
print *, value
|
5713 |
|
|
|
5714 |
|
|
! Convert a value to a formatted string
|
5715 |
|
|
write (string2,'(I10)') value
|
5716 |
|
|
print *, string2
|
5717 |
|
|
end program read_val
|
5718 |
|
|
@end smallexample
|
5719 |
|
|
|
5720 |
|
|
@item @emph{See also}:
|
5721 |
|
|
@ref{ACHAR}, @ref{CHAR}, @ref{IACHAR}
|
5722 |
|
|
|
5723 |
|
|
@end table
|
5724 |
|
|
|
5725 |
|
|
|
5726 |
|
|
|
5727 |
|
|
@node IDATE
|
5728 |
|
|
@section @code{IDATE} --- Get current local time subroutine (day/month/year)
|
5729 |
|
|
@fnindex IDATE
|
5730 |
|
|
@cindex date, current
|
5731 |
|
|
@cindex current date
|
5732 |
|
|
|
5733 |
|
|
@table @asis
|
5734 |
|
|
@item @emph{Description}:
|
5735 |
|
|
@code{IDATE(VALUES)} Fills @var{VALUES} with the numerical values at the
|
5736 |
|
|
current local time. The day (in the range 1-31), month (in the range 1-12),
|
5737 |
|
|
and year appear in elements 1, 2, and 3 of @var{VALUES}, respectively.
|
5738 |
|
|
The year has four significant digits.
|
5739 |
|
|
|
5740 |
|
|
@item @emph{Standard}:
|
5741 |
|
|
GNU extension
|
5742 |
|
|
|
5743 |
|
|
@item @emph{Class}:
|
5744 |
|
|
Subroutine
|
5745 |
|
|
|
5746 |
|
|
@item @emph{Syntax}:
|
5747 |
|
|
@code{CALL IDATE(VALUES)}
|
5748 |
|
|
|
5749 |
|
|
@item @emph{Arguments}:
|
5750 |
|
|
@multitable @columnfractions .15 .70
|
5751 |
|
|
@item @var{VALUES} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
|
5752 |
|
|
the kind shall be the default integer kind.
|
5753 |
|
|
@end multitable
|
5754 |
|
|
|
5755 |
|
|
@item @emph{Return value}:
|
5756 |
|
|
Does not return anything.
|
5757 |
|
|
|
5758 |
|
|
@item @emph{Example}:
|
5759 |
|
|
@smallexample
|
5760 |
|
|
program test_idate
|
5761 |
|
|
integer, dimension(3) :: tarray
|
5762 |
|
|
call idate(tarray)
|
5763 |
|
|
print *, tarray(1)
|
5764 |
|
|
print *, tarray(2)
|
5765 |
|
|
print *, tarray(3)
|
5766 |
|
|
end program test_idate
|
5767 |
|
|
@end smallexample
|
5768 |
|
|
@end table
|
5769 |
|
|
|
5770 |
|
|
|
5771 |
|
|
|
5772 |
|
|
@node IEOR
|
5773 |
|
|
@section @code{IEOR} --- Bitwise logical exclusive or
|
5774 |
|
|
@fnindex IEOR
|
5775 |
|
|
@cindex bitwise logical exclusive or
|
5776 |
|
|
@cindex logical exclusive or, bitwise
|
5777 |
|
|
|
5778 |
|
|
@table @asis
|
5779 |
|
|
@item @emph{Description}:
|
5780 |
|
|
@code{IEOR} returns the bitwise boolean exclusive-OR of @var{I} and
|
5781 |
|
|
@var{J}.
|
5782 |
|
|
|
5783 |
|
|
@item @emph{Standard}:
|
5784 |
|
|
Fortran 95 and later
|
5785 |
|
|
|
5786 |
|
|
@item @emph{Class}:
|
5787 |
|
|
Elemental function
|
5788 |
|
|
|
5789 |
|
|
@item @emph{Syntax}:
|
5790 |
|
|
@code{RESULT = IEOR(I, J)}
|
5791 |
|
|
|
5792 |
|
|
@item @emph{Arguments}:
|
5793 |
|
|
@multitable @columnfractions .15 .70
|
5794 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
5795 |
|
|
@item @var{J} @tab The type shall be @code{INTEGER}, of the same
|
5796 |
|
|
kind as @var{I}. (As a GNU extension, different kinds are also
|
5797 |
|
|
permitted.)
|
5798 |
|
|
@end multitable
|
5799 |
|
|
|
5800 |
|
|
@item @emph{Return value}:
|
5801 |
|
|
The return type is @code{INTEGER}, of the same kind as the
|
5802 |
|
|
arguments. (If the argument kinds differ, it is of the same kind as
|
5803 |
|
|
the larger argument.)
|
5804 |
|
|
|
5805 |
|
|
@item @emph{See also}:
|
5806 |
|
|
@ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
|
5807 |
|
|
@end table
|
5808 |
|
|
|
5809 |
|
|
|
5810 |
|
|
|
5811 |
|
|
@node IERRNO
|
5812 |
|
|
@section @code{IERRNO} --- Get the last system error number
|
5813 |
|
|
@fnindex IERRNO
|
5814 |
|
|
@cindex system, error handling
|
5815 |
|
|
|
5816 |
|
|
@table @asis
|
5817 |
|
|
@item @emph{Description}:
|
5818 |
|
|
Returns the last system error number, as given by the C @code{errno()}
|
5819 |
|
|
function.
|
5820 |
|
|
|
5821 |
|
|
@item @emph{Standard}:
|
5822 |
|
|
GNU extension
|
5823 |
|
|
|
5824 |
|
|
@item @emph{Class}:
|
5825 |
|
|
Function
|
5826 |
|
|
|
5827 |
|
|
@item @emph{Syntax}:
|
5828 |
|
|
@code{RESULT = IERRNO()}
|
5829 |
|
|
|
5830 |
|
|
@item @emph{Arguments}:
|
5831 |
|
|
None.
|
5832 |
|
|
|
5833 |
|
|
@item @emph{Return value}:
|
5834 |
|
|
The return value is of type @code{INTEGER} and of the default integer
|
5835 |
|
|
kind.
|
5836 |
|
|
|
5837 |
|
|
@item @emph{See also}:
|
5838 |
|
|
@ref{PERROR}
|
5839 |
|
|
@end table
|
5840 |
|
|
|
5841 |
|
|
|
5842 |
|
|
|
5843 |
|
|
@node INDEX intrinsic
|
5844 |
|
|
@section @code{INDEX} --- Position of a substring within a string
|
5845 |
|
|
@fnindex INDEX
|
5846 |
|
|
@cindex substring position
|
5847 |
|
|
@cindex string, find substring
|
5848 |
|
|
|
5849 |
|
|
@table @asis
|
5850 |
|
|
@item @emph{Description}:
|
5851 |
|
|
Returns the position of the start of the first occurrence of string
|
5852 |
|
|
@var{SUBSTRING} as a substring in @var{STRING}, counting from one. If
|
5853 |
|
|
@var{SUBSTRING} is not present in @var{STRING}, zero is returned. If
|
5854 |
|
|
the @var{BACK} argument is present and true, the return value is the
|
5855 |
|
|
start of the last occurrence rather than the first.
|
5856 |
|
|
|
5857 |
|
|
@item @emph{Standard}:
|
5858 |
|
|
Fortran 77 and later, with @var{KIND} argument Fortran 2003 and later
|
5859 |
|
|
|
5860 |
|
|
@item @emph{Class}:
|
5861 |
|
|
Elemental function
|
5862 |
|
|
|
5863 |
|
|
@item @emph{Syntax}:
|
5864 |
|
|
@code{RESULT = INDEX(STRING, SUBSTRING [, BACK [, KIND]])}
|
5865 |
|
|
|
5866 |
|
|
@item @emph{Arguments}:
|
5867 |
|
|
@multitable @columnfractions .15 .70
|
5868 |
|
|
@item @var{STRING} @tab Shall be a scalar @code{CHARACTER}, with
|
5869 |
|
|
@code{INTENT(IN)}
|
5870 |
|
|
@item @var{SUBSTRING} @tab Shall be a scalar @code{CHARACTER}, with
|
5871 |
|
|
@code{INTENT(IN)}
|
5872 |
|
|
@item @var{BACK} @tab (Optional) Shall be a scalar @code{LOGICAL}, with
|
5873 |
|
|
@code{INTENT(IN)}
|
5874 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
5875 |
|
|
expression indicating the kind parameter of the result.
|
5876 |
|
|
@end multitable
|
5877 |
|
|
|
5878 |
|
|
@item @emph{Return value}:
|
5879 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
5880 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
5881 |
|
|
|
5882 |
|
|
@item @emph{See also}:
|
5883 |
|
|
@ref{SCAN}, @ref{VERIFY}
|
5884 |
|
|
@end table
|
5885 |
|
|
|
5886 |
|
|
|
5887 |
|
|
|
5888 |
|
|
@node INT
|
5889 |
|
|
@section @code{INT} --- Convert to integer type
|
5890 |
|
|
@fnindex INT
|
5891 |
|
|
@fnindex IFIX
|
5892 |
|
|
@fnindex IDINT
|
5893 |
|
|
@cindex conversion, to integer
|
5894 |
|
|
|
5895 |
|
|
@table @asis
|
5896 |
|
|
@item @emph{Description}:
|
5897 |
|
|
Convert to integer type
|
5898 |
|
|
|
5899 |
|
|
@item @emph{Standard}:
|
5900 |
|
|
Fortran 77 and later
|
5901 |
|
|
|
5902 |
|
|
@item @emph{Class}:
|
5903 |
|
|
Elemental function
|
5904 |
|
|
|
5905 |
|
|
@item @emph{Syntax}:
|
5906 |
|
|
@code{RESULT = INT(A [, KIND))}
|
5907 |
|
|
|
5908 |
|
|
@item @emph{Arguments}:
|
5909 |
|
|
@multitable @columnfractions .15 .70
|
5910 |
|
|
@item @var{A} @tab Shall be of type @code{INTEGER},
|
5911 |
|
|
@code{REAL}, or @code{COMPLEX}.
|
5912 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
5913 |
|
|
expression indicating the kind parameter of the result.
|
5914 |
|
|
@end multitable
|
5915 |
|
|
|
5916 |
|
|
@item @emph{Return value}:
|
5917 |
|
|
These functions return a @code{INTEGER} variable or array under
|
5918 |
|
|
the following rules:
|
5919 |
|
|
|
5920 |
|
|
@table @asis
|
5921 |
|
|
@item (A)
|
5922 |
|
|
If @var{A} is of type @code{INTEGER}, @code{INT(A) = A}
|
5923 |
|
|
@item (B)
|
5924 |
|
|
If @var{A} is of type @code{REAL} and @math{|A| < 1}, @code{INT(A)} equals @code{0}.
|
5925 |
|
|
If @math{|A| \geq 1}, then @code{INT(A)} equals the largest integer that does not exceed
|
5926 |
|
|
the range of @var{A} and whose sign is the same as the sign of @var{A}.
|
5927 |
|
|
@item (C)
|
5928 |
|
|
If @var{A} is of type @code{COMPLEX}, rule B is applied to the real part of @var{A}.
|
5929 |
|
|
@end table
|
5930 |
|
|
|
5931 |
|
|
@item @emph{Example}:
|
5932 |
|
|
@smallexample
|
5933 |
|
|
program test_int
|
5934 |
|
|
integer :: i = 42
|
5935 |
|
|
complex :: z = (-3.7, 1.0)
|
5936 |
|
|
print *, int(i)
|
5937 |
|
|
print *, int(z), int(z,8)
|
5938 |
|
|
end program
|
5939 |
|
|
@end smallexample
|
5940 |
|
|
|
5941 |
|
|
@item @emph{Specific names}:
|
5942 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
5943 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
5944 |
|
|
@item @code{IFIX(A)} @tab @code{REAL(4) A} @tab @code{INTEGER} @tab Fortran 77 and later
|
5945 |
|
|
@item @code{IDINT(A)} @tab @code{REAL(8) A} @tab @code{INTEGER} @tab Fortran 77 and later
|
5946 |
|
|
@end multitable
|
5947 |
|
|
|
5948 |
|
|
@end table
|
5949 |
|
|
|
5950 |
|
|
|
5951 |
|
|
|
5952 |
|
|
@node INT2
|
5953 |
|
|
@section @code{INT2} --- Convert to 16-bit integer type
|
5954 |
|
|
@fnindex INT2
|
5955 |
|
|
@fnindex SHORT
|
5956 |
|
|
@cindex conversion, to integer
|
5957 |
|
|
|
5958 |
|
|
@table @asis
|
5959 |
|
|
@item @emph{Description}:
|
5960 |
|
|
Convert to a @code{KIND=2} integer type. This is equivalent to the
|
5961 |
|
|
standard @code{INT} intrinsic with an optional argument of
|
5962 |
|
|
@code{KIND=2}, and is only included for backwards compatibility.
|
5963 |
|
|
|
5964 |
|
|
The @code{SHORT} intrinsic is equivalent to @code{INT2}.
|
5965 |
|
|
|
5966 |
|
|
@item @emph{Standard}:
|
5967 |
|
|
GNU extension
|
5968 |
|
|
|
5969 |
|
|
@item @emph{Class}:
|
5970 |
|
|
Elemental function
|
5971 |
|
|
|
5972 |
|
|
@item @emph{Syntax}:
|
5973 |
|
|
@code{RESULT = INT2(A)}
|
5974 |
|
|
|
5975 |
|
|
@item @emph{Arguments}:
|
5976 |
|
|
@multitable @columnfractions .15 .70
|
5977 |
|
|
@item @var{A} @tab Shall be of type @code{INTEGER},
|
5978 |
|
|
@code{REAL}, or @code{COMPLEX}.
|
5979 |
|
|
@end multitable
|
5980 |
|
|
|
5981 |
|
|
@item @emph{Return value}:
|
5982 |
|
|
The return value is a @code{INTEGER(2)} variable.
|
5983 |
|
|
|
5984 |
|
|
@item @emph{See also}:
|
5985 |
|
|
@ref{INT}, @ref{INT8}, @ref{LONG}
|
5986 |
|
|
@end table
|
5987 |
|
|
|
5988 |
|
|
|
5989 |
|
|
|
5990 |
|
|
@node INT8
|
5991 |
|
|
@section @code{INT8} --- Convert to 64-bit integer type
|
5992 |
|
|
@fnindex INT8
|
5993 |
|
|
@cindex conversion, to integer
|
5994 |
|
|
|
5995 |
|
|
@table @asis
|
5996 |
|
|
@item @emph{Description}:
|
5997 |
|
|
Convert to a @code{KIND=8} integer type. This is equivalent to the
|
5998 |
|
|
standard @code{INT} intrinsic with an optional argument of
|
5999 |
|
|
@code{KIND=8}, and is only included for backwards compatibility.
|
6000 |
|
|
|
6001 |
|
|
@item @emph{Standard}:
|
6002 |
|
|
GNU extension
|
6003 |
|
|
|
6004 |
|
|
@item @emph{Class}:
|
6005 |
|
|
Elemental function
|
6006 |
|
|
|
6007 |
|
|
@item @emph{Syntax}:
|
6008 |
|
|
@code{RESULT = INT8(A)}
|
6009 |
|
|
|
6010 |
|
|
@item @emph{Arguments}:
|
6011 |
|
|
@multitable @columnfractions .15 .70
|
6012 |
|
|
@item @var{A} @tab Shall be of type @code{INTEGER},
|
6013 |
|
|
@code{REAL}, or @code{COMPLEX}.
|
6014 |
|
|
@end multitable
|
6015 |
|
|
|
6016 |
|
|
@item @emph{Return value}:
|
6017 |
|
|
The return value is a @code{INTEGER(8)} variable.
|
6018 |
|
|
|
6019 |
|
|
@item @emph{See also}:
|
6020 |
|
|
@ref{INT}, @ref{INT2}, @ref{LONG}
|
6021 |
|
|
@end table
|
6022 |
|
|
|
6023 |
|
|
|
6024 |
|
|
|
6025 |
|
|
@node IOR
|
6026 |
|
|
@section @code{IOR} --- Bitwise logical or
|
6027 |
|
|
@fnindex IOR
|
6028 |
|
|
@cindex bitwise logical or
|
6029 |
|
|
@cindex logical or, bitwise
|
6030 |
|
|
|
6031 |
|
|
@table @asis
|
6032 |
|
|
@item @emph{Description}:
|
6033 |
|
|
@code{IOR} returns the bitwise boolean inclusive-OR of @var{I} and
|
6034 |
|
|
@var{J}.
|
6035 |
|
|
|
6036 |
|
|
@item @emph{Standard}:
|
6037 |
|
|
Fortran 95 and later
|
6038 |
|
|
|
6039 |
|
|
@item @emph{Class}:
|
6040 |
|
|
Elemental function
|
6041 |
|
|
|
6042 |
|
|
@item @emph{Syntax}:
|
6043 |
|
|
@code{RESULT = IOR(I, J)}
|
6044 |
|
|
|
6045 |
|
|
@item @emph{Arguments}:
|
6046 |
|
|
@multitable @columnfractions .15 .70
|
6047 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
6048 |
|
|
@item @var{J} @tab The type shall be @code{INTEGER}, of the same
|
6049 |
|
|
kind as @var{I}. (As a GNU extension, different kinds are also
|
6050 |
|
|
permitted.)
|
6051 |
|
|
@end multitable
|
6052 |
|
|
|
6053 |
|
|
@item @emph{Return value}:
|
6054 |
|
|
The return type is @code{INTEGER}, of the same kind as the
|
6055 |
|
|
arguments. (If the argument kinds differ, it is of the same kind as
|
6056 |
|
|
the larger argument.)
|
6057 |
|
|
|
6058 |
|
|
@item @emph{See also}:
|
6059 |
|
|
@ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
|
6060 |
|
|
@end table
|
6061 |
|
|
|
6062 |
|
|
|
6063 |
|
|
|
6064 |
|
|
@node IRAND
|
6065 |
|
|
@section @code{IRAND} --- Integer pseudo-random number
|
6066 |
|
|
@fnindex IRAND
|
6067 |
|
|
@cindex random number generation
|
6068 |
|
|
|
6069 |
|
|
@table @asis
|
6070 |
|
|
@item @emph{Description}:
|
6071 |
|
|
@code{IRAND(FLAG)} returns a pseudo-random number from a uniform
|
6072 |
|
|
distribution between 0 and a system-dependent limit (which is in most
|
6073 |
|
|
cases 2147483647). If @var{FLAG} is 0, the next number
|
6074 |
|
|
in the current sequence is returned; if @var{FLAG} is 1, the generator
|
6075 |
|
|
is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
|
6076 |
|
|
it is used as a new seed with @code{SRAND}.
|
6077 |
|
|
|
6078 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
6079 |
|
|
GNU Fortran 77. It implements a simple modulo generator as provided
|
6080 |
|
|
by @command{g77}. For new code, one should consider the use of
|
6081 |
|
|
@ref{RANDOM_NUMBER} as it implements a superior algorithm.
|
6082 |
|
|
|
6083 |
|
|
@item @emph{Standard}:
|
6084 |
|
|
GNU extension
|
6085 |
|
|
|
6086 |
|
|
@item @emph{Class}:
|
6087 |
|
|
Function
|
6088 |
|
|
|
6089 |
|
|
@item @emph{Syntax}:
|
6090 |
|
|
@code{RESULT = IRAND(I)}
|
6091 |
|
|
|
6092 |
|
|
@item @emph{Arguments}:
|
6093 |
|
|
@multitable @columnfractions .15 .70
|
6094 |
|
|
@item @var{I} @tab Shall be a scalar @code{INTEGER} of kind 4.
|
6095 |
|
|
@end multitable
|
6096 |
|
|
|
6097 |
|
|
@item @emph{Return value}:
|
6098 |
|
|
The return value is of @code{INTEGER(kind=4)} type.
|
6099 |
|
|
|
6100 |
|
|
@item @emph{Example}:
|
6101 |
|
|
@smallexample
|
6102 |
|
|
program test_irand
|
6103 |
|
|
integer,parameter :: seed = 86456
|
6104 |
|
|
|
6105 |
|
|
call srand(seed)
|
6106 |
|
|
print *, irand(), irand(), irand(), irand()
|
6107 |
|
|
print *, irand(seed), irand(), irand(), irand()
|
6108 |
|
|
end program test_irand
|
6109 |
|
|
@end smallexample
|
6110 |
|
|
|
6111 |
|
|
@end table
|
6112 |
|
|
|
6113 |
|
|
|
6114 |
|
|
|
6115 |
|
|
@node IS_IOSTAT_END
|
6116 |
|
|
@section @code{IS_IOSTAT_END} --- Test for end-of-file value
|
6117 |
|
|
@fnindex IS_IOSTAT_END
|
6118 |
|
|
@cindex IOSTAT, end of file
|
6119 |
|
|
|
6120 |
|
|
@table @asis
|
6121 |
|
|
@item @emph{Description}:
|
6122 |
|
|
@code{IS_IOSTAT_END} tests whether an variable has the value of the I/O
|
6123 |
|
|
status ``end of file''. The function is equivalent to comparing the variable
|
6124 |
|
|
with the @code{IOSTAT_END} parameter of the intrinsic module
|
6125 |
|
|
@code{ISO_FORTRAN_ENV}.
|
6126 |
|
|
|
6127 |
|
|
@item @emph{Standard}:
|
6128 |
|
|
Fortran 2003 and later
|
6129 |
|
|
|
6130 |
|
|
@item @emph{Class}:
|
6131 |
|
|
Elemental function
|
6132 |
|
|
|
6133 |
|
|
@item @emph{Syntax}:
|
6134 |
|
|
@code{RESULT = IS_IOSTAT_END(I)}
|
6135 |
|
|
|
6136 |
|
|
@item @emph{Arguments}:
|
6137 |
|
|
@multitable @columnfractions .15 .70
|
6138 |
|
|
@item @var{I} @tab Shall be of the type @code{INTEGER}.
|
6139 |
|
|
@end multitable
|
6140 |
|
|
|
6141 |
|
|
@item @emph{Return value}:
|
6142 |
|
|
Returns a @code{LOGICAL} of the default kind, which @code{.TRUE.} if
|
6143 |
|
|
@var{I} has the value which indicates an end of file condition for
|
6144 |
|
|
IOSTAT= specifiers, and is @code{.FALSE.} otherwise.
|
6145 |
|
|
|
6146 |
|
|
@item @emph{Example}:
|
6147 |
|
|
@smallexample
|
6148 |
|
|
PROGRAM iostat
|
6149 |
|
|
IMPLICIT NONE
|
6150 |
|
|
INTEGER :: stat, i
|
6151 |
|
|
OPEN(88, FILE='test.dat')
|
6152 |
|
|
READ(88, *, IOSTAT=stat) i
|
6153 |
|
|
IF(IS_IOSTAT_END(stat)) STOP 'END OF FILE'
|
6154 |
|
|
END PROGRAM
|
6155 |
|
|
@end smallexample
|
6156 |
|
|
@end table
|
6157 |
|
|
|
6158 |
|
|
|
6159 |
|
|
|
6160 |
|
|
@node IS_IOSTAT_EOR
|
6161 |
|
|
@section @code{IS_IOSTAT_EOR} --- Test for end-of-record value
|
6162 |
|
|
@fnindex IS_IOSTAT_EOR
|
6163 |
|
|
@cindex IOSTAT, end of record
|
6164 |
|
|
|
6165 |
|
|
@table @asis
|
6166 |
|
|
@item @emph{Description}:
|
6167 |
|
|
@code{IS_IOSTAT_EOR} tests whether an variable has the value of the I/O
|
6168 |
|
|
status ``end of record''. The function is equivalent to comparing the
|
6169 |
|
|
variable with the @code{IOSTAT_EOR} parameter of the intrinsic module
|
6170 |
|
|
@code{ISO_FORTRAN_ENV}.
|
6171 |
|
|
|
6172 |
|
|
@item @emph{Standard}:
|
6173 |
|
|
Fortran 2003 and later
|
6174 |
|
|
|
6175 |
|
|
@item @emph{Class}:
|
6176 |
|
|
Elemental function
|
6177 |
|
|
|
6178 |
|
|
@item @emph{Syntax}:
|
6179 |
|
|
@code{RESULT = IS_IOSTAT_EOR(I)}
|
6180 |
|
|
|
6181 |
|
|
@item @emph{Arguments}:
|
6182 |
|
|
@multitable @columnfractions .15 .70
|
6183 |
|
|
@item @var{I} @tab Shall be of the type @code{INTEGER}.
|
6184 |
|
|
@end multitable
|
6185 |
|
|
|
6186 |
|
|
@item @emph{Return value}:
|
6187 |
|
|
Returns a @code{LOGICAL} of the default kind, which @code{.TRUE.} if
|
6188 |
|
|
@var{I} has the value which indicates an end of file condition for
|
6189 |
|
|
IOSTAT= specifiers, and is @code{.FALSE.} otherwise.
|
6190 |
|
|
|
6191 |
|
|
@item @emph{Example}:
|
6192 |
|
|
@smallexample
|
6193 |
|
|
PROGRAM iostat
|
6194 |
|
|
IMPLICIT NONE
|
6195 |
|
|
INTEGER :: stat, i(50)
|
6196 |
|
|
OPEN(88, FILE='test.dat', FORM='UNFORMATTED')
|
6197 |
|
|
READ(88, IOSTAT=stat) i
|
6198 |
|
|
IF(IS_IOSTAT_EOR(stat)) STOP 'END OF RECORD'
|
6199 |
|
|
END PROGRAM
|
6200 |
|
|
@end smallexample
|
6201 |
|
|
@end table
|
6202 |
|
|
|
6203 |
|
|
|
6204 |
|
|
|
6205 |
|
|
@node ISATTY
|
6206 |
|
|
@section @code{ISATTY} --- Whether a unit is a terminal device.
|
6207 |
|
|
@fnindex ISATTY
|
6208 |
|
|
@cindex system, terminal
|
6209 |
|
|
|
6210 |
|
|
@table @asis
|
6211 |
|
|
@item @emph{Description}:
|
6212 |
|
|
Determine whether a unit is connected to a terminal device.
|
6213 |
|
|
|
6214 |
|
|
@item @emph{Standard}:
|
6215 |
|
|
GNU extension
|
6216 |
|
|
|
6217 |
|
|
@item @emph{Class}:
|
6218 |
|
|
Function
|
6219 |
|
|
|
6220 |
|
|
@item @emph{Syntax}:
|
6221 |
|
|
@code{RESULT = ISATTY(UNIT)}
|
6222 |
|
|
|
6223 |
|
|
@item @emph{Arguments}:
|
6224 |
|
|
@multitable @columnfractions .15 .70
|
6225 |
|
|
@item @var{UNIT} @tab Shall be a scalar @code{INTEGER}.
|
6226 |
|
|
@end multitable
|
6227 |
|
|
|
6228 |
|
|
@item @emph{Return value}:
|
6229 |
|
|
Returns @code{.TRUE.} if the @var{UNIT} is connected to a terminal
|
6230 |
|
|
device, @code{.FALSE.} otherwise.
|
6231 |
|
|
|
6232 |
|
|
@item @emph{Example}:
|
6233 |
|
|
@smallexample
|
6234 |
|
|
PROGRAM test_isatty
|
6235 |
|
|
INTEGER(kind=1) :: unit
|
6236 |
|
|
DO unit = 1, 10
|
6237 |
|
|
write(*,*) isatty(unit=unit)
|
6238 |
|
|
END DO
|
6239 |
|
|
END PROGRAM
|
6240 |
|
|
@end smallexample
|
6241 |
|
|
@item @emph{See also}:
|
6242 |
|
|
@ref{TTYNAM}
|
6243 |
|
|
@end table
|
6244 |
|
|
|
6245 |
|
|
|
6246 |
|
|
|
6247 |
|
|
@node ISHFT
|
6248 |
|
|
@section @code{ISHFT} --- Shift bits
|
6249 |
|
|
@fnindex ISHFT
|
6250 |
|
|
@cindex bits, shift
|
6251 |
|
|
|
6252 |
|
|
@table @asis
|
6253 |
|
|
@item @emph{Description}:
|
6254 |
|
|
@code{ISHFT} returns a value corresponding to @var{I} with all of the
|
6255 |
|
|
bits shifted @var{SHIFT} places. A value of @var{SHIFT} greater than
|
6256 |
|
|
zero corresponds to a left shift, a value of zero corresponds to no
|
6257 |
|
|
shift, and a value less than zero corresponds to a right shift. If the
|
6258 |
|
|
absolute value of @var{SHIFT} is greater than @code{BIT_SIZE(I)}, the
|
6259 |
|
|
value is undefined. Bits shifted out from the left end or right end are
|
6260 |
|
|
lost; zeros are shifted in from the opposite end.
|
6261 |
|
|
|
6262 |
|
|
@item @emph{Standard}:
|
6263 |
|
|
Fortran 95 and later
|
6264 |
|
|
|
6265 |
|
|
@item @emph{Class}:
|
6266 |
|
|
Elemental function
|
6267 |
|
|
|
6268 |
|
|
@item @emph{Syntax}:
|
6269 |
|
|
@code{RESULT = ISHFT(I, SHIFT)}
|
6270 |
|
|
|
6271 |
|
|
@item @emph{Arguments}:
|
6272 |
|
|
@multitable @columnfractions .15 .70
|
6273 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
6274 |
|
|
@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
|
6275 |
|
|
@end multitable
|
6276 |
|
|
|
6277 |
|
|
@item @emph{Return value}:
|
6278 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
6279 |
|
|
@var{I}.
|
6280 |
|
|
|
6281 |
|
|
@item @emph{See also}:
|
6282 |
|
|
@ref{ISHFTC}
|
6283 |
|
|
@end table
|
6284 |
|
|
|
6285 |
|
|
|
6286 |
|
|
|
6287 |
|
|
@node ISHFTC
|
6288 |
|
|
@section @code{ISHFTC} --- Shift bits circularly
|
6289 |
|
|
@fnindex ISHFTC
|
6290 |
|
|
@cindex bits, shift circular
|
6291 |
|
|
|
6292 |
|
|
@table @asis
|
6293 |
|
|
@item @emph{Description}:
|
6294 |
|
|
@code{ISHFTC} returns a value corresponding to @var{I} with the
|
6295 |
|
|
rightmost @var{SIZE} bits shifted circularly @var{SHIFT} places; that
|
6296 |
|
|
is, bits shifted out one end are shifted into the opposite end. A value
|
6297 |
|
|
of @var{SHIFT} greater than zero corresponds to a left shift, a value of
|
6298 |
|
|
zero corresponds to no shift, and a value less than zero corresponds to
|
6299 |
|
|
a right shift. The absolute value of @var{SHIFT} must be less than
|
6300 |
|
|
@var{SIZE}. If the @var{SIZE} argument is omitted, it is taken to be
|
6301 |
|
|
equivalent to @code{BIT_SIZE(I)}.
|
6302 |
|
|
|
6303 |
|
|
@item @emph{Standard}:
|
6304 |
|
|
Fortran 95 and later
|
6305 |
|
|
|
6306 |
|
|
@item @emph{Class}:
|
6307 |
|
|
Elemental function
|
6308 |
|
|
|
6309 |
|
|
@item @emph{Syntax}:
|
6310 |
|
|
@code{RESULT = ISHFTC(I, SHIFT [, SIZE])}
|
6311 |
|
|
|
6312 |
|
|
@item @emph{Arguments}:
|
6313 |
|
|
@multitable @columnfractions .15 .70
|
6314 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
6315 |
|
|
@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
|
6316 |
|
|
@item @var{SIZE} @tab (Optional) The type shall be @code{INTEGER};
|
6317 |
|
|
the value must be greater than zero and less than or equal to
|
6318 |
|
|
@code{BIT_SIZE(I)}.
|
6319 |
|
|
@end multitable
|
6320 |
|
|
|
6321 |
|
|
@item @emph{Return value}:
|
6322 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
6323 |
|
|
@var{I}.
|
6324 |
|
|
|
6325 |
|
|
@item @emph{See also}:
|
6326 |
|
|
@ref{ISHFT}
|
6327 |
|
|
@end table
|
6328 |
|
|
|
6329 |
|
|
|
6330 |
|
|
|
6331 |
|
|
@node ISNAN
|
6332 |
|
|
@section @code{ISNAN} --- Test for a NaN
|
6333 |
|
|
@fnindex ISNAN
|
6334 |
|
|
@cindex IEEE, ISNAN
|
6335 |
|
|
|
6336 |
|
|
@table @asis
|
6337 |
|
|
@item @emph{Description}:
|
6338 |
|
|
@code{ISNAN} tests whether a floating-point value is an IEEE
|
6339 |
|
|
Not-a-Number (NaN).
|
6340 |
|
|
@item @emph{Standard}:
|
6341 |
|
|
GNU extension
|
6342 |
|
|
|
6343 |
|
|
@item @emph{Class}:
|
6344 |
|
|
Elemental function
|
6345 |
|
|
|
6346 |
|
|
@item @emph{Syntax}:
|
6347 |
|
|
@code{ISNAN(X)}
|
6348 |
|
|
|
6349 |
|
|
@item @emph{Arguments}:
|
6350 |
|
|
@multitable @columnfractions .15 .70
|
6351 |
|
|
@item @var{X} @tab Variable of the type @code{REAL}.
|
6352 |
|
|
|
6353 |
|
|
@end multitable
|
6354 |
|
|
|
6355 |
|
|
@item @emph{Return value}:
|
6356 |
|
|
Returns a default-kind @code{LOGICAL}. The returned value is @code{TRUE}
|
6357 |
|
|
if @var{X} is a NaN and @code{FALSE} otherwise.
|
6358 |
|
|
|
6359 |
|
|
@item @emph{Example}:
|
6360 |
|
|
@smallexample
|
6361 |
|
|
program test_nan
|
6362 |
|
|
implicit none
|
6363 |
|
|
real :: x
|
6364 |
|
|
x = -1.0
|
6365 |
|
|
x = sqrt(x)
|
6366 |
|
|
if (isnan(x)) stop '"x" is a NaN'
|
6367 |
|
|
end program test_nan
|
6368 |
|
|
@end smallexample
|
6369 |
|
|
@end table
|
6370 |
|
|
|
6371 |
|
|
|
6372 |
|
|
|
6373 |
|
|
@node ITIME
|
6374 |
|
|
@section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds)
|
6375 |
|
|
@fnindex ITIME
|
6376 |
|
|
@cindex time, current
|
6377 |
|
|
@cindex current time
|
6378 |
|
|
|
6379 |
|
|
@table @asis
|
6380 |
|
|
@item @emph{Description}:
|
6381 |
|
|
@code{IDATE(VALUES)} Fills @var{VALUES} with the numerical values at the
|
6382 |
|
|
current local time. The hour (in the range 1-24), minute (in the range 1-60),
|
6383 |
|
|
and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{VALUES},
|
6384 |
|
|
respectively.
|
6385 |
|
|
|
6386 |
|
|
@item @emph{Standard}:
|
6387 |
|
|
GNU extension
|
6388 |
|
|
|
6389 |
|
|
@item @emph{Class}:
|
6390 |
|
|
Subroutine
|
6391 |
|
|
|
6392 |
|
|
@item @emph{Syntax}:
|
6393 |
|
|
@code{CALL ITIME(VALUES)}
|
6394 |
|
|
|
6395 |
|
|
@item @emph{Arguments}:
|
6396 |
|
|
@multitable @columnfractions .15 .70
|
6397 |
|
|
@item @var{VALUES} @tab The type shall be @code{INTEGER, DIMENSION(3)}
|
6398 |
|
|
and the kind shall be the default integer kind.
|
6399 |
|
|
@end multitable
|
6400 |
|
|
|
6401 |
|
|
@item @emph{Return value}:
|
6402 |
|
|
Does not return anything.
|
6403 |
|
|
|
6404 |
|
|
|
6405 |
|
|
@item @emph{Example}:
|
6406 |
|
|
@smallexample
|
6407 |
|
|
program test_itime
|
6408 |
|
|
integer, dimension(3) :: tarray
|
6409 |
|
|
call itime(tarray)
|
6410 |
|
|
print *, tarray(1)
|
6411 |
|
|
print *, tarray(2)
|
6412 |
|
|
print *, tarray(3)
|
6413 |
|
|
end program test_itime
|
6414 |
|
|
@end smallexample
|
6415 |
|
|
@end table
|
6416 |
|
|
|
6417 |
|
|
|
6418 |
|
|
|
6419 |
|
|
@node KILL
|
6420 |
|
|
@section @code{KILL} --- Send a signal to a process
|
6421 |
|
|
@fnindex KILL
|
6422 |
|
|
|
6423 |
|
|
@table @asis
|
6424 |
|
|
@item @emph{Description}:
|
6425 |
|
|
@item @emph{Standard}:
|
6426 |
|
|
Sends the signal specified by @var{SIGNAL} to the process @var{PID}.
|
6427 |
|
|
See @code{kill(2)}.
|
6428 |
|
|
|
6429 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
6430 |
|
|
only one form can be used in any given program unit.
|
6431 |
|
|
|
6432 |
|
|
@item @emph{Class}:
|
6433 |
|
|
Subroutine, function
|
6434 |
|
|
|
6435 |
|
|
@item @emph{Syntax}:
|
6436 |
|
|
@code{CALL KILL(C, VALUE [, STATUS])}
|
6437 |
|
|
|
6438 |
|
|
@item @emph{Arguments}:
|
6439 |
|
|
@multitable @columnfractions .15 .70
|
6440 |
|
|
@item @var{C} @tab Shall be a scalar @code{INTEGER}, with
|
6441 |
|
|
@code{INTENT(IN)}
|
6442 |
|
|
@item @var{VALUE} @tab Shall be a scalar @code{INTEGER}, with
|
6443 |
|
|
@code{INTENT(IN)}
|
6444 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)} or
|
6445 |
|
|
@code{INTEGER(8)}. Returns 0 on success, or a system-specific error code
|
6446 |
|
|
otherwise.
|
6447 |
|
|
@end multitable
|
6448 |
|
|
|
6449 |
|
|
@item @emph{See also}:
|
6450 |
|
|
@ref{ABORT}, @ref{EXIT}
|
6451 |
|
|
@end table
|
6452 |
|
|
|
6453 |
|
|
|
6454 |
|
|
|
6455 |
|
|
@node KIND
|
6456 |
|
|
@section @code{KIND} --- Kind of an entity
|
6457 |
|
|
@fnindex KIND
|
6458 |
|
|
@cindex kind
|
6459 |
|
|
|
6460 |
|
|
@table @asis
|
6461 |
|
|
@item @emph{Description}:
|
6462 |
|
|
@code{KIND(X)} returns the kind value of the entity @var{X}.
|
6463 |
|
|
|
6464 |
|
|
@item @emph{Standard}:
|
6465 |
|
|
Fortran 95 and later
|
6466 |
|
|
|
6467 |
|
|
@item @emph{Class}:
|
6468 |
|
|
Inquiry function
|
6469 |
|
|
|
6470 |
|
|
@item @emph{Syntax}:
|
6471 |
|
|
@code{K = KIND(X)}
|
6472 |
|
|
|
6473 |
|
|
@item @emph{Arguments}:
|
6474 |
|
|
@multitable @columnfractions .15 .70
|
6475 |
|
|
@item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
|
6476 |
|
|
@code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
|
6477 |
|
|
@end multitable
|
6478 |
|
|
|
6479 |
|
|
@item @emph{Return value}:
|
6480 |
|
|
The return value is a scalar of type @code{INTEGER} and of the default
|
6481 |
|
|
integer kind.
|
6482 |
|
|
|
6483 |
|
|
@item @emph{Example}:
|
6484 |
|
|
@smallexample
|
6485 |
|
|
program test_kind
|
6486 |
|
|
integer,parameter :: kc = kind(' ')
|
6487 |
|
|
integer,parameter :: kl = kind(.true.)
|
6488 |
|
|
|
6489 |
|
|
print *, "The default character kind is ", kc
|
6490 |
|
|
print *, "The default logical kind is ", kl
|
6491 |
|
|
end program test_kind
|
6492 |
|
|
@end smallexample
|
6493 |
|
|
|
6494 |
|
|
@end table
|
6495 |
|
|
|
6496 |
|
|
|
6497 |
|
|
|
6498 |
|
|
@node LBOUND
|
6499 |
|
|
@section @code{LBOUND} --- Lower dimension bounds of an array
|
6500 |
|
|
@fnindex LBOUND
|
6501 |
|
|
@cindex array, lower bound
|
6502 |
|
|
|
6503 |
|
|
@table @asis
|
6504 |
|
|
@item @emph{Description}:
|
6505 |
|
|
Returns the lower bounds of an array, or a single lower bound
|
6506 |
|
|
along the @var{DIM} dimension.
|
6507 |
|
|
@item @emph{Standard}:
|
6508 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
6509 |
|
|
|
6510 |
|
|
@item @emph{Class}:
|
6511 |
|
|
Inquiry function
|
6512 |
|
|
|
6513 |
|
|
@item @emph{Syntax}:
|
6514 |
|
|
@code{RESULT = LBOUND(ARRAY [, DIM [, KIND]])}
|
6515 |
|
|
|
6516 |
|
|
@item @emph{Arguments}:
|
6517 |
|
|
@multitable @columnfractions .15 .70
|
6518 |
|
|
@item @var{ARRAY} @tab Shall be an array, of any type.
|
6519 |
|
|
@item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER}.
|
6520 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
6521 |
|
|
expression indicating the kind parameter of the result.
|
6522 |
|
|
@end multitable
|
6523 |
|
|
|
6524 |
|
|
@item @emph{Return value}:
|
6525 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
6526 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
6527 |
|
|
If @var{DIM} is absent, the result is an array of the lower bounds of
|
6528 |
|
|
@var{ARRAY}. If @var{DIM} is present, the result is a scalar
|
6529 |
|
|
corresponding to the lower bound of the array along that dimension. If
|
6530 |
|
|
@var{ARRAY} is an expression rather than a whole array or array
|
6531 |
|
|
structure component, or if it has a zero extent along the relevant
|
6532 |
|
|
dimension, the lower bound is taken to be 1.
|
6533 |
|
|
|
6534 |
|
|
@item @emph{See also}:
|
6535 |
|
|
@ref{UBOUND}
|
6536 |
|
|
@end table
|
6537 |
|
|
|
6538 |
|
|
|
6539 |
|
|
|
6540 |
|
|
@node LEADZ
|
6541 |
|
|
@section @code{LEADZ} --- Number of leading zero bits of an integer
|
6542 |
|
|
@fnindex LEADZ
|
6543 |
|
|
@cindex zero bits
|
6544 |
|
|
|
6545 |
|
|
@table @asis
|
6546 |
|
|
@item @emph{Description}:
|
6547 |
|
|
@code{LEADZ} returns the number of leading zero bits of an integer.
|
6548 |
|
|
|
6549 |
|
|
@item @emph{Standard}:
|
6550 |
|
|
Fortran 2008 and later
|
6551 |
|
|
|
6552 |
|
|
@item @emph{Class}:
|
6553 |
|
|
Elemental function
|
6554 |
|
|
|
6555 |
|
|
@item @emph{Syntax}:
|
6556 |
|
|
@code{RESULT = LEADZ(I)}
|
6557 |
|
|
|
6558 |
|
|
@item @emph{Arguments}:
|
6559 |
|
|
@multitable @columnfractions .15 .70
|
6560 |
|
|
@item @var{I} @tab Shall be of type @code{INTEGER}.
|
6561 |
|
|
@end multitable
|
6562 |
|
|
|
6563 |
|
|
@item @emph{Return value}:
|
6564 |
|
|
The type of the return value is the default @code{INTEGER}.
|
6565 |
|
|
If all the bits of @code{I} are zero, the result value is @code{BIT_SIZE(I)}.
|
6566 |
|
|
|
6567 |
|
|
@item @emph{Example}:
|
6568 |
|
|
@smallexample
|
6569 |
|
|
PROGRAM test_leadz
|
6570 |
|
|
WRITE (*,*) LEADZ(1) ! prints 8 if BITSIZE(I) has the value 32
|
6571 |
|
|
END PROGRAM
|
6572 |
|
|
@end smallexample
|
6573 |
|
|
|
6574 |
|
|
@item @emph{See also}:
|
6575 |
|
|
@ref{BIT_SIZE}, @ref{TRAILZ}
|
6576 |
|
|
@end table
|
6577 |
|
|
|
6578 |
|
|
|
6579 |
|
|
|
6580 |
|
|
@node LEN
|
6581 |
|
|
@section @code{LEN} --- Length of a character entity
|
6582 |
|
|
@fnindex LEN
|
6583 |
|
|
@cindex string, length
|
6584 |
|
|
|
6585 |
|
|
@table @asis
|
6586 |
|
|
@item @emph{Description}:
|
6587 |
|
|
Returns the length of a character string. If @var{STRING} is an array,
|
6588 |
|
|
the length of an element of @var{STRING} is returned. Note that
|
6589 |
|
|
@var{STRING} need not be defined when this intrinsic is invoked, since
|
6590 |
|
|
only the length, not the content, of @var{STRING} is needed.
|
6591 |
|
|
|
6592 |
|
|
@item @emph{Standard}:
|
6593 |
|
|
Fortran 77 and later, with @var{KIND} argument Fortran 2003 and later
|
6594 |
|
|
|
6595 |
|
|
@item @emph{Class}:
|
6596 |
|
|
Inquiry function
|
6597 |
|
|
|
6598 |
|
|
@item @emph{Syntax}:
|
6599 |
|
|
@code{L = LEN(STRING [, KIND])}
|
6600 |
|
|
|
6601 |
|
|
@item @emph{Arguments}:
|
6602 |
|
|
@multitable @columnfractions .15 .70
|
6603 |
|
|
@item @var{STRING} @tab Shall be a scalar or array of type
|
6604 |
|
|
@code{CHARACTER}, with @code{INTENT(IN)}
|
6605 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
6606 |
|
|
expression indicating the kind parameter of the result.
|
6607 |
|
|
@end multitable
|
6608 |
|
|
|
6609 |
|
|
@item @emph{Return value}:
|
6610 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
6611 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
6612 |
|
|
|
6613 |
|
|
@item @emph{See also}:
|
6614 |
|
|
@ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
|
6615 |
|
|
@end table
|
6616 |
|
|
|
6617 |
|
|
|
6618 |
|
|
|
6619 |
|
|
@node LEN_TRIM
|
6620 |
|
|
@section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
|
6621 |
|
|
@fnindex LEN_TRIM
|
6622 |
|
|
@cindex string, length, without trailing whitespace
|
6623 |
|
|
|
6624 |
|
|
@table @asis
|
6625 |
|
|
@item @emph{Description}:
|
6626 |
|
|
Returns the length of a character string, ignoring any trailing blanks.
|
6627 |
|
|
|
6628 |
|
|
@item @emph{Standard}:
|
6629 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
6630 |
|
|
|
6631 |
|
|
@item @emph{Class}:
|
6632 |
|
|
Elemental function
|
6633 |
|
|
|
6634 |
|
|
@item @emph{Syntax}:
|
6635 |
|
|
@code{RESULT = LEN_TRIM(STRING [, KIND])}
|
6636 |
|
|
|
6637 |
|
|
@item @emph{Arguments}:
|
6638 |
|
|
@multitable @columnfractions .15 .70
|
6639 |
|
|
@item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER},
|
6640 |
|
|
with @code{INTENT(IN)}
|
6641 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
6642 |
|
|
expression indicating the kind parameter of the result.
|
6643 |
|
|
@end multitable
|
6644 |
|
|
|
6645 |
|
|
@item @emph{Return value}:
|
6646 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
6647 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
6648 |
|
|
|
6649 |
|
|
@item @emph{See also}:
|
6650 |
|
|
@ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
|
6651 |
|
|
@end table
|
6652 |
|
|
|
6653 |
|
|
|
6654 |
|
|
|
6655 |
|
|
@node LGE
|
6656 |
|
|
@section @code{LGE} --- Lexical greater than or equal
|
6657 |
|
|
@fnindex LGE
|
6658 |
|
|
@cindex lexical comparison of strings
|
6659 |
|
|
@cindex string, comparison
|
6660 |
|
|
|
6661 |
|
|
@table @asis
|
6662 |
|
|
@item @emph{Description}:
|
6663 |
|
|
Determines whether one string is lexically greater than or equal to
|
6664 |
|
|
another string, where the two strings are interpreted as containing
|
6665 |
|
|
ASCII character codes. If the String A and String B are not the same
|
6666 |
|
|
length, the shorter is compared as if spaces were appended to it to form
|
6667 |
|
|
a value that has the same length as the longer.
|
6668 |
|
|
|
6669 |
|
|
In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
|
6670 |
|
|
@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
|
6671 |
|
|
operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
|
6672 |
|
|
that the latter use the processor's character ordering (which is not
|
6673 |
|
|
ASCII on some targets), whereas the former always use the ASCII
|
6674 |
|
|
ordering.
|
6675 |
|
|
|
6676 |
|
|
@item @emph{Standard}:
|
6677 |
|
|
Fortran 77 and later
|
6678 |
|
|
|
6679 |
|
|
@item @emph{Class}:
|
6680 |
|
|
Elemental function
|
6681 |
|
|
|
6682 |
|
|
@item @emph{Syntax}:
|
6683 |
|
|
@code{RESULT = LGE(STRING_A, STRING_B)}
|
6684 |
|
|
|
6685 |
|
|
@item @emph{Arguments}:
|
6686 |
|
|
@multitable @columnfractions .15 .70
|
6687 |
|
|
@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
|
6688 |
|
|
@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
|
6689 |
|
|
@end multitable
|
6690 |
|
|
|
6691 |
|
|
@item @emph{Return value}:
|
6692 |
|
|
Returns @code{.TRUE.} if @code{STRING_A >= STRING_B}, and @code{.FALSE.}
|
6693 |
|
|
otherwise, based on the ASCII ordering.
|
6694 |
|
|
|
6695 |
|
|
@item @emph{See also}:
|
6696 |
|
|
@ref{LGT}, @ref{LLE}, @ref{LLT}
|
6697 |
|
|
@end table
|
6698 |
|
|
|
6699 |
|
|
|
6700 |
|
|
|
6701 |
|
|
@node LGT
|
6702 |
|
|
@section @code{LGT} --- Lexical greater than
|
6703 |
|
|
@fnindex LGT
|
6704 |
|
|
@cindex lexical comparison of strings
|
6705 |
|
|
@cindex string, comparison
|
6706 |
|
|
|
6707 |
|
|
@table @asis
|
6708 |
|
|
@item @emph{Description}:
|
6709 |
|
|
Determines whether one string is lexically greater than another string,
|
6710 |
|
|
where the two strings are interpreted as containing ASCII character
|
6711 |
|
|
codes. If the String A and String B are not the same length, the
|
6712 |
|
|
shorter is compared as if spaces were appended to it to form a value
|
6713 |
|
|
that has the same length as the longer.
|
6714 |
|
|
|
6715 |
|
|
In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
|
6716 |
|
|
@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
|
6717 |
|
|
operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
|
6718 |
|
|
that the latter use the processor's character ordering (which is not
|
6719 |
|
|
ASCII on some targets), whereas the former always use the ASCII
|
6720 |
|
|
ordering.
|
6721 |
|
|
|
6722 |
|
|
@item @emph{Standard}:
|
6723 |
|
|
Fortran 77 and later
|
6724 |
|
|
|
6725 |
|
|
@item @emph{Class}:
|
6726 |
|
|
Elemental function
|
6727 |
|
|
|
6728 |
|
|
@item @emph{Syntax}:
|
6729 |
|
|
@code{RESULT = LGT(STRING_A, STRING_B)}
|
6730 |
|
|
|
6731 |
|
|
@item @emph{Arguments}:
|
6732 |
|
|
@multitable @columnfractions .15 .70
|
6733 |
|
|
@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
|
6734 |
|
|
@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
|
6735 |
|
|
@end multitable
|
6736 |
|
|
|
6737 |
|
|
@item @emph{Return value}:
|
6738 |
|
|
Returns @code{.TRUE.} if @code{STRING_A > STRING_B}, and @code{.FALSE.}
|
6739 |
|
|
otherwise, based on the ASCII ordering.
|
6740 |
|
|
|
6741 |
|
|
@item @emph{See also}:
|
6742 |
|
|
@ref{LGE}, @ref{LLE}, @ref{LLT}
|
6743 |
|
|
@end table
|
6744 |
|
|
|
6745 |
|
|
|
6746 |
|
|
|
6747 |
|
|
@node LINK
|
6748 |
|
|
@section @code{LINK} --- Create a hard link
|
6749 |
|
|
@fnindex LINK
|
6750 |
|
|
@cindex file system, create link
|
6751 |
|
|
@cindex file system, hard link
|
6752 |
|
|
|
6753 |
|
|
@table @asis
|
6754 |
|
|
@item @emph{Description}:
|
6755 |
|
|
Makes a (hard) link from file @var{PATH1} to @var{PATH2}. A null
|
6756 |
|
|
character (@code{CHAR(0)}) can be used to mark the end of the names in
|
6757 |
|
|
@var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
|
6758 |
|
|
names are ignored. If the @var{STATUS} argument is supplied, it
|
6759 |
|
|
contains 0 on success or a nonzero error code upon return; see
|
6760 |
|
|
@code{link(2)}.
|
6761 |
|
|
|
6762 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6763 |
|
|
however, only one form can be used in any given program unit.
|
6764 |
|
|
|
6765 |
|
|
@item @emph{Standard}:
|
6766 |
|
|
GNU extension
|
6767 |
|
|
|
6768 |
|
|
@item @emph{Class}:
|
6769 |
|
|
Subroutine, function
|
6770 |
|
|
|
6771 |
|
|
@item @emph{Syntax}:
|
6772 |
|
|
@multitable @columnfractions .80
|
6773 |
|
|
@item @code{CALL LINK(PATH1, PATH2 [, STATUS])}
|
6774 |
|
|
@item @code{STATUS = LINK(PATH1, PATH2)}
|
6775 |
|
|
@end multitable
|
6776 |
|
|
|
6777 |
|
|
@item @emph{Arguments}:
|
6778 |
|
|
@multitable @columnfractions .15 .70
|
6779 |
|
|
@item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
|
6780 |
|
|
@item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
|
6781 |
|
|
@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
|
6782 |
|
|
@end multitable
|
6783 |
|
|
|
6784 |
|
|
@item @emph{See also}:
|
6785 |
|
|
@ref{SYMLNK}, @ref{UNLINK}
|
6786 |
|
|
@end table
|
6787 |
|
|
|
6788 |
|
|
|
6789 |
|
|
|
6790 |
|
|
@node LLE
|
6791 |
|
|
@section @code{LLE} --- Lexical less than or equal
|
6792 |
|
|
@fnindex LLE
|
6793 |
|
|
@cindex lexical comparison of strings
|
6794 |
|
|
@cindex string, comparison
|
6795 |
|
|
|
6796 |
|
|
@table @asis
|
6797 |
|
|
@item @emph{Description}:
|
6798 |
|
|
Determines whether one string is lexically less than or equal to another
|
6799 |
|
|
string, where the two strings are interpreted as containing ASCII
|
6800 |
|
|
character codes. If the String A and String B are not the same length,
|
6801 |
|
|
the shorter is compared as if spaces were appended to it to form a value
|
6802 |
|
|
that has the same length as the longer.
|
6803 |
|
|
|
6804 |
|
|
In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
|
6805 |
|
|
@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
|
6806 |
|
|
operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
|
6807 |
|
|
that the latter use the processor's character ordering (which is not
|
6808 |
|
|
ASCII on some targets), whereas the former always use the ASCII
|
6809 |
|
|
ordering.
|
6810 |
|
|
|
6811 |
|
|
@item @emph{Standard}:
|
6812 |
|
|
Fortran 77 and later
|
6813 |
|
|
|
6814 |
|
|
@item @emph{Class}:
|
6815 |
|
|
Elemental function
|
6816 |
|
|
|
6817 |
|
|
@item @emph{Syntax}:
|
6818 |
|
|
@code{RESULT = LLE(STRING_A, STRING_B)}
|
6819 |
|
|
|
6820 |
|
|
@item @emph{Arguments}:
|
6821 |
|
|
@multitable @columnfractions .15 .70
|
6822 |
|
|
@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
|
6823 |
|
|
@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
|
6824 |
|
|
@end multitable
|
6825 |
|
|
|
6826 |
|
|
@item @emph{Return value}:
|
6827 |
|
|
Returns @code{.TRUE.} if @code{STRING_A <= STRING_B}, and @code{.FALSE.}
|
6828 |
|
|
otherwise, based on the ASCII ordering.
|
6829 |
|
|
|
6830 |
|
|
@item @emph{See also}:
|
6831 |
|
|
@ref{LGE}, @ref{LGT}, @ref{LLT}
|
6832 |
|
|
@end table
|
6833 |
|
|
|
6834 |
|
|
|
6835 |
|
|
|
6836 |
|
|
@node LLT
|
6837 |
|
|
@section @code{LLT} --- Lexical less than
|
6838 |
|
|
@fnindex LLT
|
6839 |
|
|
@cindex lexical comparison of strings
|
6840 |
|
|
@cindex string, comparison
|
6841 |
|
|
|
6842 |
|
|
@table @asis
|
6843 |
|
|
@item @emph{Description}:
|
6844 |
|
|
Determines whether one string is lexically less than another string,
|
6845 |
|
|
where the two strings are interpreted as containing ASCII character
|
6846 |
|
|
codes. If the String A and String B are not the same length, the
|
6847 |
|
|
shorter is compared as if spaces were appended to it to form a value
|
6848 |
|
|
that has the same length as the longer.
|
6849 |
|
|
|
6850 |
|
|
In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
|
6851 |
|
|
@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
|
6852 |
|
|
operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
|
6853 |
|
|
that the latter use the processor's character ordering (which is not
|
6854 |
|
|
ASCII on some targets), whereas the former always use the ASCII
|
6855 |
|
|
ordering.
|
6856 |
|
|
|
6857 |
|
|
@item @emph{Standard}:
|
6858 |
|
|
Fortran 77 and later
|
6859 |
|
|
|
6860 |
|
|
@item @emph{Class}:
|
6861 |
|
|
Elemental function
|
6862 |
|
|
|
6863 |
|
|
@item @emph{Syntax}:
|
6864 |
|
|
@code{RESULT = LLT(STRING_A, STRING_B)}
|
6865 |
|
|
|
6866 |
|
|
@item @emph{Arguments}:
|
6867 |
|
|
@multitable @columnfractions .15 .70
|
6868 |
|
|
@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
|
6869 |
|
|
@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
|
6870 |
|
|
@end multitable
|
6871 |
|
|
|
6872 |
|
|
@item @emph{Return value}:
|
6873 |
|
|
Returns @code{.TRUE.} if @code{STRING_A < STRING_B}, and @code{.FALSE.}
|
6874 |
|
|
otherwise, based on the ASCII ordering.
|
6875 |
|
|
|
6876 |
|
|
@item @emph{See also}:
|
6877 |
|
|
@ref{LGE}, @ref{LGT}, @ref{LLE}
|
6878 |
|
|
@end table
|
6879 |
|
|
|
6880 |
|
|
|
6881 |
|
|
|
6882 |
|
|
@node LNBLNK
|
6883 |
|
|
@section @code{LNBLNK} --- Index of the last non-blank character in a string
|
6884 |
|
|
@fnindex LNBLNK
|
6885 |
|
|
@cindex string, find non-blank character
|
6886 |
|
|
|
6887 |
|
|
@table @asis
|
6888 |
|
|
@item @emph{Description}:
|
6889 |
|
|
Returns the length of a character string, ignoring any trailing blanks.
|
6890 |
|
|
This is identical to the standard @code{LEN_TRIM} intrinsic, and is only
|
6891 |
|
|
included for backwards compatibility.
|
6892 |
|
|
|
6893 |
|
|
@item @emph{Standard}:
|
6894 |
|
|
GNU extension
|
6895 |
|
|
|
6896 |
|
|
@item @emph{Class}:
|
6897 |
|
|
Elemental function
|
6898 |
|
|
|
6899 |
|
|
@item @emph{Syntax}:
|
6900 |
|
|
@code{RESULT = LNBLNK(STRING)}
|
6901 |
|
|
|
6902 |
|
|
@item @emph{Arguments}:
|
6903 |
|
|
@multitable @columnfractions .15 .70
|
6904 |
|
|
@item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER},
|
6905 |
|
|
with @code{INTENT(IN)}
|
6906 |
|
|
@end multitable
|
6907 |
|
|
|
6908 |
|
|
@item @emph{Return value}:
|
6909 |
|
|
The return value is of @code{INTEGER(kind=4)} type.
|
6910 |
|
|
|
6911 |
|
|
@item @emph{See also}:
|
6912 |
|
|
@ref{INDEX intrinsic}, @ref{LEN_TRIM}
|
6913 |
|
|
@end table
|
6914 |
|
|
|
6915 |
|
|
|
6916 |
|
|
|
6917 |
|
|
@node LOC
|
6918 |
|
|
@section @code{LOC} --- Returns the address of a variable
|
6919 |
|
|
@fnindex LOC
|
6920 |
|
|
@cindex location of a variable in memory
|
6921 |
|
|
|
6922 |
|
|
@table @asis
|
6923 |
|
|
@item @emph{Description}:
|
6924 |
|
|
@code{LOC(X)} returns the address of @var{X} as an integer.
|
6925 |
|
|
|
6926 |
|
|
@item @emph{Standard}:
|
6927 |
|
|
GNU extension
|
6928 |
|
|
|
6929 |
|
|
@item @emph{Class}:
|
6930 |
|
|
Inquiry function
|
6931 |
|
|
|
6932 |
|
|
@item @emph{Syntax}:
|
6933 |
|
|
@code{RESULT = LOC(X)}
|
6934 |
|
|
|
6935 |
|
|
@item @emph{Arguments}:
|
6936 |
|
|
@multitable @columnfractions .15 .70
|
6937 |
|
|
@item @var{X} @tab Variable of any type.
|
6938 |
|
|
@end multitable
|
6939 |
|
|
|
6940 |
|
|
@item @emph{Return value}:
|
6941 |
|
|
The return value is of type @code{INTEGER}, with a @code{KIND}
|
6942 |
|
|
corresponding to the size (in bytes) of a memory address on the target
|
6943 |
|
|
machine.
|
6944 |
|
|
|
6945 |
|
|
@item @emph{Example}:
|
6946 |
|
|
@smallexample
|
6947 |
|
|
program test_loc
|
6948 |
|
|
integer :: i
|
6949 |
|
|
real :: r
|
6950 |
|
|
i = loc(r)
|
6951 |
|
|
print *, i
|
6952 |
|
|
end program test_loc
|
6953 |
|
|
@end smallexample
|
6954 |
|
|
@end table
|
6955 |
|
|
|
6956 |
|
|
|
6957 |
|
|
|
6958 |
|
|
@node LOG
|
6959 |
|
|
@section @code{LOG} --- Logarithm function
|
6960 |
|
|
@fnindex LOG
|
6961 |
|
|
@fnindex ALOG
|
6962 |
|
|
@fnindex DLOG
|
6963 |
|
|
@fnindex CLOG
|
6964 |
|
|
@fnindex ZLOG
|
6965 |
|
|
@fnindex CDLOG
|
6966 |
|
|
@cindex exponential function, inverse
|
6967 |
|
|
@cindex logarithmic function
|
6968 |
|
|
|
6969 |
|
|
@table @asis
|
6970 |
|
|
@item @emph{Description}:
|
6971 |
|
|
@code{LOG(X)} computes the logarithm of @var{X}.
|
6972 |
|
|
|
6973 |
|
|
@item @emph{Standard}:
|
6974 |
|
|
Fortran 77 and later
|
6975 |
|
|
|
6976 |
|
|
@item @emph{Class}:
|
6977 |
|
|
Elemental function
|
6978 |
|
|
|
6979 |
|
|
@item @emph{Syntax}:
|
6980 |
|
|
@code{RESULT = LOG(X)}
|
6981 |
|
|
|
6982 |
|
|
@item @emph{Arguments}:
|
6983 |
|
|
@multitable @columnfractions .15 .70
|
6984 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or
|
6985 |
|
|
@code{COMPLEX}.
|
6986 |
|
|
@end multitable
|
6987 |
|
|
|
6988 |
|
|
@item @emph{Return value}:
|
6989 |
|
|
The return value is of type @code{REAL} or @code{COMPLEX}.
|
6990 |
|
|
The kind type parameter is the same as @var{X}.
|
6991 |
|
|
If @var{X} is @code{COMPLEX}, the imaginary part @math{\omega} is in the range
|
6992 |
|
|
@math{-\pi \leq \omega \leq \pi}.
|
6993 |
|
|
|
6994 |
|
|
@item @emph{Example}:
|
6995 |
|
|
@smallexample
|
6996 |
|
|
program test_log
|
6997 |
|
|
real(8) :: x = 1.0_8
|
6998 |
|
|
complex :: z = (1.0, 2.0)
|
6999 |
|
|
x = log(x)
|
7000 |
|
|
z = log(z)
|
7001 |
|
|
end program test_log
|
7002 |
|
|
@end smallexample
|
7003 |
|
|
|
7004 |
|
|
@item @emph{Specific names}:
|
7005 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
7006 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
7007 |
|
|
@item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
|
7008 |
|
|
@item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
|
7009 |
|
|
@item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
|
7010 |
|
|
@item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
|
7011 |
|
|
@item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
|
7012 |
|
|
@end multitable
|
7013 |
|
|
@end table
|
7014 |
|
|
|
7015 |
|
|
|
7016 |
|
|
|
7017 |
|
|
@node LOG10
|
7018 |
|
|
@section @code{LOG10} --- Base 10 logarithm function
|
7019 |
|
|
@fnindex LOG10
|
7020 |
|
|
@fnindex ALOG10
|
7021 |
|
|
@fnindex DLOG10
|
7022 |
|
|
@cindex exponential function, inverse
|
7023 |
|
|
@cindex logarithmic function
|
7024 |
|
|
|
7025 |
|
|
@table @asis
|
7026 |
|
|
@item @emph{Description}:
|
7027 |
|
|
@code{LOG10(X)} computes the base 10 logarithm of @var{X}.
|
7028 |
|
|
|
7029 |
|
|
@item @emph{Standard}:
|
7030 |
|
|
Fortran 77 and later
|
7031 |
|
|
|
7032 |
|
|
@item @emph{Class}:
|
7033 |
|
|
Elemental function
|
7034 |
|
|
|
7035 |
|
|
@item @emph{Syntax}:
|
7036 |
|
|
@code{RESULT = LOG10(X)}
|
7037 |
|
|
|
7038 |
|
|
@item @emph{Arguments}:
|
7039 |
|
|
@multitable @columnfractions .15 .70
|
7040 |
|
|
@item @var{X} @tab The type shall be @code{REAL}.
|
7041 |
|
|
@end multitable
|
7042 |
|
|
|
7043 |
|
|
@item @emph{Return value}:
|
7044 |
|
|
The return value is of type @code{REAL} or @code{COMPLEX}.
|
7045 |
|
|
The kind type parameter is the same as @var{X}.
|
7046 |
|
|
|
7047 |
|
|
@item @emph{Example}:
|
7048 |
|
|
@smallexample
|
7049 |
|
|
program test_log10
|
7050 |
|
|
real(8) :: x = 10.0_8
|
7051 |
|
|
x = log10(x)
|
7052 |
|
|
end program test_log10
|
7053 |
|
|
@end smallexample
|
7054 |
|
|
|
7055 |
|
|
@item @emph{Specific names}:
|
7056 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
7057 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
7058 |
|
|
@item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 95 and later
|
7059 |
|
|
@item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 95 and later
|
7060 |
|
|
@end multitable
|
7061 |
|
|
@end table
|
7062 |
|
|
|
7063 |
|
|
|
7064 |
|
|
|
7065 |
|
|
@node LOG_GAMMA
|
7066 |
|
|
@section @code{LOG_GAMMA} --- Logarithm of the Gamma function
|
7067 |
|
|
@fnindex LOG_GAMMA
|
7068 |
|
|
@fnindex LGAMMA
|
7069 |
|
|
@fnindex ALGAMA
|
7070 |
|
|
@fnindex DLGAMA
|
7071 |
|
|
@cindex Gamma function, logarithm of
|
7072 |
|
|
|
7073 |
|
|
@table @asis
|
7074 |
|
|
@item @emph{Description}:
|
7075 |
|
|
@code{LOG_GAMMA(X)} computes the natural logarithm of the absolute value
|
7076 |
|
|
of the Gamma (@math{\Gamma}) function.
|
7077 |
|
|
|
7078 |
|
|
@item @emph{Standard}:
|
7079 |
|
|
Fortran 2008 and later
|
7080 |
|
|
|
7081 |
|
|
@item @emph{Class}:
|
7082 |
|
|
Elemental function
|
7083 |
|
|
|
7084 |
|
|
@item @emph{Syntax}:
|
7085 |
|
|
@code{X = LOG_GAMMA(X)}
|
7086 |
|
|
|
7087 |
|
|
@item @emph{Arguments}:
|
7088 |
|
|
@multitable @columnfractions .15 .70
|
7089 |
|
|
@item @var{X} @tab Shall be of type @code{REAL} and neither zero
|
7090 |
|
|
nor a negative integer.
|
7091 |
|
|
@end multitable
|
7092 |
|
|
|
7093 |
|
|
@item @emph{Return value}:
|
7094 |
|
|
The return value is of type @code{REAL} of the same kind as @var{X}.
|
7095 |
|
|
|
7096 |
|
|
@item @emph{Example}:
|
7097 |
|
|
@smallexample
|
7098 |
|
|
program test_log_gamma
|
7099 |
|
|
real :: x = 1.0
|
7100 |
|
|
x = lgamma(x) ! returns 0.0
|
7101 |
|
|
end program test_log_gamma
|
7102 |
|
|
@end smallexample
|
7103 |
|
|
|
7104 |
|
|
@item @emph{Specific names}:
|
7105 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
7106 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
7107 |
|
|
@item @code{LGAMMA(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab GNU Extension
|
7108 |
|
|
@item @code{ALGAMA(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab GNU Extension
|
7109 |
|
|
@item @code{DLGAMA(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU Extension
|
7110 |
|
|
@end multitable
|
7111 |
|
|
|
7112 |
|
|
@item @emph{See also}:
|
7113 |
|
|
Gamma function: @ref{GAMMA}
|
7114 |
|
|
|
7115 |
|
|
@end table
|
7116 |
|
|
|
7117 |
|
|
|
7118 |
|
|
|
7119 |
|
|
@node LOGICAL
|
7120 |
|
|
@section @code{LOGICAL} --- Convert to logical type
|
7121 |
|
|
@fnindex LOGICAL
|
7122 |
|
|
@cindex conversion, to logical
|
7123 |
|
|
|
7124 |
|
|
@table @asis
|
7125 |
|
|
@item @emph{Description}:
|
7126 |
|
|
Converts one kind of @code{LOGICAL} variable to another.
|
7127 |
|
|
|
7128 |
|
|
@item @emph{Standard}:
|
7129 |
|
|
Fortran 95 and later
|
7130 |
|
|
|
7131 |
|
|
@item @emph{Class}:
|
7132 |
|
|
Elemental function
|
7133 |
|
|
|
7134 |
|
|
@item @emph{Syntax}:
|
7135 |
|
|
@code{RESULT = LOGICAL(L [, KIND])}
|
7136 |
|
|
|
7137 |
|
|
@item @emph{Arguments}:
|
7138 |
|
|
@multitable @columnfractions .15 .70
|
7139 |
|
|
@item @var{L} @tab The type shall be @code{LOGICAL}.
|
7140 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
7141 |
|
|
expression indicating the kind parameter of the result.
|
7142 |
|
|
@end multitable
|
7143 |
|
|
|
7144 |
|
|
@item @emph{Return value}:
|
7145 |
|
|
The return value is a @code{LOGICAL} value equal to @var{L}, with a
|
7146 |
|
|
kind corresponding to @var{KIND}, or of the default logical kind if
|
7147 |
|
|
@var{KIND} is not given.
|
7148 |
|
|
|
7149 |
|
|
@item @emph{See also}:
|
7150 |
|
|
@ref{INT}, @ref{REAL}, @ref{CMPLX}
|
7151 |
|
|
@end table
|
7152 |
|
|
|
7153 |
|
|
|
7154 |
|
|
|
7155 |
|
|
@node LONG
|
7156 |
|
|
@section @code{LONG} --- Convert to integer type
|
7157 |
|
|
@fnindex LONG
|
7158 |
|
|
@cindex conversion, to integer
|
7159 |
|
|
|
7160 |
|
|
@table @asis
|
7161 |
|
|
@item @emph{Description}:
|
7162 |
|
|
Convert to a @code{KIND=4} integer type, which is the same size as a C
|
7163 |
|
|
@code{long} integer. This is equivalent to the standard @code{INT}
|
7164 |
|
|
intrinsic with an optional argument of @code{KIND=4}, and is only
|
7165 |
|
|
included for backwards compatibility.
|
7166 |
|
|
|
7167 |
|
|
@item @emph{Standard}:
|
7168 |
|
|
GNU extension
|
7169 |
|
|
|
7170 |
|
|
@item @emph{Class}:
|
7171 |
|
|
Elemental function
|
7172 |
|
|
|
7173 |
|
|
@item @emph{Syntax}:
|
7174 |
|
|
@code{RESULT = LONG(A)}
|
7175 |
|
|
|
7176 |
|
|
@item @emph{Arguments}:
|
7177 |
|
|
@multitable @columnfractions .15 .70
|
7178 |
|
|
@item @var{A} @tab Shall be of type @code{INTEGER},
|
7179 |
|
|
@code{REAL}, or @code{COMPLEX}.
|
7180 |
|
|
@end multitable
|
7181 |
|
|
|
7182 |
|
|
@item @emph{Return value}:
|
7183 |
|
|
The return value is a @code{INTEGER(4)} variable.
|
7184 |
|
|
|
7185 |
|
|
@item @emph{See also}:
|
7186 |
|
|
@ref{INT}, @ref{INT2}, @ref{INT8}
|
7187 |
|
|
@end table
|
7188 |
|
|
|
7189 |
|
|
|
7190 |
|
|
|
7191 |
|
|
@node LSHIFT
|
7192 |
|
|
@section @code{LSHIFT} --- Left shift bits
|
7193 |
|
|
@fnindex LSHIFT
|
7194 |
|
|
@cindex bits, shift left
|
7195 |
|
|
|
7196 |
|
|
@table @asis
|
7197 |
|
|
@item @emph{Description}:
|
7198 |
|
|
@code{LSHIFT} returns a value corresponding to @var{I} with all of the
|
7199 |
|
|
bits shifted left by @var{SHIFT} places. If the absolute value of
|
7200 |
|
|
@var{SHIFT} is greater than @code{BIT_SIZE(I)}, the value is undefined.
|
7201 |
|
|
Bits shifted out from the left end are lost; zeros are shifted in from
|
7202 |
|
|
the opposite end.
|
7203 |
|
|
|
7204 |
|
|
This function has been superseded by the @code{ISHFT} intrinsic, which
|
7205 |
|
|
is standard in Fortran 95 and later.
|
7206 |
|
|
|
7207 |
|
|
@item @emph{Standard}:
|
7208 |
|
|
GNU extension
|
7209 |
|
|
|
7210 |
|
|
@item @emph{Class}:
|
7211 |
|
|
Elemental function
|
7212 |
|
|
|
7213 |
|
|
@item @emph{Syntax}:
|
7214 |
|
|
@code{RESULT = LSHIFT(I, SHIFT)}
|
7215 |
|
|
|
7216 |
|
|
@item @emph{Arguments}:
|
7217 |
|
|
@multitable @columnfractions .15 .70
|
7218 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
7219 |
|
|
@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
|
7220 |
|
|
@end multitable
|
7221 |
|
|
|
7222 |
|
|
@item @emph{Return value}:
|
7223 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
7224 |
|
|
@var{I}.
|
7225 |
|
|
|
7226 |
|
|
@item @emph{See also}:
|
7227 |
|
|
@ref{ISHFT}, @ref{ISHFTC}, @ref{RSHIFT}
|
7228 |
|
|
|
7229 |
|
|
@end table
|
7230 |
|
|
|
7231 |
|
|
|
7232 |
|
|
|
7233 |
|
|
@node LSTAT
|
7234 |
|
|
@section @code{LSTAT} --- Get file status
|
7235 |
|
|
@fnindex LSTAT
|
7236 |
|
|
@cindex file system, file status
|
7237 |
|
|
|
7238 |
|
|
@table @asis
|
7239 |
|
|
@item @emph{Description}:
|
7240 |
|
|
@code{LSTAT} is identical to @ref{STAT}, except that if path is a
|
7241 |
|
|
symbolic link, then the link itself is statted, not the file that it
|
7242 |
|
|
refers to.
|
7243 |
|
|
|
7244 |
|
|
The elements in @code{VALUES} are the same as described by @ref{STAT}.
|
7245 |
|
|
|
7246 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
7247 |
|
|
however, only one form can be used in any given program unit.
|
7248 |
|
|
|
7249 |
|
|
@item @emph{Standard}:
|
7250 |
|
|
GNU extension
|
7251 |
|
|
|
7252 |
|
|
@item @emph{Class}:
|
7253 |
|
|
Subroutine, function
|
7254 |
|
|
|
7255 |
|
|
@item @emph{Syntax}:
|
7256 |
|
|
@code{CALL LSTAT(NAME, VALUES [, STATUS])}
|
7257 |
|
|
|
7258 |
|
|
@item @emph{Arguments}:
|
7259 |
|
|
@multitable @columnfractions .15 .70
|
7260 |
|
|
@item @var{NAME} @tab The type shall be @code{CHARACTER} of the default
|
7261 |
|
|
kind, a valid path within the file system.
|
7262 |
|
|
@item @var{VALUES} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
|
7263 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}.
|
7264 |
|
|
Returns 0 on success and a system specific error code otherwise.
|
7265 |
|
|
@end multitable
|
7266 |
|
|
|
7267 |
|
|
@item @emph{Example}:
|
7268 |
|
|
See @ref{STAT} for an example.
|
7269 |
|
|
|
7270 |
|
|
@item @emph{See also}:
|
7271 |
|
|
To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
|
7272 |
|
|
@end table
|
7273 |
|
|
|
7274 |
|
|
|
7275 |
|
|
|
7276 |
|
|
@node LTIME
|
7277 |
|
|
@section @code{LTIME} --- Convert time to local time info
|
7278 |
|
|
@fnindex LTIME
|
7279 |
|
|
@cindex time, conversion to local time info
|
7280 |
|
|
|
7281 |
|
|
@table @asis
|
7282 |
|
|
@item @emph{Description}:
|
7283 |
|
|
Given a system time value @var{TIME} (as provided by the @code{TIME8()}
|
7284 |
|
|
intrinsic), fills @var{VALUES} with values extracted from it appropriate
|
7285 |
|
|
to the local time zone using @code{localtime(3)}.
|
7286 |
|
|
|
7287 |
|
|
@item @emph{Standard}:
|
7288 |
|
|
GNU extension
|
7289 |
|
|
|
7290 |
|
|
@item @emph{Class}:
|
7291 |
|
|
Subroutine
|
7292 |
|
|
|
7293 |
|
|
@item @emph{Syntax}:
|
7294 |
|
|
@code{CALL LTIME(TIME, VALUES)}
|
7295 |
|
|
|
7296 |
|
|
@item @emph{Arguments}:
|
7297 |
|
|
@multitable @columnfractions .15 .70
|
7298 |
|
|
@item @var{TIME} @tab An @code{INTEGER} scalar expression
|
7299 |
|
|
corresponding to a system time, with @code{INTENT(IN)}.
|
7300 |
|
|
@item @var{VALUES} @tab A default @code{INTEGER} array with 9 elements,
|
7301 |
|
|
with @code{INTENT(OUT)}.
|
7302 |
|
|
@end multitable
|
7303 |
|
|
|
7304 |
|
|
@item @emph{Return value}:
|
7305 |
|
|
The elements of @var{VALUES} are assigned as follows:
|
7306 |
|
|
@enumerate
|
7307 |
|
|
@item Seconds after the minute, range 0--59 or 0--61 to allow for leap
|
7308 |
|
|
seconds
|
7309 |
|
|
@item Minutes after the hour, range 0--59
|
7310 |
|
|
@item Hours past midnight, range 0--23
|
7311 |
|
|
@item Day of month, range 0--31
|
7312 |
|
|
@item Number of months since January, range 0--12
|
7313 |
|
|
@item Years since 1900
|
7314 |
|
|
@item Number of days since Sunday, range 0--6
|
7315 |
|
|
@item Days since January 1
|
7316 |
|
|
@item Daylight savings indicator: positive if daylight savings is in
|
7317 |
|
|
effect, zero if not, and negative if the information is not available.
|
7318 |
|
|
@end enumerate
|
7319 |
|
|
|
7320 |
|
|
@item @emph{See also}:
|
7321 |
|
|
@ref{CTIME}, @ref{GMTIME}, @ref{TIME}, @ref{TIME8}
|
7322 |
|
|
|
7323 |
|
|
@end table
|
7324 |
|
|
|
7325 |
|
|
|
7326 |
|
|
|
7327 |
|
|
@node MALLOC
|
7328 |
|
|
@section @code{MALLOC} --- Allocate dynamic memory
|
7329 |
|
|
@fnindex MALLOC
|
7330 |
|
|
@cindex pointer, cray
|
7331 |
|
|
|
7332 |
|
|
@table @asis
|
7333 |
|
|
@item @emph{Description}:
|
7334 |
|
|
@code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
|
7335 |
|
|
returns the address of the allocated memory. The @code{MALLOC} intrinsic
|
7336 |
|
|
is an extension intended to be used with Cray pointers, and is provided
|
7337 |
|
|
in GNU Fortran to allow the user to compile legacy code. For new code
|
7338 |
|
|
using Fortran 95 pointers, the memory allocation intrinsic is
|
7339 |
|
|
@code{ALLOCATE}.
|
7340 |
|
|
|
7341 |
|
|
@item @emph{Standard}:
|
7342 |
|
|
GNU extension
|
7343 |
|
|
|
7344 |
|
|
@item @emph{Class}:
|
7345 |
|
|
Function
|
7346 |
|
|
|
7347 |
|
|
@item @emph{Syntax}:
|
7348 |
|
|
@code{PTR = MALLOC(SIZE)}
|
7349 |
|
|
|
7350 |
|
|
@item @emph{Arguments}:
|
7351 |
|
|
@multitable @columnfractions .15 .70
|
7352 |
|
|
@item @var{SIZE} @tab The type shall be @code{INTEGER}.
|
7353 |
|
|
@end multitable
|
7354 |
|
|
|
7355 |
|
|
@item @emph{Return value}:
|
7356 |
|
|
The return value is of type @code{INTEGER(K)}, with @var{K} such that
|
7357 |
|
|
variables of type @code{INTEGER(K)} have the same size as
|
7358 |
|
|
C pointers (@code{sizeof(void *)}).
|
7359 |
|
|
|
7360 |
|
|
@item @emph{Example}:
|
7361 |
|
|
The following example demonstrates the use of @code{MALLOC} and
|
7362 |
|
|
@code{FREE} with Cray pointers.
|
7363 |
|
|
|
7364 |
|
|
@smallexample
|
7365 |
|
|
program test_malloc
|
7366 |
|
|
implicit none
|
7367 |
|
|
integer i
|
7368 |
|
|
real*8 x(*), z
|
7369 |
|
|
pointer(ptr_x,x)
|
7370 |
|
|
|
7371 |
|
|
ptr_x = malloc(20*8)
|
7372 |
|
|
do i = 1, 20
|
7373 |
|
|
x(i) = sqrt(1.0d0 / i)
|
7374 |
|
|
end do
|
7375 |
|
|
z = 0
|
7376 |
|
|
do i = 1, 20
|
7377 |
|
|
z = z + x(i)
|
7378 |
|
|
print *, z
|
7379 |
|
|
end do
|
7380 |
|
|
call free(ptr_x)
|
7381 |
|
|
end program test_malloc
|
7382 |
|
|
@end smallexample
|
7383 |
|
|
|
7384 |
|
|
@item @emph{See also}:
|
7385 |
|
|
@ref{FREE}
|
7386 |
|
|
@end table
|
7387 |
|
|
|
7388 |
|
|
|
7389 |
|
|
|
7390 |
|
|
@node MATMUL
|
7391 |
|
|
@section @code{MATMUL} --- matrix multiplication
|
7392 |
|
|
@fnindex MATMUL
|
7393 |
|
|
@cindex matrix multiplication
|
7394 |
|
|
@cindex product, matrix
|
7395 |
|
|
|
7396 |
|
|
@table @asis
|
7397 |
|
|
@item @emph{Description}:
|
7398 |
|
|
Performs a matrix multiplication on numeric or logical arguments.
|
7399 |
|
|
|
7400 |
|
|
@item @emph{Standard}:
|
7401 |
|
|
Fortran 95 and later
|
7402 |
|
|
|
7403 |
|
|
@item @emph{Class}:
|
7404 |
|
|
Transformational function
|
7405 |
|
|
|
7406 |
|
|
@item @emph{Syntax}:
|
7407 |
|
|
@code{RESULT = MATMUL(MATRIX_A, MATRIX_B)}
|
7408 |
|
|
|
7409 |
|
|
@item @emph{Arguments}:
|
7410 |
|
|
@multitable @columnfractions .15 .70
|
7411 |
|
|
@item @var{MATRIX_A} @tab An array of @code{INTEGER},
|
7412 |
|
|
@code{REAL}, @code{COMPLEX}, or @code{LOGICAL} type, with a rank of
|
7413 |
|
|
one or two.
|
7414 |
|
|
@item @var{MATRIX_B} @tab An array of @code{INTEGER},
|
7415 |
|
|
@code{REAL}, or @code{COMPLEX} type if @var{MATRIX_A} is of a numeric
|
7416 |
|
|
type; otherwise, an array of @code{LOGICAL} type. The rank shall be one
|
7417 |
|
|
or two, and the first (or only) dimension of @var{MATRIX_B} shall be
|
7418 |
|
|
equal to the last (or only) dimension of @var{MATRIX_A}.
|
7419 |
|
|
@end multitable
|
7420 |
|
|
|
7421 |
|
|
@item @emph{Return value}:
|
7422 |
|
|
The matrix product of @var{MATRIX_A} and @var{MATRIX_B}. The type and
|
7423 |
|
|
kind of the result follow the usual type and kind promotion rules, as
|
7424 |
|
|
for the @code{*} or @code{.AND.} operators.
|
7425 |
|
|
|
7426 |
|
|
@item @emph{See also}:
|
7427 |
|
|
@end table
|
7428 |
|
|
|
7429 |
|
|
|
7430 |
|
|
|
7431 |
|
|
@node MAX
|
7432 |
|
|
@section @code{MAX} --- Maximum value of an argument list
|
7433 |
|
|
@fnindex MAX
|
7434 |
|
|
@fnindex MAX0
|
7435 |
|
|
@fnindex AMAX0
|
7436 |
|
|
@fnindex MAX1
|
7437 |
|
|
@fnindex AMAX1
|
7438 |
|
|
@fnindex DMAX1
|
7439 |
|
|
@cindex maximum value
|
7440 |
|
|
|
7441 |
|
|
@table @asis
|
7442 |
|
|
@item @emph{Description}:
|
7443 |
|
|
Returns the argument with the largest (most positive) value.
|
7444 |
|
|
|
7445 |
|
|
@item @emph{Standard}:
|
7446 |
|
|
Fortran 77 and later
|
7447 |
|
|
|
7448 |
|
|
@item @emph{Class}:
|
7449 |
|
|
Elemental function
|
7450 |
|
|
|
7451 |
|
|
@item @emph{Syntax}:
|
7452 |
|
|
@code{RESULT = MAX(A1, A2 [, A3 [, ...]])}
|
7453 |
|
|
|
7454 |
|
|
@item @emph{Arguments}:
|
7455 |
|
|
@multitable @columnfractions .15 .70
|
7456 |
|
|
@item @var{A1} @tab The type shall be @code{INTEGER} or
|
7457 |
|
|
@code{REAL}.
|
7458 |
|
|
@item @var{A2}, @var{A3}, ... @tab An expression of the same type and kind
|
7459 |
|
|
as @var{A1}. (As a GNU extension, arguments of different kinds are
|
7460 |
|
|
permitted.)
|
7461 |
|
|
@end multitable
|
7462 |
|
|
|
7463 |
|
|
@item @emph{Return value}:
|
7464 |
|
|
The return value corresponds to the maximum value among the arguments,
|
7465 |
|
|
and has the same type and kind as the first argument.
|
7466 |
|
|
|
7467 |
|
|
@item @emph{Specific names}:
|
7468 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
7469 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
7470 |
|
|
@item @code{MAX0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab Fortran 77 and later
|
7471 |
|
|
@item @code{AMAX0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab Fortran 77 and later
|
7472 |
|
|
@item @code{MAX1(X)} @tab @code{REAL X} @tab @code{INT(MAX(X))} @tab Fortran 77 and later
|
7473 |
|
|
@item @code{AMAX1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 77 and later
|
7474 |
|
|
@item @code{DMAX1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
7475 |
|
|
@end multitable
|
7476 |
|
|
|
7477 |
|
|
@item @emph{See also}:
|
7478 |
|
|
@ref{MAXLOC} @ref{MAXVAL}, @ref{MIN}
|
7479 |
|
|
|
7480 |
|
|
@end table
|
7481 |
|
|
|
7482 |
|
|
|
7483 |
|
|
|
7484 |
|
|
@node MAXEXPONENT
|
7485 |
|
|
@section @code{MAXEXPONENT} --- Maximum exponent of a real kind
|
7486 |
|
|
@fnindex MAXEXPONENT
|
7487 |
|
|
@cindex model representation, maximum exponent
|
7488 |
|
|
|
7489 |
|
|
@table @asis
|
7490 |
|
|
@item @emph{Description}:
|
7491 |
|
|
@code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
|
7492 |
|
|
type of @code{X}.
|
7493 |
|
|
|
7494 |
|
|
@item @emph{Standard}:
|
7495 |
|
|
Fortran 95 and later
|
7496 |
|
|
|
7497 |
|
|
@item @emph{Class}:
|
7498 |
|
|
Inquiry function
|
7499 |
|
|
|
7500 |
|
|
@item @emph{Syntax}:
|
7501 |
|
|
@code{RESULT = MAXEXPONENT(X)}
|
7502 |
|
|
|
7503 |
|
|
@item @emph{Arguments}:
|
7504 |
|
|
@multitable @columnfractions .15 .70
|
7505 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
7506 |
|
|
@end multitable
|
7507 |
|
|
|
7508 |
|
|
@item @emph{Return value}:
|
7509 |
|
|
The return value is of type @code{INTEGER} and of the default integer
|
7510 |
|
|
kind.
|
7511 |
|
|
|
7512 |
|
|
@item @emph{Example}:
|
7513 |
|
|
@smallexample
|
7514 |
|
|
program exponents
|
7515 |
|
|
real(kind=4) :: x
|
7516 |
|
|
real(kind=8) :: y
|
7517 |
|
|
|
7518 |
|
|
print *, minexponent(x), maxexponent(x)
|
7519 |
|
|
print *, minexponent(y), maxexponent(y)
|
7520 |
|
|
end program exponents
|
7521 |
|
|
@end smallexample
|
7522 |
|
|
@end table
|
7523 |
|
|
|
7524 |
|
|
|
7525 |
|
|
|
7526 |
|
|
@node MAXLOC
|
7527 |
|
|
@section @code{MAXLOC} --- Location of the maximum value within an array
|
7528 |
|
|
@fnindex MAXLOC
|
7529 |
|
|
@cindex array, location of maximum element
|
7530 |
|
|
|
7531 |
|
|
@table @asis
|
7532 |
|
|
@item @emph{Description}:
|
7533 |
|
|
Determines the location of the element in the array with the maximum
|
7534 |
|
|
value, or, if the @var{DIM} argument is supplied, determines the
|
7535 |
|
|
locations of the maximum element along each row of the array in the
|
7536 |
|
|
@var{DIM} direction. If @var{MASK} is present, only the elements for
|
7537 |
|
|
which @var{MASK} is @code{.TRUE.} are considered. If more than one
|
7538 |
|
|
element in the array has the maximum value, the location returned is
|
7539 |
|
|
that of the first such element in array element order. If the array has
|
7540 |
|
|
zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then
|
7541 |
|
|
the result is an array of zeroes. Similarly, if @var{DIM} is supplied
|
7542 |
|
|
and all of the elements of @var{MASK} along a given row are zero, the
|
7543 |
|
|
result value for that row is zero.
|
7544 |
|
|
|
7545 |
|
|
@item @emph{Standard}:
|
7546 |
|
|
Fortran 95 and later
|
7547 |
|
|
|
7548 |
|
|
@item @emph{Class}:
|
7549 |
|
|
Transformational function
|
7550 |
|
|
|
7551 |
|
|
@item @emph{Syntax}:
|
7552 |
|
|
@multitable @columnfractions .80
|
7553 |
|
|
@item @code{RESULT = MAXLOC(ARRAY, DIM [, MASK])}
|
7554 |
|
|
@item @code{RESULT = MAXLOC(ARRAY [, MASK])}
|
7555 |
|
|
@end multitable
|
7556 |
|
|
|
7557 |
|
|
@item @emph{Arguments}:
|
7558 |
|
|
@multitable @columnfractions .15 .70
|
7559 |
|
|
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or
|
7560 |
|
|
@code{REAL}.
|
7561 |
|
|
@item @var{DIM} @tab (Optional) Shall be a scalar of type
|
7562 |
|
|
@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
|
7563 |
|
|
inclusive. It may not be an optional dummy argument.
|
7564 |
|
|
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
|
7565 |
|
|
and conformable with @var{ARRAY}.
|
7566 |
|
|
@end multitable
|
7567 |
|
|
|
7568 |
|
|
@item @emph{Return value}:
|
7569 |
|
|
If @var{DIM} is absent, the result is a rank-one array with a length
|
7570 |
|
|
equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result
|
7571 |
|
|
is an array with a rank one less than the rank of @var{ARRAY}, and a
|
7572 |
|
|
size corresponding to the size of @var{ARRAY} with the @var{DIM}
|
7573 |
|
|
dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank
|
7574 |
|
|
of one, the result is a scalar. In all cases, the result is of default
|
7575 |
|
|
@code{INTEGER} type.
|
7576 |
|
|
|
7577 |
|
|
@item @emph{See also}:
|
7578 |
|
|
@ref{MAX}, @ref{MAXVAL}
|
7579 |
|
|
|
7580 |
|
|
@end table
|
7581 |
|
|
|
7582 |
|
|
|
7583 |
|
|
|
7584 |
|
|
@node MAXVAL
|
7585 |
|
|
@section @code{MAXVAL} --- Maximum value of an array
|
7586 |
|
|
@fnindex MAXVAL
|
7587 |
|
|
@cindex array, maximum value
|
7588 |
|
|
@cindex maximum value
|
7589 |
|
|
|
7590 |
|
|
@table @asis
|
7591 |
|
|
@item @emph{Description}:
|
7592 |
|
|
Determines the maximum value of the elements in an array value, or, if
|
7593 |
|
|
the @var{DIM} argument is supplied, determines the maximum value along
|
7594 |
|
|
each row of the array in the @var{DIM} direction. If @var{MASK} is
|
7595 |
|
|
present, only the elements for which @var{MASK} is @code{.TRUE.} are
|
7596 |
|
|
considered. If the array has zero size, or all of the elements of
|
7597 |
|
|
@var{MASK} are @code{.FALSE.}, then the result is @code{-HUGE(ARRAY)}
|
7598 |
|
|
if @var{ARRAY} is numeric, or a string of nulls if @var{ARRAY} is of character
|
7599 |
|
|
type.
|
7600 |
|
|
|
7601 |
|
|
@item @emph{Standard}:
|
7602 |
|
|
Fortran 95 and later
|
7603 |
|
|
|
7604 |
|
|
@item @emph{Class}:
|
7605 |
|
|
Transformational function
|
7606 |
|
|
|
7607 |
|
|
@item @emph{Syntax}:
|
7608 |
|
|
@multitable @columnfractions .80
|
7609 |
|
|
@item @code{RESULT = MAXVAL(ARRAY, DIM [, MASK])}
|
7610 |
|
|
@item @code{RESULT = MAXVAL(ARRAY [, MASK])}
|
7611 |
|
|
@end multitable
|
7612 |
|
|
|
7613 |
|
|
@item @emph{Arguments}:
|
7614 |
|
|
@multitable @columnfractions .15 .70
|
7615 |
|
|
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or
|
7616 |
|
|
@code{REAL}.
|
7617 |
|
|
@item @var{DIM} @tab (Optional) Shall be a scalar of type
|
7618 |
|
|
@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
|
7619 |
|
|
inclusive. It may not be an optional dummy argument.
|
7620 |
|
|
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
|
7621 |
|
|
and conformable with @var{ARRAY}.
|
7622 |
|
|
@end multitable
|
7623 |
|
|
|
7624 |
|
|
@item @emph{Return value}:
|
7625 |
|
|
If @var{DIM} is absent, or if @var{ARRAY} has a rank of one, the result
|
7626 |
|
|
is a scalar. If @var{DIM} is present, the result is an array with a
|
7627 |
|
|
rank one less than the rank of @var{ARRAY}, and a size corresponding to
|
7628 |
|
|
the size of @var{ARRAY} with the @var{DIM} dimension removed. In all
|
7629 |
|
|
cases, the result is of the same type and kind as @var{ARRAY}.
|
7630 |
|
|
|
7631 |
|
|
@item @emph{See also}:
|
7632 |
|
|
@ref{MAX}, @ref{MAXLOC}
|
7633 |
|
|
@end table
|
7634 |
|
|
|
7635 |
|
|
|
7636 |
|
|
|
7637 |
|
|
@node MCLOCK
|
7638 |
|
|
@section @code{MCLOCK} --- Time function
|
7639 |
|
|
@fnindex MCLOCK
|
7640 |
|
|
@cindex time, clock ticks
|
7641 |
|
|
@cindex clock ticks
|
7642 |
|
|
|
7643 |
|
|
@table @asis
|
7644 |
|
|
@item @emph{Description}:
|
7645 |
|
|
Returns the number of clock ticks since the start of the process, based
|
7646 |
|
|
on the UNIX function @code{clock(3)}.
|
7647 |
|
|
|
7648 |
|
|
This intrinsic is not fully portable, such as to systems with 32-bit
|
7649 |
|
|
@code{INTEGER} types but supporting times wider than 32 bits. Therefore,
|
7650 |
|
|
the values returned by this intrinsic might be, or become, negative, or
|
7651 |
|
|
numerically less than previous values, during a single run of the
|
7652 |
|
|
compiled program.
|
7653 |
|
|
|
7654 |
|
|
@item @emph{Standard}:
|
7655 |
|
|
GNU extension
|
7656 |
|
|
|
7657 |
|
|
@item @emph{Class}:
|
7658 |
|
|
Function
|
7659 |
|
|
|
7660 |
|
|
@item @emph{Syntax}:
|
7661 |
|
|
@code{RESULT = MCLOCK()}
|
7662 |
|
|
|
7663 |
|
|
@item @emph{Return value}:
|
7664 |
|
|
The return value is a scalar of type @code{INTEGER(4)}, equal to the
|
7665 |
|
|
number of clock ticks since the start of the process, or @code{-1} if
|
7666 |
|
|
the system does not support @code{clock(3)}.
|
7667 |
|
|
|
7668 |
|
|
@item @emph{See also}:
|
7669 |
|
|
@ref{CTIME}, @ref{GMTIME}, @ref{LTIME}, @ref{MCLOCK}, @ref{TIME}
|
7670 |
|
|
|
7671 |
|
|
@end table
|
7672 |
|
|
|
7673 |
|
|
|
7674 |
|
|
|
7675 |
|
|
@node MCLOCK8
|
7676 |
|
|
@section @code{MCLOCK8} --- Time function (64-bit)
|
7677 |
|
|
@fnindex MCLOCK8
|
7678 |
|
|
@cindex time, clock ticks
|
7679 |
|
|
@cindex clock ticks
|
7680 |
|
|
|
7681 |
|
|
@table @asis
|
7682 |
|
|
@item @emph{Description}:
|
7683 |
|
|
Returns the number of clock ticks since the start of the process, based
|
7684 |
|
|
on the UNIX function @code{clock(3)}.
|
7685 |
|
|
|
7686 |
|
|
@emph{Warning:} this intrinsic does not increase the range of the timing
|
7687 |
|
|
values over that returned by @code{clock(3)}. On a system with a 32-bit
|
7688 |
|
|
@code{clock(3)}, @code{MCLOCK8()} will return a 32-bit value, even though
|
7689 |
|
|
it is converted to a 64-bit @code{INTEGER(8)} value. That means
|
7690 |
|
|
overflows of the 32-bit value can still occur. Therefore, the values
|
7691 |
|
|
returned by this intrinsic might be or become negative or numerically
|
7692 |
|
|
less than previous values during a single run of the compiled program.
|
7693 |
|
|
|
7694 |
|
|
@item @emph{Standard}:
|
7695 |
|
|
GNU extension
|
7696 |
|
|
|
7697 |
|
|
@item @emph{Class}:
|
7698 |
|
|
Function
|
7699 |
|
|
|
7700 |
|
|
@item @emph{Syntax}:
|
7701 |
|
|
@code{RESULT = MCLOCK8()}
|
7702 |
|
|
|
7703 |
|
|
@item @emph{Return value}:
|
7704 |
|
|
The return value is a scalar of type @code{INTEGER(8)}, equal to the
|
7705 |
|
|
number of clock ticks since the start of the process, or @code{-1} if
|
7706 |
|
|
the system does not support @code{clock(3)}.
|
7707 |
|
|
|
7708 |
|
|
@item @emph{See also}:
|
7709 |
|
|
@ref{CTIME}, @ref{GMTIME}, @ref{LTIME}, @ref{MCLOCK}, @ref{TIME8}
|
7710 |
|
|
|
7711 |
|
|
@end table
|
7712 |
|
|
|
7713 |
|
|
|
7714 |
|
|
|
7715 |
|
|
@node MERGE
|
7716 |
|
|
@section @code{MERGE} --- Merge variables
|
7717 |
|
|
@fnindex MERGE
|
7718 |
|
|
@cindex array, merge arrays
|
7719 |
|
|
@cindex array, combine arrays
|
7720 |
|
|
|
7721 |
|
|
@table @asis
|
7722 |
|
|
@item @emph{Description}:
|
7723 |
|
|
Select values from two arrays according to a logical mask. The result
|
7724 |
|
|
is equal to @var{TSOURCE} if @var{MASK} is @code{.TRUE.}, or equal to
|
7725 |
|
|
@var{FSOURCE} if it is @code{.FALSE.}.
|
7726 |
|
|
|
7727 |
|
|
@item @emph{Standard}:
|
7728 |
|
|
Fortran 95 and later
|
7729 |
|
|
|
7730 |
|
|
@item @emph{Class}:
|
7731 |
|
|
Elemental function
|
7732 |
|
|
|
7733 |
|
|
@item @emph{Syntax}:
|
7734 |
|
|
@code{RESULT = MERGE(TSOURCE, FSOURCE, MASK)}
|
7735 |
|
|
|
7736 |
|
|
@item @emph{Arguments}:
|
7737 |
|
|
@multitable @columnfractions .15 .70
|
7738 |
|
|
@item @var{TSOURCE} @tab May be of any type.
|
7739 |
|
|
@item @var{FSOURCE} @tab Shall be of the same type and type parameters
|
7740 |
|
|
as @var{TSOURCE}.
|
7741 |
|
|
@item @var{MASK} @tab Shall be of type @code{LOGICAL}.
|
7742 |
|
|
@end multitable
|
7743 |
|
|
|
7744 |
|
|
@item @emph{Return value}:
|
7745 |
|
|
The result is of the same type and type parameters as @var{TSOURCE}.
|
7746 |
|
|
|
7747 |
|
|
@end table
|
7748 |
|
|
|
7749 |
|
|
|
7750 |
|
|
|
7751 |
|
|
@node MIN
|
7752 |
|
|
@section @code{MIN} --- Minimum value of an argument list
|
7753 |
|
|
@fnindex MIN
|
7754 |
|
|
@fnindex MIN0
|
7755 |
|
|
@fnindex AMIN0
|
7756 |
|
|
@fnindex MIN1
|
7757 |
|
|
@fnindex AMIN1
|
7758 |
|
|
@fnindex DMIN1
|
7759 |
|
|
@cindex minimum value
|
7760 |
|
|
|
7761 |
|
|
@table @asis
|
7762 |
|
|
@item @emph{Description}:
|
7763 |
|
|
Returns the argument with the smallest (most negative) value.
|
7764 |
|
|
|
7765 |
|
|
@item @emph{Standard}:
|
7766 |
|
|
Fortran 77 and later
|
7767 |
|
|
|
7768 |
|
|
@item @emph{Class}:
|
7769 |
|
|
Elemental function
|
7770 |
|
|
|
7771 |
|
|
@item @emph{Syntax}:
|
7772 |
|
|
@code{RESULT = MIN(A1, A2 [, A3, ...])}
|
7773 |
|
|
|
7774 |
|
|
@item @emph{Arguments}:
|
7775 |
|
|
@multitable @columnfractions .15 .70
|
7776 |
|
|
@item @var{A1} @tab The type shall be @code{INTEGER} or
|
7777 |
|
|
@code{REAL}.
|
7778 |
|
|
@item @var{A2}, @var{A3}, ... @tab An expression of the same type and kind
|
7779 |
|
|
as @var{A1}. (As a GNU extension, arguments of different kinds are
|
7780 |
|
|
permitted.)
|
7781 |
|
|
@end multitable
|
7782 |
|
|
|
7783 |
|
|
@item @emph{Return value}:
|
7784 |
|
|
The return value corresponds to the maximum value among the arguments,
|
7785 |
|
|
and has the same type and kind as the first argument.
|
7786 |
|
|
|
7787 |
|
|
@item @emph{Specific names}:
|
7788 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
7789 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
7790 |
|
|
@item @code{MIN0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab Fortran 77 and later
|
7791 |
|
|
@item @code{AMIN0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab Fortran 77 and later
|
7792 |
|
|
@item @code{MIN1(X)} @tab @code{REAL X} @tab @code{INT(MIN(X))} @tab Fortran 77 and later
|
7793 |
|
|
@item @code{AMIN1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab Fortran 77 and later
|
7794 |
|
|
@item @code{DMIN1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 77 and later
|
7795 |
|
|
@end multitable
|
7796 |
|
|
|
7797 |
|
|
@item @emph{See also}:
|
7798 |
|
|
@ref{MAX}, @ref{MINLOC}, @ref{MINVAL}
|
7799 |
|
|
@end table
|
7800 |
|
|
|
7801 |
|
|
|
7802 |
|
|
|
7803 |
|
|
@node MINEXPONENT
|
7804 |
|
|
@section @code{MINEXPONENT} --- Minimum exponent of a real kind
|
7805 |
|
|
@fnindex MINEXPONENT
|
7806 |
|
|
@cindex model representation, minimum exponent
|
7807 |
|
|
|
7808 |
|
|
@table @asis
|
7809 |
|
|
@item @emph{Description}:
|
7810 |
|
|
@code{MINEXPONENT(X)} returns the minimum exponent in the model of the
|
7811 |
|
|
type of @code{X}.
|
7812 |
|
|
|
7813 |
|
|
@item @emph{Standard}:
|
7814 |
|
|
Fortran 95 and later
|
7815 |
|
|
|
7816 |
|
|
@item @emph{Class}:
|
7817 |
|
|
Inquiry function
|
7818 |
|
|
|
7819 |
|
|
@item @emph{Syntax}:
|
7820 |
|
|
@code{RESULT = MINEXPONENT(X)}
|
7821 |
|
|
|
7822 |
|
|
@item @emph{Arguments}:
|
7823 |
|
|
@multitable @columnfractions .15 .70
|
7824 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
7825 |
|
|
@end multitable
|
7826 |
|
|
|
7827 |
|
|
@item @emph{Return value}:
|
7828 |
|
|
The return value is of type @code{INTEGER} and of the default integer
|
7829 |
|
|
kind.
|
7830 |
|
|
|
7831 |
|
|
@item @emph{Example}:
|
7832 |
|
|
See @code{MAXEXPONENT} for an example.
|
7833 |
|
|
@end table
|
7834 |
|
|
|
7835 |
|
|
|
7836 |
|
|
|
7837 |
|
|
@node MINLOC
|
7838 |
|
|
@section @code{MINLOC} --- Location of the minimum value within an array
|
7839 |
|
|
@fnindex MINLOC
|
7840 |
|
|
@cindex array, location of minimum element
|
7841 |
|
|
|
7842 |
|
|
@table @asis
|
7843 |
|
|
@item @emph{Description}:
|
7844 |
|
|
Determines the location of the element in the array with the minimum
|
7845 |
|
|
value, or, if the @var{DIM} argument is supplied, determines the
|
7846 |
|
|
locations of the minimum element along each row of the array in the
|
7847 |
|
|
@var{DIM} direction. If @var{MASK} is present, only the elements for
|
7848 |
|
|
which @var{MASK} is @code{.TRUE.} are considered. If more than one
|
7849 |
|
|
element in the array has the minimum value, the location returned is
|
7850 |
|
|
that of the first such element in array element order. If the array has
|
7851 |
|
|
zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then
|
7852 |
|
|
the result is an array of zeroes. Similarly, if @var{DIM} is supplied
|
7853 |
|
|
and all of the elements of @var{MASK} along a given row are zero, the
|
7854 |
|
|
result value for that row is zero.
|
7855 |
|
|
|
7856 |
|
|
@item @emph{Standard}:
|
7857 |
|
|
Fortran 95 and later
|
7858 |
|
|
|
7859 |
|
|
@item @emph{Class}:
|
7860 |
|
|
Transformational function
|
7861 |
|
|
|
7862 |
|
|
@item @emph{Syntax}:
|
7863 |
|
|
@multitable @columnfractions .80
|
7864 |
|
|
@item @code{RESULT = MINLOC(ARRAY, DIM [, MASK])}
|
7865 |
|
|
@item @code{RESULT = MINLOC(ARRAY [, MASK])}
|
7866 |
|
|
@end multitable
|
7867 |
|
|
|
7868 |
|
|
@item @emph{Arguments}:
|
7869 |
|
|
@multitable @columnfractions .15 .70
|
7870 |
|
|
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or
|
7871 |
|
|
@code{REAL}.
|
7872 |
|
|
@item @var{DIM} @tab (Optional) Shall be a scalar of type
|
7873 |
|
|
@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
|
7874 |
|
|
inclusive. It may not be an optional dummy argument.
|
7875 |
|
|
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
|
7876 |
|
|
and conformable with @var{ARRAY}.
|
7877 |
|
|
@end multitable
|
7878 |
|
|
|
7879 |
|
|
@item @emph{Return value}:
|
7880 |
|
|
If @var{DIM} is absent, the result is a rank-one array with a length
|
7881 |
|
|
equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result
|
7882 |
|
|
is an array with a rank one less than the rank of @var{ARRAY}, and a
|
7883 |
|
|
size corresponding to the size of @var{ARRAY} with the @var{DIM}
|
7884 |
|
|
dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank
|
7885 |
|
|
of one, the result is a scalar. In all cases, the result is of default
|
7886 |
|
|
@code{INTEGER} type.
|
7887 |
|
|
|
7888 |
|
|
@item @emph{See also}:
|
7889 |
|
|
@ref{MIN}, @ref{MINVAL}
|
7890 |
|
|
|
7891 |
|
|
@end table
|
7892 |
|
|
|
7893 |
|
|
|
7894 |
|
|
|
7895 |
|
|
@node MINVAL
|
7896 |
|
|
@section @code{MINVAL} --- Minimum value of an array
|
7897 |
|
|
@fnindex MINVAL
|
7898 |
|
|
@cindex array, minimum value
|
7899 |
|
|
@cindex minimum value
|
7900 |
|
|
|
7901 |
|
|
@table @asis
|
7902 |
|
|
@item @emph{Description}:
|
7903 |
|
|
Determines the minimum value of the elements in an array value, or, if
|
7904 |
|
|
the @var{DIM} argument is supplied, determines the minimum value along
|
7905 |
|
|
each row of the array in the @var{DIM} direction. If @var{MASK} is
|
7906 |
|
|
present, only the elements for which @var{MASK} is @code{.TRUE.} are
|
7907 |
|
|
considered. If the array has zero size, or all of the elements of
|
7908 |
|
|
@var{MASK} are @code{.FALSE.}, then the result is @code{HUGE(ARRAY)} if
|
7909 |
|
|
@var{ARRAY} is numeric, or a string of @code{CHAR(255)} characters if
|
7910 |
|
|
@var{ARRAY} is of character type.
|
7911 |
|
|
|
7912 |
|
|
@item @emph{Standard}:
|
7913 |
|
|
Fortran 95 and later
|
7914 |
|
|
|
7915 |
|
|
@item @emph{Class}:
|
7916 |
|
|
Transformational function
|
7917 |
|
|
|
7918 |
|
|
@item @emph{Syntax}:
|
7919 |
|
|
@multitable @columnfractions .80
|
7920 |
|
|
@item @code{RESULT = MINVAL(ARRAY, DIM [, MASK])}
|
7921 |
|
|
@item @code{RESULT = MINVAL(ARRAY [, MASK])}
|
7922 |
|
|
@end multitable
|
7923 |
|
|
|
7924 |
|
|
@item @emph{Arguments}:
|
7925 |
|
|
@multitable @columnfractions .15 .70
|
7926 |
|
|
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER} or
|
7927 |
|
|
@code{REAL}.
|
7928 |
|
|
@item @var{DIM} @tab (Optional) Shall be a scalar of type
|
7929 |
|
|
@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
|
7930 |
|
|
inclusive. It may not be an optional dummy argument.
|
7931 |
|
|
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
|
7932 |
|
|
and conformable with @var{ARRAY}.
|
7933 |
|
|
@end multitable
|
7934 |
|
|
|
7935 |
|
|
@item @emph{Return value}:
|
7936 |
|
|
If @var{DIM} is absent, or if @var{ARRAY} has a rank of one, the result
|
7937 |
|
|
is a scalar. If @var{DIM} is present, the result is an array with a
|
7938 |
|
|
rank one less than the rank of @var{ARRAY}, and a size corresponding to
|
7939 |
|
|
the size of @var{ARRAY} with the @var{DIM} dimension removed. In all
|
7940 |
|
|
cases, the result is of the same type and kind as @var{ARRAY}.
|
7941 |
|
|
|
7942 |
|
|
@item @emph{See also}:
|
7943 |
|
|
@ref{MIN}, @ref{MINLOC}
|
7944 |
|
|
|
7945 |
|
|
@end table
|
7946 |
|
|
|
7947 |
|
|
|
7948 |
|
|
|
7949 |
|
|
@node MOD
|
7950 |
|
|
@section @code{MOD} --- Remainder function
|
7951 |
|
|
@fnindex MOD
|
7952 |
|
|
@fnindex AMOD
|
7953 |
|
|
@fnindex DMOD
|
7954 |
|
|
@cindex remainder
|
7955 |
|
|
@cindex division, remainder
|
7956 |
|
|
|
7957 |
|
|
@table @asis
|
7958 |
|
|
@item @emph{Description}:
|
7959 |
|
|
@code{MOD(A,P)} computes the remainder of the division of A by P@. It is
|
7960 |
|
|
calculated as @code{A - (INT(A/P) * P)}.
|
7961 |
|
|
|
7962 |
|
|
@item @emph{Standard}:
|
7963 |
|
|
Fortran 77 and later
|
7964 |
|
|
|
7965 |
|
|
@item @emph{Class}:
|
7966 |
|
|
Elemental function
|
7967 |
|
|
|
7968 |
|
|
@item @emph{Syntax}:
|
7969 |
|
|
@code{RESULT = MOD(A, P)}
|
7970 |
|
|
|
7971 |
|
|
@item @emph{Arguments}:
|
7972 |
|
|
@multitable @columnfractions .15 .70
|
7973 |
|
|
@item @var{A} @tab Shall be a scalar of type @code{INTEGER} or @code{REAL}
|
7974 |
|
|
@item @var{P} @tab Shall be a scalar of the same type as @var{A} and not
|
7975 |
|
|
equal to zero
|
7976 |
|
|
@end multitable
|
7977 |
|
|
|
7978 |
|
|
@item @emph{Return value}:
|
7979 |
|
|
The kind of the return value is the result of cross-promoting
|
7980 |
|
|
the kinds of the arguments.
|
7981 |
|
|
|
7982 |
|
|
@item @emph{Example}:
|
7983 |
|
|
@smallexample
|
7984 |
|
|
program test_mod
|
7985 |
|
|
print *, mod(17,3)
|
7986 |
|
|
print *, mod(17.5,5.5)
|
7987 |
|
|
print *, mod(17.5d0,5.5)
|
7988 |
|
|
print *, mod(17.5,5.5d0)
|
7989 |
|
|
|
7990 |
|
|
print *, mod(-17,3)
|
7991 |
|
|
print *, mod(-17.5,5.5)
|
7992 |
|
|
print *, mod(-17.5d0,5.5)
|
7993 |
|
|
print *, mod(-17.5,5.5d0)
|
7994 |
|
|
|
7995 |
|
|
print *, mod(17,-3)
|
7996 |
|
|
print *, mod(17.5,-5.5)
|
7997 |
|
|
print *, mod(17.5d0,-5.5)
|
7998 |
|
|
print *, mod(17.5,-5.5d0)
|
7999 |
|
|
end program test_mod
|
8000 |
|
|
@end smallexample
|
8001 |
|
|
|
8002 |
|
|
@item @emph{Specific names}:
|
8003 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
8004 |
|
|
@item Name @tab Arguments @tab Return type @tab Standard
|
8005 |
|
|
@item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab Fortran 95 and later
|
8006 |
|
|
@item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab Fortran 95 and later
|
8007 |
|
|
@end multitable
|
8008 |
|
|
@end table
|
8009 |
|
|
|
8010 |
|
|
|
8011 |
|
|
|
8012 |
|
|
@node MODULO
|
8013 |
|
|
@section @code{MODULO} --- Modulo function
|
8014 |
|
|
@fnindex MODULO
|
8015 |
|
|
@cindex modulo
|
8016 |
|
|
@cindex division, modulo
|
8017 |
|
|
|
8018 |
|
|
@table @asis
|
8019 |
|
|
@item @emph{Description}:
|
8020 |
|
|
@code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
|
8021 |
|
|
|
8022 |
|
|
@item @emph{Standard}:
|
8023 |
|
|
Fortran 95 and later
|
8024 |
|
|
|
8025 |
|
|
@item @emph{Class}:
|
8026 |
|
|
Elemental function
|
8027 |
|
|
|
8028 |
|
|
@item @emph{Syntax}:
|
8029 |
|
|
@code{RESULT = MODULO(A, P)}
|
8030 |
|
|
|
8031 |
|
|
@item @emph{Arguments}:
|
8032 |
|
|
@multitable @columnfractions .15 .70
|
8033 |
|
|
@item @var{A} @tab Shall be a scalar of type @code{INTEGER} or @code{REAL}
|
8034 |
|
|
@item @var{P} @tab Shall be a scalar of the same type and kind as @var{A}
|
8035 |
|
|
@end multitable
|
8036 |
|
|
|
8037 |
|
|
@item @emph{Return value}:
|
8038 |
|
|
The type and kind of the result are those of the arguments.
|
8039 |
|
|
@table @asis
|
8040 |
|
|
@item If @var{A} and @var{P} are of type @code{INTEGER}:
|
8041 |
|
|
@code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
|
8042 |
|
|
@var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
|
8043 |
|
|
(exclusive).
|
8044 |
|
|
@item If @var{A} and @var{P} are of type @code{REAL}:
|
8045 |
|
|
@code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
|
8046 |
|
|
@end table
|
8047 |
|
|
In all cases, if @var{P} is zero the result is processor-dependent.
|
8048 |
|
|
|
8049 |
|
|
@item @emph{Example}:
|
8050 |
|
|
@smallexample
|
8051 |
|
|
program test_modulo
|
8052 |
|
|
print *, modulo(17,3)
|
8053 |
|
|
print *, modulo(17.5,5.5)
|
8054 |
|
|
|
8055 |
|
|
print *, modulo(-17,3)
|
8056 |
|
|
print *, modulo(-17.5,5.5)
|
8057 |
|
|
|
8058 |
|
|
print *, modulo(17,-3)
|
8059 |
|
|
print *, modulo(17.5,-5.5)
|
8060 |
|
|
end program
|
8061 |
|
|
@end smallexample
|
8062 |
|
|
|
8063 |
|
|
@end table
|
8064 |
|
|
|
8065 |
|
|
|
8066 |
|
|
|
8067 |
|
|
@node MOVE_ALLOC
|
8068 |
|
|
@section @code{MOVE_ALLOC} --- Move allocation from one object to another
|
8069 |
|
|
@fnindex MOVE_ALLOC
|
8070 |
|
|
@cindex moving allocation
|
8071 |
|
|
@cindex allocation, moving
|
8072 |
|
|
|
8073 |
|
|
@table @asis
|
8074 |
|
|
@item @emph{Description}:
|
8075 |
|
|
@code{MOVE_ALLOC(FROM, TO)} moves the allocation from @var{FROM} to
|
8076 |
|
|
@var{TO}. @var{FROM} will become deallocated in the process.
|
8077 |
|
|
|
8078 |
|
|
@item @emph{Standard}:
|
8079 |
|
|
Fortran 2003 and later
|
8080 |
|
|
|
8081 |
|
|
@item @emph{Class}:
|
8082 |
|
|
Subroutine
|
8083 |
|
|
|
8084 |
|
|
@item @emph{Syntax}:
|
8085 |
|
|
@code{CALL MOVE_ALLOC(FROM, TO)}
|
8086 |
|
|
|
8087 |
|
|
@item @emph{Arguments}:
|
8088 |
|
|
@multitable @columnfractions .15 .70
|
8089 |
|
|
@item @var{FROM} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be
|
8090 |
|
|
of any type and kind.
|
8091 |
|
|
@item @var{TO} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be
|
8092 |
|
|
of the same type, kind and rank as @var{FROM}.
|
8093 |
|
|
@end multitable
|
8094 |
|
|
|
8095 |
|
|
@item @emph{Return value}:
|
8096 |
|
|
None
|
8097 |
|
|
|
8098 |
|
|
@item @emph{Example}:
|
8099 |
|
|
@smallexample
|
8100 |
|
|
program test_move_alloc
|
8101 |
|
|
integer, allocatable :: a(:), b(:)
|
8102 |
|
|
|
8103 |
|
|
allocate(a(3))
|
8104 |
|
|
a = [ 1, 2, 3 ]
|
8105 |
|
|
call move_alloc(a, b)
|
8106 |
|
|
print *, allocated(a), allocated(b)
|
8107 |
|
|
print *, b
|
8108 |
|
|
end program test_move_alloc
|
8109 |
|
|
@end smallexample
|
8110 |
|
|
@end table
|
8111 |
|
|
|
8112 |
|
|
|
8113 |
|
|
|
8114 |
|
|
@node MVBITS
|
8115 |
|
|
@section @code{MVBITS} --- Move bits from one integer to another
|
8116 |
|
|
@fnindex MVBITS
|
8117 |
|
|
@cindex bits, move
|
8118 |
|
|
|
8119 |
|
|
@table @asis
|
8120 |
|
|
@item @emph{Description}:
|
8121 |
|
|
Moves @var{LEN} bits from positions @var{FROMPOS} through
|
8122 |
|
|
@code{FROMPOS+LEN-1} of @var{FROM} to positions @var{TOPOS} through
|
8123 |
|
|
@code{TOPOS+LEN-1} of @var{TO}. The portion of argument @var{TO} not
|
8124 |
|
|
affected by the movement of bits is unchanged. The values of
|
8125 |
|
|
@code{FROMPOS+LEN-1} and @code{TOPOS+LEN-1} must be less than
|
8126 |
|
|
@code{BIT_SIZE(FROM)}.
|
8127 |
|
|
|
8128 |
|
|
@item @emph{Standard}:
|
8129 |
|
|
Fortran 95 and later
|
8130 |
|
|
|
8131 |
|
|
@item @emph{Class}:
|
8132 |
|
|
Elemental subroutine
|
8133 |
|
|
|
8134 |
|
|
@item @emph{Syntax}:
|
8135 |
|
|
@code{CALL MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)}
|
8136 |
|
|
|
8137 |
|
|
@item @emph{Arguments}:
|
8138 |
|
|
@multitable @columnfractions .15 .70
|
8139 |
|
|
@item @var{FROM} @tab The type shall be @code{INTEGER}.
|
8140 |
|
|
@item @var{FROMPOS} @tab The type shall be @code{INTEGER}.
|
8141 |
|
|
@item @var{LEN} @tab The type shall be @code{INTEGER}.
|
8142 |
|
|
@item @var{TO} @tab The type shall be @code{INTEGER}, of the
|
8143 |
|
|
same kind as @var{FROM}.
|
8144 |
|
|
@item @var{TOPOS} @tab The type shall be @code{INTEGER}.
|
8145 |
|
|
@end multitable
|
8146 |
|
|
|
8147 |
|
|
@item @emph{See also}:
|
8148 |
|
|
@ref{IBCLR}, @ref{IBSET}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
|
8149 |
|
|
@end table
|
8150 |
|
|
|
8151 |
|
|
|
8152 |
|
|
|
8153 |
|
|
@node NEAREST
|
8154 |
|
|
@section @code{NEAREST} --- Nearest representable number
|
8155 |
|
|
@fnindex NEAREST
|
8156 |
|
|
@cindex real number, nearest different
|
8157 |
|
|
@cindex floating point, nearest different
|
8158 |
|
|
|
8159 |
|
|
@table @asis
|
8160 |
|
|
@item @emph{Description}:
|
8161 |
|
|
@code{NEAREST(X, S)} returns the processor-representable number nearest
|
8162 |
|
|
to @code{X} in the direction indicated by the sign of @code{S}.
|
8163 |
|
|
|
8164 |
|
|
@item @emph{Standard}:
|
8165 |
|
|
Fortran 95 and later
|
8166 |
|
|
|
8167 |
|
|
@item @emph{Class}:
|
8168 |
|
|
Elemental function
|
8169 |
|
|
|
8170 |
|
|
@item @emph{Syntax}:
|
8171 |
|
|
@code{RESULT = NEAREST(X, S)}
|
8172 |
|
|
|
8173 |
|
|
@item @emph{Arguments}:
|
8174 |
|
|
@multitable @columnfractions .15 .70
|
8175 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
8176 |
|
|
@item @var{S} @tab (Optional) shall be of type @code{REAL} and
|
8177 |
|
|
not equal to zero.
|
8178 |
|
|
@end multitable
|
8179 |
|
|
|
8180 |
|
|
@item @emph{Return value}:
|
8181 |
|
|
The return value is of the same type as @code{X}. If @code{S} is
|
8182 |
|
|
positive, @code{NEAREST} returns the processor-representable number
|
8183 |
|
|
greater than @code{X} and nearest to it. If @code{S} is negative,
|
8184 |
|
|
@code{NEAREST} returns the processor-representable number smaller than
|
8185 |
|
|
@code{X} and nearest to it.
|
8186 |
|
|
|
8187 |
|
|
@item @emph{Example}:
|
8188 |
|
|
@smallexample
|
8189 |
|
|
program test_nearest
|
8190 |
|
|
real :: x, y
|
8191 |
|
|
x = nearest(42.0, 1.0)
|
8192 |
|
|
y = nearest(42.0, -1.0)
|
8193 |
|
|
write (*,"(3(G20.15))") x, y, x - y
|
8194 |
|
|
end program test_nearest
|
8195 |
|
|
@end smallexample
|
8196 |
|
|
@end table
|
8197 |
|
|
|
8198 |
|
|
|
8199 |
|
|
|
8200 |
|
|
@node NEW_LINE
|
8201 |
|
|
@section @code{NEW_LINE} --- New line character
|
8202 |
|
|
@fnindex NEW_LINE
|
8203 |
|
|
@cindex newline
|
8204 |
|
|
@cindex output, newline
|
8205 |
|
|
|
8206 |
|
|
@table @asis
|
8207 |
|
|
@item @emph{Description}:
|
8208 |
|
|
@code{NEW_LINE(C)} returns the new-line character.
|
8209 |
|
|
|
8210 |
|
|
@item @emph{Standard}:
|
8211 |
|
|
Fortran 2003 and later
|
8212 |
|
|
|
8213 |
|
|
@item @emph{Class}:
|
8214 |
|
|
Inquiry function
|
8215 |
|
|
|
8216 |
|
|
@item @emph{Syntax}:
|
8217 |
|
|
@code{RESULT = NEW_LINE(C)}
|
8218 |
|
|
|
8219 |
|
|
@item @emph{Arguments}:
|
8220 |
|
|
@multitable @columnfractions .15 .70
|
8221 |
|
|
@item @var{C} @tab The argument shall be a scalar or array of the
|
8222 |
|
|
type @code{CHARACTER}.
|
8223 |
|
|
@end multitable
|
8224 |
|
|
|
8225 |
|
|
@item @emph{Return value}:
|
8226 |
|
|
Returns a @var{CHARACTER} scalar of length one with the new-line character of
|
8227 |
|
|
the same kind as parameter @var{C}.
|
8228 |
|
|
|
8229 |
|
|
@item @emph{Example}:
|
8230 |
|
|
@smallexample
|
8231 |
|
|
program newline
|
8232 |
|
|
implicit none
|
8233 |
|
|
write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
|
8234 |
|
|
end program newline
|
8235 |
|
|
@end smallexample
|
8236 |
|
|
@end table
|
8237 |
|
|
|
8238 |
|
|
|
8239 |
|
|
|
8240 |
|
|
@node NINT
|
8241 |
|
|
@section @code{NINT} --- Nearest whole number
|
8242 |
|
|
@fnindex NINT
|
8243 |
|
|
@fnindex IDNINT
|
8244 |
|
|
@cindex rounding, nearest whole number
|
8245 |
|
|
|
8246 |
|
|
@table @asis
|
8247 |
|
|
@item @emph{Description}:
|
8248 |
|
|
@code{NINT(A)} rounds its argument to the nearest whole number.
|
8249 |
|
|
|
8250 |
|
|
@item @emph{Standard}:
|
8251 |
|
|
Fortran 77 and later, with @var{KIND} argument Fortran 90 and later
|
8252 |
|
|
|
8253 |
|
|
@item @emph{Class}:
|
8254 |
|
|
Elemental function
|
8255 |
|
|
|
8256 |
|
|
@item @emph{Syntax}:
|
8257 |
|
|
@code{RESULT = NINT(A [, KIND])}
|
8258 |
|
|
|
8259 |
|
|
@item @emph{Arguments}:
|
8260 |
|
|
@multitable @columnfractions .15 .70
|
8261 |
|
|
@item @var{A} @tab The type of the argument shall be @code{REAL}.
|
8262 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
8263 |
|
|
expression indicating the kind parameter of the result.
|
8264 |
|
|
@end multitable
|
8265 |
|
|
|
8266 |
|
|
@item @emph{Return value}:
|
8267 |
|
|
Returns @var{A} with the fractional portion of its magnitude eliminated by
|
8268 |
|
|
rounding to the nearest whole number and with its sign preserved,
|
8269 |
|
|
converted to an @code{INTEGER} of the default kind.
|
8270 |
|
|
|
8271 |
|
|
@item @emph{Example}:
|
8272 |
|
|
@smallexample
|
8273 |
|
|
program test_nint
|
8274 |
|
|
real(4) x4
|
8275 |
|
|
real(8) x8
|
8276 |
|
|
x4 = 1.234E0_4
|
8277 |
|
|
x8 = 4.321_8
|
8278 |
|
|
print *, nint(x4), idnint(x8)
|
8279 |
|
|
end program test_nint
|
8280 |
|
|
@end smallexample
|
8281 |
|
|
|
8282 |
|
|
@item @emph{Specific names}:
|
8283 |
|
|
@multitable @columnfractions .25 .25 .25
|
8284 |
|
|
@item Name @tab Argument @tab Standard
|
8285 |
|
|
@item @code{IDNINT(X)} @tab @code{REAL(8)} @tab Fortran 95 and later
|
8286 |
|
|
@end multitable
|
8287 |
|
|
|
8288 |
|
|
@item @emph{See also}:
|
8289 |
|
|
@ref{CEILING}, @ref{FLOOR}
|
8290 |
|
|
|
8291 |
|
|
@end table
|
8292 |
|
|
|
8293 |
|
|
|
8294 |
|
|
|
8295 |
|
|
@node NOT
|
8296 |
|
|
@section @code{NOT} --- Logical negation
|
8297 |
|
|
@fnindex NOT
|
8298 |
|
|
@cindex bits, negate
|
8299 |
|
|
@cindex bitwise logical not
|
8300 |
|
|
@cindex logical not, bitwise
|
8301 |
|
|
|
8302 |
|
|
@table @asis
|
8303 |
|
|
@item @emph{Description}:
|
8304 |
|
|
@code{NOT} returns the bitwise boolean inverse of @var{I}.
|
8305 |
|
|
|
8306 |
|
|
@item @emph{Standard}:
|
8307 |
|
|
Fortran 95 and later
|
8308 |
|
|
|
8309 |
|
|
@item @emph{Class}:
|
8310 |
|
|
Elemental function
|
8311 |
|
|
|
8312 |
|
|
@item @emph{Syntax}:
|
8313 |
|
|
@code{RESULT = NOT(I)}
|
8314 |
|
|
|
8315 |
|
|
@item @emph{Arguments}:
|
8316 |
|
|
@multitable @columnfractions .15 .70
|
8317 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
8318 |
|
|
@end multitable
|
8319 |
|
|
|
8320 |
|
|
@item @emph{Return value}:
|
8321 |
|
|
The return type is @code{INTEGER}, of the same kind as the
|
8322 |
|
|
argument.
|
8323 |
|
|
|
8324 |
|
|
@item @emph{See also}:
|
8325 |
|
|
@ref{IAND}, @ref{IEOR}, @ref{IOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}
|
8326 |
|
|
|
8327 |
|
|
@end table
|
8328 |
|
|
|
8329 |
|
|
|
8330 |
|
|
|
8331 |
|
|
@node NULL
|
8332 |
|
|
@section @code{NULL} --- Function that returns an disassociated pointer
|
8333 |
|
|
@fnindex NULL
|
8334 |
|
|
@cindex pointer, status
|
8335 |
|
|
@cindex pointer, disassociated
|
8336 |
|
|
|
8337 |
|
|
@table @asis
|
8338 |
|
|
@item @emph{Description}:
|
8339 |
|
|
Returns a disassociated pointer.
|
8340 |
|
|
|
8341 |
|
|
If @var{MOLD} is present, a dissassociated pointer of the same type is
|
8342 |
|
|
returned, otherwise the type is determined by context.
|
8343 |
|
|
|
8344 |
|
|
In Fortran 95, @var{MOLD} is optional. Please note that Fortran 2003
|
8345 |
|
|
includes cases where it is required.
|
8346 |
|
|
|
8347 |
|
|
@item @emph{Standard}:
|
8348 |
|
|
Fortran 95 and later
|
8349 |
|
|
|
8350 |
|
|
@item @emph{Class}:
|
8351 |
|
|
Transformational function
|
8352 |
|
|
|
8353 |
|
|
@item @emph{Syntax}:
|
8354 |
|
|
@code{PTR => NULL([MOLD])}
|
8355 |
|
|
|
8356 |
|
|
@item @emph{Arguments}:
|
8357 |
|
|
@multitable @columnfractions .15 .70
|
8358 |
|
|
@item @var{MOLD} @tab (Optional) shall be a pointer of any association
|
8359 |
|
|
status and of any type.
|
8360 |
|
|
@end multitable
|
8361 |
|
|
|
8362 |
|
|
@item @emph{Return value}:
|
8363 |
|
|
A disassociated pointer.
|
8364 |
|
|
|
8365 |
|
|
@item @emph{Example}:
|
8366 |
|
|
@smallexample
|
8367 |
|
|
REAL, POINTER, DIMENSION(:) :: VEC => NULL ()
|
8368 |
|
|
@end smallexample
|
8369 |
|
|
|
8370 |
|
|
@item @emph{See also}:
|
8371 |
|
|
@ref{ASSOCIATED}
|
8372 |
|
|
@end table
|
8373 |
|
|
|
8374 |
|
|
|
8375 |
|
|
|
8376 |
|
|
@node OR
|
8377 |
|
|
@section @code{OR} --- Bitwise logical OR
|
8378 |
|
|
@fnindex OR
|
8379 |
|
|
@cindex bitwise logical or
|
8380 |
|
|
@cindex logical or, bitwise
|
8381 |
|
|
|
8382 |
|
|
@table @asis
|
8383 |
|
|
@item @emph{Description}:
|
8384 |
|
|
Bitwise logical @code{OR}.
|
8385 |
|
|
|
8386 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
8387 |
|
|
GNU Fortran 77. For integer arguments, programmers should consider
|
8388 |
|
|
the use of the @ref{IOR} intrinsic defined by the Fortran standard.
|
8389 |
|
|
|
8390 |
|
|
@item @emph{Standard}:
|
8391 |
|
|
GNU extension
|
8392 |
|
|
|
8393 |
|
|
@item @emph{Class}:
|
8394 |
|
|
Function
|
8395 |
|
|
|
8396 |
|
|
@item @emph{Syntax}:
|
8397 |
|
|
@code{RESULT = OR(I, J)}
|
8398 |
|
|
|
8399 |
|
|
@item @emph{Arguments}:
|
8400 |
|
|
@multitable @columnfractions .15 .70
|
8401 |
|
|
@item @var{I} @tab The type shall be either a scalar @code{INTEGER}
|
8402 |
|
|
type or a scalar @code{LOGICAL} type.
|
8403 |
|
|
@item @var{J} @tab The type shall be the same as the type of @var{J}.
|
8404 |
|
|
@end multitable
|
8405 |
|
|
|
8406 |
|
|
@item @emph{Return value}:
|
8407 |
|
|
The return type is either a scalar @code{INTEGER} or a scalar
|
8408 |
|
|
@code{LOGICAL}. If the kind type parameters differ, then the
|
8409 |
|
|
smaller kind type is implicitly converted to larger kind, and the
|
8410 |
|
|
return has the larger kind.
|
8411 |
|
|
|
8412 |
|
|
@item @emph{Example}:
|
8413 |
|
|
@smallexample
|
8414 |
|
|
PROGRAM test_or
|
8415 |
|
|
LOGICAL :: T = .TRUE., F = .FALSE.
|
8416 |
|
|
INTEGER :: a, b
|
8417 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
8418 |
|
|
|
8419 |
|
|
WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
|
8420 |
|
|
WRITE (*,*) OR(a, b)
|
8421 |
|
|
END PROGRAM
|
8422 |
|
|
@end smallexample
|
8423 |
|
|
|
8424 |
|
|
@item @emph{See also}:
|
8425 |
|
|
Fortran 95 elemental function: @ref{IOR}
|
8426 |
|
|
@end table
|
8427 |
|
|
|
8428 |
|
|
|
8429 |
|
|
|
8430 |
|
|
@node PACK
|
8431 |
|
|
@section @code{PACK} --- Pack an array into an array of rank one
|
8432 |
|
|
@fnindex PACK
|
8433 |
|
|
@cindex array, packing
|
8434 |
|
|
@cindex array, reduce dimension
|
8435 |
|
|
@cindex array, gather elements
|
8436 |
|
|
|
8437 |
|
|
@table @asis
|
8438 |
|
|
@item @emph{Description}:
|
8439 |
|
|
Stores the elements of @var{ARRAY} in an array of rank one.
|
8440 |
|
|
|
8441 |
|
|
The beginning of the resulting array is made up of elements whose @var{MASK}
|
8442 |
|
|
equals @code{TRUE}. Afterwards, positions are filled with elements taken from
|
8443 |
|
|
@var{VECTOR}.
|
8444 |
|
|
|
8445 |
|
|
@item @emph{Standard}:
|
8446 |
|
|
Fortran 95 and later
|
8447 |
|
|
|
8448 |
|
|
@item @emph{Class}:
|
8449 |
|
|
Transformational function
|
8450 |
|
|
|
8451 |
|
|
@item @emph{Syntax}:
|
8452 |
|
|
@code{RESULT = PACK(ARRAY, MASK[,VECTOR]}
|
8453 |
|
|
|
8454 |
|
|
@item @emph{Arguments}:
|
8455 |
|
|
@multitable @columnfractions .15 .70
|
8456 |
|
|
@item @var{ARRAY} @tab Shall be an array of any type.
|
8457 |
|
|
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL} and
|
8458 |
|
|
of the same size as @var{ARRAY}. Alternatively, it may be a @code{LOGICAL}
|
8459 |
|
|
scalar.
|
8460 |
|
|
@item @var{VECTOR} @tab (Optional) shall be an array of the same type
|
8461 |
|
|
as @var{ARRAY} and of rank one. If present, the number of elements in
|
8462 |
|
|
@var{VECTOR} shall be equal to or greater than the number of true elements
|
8463 |
|
|
in @var{MASK}. If @var{MASK} is scalar, the number of elements in
|
8464 |
|
|
@var{VECTOR} shall be equal to or greater than the number of elements in
|
8465 |
|
|
@var{ARRAY}.
|
8466 |
|
|
@end multitable
|
8467 |
|
|
|
8468 |
|
|
@item @emph{Return value}:
|
8469 |
|
|
The result is an array of rank one and the same type as that of @var{ARRAY}.
|
8470 |
|
|
If @var{VECTOR} is present, the result size is that of @var{VECTOR}, the
|
8471 |
|
|
number of @code{TRUE} values in @var{MASK} otherwise.
|
8472 |
|
|
|
8473 |
|
|
@item @emph{Example}:
|
8474 |
|
|
Gathering nonzero elements from an array:
|
8475 |
|
|
@smallexample
|
8476 |
|
|
PROGRAM test_pack_1
|
8477 |
|
|
INTEGER :: m(6)
|
8478 |
|
|
m = (/ 1, 0, 0, 0, 5, 0 /)
|
8479 |
|
|
WRITE(*, FMT="(6(I0, ' '))") pack(m, m /= 0) ! "1 5"
|
8480 |
|
|
END PROGRAM
|
8481 |
|
|
@end smallexample
|
8482 |
|
|
|
8483 |
|
|
Gathering nonzero elements from an array and appending elements from @var{VECTOR}:
|
8484 |
|
|
@smallexample
|
8485 |
|
|
PROGRAM test_pack_2
|
8486 |
|
|
INTEGER :: m(4)
|
8487 |
|
|
m = (/ 1, 0, 0, 2 /)
|
8488 |
|
|
WRITE(*, FMT="(4(I0, ' '))") pack(m, m /= 0, (/ 0, 0, 3, 4 /)) ! "1 2 3 4"
|
8489 |
|
|
END PROGRAM
|
8490 |
|
|
@end smallexample
|
8491 |
|
|
|
8492 |
|
|
@item @emph{See also}:
|
8493 |
|
|
@ref{UNPACK}
|
8494 |
|
|
@end table
|
8495 |
|
|
|
8496 |
|
|
|
8497 |
|
|
|
8498 |
|
|
@node PERROR
|
8499 |
|
|
@section @code{PERROR} --- Print system error message
|
8500 |
|
|
@fnindex PERROR
|
8501 |
|
|
@cindex system, error handling
|
8502 |
|
|
|
8503 |
|
|
@table @asis
|
8504 |
|
|
@item @emph{Description}:
|
8505 |
|
|
Prints (on the C @code{stderr} stream) a newline-terminated error
|
8506 |
|
|
message corresponding to the last system error. This is prefixed by
|
8507 |
|
|
@var{STRING}, a colon and a space. See @code{perror(3)}.
|
8508 |
|
|
|
8509 |
|
|
@item @emph{Standard}:
|
8510 |
|
|
GNU extension
|
8511 |
|
|
|
8512 |
|
|
@item @emph{Class}:
|
8513 |
|
|
Subroutine
|
8514 |
|
|
|
8515 |
|
|
@item @emph{Syntax}:
|
8516 |
|
|
@code{CALL PERROR(STRING)}
|
8517 |
|
|
|
8518 |
|
|
@item @emph{Arguments}:
|
8519 |
|
|
@multitable @columnfractions .15 .70
|
8520 |
|
|
@item @var{STRING} @tab A scalar of type @code{CHARACTER} and of the
|
8521 |
|
|
default kind.
|
8522 |
|
|
@end multitable
|
8523 |
|
|
|
8524 |
|
|
@item @emph{See also}:
|
8525 |
|
|
@ref{IERRNO}
|
8526 |
|
|
@end table
|
8527 |
|
|
|
8528 |
|
|
|
8529 |
|
|
|
8530 |
|
|
@node PRECISION
|
8531 |
|
|
@section @code{PRECISION} --- Decimal precision of a real kind
|
8532 |
|
|
@fnindex PRECISION
|
8533 |
|
|
@cindex model representation, precision
|
8534 |
|
|
|
8535 |
|
|
@table @asis
|
8536 |
|
|
@item @emph{Description}:
|
8537 |
|
|
@code{PRECISION(X)} returns the decimal precision in the model of the
|
8538 |
|
|
type of @code{X}.
|
8539 |
|
|
|
8540 |
|
|
@item @emph{Standard}:
|
8541 |
|
|
Fortran 95 and later
|
8542 |
|
|
|
8543 |
|
|
@item @emph{Class}:
|
8544 |
|
|
Inquiry function
|
8545 |
|
|
|
8546 |
|
|
@item @emph{Syntax}:
|
8547 |
|
|
@code{RESULT = PRECISION(X)}
|
8548 |
|
|
|
8549 |
|
|
@item @emph{Arguments}:
|
8550 |
|
|
@multitable @columnfractions .15 .70
|
8551 |
|
|
@item @var{X} @tab Shall be of type @code{REAL} or @code{COMPLEX}.
|
8552 |
|
|
@end multitable
|
8553 |
|
|
|
8554 |
|
|
@item @emph{Return value}:
|
8555 |
|
|
The return value is of type @code{INTEGER} and of the default integer
|
8556 |
|
|
kind.
|
8557 |
|
|
|
8558 |
|
|
@item @emph{Example}:
|
8559 |
|
|
@smallexample
|
8560 |
|
|
program prec_and_range
|
8561 |
|
|
real(kind=4) :: x(2)
|
8562 |
|
|
complex(kind=8) :: y
|
8563 |
|
|
|
8564 |
|
|
print *, precision(x), range(x)
|
8565 |
|
|
print *, precision(y), range(y)
|
8566 |
|
|
end program prec_and_range
|
8567 |
|
|
@end smallexample
|
8568 |
|
|
@end table
|
8569 |
|
|
|
8570 |
|
|
|
8571 |
|
|
|
8572 |
|
|
@node PRESENT
|
8573 |
|
|
@section @code{PRESENT} --- Determine whether an optional dummy argument is specified
|
8574 |
|
|
@fnindex PRESENT
|
8575 |
|
|
|
8576 |
|
|
@table @asis
|
8577 |
|
|
@item @emph{Description}:
|
8578 |
|
|
Determines whether an optional dummy argument is present.
|
8579 |
|
|
|
8580 |
|
|
@item @emph{Standard}:
|
8581 |
|
|
Fortran 95 and later
|
8582 |
|
|
|
8583 |
|
|
@item @emph{Class}:
|
8584 |
|
|
Inquiry function
|
8585 |
|
|
|
8586 |
|
|
@item @emph{Syntax}:
|
8587 |
|
|
@code{RESULT = PRESENT(A)}
|
8588 |
|
|
|
8589 |
|
|
@item @emph{Arguments}:
|
8590 |
|
|
@multitable @columnfractions .15 .70
|
8591 |
|
|
@item @var{A} @tab May be of any type and may be a pointer, scalar or array
|
8592 |
|
|
value, or a dummy procedure. It shall be the name of an optional dummy argument
|
8593 |
|
|
accessible within the current subroutine or function.
|
8594 |
|
|
@end multitable
|
8595 |
|
|
|
8596 |
|
|
@item @emph{Return value}:
|
8597 |
|
|
Returns either @code{TRUE} if the optional argument @var{A} is present, or
|
8598 |
|
|
@code{FALSE} otherwise.
|
8599 |
|
|
|
8600 |
|
|
@item @emph{Example}:
|
8601 |
|
|
@smallexample
|
8602 |
|
|
PROGRAM test_present
|
8603 |
|
|
WRITE(*,*) f(), f(42) ! "F T"
|
8604 |
|
|
CONTAINS
|
8605 |
|
|
LOGICAL FUNCTION f(x)
|
8606 |
|
|
INTEGER, INTENT(IN), OPTIONAL :: x
|
8607 |
|
|
f = PRESENT(x)
|
8608 |
|
|
END FUNCTION
|
8609 |
|
|
END PROGRAM
|
8610 |
|
|
@end smallexample
|
8611 |
|
|
@end table
|
8612 |
|
|
|
8613 |
|
|
|
8614 |
|
|
|
8615 |
|
|
@node PRODUCT
|
8616 |
|
|
@section @code{PRODUCT} --- Product of array elements
|
8617 |
|
|
@fnindex PRODUCT
|
8618 |
|
|
@cindex array, product
|
8619 |
|
|
@cindex array, multiply elements
|
8620 |
|
|
@cindex array, conditionally multiply elements
|
8621 |
|
|
@cindex multiply array elements
|
8622 |
|
|
|
8623 |
|
|
@table @asis
|
8624 |
|
|
@item @emph{Description}:
|
8625 |
|
|
Multiplies the elements of @var{ARRAY} along dimension @var{DIM} if
|
8626 |
|
|
the corresponding element in @var{MASK} is @code{TRUE}.
|
8627 |
|
|
|
8628 |
|
|
@item @emph{Standard}:
|
8629 |
|
|
Fortran 95 and later
|
8630 |
|
|
|
8631 |
|
|
@item @emph{Class}:
|
8632 |
|
|
Transformational function
|
8633 |
|
|
|
8634 |
|
|
@item @emph{Syntax}:
|
8635 |
|
|
@multitable @columnfractions .80
|
8636 |
|
|
@item @code{RESULT = PRODUCT(ARRAY[, MASK])}
|
8637 |
|
|
@item @code{RESULT = PRODUCT(ARRAY, DIM[, MASK])}
|
8638 |
|
|
@end multitable
|
8639 |
|
|
|
8640 |
|
|
@item @emph{Arguments}:
|
8641 |
|
|
@multitable @columnfractions .15 .70
|
8642 |
|
|
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER},
|
8643 |
|
|
@code{REAL} or @code{COMPLEX}.
|
8644 |
|
|
@item @var{DIM} @tab (Optional) shall be a scalar of type
|
8645 |
|
|
@code{INTEGER} with a value in the range from 1 to n, where n
|
8646 |
|
|
equals the rank of @var{ARRAY}.
|
8647 |
|
|
@item @var{MASK} @tab (Optional) shall be of type @code{LOGICAL}
|
8648 |
|
|
and either be a scalar or an array of the same shape as @var{ARRAY}.
|
8649 |
|
|
@end multitable
|
8650 |
|
|
|
8651 |
|
|
@item @emph{Return value}:
|
8652 |
|
|
The result is of the same type as @var{ARRAY}.
|
8653 |
|
|
|
8654 |
|
|
If @var{DIM} is absent, a scalar with the product of all elements in
|
8655 |
|
|
@var{ARRAY} is returned. Otherwise, an array of rank n-1, where n equals
|
8656 |
|
|
the rank of @var{ARRAY}, and a shape similar to that of @var{ARRAY} with
|
8657 |
|
|
dimension @var{DIM} dropped is returned.
|
8658 |
|
|
|
8659 |
|
|
|
8660 |
|
|
@item @emph{Example}:
|
8661 |
|
|
@smallexample
|
8662 |
|
|
PROGRAM test_product
|
8663 |
|
|
INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /)
|
8664 |
|
|
print *, PRODUCT(x) ! all elements, product = 120
|
8665 |
|
|
print *, PRODUCT(x, MASK=MOD(x, 2)==1) ! odd elements, product = 15
|
8666 |
|
|
END PROGRAM
|
8667 |
|
|
@end smallexample
|
8668 |
|
|
|
8669 |
|
|
@item @emph{See also}:
|
8670 |
|
|
@ref{SUM}
|
8671 |
|
|
@end table
|
8672 |
|
|
|
8673 |
|
|
|
8674 |
|
|
|
8675 |
|
|
@node RADIX
|
8676 |
|
|
@section @code{RADIX} --- Base of a model number
|
8677 |
|
|
@fnindex RADIX
|
8678 |
|
|
@cindex model representation, base
|
8679 |
|
|
@cindex model representation, radix
|
8680 |
|
|
|
8681 |
|
|
@table @asis
|
8682 |
|
|
@item @emph{Description}:
|
8683 |
|
|
@code{RADIX(X)} returns the base of the model representing the entity @var{X}.
|
8684 |
|
|
|
8685 |
|
|
@item @emph{Standard}:
|
8686 |
|
|
Fortran 95 and later
|
8687 |
|
|
|
8688 |
|
|
@item @emph{Class}:
|
8689 |
|
|
Inquiry function
|
8690 |
|
|
|
8691 |
|
|
@item @emph{Syntax}:
|
8692 |
|
|
@code{RESULT = RADIX(X)}
|
8693 |
|
|
|
8694 |
|
|
@item @emph{Arguments}:
|
8695 |
|
|
@multitable @columnfractions .15 .70
|
8696 |
|
|
@item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
|
8697 |
|
|
@end multitable
|
8698 |
|
|
|
8699 |
|
|
@item @emph{Return value}:
|
8700 |
|
|
The return value is a scalar of type @code{INTEGER} and of the default
|
8701 |
|
|
integer kind.
|
8702 |
|
|
|
8703 |
|
|
@item @emph{Example}:
|
8704 |
|
|
@smallexample
|
8705 |
|
|
program test_radix
|
8706 |
|
|
print *, "The radix for the default integer kind is", radix(0)
|
8707 |
|
|
print *, "The radix for the default real kind is", radix(0.0)
|
8708 |
|
|
end program test_radix
|
8709 |
|
|
@end smallexample
|
8710 |
|
|
|
8711 |
|
|
@end table
|
8712 |
|
|
|
8713 |
|
|
|
8714 |
|
|
|
8715 |
|
|
@node RAN
|
8716 |
|
|
@section @code{RAN} --- Real pseudo-random number
|
8717 |
|
|
@fnindex RAN
|
8718 |
|
|
@cindex random number generation
|
8719 |
|
|
|
8720 |
|
|
@table @asis
|
8721 |
|
|
@item @emph{Description}:
|
8722 |
|
|
For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
|
8723 |
|
|
provided as an alias for @code{RAND}. See @ref{RAND} for complete
|
8724 |
|
|
documentation.
|
8725 |
|
|
|
8726 |
|
|
@item @emph{Standard}:
|
8727 |
|
|
GNU extension
|
8728 |
|
|
|
8729 |
|
|
@item @emph{Class}:
|
8730 |
|
|
Function
|
8731 |
|
|
|
8732 |
|
|
@item @emph{See also}:
|
8733 |
|
|
@ref{RAND}, @ref{RANDOM_NUMBER}
|
8734 |
|
|
@end table
|
8735 |
|
|
|
8736 |
|
|
|
8737 |
|
|
|
8738 |
|
|
@node RAND
|
8739 |
|
|
@section @code{RAND} --- Real pseudo-random number
|
8740 |
|
|
@fnindex RAND
|
8741 |
|
|
@cindex random number generation
|
8742 |
|
|
|
8743 |
|
|
@table @asis
|
8744 |
|
|
@item @emph{Description}:
|
8745 |
|
|
@code{RAND(FLAG)} returns a pseudo-random number from a uniform
|
8746 |
|
|
distribution between 0 and 1. If @var{FLAG} is 0, the next number
|
8747 |
|
|
in the current sequence is returned; if @var{FLAG} is 1, the generator
|
8748 |
|
|
is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
|
8749 |
|
|
it is used as a new seed with @code{SRAND}.
|
8750 |
|
|
|
8751 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
8752 |
|
|
GNU Fortran 77. It implements a simple modulo generator as provided
|
8753 |
|
|
by @command{g77}. For new code, one should consider the use of
|
8754 |
|
|
@ref{RANDOM_NUMBER} as it implements a superior algorithm.
|
8755 |
|
|
|
8756 |
|
|
@item @emph{Standard}:
|
8757 |
|
|
GNU extension
|
8758 |
|
|
|
8759 |
|
|
@item @emph{Class}:
|
8760 |
|
|
Function
|
8761 |
|
|
|
8762 |
|
|
@item @emph{Syntax}:
|
8763 |
|
|
@code{RESULT = RAND(I)}
|
8764 |
|
|
|
8765 |
|
|
@item @emph{Arguments}:
|
8766 |
|
|
@multitable @columnfractions .15 .70
|
8767 |
|
|
@item @var{I} @tab Shall be a scalar @code{INTEGER} of kind 4.
|
8768 |
|
|
@end multitable
|
8769 |
|
|
|
8770 |
|
|
@item @emph{Return value}:
|
8771 |
|
|
The return value is of @code{REAL} type and the default kind.
|
8772 |
|
|
|
8773 |
|
|
@item @emph{Example}:
|
8774 |
|
|
@smallexample
|
8775 |
|
|
program test_rand
|
8776 |
|
|
integer,parameter :: seed = 86456
|
8777 |
|
|
|
8778 |
|
|
call srand(seed)
|
8779 |
|
|
print *, rand(), rand(), rand(), rand()
|
8780 |
|
|
print *, rand(seed), rand(), rand(), rand()
|
8781 |
|
|
end program test_rand
|
8782 |
|
|
@end smallexample
|
8783 |
|
|
|
8784 |
|
|
@item @emph{See also}:
|
8785 |
|
|
@ref{SRAND}, @ref{RANDOM_NUMBER}
|
8786 |
|
|
|
8787 |
|
|
@end table
|
8788 |
|
|
|
8789 |
|
|
|
8790 |
|
|
|
8791 |
|
|
@node RANDOM_NUMBER
|
8792 |
|
|
@section @code{RANDOM_NUMBER} --- Pseudo-random number
|
8793 |
|
|
@fnindex RANDOM_NUMBER
|
8794 |
|
|
@cindex random number generation
|
8795 |
|
|
|
8796 |
|
|
@table @asis
|
8797 |
|
|
@item @emph{Description}:
|
8798 |
|
|
Returns a single pseudorandom number or an array of pseudorandom numbers
|
8799 |
|
|
from the uniform distribution over the range @math{ 0 \leq x < 1}.
|
8800 |
|
|
|
8801 |
|
|
The runtime-library implements George Marsaglia's KISS (Keep It Simple
|
8802 |
|
|
Stupid) random number generator (RNG). This RNG combines:
|
8803 |
|
|
@enumerate
|
8804 |
|
|
@item The congruential generator @math{x(n) = 69069 \cdot x(n-1) + 1327217885}
|
8805 |
|
|
with a period of @math{2^{32}},
|
8806 |
|
|
@item A 3-shift shift-register generator with a period of @math{2^{32} - 1},
|
8807 |
|
|
@item Two 16-bit multiply-with-carry generators with a period of
|
8808 |
|
|
@math{597273182964842497 > 2^{59}}.
|
8809 |
|
|
@end enumerate
|
8810 |
|
|
The overall period exceeds @math{2^{123}}.
|
8811 |
|
|
|
8812 |
|
|
Please note, this RNG is thread safe if used within OpenMP directives,
|
8813 |
|
|
i.e., its state will be consistent while called from multiple threads.
|
8814 |
|
|
However, the KISS generator does not create random numbers in parallel
|
8815 |
|
|
from multiple sources, but in sequence from a single source. If an
|
8816 |
|
|
OpenMP-enabled application heavily relies on random numbers, one should
|
8817 |
|
|
consider employing a dedicated parallel random number generator instead.
|
8818 |
|
|
|
8819 |
|
|
@item @emph{Standard}:
|
8820 |
|
|
Fortran 95 and later
|
8821 |
|
|
|
8822 |
|
|
@item @emph{Class}:
|
8823 |
|
|
Subroutine
|
8824 |
|
|
|
8825 |
|
|
@item @emph{Syntax}:
|
8826 |
|
|
@code{RANDOM_NUMBER(HARVEST)}
|
8827 |
|
|
|
8828 |
|
|
@item @emph{Arguments}:
|
8829 |
|
|
@multitable @columnfractions .15 .70
|
8830 |
|
|
@item @var{HARVEST} @tab Shall be a scalar or an array of type @code{REAL}.
|
8831 |
|
|
@end multitable
|
8832 |
|
|
|
8833 |
|
|
@item @emph{Example}:
|
8834 |
|
|
@smallexample
|
8835 |
|
|
program test_random_number
|
8836 |
|
|
REAL :: r(5,5)
|
8837 |
|
|
CALL init_random_seed() ! see example of RANDOM_SEED
|
8838 |
|
|
CALL RANDOM_NUMBER(r)
|
8839 |
|
|
end program
|
8840 |
|
|
@end smallexample
|
8841 |
|
|
|
8842 |
|
|
@item @emph{See also}:
|
8843 |
|
|
@ref{RANDOM_SEED}
|
8844 |
|
|
@end table
|
8845 |
|
|
|
8846 |
|
|
|
8847 |
|
|
|
8848 |
|
|
@node RANDOM_SEED
|
8849 |
|
|
@section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
|
8850 |
|
|
@fnindex RANDOM_SEED
|
8851 |
|
|
@cindex random number generation, seeding
|
8852 |
|
|
@cindex seeding a random number generator
|
8853 |
|
|
|
8854 |
|
|
@table @asis
|
8855 |
|
|
@item @emph{Description}:
|
8856 |
|
|
Restarts or queries the state of the pseudorandom number generator used by
|
8857 |
|
|
@code{RANDOM_NUMBER}.
|
8858 |
|
|
|
8859 |
|
|
If @code{RANDOM_SEED} is called without arguments, it is initialized to
|
8860 |
|
|
a default state. The example below shows how to initialize the random
|
8861 |
|
|
seed based on the system's time.
|
8862 |
|
|
|
8863 |
|
|
@item @emph{Standard}:
|
8864 |
|
|
Fortran 95 and later
|
8865 |
|
|
|
8866 |
|
|
@item @emph{Class}:
|
8867 |
|
|
Subroutine
|
8868 |
|
|
|
8869 |
|
|
@item @emph{Syntax}:
|
8870 |
|
|
@code{CALL RANDOM_SEED([SIZE, PUT, GET])}
|
8871 |
|
|
|
8872 |
|
|
@item @emph{Arguments}:
|
8873 |
|
|
@multitable @columnfractions .15 .70
|
8874 |
|
|
@item @var{SIZE} @tab (Optional) Shall be a scalar and of type default
|
8875 |
|
|
@code{INTEGER}, with @code{INTENT(OUT)}. It specifies the minimum size
|
8876 |
|
|
of the arrays used with the @var{PUT} and @var{GET} arguments.
|
8877 |
|
|
@item @var{PUT} @tab (Optional) Shall be an array of type default
|
8878 |
|
|
@code{INTEGER} and rank one. It is @code{INTENT(IN)} and the size of
|
8879 |
|
|
the array must be larger than or equal to the number returned by the
|
8880 |
|
|
@var{SIZE} argument.
|
8881 |
|
|
@item @var{GET} @tab (Optional) Shall be an array of type default
|
8882 |
|
|
@code{INTEGER} and rank one. It is @code{INTENT(OUT)} and the size
|
8883 |
|
|
of the array must be larger than or equal to the number returned by
|
8884 |
|
|
the @var{SIZE} argument.
|
8885 |
|
|
@end multitable
|
8886 |
|
|
|
8887 |
|
|
@item @emph{Example}:
|
8888 |
|
|
@smallexample
|
8889 |
|
|
SUBROUTINE init_random_seed()
|
8890 |
|
|
INTEGER :: i, n, clock
|
8891 |
|
|
INTEGER, DIMENSION(:), ALLOCATABLE :: seed
|
8892 |
|
|
|
8893 |
|
|
CALL RANDOM_SEED(size = n)
|
8894 |
|
|
ALLOCATE(seed(n))
|
8895 |
|
|
|
8896 |
|
|
CALL SYSTEM_CLOCK(COUNT=clock)
|
8897 |
|
|
|
8898 |
|
|
seed = clock + 37 * (/ (i - 1, i = 1, n) /)
|
8899 |
|
|
CALL RANDOM_SEED(PUT = seed)
|
8900 |
|
|
|
8901 |
|
|
DEALLOCATE(seed)
|
8902 |
|
|
END SUBROUTINE
|
8903 |
|
|
@end smallexample
|
8904 |
|
|
|
8905 |
|
|
@item @emph{See also}:
|
8906 |
|
|
@ref{RANDOM_NUMBER}
|
8907 |
|
|
@end table
|
8908 |
|
|
|
8909 |
|
|
|
8910 |
|
|
|
8911 |
|
|
@node RANGE
|
8912 |
|
|
@section @code{RANGE} --- Decimal exponent range
|
8913 |
|
|
@fnindex RANGE
|
8914 |
|
|
@cindex model representation, range
|
8915 |
|
|
|
8916 |
|
|
@table @asis
|
8917 |
|
|
@item @emph{Description}:
|
8918 |
|
|
@code{RANGE(X)} returns the decimal exponent range in the model of the
|
8919 |
|
|
type of @code{X}.
|
8920 |
|
|
|
8921 |
|
|
@item @emph{Standard}:
|
8922 |
|
|
Fortran 95 and later
|
8923 |
|
|
|
8924 |
|
|
@item @emph{Class}:
|
8925 |
|
|
Inquiry function
|
8926 |
|
|
|
8927 |
|
|
@item @emph{Syntax}:
|
8928 |
|
|
@code{RESULT = RANGE(X)}
|
8929 |
|
|
|
8930 |
|
|
@item @emph{Arguments}:
|
8931 |
|
|
@multitable @columnfractions .15 .70
|
8932 |
|
|
@item @var{X} @tab Shall be of type @code{INTEGER}, @code{REAL}
|
8933 |
|
|
or @code{COMPLEX}.
|
8934 |
|
|
@end multitable
|
8935 |
|
|
|
8936 |
|
|
@item @emph{Return value}:
|
8937 |
|
|
The return value is of type @code{INTEGER} and of the default integer
|
8938 |
|
|
kind.
|
8939 |
|
|
|
8940 |
|
|
@item @emph{Example}:
|
8941 |
|
|
See @code{PRECISION} for an example.
|
8942 |
|
|
@end table
|
8943 |
|
|
|
8944 |
|
|
|
8945 |
|
|
|
8946 |
|
|
@node REAL
|
8947 |
|
|
@section @code{REAL} --- Convert to real type
|
8948 |
|
|
@fnindex REAL
|
8949 |
|
|
@fnindex REALPART
|
8950 |
|
|
@cindex conversion, to real
|
8951 |
|
|
@cindex complex numbers, real part
|
8952 |
|
|
|
8953 |
|
|
@table @asis
|
8954 |
|
|
@item @emph{Description}:
|
8955 |
|
|
@code{REAL(A [, KIND])} converts its argument @var{A} to a real type. The
|
8956 |
|
|
@code{REALPART} function is provided for compatibility with @command{g77},
|
8957 |
|
|
and its use is strongly discouraged.
|
8958 |
|
|
|
8959 |
|
|
@item @emph{Standard}:
|
8960 |
|
|
Fortran 77 and later
|
8961 |
|
|
|
8962 |
|
|
@item @emph{Class}:
|
8963 |
|
|
Elemental function
|
8964 |
|
|
|
8965 |
|
|
@item @emph{Syntax}:
|
8966 |
|
|
@multitable @columnfractions .80
|
8967 |
|
|
@item @code{RESULT = REAL(A [, KIND])}
|
8968 |
|
|
@item @code{RESULT = REALPART(Z)}
|
8969 |
|
|
@end multitable
|
8970 |
|
|
|
8971 |
|
|
@item @emph{Arguments}:
|
8972 |
|
|
@multitable @columnfractions .15 .70
|
8973 |
|
|
@item @var{A} @tab Shall be @code{INTEGER}, @code{REAL}, or
|
8974 |
|
|
@code{COMPLEX}.
|
8975 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
8976 |
|
|
expression indicating the kind parameter of the result.
|
8977 |
|
|
@end multitable
|
8978 |
|
|
|
8979 |
|
|
@item @emph{Return value}:
|
8980 |
|
|
These functions return a @code{REAL} variable or array under
|
8981 |
|
|
the following rules:
|
8982 |
|
|
|
8983 |
|
|
@table @asis
|
8984 |
|
|
@item (A)
|
8985 |
|
|
@code{REAL(A)} is converted to a default real type if @var{A} is an
|
8986 |
|
|
integer or real variable.
|
8987 |
|
|
@item (B)
|
8988 |
|
|
@code{REAL(A)} is converted to a real type with the kind type parameter
|
8989 |
|
|
of @var{A} if @var{A} is a complex variable.
|
8990 |
|
|
@item (C)
|
8991 |
|
|
@code{REAL(A, KIND)} is converted to a real type with kind type
|
8992 |
|
|
parameter @var{KIND} if @var{A} is a complex, integer, or real
|
8993 |
|
|
variable.
|
8994 |
|
|
@end table
|
8995 |
|
|
|
8996 |
|
|
@item @emph{Example}:
|
8997 |
|
|
@smallexample
|
8998 |
|
|
program test_real
|
8999 |
|
|
complex :: x = (1.0, 2.0)
|
9000 |
|
|
print *, real(x), real(x,8), realpart(x)
|
9001 |
|
|
end program test_real
|
9002 |
|
|
@end smallexample
|
9003 |
|
|
|
9004 |
|
|
@item @emph{See also}:
|
9005 |
|
|
@ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
|
9006 |
|
|
|
9007 |
|
|
@end table
|
9008 |
|
|
|
9009 |
|
|
|
9010 |
|
|
|
9011 |
|
|
@node RENAME
|
9012 |
|
|
@section @code{RENAME} --- Rename a file
|
9013 |
|
|
@fnindex RENAME
|
9014 |
|
|
@cindex file system, rename file
|
9015 |
|
|
|
9016 |
|
|
@table @asis
|
9017 |
|
|
@item @emph{Description}:
|
9018 |
|
|
Renames a file from file @var{PATH1} to @var{PATH2}. A null
|
9019 |
|
|
character (@code{CHAR(0)}) can be used to mark the end of the names in
|
9020 |
|
|
@var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
|
9021 |
|
|
names are ignored. If the @var{STATUS} argument is supplied, it
|
9022 |
|
|
contains 0 on success or a nonzero error code upon return; see
|
9023 |
|
|
@code{rename(2)}.
|
9024 |
|
|
|
9025 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
9026 |
|
|
however, only one form can be used in any given program unit.
|
9027 |
|
|
|
9028 |
|
|
@item @emph{Standard}:
|
9029 |
|
|
GNU extension
|
9030 |
|
|
|
9031 |
|
|
@item @emph{Class}:
|
9032 |
|
|
Subroutine, function
|
9033 |
|
|
|
9034 |
|
|
@item @emph{Syntax}:
|
9035 |
|
|
@multitable @columnfractions .80
|
9036 |
|
|
@item @code{CALL RENAME(PATH1, PATH2 [, STATUS])}
|
9037 |
|
|
@item @code{STATUS = RENAME(PATH1, PATH2)}
|
9038 |
|
|
@end multitable
|
9039 |
|
|
|
9040 |
|
|
@item @emph{Arguments}:
|
9041 |
|
|
@multitable @columnfractions .15 .70
|
9042 |
|
|
@item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
|
9043 |
|
|
@item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
|
9044 |
|
|
@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
|
9045 |
|
|
@end multitable
|
9046 |
|
|
|
9047 |
|
|
@item @emph{See also}:
|
9048 |
|
|
@ref{LINK}
|
9049 |
|
|
|
9050 |
|
|
@end table
|
9051 |
|
|
|
9052 |
|
|
|
9053 |
|
|
|
9054 |
|
|
@node REPEAT
|
9055 |
|
|
@section @code{REPEAT} --- Repeated string concatenation
|
9056 |
|
|
@fnindex REPEAT
|
9057 |
|
|
@cindex string, repeat
|
9058 |
|
|
@cindex string, concatenate
|
9059 |
|
|
|
9060 |
|
|
@table @asis
|
9061 |
|
|
@item @emph{Description}:
|
9062 |
|
|
Concatenates @var{NCOPIES} copies of a string.
|
9063 |
|
|
|
9064 |
|
|
@item @emph{Standard}:
|
9065 |
|
|
Fortran 95 and later
|
9066 |
|
|
|
9067 |
|
|
@item @emph{Class}:
|
9068 |
|
|
Transformational function
|
9069 |
|
|
|
9070 |
|
|
@item @emph{Syntax}:
|
9071 |
|
|
@code{RESULT = REPEAT(STRING, NCOPIES)}
|
9072 |
|
|
|
9073 |
|
|
@item @emph{Arguments}:
|
9074 |
|
|
@multitable @columnfractions .15 .70
|
9075 |
|
|
@item @var{STRING} @tab Shall be scalar and of type @code{CHARACTER}.
|
9076 |
|
|
@item @var{NCOPIES} @tab Shall be scalar and of type @code{INTEGER}.
|
9077 |
|
|
@end multitable
|
9078 |
|
|
|
9079 |
|
|
@item @emph{Return value}:
|
9080 |
|
|
A new scalar of type @code{CHARACTER} built up from @var{NCOPIES} copies
|
9081 |
|
|
of @var{STRING}.
|
9082 |
|
|
|
9083 |
|
|
@item @emph{Example}:
|
9084 |
|
|
@smallexample
|
9085 |
|
|
program test_repeat
|
9086 |
|
|
write(*,*) repeat("x", 5) ! "xxxxx"
|
9087 |
|
|
end program
|
9088 |
|
|
@end smallexample
|
9089 |
|
|
@end table
|
9090 |
|
|
|
9091 |
|
|
|
9092 |
|
|
|
9093 |
|
|
@node RESHAPE
|
9094 |
|
|
@section @code{RESHAPE} --- Function to reshape an array
|
9095 |
|
|
@fnindex RESHAPE
|
9096 |
|
|
@cindex array, change dimensions
|
9097 |
|
|
@cindex array, transmogrify
|
9098 |
|
|
|
9099 |
|
|
@table @asis
|
9100 |
|
|
@item @emph{Description}:
|
9101 |
|
|
Reshapes @var{SOURCE} to correspond to @var{SHAPE}. If necessary,
|
9102 |
|
|
the new array may be padded with elements from @var{PAD} or permuted
|
9103 |
|
|
as defined by @var{ORDER}.
|
9104 |
|
|
|
9105 |
|
|
@item @emph{Standard}:
|
9106 |
|
|
Fortran 95 and later
|
9107 |
|
|
|
9108 |
|
|
@item @emph{Class}:
|
9109 |
|
|
Transformational function
|
9110 |
|
|
|
9111 |
|
|
@item @emph{Syntax}:
|
9112 |
|
|
@code{RESULT = RESHAPE(SOURCE, SHAPE[, PAD, ORDER])}
|
9113 |
|
|
|
9114 |
|
|
@item @emph{Arguments}:
|
9115 |
|
|
@multitable @columnfractions .15 .70
|
9116 |
|
|
@item @var{SOURCE} @tab Shall be an array of any type.
|
9117 |
|
|
@item @var{SHAPE} @tab Shall be of type @code{INTEGER} and an
|
9118 |
|
|
array of rank one. Its values must be positive or zero.
|
9119 |
|
|
@item @var{PAD} @tab (Optional) shall be an array of the same
|
9120 |
|
|
type as @var{SOURCE}.
|
9121 |
|
|
@item @var{ORDER} @tab (Optional) shall be of type @code{INTEGER}
|
9122 |
|
|
and an array of the same shape as @var{SHAPE}. Its values shall
|
9123 |
|
|
be a permutation of the numbers from 1 to n, where n is the size of
|
9124 |
|
|
@var{SHAPE}. If @var{ORDER} is absent, the natural ordering shall
|
9125 |
|
|
be assumed.
|
9126 |
|
|
@end multitable
|
9127 |
|
|
|
9128 |
|
|
@item @emph{Return value}:
|
9129 |
|
|
The result is an array of shape @var{SHAPE} with the same type as
|
9130 |
|
|
@var{SOURCE}.
|
9131 |
|
|
|
9132 |
|
|
@item @emph{Example}:
|
9133 |
|
|
@smallexample
|
9134 |
|
|
PROGRAM test_reshape
|
9135 |
|
|
INTEGER, DIMENSION(4) :: x
|
9136 |
|
|
WRITE(*,*) SHAPE(x) ! prints "4"
|
9137 |
|
|
WRITE(*,*) SHAPE(RESHAPE(x, (/2, 2/))) ! prints "2 2"
|
9138 |
|
|
END PROGRAM
|
9139 |
|
|
@end smallexample
|
9140 |
|
|
|
9141 |
|
|
@item @emph{See also}:
|
9142 |
|
|
@ref{SHAPE}
|
9143 |
|
|
@end table
|
9144 |
|
|
|
9145 |
|
|
|
9146 |
|
|
|
9147 |
|
|
@node RRSPACING
|
9148 |
|
|
@section @code{RRSPACING} --- Reciprocal of the relative spacing
|
9149 |
|
|
@fnindex RRSPACING
|
9150 |
|
|
@cindex real number, relative spacing
|
9151 |
|
|
@cindex floating point, relative spacing
|
9152 |
|
|
|
9153 |
|
|
|
9154 |
|
|
@table @asis
|
9155 |
|
|
@item @emph{Description}:
|
9156 |
|
|
@code{RRSPACING(X)} returns the reciprocal of the relative spacing of
|
9157 |
|
|
model numbers near @var{X}.
|
9158 |
|
|
|
9159 |
|
|
@item @emph{Standard}:
|
9160 |
|
|
Fortran 95 and later
|
9161 |
|
|
|
9162 |
|
|
@item @emph{Class}:
|
9163 |
|
|
Elemental function
|
9164 |
|
|
|
9165 |
|
|
@item @emph{Syntax}:
|
9166 |
|
|
@code{RESULT = RRSPACING(X)}
|
9167 |
|
|
|
9168 |
|
|
@item @emph{Arguments}:
|
9169 |
|
|
@multitable @columnfractions .15 .70
|
9170 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
9171 |
|
|
@end multitable
|
9172 |
|
|
|
9173 |
|
|
@item @emph{Return value}:
|
9174 |
|
|
The return value is of the same type and kind as @var{X}.
|
9175 |
|
|
The value returned is equal to
|
9176 |
|
|
@code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
|
9177 |
|
|
|
9178 |
|
|
@item @emph{See also}:
|
9179 |
|
|
@ref{SPACING}
|
9180 |
|
|
@end table
|
9181 |
|
|
|
9182 |
|
|
|
9183 |
|
|
|
9184 |
|
|
@node RSHIFT
|
9185 |
|
|
@section @code{RSHIFT} --- Right shift bits
|
9186 |
|
|
@fnindex RSHIFT
|
9187 |
|
|
@cindex bits, shift right
|
9188 |
|
|
|
9189 |
|
|
@table @asis
|
9190 |
|
|
@item @emph{Description}:
|
9191 |
|
|
@code{RSHIFT} returns a value corresponding to @var{I} with all of the
|
9192 |
|
|
bits shifted right by @var{SHIFT} places. If the absolute value of
|
9193 |
|
|
@var{SHIFT} is greater than @code{BIT_SIZE(I)}, the value is undefined.
|
9194 |
|
|
Bits shifted out from the left end are lost; zeros are shifted in from
|
9195 |
|
|
the opposite end.
|
9196 |
|
|
|
9197 |
|
|
This function has been superseded by the @code{ISHFT} intrinsic, which
|
9198 |
|
|
is standard in Fortran 95 and later.
|
9199 |
|
|
|
9200 |
|
|
@item @emph{Standard}:
|
9201 |
|
|
GNU extension
|
9202 |
|
|
|
9203 |
|
|
@item @emph{Class}:
|
9204 |
|
|
Elemental function
|
9205 |
|
|
|
9206 |
|
|
@item @emph{Syntax}:
|
9207 |
|
|
@code{RESULT = RSHIFT(I, SHIFT)}
|
9208 |
|
|
|
9209 |
|
|
@item @emph{Arguments}:
|
9210 |
|
|
@multitable @columnfractions .15 .70
|
9211 |
|
|
@item @var{I} @tab The type shall be @code{INTEGER}.
|
9212 |
|
|
@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
|
9213 |
|
|
@end multitable
|
9214 |
|
|
|
9215 |
|
|
@item @emph{Return value}:
|
9216 |
|
|
The return value is of type @code{INTEGER} and of the same kind as
|
9217 |
|
|
@var{I}.
|
9218 |
|
|
|
9219 |
|
|
@item @emph{See also}:
|
9220 |
|
|
@ref{ISHFT}, @ref{ISHFTC}, @ref{LSHIFT}
|
9221 |
|
|
|
9222 |
|
|
@end table
|
9223 |
|
|
|
9224 |
|
|
|
9225 |
|
|
|
9226 |
|
|
@node SCALE
|
9227 |
|
|
@section @code{SCALE} --- Scale a real value
|
9228 |
|
|
@fnindex SCALE
|
9229 |
|
|
@cindex real number, scale
|
9230 |
|
|
@cindex floating point, scale
|
9231 |
|
|
|
9232 |
|
|
@table @asis
|
9233 |
|
|
@item @emph{Description}:
|
9234 |
|
|
@code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
|
9235 |
|
|
|
9236 |
|
|
@item @emph{Standard}:
|
9237 |
|
|
Fortran 95 and later
|
9238 |
|
|
|
9239 |
|
|
@item @emph{Class}:
|
9240 |
|
|
Elemental function
|
9241 |
|
|
|
9242 |
|
|
@item @emph{Syntax}:
|
9243 |
|
|
@code{RESULT = SCALE(X, I)}
|
9244 |
|
|
|
9245 |
|
|
@item @emph{Arguments}:
|
9246 |
|
|
@multitable @columnfractions .15 .70
|
9247 |
|
|
@item @var{X} @tab The type of the argument shall be a @code{REAL}.
|
9248 |
|
|
@item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
|
9249 |
|
|
@end multitable
|
9250 |
|
|
|
9251 |
|
|
@item @emph{Return value}:
|
9252 |
|
|
The return value is of the same type and kind as @var{X}.
|
9253 |
|
|
Its value is @code{X * RADIX(X)**I}.
|
9254 |
|
|
|
9255 |
|
|
@item @emph{Example}:
|
9256 |
|
|
@smallexample
|
9257 |
|
|
program test_scale
|
9258 |
|
|
real :: x = 178.1387e-4
|
9259 |
|
|
integer :: i = 5
|
9260 |
|
|
print *, scale(x,i), x*radix(x)**i
|
9261 |
|
|
end program test_scale
|
9262 |
|
|
@end smallexample
|
9263 |
|
|
|
9264 |
|
|
@end table
|
9265 |
|
|
|
9266 |
|
|
|
9267 |
|
|
|
9268 |
|
|
@node SCAN
|
9269 |
|
|
@section @code{SCAN} --- Scan a string for the presence of a set of characters
|
9270 |
|
|
@fnindex SCAN
|
9271 |
|
|
@cindex string, find subset
|
9272 |
|
|
|
9273 |
|
|
@table @asis
|
9274 |
|
|
@item @emph{Description}:
|
9275 |
|
|
Scans a @var{STRING} for any of the characters in a @var{SET}
|
9276 |
|
|
of characters.
|
9277 |
|
|
|
9278 |
|
|
If @var{BACK} is either absent or equals @code{FALSE}, this function
|
9279 |
|
|
returns the position of the leftmost character of @var{STRING} that is
|
9280 |
|
|
in @var{SET}. If @var{BACK} equals @code{TRUE}, the rightmost position
|
9281 |
|
|
is returned. If no character of @var{SET} is found in @var{STRING}, the
|
9282 |
|
|
result is zero.
|
9283 |
|
|
|
9284 |
|
|
@item @emph{Standard}:
|
9285 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
9286 |
|
|
|
9287 |
|
|
@item @emph{Class}:
|
9288 |
|
|
Elemental function
|
9289 |
|
|
|
9290 |
|
|
@item @emph{Syntax}:
|
9291 |
|
|
@code{RESULT = SCAN(STRING, SET[, BACK [, KIND]])}
|
9292 |
|
|
|
9293 |
|
|
@item @emph{Arguments}:
|
9294 |
|
|
@multitable @columnfractions .15 .70
|
9295 |
|
|
@item @var{STRING} @tab Shall be of type @code{CHARACTER}.
|
9296 |
|
|
@item @var{SET} @tab Shall be of type @code{CHARACTER}.
|
9297 |
|
|
@item @var{BACK} @tab (Optional) shall be of type @code{LOGICAL}.
|
9298 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
9299 |
|
|
expression indicating the kind parameter of the result.
|
9300 |
|
|
@end multitable
|
9301 |
|
|
|
9302 |
|
|
@item @emph{Return value}:
|
9303 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
9304 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
9305 |
|
|
|
9306 |
|
|
@item @emph{Example}:
|
9307 |
|
|
@smallexample
|
9308 |
|
|
PROGRAM test_scan
|
9309 |
|
|
WRITE(*,*) SCAN("FORTRAN", "AO") ! 2, found 'O'
|
9310 |
|
|
WRITE(*,*) SCAN("FORTRAN", "AO", .TRUE.) ! 6, found 'A'
|
9311 |
|
|
WRITE(*,*) SCAN("FORTRAN", "C++") ! 0, found none
|
9312 |
|
|
END PROGRAM
|
9313 |
|
|
@end smallexample
|
9314 |
|
|
|
9315 |
|
|
@item @emph{See also}:
|
9316 |
|
|
@ref{INDEX intrinsic}, @ref{VERIFY}
|
9317 |
|
|
@end table
|
9318 |
|
|
|
9319 |
|
|
|
9320 |
|
|
|
9321 |
|
|
@node SECNDS
|
9322 |
|
|
@section @code{SECNDS} --- Time function
|
9323 |
|
|
@fnindex SECNDS
|
9324 |
|
|
@cindex time, elapsed
|
9325 |
|
|
@cindex elapsed time
|
9326 |
|
|
|
9327 |
|
|
@table @asis
|
9328 |
|
|
@item @emph{Description}:
|
9329 |
|
|
@code{SECNDS(X)} gets the time in seconds from the real-time system clock.
|
9330 |
|
|
@var{X} is a reference time, also in seconds. If this is zero, the time in
|
9331 |
|
|
seconds from midnight is returned. This function is non-standard and its
|
9332 |
|
|
use is discouraged.
|
9333 |
|
|
|
9334 |
|
|
@item @emph{Standard}:
|
9335 |
|
|
GNU extension
|
9336 |
|
|
|
9337 |
|
|
@item @emph{Class}:
|
9338 |
|
|
Function
|
9339 |
|
|
|
9340 |
|
|
@item @emph{Syntax}:
|
9341 |
|
|
@code{RESULT = SECNDS (X)}
|
9342 |
|
|
|
9343 |
|
|
@item @emph{Arguments}:
|
9344 |
|
|
@multitable @columnfractions .15 .70
|
9345 |
|
|
@item @var{T} @tab Shall be of type @code{REAL(4)}.
|
9346 |
|
|
@item @var{X} @tab Shall be of type @code{REAL(4)}.
|
9347 |
|
|
@end multitable
|
9348 |
|
|
|
9349 |
|
|
@item @emph{Return value}:
|
9350 |
|
|
None
|
9351 |
|
|
|
9352 |
|
|
@item @emph{Example}:
|
9353 |
|
|
@smallexample
|
9354 |
|
|
program test_secnds
|
9355 |
|
|
integer :: i
|
9356 |
|
|
real(4) :: t1, t2
|
9357 |
|
|
print *, secnds (0.0) ! seconds since midnight
|
9358 |
|
|
t1 = secnds (0.0) ! reference time
|
9359 |
|
|
do i = 1, 10000000 ! do something
|
9360 |
|
|
end do
|
9361 |
|
|
t2 = secnds (t1) ! elapsed time
|
9362 |
|
|
print *, "Something took ", t2, " seconds."
|
9363 |
|
|
end program test_secnds
|
9364 |
|
|
@end smallexample
|
9365 |
|
|
@end table
|
9366 |
|
|
|
9367 |
|
|
|
9368 |
|
|
|
9369 |
|
|
@node SECOND
|
9370 |
|
|
@section @code{SECOND} --- CPU time function
|
9371 |
|
|
@fnindex SECOND
|
9372 |
|
|
@cindex time, elapsed
|
9373 |
|
|
@cindex elapsed time
|
9374 |
|
|
|
9375 |
|
|
@table @asis
|
9376 |
|
|
@item @emph{Description}:
|
9377 |
|
|
Returns a @code{REAL(4)} value representing the elapsed CPU time in
|
9378 |
|
|
seconds. This provides the same functionality as the standard
|
9379 |
|
|
@code{CPU_TIME} intrinsic, and is only included for backwards
|
9380 |
|
|
compatibility.
|
9381 |
|
|
|
9382 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
9383 |
|
|
however, only one form can be used in any given program unit.
|
9384 |
|
|
|
9385 |
|
|
@item @emph{Standard}:
|
9386 |
|
|
GNU extension
|
9387 |
|
|
|
9388 |
|
|
@item @emph{Class}:
|
9389 |
|
|
Subroutine, function
|
9390 |
|
|
|
9391 |
|
|
@item @emph{Syntax}:
|
9392 |
|
|
@multitable @columnfractions .80
|
9393 |
|
|
@item @code{CALL SECOND(TIME)}
|
9394 |
|
|
@item @code{TIME = SECOND()}
|
9395 |
|
|
@end multitable
|
9396 |
|
|
|
9397 |
|
|
@item @emph{Arguments}:
|
9398 |
|
|
@multitable @columnfractions .15 .70
|
9399 |
|
|
@item @var{TIME} @tab Shall be of type @code{REAL(4)}.
|
9400 |
|
|
@end multitable
|
9401 |
|
|
|
9402 |
|
|
@item @emph{Return value}:
|
9403 |
|
|
In either syntax, @var{TIME} is set to the process's current runtime in
|
9404 |
|
|
seconds.
|
9405 |
|
|
|
9406 |
|
|
@item @emph{See also}:
|
9407 |
|
|
@ref{CPU_TIME}
|
9408 |
|
|
|
9409 |
|
|
@end table
|
9410 |
|
|
|
9411 |
|
|
|
9412 |
|
|
|
9413 |
|
|
@node SELECTED_CHAR_KIND
|
9414 |
|
|
@section @code{SELECTED_CHAR_KIND} --- Choose character kind
|
9415 |
|
|
@fnindex SELECTED_CHAR_KIND
|
9416 |
|
|
@cindex character kind
|
9417 |
|
|
@cindex kind, character
|
9418 |
|
|
|
9419 |
|
|
@table @asis
|
9420 |
|
|
@item @emph{Description}:
|
9421 |
|
|
|
9422 |
|
|
@code{SELECTED_CHAR_KIND(NAME)} returns the kind value for the character
|
9423 |
|
|
set named @var{NAME}, if a character set with such a name is supported,
|
9424 |
|
|
or @math{-1} otherwise. Currently, supported character sets include
|
9425 |
|
|
``ASCII'' and ``DEFAULT'', which are equivalent.
|
9426 |
|
|
|
9427 |
|
|
@item @emph{Standard}:
|
9428 |
|
|
Fortran 2003 and later
|
9429 |
|
|
|
9430 |
|
|
@item @emph{Class}:
|
9431 |
|
|
Transformational function
|
9432 |
|
|
|
9433 |
|
|
@item @emph{Syntax}:
|
9434 |
|
|
@code{RESULT = SELECTED_CHAR_KIND(NAME)}
|
9435 |
|
|
|
9436 |
|
|
@item @emph{Arguments}:
|
9437 |
|
|
@multitable @columnfractions .15 .70
|
9438 |
|
|
@item @var{NAME} @tab Shall be a scalar and of the default character type.
|
9439 |
|
|
@end multitable
|
9440 |
|
|
|
9441 |
|
|
@item @emph{Example}:
|
9442 |
|
|
@smallexample
|
9443 |
|
|
program ascii_kind
|
9444 |
|
|
integer,parameter :: ascii = selected_char_kind("ascii")
|
9445 |
|
|
character(kind=ascii, len=26) :: s
|
9446 |
|
|
|
9447 |
|
|
s = ascii_"abcdefghijklmnopqrstuvwxyz"
|
9448 |
|
|
print *, s
|
9449 |
|
|
end program ascii_kind
|
9450 |
|
|
@end smallexample
|
9451 |
|
|
@end table
|
9452 |
|
|
|
9453 |
|
|
|
9454 |
|
|
|
9455 |
|
|
@node SELECTED_INT_KIND
|
9456 |
|
|
@section @code{SELECTED_INT_KIND} --- Choose integer kind
|
9457 |
|
|
@fnindex SELECTED_INT_KIND
|
9458 |
|
|
@cindex integer kind
|
9459 |
|
|
@cindex kind, integer
|
9460 |
|
|
|
9461 |
|
|
@table @asis
|
9462 |
|
|
@item @emph{Description}:
|
9463 |
|
|
@code{SELECTED_INT_KIND(R)} return the kind value of the smallest integer
|
9464 |
|
|
type that can represent all values ranging from @math{-10^R} (exclusive)
|
9465 |
|
|
to @math{10^R} (exclusive). If there is no integer kind that accommodates
|
9466 |
|
|
this range, @code{SELECTED_INT_KIND} returns @math{-1}.
|
9467 |
|
|
|
9468 |
|
|
@item @emph{Standard}:
|
9469 |
|
|
Fortran 95 and later
|
9470 |
|
|
|
9471 |
|
|
@item @emph{Class}:
|
9472 |
|
|
Transformational function
|
9473 |
|
|
|
9474 |
|
|
@item @emph{Syntax}:
|
9475 |
|
|
@code{RESULT = SELECTED_INT_KIND(R)}
|
9476 |
|
|
|
9477 |
|
|
@item @emph{Arguments}:
|
9478 |
|
|
@multitable @columnfractions .15 .70
|
9479 |
|
|
@item @var{R} @tab Shall be a scalar and of type @code{INTEGER}.
|
9480 |
|
|
@end multitable
|
9481 |
|
|
|
9482 |
|
|
@item @emph{Example}:
|
9483 |
|
|
@smallexample
|
9484 |
|
|
program large_integers
|
9485 |
|
|
integer,parameter :: k5 = selected_int_kind(5)
|
9486 |
|
|
integer,parameter :: k15 = selected_int_kind(15)
|
9487 |
|
|
integer(kind=k5) :: i5
|
9488 |
|
|
integer(kind=k15) :: i15
|
9489 |
|
|
|
9490 |
|
|
print *, huge(i5), huge(i15)
|
9491 |
|
|
|
9492 |
|
|
! The following inequalities are always true
|
9493 |
|
|
print *, huge(i5) >= 10_k5**5-1
|
9494 |
|
|
print *, huge(i15) >= 10_k15**15-1
|
9495 |
|
|
end program large_integers
|
9496 |
|
|
@end smallexample
|
9497 |
|
|
@end table
|
9498 |
|
|
|
9499 |
|
|
|
9500 |
|
|
|
9501 |
|
|
@node SELECTED_REAL_KIND
|
9502 |
|
|
@section @code{SELECTED_REAL_KIND} --- Choose real kind
|
9503 |
|
|
@fnindex SELECTED_REAL_KIND
|
9504 |
|
|
@cindex real kind
|
9505 |
|
|
@cindex kind, real
|
9506 |
|
|
|
9507 |
|
|
@table @asis
|
9508 |
|
|
@item @emph{Description}:
|
9509 |
|
|
@code{SELECTED_REAL_KIND(P,R)} returns the kind value of a real data type
|
9510 |
|
|
with decimal precision of at least @code{P} digits and exponent
|
9511 |
|
|
range greater at least @code{R}.
|
9512 |
|
|
|
9513 |
|
|
@item @emph{Standard}:
|
9514 |
|
|
Fortran 95 and later
|
9515 |
|
|
|
9516 |
|
|
@item @emph{Class}:
|
9517 |
|
|
Transformational function
|
9518 |
|
|
|
9519 |
|
|
@item @emph{Syntax}:
|
9520 |
|
|
@code{RESULT = SELECTED_REAL_KIND([P, R])}
|
9521 |
|
|
|
9522 |
|
|
@item @emph{Arguments}:
|
9523 |
|
|
@multitable @columnfractions .15 .70
|
9524 |
|
|
@item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
|
9525 |
|
|
@item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
|
9526 |
|
|
@end multitable
|
9527 |
|
|
At least one argument shall be present.
|
9528 |
|
|
|
9529 |
|
|
@item @emph{Return value}:
|
9530 |
|
|
|
9531 |
|
|
@code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
|
9532 |
|
|
a real data type with decimal precision of at least @code{P} digits and a
|
9533 |
|
|
decimal exponent range of at least @code{R}. If more than one real data
|
9534 |
|
|
type meet the criteria, the kind of the data type with the smallest
|
9535 |
|
|
decimal precision is returned. If no real data type matches the criteria,
|
9536 |
|
|
the result is
|
9537 |
|
|
@table @asis
|
9538 |
|
|
@item -1 if the processor does not support a real data type with a
|
9539 |
|
|
precision greater than or equal to @code{P}
|
9540 |
|
|
@item -2 if the processor does not support a real type with an exponent
|
9541 |
|
|
range greater than or equal to @code{R}
|
9542 |
|
|
@item -3 if neither is supported.
|
9543 |
|
|
@end table
|
9544 |
|
|
|
9545 |
|
|
@item @emph{Example}:
|
9546 |
|
|
@smallexample
|
9547 |
|
|
program real_kinds
|
9548 |
|
|
integer,parameter :: p6 = selected_real_kind(6)
|
9549 |
|
|
integer,parameter :: p10r100 = selected_real_kind(10,100)
|
9550 |
|
|
integer,parameter :: r400 = selected_real_kind(r=400)
|
9551 |
|
|
real(kind=p6) :: x
|
9552 |
|
|
real(kind=p10r100) :: y
|
9553 |
|
|
real(kind=r400) :: z
|
9554 |
|
|
|
9555 |
|
|
print *, precision(x), range(x)
|
9556 |
|
|
print *, precision(y), range(y)
|
9557 |
|
|
print *, precision(z), range(z)
|
9558 |
|
|
end program real_kinds
|
9559 |
|
|
@end smallexample
|
9560 |
|
|
@end table
|
9561 |
|
|
|
9562 |
|
|
|
9563 |
|
|
|
9564 |
|
|
@node SET_EXPONENT
|
9565 |
|
|
@section @code{SET_EXPONENT} --- Set the exponent of the model
|
9566 |
|
|
@fnindex SET_EXPONENT
|
9567 |
|
|
@cindex real number, set exponent
|
9568 |
|
|
@cindex floating point, set exponent
|
9569 |
|
|
|
9570 |
|
|
@table @asis
|
9571 |
|
|
@item @emph{Description}:
|
9572 |
|
|
@code{SET_EXPONENT(X, I)} returns the real number whose fractional part
|
9573 |
|
|
is that that of @var{X} and whose exponent part is @var{I}.
|
9574 |
|
|
|
9575 |
|
|
@item @emph{Standard}:
|
9576 |
|
|
Fortran 95 and later
|
9577 |
|
|
|
9578 |
|
|
@item @emph{Class}:
|
9579 |
|
|
Elemental function
|
9580 |
|
|
|
9581 |
|
|
@item @emph{Syntax}:
|
9582 |
|
|
@code{RESULT = SET_EXPONENT(X, I)}
|
9583 |
|
|
|
9584 |
|
|
@item @emph{Arguments}:
|
9585 |
|
|
@multitable @columnfractions .15 .70
|
9586 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
9587 |
|
|
@item @var{I} @tab Shall be of type @code{INTEGER}.
|
9588 |
|
|
@end multitable
|
9589 |
|
|
|
9590 |
|
|
@item @emph{Return value}:
|
9591 |
|
|
The return value is of the same type and kind as @var{X}.
|
9592 |
|
|
The real number whose fractional part
|
9593 |
|
|
is that that of @var{X} and whose exponent part if @var{I} is returned;
|
9594 |
|
|
it is @code{FRACTION(X) * RADIX(X)**I}.
|
9595 |
|
|
|
9596 |
|
|
@item @emph{Example}:
|
9597 |
|
|
@smallexample
|
9598 |
|
|
PROGRAM test_setexp
|
9599 |
|
|
REAL :: x = 178.1387e-4
|
9600 |
|
|
INTEGER :: i = 17
|
9601 |
|
|
PRINT *, SET_EXPONENT(x, i), FRACTION(x) * RADIX(x)**i
|
9602 |
|
|
END PROGRAM
|
9603 |
|
|
@end smallexample
|
9604 |
|
|
|
9605 |
|
|
@end table
|
9606 |
|
|
|
9607 |
|
|
|
9608 |
|
|
|
9609 |
|
|
@node SHAPE
|
9610 |
|
|
@section @code{SHAPE} --- Determine the shape of an array
|
9611 |
|
|
@fnindex SHAPE
|
9612 |
|
|
@cindex array, shape
|
9613 |
|
|
|
9614 |
|
|
@table @asis
|
9615 |
|
|
@item @emph{Description}:
|
9616 |
|
|
Determines the shape of an array.
|
9617 |
|
|
|
9618 |
|
|
@item @emph{Standard}:
|
9619 |
|
|
Fortran 95 and later
|
9620 |
|
|
|
9621 |
|
|
@item @emph{Class}:
|
9622 |
|
|
Inquiry function
|
9623 |
|
|
|
9624 |
|
|
@item @emph{Syntax}:
|
9625 |
|
|
@code{RESULT = SHAPE(SOURCE)}
|
9626 |
|
|
|
9627 |
|
|
@item @emph{Arguments}:
|
9628 |
|
|
@multitable @columnfractions .15 .70
|
9629 |
|
|
@item @var{SOURCE} @tab Shall be an array or scalar of any type.
|
9630 |
|
|
If @var{SOURCE} is a pointer it must be associated and allocatable
|
9631 |
|
|
arrays must be allocated.
|
9632 |
|
|
@end multitable
|
9633 |
|
|
|
9634 |
|
|
@item @emph{Return value}:
|
9635 |
|
|
An @code{INTEGER} array of rank one with as many elements as @var{SOURCE}
|
9636 |
|
|
has dimensions. The elements of the resulting array correspond to the extend
|
9637 |
|
|
of @var{SOURCE} along the respective dimensions. If @var{SOURCE} is a scalar,
|
9638 |
|
|
the result is the rank one array of size zero.
|
9639 |
|
|
|
9640 |
|
|
@item @emph{Example}:
|
9641 |
|
|
@smallexample
|
9642 |
|
|
PROGRAM test_shape
|
9643 |
|
|
INTEGER, DIMENSION(-1:1, -1:2) :: A
|
9644 |
|
|
WRITE(*,*) SHAPE(A) ! (/ 3, 4 /)
|
9645 |
|
|
WRITE(*,*) SIZE(SHAPE(42)) ! (/ /)
|
9646 |
|
|
END PROGRAM
|
9647 |
|
|
@end smallexample
|
9648 |
|
|
|
9649 |
|
|
@item @emph{See also}:
|
9650 |
|
|
@ref{RESHAPE}, @ref{SIZE}
|
9651 |
|
|
@end table
|
9652 |
|
|
|
9653 |
|
|
|
9654 |
|
|
|
9655 |
|
|
@node SIGN
|
9656 |
|
|
@section @code{SIGN} --- Sign copying function
|
9657 |
|
|
@fnindex SIGN
|
9658 |
|
|
@fnindex ISIGN
|
9659 |
|
|
@fnindex DSIGN
|
9660 |
|
|
@cindex sign copying
|
9661 |
|
|
|
9662 |
|
|
@table @asis
|
9663 |
|
|
@item @emph{Description}:
|
9664 |
|
|
@code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
|
9665 |
|
|
|
9666 |
|
|
@item @emph{Standard}:
|
9667 |
|
|
Fortran 77 and later
|
9668 |
|
|
|
9669 |
|
|
@item @emph{Class}:
|
9670 |
|
|
Elemental function
|
9671 |
|
|
|
9672 |
|
|
@item @emph{Syntax}:
|
9673 |
|
|
@code{RESULT = SIGN(A, B)}
|
9674 |
|
|
|
9675 |
|
|
@item @emph{Arguments}:
|
9676 |
|
|
@multitable @columnfractions .15 .70
|
9677 |
|
|
@item @var{A} @tab Shall be of type @code{INTEGER} or @code{REAL}
|
9678 |
|
|
@item @var{B} @tab Shall be of the same type and kind as @var{A}
|
9679 |
|
|
@end multitable
|
9680 |
|
|
|
9681 |
|
|
@item @emph{Return value}:
|
9682 |
|
|
The kind of the return value is that of @var{A} and @var{B}.
|
9683 |
|
|
If @math{B\ge 0} then the result is @code{ABS(A)}, else
|
9684 |
|
|
it is @code{-ABS(A)}.
|
9685 |
|
|
|
9686 |
|
|
@item @emph{Example}:
|
9687 |
|
|
@smallexample
|
9688 |
|
|
program test_sign
|
9689 |
|
|
print *, sign(-12,1)
|
9690 |
|
|
print *, sign(-12,0)
|
9691 |
|
|
print *, sign(-12,-1)
|
9692 |
|
|
|
9693 |
|
|
print *, sign(-12.,1.)
|
9694 |
|
|
print *, sign(-12.,0.)
|
9695 |
|
|
print *, sign(-12.,-1.)
|
9696 |
|
|
end program test_sign
|
9697 |
|
|
@end smallexample
|
9698 |
|
|
|
9699 |
|
|
@item @emph{Specific names}:
|
9700 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
9701 |
|
|
@item Name @tab Arguments @tab Return type @tab Standard
|
9702 |
|
|
@item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
|
9703 |
|
|
@item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
|
9704 |
|
|
@end multitable
|
9705 |
|
|
@end table
|
9706 |
|
|
|
9707 |
|
|
|
9708 |
|
|
|
9709 |
|
|
@node SIGNAL
|
9710 |
|
|
@section @code{SIGNAL} --- Signal handling subroutine (or function)
|
9711 |
|
|
@fnindex SIGNAL
|
9712 |
|
|
@cindex system, signal handling
|
9713 |
|
|
|
9714 |
|
|
@table @asis
|
9715 |
|
|
@item @emph{Description}:
|
9716 |
|
|
@code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
|
9717 |
|
|
@var{HANDLER} to be executed with a single integer argument when signal
|
9718 |
|
|
@var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to
|
9719 |
|
|
turn off handling of signal @var{NUMBER} or revert to its default
|
9720 |
|
|
action. See @code{signal(2)}.
|
9721 |
|
|
|
9722 |
|
|
If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
|
9723 |
|
|
is supplied, it is set to the value returned by @code{signal(2)}.
|
9724 |
|
|
|
9725 |
|
|
@item @emph{Standard}:
|
9726 |
|
|
GNU extension
|
9727 |
|
|
|
9728 |
|
|
@item @emph{Class}:
|
9729 |
|
|
Subroutine, function
|
9730 |
|
|
|
9731 |
|
|
@item @emph{Syntax}:
|
9732 |
|
|
@multitable @columnfractions .80
|
9733 |
|
|
@item @code{CALL SIGNAL(NUMBER, HANDLER [, STATUS])}
|
9734 |
|
|
@item @code{STATUS = SIGNAL(NUMBER, HANDLER)}
|
9735 |
|
|
@end multitable
|
9736 |
|
|
|
9737 |
|
|
@item @emph{Arguments}:
|
9738 |
|
|
@multitable @columnfractions .15 .70
|
9739 |
|
|
@item @var{NUMBER} @tab Shall be a scalar integer, with @code{INTENT(IN)}
|
9740 |
|
|
@item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
|
9741 |
|
|
@code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
|
9742 |
|
|
@code{INTEGER}. It is @code{INTENT(IN)}.
|
9743 |
|
|
@item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
|
9744 |
|
|
integer. It has @code{INTENT(OUT)}.
|
9745 |
|
|
@end multitable
|
9746 |
|
|
@c TODO: What should the interface of the handler be? Does it take arguments?
|
9747 |
|
|
|
9748 |
|
|
@item @emph{Return value}:
|
9749 |
|
|
The @code{SIGNAL} function returns the value returned by @code{signal(2)}.
|
9750 |
|
|
|
9751 |
|
|
@item @emph{Example}:
|
9752 |
|
|
@smallexample
|
9753 |
|
|
program test_signal
|
9754 |
|
|
intrinsic signal
|
9755 |
|
|
external handler_print
|
9756 |
|
|
|
9757 |
|
|
call signal (12, handler_print)
|
9758 |
|
|
call signal (10, 1)
|
9759 |
|
|
|
9760 |
|
|
call sleep (30)
|
9761 |
|
|
end program test_signal
|
9762 |
|
|
@end smallexample
|
9763 |
|
|
@end table
|
9764 |
|
|
|
9765 |
|
|
|
9766 |
|
|
|
9767 |
|
|
@node SIN
|
9768 |
|
|
@section @code{SIN} --- Sine function
|
9769 |
|
|
@fnindex SIN
|
9770 |
|
|
@fnindex DSIN
|
9771 |
|
|
@fnindex CSIN
|
9772 |
|
|
@fnindex ZSIN
|
9773 |
|
|
@fnindex CDSIN
|
9774 |
|
|
@cindex trigonometric function, sine
|
9775 |
|
|
@cindex sine
|
9776 |
|
|
|
9777 |
|
|
@table @asis
|
9778 |
|
|
@item @emph{Description}:
|
9779 |
|
|
@code{SIN(X)} computes the sine of @var{X}.
|
9780 |
|
|
|
9781 |
|
|
@item @emph{Standard}:
|
9782 |
|
|
Fortran 77 and later
|
9783 |
|
|
|
9784 |
|
|
@item @emph{Class}:
|
9785 |
|
|
Elemental function
|
9786 |
|
|
|
9787 |
|
|
@item @emph{Syntax}:
|
9788 |
|
|
@code{RESULT = SIN(X)}
|
9789 |
|
|
|
9790 |
|
|
@item @emph{Arguments}:
|
9791 |
|
|
@multitable @columnfractions .15 .70
|
9792 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or
|
9793 |
|
|
@code{COMPLEX}.
|
9794 |
|
|
@end multitable
|
9795 |
|
|
|
9796 |
|
|
@item @emph{Return value}:
|
9797 |
|
|
The return value has same type and kind as @var{X}.
|
9798 |
|
|
|
9799 |
|
|
@item @emph{Example}:
|
9800 |
|
|
@smallexample
|
9801 |
|
|
program test_sin
|
9802 |
|
|
real :: x = 0.0
|
9803 |
|
|
x = sin(x)
|
9804 |
|
|
end program test_sin
|
9805 |
|
|
@end smallexample
|
9806 |
|
|
|
9807 |
|
|
@item @emph{Specific names}:
|
9808 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
9809 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
9810 |
|
|
@item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
|
9811 |
|
|
@item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
|
9812 |
|
|
@item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
|
9813 |
|
|
@item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
|
9814 |
|
|
@end multitable
|
9815 |
|
|
|
9816 |
|
|
@item @emph{See also}:
|
9817 |
|
|
@ref{ASIN}
|
9818 |
|
|
@end table
|
9819 |
|
|
|
9820 |
|
|
|
9821 |
|
|
|
9822 |
|
|
@node SINH
|
9823 |
|
|
@section @code{SINH} --- Hyperbolic sine function
|
9824 |
|
|
@fnindex SINH
|
9825 |
|
|
@fnindex DSINH
|
9826 |
|
|
@cindex hyperbolic sine
|
9827 |
|
|
@cindex hyperbolic function, sine
|
9828 |
|
|
@cindex sine, hyperbolic
|
9829 |
|
|
|
9830 |
|
|
@table @asis
|
9831 |
|
|
@item @emph{Description}:
|
9832 |
|
|
@code{SINH(X)} computes the hyperbolic sine of @var{X}.
|
9833 |
|
|
|
9834 |
|
|
@item @emph{Standard}:
|
9835 |
|
|
Fortran 95 and later, for a complex argument Fortran 2008 or later
|
9836 |
|
|
|
9837 |
|
|
@item @emph{Class}:
|
9838 |
|
|
Elemental function
|
9839 |
|
|
|
9840 |
|
|
@item @emph{Syntax}:
|
9841 |
|
|
@code{RESULT = SINH(X)}
|
9842 |
|
|
|
9843 |
|
|
@item @emph{Arguments}:
|
9844 |
|
|
@multitable @columnfractions .15 .70
|
9845 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
9846 |
|
|
@end multitable
|
9847 |
|
|
|
9848 |
|
|
@item @emph{Return value}:
|
9849 |
|
|
The return value has same type and kind as @var{X}.
|
9850 |
|
|
|
9851 |
|
|
@item @emph{Example}:
|
9852 |
|
|
@smallexample
|
9853 |
|
|
program test_sinh
|
9854 |
|
|
real(8) :: x = - 1.0_8
|
9855 |
|
|
x = sinh(x)
|
9856 |
|
|
end program test_sinh
|
9857 |
|
|
@end smallexample
|
9858 |
|
|
|
9859 |
|
|
@item @emph{Specific names}:
|
9860 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
9861 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
9862 |
|
|
@item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 95 and later
|
9863 |
|
|
@end multitable
|
9864 |
|
|
|
9865 |
|
|
@item @emph{See also}:
|
9866 |
|
|
@ref{ASINH}
|
9867 |
|
|
@end table
|
9868 |
|
|
|
9869 |
|
|
|
9870 |
|
|
|
9871 |
|
|
@node SIZE
|
9872 |
|
|
@section @code{SIZE} --- Determine the size of an array
|
9873 |
|
|
@fnindex SIZE
|
9874 |
|
|
@cindex array, size
|
9875 |
|
|
@cindex array, number of elements
|
9876 |
|
|
@cindex array, count elements
|
9877 |
|
|
|
9878 |
|
|
@table @asis
|
9879 |
|
|
@item @emph{Description}:
|
9880 |
|
|
Determine the extent of @var{ARRAY} along a specified dimension @var{DIM},
|
9881 |
|
|
or the total number of elements in @var{ARRAY} if @var{DIM} is absent.
|
9882 |
|
|
|
9883 |
|
|
@item @emph{Standard}:
|
9884 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
9885 |
|
|
|
9886 |
|
|
@item @emph{Class}:
|
9887 |
|
|
Inquiry function
|
9888 |
|
|
|
9889 |
|
|
@item @emph{Syntax}:
|
9890 |
|
|
@code{RESULT = SIZE(ARRAY[, DIM [, KIND]])}
|
9891 |
|
|
|
9892 |
|
|
@item @emph{Arguments}:
|
9893 |
|
|
@multitable @columnfractions .15 .70
|
9894 |
|
|
@item @var{ARRAY} @tab Shall be an array of any type. If @var{ARRAY} is
|
9895 |
|
|
a pointer it must be associated and allocatable arrays must be allocated.
|
9896 |
|
|
@item @var{DIM} @tab (Optional) shall be a scalar of type @code{INTEGER}
|
9897 |
|
|
and its value shall be in the range from 1 to n, where n equals the rank
|
9898 |
|
|
of @var{ARRAY}.
|
9899 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
9900 |
|
|
expression indicating the kind parameter of the result.
|
9901 |
|
|
@end multitable
|
9902 |
|
|
|
9903 |
|
|
@item @emph{Return value}:
|
9904 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
9905 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
9906 |
|
|
|
9907 |
|
|
@item @emph{Example}:
|
9908 |
|
|
@smallexample
|
9909 |
|
|
PROGRAM test_size
|
9910 |
|
|
WRITE(*,*) SIZE((/ 1, 2 /)) ! 2
|
9911 |
|
|
END PROGRAM
|
9912 |
|
|
@end smallexample
|
9913 |
|
|
|
9914 |
|
|
@item @emph{See also}:
|
9915 |
|
|
@ref{SHAPE}, @ref{RESHAPE}
|
9916 |
|
|
@end table
|
9917 |
|
|
|
9918 |
|
|
|
9919 |
|
|
@node SIZEOF
|
9920 |
|
|
@section @code{SIZEOF} --- Size in bytes of an expression
|
9921 |
|
|
@fnindex SIZEOF
|
9922 |
|
|
@cindex expression size
|
9923 |
|
|
@cindex size of an expression
|
9924 |
|
|
|
9925 |
|
|
@table @asis
|
9926 |
|
|
@item @emph{Description}:
|
9927 |
|
|
@code{SIZEOF(X)} calculates the number of bytes of storage the
|
9928 |
|
|
expression @code{X} occupies.
|
9929 |
|
|
|
9930 |
|
|
@item @emph{Standard}:
|
9931 |
|
|
GNU extension
|
9932 |
|
|
|
9933 |
|
|
@item @emph{Class}:
|
9934 |
|
|
Intrinsic function
|
9935 |
|
|
|
9936 |
|
|
@item @emph{Syntax}:
|
9937 |
|
|
@code{N = SIZEOF(X)}
|
9938 |
|
|
|
9939 |
|
|
@item @emph{Arguments}:
|
9940 |
|
|
@multitable @columnfractions .15 .70
|
9941 |
|
|
@item @var{X} @tab The argument shall be of any type, rank or shape.
|
9942 |
|
|
@end multitable
|
9943 |
|
|
|
9944 |
|
|
@item @emph{Return value}:
|
9945 |
|
|
The return value is of type integer and of the system-dependent kind
|
9946 |
|
|
@var{C_SIZE_T} (from the @var{ISO_C_BINDING} module). Its value is the
|
9947 |
|
|
number of bytes occupied by the argument. If the argument has the
|
9948 |
|
|
@code{POINTER} attribute, the number of bytes of the storage area pointed
|
9949 |
|
|
to is returned. If the argument is of a derived type with @code{POINTER}
|
9950 |
|
|
or @code{ALLOCATABLE} components, the return value doesn't account for
|
9951 |
|
|
the sizes of the data pointed to by these components.
|
9952 |
|
|
|
9953 |
|
|
@item @emph{Example}:
|
9954 |
|
|
@smallexample
|
9955 |
|
|
integer :: i
|
9956 |
|
|
real :: r, s(5)
|
9957 |
|
|
print *, (sizeof(s)/sizeof(r) == 5)
|
9958 |
|
|
end
|
9959 |
|
|
@end smallexample
|
9960 |
|
|
The example will print @code{.TRUE.} unless you are using a platform
|
9961 |
|
|
where default @code{REAL} variables are unusually padded.
|
9962 |
|
|
|
9963 |
|
|
@item @emph{See also}:
|
9964 |
|
|
@ref{C_SIZEOF}
|
9965 |
|
|
@end table
|
9966 |
|
|
|
9967 |
|
|
|
9968 |
|
|
@node SLEEP
|
9969 |
|
|
@section @code{SLEEP} --- Sleep for the specified number of seconds
|
9970 |
|
|
@fnindex SLEEP
|
9971 |
|
|
@cindex delayed execution
|
9972 |
|
|
|
9973 |
|
|
@table @asis
|
9974 |
|
|
@item @emph{Description}:
|
9975 |
|
|
Calling this subroutine causes the process to pause for @var{SECONDS} seconds.
|
9976 |
|
|
|
9977 |
|
|
@item @emph{Standard}:
|
9978 |
|
|
GNU extension
|
9979 |
|
|
|
9980 |
|
|
@item @emph{Class}:
|
9981 |
|
|
Subroutine
|
9982 |
|
|
|
9983 |
|
|
@item @emph{Syntax}:
|
9984 |
|
|
@code{CALL SLEEP(SECONDS)}
|
9985 |
|
|
|
9986 |
|
|
@item @emph{Arguments}:
|
9987 |
|
|
@multitable @columnfractions .15 .70
|
9988 |
|
|
@item @var{SECONDS} @tab The type shall be of default @code{INTEGER}.
|
9989 |
|
|
@end multitable
|
9990 |
|
|
|
9991 |
|
|
@item @emph{Example}:
|
9992 |
|
|
@smallexample
|
9993 |
|
|
program test_sleep
|
9994 |
|
|
call sleep(5)
|
9995 |
|
|
end
|
9996 |
|
|
@end smallexample
|
9997 |
|
|
@end table
|
9998 |
|
|
|
9999 |
|
|
|
10000 |
|
|
|
10001 |
|
|
@node SNGL
|
10002 |
|
|
@section @code{SNGL} --- Convert double precision real to default real
|
10003 |
|
|
@fnindex SNGL
|
10004 |
|
|
@cindex conversion, to real
|
10005 |
|
|
|
10006 |
|
|
@table @asis
|
10007 |
|
|
@item @emph{Description}:
|
10008 |
|
|
@code{SNGL(A)} converts the double precision real @var{A}
|
10009 |
|
|
to a default real value. This is an archaic form of @code{REAL}
|
10010 |
|
|
that is specific to one type for @var{A}.
|
10011 |
|
|
|
10012 |
|
|
@item @emph{Standard}:
|
10013 |
|
|
Fortran 77 and later
|
10014 |
|
|
|
10015 |
|
|
@item @emph{Class}:
|
10016 |
|
|
Elemental function
|
10017 |
|
|
|
10018 |
|
|
@item @emph{Syntax}:
|
10019 |
|
|
@code{RESULT = SNGL(A)}
|
10020 |
|
|
|
10021 |
|
|
@item @emph{Arguments}:
|
10022 |
|
|
@multitable @columnfractions .15 .70
|
10023 |
|
|
@item @var{A} @tab The type shall be a double precision @code{REAL}.
|
10024 |
|
|
@end multitable
|
10025 |
|
|
|
10026 |
|
|
@item @emph{Return value}:
|
10027 |
|
|
The return value is of type default @code{REAL}.
|
10028 |
|
|
|
10029 |
|
|
@item @emph{See also}:
|
10030 |
|
|
@ref{DBLE}
|
10031 |
|
|
@end table
|
10032 |
|
|
|
10033 |
|
|
|
10034 |
|
|
|
10035 |
|
|
@node SPACING
|
10036 |
|
|
@section @code{SPACING} --- Smallest distance between two numbers of a given type
|
10037 |
|
|
@fnindex SPACING
|
10038 |
|
|
@cindex real number, relative spacing
|
10039 |
|
|
@cindex floating point, relative spacing
|
10040 |
|
|
|
10041 |
|
|
@table @asis
|
10042 |
|
|
@item @emph{Description}:
|
10043 |
|
|
Determines the distance between the argument @var{X} and the nearest
|
10044 |
|
|
adjacent number of the same type.
|
10045 |
|
|
|
10046 |
|
|
@item @emph{Standard}:
|
10047 |
|
|
Fortran 95 and later
|
10048 |
|
|
|
10049 |
|
|
@item @emph{Class}:
|
10050 |
|
|
Elemental function
|
10051 |
|
|
|
10052 |
|
|
@item @emph{Syntax}:
|
10053 |
|
|
@code{RESULT = SPACING(X)}
|
10054 |
|
|
|
10055 |
|
|
@item @emph{Arguments}:
|
10056 |
|
|
@multitable @columnfractions .15 .70
|
10057 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
10058 |
|
|
@end multitable
|
10059 |
|
|
|
10060 |
|
|
@item @emph{Return value}:
|
10061 |
|
|
The result is of the same type as the input argument @var{X}.
|
10062 |
|
|
|
10063 |
|
|
@item @emph{Example}:
|
10064 |
|
|
@smallexample
|
10065 |
|
|
PROGRAM test_spacing
|
10066 |
|
|
INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
|
10067 |
|
|
INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200)
|
10068 |
|
|
|
10069 |
|
|
WRITE(*,*) spacing(1.0_SGL) ! "1.1920929E-07" on i686
|
10070 |
|
|
WRITE(*,*) spacing(1.0_DBL) ! "2.220446049250313E-016" on i686
|
10071 |
|
|
END PROGRAM
|
10072 |
|
|
@end smallexample
|
10073 |
|
|
|
10074 |
|
|
@item @emph{See also}:
|
10075 |
|
|
@ref{RRSPACING}
|
10076 |
|
|
@end table
|
10077 |
|
|
|
10078 |
|
|
|
10079 |
|
|
|
10080 |
|
|
@node SPREAD
|
10081 |
|
|
@section @code{SPREAD} --- Add a dimension to an array
|
10082 |
|
|
@fnindex SPREAD
|
10083 |
|
|
@cindex array, increase dimension
|
10084 |
|
|
@cindex array, duplicate elements
|
10085 |
|
|
@cindex array, duplicate dimensions
|
10086 |
|
|
|
10087 |
|
|
@table @asis
|
10088 |
|
|
@item @emph{Description}:
|
10089 |
|
|
Replicates a @var{SOURCE} array @var{NCOPIES} times along a specified
|
10090 |
|
|
dimension @var{DIM}.
|
10091 |
|
|
|
10092 |
|
|
@item @emph{Standard}:
|
10093 |
|
|
Fortran 95 and later
|
10094 |
|
|
|
10095 |
|
|
@item @emph{Class}:
|
10096 |
|
|
Transformational function
|
10097 |
|
|
|
10098 |
|
|
@item @emph{Syntax}:
|
10099 |
|
|
@code{RESULT = SPREAD(SOURCE, DIM, NCOPIES)}
|
10100 |
|
|
|
10101 |
|
|
@item @emph{Arguments}:
|
10102 |
|
|
@multitable @columnfractions .15 .70
|
10103 |
|
|
@item @var{SOURCE} @tab Shall be a scalar or an array of any type and
|
10104 |
|
|
a rank less than seven.
|
10105 |
|
|
@item @var{DIM} @tab Shall be a scalar of type @code{INTEGER} with a
|
10106 |
|
|
value in the range from 1 to n+1, where n equals the rank of @var{SOURCE}.
|
10107 |
|
|
@item @var{NCOPIES} @tab Shall be a scalar of type @code{INTEGER}.
|
10108 |
|
|
@end multitable
|
10109 |
|
|
|
10110 |
|
|
@item @emph{Return value}:
|
10111 |
|
|
The result is an array of the same type as @var{SOURCE} and has rank n+1
|
10112 |
|
|
where n equals the rank of @var{SOURCE}.
|
10113 |
|
|
|
10114 |
|
|
@item @emph{Example}:
|
10115 |
|
|
@smallexample
|
10116 |
|
|
PROGRAM test_spread
|
10117 |
|
|
INTEGER :: a = 1, b(2) = (/ 1, 2 /)
|
10118 |
|
|
WRITE(*,*) SPREAD(A, 1, 2) ! "1 1"
|
10119 |
|
|
WRITE(*,*) SPREAD(B, 1, 2) ! "1 1 2 2"
|
10120 |
|
|
END PROGRAM
|
10121 |
|
|
@end smallexample
|
10122 |
|
|
|
10123 |
|
|
@item @emph{See also}:
|
10124 |
|
|
@ref{UNPACK}
|
10125 |
|
|
@end table
|
10126 |
|
|
|
10127 |
|
|
|
10128 |
|
|
|
10129 |
|
|
@node SQRT
|
10130 |
|
|
@section @code{SQRT} --- Square-root function
|
10131 |
|
|
@fnindex SQRT
|
10132 |
|
|
@fnindex DSQRT
|
10133 |
|
|
@fnindex CSQRT
|
10134 |
|
|
@fnindex ZSQRT
|
10135 |
|
|
@fnindex CDSQRT
|
10136 |
|
|
@cindex root
|
10137 |
|
|
@cindex square-root
|
10138 |
|
|
|
10139 |
|
|
@table @asis
|
10140 |
|
|
@item @emph{Description}:
|
10141 |
|
|
@code{SQRT(X)} computes the square root of @var{X}.
|
10142 |
|
|
|
10143 |
|
|
@item @emph{Standard}:
|
10144 |
|
|
Fortran 77 and later
|
10145 |
|
|
|
10146 |
|
|
@item @emph{Class}:
|
10147 |
|
|
Elemental function
|
10148 |
|
|
|
10149 |
|
|
@item @emph{Syntax}:
|
10150 |
|
|
@code{RESULT = SQRT(X)}
|
10151 |
|
|
|
10152 |
|
|
@item @emph{Arguments}:
|
10153 |
|
|
@multitable @columnfractions .15 .70
|
10154 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or
|
10155 |
|
|
@code{COMPLEX}.
|
10156 |
|
|
@end multitable
|
10157 |
|
|
|
10158 |
|
|
@item @emph{Return value}:
|
10159 |
|
|
The return value is of type @code{REAL} or @code{COMPLEX}.
|
10160 |
|
|
The kind type parameter is the same as @var{X}.
|
10161 |
|
|
|
10162 |
|
|
@item @emph{Example}:
|
10163 |
|
|
@smallexample
|
10164 |
|
|
program test_sqrt
|
10165 |
|
|
real(8) :: x = 2.0_8
|
10166 |
|
|
complex :: z = (1.0, 2.0)
|
10167 |
|
|
x = sqrt(x)
|
10168 |
|
|
z = sqrt(z)
|
10169 |
|
|
end program test_sqrt
|
10170 |
|
|
@end smallexample
|
10171 |
|
|
|
10172 |
|
|
@item @emph{Specific names}:
|
10173 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
10174 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
10175 |
|
|
@item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 95 and later
|
10176 |
|
|
@item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab Fortran 95 and later
|
10177 |
|
|
@item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
|
10178 |
|
|
@item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
|
10179 |
|
|
@end multitable
|
10180 |
|
|
@end table
|
10181 |
|
|
|
10182 |
|
|
|
10183 |
|
|
|
10184 |
|
|
@node SRAND
|
10185 |
|
|
@section @code{SRAND} --- Reinitialize the random number generator
|
10186 |
|
|
@fnindex SRAND
|
10187 |
|
|
@cindex random number generation, seeding
|
10188 |
|
|
@cindex seeding a random number generator
|
10189 |
|
|
|
10190 |
|
|
@table @asis
|
10191 |
|
|
@item @emph{Description}:
|
10192 |
|
|
@code{SRAND} reinitializes the pseudo-random number generator
|
10193 |
|
|
called by @code{RAND} and @code{IRAND}. The new seed used by the
|
10194 |
|
|
generator is specified by the required argument @var{SEED}.
|
10195 |
|
|
|
10196 |
|
|
@item @emph{Standard}:
|
10197 |
|
|
GNU extension
|
10198 |
|
|
|
10199 |
|
|
@item @emph{Class}:
|
10200 |
|
|
Subroutine
|
10201 |
|
|
|
10202 |
|
|
@item @emph{Syntax}:
|
10203 |
|
|
@code{CALL SRAND(SEED)}
|
10204 |
|
|
|
10205 |
|
|
@item @emph{Arguments}:
|
10206 |
|
|
@multitable @columnfractions .15 .70
|
10207 |
|
|
@item @var{SEED} @tab Shall be a scalar @code{INTEGER(kind=4)}.
|
10208 |
|
|
@end multitable
|
10209 |
|
|
|
10210 |
|
|
@item @emph{Return value}:
|
10211 |
|
|
Does not return anything.
|
10212 |
|
|
|
10213 |
|
|
@item @emph{Example}:
|
10214 |
|
|
See @code{RAND} and @code{IRAND} for examples.
|
10215 |
|
|
|
10216 |
|
|
@item @emph{Notes}:
|
10217 |
|
|
The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
|
10218 |
|
|
initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
|
10219 |
|
|
to generate pseudo-random numbers. Please note that in
|
10220 |
|
|
GNU Fortran, these two sets of intrinsics (@code{RAND},
|
10221 |
|
|
@code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
|
10222 |
|
|
@code{RANDOM_SEED} on the other hand) access two independent
|
10223 |
|
|
pseudo-random number generators.
|
10224 |
|
|
|
10225 |
|
|
@item @emph{See also}:
|
10226 |
|
|
@ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
|
10227 |
|
|
|
10228 |
|
|
@end table
|
10229 |
|
|
|
10230 |
|
|
|
10231 |
|
|
|
10232 |
|
|
@node STAT
|
10233 |
|
|
@section @code{STAT} --- Get file status
|
10234 |
|
|
@fnindex STAT
|
10235 |
|
|
@cindex file system, file status
|
10236 |
|
|
|
10237 |
|
|
@table @asis
|
10238 |
|
|
@item @emph{Description}:
|
10239 |
|
|
This function returns information about a file. No permissions are required on
|
10240 |
|
|
the file itself, but execute (search) permission is required on all of the
|
10241 |
|
|
directories in path that lead to the file.
|
10242 |
|
|
|
10243 |
|
|
The elements that are obtained and stored in the array @code{VALUES}:
|
10244 |
|
|
@multitable @columnfractions .15 .70
|
10245 |
|
|
@item @code{VALUES(1)} @tab Device ID
|
10246 |
|
|
@item @code{VALUES(2)} @tab Inode number
|
10247 |
|
|
@item @code{VALUES(3)} @tab File mode
|
10248 |
|
|
@item @code{VALUES(4)} @tab Number of links
|
10249 |
|
|
@item @code{VALUES(5)} @tab Owner's uid
|
10250 |
|
|
@item @code{VALUES(6)} @tab Owner's gid
|
10251 |
|
|
@item @code{VALUES(7)} @tab ID of device containing directory entry for file (0 if not available)
|
10252 |
|
|
@item @code{VALUES(8)} @tab File size (bytes)
|
10253 |
|
|
@item @code{VALUES(9)} @tab Last access time
|
10254 |
|
|
@item @code{VALUES(10)} @tab Last modification time
|
10255 |
|
|
@item @code{VALUES(11)} @tab Last file status change time
|
10256 |
|
|
@item @code{VALUES(12)} @tab Preferred I/O block size (-1 if not available)
|
10257 |
|
|
@item @code{VALUES(13)} @tab Number of blocks allocated (-1 if not available)
|
10258 |
|
|
@end multitable
|
10259 |
|
|
|
10260 |
|
|
Not all these elements are relevant on all systems.
|
10261 |
|
|
If an element is not relevant, it is returned as 0.
|
10262 |
|
|
|
10263 |
|
|
This intrinsic is provided in both subroutine and function forms; however,
|
10264 |
|
|
only one form can be used in any given program unit.
|
10265 |
|
|
|
10266 |
|
|
@item @emph{Standard}:
|
10267 |
|
|
GNU extension
|
10268 |
|
|
|
10269 |
|
|
@item @emph{Class}:
|
10270 |
|
|
Subroutine, function
|
10271 |
|
|
|
10272 |
|
|
@item @emph{Syntax}:
|
10273 |
|
|
@code{CALL STAT(NAME, VALUES [, STATUS])}
|
10274 |
|
|
|
10275 |
|
|
@item @emph{Arguments}:
|
10276 |
|
|
@multitable @columnfractions .15 .70
|
10277 |
|
|
@item @var{NAME} @tab The type shall be @code{CHARACTER}, of the
|
10278 |
|
|
default kind and a valid path within the file system.
|
10279 |
|
|
@item @var{VALUES} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
|
10280 |
|
|
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
|
10281 |
|
|
on success and a system specific error code otherwise.
|
10282 |
|
|
@end multitable
|
10283 |
|
|
|
10284 |
|
|
@item @emph{Example}:
|
10285 |
|
|
@smallexample
|
10286 |
|
|
PROGRAM test_stat
|
10287 |
|
|
INTEGER, DIMENSION(13) :: buff
|
10288 |
|
|
INTEGER :: status
|
10289 |
|
|
|
10290 |
|
|
CALL STAT("/etc/passwd", buff, status)
|
10291 |
|
|
|
10292 |
|
|
IF (status == 0) THEN
|
10293 |
|
|
WRITE (*, FMT="('Device ID:', T30, I19)") buff(1)
|
10294 |
|
|
WRITE (*, FMT="('Inode number:', T30, I19)") buff(2)
|
10295 |
|
|
WRITE (*, FMT="('File mode (octal):', T30, O19)") buff(3)
|
10296 |
|
|
WRITE (*, FMT="('Number of links:', T30, I19)") buff(4)
|
10297 |
|
|
WRITE (*, FMT="('Owner''s uid:', T30, I19)") buff(5)
|
10298 |
|
|
WRITE (*, FMT="('Owner''s gid:', T30, I19)") buff(6)
|
10299 |
|
|
WRITE (*, FMT="('Device where located:', T30, I19)") buff(7)
|
10300 |
|
|
WRITE (*, FMT="('File size:', T30, I19)") buff(8)
|
10301 |
|
|
WRITE (*, FMT="('Last access time:', T30, A19)") CTIME(buff(9))
|
10302 |
|
|
WRITE (*, FMT="('Last modification time', T30, A19)") CTIME(buff(10))
|
10303 |
|
|
WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
|
10304 |
|
|
WRITE (*, FMT="('Preferred block size:', T30, I19)") buff(12)
|
10305 |
|
|
WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
|
10306 |
|
|
END IF
|
10307 |
|
|
END PROGRAM
|
10308 |
|
|
@end smallexample
|
10309 |
|
|
|
10310 |
|
|
@item @emph{See also}:
|
10311 |
|
|
To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
|
10312 |
|
|
@end table
|
10313 |
|
|
|
10314 |
|
|
|
10315 |
|
|
|
10316 |
|
|
@node SUM
|
10317 |
|
|
@section @code{SUM} --- Sum of array elements
|
10318 |
|
|
@fnindex SUM
|
10319 |
|
|
@cindex array, sum
|
10320 |
|
|
@cindex array, add elements
|
10321 |
|
|
@cindex array, conditionally add elements
|
10322 |
|
|
@cindex sum array elements
|
10323 |
|
|
|
10324 |
|
|
@table @asis
|
10325 |
|
|
@item @emph{Description}:
|
10326 |
|
|
Adds the elements of @var{ARRAY} along dimension @var{DIM} if
|
10327 |
|
|
the corresponding element in @var{MASK} is @code{TRUE}.
|
10328 |
|
|
|
10329 |
|
|
@item @emph{Standard}:
|
10330 |
|
|
Fortran 95 and later
|
10331 |
|
|
|
10332 |
|
|
@item @emph{Class}:
|
10333 |
|
|
Transformational function
|
10334 |
|
|
|
10335 |
|
|
@item @emph{Syntax}:
|
10336 |
|
|
@multitable @columnfractions .80
|
10337 |
|
|
@item @code{RESULT = SUM(ARRAY[, MASK])}
|
10338 |
|
|
@item @code{RESULT = SUM(ARRAY, DIM[, MASK])}
|
10339 |
|
|
@end multitable
|
10340 |
|
|
|
10341 |
|
|
@item @emph{Arguments}:
|
10342 |
|
|
@multitable @columnfractions .15 .70
|
10343 |
|
|
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER},
|
10344 |
|
|
@code{REAL} or @code{COMPLEX}.
|
10345 |
|
|
@item @var{DIM} @tab (Optional) shall be a scalar of type
|
10346 |
|
|
@code{INTEGER} with a value in the range from 1 to n, where n
|
10347 |
|
|
equals the rank of @var{ARRAY}.
|
10348 |
|
|
@item @var{MASK} @tab (Optional) shall be of type @code{LOGICAL}
|
10349 |
|
|
and either be a scalar or an array of the same shape as @var{ARRAY}.
|
10350 |
|
|
@end multitable
|
10351 |
|
|
|
10352 |
|
|
@item @emph{Return value}:
|
10353 |
|
|
The result is of the same type as @var{ARRAY}.
|
10354 |
|
|
|
10355 |
|
|
If @var{DIM} is absent, a scalar with the sum of all elements in @var{ARRAY}
|
10356 |
|
|
is returned. Otherwise, an array of rank n-1, where n equals the rank of
|
10357 |
|
|
@var{ARRAY},and a shape similar to that of @var{ARRAY} with dimension @var{DIM}
|
10358 |
|
|
dropped is returned.
|
10359 |
|
|
|
10360 |
|
|
@item @emph{Example}:
|
10361 |
|
|
@smallexample
|
10362 |
|
|
PROGRAM test_sum
|
10363 |
|
|
INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /)
|
10364 |
|
|
print *, SUM(x) ! all elements, sum = 15
|
10365 |
|
|
print *, SUM(x, MASK=MOD(x, 2)==1) ! odd elements, sum = 9
|
10366 |
|
|
END PROGRAM
|
10367 |
|
|
@end smallexample
|
10368 |
|
|
|
10369 |
|
|
@item @emph{See also}:
|
10370 |
|
|
@ref{PRODUCT}
|
10371 |
|
|
@end table
|
10372 |
|
|
|
10373 |
|
|
|
10374 |
|
|
|
10375 |
|
|
@node SYMLNK
|
10376 |
|
|
@section @code{SYMLNK} --- Create a symbolic link
|
10377 |
|
|
@fnindex SYMLNK
|
10378 |
|
|
@cindex file system, create link
|
10379 |
|
|
@cindex file system, soft link
|
10380 |
|
|
|
10381 |
|
|
@table @asis
|
10382 |
|
|
@item @emph{Description}:
|
10383 |
|
|
Makes a symbolic link from file @var{PATH1} to @var{PATH2}. A null
|
10384 |
|
|
character (@code{CHAR(0)}) can be used to mark the end of the names in
|
10385 |
|
|
@var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
|
10386 |
|
|
names are ignored. If the @var{STATUS} argument is supplied, it
|
10387 |
|
|
contains 0 on success or a nonzero error code upon return; see
|
10388 |
|
|
@code{symlink(2)}. If the system does not supply @code{symlink(2)},
|
10389 |
|
|
@code{ENOSYS} is returned.
|
10390 |
|
|
|
10391 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
10392 |
|
|
however, only one form can be used in any given program unit.
|
10393 |
|
|
|
10394 |
|
|
@item @emph{Standard}:
|
10395 |
|
|
GNU extension
|
10396 |
|
|
|
10397 |
|
|
@item @emph{Class}:
|
10398 |
|
|
Subroutine, function
|
10399 |
|
|
|
10400 |
|
|
@item @emph{Syntax}:
|
10401 |
|
|
@multitable @columnfractions .80
|
10402 |
|
|
@item @code{CALL SYMLNK(PATH1, PATH2 [, STATUS])}
|
10403 |
|
|
@item @code{STATUS = SYMLNK(PATH1, PATH2)}
|
10404 |
|
|
@end multitable
|
10405 |
|
|
|
10406 |
|
|
@item @emph{Arguments}:
|
10407 |
|
|
@multitable @columnfractions .15 .70
|
10408 |
|
|
@item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
|
10409 |
|
|
@item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
|
10410 |
|
|
@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
|
10411 |
|
|
@end multitable
|
10412 |
|
|
|
10413 |
|
|
@item @emph{See also}:
|
10414 |
|
|
@ref{LINK}, @ref{UNLINK}
|
10415 |
|
|
|
10416 |
|
|
@end table
|
10417 |
|
|
|
10418 |
|
|
|
10419 |
|
|
|
10420 |
|
|
@node SYSTEM
|
10421 |
|
|
@section @code{SYSTEM} --- Execute a shell command
|
10422 |
|
|
@fnindex SYSTEM
|
10423 |
|
|
@cindex system, system call
|
10424 |
|
|
|
10425 |
|
|
@table @asis
|
10426 |
|
|
@item @emph{Description}:
|
10427 |
|
|
Passes the command @var{COMMAND} to a shell (see @code{system(3)}). If
|
10428 |
|
|
argument @var{STATUS} is present, it contains the value returned by
|
10429 |
|
|
@code{system(3)}, which is presumably 0 if the shell command succeeded.
|
10430 |
|
|
Note that which shell is used to invoke the command is system-dependent
|
10431 |
|
|
and environment-dependent.
|
10432 |
|
|
|
10433 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
10434 |
|
|
however, only one form can be used in any given program unit.
|
10435 |
|
|
|
10436 |
|
|
@item @emph{Standard}:
|
10437 |
|
|
GNU extension
|
10438 |
|
|
|
10439 |
|
|
@item @emph{Class}:
|
10440 |
|
|
Subroutine, function
|
10441 |
|
|
|
10442 |
|
|
@item @emph{Syntax}:
|
10443 |
|
|
@multitable @columnfractions .80
|
10444 |
|
|
@item @code{CALL SYSTEM(COMMAND [, STATUS])}
|
10445 |
|
|
@item @code{STATUS = SYSTEM(COMMAND)}
|
10446 |
|
|
@end multitable
|
10447 |
|
|
|
10448 |
|
|
@item @emph{Arguments}:
|
10449 |
|
|
@multitable @columnfractions .15 .70
|
10450 |
|
|
@item @var{COMMAND} @tab Shall be of default @code{CHARACTER} type.
|
10451 |
|
|
@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
|
10452 |
|
|
@end multitable
|
10453 |
|
|
|
10454 |
|
|
@item @emph{See also}:
|
10455 |
|
|
@end table
|
10456 |
|
|
|
10457 |
|
|
|
10458 |
|
|
|
10459 |
|
|
@node SYSTEM_CLOCK
|
10460 |
|
|
@section @code{SYSTEM_CLOCK} --- Time function
|
10461 |
|
|
@fnindex SYSTEM_CLOCK
|
10462 |
|
|
@cindex time, clock ticks
|
10463 |
|
|
@cindex clock ticks
|
10464 |
|
|
|
10465 |
|
|
@table @asis
|
10466 |
|
|
@item @emph{Description}:
|
10467 |
|
|
Determines the @var{COUNT} of milliseconds of wall clock time since
|
10468 |
|
|
the Epoch (00:00:00 UTC, January 1, 1970) modulo @var{COUNT_MAX},
|
10469 |
|
|
@var{COUNT_RATE} determines the number of clock ticks per second.
|
10470 |
|
|
@var{COUNT_RATE} and @var{COUNT_MAX} are constant and specific to
|
10471 |
|
|
@command{gfortran}.
|
10472 |
|
|
|
10473 |
|
|
If there is no clock, @var{COUNT} is set to @code{-HUGE(COUNT)}, and
|
10474 |
|
|
@var{COUNT_RATE} and @var{COUNT_MAX} are set to zero
|
10475 |
|
|
|
10476 |
|
|
@item @emph{Standard}:
|
10477 |
|
|
Fortran 95 and later
|
10478 |
|
|
|
10479 |
|
|
@item @emph{Class}:
|
10480 |
|
|
Subroutine
|
10481 |
|
|
|
10482 |
|
|
@item @emph{Syntax}:
|
10483 |
|
|
@code{CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])}
|
10484 |
|
|
|
10485 |
|
|
@item @emph{Arguments}:
|
10486 |
|
|
@item @emph{Arguments}:
|
10487 |
|
|
@multitable @columnfractions .15 .70
|
10488 |
|
|
@item @var{COUNT} @tab (Optional) shall be a scalar of type default
|
10489 |
|
|
@code{INTEGER} with @code{INTENT(OUT)}.
|
10490 |
|
|
@item @var{COUNT_RATE} @tab (Optional) shall be a scalar of type default
|
10491 |
|
|
@code{INTEGER} with @code{INTENT(OUT)}.
|
10492 |
|
|
@item @var{COUNT_MAX} @tab (Optional) shall be a scalar of type default
|
10493 |
|
|
@code{INTEGER} with @code{INTENT(OUT)}.
|
10494 |
|
|
@end multitable
|
10495 |
|
|
|
10496 |
|
|
@item @emph{Example}:
|
10497 |
|
|
@smallexample
|
10498 |
|
|
PROGRAM test_system_clock
|
10499 |
|
|
INTEGER :: count, count_rate, count_max
|
10500 |
|
|
CALL SYSTEM_CLOCK(count, count_rate, count_max)
|
10501 |
|
|
WRITE(*,*) count, count_rate, count_max
|
10502 |
|
|
END PROGRAM
|
10503 |
|
|
@end smallexample
|
10504 |
|
|
|
10505 |
|
|
@item @emph{See also}:
|
10506 |
|
|
@ref{DATE_AND_TIME}, @ref{CPU_TIME}
|
10507 |
|
|
@end table
|
10508 |
|
|
|
10509 |
|
|
|
10510 |
|
|
|
10511 |
|
|
@node TAN
|
10512 |
|
|
@section @code{TAN} --- Tangent function
|
10513 |
|
|
@fnindex TAN
|
10514 |
|
|
@fnindex DTAN
|
10515 |
|
|
@cindex trigonometric function, tangent
|
10516 |
|
|
@cindex tangent
|
10517 |
|
|
|
10518 |
|
|
@table @asis
|
10519 |
|
|
@item @emph{Description}:
|
10520 |
|
|
@code{TAN(X)} computes the tangent of @var{X}.
|
10521 |
|
|
|
10522 |
|
|
@item @emph{Standard}:
|
10523 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
10524 |
|
|
|
10525 |
|
|
@item @emph{Class}:
|
10526 |
|
|
Elemental function
|
10527 |
|
|
|
10528 |
|
|
@item @emph{Syntax}:
|
10529 |
|
|
@code{RESULT = TAN(X)}
|
10530 |
|
|
|
10531 |
|
|
@item @emph{Arguments}:
|
10532 |
|
|
@multitable @columnfractions .15 .70
|
10533 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
10534 |
|
|
@end multitable
|
10535 |
|
|
|
10536 |
|
|
@item @emph{Return value}:
|
10537 |
|
|
The return value has same type and kind as @var{X}.
|
10538 |
|
|
|
10539 |
|
|
@item @emph{Example}:
|
10540 |
|
|
@smallexample
|
10541 |
|
|
program test_tan
|
10542 |
|
|
real(8) :: x = 0.165_8
|
10543 |
|
|
x = tan(x)
|
10544 |
|
|
end program test_tan
|
10545 |
|
|
@end smallexample
|
10546 |
|
|
|
10547 |
|
|
@item @emph{Specific names}:
|
10548 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
10549 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
10550 |
|
|
@item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 95 and later
|
10551 |
|
|
@end multitable
|
10552 |
|
|
|
10553 |
|
|
@item @emph{See also}:
|
10554 |
|
|
@ref{ATAN}
|
10555 |
|
|
@end table
|
10556 |
|
|
|
10557 |
|
|
|
10558 |
|
|
|
10559 |
|
|
@node TANH
|
10560 |
|
|
@section @code{TANH} --- Hyperbolic tangent function
|
10561 |
|
|
@fnindex TANH
|
10562 |
|
|
@fnindex DTANH
|
10563 |
|
|
@cindex hyperbolic tangent
|
10564 |
|
|
@cindex hyperbolic function, tangent
|
10565 |
|
|
@cindex tangent, hyperbolic
|
10566 |
|
|
|
10567 |
|
|
@table @asis
|
10568 |
|
|
@item @emph{Description}:
|
10569 |
|
|
@code{TANH(X)} computes the hyperbolic tangent of @var{X}.
|
10570 |
|
|
|
10571 |
|
|
@item @emph{Standard}:
|
10572 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
10573 |
|
|
|
10574 |
|
|
@item @emph{Class}:
|
10575 |
|
|
Elemental function
|
10576 |
|
|
|
10577 |
|
|
@item @emph{Syntax}:
|
10578 |
|
|
@code{X = TANH(X)}
|
10579 |
|
|
|
10580 |
|
|
@item @emph{Arguments}:
|
10581 |
|
|
@multitable @columnfractions .15 .70
|
10582 |
|
|
@item @var{X} @tab The type shall be @code{REAL} or @code{COMPLEX}.
|
10583 |
|
|
@end multitable
|
10584 |
|
|
|
10585 |
|
|
@item @emph{Return value}:
|
10586 |
|
|
The return value has same type and kind as @var{X}. If @var{X} is
|
10587 |
|
|
complex, the imaginary part of the result is in radians. If @var{X}
|
10588 |
|
|
is @code{REAL}, the return value lies in the range
|
10589 |
|
|
@math{ - 1 \leq tanh(x) \leq 1 }.
|
10590 |
|
|
|
10591 |
|
|
@item @emph{Example}:
|
10592 |
|
|
@smallexample
|
10593 |
|
|
program test_tanh
|
10594 |
|
|
real(8) :: x = 2.1_8
|
10595 |
|
|
x = tanh(x)
|
10596 |
|
|
end program test_tanh
|
10597 |
|
|
@end smallexample
|
10598 |
|
|
|
10599 |
|
|
@item @emph{Specific names}:
|
10600 |
|
|
@multitable @columnfractions .20 .20 .20 .25
|
10601 |
|
|
@item Name @tab Argument @tab Return type @tab Standard
|
10602 |
|
|
@item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab Fortran 95 and later
|
10603 |
|
|
@end multitable
|
10604 |
|
|
|
10605 |
|
|
@item @emph{See also}:
|
10606 |
|
|
@ref{ATANH}
|
10607 |
|
|
@end table
|
10608 |
|
|
|
10609 |
|
|
|
10610 |
|
|
|
10611 |
|
|
@node TIME
|
10612 |
|
|
@section @code{TIME} --- Time function
|
10613 |
|
|
@fnindex TIME
|
10614 |
|
|
@cindex time, current
|
10615 |
|
|
@cindex current time
|
10616 |
|
|
|
10617 |
|
|
@table @asis
|
10618 |
|
|
@item @emph{Description}:
|
10619 |
|
|
Returns the current time encoded as an integer (in the manner of the
|
10620 |
|
|
UNIX function @code{time(3)}). This value is suitable for passing to
|
10621 |
|
|
@code{CTIME()}, @code{GMTIME()}, and @code{LTIME()}.
|
10622 |
|
|
|
10623 |
|
|
This intrinsic is not fully portable, such as to systems with 32-bit
|
10624 |
|
|
@code{INTEGER} types but supporting times wider than 32 bits. Therefore,
|
10625 |
|
|
the values returned by this intrinsic might be, or become, negative, or
|
10626 |
|
|
numerically less than previous values, during a single run of the
|
10627 |
|
|
compiled program.
|
10628 |
|
|
|
10629 |
|
|
See @ref{TIME8}, for information on a similar intrinsic that might be
|
10630 |
|
|
portable to more GNU Fortran implementations, though to fewer Fortran
|
10631 |
|
|
compilers.
|
10632 |
|
|
|
10633 |
|
|
@item @emph{Standard}:
|
10634 |
|
|
GNU extension
|
10635 |
|
|
|
10636 |
|
|
@item @emph{Class}:
|
10637 |
|
|
Function
|
10638 |
|
|
|
10639 |
|
|
@item @emph{Syntax}:
|
10640 |
|
|
@code{RESULT = TIME()}
|
10641 |
|
|
|
10642 |
|
|
@item @emph{Return value}:
|
10643 |
|
|
The return value is a scalar of type @code{INTEGER(4)}.
|
10644 |
|
|
|
10645 |
|
|
@item @emph{See also}:
|
10646 |
|
|
@ref{CTIME}, @ref{GMTIME}, @ref{LTIME}, @ref{MCLOCK}, @ref{TIME8}
|
10647 |
|
|
|
10648 |
|
|
@end table
|
10649 |
|
|
|
10650 |
|
|
|
10651 |
|
|
|
10652 |
|
|
@node TIME8
|
10653 |
|
|
@section @code{TIME8} --- Time function (64-bit)
|
10654 |
|
|
@fnindex TIME8
|
10655 |
|
|
@cindex time, current
|
10656 |
|
|
@cindex current time
|
10657 |
|
|
|
10658 |
|
|
@table @asis
|
10659 |
|
|
@item @emph{Description}:
|
10660 |
|
|
Returns the current time encoded as an integer (in the manner of the
|
10661 |
|
|
UNIX function @code{time(3)}). This value is suitable for passing to
|
10662 |
|
|
@code{CTIME()}, @code{GMTIME()}, and @code{LTIME()}.
|
10663 |
|
|
|
10664 |
|
|
@emph{Warning:} this intrinsic does not increase the range of the timing
|
10665 |
|
|
values over that returned by @code{time(3)}. On a system with a 32-bit
|
10666 |
|
|
@code{time(3)}, @code{TIME8()} will return a 32-bit value, even though
|
10667 |
|
|
it is converted to a 64-bit @code{INTEGER(8)} value. That means
|
10668 |
|
|
overflows of the 32-bit value can still occur. Therefore, the values
|
10669 |
|
|
returned by this intrinsic might be or become negative or numerically
|
10670 |
|
|
less than previous values during a single run of the compiled program.
|
10671 |
|
|
|
10672 |
|
|
@item @emph{Standard}:
|
10673 |
|
|
GNU extension
|
10674 |
|
|
|
10675 |
|
|
@item @emph{Class}:
|
10676 |
|
|
Function
|
10677 |
|
|
|
10678 |
|
|
@item @emph{Syntax}:
|
10679 |
|
|
@code{RESULT = TIME8()}
|
10680 |
|
|
|
10681 |
|
|
@item @emph{Return value}:
|
10682 |
|
|
The return value is a scalar of type @code{INTEGER(8)}.
|
10683 |
|
|
|
10684 |
|
|
@item @emph{See also}:
|
10685 |
|
|
@ref{CTIME}, @ref{GMTIME}, @ref{LTIME}, @ref{MCLOCK8}, @ref{TIME}
|
10686 |
|
|
|
10687 |
|
|
@end table
|
10688 |
|
|
|
10689 |
|
|
|
10690 |
|
|
|
10691 |
|
|
@node TINY
|
10692 |
|
|
@section @code{TINY} --- Smallest positive number of a real kind
|
10693 |
|
|
@fnindex TINY
|
10694 |
|
|
@cindex limits, smallest number
|
10695 |
|
|
@cindex model representation, smallest number
|
10696 |
|
|
|
10697 |
|
|
@table @asis
|
10698 |
|
|
@item @emph{Description}:
|
10699 |
|
|
@code{TINY(X)} returns the smallest positive (non zero) number
|
10700 |
|
|
in the model of the type of @code{X}.
|
10701 |
|
|
|
10702 |
|
|
@item @emph{Standard}:
|
10703 |
|
|
Fortran 95 and later
|
10704 |
|
|
|
10705 |
|
|
@item @emph{Class}:
|
10706 |
|
|
Inquiry function
|
10707 |
|
|
|
10708 |
|
|
@item @emph{Syntax}:
|
10709 |
|
|
@code{RESULT = TINY(X)}
|
10710 |
|
|
|
10711 |
|
|
@item @emph{Arguments}:
|
10712 |
|
|
@multitable @columnfractions .15 .70
|
10713 |
|
|
@item @var{X} @tab Shall be of type @code{REAL}.
|
10714 |
|
|
@end multitable
|
10715 |
|
|
|
10716 |
|
|
@item @emph{Return value}:
|
10717 |
|
|
The return value is of the same type and kind as @var{X}
|
10718 |
|
|
|
10719 |
|
|
@item @emph{Example}:
|
10720 |
|
|
See @code{HUGE} for an example.
|
10721 |
|
|
@end table
|
10722 |
|
|
|
10723 |
|
|
|
10724 |
|
|
|
10725 |
|
|
@node TRAILZ
|
10726 |
|
|
@section @code{TRAILZ} --- Number of trailing zero bits of an integer
|
10727 |
|
|
@fnindex TRAILZ
|
10728 |
|
|
@cindex zero bits
|
10729 |
|
|
|
10730 |
|
|
@table @asis
|
10731 |
|
|
@item @emph{Description}:
|
10732 |
|
|
@code{TRAILZ} returns the number of trailing zero bits of an integer.
|
10733 |
|
|
|
10734 |
|
|
@item @emph{Standard}:
|
10735 |
|
|
Fortran 2008 and later
|
10736 |
|
|
|
10737 |
|
|
@item @emph{Class}:
|
10738 |
|
|
Elemental function
|
10739 |
|
|
|
10740 |
|
|
@item @emph{Syntax}:
|
10741 |
|
|
@code{RESULT = TRAILZ(I)}
|
10742 |
|
|
|
10743 |
|
|
@item @emph{Arguments}:
|
10744 |
|
|
@multitable @columnfractions .15 .70
|
10745 |
|
|
@item @var{I} @tab Shall be of type @code{INTEGER}.
|
10746 |
|
|
@end multitable
|
10747 |
|
|
|
10748 |
|
|
@item @emph{Return value}:
|
10749 |
|
|
The type of the return value is the default @code{INTEGER}.
|
10750 |
|
|
If all the bits of @code{I} are zero, the result value is @code{BIT_SIZE(I)}.
|
10751 |
|
|
|
10752 |
|
|
@item @emph{Example}:
|
10753 |
|
|
@smallexample
|
10754 |
|
|
PROGRAM test_trailz
|
10755 |
|
|
WRITE (*,*) TRAILZ(8) ! prints 3
|
10756 |
|
|
END PROGRAM
|
10757 |
|
|
@end smallexample
|
10758 |
|
|
|
10759 |
|
|
@item @emph{See also}:
|
10760 |
|
|
@ref{BIT_SIZE}, @ref{LEADZ}
|
10761 |
|
|
@end table
|
10762 |
|
|
|
10763 |
|
|
|
10764 |
|
|
|
10765 |
|
|
@node TRANSFER
|
10766 |
|
|
@section @code{TRANSFER} --- Transfer bit patterns
|
10767 |
|
|
@fnindex TRANSFER
|
10768 |
|
|
@cindex bits, move
|
10769 |
|
|
@cindex type cast
|
10770 |
|
|
|
10771 |
|
|
@table @asis
|
10772 |
|
|
@item @emph{Description}:
|
10773 |
|
|
Interprets the bitwise representation of @var{SOURCE} in memory as if it
|
10774 |
|
|
is the representation of a variable or array of the same type and type
|
10775 |
|
|
parameters as @var{MOLD}.
|
10776 |
|
|
|
10777 |
|
|
This is approximately equivalent to the C concept of @emph{casting} one
|
10778 |
|
|
type to another.
|
10779 |
|
|
|
10780 |
|
|
@item @emph{Standard}:
|
10781 |
|
|
Fortran 95 and later
|
10782 |
|
|
|
10783 |
|
|
@item @emph{Class}:
|
10784 |
|
|
Transformational function
|
10785 |
|
|
|
10786 |
|
|
@item @emph{Syntax}:
|
10787 |
|
|
@code{RESULT = TRANSFER(SOURCE, MOLD[, SIZE])}
|
10788 |
|
|
|
10789 |
|
|
@item @emph{Arguments}:
|
10790 |
|
|
@multitable @columnfractions .15 .70
|
10791 |
|
|
@item @var{SOURCE} @tab Shall be a scalar or an array of any type.
|
10792 |
|
|
@item @var{MOLD} @tab Shall be a scalar or an array of any type.
|
10793 |
|
|
@item @var{SIZE} @tab (Optional) shall be a scalar of type
|
10794 |
|
|
@code{INTEGER}.
|
10795 |
|
|
@end multitable
|
10796 |
|
|
|
10797 |
|
|
@item @emph{Return value}:
|
10798 |
|
|
The result has the same type as @var{MOLD}, with the bit level
|
10799 |
|
|
representation of @var{SOURCE}. If @var{SIZE} is present, the result is
|
10800 |
|
|
a one-dimensional array of length @var{SIZE}. If @var{SIZE} is absent
|
10801 |
|
|
but @var{MOLD} is an array (of any size or shape), the result is a one-
|
10802 |
|
|
dimensional array of the minimum length needed to contain the entirety
|
10803 |
|
|
of the bitwise representation of @var{SOURCE}. If @var{SIZE} is absent
|
10804 |
|
|
and @var{MOLD} is a scalar, the result is a scalar.
|
10805 |
|
|
|
10806 |
|
|
If the bitwise representation of the result is longer than that of
|
10807 |
|
|
@var{SOURCE}, then the leading bits of the result correspond to those of
|
10808 |
|
|
@var{SOURCE} and any trailing bits are filled arbitrarily.
|
10809 |
|
|
|
10810 |
|
|
When the resulting bit representation does not correspond to a valid
|
10811 |
|
|
representation of a variable of the same type as @var{MOLD}, the results
|
10812 |
|
|
are undefined, and subsequent operations on the result cannot be
|
10813 |
|
|
guaranteed to produce sensible behavior. For example, it is possible to
|
10814 |
|
|
create @code{LOGICAL} variables for which @code{@var{VAR}} and
|
10815 |
|
|
@code{.NOT.@var{VAR}} both appear to be true.
|
10816 |
|
|
|
10817 |
|
|
@item @emph{Example}:
|
10818 |
|
|
@smallexample
|
10819 |
|
|
PROGRAM test_transfer
|
10820 |
|
|
integer :: x = 2143289344
|
10821 |
|
|
print *, transfer(x, 1.0) ! prints "NaN" on i686
|
10822 |
|
|
END PROGRAM
|
10823 |
|
|
@end smallexample
|
10824 |
|
|
@end table
|
10825 |
|
|
|
10826 |
|
|
|
10827 |
|
|
|
10828 |
|
|
@node TRANSPOSE
|
10829 |
|
|
@section @code{TRANSPOSE} --- Transpose an array of rank two
|
10830 |
|
|
@fnindex TRANSPOSE
|
10831 |
|
|
@cindex array, transpose
|
10832 |
|
|
@cindex matrix, transpose
|
10833 |
|
|
@cindex transpose
|
10834 |
|
|
|
10835 |
|
|
@table @asis
|
10836 |
|
|
@item @emph{Description}:
|
10837 |
|
|
Transpose an array of rank two. Element (i, j) of the result has the value
|
10838 |
|
|
@code{MATRIX(j, i)}, for all i, j.
|
10839 |
|
|
|
10840 |
|
|
@item @emph{Standard}:
|
10841 |
|
|
Fortran 95 and later
|
10842 |
|
|
|
10843 |
|
|
@item @emph{Class}:
|
10844 |
|
|
Transformational function
|
10845 |
|
|
|
10846 |
|
|
@item @emph{Syntax}:
|
10847 |
|
|
@code{RESULT = TRANSPOSE(MATRIX)}
|
10848 |
|
|
|
10849 |
|
|
@item @emph{Arguments}:
|
10850 |
|
|
@multitable @columnfractions .15 .70
|
10851 |
|
|
@item @var{MATRIX} @tab Shall be an array of any type and have a rank of two.
|
10852 |
|
|
@end multitable
|
10853 |
|
|
|
10854 |
|
|
@item @emph{Return value}:
|
10855 |
|
|
The result has the same type as @var{MATRIX}, and has shape
|
10856 |
|
|
@code{(/ m, n /)} if @var{MATRIX} has shape @code{(/ n, m /)}.
|
10857 |
|
|
@end table
|
10858 |
|
|
|
10859 |
|
|
|
10860 |
|
|
|
10861 |
|
|
@node TRIM
|
10862 |
|
|
@section @code{TRIM} --- Remove trailing blank characters of a string
|
10863 |
|
|
@fnindex TRIM
|
10864 |
|
|
@cindex string, remove trailing whitespace
|
10865 |
|
|
|
10866 |
|
|
@table @asis
|
10867 |
|
|
@item @emph{Description}:
|
10868 |
|
|
Removes trailing blank characters of a string.
|
10869 |
|
|
|
10870 |
|
|
@item @emph{Standard}:
|
10871 |
|
|
Fortran 95 and later
|
10872 |
|
|
|
10873 |
|
|
@item @emph{Class}:
|
10874 |
|
|
Transformational function
|
10875 |
|
|
|
10876 |
|
|
@item @emph{Syntax}:
|
10877 |
|
|
@code{RESULT = TRIM(STRING)}
|
10878 |
|
|
|
10879 |
|
|
@item @emph{Arguments}:
|
10880 |
|
|
@multitable @columnfractions .15 .70
|
10881 |
|
|
@item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER}.
|
10882 |
|
|
@end multitable
|
10883 |
|
|
|
10884 |
|
|
@item @emph{Return value}:
|
10885 |
|
|
A scalar of type @code{CHARACTER} which length is that of @var{STRING}
|
10886 |
|
|
less the number of trailing blanks.
|
10887 |
|
|
|
10888 |
|
|
@item @emph{Example}:
|
10889 |
|
|
@smallexample
|
10890 |
|
|
PROGRAM test_trim
|
10891 |
|
|
CHARACTER(len=10), PARAMETER :: s = "GFORTRAN "
|
10892 |
|
|
WRITE(*,*) LEN(s), LEN(TRIM(s)) ! "10 8", with/without trailing blanks
|
10893 |
|
|
END PROGRAM
|
10894 |
|
|
@end smallexample
|
10895 |
|
|
|
10896 |
|
|
@item @emph{See also}:
|
10897 |
|
|
@ref{ADJUSTL}, @ref{ADJUSTR}
|
10898 |
|
|
@end table
|
10899 |
|
|
|
10900 |
|
|
|
10901 |
|
|
|
10902 |
|
|
@node TTYNAM
|
10903 |
|
|
@section @code{TTYNAM} --- Get the name of a terminal device.
|
10904 |
|
|
@fnindex TTYNAM
|
10905 |
|
|
@cindex system, terminal
|
10906 |
|
|
|
10907 |
|
|
@table @asis
|
10908 |
|
|
@item @emph{Description}:
|
10909 |
|
|
Get the name of a terminal device. For more information,
|
10910 |
|
|
see @code{ttyname(3)}.
|
10911 |
|
|
|
10912 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
10913 |
|
|
however, only one form can be used in any given program unit.
|
10914 |
|
|
|
10915 |
|
|
@item @emph{Standard}:
|
10916 |
|
|
GNU extension
|
10917 |
|
|
|
10918 |
|
|
@item @emph{Class}:
|
10919 |
|
|
Subroutine, function
|
10920 |
|
|
|
10921 |
|
|
@item @emph{Syntax}:
|
10922 |
|
|
@multitable @columnfractions .80
|
10923 |
|
|
@item @code{CALL TTYNAM(UNIT, NAME)}
|
10924 |
|
|
@item @code{NAME = TTYNAM(UNIT)}
|
10925 |
|
|
@end multitable
|
10926 |
|
|
|
10927 |
|
|
@item @emph{Arguments}:
|
10928 |
|
|
@multitable @columnfractions .15 .70
|
10929 |
|
|
@item @var{UNIT} @tab Shall be a scalar @code{INTEGER}.
|
10930 |
|
|
@item @var{NAME} @tab Shall be of type @code{CHARACTER}.
|
10931 |
|
|
@end multitable
|
10932 |
|
|
|
10933 |
|
|
@item @emph{Example}:
|
10934 |
|
|
@smallexample
|
10935 |
|
|
PROGRAM test_ttynam
|
10936 |
|
|
INTEGER :: unit
|
10937 |
|
|
DO unit = 1, 10
|
10938 |
|
|
IF (isatty(unit=unit)) write(*,*) ttynam(unit)
|
10939 |
|
|
END DO
|
10940 |
|
|
END PROGRAM
|
10941 |
|
|
@end smallexample
|
10942 |
|
|
|
10943 |
|
|
@item @emph{See also}:
|
10944 |
|
|
@ref{ISATTY}
|
10945 |
|
|
@end table
|
10946 |
|
|
|
10947 |
|
|
|
10948 |
|
|
|
10949 |
|
|
@node UBOUND
|
10950 |
|
|
@section @code{UBOUND} --- Upper dimension bounds of an array
|
10951 |
|
|
@fnindex UBOUND
|
10952 |
|
|
@cindex array, upper bound
|
10953 |
|
|
|
10954 |
|
|
@table @asis
|
10955 |
|
|
@item @emph{Description}:
|
10956 |
|
|
Returns the upper bounds of an array, or a single upper bound
|
10957 |
|
|
along the @var{DIM} dimension.
|
10958 |
|
|
@item @emph{Standard}:
|
10959 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
10960 |
|
|
|
10961 |
|
|
@item @emph{Class}:
|
10962 |
|
|
Inquiry function
|
10963 |
|
|
|
10964 |
|
|
@item @emph{Syntax}:
|
10965 |
|
|
@code{RESULT = UBOUND(ARRAY [, DIM [, KIND]])}
|
10966 |
|
|
|
10967 |
|
|
@item @emph{Arguments}:
|
10968 |
|
|
@multitable @columnfractions .15 .70
|
10969 |
|
|
@item @var{ARRAY} @tab Shall be an array, of any type.
|
10970 |
|
|
@item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER}.
|
10971 |
|
|
@item @var{KIND}@tab (Optional) An @code{INTEGER} initialization
|
10972 |
|
|
expression indicating the kind parameter of the result.
|
10973 |
|
|
@end multitable
|
10974 |
|
|
|
10975 |
|
|
@item @emph{Return value}:
|
10976 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
10977 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
10978 |
|
|
If @var{DIM} is absent, the result is an array of the upper bounds of
|
10979 |
|
|
@var{ARRAY}. If @var{DIM} is present, the result is a scalar
|
10980 |
|
|
corresponding to the upper bound of the array along that dimension. If
|
10981 |
|
|
@var{ARRAY} is an expression rather than a whole array or array
|
10982 |
|
|
structure component, or if it has a zero extent along the relevant
|
10983 |
|
|
dimension, the upper bound is taken to be the number of elements along
|
10984 |
|
|
the relevant dimension.
|
10985 |
|
|
|
10986 |
|
|
@item @emph{See also}:
|
10987 |
|
|
@ref{LBOUND}
|
10988 |
|
|
@end table
|
10989 |
|
|
|
10990 |
|
|
|
10991 |
|
|
|
10992 |
|
|
@node UMASK
|
10993 |
|
|
@section @code{UMASK} --- Set the file creation mask
|
10994 |
|
|
@fnindex UMASK
|
10995 |
|
|
@cindex file system, file creation mask
|
10996 |
|
|
|
10997 |
|
|
@table @asis
|
10998 |
|
|
@item @emph{Description}:
|
10999 |
|
|
Sets the file creation mask to @var{MASK}. If called as a function, it
|
11000 |
|
|
returns the old value. If called as a subroutine and argument @var{OLD}
|
11001 |
|
|
if it is supplied, it is set to the old value. See @code{umask(2)}.
|
11002 |
|
|
|
11003 |
|
|
@item @emph{Standard}:
|
11004 |
|
|
GNU extension
|
11005 |
|
|
|
11006 |
|
|
@item @emph{Class}:
|
11007 |
|
|
Subroutine, function
|
11008 |
|
|
|
11009 |
|
|
@item @emph{Syntax}:
|
11010 |
|
|
@code{CALL UMASK(MASK [, OLD])}
|
11011 |
|
|
@code{OLD = UMASK(MASK)}
|
11012 |
|
|
|
11013 |
|
|
@item @emph{Arguments}:
|
11014 |
|
|
@multitable @columnfractions .15 .70
|
11015 |
|
|
@item @var{MASK} @tab Shall be a scalar of type @code{INTEGER}.
|
11016 |
|
|
@item @var{OLD} @tab (Optional) Shall be a scalar of type
|
11017 |
|
|
@code{INTEGER}.
|
11018 |
|
|
@end multitable
|
11019 |
|
|
|
11020 |
|
|
@end table
|
11021 |
|
|
|
11022 |
|
|
|
11023 |
|
|
|
11024 |
|
|
@node UNLINK
|
11025 |
|
|
@section @code{UNLINK} --- Remove a file from the file system
|
11026 |
|
|
@fnindex UNLINK
|
11027 |
|
|
@cindex file system, remove file
|
11028 |
|
|
|
11029 |
|
|
@table @asis
|
11030 |
|
|
@item @emph{Description}:
|
11031 |
|
|
Unlinks the file @var{PATH}. A null character (@code{CHAR(0)}) can be
|
11032 |
|
|
used to mark the end of the name in @var{PATH}; otherwise, trailing
|
11033 |
|
|
blanks in the file name are ignored. If the @var{STATUS} argument is
|
11034 |
|
|
supplied, it contains 0 on success or a nonzero error code upon return;
|
11035 |
|
|
see @code{unlink(2)}.
|
11036 |
|
|
|
11037 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
11038 |
|
|
however, only one form can be used in any given program unit.
|
11039 |
|
|
|
11040 |
|
|
@item @emph{Standard}:
|
11041 |
|
|
GNU extension
|
11042 |
|
|
|
11043 |
|
|
@item @emph{Class}:
|
11044 |
|
|
Subroutine, function
|
11045 |
|
|
|
11046 |
|
|
@item @emph{Syntax}:
|
11047 |
|
|
@multitable @columnfractions .80
|
11048 |
|
|
@item @code{CALL UNLINK(PATH [, STATUS])}
|
11049 |
|
|
@item @code{STATUS = UNLINK(PATH)}
|
11050 |
|
|
@end multitable
|
11051 |
|
|
|
11052 |
|
|
@item @emph{Arguments}:
|
11053 |
|
|
@multitable @columnfractions .15 .70
|
11054 |
|
|
@item @var{PATH} @tab Shall be of default @code{CHARACTER} type.
|
11055 |
|
|
@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
|
11056 |
|
|
@end multitable
|
11057 |
|
|
|
11058 |
|
|
@item @emph{See also}:
|
11059 |
|
|
@ref{LINK}, @ref{SYMLNK}
|
11060 |
|
|
@end table
|
11061 |
|
|
|
11062 |
|
|
|
11063 |
|
|
|
11064 |
|
|
@node UNPACK
|
11065 |
|
|
@section @code{UNPACK} --- Unpack an array of rank one into an array
|
11066 |
|
|
@fnindex UNPACK
|
11067 |
|
|
@cindex array, unpacking
|
11068 |
|
|
@cindex array, increase dimension
|
11069 |
|
|
@cindex array, scatter elements
|
11070 |
|
|
|
11071 |
|
|
@table @asis
|
11072 |
|
|
@item @emph{Description}:
|
11073 |
|
|
Store the elements of @var{VECTOR} in an array of higher rank.
|
11074 |
|
|
|
11075 |
|
|
@item @emph{Standard}:
|
11076 |
|
|
Fortran 95 and later
|
11077 |
|
|
|
11078 |
|
|
@item @emph{Class}:
|
11079 |
|
|
Transformational function
|
11080 |
|
|
|
11081 |
|
|
@item @emph{Syntax}:
|
11082 |
|
|
@code{RESULT = UNPACK(VECTOR, MASK, FIELD)}
|
11083 |
|
|
|
11084 |
|
|
@item @emph{Arguments}:
|
11085 |
|
|
@multitable @columnfractions .15 .70
|
11086 |
|
|
@item @var{VECTOR} @tab Shall be an array of any type and rank one. It
|
11087 |
|
|
shall have at least as many elements as @var{MASK} has @code{TRUE} values.
|
11088 |
|
|
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL}.
|
11089 |
|
|
@item @var{FIELD} @tab Shall be of the same type as @var{VECTOR} and have
|
11090 |
|
|
the same shape as @var{MASK}.
|
11091 |
|
|
@end multitable
|
11092 |
|
|
|
11093 |
|
|
@item @emph{Return value}:
|
11094 |
|
|
The resulting array corresponds to @var{FIELD} with @code{TRUE} elements
|
11095 |
|
|
of @var{MASK} replaced by values from @var{VECTOR} in array element order.
|
11096 |
|
|
|
11097 |
|
|
@item @emph{Example}:
|
11098 |
|
|
@smallexample
|
11099 |
|
|
PROGRAM test_unpack
|
11100 |
|
|
integer :: vector(2) = (/1,1/)
|
11101 |
|
|
logical :: mask(4) = (/ .TRUE., .FALSE., .FALSE., .TRUE. /)
|
11102 |
|
|
integer :: field(2,2) = 0, unity(2,2)
|
11103 |
|
|
|
11104 |
|
|
! result: unity matrix
|
11105 |
|
|
unity = unpack(vector, reshape(mask, (/2,2/)), field)
|
11106 |
|
|
END PROGRAM
|
11107 |
|
|
@end smallexample
|
11108 |
|
|
|
11109 |
|
|
@item @emph{See also}:
|
11110 |
|
|
@ref{PACK}, @ref{SPREAD}
|
11111 |
|
|
@end table
|
11112 |
|
|
|
11113 |
|
|
|
11114 |
|
|
|
11115 |
|
|
@node VERIFY
|
11116 |
|
|
@section @code{VERIFY} --- Scan a string for the absence of a set of characters
|
11117 |
|
|
@fnindex VERIFY
|
11118 |
|
|
@cindex string, find missing set
|
11119 |
|
|
|
11120 |
|
|
@table @asis
|
11121 |
|
|
@item @emph{Description}:
|
11122 |
|
|
Verifies that all the characters in a @var{SET} are present in a @var{STRING}.
|
11123 |
|
|
|
11124 |
|
|
If @var{BACK} is either absent or equals @code{FALSE}, this function
|
11125 |
|
|
returns the position of the leftmost character of @var{STRING} that is
|
11126 |
|
|
not in @var{SET}. If @var{BACK} equals @code{TRUE}, the rightmost position
|
11127 |
|
|
is returned. If all characters of @var{SET} are found in @var{STRING}, the
|
11128 |
|
|
result is zero.
|
11129 |
|
|
|
11130 |
|
|
@item @emph{Standard}:
|
11131 |
|
|
Fortran 95 and later, with @var{KIND} argument Fortran 2003 and later
|
11132 |
|
|
|
11133 |
|
|
@item @emph{Class}:
|
11134 |
|
|
Elemental function
|
11135 |
|
|
|
11136 |
|
|
@item @emph{Syntax}:
|
11137 |
|
|
@code{RESULT = VERIFY(STRING, SET[, BACK [, KIND]])}
|
11138 |
|
|
|
11139 |
|
|
@item @emph{Arguments}:
|
11140 |
|
|
@multitable @columnfractions .15 .70
|
11141 |
|
|
@item @var{STRING} @tab Shall be of type @code{CHARACTER}.
|
11142 |
|
|
@item @var{SET} @tab Shall be of type @code{CHARACTER}.
|
11143 |
|
|
@item @var{BACK} @tab (Optional) shall be of type @code{LOGICAL}.
|
11144 |
|
|
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
|
11145 |
|
|
expression indicating the kind parameter of the result.
|
11146 |
|
|
@end multitable
|
11147 |
|
|
|
11148 |
|
|
@item @emph{Return value}:
|
11149 |
|
|
The return value is of type @code{INTEGER} and of kind @var{KIND}. If
|
11150 |
|
|
@var{KIND} is absent, the return value is of default integer kind.
|
11151 |
|
|
|
11152 |
|
|
@item @emph{Example}:
|
11153 |
|
|
@smallexample
|
11154 |
|
|
PROGRAM test_verify
|
11155 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "AO") ! 1, found 'F'
|
11156 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "FOO") ! 3, found 'R'
|
11157 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "C++") ! 1, found 'F'
|
11158 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "C++", .TRUE.) ! 7, found 'N'
|
11159 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "FORTRAN") ! 0' found none
|
11160 |
|
|
END PROGRAM
|
11161 |
|
|
@end smallexample
|
11162 |
|
|
|
11163 |
|
|
@item @emph{See also}:
|
11164 |
|
|
@ref{SCAN}, @ref{INDEX intrinsic}
|
11165 |
|
|
@end table
|
11166 |
|
|
|
11167 |
|
|
|
11168 |
|
|
|
11169 |
|
|
@node XOR
|
11170 |
|
|
@section @code{XOR} --- Bitwise logical exclusive OR
|
11171 |
|
|
@fnindex XOR
|
11172 |
|
|
@cindex bitwise logical exclusive or
|
11173 |
|
|
@cindex logical exclusive or, bitwise
|
11174 |
|
|
|
11175 |
|
|
@table @asis
|
11176 |
|
|
@item @emph{Description}:
|
11177 |
|
|
Bitwise logical exclusive or.
|
11178 |
|
|
|
11179 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
11180 |
|
|
GNU Fortran 77. For integer arguments, programmers should consider
|
11181 |
|
|
the use of the @ref{IEOR} intrinsic and for logical arguments the
|
11182 |
|
|
@code{.NEQV.} operator, which are both defined by the Fortran standard.
|
11183 |
|
|
|
11184 |
|
|
@item @emph{Standard}:
|
11185 |
|
|
GNU extension
|
11186 |
|
|
|
11187 |
|
|
@item @emph{Class}:
|
11188 |
|
|
Function
|
11189 |
|
|
|
11190 |
|
|
@item @emph{Syntax}:
|
11191 |
|
|
@code{RESULT = XOR(I, J)}
|
11192 |
|
|
|
11193 |
|
|
@item @emph{Arguments}:
|
11194 |
|
|
@multitable @columnfractions .15 .70
|
11195 |
|
|
@item @var{I} @tab The type shall be either a scalar @code{INTEGER}
|
11196 |
|
|
type or a scalar @code{LOGICAL} type.
|
11197 |
|
|
@item @var{J} @tab The type shall be the same as the type of @var{I}.
|
11198 |
|
|
@end multitable
|
11199 |
|
|
|
11200 |
|
|
@item @emph{Return value}:
|
11201 |
|
|
The return type is either a scalar @code{INTEGER} or a scalar
|
11202 |
|
|
@code{LOGICAL}. If the kind type parameters differ, then the
|
11203 |
|
|
smaller kind type is implicitly converted to larger kind, and the
|
11204 |
|
|
return has the larger kind.
|
11205 |
|
|
|
11206 |
|
|
@item @emph{Example}:
|
11207 |
|
|
@smallexample
|
11208 |
|
|
PROGRAM test_xor
|
11209 |
|
|
LOGICAL :: T = .TRUE., F = .FALSE.
|
11210 |
|
|
INTEGER :: a, b
|
11211 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
11212 |
|
|
|
11213 |
|
|
WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
|
11214 |
|
|
WRITE (*,*) XOR(a, b)
|
11215 |
|
|
END PROGRAM
|
11216 |
|
|
@end smallexample
|
11217 |
|
|
|
11218 |
|
|
@item @emph{See also}:
|
11219 |
|
|
Fortran 95 elemental function: @ref{IEOR}
|
11220 |
|
|
@end table
|
11221 |
|
|
|
11222 |
|
|
|
11223 |
|
|
|
11224 |
|
|
@node Intrinsic Modules
|
11225 |
|
|
@chapter Intrinsic Modules
|
11226 |
|
|
@cindex intrinsic Modules
|
11227 |
|
|
|
11228 |
|
|
@menu
|
11229 |
|
|
* ISO_FORTRAN_ENV::
|
11230 |
|
|
* ISO_C_BINDING::
|
11231 |
|
|
* OpenMP Modules OMP_LIB and OMP_LIB_KINDS::
|
11232 |
|
|
@end menu
|
11233 |
|
|
|
11234 |
|
|
@node ISO_FORTRAN_ENV
|
11235 |
|
|
@section @code{ISO_FORTRAN_ENV}
|
11236 |
|
|
@table @asis
|
11237 |
|
|
@item @emph{Standard}:
|
11238 |
|
|
Fortran 2003 and later; @code{INT8}, @code{INT16}, @code{INT32}, @code{INT64},
|
11239 |
|
|
@code{REAL32}, @code{REAL64}, @code{REAL128} are Fortran 2008 or later
|
11240 |
|
|
@end table
|
11241 |
|
|
|
11242 |
|
|
The @code{ISO_FORTRAN_ENV} module provides the following scalar default-integer
|
11243 |
|
|
named constants:
|
11244 |
|
|
|
11245 |
|
|
@table @asis
|
11246 |
|
|
@item @code{CHARACTER_STORAGE_SIZE}:
|
11247 |
|
|
Size in bits of the character storage unit.
|
11248 |
|
|
|
11249 |
|
|
@item @code{ERROR_UNIT}:
|
11250 |
|
|
Identifies the preconnected unit used for error reporting.
|
11251 |
|
|
|
11252 |
|
|
@item @code{FILE_STORAGE_SIZE}:
|
11253 |
|
|
Size in bits of the file-storage unit.
|
11254 |
|
|
|
11255 |
|
|
@item @code{INPUT_UNIT}:
|
11256 |
|
|
Identifies the preconnected unit identified by the asterisk
|
11257 |
|
|
(@code{*}) in @code{READ} statement.
|
11258 |
|
|
|
11259 |
|
|
@item @code{INT8}, @code{INT16}, @code{INT32}, @code{INT64}
|
11260 |
|
|
Kind type parameters to specify an INTEGER type with a storage
|
11261 |
|
|
size of 16, 32, and 64 bits. It is negative if a target platform
|
11262 |
|
|
does not support the particular kind.
|
11263 |
|
|
|
11264 |
|
|
@item @code{IOSTAT_END}:
|
11265 |
|
|
The value assigned to the variable passed to the IOSTAT= specifier of
|
11266 |
|
|
an input/output statement if an end-of-file condition occurred.
|
11267 |
|
|
|
11268 |
|
|
@item @code{IOSTAT_EOR}:
|
11269 |
|
|
The value assigned to the variable passed to the IOSTAT= specifier of
|
11270 |
|
|
an input/output statement if an end-of-record condition occurred.
|
11271 |
|
|
|
11272 |
|
|
@item @code{NUMERIC_STORAGE_SIZE}:
|
11273 |
|
|
The size in bits of the numeric storage unit.
|
11274 |
|
|
|
11275 |
|
|
@item @code{OUTPUT_UNIT}:
|
11276 |
|
|
Identifies the preconnected unit identified by the asterisk
|
11277 |
|
|
(@code{*}) in @code{WRITE} statement.
|
11278 |
|
|
|
11279 |
|
|
@item @code{REAL32}, @code{REAL64}, @code{REAL128}
|
11280 |
|
|
Kind type parameters to specify a REAL type with a storage
|
11281 |
|
|
size of 32, 64, and 128 bits. It is negative if a target platform
|
11282 |
|
|
does not support the particular kind.
|
11283 |
|
|
@end table
|
11284 |
|
|
|
11285 |
|
|
|
11286 |
|
|
|
11287 |
|
|
@node ISO_C_BINDING
|
11288 |
|
|
@section @code{ISO_C_BINDING}
|
11289 |
|
|
@table @asis
|
11290 |
|
|
@item @emph{Standard}:
|
11291 |
|
|
Fortran 2003 and later, GNU extensions
|
11292 |
|
|
@end table
|
11293 |
|
|
|
11294 |
|
|
The following intrinsic procedures are provided by the module; their
|
11295 |
|
|
definition can be found in the section Intrinsic Procedures of this
|
11296 |
|
|
manual.
|
11297 |
|
|
|
11298 |
|
|
@table @asis
|
11299 |
|
|
@item @code{C_ASSOCIATED}
|
11300 |
|
|
@item @code{C_F_POINTER}
|
11301 |
|
|
@item @code{C_F_PROCPOINTER}
|
11302 |
|
|
@item @code{C_FUNLOC}
|
11303 |
|
|
@item @code{C_LOC}
|
11304 |
|
|
@end table
|
11305 |
|
|
@c TODO: Vertical spacing between C_FUNLOC and C_LOC wrong in PDF,
|
11306 |
|
|
@c don't really know why.
|
11307 |
|
|
|
11308 |
|
|
The @code{ISO_C_BINDING} module provides the following named constants of
|
11309 |
|
|
type default integer, which can be used as KIND type parameters.
|
11310 |
|
|
|
11311 |
|
|
In addition to the integer named constants required by the Fortran 2003
|
11312 |
|
|
standard, GNU Fortran provides as an extension named constants for the
|
11313 |
|
|
128-bit integer types supported by the C compiler: @code{C_INT128_T,
|
11314 |
|
|
C_INT_LEAST128_T, C_INT_FAST128_T}.
|
11315 |
|
|
|
11316 |
|
|
@multitable @columnfractions .15 .35 .35 .35
|
11317 |
|
|
@item Fortran Type @tab Named constant @tab C type @tab Extension
|
11318 |
|
|
@item @code{INTEGER}@tab @code{C_INT} @tab @code{int}
|
11319 |
|
|
@item @code{INTEGER}@tab @code{C_SHORT} @tab @code{short int}
|
11320 |
|
|
@item @code{INTEGER}@tab @code{C_LONG} @tab @code{long int}
|
11321 |
|
|
@item @code{INTEGER}@tab @code{C_LONG_LONG} @tab @code{long long int}
|
11322 |
|
|
@item @code{INTEGER}@tab @code{C_SIGNED_CHAR} @tab @code{signed char}/@code{unsigned char}
|
11323 |
|
|
@item @code{INTEGER}@tab @code{C_SIZE_T} @tab @code{size_t}
|
11324 |
|
|
@item @code{INTEGER}@tab @code{C_INT8_T} @tab @code{int8_t}
|
11325 |
|
|
@item @code{INTEGER}@tab @code{C_INT16_T} @tab @code{int16_t}
|
11326 |
|
|
@item @code{INTEGER}@tab @code{C_INT32_T} @tab @code{int32_t}
|
11327 |
|
|
@item @code{INTEGER}@tab @code{C_INT64_T} @tab @code{int64_t}
|
11328 |
|
|
@item @code{INTEGER}@tab @code{C_INT128_T} @tab @code{int128_t} @tab Ext.
|
11329 |
|
|
@item @code{INTEGER}@tab @code{C_INT_LEAST8_T} @tab @code{int_least8_t}
|
11330 |
|
|
@item @code{INTEGER}@tab @code{C_INT_LEAST16_T} @tab @code{int_least16_t}
|
11331 |
|
|
@item @code{INTEGER}@tab @code{C_INT_LEAST32_T} @tab @code{int_least32_t}
|
11332 |
|
|
@item @code{INTEGER}@tab @code{C_INT_LEAST64_T} @tab @code{int_least64_t}
|
11333 |
|
|
@item @code{INTEGER}@tab @code{C_INT_LEAST128_T}@tab @code{int_least128_t} @tab Ext.
|
11334 |
|
|
@item @code{INTEGER}@tab @code{C_INT_FAST8_T} @tab @code{int_fast8_t}
|
11335 |
|
|
@item @code{INTEGER}@tab @code{C_INT_FAST16_T} @tab @code{int_fast16_t}
|
11336 |
|
|
@item @code{INTEGER}@tab @code{C_INT_FAST32_T} @tab @code{int_fast32_t}
|
11337 |
|
|
@item @code{INTEGER}@tab @code{C_INT_FAST64_T} @tab @code{int_fast64_t}
|
11338 |
|
|
@item @code{INTEGER}@tab @code{C_INT_FAST128_T} @tab @code{int_fast128_t} @tab Ext.
|
11339 |
|
|
@item @code{INTEGER}@tab @code{C_INTMAX_T} @tab @code{intmax_t}
|
11340 |
|
|
@item @code{INTEGER}@tab @code{C_INTPTR_T} @tab @code{intptr_t}
|
11341 |
|
|
@item @code{REAL} @tab @code{C_FLOAT} @tab @code{float}
|
11342 |
|
|
@item @code{REAL} @tab @code{C_DOUBLE} @tab @code{double}
|
11343 |
|
|
@item @code{REAL} @tab @code{C_LONG_DOUBLE} @tab @code{long double}
|
11344 |
|
|
@item @code{COMPLEX}@tab @code{C_FLOAT_COMPLEX} @tab @code{float _Complex}
|
11345 |
|
|
@item @code{COMPLEX}@tab @code{C_DOUBLE_COMPLEX}@tab @code{double _Complex}
|
11346 |
|
|
@item @code{COMPLEX}@tab @code{C_LONG_DOUBLE_COMPLEX}@tab @code{long double _Complex}
|
11347 |
|
|
@item @code{LOGICAL}@tab @code{C_BOOL} @tab @code{_Bool}
|
11348 |
|
|
@item @code{CHARACTER}@tab @code{C_CHAR} @tab @code{char}
|
11349 |
|
|
@end multitable
|
11350 |
|
|
|
11351 |
|
|
Additionally, the following parameters of type @code{CHARACTER(KIND=C_CHAR)}
|
11352 |
|
|
are defined.
|
11353 |
|
|
|
11354 |
|
|
@multitable @columnfractions .20 .45 .15
|
11355 |
|
|
@item Name @tab C definition @tab Value
|
11356 |
|
|
@item @code{C_NULL_CHAR} @tab null character @tab @code{'\0'}
|
11357 |
|
|
@item @code{C_ALERT} @tab alert @tab @code{'\a'}
|
11358 |
|
|
@item @code{C_BACKSPACE} @tab backspace @tab @code{'\b'}
|
11359 |
|
|
@item @code{C_FORM_FEED} @tab form feed @tab @code{'\f'}
|
11360 |
|
|
@item @code{C_NEW_LINE} @tab new line @tab @code{'\n'}
|
11361 |
|
|
@item @code{C_CARRIAGE_RETURN} @tab carriage return @tab @code{'\r'}
|
11362 |
|
|
@item @code{C_HORIZONTAL_TAB} @tab horizontal tab @tab @code{'\t'}
|
11363 |
|
|
@item @code{C_VERTICAL_TAB} @tab vertical tab @tab @code{'\v'}
|
11364 |
|
|
@end multitable
|
11365 |
|
|
|
11366 |
|
|
@node OpenMP Modules OMP_LIB and OMP_LIB_KINDS
|
11367 |
|
|
@section OpenMP Modules @code{OMP_LIB} and @code{OMP_LIB_KINDS}
|
11368 |
|
|
@table @asis
|
11369 |
|
|
@item @emph{Standard}:
|
11370 |
|
|
OpenMP Application Program Interface v3.0
|
11371 |
|
|
@end table
|
11372 |
|
|
|
11373 |
|
|
|
11374 |
|
|
The OpenMP Fortran runtime library routines are provided both in
|
11375 |
|
|
a form of two Fortran 90 modules, named @code{OMP_LIB} and
|
11376 |
|
|
@code{OMP_LIB_KINDS}, and in a form of a Fortran @code{include} file named
|
11377 |
|
|
@file{omp_lib.h}. The procedures provided by @code{OMP_LIB} can be found
|
11378 |
|
|
in the @ref{Top,,Introduction,libgomp,GNU OpenMP runtime library} manual,
|
11379 |
|
|
the named constants defined in the @code{OMP_LIB_KINDS} module are listed
|
11380 |
|
|
below.
|
11381 |
|
|
|
11382 |
|
|
For details refer to the actual
|
11383 |
|
|
@uref{http://www.openmp.org/mp-documents/spec30.pdf,
|
11384 |
|
|
OpenMP Application Program Interface v3.0}.
|
11385 |
|
|
|
11386 |
|
|
@code{OMP_LIB_KINDS} provides the following scalar default-integer
|
11387 |
|
|
named constants:
|
11388 |
|
|
|
11389 |
|
|
@table @asis
|
11390 |
|
|
@item @code{omp_integer_kind}
|
11391 |
|
|
@item @code{omp_logical_kind}
|
11392 |
|
|
@item @code{omp_lock_kind}
|
11393 |
|
|
@item @code{omp_nest_lock_kind}
|
11394 |
|
|
@item @code{omp_sched_kind}
|
11395 |
|
|
@end table
|