]> gcc.gnu.org Git - gcc.git/blame - gcc/fortran/intrinsic.texi
invoke.texi (Code Gen Options): Fix abbreviation typo.
[gcc.git] / gcc / fortran / intrinsic.texi
CommitLineData
8db2ba40 1@ignore
2553e4e0 2Copyright (C) 2005, 2006, 2007
8db2ba40 3Free Software Foundation, Inc.
7fc15ba5 4This is part of the GNU Fortran manual.
8db2ba40
SK
5For copying conditions, see the file gfortran.texi.
6
7Permission is granted to copy, distribute and/or modify this document
8under the terms of the GNU Free Documentation License, Version 1.2 or
9any later version published by the Free Software Foundation; with the
10Invariant Sections being ``GNU General Public License'' and ``Funding
11Free Software'', the Front-Cover texts being (a) (see below), and with
12the Back-Cover Texts being (b) (see below). A copy of the license is
13included in the gfdl(7) man page.
14
15
16Some basic guidelines for editing this document:
17
18 (1) The intrinsic procedures are to be listed in alphabetical order.
ea8dda63 19 (2) The generic name is to be used.
8db2ba40
SK
20 (3) The specific names are included in the function index and in a
21 table at the end of the node (See ABS entry).
22 (4) Try to maintain the same style for each entry.
23
24
25@end ignore
26
fe284266
DF
27@tex
28\gdef\acos{\mathop{\rm acos}\nolimits}
29\gdef\asin{\mathop{\rm asin}\nolimits}
30\gdef\atan{\mathop{\rm atan}\nolimits}
31\gdef\acosh{\mathop{\rm acosh}\nolimits}
32\gdef\asinh{\mathop{\rm asinh}\nolimits}
33\gdef\atanh{\mathop{\rm atanh}\nolimits}
34@end tex
35
36
8db2ba40
SK
37@node Intrinsic Procedures
38@chapter Intrinsic Procedures
4ba96c02 39@cindex intrinsic procedures
8db2ba40
SK
40
41This portion of the document is incomplete and undergoing massive expansion
42and editing. All contributions and corrections are strongly encouraged.
43
cd051390
DF
44Implemented intrinsics are fully functional and available to the user to apply.
45Some intrinsics have documentation yet to be completed as indicated by 'documentation pending'.
46
21825fd6
DF
47@comment Missing intrinsics (double check with #19292)
48@comment - MClock
49@comment - Short
50
8db2ba40 51@menu
e6b38f67 52* Introduction: Introduction to Intrinsics
eaef357b
JD
53* @code{ABORT}: ABORT, Abort the program
54* @code{ABS}: ABS, Absolute value
26d29061 55* @code{ACCESS}: ACCESS, Checks file access modes
eaef357b 56* @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
cd051390
DF
57* @code{ACOS}: ACOS, Arccosine function
58* @code{ACOSH}: ACOSH, Hyperbolic arccosine function
eaef357b
JD
59* @code{ADJUSTL}: ADJUSTL, Left adjust a string
60* @code{ADJUSTR}: ADJUSTR, Right adjust a string
61* @code{AIMAG}: AIMAG, Imaginary part of complex number
62* @code{AINT}: AINT, Truncate to a whole number
185d7d97 63* @code{ALARM}: ALARM, Set an alarm clock
eaef357b
JD
64* @code{ALL}: ALL, Determine if all values are true
65* @code{ALLOCATED}: ALLOCATED, Status of allocatable entity
fe284266 66* @code{AND}: AND, Bitwise logical AND
eaef357b
JD
67* @code{ANINT}: ANINT, Nearest whole number
68* @code{ANY}: ANY, Determine if any values are true
69* @code{ASIN}: ASIN, Arcsine function
cd051390 70* @code{ASINH}: ASINH, Hyperbolic arcsine function
eaef357b
JD
71* @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
72* @code{ATAN}: ATAN, Arctangent function
73* @code{ATAN2}: ATAN2, Arctangent function
cd051390 74* @code{ATANH}: ATANH, Hyperbolic arctangent function
eaef357b
JD
75* @code{BESJ0}: BESJ0, Bessel function of the first kind of order 0
76* @code{BESJ1}: BESJ1, Bessel function of the first kind of order 1
77* @code{BESJN}: BESJN, Bessel function of the first kind
78* @code{BESY0}: BESY0, Bessel function of the second kind of order 0
79* @code{BESY1}: BESY1, Bessel function of the second kind of order 1
80* @code{BESYN}: BESYN, Bessel function of the second kind
81* @code{BIT_SIZE}: BIT_SIZE, Bit size inquiry function
82* @code{BTEST}: BTEST, Bit test function
83* @code{CEILING}: CEILING, Integer ceiling function
3a3977a8 84* @code{CHAR}: CHAR, Integer-to-character conversion function
cd051390
DF
85* @code{CHDIR}: CHDIR, Change working directory
86* @code{CHMOD}: CHMOD, Change access permissions of files
eaef357b 87* @code{CMPLX}: CMPLX, Complex conversion function
21825fd6 88* @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Get number of command line arguments
323d0f0b 89* @code{CONJG}: CONJG, Complex conjugate function
eaef357b
JD
90* @code{COS}: COS, Cosine function
91* @code{COSH}: COSH, Hyperbolic cosine function
fe284266 92* @code{COUNT}: COUNT, Count occurrences of TRUE in an array
323d0f0b 93* @code{CPU_TIME}: CPU_TIME, CPU time subroutine
3435a71e 94* @code{CSHIFT}: CSHIFT, Circular array shift function
35059811 95* @code{CTIME}: CTIME, Subroutine (or function) to convert a time into a string
323d0f0b 96* @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
3435a71e
JD
97* @code{DBLE}: DBLE, Double precision conversion function
98* @code{DCMPLX}: DCMPLX, Double complex conversion function
99* @code{DFLOAT}: DFLOAT, Double precision conversion function
100* @code{DIGITS}: DIGITS, Significant digits function
101* @code{DIM}: DIM, Dim function
102* @code{DOT_PRODUCT}: DOT_PRODUCT, Dot product function
103* @code{DPROD}: DPROD, Double product function
104* @code{DREAL}: DREAL, Double real part function
105* @code{DTIME}: DTIME, Execution time subroutine (or function)
f60d6481
JD
106* @code{EOSHIFT}: EOSHIFT, End-off shift function
107* @code{EPSILON}: EPSILON, Epsilon function
eaef357b
JD
108* @code{ERF}: ERF, Error function
109* @code{ERFC}: ERFC, Complementary error function
f60d6481
JD
110* @code{ETIME}: ETIME, Execution time subroutine (or function)
111* @code{EXIT}: EXIT, Exit the program with status.
ee2242a2
JD
112* @code{EXP}: EXP, Exponential function
113* @code{EXPONENT}: EXPONENT, Exponent function
35059811 114* @code{FDATE}: FDATE, Subroutine (or function) to get the current time as a string
fe284266 115* @code{FGET}: FGET, Read a single character in stream mode from stdin
cd051390 116* @code{FGETC}: FGETC, Read a single character in stream mode
6110b776 117* @code{FLOAT}: FLOAT, Convert integer to default real
ee2242a2 118* @code{FLOOR}: FLOOR, Integer floor function
3a3977a8 119* @code{FLUSH}: FLUSH, Flush I/O unit(s)
ee2242a2 120* @code{FNUM}: FNUM, File number function
fe284266 121* @code{FPUT}: FPUT, Write a single character in stream mode to stdout
cd051390 122* @code{FPUTC}: FPUTC, Write a single character in stream mode
3a3977a8 123* @code{FRACTION}: FRACTION, Fractional part of the model representation
0d519038 124* @code{FREE}: FREE, Memory de-allocation subroutine
cd051390
DF
125* @code{FSEEK}: FSEEK, Low level file positioning subroutine
126* @code{FSTAT}: FSTAT, Get file status
127* @code{FTELL}: FTELL, Current stream position
128* @code{GETARG}: GETARG, Get command line arguments
21825fd6
DF
129* @code{GET_COMMAND}: GET_COMMAND, Get the entire command line
130* @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Get command line arguments
cd051390
DF
131* @code{GETCWD}: GETCWD, Get current working directory
132* @code{GETENV}: GETENV, Get an environmental variable
133* @code{GET_ENVIRONMENT_VARIABLE}: GET_ENVIRONMENT_VARIABLE, Get an environmental variable
3a3977a8 134* @code{GETGID}: GETGID, Group ID function
cd051390 135* @code{GETLOG}: GETLOG, Get login name
3a3977a8
FXC
136* @code{GETPID}: GETPID, Process ID function
137* @code{GETUID}: GETUID, User ID function
cd051390
DF
138* @code{GMTIME}: GMTIME, Convert time to GMT info
139* @code{HOSTNM}: HOSTNM, Get system host name
3a3977a8
FXC
140* @code{HUGE}: HUGE, Largest number of a kind
141* @code{IACHAR}: IACHAR, Code in @acronym{ASCII} collating sequence
cd051390 142* @code{IAND}: IAND, Bitwise logical and
21825fd6 143* @code{IARGC}: IARGC, Get the number of command line arguments
cd051390
DF
144* @code{IBCLR}: IBCLR, Clear bit
145* @code{IBITS}: IBITS, Bit extraction
146* @code{IBSET}: IBSET, Set bit
3a3977a8 147* @code{ICHAR}: ICHAR, Character-to-integer conversion function
12197210 148* @code{IDATE}: IDATE, Current local time (day/month/year)
cd051390
DF
149* @code{IEOR}: IEOR, Bitwise logical exclusive or
150* @code{IERRNO}: IERRNO, Function to get the last system error number
151* @code{INDEX}: INDEX, Position of a substring within a string
152* @code{INT}: INT, Convert to integer type
153* @code{IOR}: IOR, Bitwise logical or
3a3977a8 154* @code{IRAND}: IRAND, Integer pseudo-random number
cd051390
DF
155* @code{ISHFT}: ISHFT, Shift bits
156* @code{ISHFTC}: ISHFTC, Shift bits circularly
12197210 157* @code{ITIME}: ITIME, Current local time (hour/minutes/seconds)
cd051390 158* @code{KILL}: KILL, Send a signal to a process
3a3977a8 159* @code{KIND}: KIND, Kind of an entity
cd051390
DF
160* @code{LBOUND}: LBOUND, Lower dimension bounds of an array
161* @code{LEN}: LEN, Length of a character entity
162* @code{LEN_TRIM}: LEN_TRIM, Length of a character entity without trailing blank characters
163* @code{LGE}: LGE, Lexical greater than or equal
164* @code{LGT}: LGT, Lexical greater than
165* @code{LINK}: LINK, Create a hard link
166* @code{LLE}: LLE, Lexical less than or equal
167* @code{LLT}: LLT, Lexical less than
168* @code{LNBLNK}: LNBLNK, Index of the last non-blank character in a string
83d890b9 169* @code{LOC}: LOC, Returns the address of a variable
eaef357b
JD
170* @code{LOG}: LOG, Logarithm function
171* @code{LOG10}: LOG10, Base 10 logarithm function
cd051390
DF
172* @code{LOGICAL}: LOGICAL, Convert to logical type
173* @code{LSHIFT}: LSHIFT, Left shift bits
21825fd6 174* @code{LSTAT}: LSTAT, Get file status
cd051390 175* @code{LTIME}: LTIME, Convert time to local time info
0d519038 176* @code{MALLOC}: MALLOC, Dynamic memory allocation function
cd051390
DF
177* @code{MATMUL}: MATMUL, matrix multiplication
178* @code{MAX}: MAX, Maximum value of an argument list
3a3977a8 179* @code{MAXEXPONENT}: MAXEXPONENT, Maximum exponent of a real kind
cd051390
DF
180* @code{MAXLOC}: MAXLOC, Location of the maximum value within an array
181* @code{MAXVAL}: MAXVAL, Maximum value of an array
182* @code{MERGE}: MERGE, Merge arrays
183* @code{MIN}: MIN, Minimum value of an argument list
3a3977a8 184* @code{MINEXPONENT}: MINEXPONENT, Minimum exponent of a real kind
cd051390
DF
185* @code{MINLOC}: MINLOC, Location of the minimum value within an array
186* @code{MINVAL}: MINVAL, Minimum value of an array
3a3977a8
FXC
187* @code{MOD}: MOD, Remainder function
188* @code{MODULO}: MODULO, Modulo function
5046aff5 189* @code{MOVE_ALLOC}: MOVE_ALLOC, Move allocation from one object to another
cd051390 190* @code{MVBITS}: MVBITS, Move bits from one integer to another
3a3977a8 191* @code{NEAREST}: NEAREST, Nearest representable number
bec93d79 192* @code{NEW_LINE}: NEW_LINE, New line character
3a3977a8 193* @code{NINT}: NINT, Nearest whole number
cd051390 194* @code{NOT}: NOT, Logical negation
fe284266
DF
195* @code{NULL}: NULL, Function that returns an disassociated pointer
196* @code{OR}: OR, Bitwise logical OR
cd051390
DF
197* @code{PACK}: PACK, Pack an array into an array of rank one
198* @code{PERROR}: PERROR, Print system error message
3a3977a8 199* @code{PRECISION}: PRECISION, Decimal precision of a real kind
cd051390
DF
200* @code{PRESENT}: PRESENT, Determine whether an optional argument is specified
201* @code{PRODUCT}: PRODUCT, Product of array elements
3a3977a8 202* @code{RADIX}: RADIX, Base of a data model
cd051390
DF
203* @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number
204* @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence
3a3977a8
FXC
205* @code{RAND}: RAND, Real pseudo-random number
206* @code{RANGE}: RANGE, Decimal exponent range of a real kind
cd051390 207* @code{RAN}: RAN, Real pseudo-random number
6970fcc8 208* @code{REAL}: REAL, Convert to real type
cd051390
DF
209* @code{RENAME}: RENAME, Rename a file
210* @code{REPEAT}: REPEAT, Repeated string concatenation
211* @code{RESHAPE}: RESHAPE, Function to reshape an array
3a3977a8 212* @code{RRSPACING}: RRSPACING, Reciprocal of the relative spacing
cd051390 213* @code{RSHIFT}: RSHIFT, Right shift bits
3a3977a8 214* @code{SCALE}: SCALE, Scale a real value
cd051390 215* @code{SCAN}: SCAN, Scan a string for the presence of a set of characters
53096259 216* @code{SECNDS}: SECNDS, Time function
cd051390
DF
217@comment * @code{SECOND}: SECOND, (?)
218@comment * @code{SECONDS}: SECONDS, (?)
3a3977a8
FXC
219* @code{SELECTED_INT_KIND}: SELECTED_INT_KIND, Choose integer kind
220* @code{SELECTED_REAL_KIND}: SELECTED_REAL_KIND, Choose real kind
221* @code{SET_EXPONENT}: SET_EXPONENT, Set the exponent of the model
cd051390 222* @code{SHAPE}: SHAPE, Determine the shape of an array
3a3977a8 223* @code{SIGN}: SIGN, Sign copying function
185d7d97 224* @code{SIGNAL}: SIGNAL, Signal handling subroutine (or function)
eaef357b
JD
225* @code{SIN}: SIN, Sine function
226* @code{SINH}: SINH, Hyperbolic sine function
cd051390 227* @code{SIZE}: SIZE, Function to determine the size of an array
3a3977a8 228* @code{SNGL}: SNGL, Convert double precision real to default real
cd051390
DF
229* @code{SPACING}: SPACING, Smallest distance between two numbers of a given type
230* @code{SPREAD}: SPREAD, Add a dimension to an array
185d7d97 231* @code{SQRT}: SQRT, Square-root function
3a3977a8 232* @code{SRAND}: SRAND, Reinitialize the random number generator
cd051390
DF
233* @code{STAT}: STAT, Get file status
234* @code{SUM}: SUM, Sum of array elements
235* @code{SYMLNK}: SYMLNK, Create a symbolic link
236* @code{SYSTEM}: SYSTEM, Execute a shell command
237* @code{SYSTEM_CLOCK}: SYSTEM_CLOCK, Time function
eaef357b
JD
238* @code{TAN}: TAN, Tangent function
239* @code{TANH}: TANH, Hyperbolic tangent function
cd051390 240* @code{TIME}: TIME, Time function
d3dfa1fe 241* @code{TIME8}: TIME8, Time function (64-bit)
3a3977a8 242* @code{TINY}: TINY, Smallest positive number of a real kind
cd051390
DF
243* @code{TRANSFER}: TRANSFER, Transfer bit patterns
244* @code{TRANSPOSE}: TRANSPOSE, Transpose an array of rank two
245* @code{TRIM}: TRIM, Function to remove trailing blank characters of a string
246* @code{UBOUND}: UBOUND, Upper dimension bounds of an array
247* @code{UMASK}: UMASK, Set the file creation mask
248* @code{UNLINK}: UNLINK, Remove a file from the file system
cd051390
DF
249* @code{UNPACK}: UNPACK, Unpack an array of rank one into an array
250* @code{VERIFY}: VERIFY, Scan a string for the absence of a set of characters
fe284266 251* @code{XOR}: XOR, Bitwise logical exclusive or
8db2ba40
SK
252@end menu
253
e6b38f67 254@node Introduction to Intrinsics
8db2ba40
SK
255@section Introduction to intrinsic procedures
256
e1b4184c
BM
257The intrinsic procedures provided by GNU Fortran include all of the
258intrinsic procedures required by the Fortran 95 standard, a set of
259intrinsic procedures for backwards compatibility with G77, and a small
260selection of intrinsic procedures from the Fortran 2003 standard. Any
261conflict between a description here and a description in either the
262Fortran 95 standard or the Fortran 2003 standard is unintentional, and
263the standard(s) should be considered authoritative.
8db2ba40
SK
264
265The enumeration of the @code{KIND} type parameter is processor defined in
7fc15ba5 266the Fortran 95 standard. GNU Fortran defines the default integer type and
8db2ba40
SK
267default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
268respectively. The standard mandates that both data types shall have
269another kind, which have more precision. On typical target architectures
3435a71e 270supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
8db2ba40
SK
271Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
272In the description of generic intrinsic procedures, the kind type parameter
273will be specified by @code{KIND=*}, and in the description of specific
274names for an intrinsic procedure the kind type parameter will be explicitly
275given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
276brevity the optional @code{KIND=} syntax will be omitted.
277
0c5a1cbc 278Many of the intrinsic procedures take one or more optional arguments.
8db2ba40
SK
279This document follows the convention used in the Fortran 95 standard,
280and denotes such arguments by square brackets.
281
7fc15ba5 282GNU Fortran offers the @option{-std=f95} and @option{-std=gnu} options,
8db2ba40
SK
283which can be used to restrict the set of intrinsic procedures to a
284given standard. By default, @command{gfortran} sets the @option{-std=gnu}
3435a71e 285option, and so all intrinsic procedures described here are accepted. There
8db2ba40
SK
286is one caveat. For a select group of intrinsic procedures, @command{g77}
287implemented both a function and a subroutine. Both classes
288have been implemented in @command{gfortran} for backwards compatibility
289with @command{g77}. It is noted here that these functions and subroutines
290cannot be intermixed in a given subprogram. In the descriptions that follow,
ea8dda63
BM
291the applicable standard for each intrinsic procedure is noted.
292
8db2ba40
SK
293
294
7b4047a0 295@node ABORT
8db2ba40 296@section @code{ABORT} --- Abort the program
4ba96c02 297@cindex @code{ABORT} intrinsic
8db2ba40
SK
298@cindex abort
299
300@table @asis
301@item @emph{Description}:
302@code{ABORT} causes immediate termination of the program. On operating
303systems that support a core dump, @code{ABORT} will produce a core dump,
304which is suitable for debugging purposes.
305
cd051390
DF
306@item @emph{Standard}:
307GNU extension
8db2ba40 308
eaef357b 309@item @emph{Class}:
8db2ba40
SK
310non-elemental subroutine
311
312@item @emph{Syntax}:
313@code{CALL ABORT}
314
315@item @emph{Return value}:
316Does not return.
317
318@item @emph{Example}:
319@smallexample
320program test_abort
321 integer :: i = 1, j = 2
322 if (i /= j) call abort
323end program test_abort
324@end smallexample
cd051390
DF
325
326@item @emph{See also}:
327@ref{EXIT}, @ref{KILL}
328
8db2ba40
SK
329@end table
330
331
7b4047a0 332@node ABS
8db2ba40 333@section @code{ABS} --- Absolute value
4ba96c02
BM
334@cindex @code{ABS} intrinsic
335@cindex @code{CABS} intrinsic
336@cindex @code{DABS} intrinsic
337@cindex @code{IABS} intrinsic
338@cindex @code{ZABS} intrinsic
339@cindex @code{CDABS} intrinsic
8db2ba40
SK
340@cindex absolute value
341
342@table @asis
343@item @emph{Description}:
344@code{ABS(X)} computes the absolute value of @code{X}.
345
cd051390
DF
346@item @emph{Standard}:
347F77 and later, has overloads that are GNU extensions
8db2ba40 348
eaef357b 349@item @emph{Class}:
cd051390 350Elemental function
8db2ba40
SK
351
352@item @emph{Syntax}:
d565bb3a 353@code{RESULT = ABS(X)}
8db2ba40
SK
354
355@item @emph{Arguments}:
356@multitable @columnfractions .15 .80
357@item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
358@code{REAL(*)}, or @code{COMPLEX(*)}.
359@end multitable
360
361@item @emph{Return value}:
362The return value is of the same type and
363kind as the argument except the return value is @code{REAL(*)} for a
364@code{COMPLEX(*)} argument.
365
366@item @emph{Example}:
367@smallexample
6230d276 368program test_abs
8db2ba40
SK
369 integer :: i = -1
370 real :: x = -1.e0
371 complex :: z = (-1.e0,0.e0)
372 i = abs(i)
373 x = abs(x)
374 x = abs(z)
6230d276 375end program test_abs
8db2ba40
SK
376@end smallexample
377
378@item @emph{Specific names}:
cd051390
DF
379@multitable @columnfractions .20 .20 .20 .40
380@item Name @tab Argument @tab Return type @tab Standard
381@item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab F77 and later
382@item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
383@item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
384@item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
385@item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
8db2ba40
SK
386@end multitable
387@end table
388
389
cd051390 390@node ACCESS
26d29061 391@section @code{ACCESS} --- Checks file access modes
4ba96c02
BM
392@cindex @code{ACCESS}
393@cindex file system operations
cd051390 394
cd051390
DF
395@table @asis
396@item @emph{Description}:
26d29061
TB
397@code{ACCESS(NAME, MODE)} checks whether the file @var{NAME}
398exists, is readable, writable or executable. Except for the
399executable check, @code{ACCESS} can be replaced by
400Fortran 95's @code{INQUIRE}.
cd051390
DF
401
402@item @emph{Standard}:
403GNU extension
404
405@item @emph{Class}:
26d29061
TB
406Inquiry function
407
cd051390 408@item @emph{Syntax}:
d565bb3a 409@code{RESULT = ACCESS(NAME, MODE)}
26d29061 410
cd051390 411@item @emph{Arguments}:
26d29061
TB
412@multitable @columnfractions .15 .80
413@item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
414Tailing blank are ignored unless the character @code{achar(0)} is
415present, then all characters up to and excluding @code{achar(0)} are
416used as file name.
417@item @var{MODE} @tab Scalar @code{CHARACTER} with the file access mode,
418may be any concatenation of @code{"r"} (readable), @code{"w"} (writable)
37efe9e9 419and @code{"x"} (executable), or @code{" "} to check for existence.
26d29061
TB
420@end multitable
421
cd051390 422@item @emph{Return value}:
26d29061 423Returns a scalar @code{INTEGER}, which is @code{0} if the file is
8370304d 424accessible in the given mode; otherwise or if an invalid argument
26d29061
TB
425has been given for @code{MODE} the value @code{1} is returned.
426
cd051390 427@item @emph{Example}:
26d29061
TB
428@smallexample
429program access_test
430 implicit none
431 character(len=*), parameter :: file = 'test.dat'
432 character(len=*), parameter :: file2 = 'test.dat '//achar(0)
433 if(access(file,' ') == 0) print *, trim(file),' is exists'
434 if(access(file,'r') == 0) print *, trim(file),' is readable'
435 if(access(file,'w') == 0) print *, trim(file),' is writable'
436 if(access(file,'x') == 0) print *, trim(file),' is executable'
437 if(access(file2,'rwx') == 0) &
438 print *, trim(file2),' is readable, writable and executable'
439end program access_test
440@end smallexample
cd051390
DF
441@item @emph{Specific names}:
442@item @emph{See also}:
cd051390
DF
443
444@end table
445
8db2ba40 446
7b4047a0 447@node ACHAR
8db2ba40 448@section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
4ba96c02 449@cindex @code{ACHAR} intrinsic
8db2ba40
SK
450@cindex @acronym{ASCII} collating sequence
451
452@table @asis
453@item @emph{Description}:
454@code{ACHAR(I)} returns the character located at position @code{I}
455in the @acronym{ASCII} collating sequence.
456
cd051390
DF
457@item @emph{Standard}:
458F77 and later
8db2ba40 459
eaef357b 460@item @emph{Class}:
cd051390 461Elemental function
8db2ba40
SK
462
463@item @emph{Syntax}:
d565bb3a 464@code{RESULT = ACHAR(I)}
8db2ba40
SK
465
466@item @emph{Arguments}:
467@multitable @columnfractions .15 .80
eaef357b 468@item @var{I} @tab The type shall be @code{INTEGER(*)}.
8db2ba40
SK
469@end multitable
470
471@item @emph{Return value}:
472The return value is of type @code{CHARACTER} with a length of one. The
473kind type parameter is the same as @code{KIND('A')}.
474
475@item @emph{Example}:
476@smallexample
477program test_achar
478 character c
479 c = achar(32)
6230d276 480end program test_achar
8db2ba40 481@end smallexample
7f4e7e0f
BM
482
483@item @emph{See also}:
484@ref{CHAR}, @ref{IACHAR}, @ref{ICHAR}
485
8db2ba40
SK
486@end table
487
488
489
7b4047a0 490@node ACOS
cd051390 491@section @code{ACOS} --- Arccosine function
4ba96c02
BM
492@cindex @code{ACOS} intrinsic
493@cindex @code{DACOS} intrinsic
cd051390 494@cindex trigonometric functions (inverse)
8db2ba40
SK
495
496@table @asis
497@item @emph{Description}:
fe284266 498@code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
8db2ba40 499
cd051390
DF
500@item @emph{Standard}:
501F77 and later
8db2ba40 502
eaef357b 503@item @emph{Class}:
cd051390 504Elemental function
8db2ba40
SK
505
506@item @emph{Syntax}:
d565bb3a 507@code{RESULT = ACOS(X)}
8db2ba40
SK
508
509@item @emph{Arguments}:
510@multitable @columnfractions .15 .80
323d0f0b 511@item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
6230d276 512less than one.
8db2ba40
SK
513@end multitable
514
515@item @emph{Return value}:
516The return value is of type @code{REAL(*)} and it lies in the
fe284266
DF
517range @math{ 0 \leq \acos(x) \leq \pi}. The kind type parameter
518is the same as @var{X}.
8db2ba40
SK
519
520@item @emph{Example}:
521@smallexample
522program test_acos
523 real(8) :: x = 0.866_8
cd051390 524 x = acos(x)
8db2ba40
SK
525end program test_acos
526@end smallexample
527
528@item @emph{Specific names}:
cd051390
DF
529@multitable @columnfractions .20 .20 .20 .40
530@item Name @tab Argument @tab Return type @tab Standard
531@item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
8db2ba40 532@end multitable
cd051390
DF
533
534@item @emph{See also}:
535Inverse function: @ref{COS}
536
537@end table
538
539
540@node ACOSH
541@section @code{ACOSH} --- Hyperbolic arccosine function
4ba96c02 542@cindex @code{ACOSH} intrinsic
cd051390
DF
543@cindex hyperbolic arccosine
544@cindex hyperbolic cosine (inverse)
545
cd051390
DF
546@table @asis
547@item @emph{Description}:
fe284266
DF
548@code{ACOSH(X)} computes the area hyperbolic cosine of @var{X} (inverse of @code{COSH(X)}).
549
cd051390 550@item @emph{Standard}:
fe284266
DF
551GNU extension
552
cd051390 553@item @emph{Class}:
fe284266
DF
554Elemental function
555
cd051390 556@item @emph{Syntax}:
d565bb3a 557@code{RESULT = ACOSH(X)}
fe284266 558
cd051390 559@item @emph{Arguments}:
fe284266
DF
560@multitable @columnfractions .15 .80
561@item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
562greater or equal to one.
563@end multitable
564
cd051390 565@item @emph{Return value}:
fe284266
DF
566The return value is of type @code{REAL(*)} and it lies in the
567range @math{0 \leq \acosh (x) \leq \infty}.
568
cd051390 569@item @emph{Example}:
fe284266
DF
570@smallexample
571PROGRAM test_acosh
572 REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
573 WRITE (*,*) ACOSH(x)
574END PROGRAM
575@end smallexample
576
cd051390
DF
577@item @emph{See also}:
578Inverse function: @ref{COSH}
8db2ba40
SK
579@end table
580
7b4047a0
SK
581
582
583@node ADJUSTL
8db2ba40 584@section @code{ADJUSTL} --- Left adjust a string
4ba96c02 585@cindex @code{ADJUSTL} intrinsic
8db2ba40
SK
586@cindex adjust string
587
588@table @asis
589@item @emph{Description}:
590@code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
591Spaces are inserted at the end of the string as needed.
592
cd051390
DF
593@item @emph{Standard}:
594F95 and later
8db2ba40 595
eaef357b 596@item @emph{Class}:
cd051390 597Elemental function
8db2ba40
SK
598
599@item @emph{Syntax}:
d565bb3a 600@code{RESULT = ADJUSTL(STR)}
8db2ba40
SK
601
602@item @emph{Arguments}:
603@multitable @columnfractions .15 .80
604@item @var{STR} @tab The type shall be @code{CHARACTER}.
605@end multitable
606
607@item @emph{Return value}:
608The return value is of type @code{CHARACTER} where leading spaces
609are removed and the same number of spaces are inserted on the end
610of @var{STR}.
611
612@item @emph{Example}:
613@smallexample
614program test_adjustl
615 character(len=20) :: str = ' gfortran'
616 str = adjustl(str)
617 print *, str
618end program test_adjustl
619@end smallexample
620@end table
621
622
eaef357b 623
7b4047a0 624@node ADJUSTR
8db2ba40 625@section @code{ADJUSTR} --- Right adjust a string
4ba96c02 626@cindex @code{ADJUSTR} intrinsic
8db2ba40
SK
627@cindex adjust string
628
629@table @asis
630@item @emph{Description}:
631@code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
632Spaces are inserted at the start of the string as needed.
633
cd051390
DF
634@item @emph{Standard}:
635F95 and later
8db2ba40 636
eaef357b 637@item @emph{Class}:
cd051390 638Elemental function
8db2ba40
SK
639
640@item @emph{Syntax}:
d565bb3a 641@code{RESULT = ADJUSTR(STR)}
8db2ba40
SK
642
643@item @emph{Arguments}:
644@multitable @columnfractions .15 .80
645@item @var{STR} @tab The type shall be @code{CHARACTER}.
646@end multitable
647
648@item @emph{Return value}:
649The return value is of type @code{CHARACTER} where trailing spaces
650are removed and the same number of spaces are inserted at the start
651of @var{STR}.
652
653@item @emph{Example}:
654@smallexample
655program test_adjustr
656 character(len=20) :: str = 'gfortran'
657 str = adjustr(str)
658 print *, str
659end program test_adjustr
660@end smallexample
661@end table
662
663
eaef357b 664
6b32f9fc
SK
665@node AIMAG
666@section @code{AIMAG} --- Imaginary part of complex number
4ba96c02
BM
667@cindex @code{AIMAG} intrinsic
668@cindex @code{DIMAG} intrinsic
669@cindex @code{IMAG} intrinsic
670@cindex @code{IMAGPART} intrinsic
671@cindex imaginary part of a complex number
6b32f9fc
SK
672
673@table @asis
674@item @emph{Description}:
675@code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
6970fcc8
SK
676The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
677for compatibility with @command{g77}, and their use in new code is
678strongly discouraged.
6b32f9fc 679
cd051390
DF
680@item @emph{Standard}:
681F77 and later, has overloads that are GNU extensions
6b32f9fc 682
eaef357b 683@item @emph{Class}:
cd051390 684Elemental function
6b32f9fc
SK
685
686@item @emph{Syntax}:
d565bb3a 687@code{RESULT = AIMAG(Z)}
6b32f9fc
SK
688
689@item @emph{Arguments}:
690@multitable @columnfractions .15 .80
691@item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
692@end multitable
693
694@item @emph{Return value}:
695The return value is of type real with the
696kind type parameter of the argument.
697
698@item @emph{Example}:
699@smallexample
700program test_aimag
701 complex(4) z4
702 complex(8) z8
703 z4 = cmplx(1.e0_4, 0.e0_4)
704 z8 = cmplx(0.e0_8, 1.e0_8)
705 print *, aimag(z4), dimag(z8)
706end program test_aimag
707@end smallexample
708
709@item @emph{Specific names}:
cd051390
DF
710@multitable @columnfractions .20 .20 .20 .40
711@item Name @tab Argument @tab Return type @tab Standard
0e7e7e6e 712@item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab GNU extension
cd051390
DF
713@item @code{IMAG(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
714@item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
6b32f9fc
SK
715@end multitable
716@end table
717
718
eaef357b 719
6b32f9fc 720@node AINT
cd051390 721@section @code{AINT} --- Truncate to a whole number
4ba96c02
BM
722@cindex @code{AINT} intrinsic
723@cindex @code{DINT} intrinsic
6b32f9fc
SK
724@cindex whole number
725
726@table @asis
727@item @emph{Description}:
728@code{AINT(X [, KIND])} truncates its argument to a whole number.
729
cd051390
DF
730@item @emph{Standard}:
731F77 and later
6b32f9fc 732
eaef357b 733@item @emph{Class}:
cd051390 734Elemental function
6b32f9fc
SK
735
736@item @emph{Syntax}:
d565bb3a 737@code{RESULT = AINT(X [, KIND])}
6b32f9fc
SK
738
739@item @emph{Arguments}:
740@multitable @columnfractions .15 .80
741@item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
d3dfa1fe
BM
742@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
743 expression indicating the kind parameter of
744 the result.
6b32f9fc
SK
745@end multitable
746
747@item @emph{Return value}:
748The return value is of type real with the kind type parameter of the
323d0f0b 749argument if the optional @var{KIND} is absent; otherwise, the kind
6b32f9fc
SK
750type parameter will be given by @var{KIND}. If the magnitude of
751@var{X} is less than one, then @code{AINT(X)} returns zero. If the
752magnitude is equal to or greater than one, then it returns the largest
753whole number that does not exceed its magnitude. The sign is the same
754as the sign of @var{X}.
755
756@item @emph{Example}:
757@smallexample
758program test_aint
759 real(4) x4
760 real(8) x8
761 x4 = 1.234E0_4
762 x8 = 4.321_8
763 print *, aint(x4), dint(x8)
764 x8 = aint(x4,8)
765end program test_aint
766@end smallexample
767
768@item @emph{Specific names}:
cd051390
DF
769@multitable @columnfractions .20 .20 .20 .40
770@item Name @tab Argument @tab Return type @tab Standard
771@item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6b32f9fc
SK
772@end multitable
773@end table
774
775
eaef357b 776
185d7d97
FXC
777@node ALARM
778@section @code{ALARM} --- Execute a routine after a given delay
4ba96c02 779@cindex @code{ALARM} intrinsic
185d7d97
FXC
780
781@table @asis
782@item @emph{Description}:
cd051390 783@code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
185d7d97
FXC
784to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
785set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
786supplied, it will be returned with the number of seconds remaining until
787any previously scheduled alarm was due to be delivered, or zero if there
788was no previously scheduled alarm.
789
cd051390
DF
790@item @emph{Standard}:
791GNU extension
185d7d97
FXC
792
793@item @emph{Class}:
cd051390 794Subroutine
185d7d97
FXC
795
796@item @emph{Syntax}:
0c5a1cbc 797@code{CALL ALARM(SECONDS, HANDLER [, STATUS])}
185d7d97
FXC
798
799@item @emph{Arguments}:
800@multitable @columnfractions .15 .80
801@item @var{SECONDS} @tab The type of the argument shall be a scalar
802@code{INTEGER}. It is @code{INTENT(IN)}.
803@item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
804@code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
805@code{INTEGER}. It is @code{INTENT(IN)}.
806@item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
807@code{INTEGER} variable. It is @code{INTENT(OUT)}.
808@end multitable
809
810@item @emph{Example}:
811@smallexample
812program test_alarm
813 external handler_print
814 integer i
815 call alarm (3, handler_print, i)
816 print *, i
817 call sleep(10)
818end program test_alarm
819@end smallexample
820This will cause the external routine @var{handler_print} to be called
821after 3 seconds.
822@end table
823
824
825
6b32f9fc
SK
826@node ALL
827@section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
4ba96c02 828@cindex @code{ALL} intrinsic
6b32f9fc
SK
829@cindex true values
830
831@table @asis
832@item @emph{Description}:
833@code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
834in the array along dimension @var{DIM}.
835
cd051390
DF
836@item @emph{Standard}:
837F95 and later
6b32f9fc 838
eaef357b 839@item @emph{Class}:
6b32f9fc
SK
840transformational function
841
842@item @emph{Syntax}:
d565bb3a 843@code{RESULT = ALL(MASK [, DIM])}
6b32f9fc
SK
844
845@item @emph{Arguments}:
846@multitable @columnfractions .15 .80
847@item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
848it shall not be scalar.
849@item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
850with a value that lies between one and the rank of @var{MASK}.
851@end multitable
852
853@item @emph{Return value}:
854@code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
855the kind type parameter is the same as the kind type parameter of
856@var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
857an array with the rank of @var{MASK} minus 1. The shape is determined from
858the shape of @var{MASK} where the @var{DIM} dimension is elided.
859
860@table @asis
861@item (A)
862@code{ALL(MASK)} is true if all elements of @var{MASK} are true.
863It also is true if @var{MASK} has zero size; otherwise, it is false.
864@item (B)
865If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
866to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
867is determined by applying @code{ALL} to the array sections.
868@end table
869
870@item @emph{Example}:
871@smallexample
872program test_all
873 logical l
874 l = all((/.true., .true., .true./))
875 print *, l
876 call section
877 contains
878 subroutine section
879 integer a(2,3), b(2,3)
880 a = 1
881 b = 1
882 b(2,2) = 2
883 print *, all(a .eq. b, 1)
884 print *, all(a .eq. b, 2)
885 end subroutine section
886end program test_all
887@end smallexample
888@end table
8db2ba40 889
6230d276 890
a6334742 891
6230d276
SK
892@node ALLOCATED
893@section @code{ALLOCATED} --- Status of an allocatable entity
4ba96c02 894@cindex @code{ALLOCATED} intrinsic
6230d276
SK
895@cindex allocation status
896
897@table @asis
898@item @emph{Description}:
323d0f0b 899@code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
6230d276 900
cd051390
DF
901@item @emph{Standard}:
902F95 and later
6230d276 903
eaef357b 904@item @emph{Class}:
cd051390 905Inquiry function
6230d276
SK
906
907@item @emph{Syntax}:
d565bb3a 908@code{RESULT = ALLOCATED(X)}
6230d276
SK
909
910@item @emph{Arguments}:
911@multitable @columnfractions .15 .80
912@item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
913@end multitable
914
915@item @emph{Return value}:
916The return value is a scalar @code{LOGICAL} with the default logical
917kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
918is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
919
920@item @emph{Example}:
921@smallexample
922program test_allocated
923 integer :: i = 4
924 real(4), allocatable :: x(:)
cd051390 925 if (allocated(x) .eqv. .false.) allocate(x(i))
6230d276
SK
926end program test_allocated
927@end smallexample
928@end table
929
930
cd051390 931@node AND
fe284266 932@section @code{AND} --- Bitwise logical AND
4ba96c02 933@cindex @code{AND} intrinsic
fe284266 934@cindex bit operations
cd051390
DF
935
936@table @asis
937@item @emph{Description}:
fe284266
DF
938Bitwise logical @code{AND}.
939
940This intrinsic routine is provided for backwards compatibility with
941GNU Fortran 77. For integer arguments, programmers should consider
942the use of the @ref{IAND} intrinsic defined by the Fortran standard.
943
cd051390 944@item @emph{Standard}:
fe284266
DF
945GNU extension
946
cd051390 947@item @emph{Class}:
fe284266
DF
948Non-elemental function
949
cd051390 950@item @emph{Syntax}:
fe284266
DF
951@code{RESULT = AND(X, Y)}
952
cd051390 953@item @emph{Arguments}:
fe284266
DF
954@multitable @columnfractions .15 .80
955@item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
956@item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
957@end multitable
958
cd051390 959@item @emph{Return value}:
fe284266
DF
960The return type is either @code{INTEGER(*)} or @code{LOGICAL} after
961cross-promotion of the arguments.
962
cd051390 963@item @emph{Example}:
fe284266
DF
964@smallexample
965PROGRAM test_and
966 LOGICAL :: T = .TRUE., F = ..FALSE.
967 INTEGER :: a, b
968 DATA a / Z'F' /, b / Z'3' /
969
970 WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
971 WRITE (*,*) AND(a, b)
972END PROGRAM
973@end smallexample
974
cd051390 975@item @emph{See also}:
fe284266 976F95 elemental function: @ref{IAND}
cd051390
DF
977@end table
978
979
eaef357b 980
6230d276 981@node ANINT
3a3977a8 982@section @code{ANINT} --- Nearest whole number
4ba96c02
BM
983@cindex @code{ANINT} intrinsic
984@cindex @code{DNINT} intrinsic
6230d276
SK
985@cindex whole number
986
987@table @asis
988@item @emph{Description}:
989@code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
990
cd051390
DF
991@item @emph{Standard}:
992F77 and later
6230d276 993
eaef357b 994@item @emph{Class}:
cd051390 995Elemental function
6230d276
SK
996
997@item @emph{Syntax}:
d565bb3a 998@code{RESULT = ANINT(X [, KIND])}
6230d276
SK
999
1000@item @emph{Arguments}:
1001@multitable @columnfractions .15 .80
1002@item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
d3dfa1fe
BM
1003@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
1004 expression indicating the kind parameter of
1005 the result.
6230d276
SK
1006@end multitable
1007
1008@item @emph{Return value}:
1009The return value is of type real with the kind type parameter of the
323d0f0b 1010argument if the optional @var{KIND} is absent; otherwise, the kind
6230d276
SK
1011type parameter will be given by @var{KIND}. If @var{X} is greater than
1012zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
cd051390 1013less than or equal to zero, then it returns @code{AINT(X-0.5)}.
6230d276
SK
1014
1015@item @emph{Example}:
1016@smallexample
1017program test_anint
1018 real(4) x4
1019 real(8) x8
1020 x4 = 1.234E0_4
1021 x8 = 4.321_8
1022 print *, anint(x4), dnint(x8)
1023 x8 = anint(x4,8)
1024end program test_anint
1025@end smallexample
1026
1027@item @emph{Specific names}:
cd051390
DF
1028@multitable @columnfractions .20 .20 .20 .40
1029@item Name @tab Argument @tab Return type @tab Standard
1030@item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6230d276
SK
1031@end multitable
1032@end table
1033
1034
eaef357b 1035
6230d276
SK
1036@node ANY
1037@section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
4ba96c02 1038@cindex @code{ANY} intrinsic
6230d276
SK
1039@cindex true values
1040
1041@table @asis
1042@item @emph{Description}:
f60d6481
JD
1043@code{ANY(MASK [, DIM])} determines if any of the values in the logical array
1044@var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
6230d276 1045
cd051390
DF
1046@item @emph{Standard}:
1047F95 and later
6230d276 1048
eaef357b 1049@item @emph{Class}:
6230d276
SK
1050transformational function
1051
1052@item @emph{Syntax}:
d565bb3a 1053@code{RESULT = ANY(MASK [, DIM])}
6230d276
SK
1054
1055@item @emph{Arguments}:
1056@multitable @columnfractions .15 .80
1057@item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
1058it shall not be scalar.
1059@item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
1060with a value that lies between one and the rank of @var{MASK}.
1061@end multitable
1062
1063@item @emph{Return value}:
1064@code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
1065the kind type parameter is the same as the kind type parameter of
1066@var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
1067an array with the rank of @var{MASK} minus 1. The shape is determined from
1068the shape of @var{MASK} where the @var{DIM} dimension is elided.
1069
1070@table @asis
1071@item (A)
1072@code{ANY(MASK)} is true if any element of @var{MASK} is true;
1073otherwise, it is false. It also is false if @var{MASK} has zero size.
1074@item (B)
1075If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
1076to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
1077is determined by applying @code{ANY} to the array sections.
1078@end table
1079
1080@item @emph{Example}:
1081@smallexample
1082program test_any
1083 logical l
1084 l = any((/.true., .true., .true./))
1085 print *, l
1086 call section
1087 contains
1088 subroutine section
1089 integer a(2,3), b(2,3)
1090 a = 1
1091 b = 1
1092 b(2,2) = 2
1093 print *, any(a .eq. b, 1)
1094 print *, any(a .eq. b, 2)
1095 end subroutine section
1096end program test_any
1097@end smallexample
1098@end table
1099
1100
eaef357b 1101
6230d276
SK
1102@node ASIN
1103@section @code{ASIN} --- Arcsine function
4ba96c02
BM
1104@cindex @code{ASIN} intrinsic
1105@cindex @code{DASIN} intrinsic
cd051390 1106@cindex trigonometric functions (inverse)
6230d276
SK
1107
1108@table @asis
1109@item @emph{Description}:
fe284266 1110@code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
6230d276 1111
cd051390
DF
1112@item @emph{Standard}:
1113F77 and later
6230d276 1114
eaef357b 1115@item @emph{Class}:
cd051390 1116Elemental function
6230d276
SK
1117
1118@item @emph{Syntax}:
d565bb3a 1119@code{RESULT = ASIN(X)}
6230d276
SK
1120
1121@item @emph{Arguments}:
1122@multitable @columnfractions .15 .80
eaef357b 1123@item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
6230d276
SK
1124less than one.
1125@end multitable
1126
1127@item @emph{Return value}:
1128The return value is of type @code{REAL(*)} and it lies in the
fe284266 1129range @math{-\pi / 2 \leq \asin (x) \leq \pi / 2}. The kind type
6230d276
SK
1130parameter is the same as @var{X}.
1131
1132@item @emph{Example}:
1133@smallexample
1134program test_asin
1135 real(8) :: x = 0.866_8
1136 x = asin(x)
1137end program test_asin
1138@end smallexample
1139
1140@item @emph{Specific names}:
cd051390
DF
1141@multitable @columnfractions .20 .20 .20 .40
1142@item Name @tab Argument @tab Return type @tab Standard
1143@item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6230d276 1144@end multitable
cd051390
DF
1145
1146@item @emph{See also}:
1147Inverse function: @ref{SIN}
1148
1149@end table
1150
1151
1152@node ASINH
1153@section @code{ASINH} --- Hyperbolic arcsine function
4ba96c02 1154@cindex @code{ASINH} intrinsic
cd051390
DF
1155@cindex hyperbolic arcsine
1156@cindex hyperbolic sine (inverse)
1157
cd051390
DF
1158@table @asis
1159@item @emph{Description}:
fe284266
DF
1160@code{ASINH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{SINH(X)}).
1161
cd051390 1162@item @emph{Standard}:
fe284266
DF
1163GNU extension
1164
cd051390 1165@item @emph{Class}:
fe284266
DF
1166Elemental function
1167
cd051390 1168@item @emph{Syntax}:
d565bb3a 1169@code{RESULT = ASINH(X)}
fe284266 1170
cd051390 1171@item @emph{Arguments}:
fe284266
DF
1172@multitable @columnfractions .15 .80
1173@item @var{X} @tab The type shall be @code{REAL(*)}, with @var{X} a real number.
1174@end multitable
1175
cd051390 1176@item @emph{Return value}:
fe284266
DF
1177The return value is of type @code{REAL(*)} and it lies in the
1178range @math{-\infty \leq \asinh (x) \leq \infty}.
1179
cd051390 1180@item @emph{Example}:
fe284266
DF
1181@smallexample
1182PROGRAM test_asinh
1183 REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1184 WRITE (*,*) ASINH(x)
1185END PROGRAM
1186@end smallexample
1187
cd051390 1188@item @emph{See also}:
fe284266 1189Inverse function: @ref{SINH}
6230d276
SK
1190@end table
1191
1192
eaef357b 1193
a6334742
SK
1194@node ASSOCIATED
1195@section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
4ba96c02 1196@cindex @code{ASSOCIATED} intrinsic
a6334742
SK
1197@cindex pointer status
1198
1199@table @asis
1200@item @emph{Description}:
1201@code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1202or if @var{PTR} is associated with the target @var{TGT}.
1203
cd051390
DF
1204@item @emph{Standard}:
1205F95 and later
a6334742 1206
eaef357b 1207@item @emph{Class}:
cd051390 1208Inquiry function
a6334742
SK
1209
1210@item @emph{Syntax}:
d565bb3a 1211@code{RESULT = ASSOCIATED(PTR [, TGT])}
a6334742
SK
1212
1213@item @emph{Arguments}:
1214@multitable @columnfractions .15 .80
1215@item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1216it can be of any type.
1217@item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1218a @code{TARGET}. It must have the same type, kind type parameter, and
1219array rank as @var{PTR}.
1220@end multitable
1221The status of neither @var{PTR} nor @var{TGT} can be undefined.
1222
1223@item @emph{Return value}:
1224@code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1225There are several cases:
1226@table @asis
1227@item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1228is true if @var{PTR} is associated with a target; otherwise, it returns false.
1229@item (B) If @var{TGT} is present and a scalar target, the result is true if
1230@var{TGT}
1231is not a 0 sized storage sequence and the target associated with @var{PTR}
1232occupies the same storage units. If @var{PTR} is disassociated, then the
1233result is false.
1234@item (C) If @var{TGT} is present and an array target, the result is true if
1235@var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1236arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1237@var{PTR} occupy the same storage units in array element order.
1238As in case(B), the result is false, if @var{PTR} is disassociated.
1239@item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1240target associated with @var{PTR} and the target associated with @var{TGT}
1241are not 0 sized storage sequences and occupy the same storage units.
1242The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1243@item (E) If @var{TGT} is present and an array pointer, the result is true if
357877ed 1244target associated with @var{PTR} and the target associated with @var{TGT}
a6334742
SK
1245have the same shape, are not 0 sized arrays, are arrays whose elements are
1246not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1247storage units in array element order.
1248The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1249@end table
1250
1251@item @emph{Example}:
1252@smallexample
1253program test_associated
1254 implicit none
1255 real, target :: tgt(2) = (/1., 2./)
1256 real, pointer :: ptr(:)
1257 ptr => tgt
1258 if (associated(ptr) .eqv. .false.) call abort
1259 if (associated(ptr,tgt) .eqv. .false.) call abort
1260end program test_associated
1261@end smallexample
cd051390
DF
1262
1263@item @emph{See also}:
1264@ref{NULL}
a6334742
SK
1265@end table
1266
1267
eaef357b 1268
f7cdcbf1
FXC
1269@node ATAN
1270@section @code{ATAN} --- Arctangent function
4ba96c02
BM
1271@cindex @code{ATAN} intrinsic
1272@cindex @code{DATAN} intrinsic
cd051390 1273@cindex trigonometric functions (inverse)
f7cdcbf1
FXC
1274
1275@table @asis
1276@item @emph{Description}:
1277@code{ATAN(X)} computes the arctangent of @var{X}.
1278
cd051390
DF
1279@item @emph{Standard}:
1280F77 and later
f7cdcbf1 1281
eaef357b 1282@item @emph{Class}:
cd051390 1283Elemental function
f7cdcbf1
FXC
1284
1285@item @emph{Syntax}:
d565bb3a 1286@code{RESULT = ATAN(X)}
f7cdcbf1
FXC
1287
1288@item @emph{Arguments}:
1289@multitable @columnfractions .15 .80
eaef357b 1290@item @var{X} @tab The type shall be @code{REAL(*)}.
f7cdcbf1
FXC
1291@end multitable
1292
1293@item @emph{Return value}:
1294The return value is of type @code{REAL(*)} and it lies in the
fe284266 1295range @math{ - \pi / 2 \leq \atan (x) \leq \pi / 2}.
f7cdcbf1
FXC
1296
1297@item @emph{Example}:
1298@smallexample
1299program test_atan
1300 real(8) :: x = 2.866_8
1301 x = atan(x)
1302end program test_atan
1303@end smallexample
1304
1305@item @emph{Specific names}:
cd051390
DF
1306@multitable @columnfractions .20 .20 .20 .40
1307@item Name @tab Argument @tab Return type @tab Standard
1308@item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
f7cdcbf1 1309@end multitable
cd051390
DF
1310
1311@item @emph{See also}:
1312Inverse function: @ref{TAN}
1313
f7cdcbf1
FXC
1314@end table
1315
1316
eaef357b 1317
a6334742
SK
1318@node ATAN2
1319@section @code{ATAN2} --- Arctangent function
4ba96c02
BM
1320@cindex @code{ATAN2} intrinsic
1321@cindex @code{DATAN2} intrinsic
cd051390 1322@cindex trigonometric functions (inverse)
a6334742
SK
1323
1324@table @asis
1325@item @emph{Description}:
1326@code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1327
cd051390
DF
1328@item @emph{Standard}:
1329F77 and later
a6334742 1330
eaef357b 1331@item @emph{Class}:
cd051390 1332Elemental function
a6334742
SK
1333
1334@item @emph{Syntax}:
d565bb3a 1335@code{RESULT = ATAN2(Y,X)}
a6334742
SK
1336
1337@item @emph{Arguments}:
1338@multitable @columnfractions .15 .80
1339@item @var{Y} @tab The type shall be @code{REAL(*)}.
357877ed 1340@item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
a6334742
SK
1341If @var{Y} is zero, then @var{X} must be nonzero.
1342@end multitable
1343
1344@item @emph{Return value}:
357877ed 1345The return value has the same type and kind type parameter as @var{Y}.
cd051390 1346It is the principal value of the complex number @math{X + i Y}. If
fe284266 1347@var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
a6334742
SK
1348The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
1349the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1350is negative. Finally, if @var{X} is zero, then the magnitude of the result
1351is @math{\pi/2}.
1352
1353@item @emph{Example}:
1354@smallexample
1355program test_atan2
1356 real(4) :: x = 1.e0_4, y = 0.5e0_4
1357 x = atan2(y,x)
1358end program test_atan2
1359@end smallexample
1360
1361@item @emph{Specific names}:
cd051390
DF
1362@multitable @columnfractions .20 .20 .20 .40
1363@item Name @tab Argument @tab Return type @tab Standard
1364@item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
a6334742
SK
1365@end multitable
1366@end table
1367
f7cdcbf1 1368
eaef357b 1369
cd051390
DF
1370@node ATANH
1371@section @code{ATANH} --- Hyperbolic arctangent function
4ba96c02 1372@cindex @code{ASINH} intrinsic
cd051390
DF
1373@cindex hyperbolic arctangent
1374@cindex hyperbolic tangent (inverse)
1375
cd051390
DF
1376@table @asis
1377@item @emph{Description}:
fe284266
DF
1378@code{ATANH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{TANH(X)}).
1379
cd051390 1380@item @emph{Standard}:
fe284266
DF
1381GNU extension
1382
cd051390 1383@item @emph{Class}:
fe284266
DF
1384Elemental function
1385
cd051390 1386@item @emph{Syntax}:
d565bb3a 1387@code{RESULT = ATANH(X)}
fe284266 1388
cd051390 1389@item @emph{Arguments}:
fe284266 1390@multitable @columnfractions .15 .80
ea8dda63
BM
1391@item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude
1392that is less than or equal to one.
fe284266
DF
1393@end multitable
1394
cd051390 1395@item @emph{Return value}:
fe284266
DF
1396The return value is of type @code{REAL(*)} and it lies in the
1397range @math{-\infty \leq \atanh(x) \leq \infty}.
1398
cd051390 1399@item @emph{Example}:
fe284266
DF
1400@smallexample
1401PROGRAM test_atanh
1402 REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1403 WRITE (*,*) ATANH(x)
1404END PROGRAM
1405@end smallexample
1406
cd051390 1407@item @emph{See also}:
fe284266 1408Inverse function: @ref{TANH}
cd051390
DF
1409@end table
1410
1411
1412
1413
f7cdcbf1
FXC
1414@node BESJ0
1415@section @code{BESJ0} --- Bessel function of the first kind of order 0
4ba96c02
BM
1416@cindex @code{BESJ0} intrinsic
1417@cindex @code{DBESJ0} intrinsic
f7cdcbf1
FXC
1418@cindex Bessel
1419
1420@table @asis
1421@item @emph{Description}:
1422@code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1423of @var{X}.
1424
cd051390
DF
1425@item @emph{Standard}:
1426GNU extension
f7cdcbf1 1427
eaef357b 1428@item @emph{Class}:
cd051390 1429Elemental function
f7cdcbf1
FXC
1430
1431@item @emph{Syntax}:
d565bb3a 1432@code{RESULT = BESJ0(X)}
f7cdcbf1
FXC
1433
1434@item @emph{Arguments}:
1435@multitable @columnfractions .15 .80
eaef357b 1436@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
1437@end multitable
1438
1439@item @emph{Return value}:
1440The return value is of type @code{REAL(*)} and it lies in the
1441range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1442
1443@item @emph{Example}:
1444@smallexample
1445program test_besj0
1446 real(8) :: x = 0.0_8
1447 x = besj0(x)
1448end program test_besj0
1449@end smallexample
1450
1451@item @emph{Specific names}:
cd051390
DF
1452@multitable @columnfractions .20 .20 .20 .40
1453@item Name @tab Argument @tab Return type @tab Standard
1454@item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
f7cdcbf1
FXC
1455@end multitable
1456@end table
1457
1458
1459
1460@node BESJ1
1461@section @code{BESJ1} --- Bessel function of the first kind of order 1
4ba96c02
BM
1462@cindex @code{BESJ1} intrinsic
1463@cindex @code{DBESJ1} intrinsic
f7cdcbf1
FXC
1464@cindex Bessel
1465
1466@table @asis
1467@item @emph{Description}:
1468@code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1469of @var{X}.
1470
cd051390
DF
1471@item @emph{Standard}:
1472GNU extension
f7cdcbf1 1473
eaef357b 1474@item @emph{Class}:
cd051390 1475Elemental function
f7cdcbf1
FXC
1476
1477@item @emph{Syntax}:
d565bb3a 1478@code{RESULT = BESJ1(X)}
f7cdcbf1
FXC
1479
1480@item @emph{Arguments}:
1481@multitable @columnfractions .15 .80
eaef357b 1482@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
1483@end multitable
1484
1485@item @emph{Return value}:
1486The return value is of type @code{REAL(*)} and it lies in the
1487range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1488
1489@item @emph{Example}:
1490@smallexample
1491program test_besj1
1492 real(8) :: x = 1.0_8
1493 x = besj1(x)
1494end program test_besj1
1495@end smallexample
1496
1497@item @emph{Specific names}:
cd051390
DF
1498@multitable @columnfractions .20 .20 .20 .40
1499@item Name @tab Argument @tab Return type @tab Standard
1500@item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
f7cdcbf1
FXC
1501@end multitable
1502@end table
1503
1504
1505
1506@node BESJN
1507@section @code{BESJN} --- Bessel function of the first kind
4ba96c02
BM
1508@cindex @code{BESJN} intrinsic
1509@cindex @code{DBESJN} intrinsic
f7cdcbf1
FXC
1510@cindex Bessel
1511
1512@table @asis
1513@item @emph{Description}:
1514@code{BESJN(N, X)} computes the Bessel function of the first kind of order
1515@var{N} of @var{X}.
1516
cd051390
DF
1517@item @emph{Standard}:
1518GNU extension
f7cdcbf1 1519
eaef357b 1520@item @emph{Class}:
cd051390 1521Elemental function
f7cdcbf1
FXC
1522
1523@item @emph{Syntax}:
d565bb3a 1524@code{RESULT = BESJN(N, X)}
f7cdcbf1
FXC
1525
1526@item @emph{Arguments}:
1527@multitable @columnfractions .15 .80
eaef357b
JD
1528@item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1529@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
1530@end multitable
1531
1532@item @emph{Return value}:
a6334742 1533The return value is a scalar of type @code{REAL(*)}.
f7cdcbf1
FXC
1534
1535@item @emph{Example}:
1536@smallexample
1537program test_besjn
1538 real(8) :: x = 1.0_8
1539 x = besjn(5,x)
1540end program test_besjn
1541@end smallexample
1542
1543@item @emph{Specific names}:
cd051390
DF
1544@multitable @columnfractions .20 .20 .20 .40
1545@item Name @tab Argument @tab Return type @tab Standard
1546@item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
a6334742 1547@item @tab @code{REAL(8) X} @tab @tab
f7cdcbf1
FXC
1548@end multitable
1549@end table
1550
1551
1552
1553@node BESY0
1554@section @code{BESY0} --- Bessel function of the second kind of order 0
4ba96c02
BM
1555@cindex @code{BESY0} intrinsic
1556@cindex @code{DBESY0} intrinsic
f7cdcbf1
FXC
1557@cindex Bessel
1558
1559@table @asis
1560@item @emph{Description}:
1561@code{BESY0(X)} computes the Bessel function of the second kind of order 0
1562of @var{X}.
1563
cd051390
DF
1564@item @emph{Standard}:
1565GNU extension
f7cdcbf1 1566
eaef357b 1567@item @emph{Class}:
cd051390 1568Elemental function
f7cdcbf1
FXC
1569
1570@item @emph{Syntax}:
d565bb3a 1571@code{RESULT = BESY0(X)}
f7cdcbf1
FXC
1572
1573@item @emph{Arguments}:
1574@multitable @columnfractions .15 .80
eaef357b 1575@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
1576@end multitable
1577
1578@item @emph{Return value}:
a6334742 1579The return value is a scalar of type @code{REAL(*)}.
f7cdcbf1
FXC
1580
1581@item @emph{Example}:
1582@smallexample
1583program test_besy0
1584 real(8) :: x = 0.0_8
1585 x = besy0(x)
1586end program test_besy0
1587@end smallexample
1588
1589@item @emph{Specific names}:
cd051390
DF
1590@multitable @columnfractions .20 .20 .20 .40
1591@item Name @tab Argument @tab Return type @tab Standard
1592@item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
f7cdcbf1
FXC
1593@end multitable
1594@end table
1595
1596
1597
1598@node BESY1
1599@section @code{BESY1} --- Bessel function of the second kind of order 1
4ba96c02
BM
1600@cindex @code{BESY1} intrinsic
1601@cindex @code{DBESY1} intrinsic
f7cdcbf1
FXC
1602@cindex Bessel
1603
1604@table @asis
1605@item @emph{Description}:
1606@code{BESY1(X)} computes the Bessel function of the second kind of order 1
1607of @var{X}.
1608
cd051390
DF
1609@item @emph{Standard}:
1610GNU extension
f7cdcbf1 1611
eaef357b 1612@item @emph{Class}:
cd051390 1613Elemental function
f7cdcbf1
FXC
1614
1615@item @emph{Syntax}:
d565bb3a 1616@code{RESULT = BESY1(X)}
f7cdcbf1
FXC
1617
1618@item @emph{Arguments}:
1619@multitable @columnfractions .15 .80
eaef357b 1620@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
1621@end multitable
1622
1623@item @emph{Return value}:
a6334742 1624The return value is a scalar of type @code{REAL(*)}.
f7cdcbf1
FXC
1625
1626@item @emph{Example}:
1627@smallexample
1628program test_besy1
1629 real(8) :: x = 1.0_8
1630 x = besy1(x)
1631end program test_besy1
1632@end smallexample
1633
1634@item @emph{Specific names}:
cd051390
DF
1635@multitable @columnfractions .20 .20 .20 .40
1636@item Name @tab Argument @tab Return type @tab Standard
1637@item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
f7cdcbf1
FXC
1638@end multitable
1639@end table
1640
1641
1642
1643@node BESYN
1644@section @code{BESYN} --- Bessel function of the second kind
4ba96c02
BM
1645@cindex @code{BESYN} intrinsic
1646@cindex @code{DBESYN} intrinsic
f7cdcbf1
FXC
1647@cindex Bessel
1648
1649@table @asis
1650@item @emph{Description}:
1651@code{BESYN(N, X)} computes the Bessel function of the second kind of order
1652@var{N} of @var{X}.
1653
cd051390
DF
1654@item @emph{Standard}:
1655GNU extension
f7cdcbf1 1656
eaef357b 1657@item @emph{Class}:
cd051390 1658Elemental function
f7cdcbf1
FXC
1659
1660@item @emph{Syntax}:
d565bb3a 1661@code{RESULT = BESYN(N, X)}
f7cdcbf1
FXC
1662
1663@item @emph{Arguments}:
1664@multitable @columnfractions .15 .80
eaef357b
JD
1665@item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1666@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
1667@end multitable
1668
1669@item @emph{Return value}:
a6334742 1670The return value is a scalar of type @code{REAL(*)}.
f7cdcbf1
FXC
1671
1672@item @emph{Example}:
1673@smallexample
1674program test_besyn
1675 real(8) :: x = 1.0_8
1676 x = besyn(5,x)
1677end program test_besyn
1678@end smallexample
1679
1680@item @emph{Specific names}:
cd051390
DF
1681@multitable @columnfractions .20 .20 .20 .40
1682@item Name @tab Argument @tab Return type @tab Standard
1683@item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
a6334742 1684@item @tab @code{REAL(8) X} @tab @tab
f7cdcbf1
FXC
1685@end multitable
1686@end table
1687
1688
eaef357b
JD
1689
1690@node BIT_SIZE
1691@section @code{BIT_SIZE} --- Bit size inquiry function
4ba96c02
BM
1692@cindex @code{BIT_SIZE} intrinsic
1693@cindex bit size of a variable
1694@cindex size of a variable, in bits
eaef357b
JD
1695
1696@table @asis
1697@item @emph{Description}:
f60d6481
JD
1698@code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1699represented by the type of @var{I}.
eaef357b 1700
cd051390
DF
1701@item @emph{Standard}:
1702F95 and later
eaef357b
JD
1703
1704@item @emph{Class}:
cd051390 1705Inquiry function
eaef357b
JD
1706
1707@item @emph{Syntax}:
d565bb3a 1708@code{RESULT = BIT_SIZE(I)}
eaef357b
JD
1709
1710@item @emph{Arguments}:
1711@multitable @columnfractions .15 .80
1712@item @var{I} @tab The type shall be @code{INTEGER(*)}.
1713@end multitable
1714
1715@item @emph{Return value}:
1716The return value is of type @code{INTEGER(*)}
1717
1718@item @emph{Example}:
1719@smallexample
1720program test_bit_size
1721 integer :: i = 123
1722 integer :: size
1723 size = bit_size(i)
1724 print *, size
1725end program test_bit_size
1726@end smallexample
1727@end table
1728
1729
1730
1731@node BTEST
1732@section @code{BTEST} --- Bit test function
4ba96c02 1733@cindex @code{BTEST} intrinsic
21825fd6 1734@cindex bit operations
eaef357b
JD
1735
1736@table @asis
1737@item @emph{Description}:
f60d6481
JD
1738@code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1739in @var{I} is set.
eaef357b 1740
cd051390
DF
1741@item @emph{Standard}:
1742F95 and later
eaef357b
JD
1743
1744@item @emph{Class}:
cd051390 1745Elemental function
eaef357b
JD
1746
1747@item @emph{Syntax}:
d565bb3a 1748@code{RESULT = BTEST(I, POS)}
eaef357b
JD
1749
1750@item @emph{Arguments}:
1751@multitable @columnfractions .15 .80
1752@item @var{I} @tab The type shall be @code{INTEGER(*)}.
1753@item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1754@end multitable
1755
1756@item @emph{Return value}:
1757The return value is of type @code{LOGICAL}
1758
1759@item @emph{Example}:
1760@smallexample
1761program test_btest
1762 integer :: i = 32768 + 1024 + 64
1763 integer :: pos
1764 logical :: bool
1765 do pos=0,16
1766 bool = btest(i, pos)
1767 print *, pos, bool
1768 end do
1769end program test_btest
1770@end smallexample
1771@end table
1772
1773
1774
1775@node CEILING
1776@section @code{CEILING} --- Integer ceiling function
4ba96c02
BM
1777@cindex @code{CEILING} intrinsic
1778@cindex ceiling
eaef357b
JD
1779
1780@table @asis
1781@item @emph{Description}:
323d0f0b 1782@code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
eaef357b 1783
cd051390
DF
1784@item @emph{Standard}:
1785F95 and later
eaef357b
JD
1786
1787@item @emph{Class}:
cd051390 1788Elemental function
eaef357b
JD
1789
1790@item @emph{Syntax}:
d565bb3a 1791@code{RESULT = CEILING(X [, KIND])}
eaef357b
JD
1792
1793@item @emph{Arguments}:
1794@multitable @columnfractions .15 .80
1795@item @var{X} @tab The type shall be @code{REAL(*)}.
d3dfa1fe
BM
1796@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
1797 expression indicating the kind parameter of
1798 the result.
eaef357b
JD
1799@end multitable
1800
1801@item @emph{Return value}:
1802The return value is of type @code{INTEGER(KIND)}
1803
1804@item @emph{Example}:
1805@smallexample
1806program test_ceiling
1807 real :: x = 63.29
1808 real :: y = -63.59
1809 print *, ceiling(x) ! returns 64
1810 print *, ceiling(y) ! returns -63
1811end program test_ceiling
1812@end smallexample
cd051390
DF
1813
1814@item @emph{See also}:
1815@ref{FLOOR}, @ref{NINT}
1816
eaef357b
JD
1817@end table
1818
1819
1820
1821@node CHAR
1822@section @code{CHAR} --- Character conversion function
4ba96c02 1823@cindex @code{CHAR} intrinsic
cd051390 1824@cindex conversion function (character)
eaef357b
JD
1825
1826@table @asis
1827@item @emph{Description}:
d3dfa1fe 1828@code{CHAR(I [, KIND])} returns the character represented by the integer @var{I}.
eaef357b 1829
cd051390
DF
1830@item @emph{Standard}:
1831F77 and later
eaef357b
JD
1832
1833@item @emph{Class}:
cd051390 1834Elemental function
eaef357b
JD
1835
1836@item @emph{Syntax}:
d565bb3a 1837@code{RESULT = CHAR(I [, KIND])}
eaef357b
JD
1838
1839@item @emph{Arguments}:
1840@multitable @columnfractions .15 .80
1841@item @var{I} @tab The type shall be @code{INTEGER(*)}.
d3dfa1fe
BM
1842@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
1843 expression indicating the kind parameter of
1844 the result.
eaef357b
JD
1845@end multitable
1846
1847@item @emph{Return value}:
1848The return value is of type @code{CHARACTER(1)}
1849
1850@item @emph{Example}:
1851@smallexample
1852program test_char
1853 integer :: i = 74
1854 character(1) :: c
1855 c = char(i)
1856 print *, i, c ! returns 'J'
1857end program test_char
1858@end smallexample
cd051390
DF
1859
1860@item @emph{See also}:
7f4e7e0f 1861@ref{ACHAR}, @ref{IACHAR}, @ref{ICHAR}
cd051390
DF
1862
1863@end table
1864
1865
1866@node CHDIR
1867@section @code{CHDIR} --- Change working directory
4ba96c02
BM
1868@cindex @code{CHDIR} intrinsic
1869@cindex file system operations
cd051390 1870
cd051390
DF
1871@table @asis
1872@item @emph{Description}:
fe284266
DF
1873Change current working directory to a specified @var{PATH}.
1874
cd051390 1875@item @emph{Standard}:
fe284266
DF
1876GNU extension
1877
cd051390 1878@item @emph{Class}:
fe284266
DF
1879Non-elemental subroutine
1880
cd051390 1881@item @emph{Syntax}:
d565bb3a 1882@code{CALL CHDIR(PATH [, STATUS])}
fe284266 1883
cd051390 1884@item @emph{Arguments}:
fe284266 1885@multitable @columnfractions .15 .80
ea8dda63
BM
1886@item @var{PATH} @tab The type shall be @code{CHARACTER(*)} and shall
1887 specify a valid path within the file system.
fe284266
DF
1888@item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
1889 a system specific and non-zero error code otherwise.
1890@end multitable
1891
cd051390 1892@item @emph{Example}:
fe284266
DF
1893@smallexample
1894PROGRAM test_chdir
1895 CHARACTER(len=255) :: path
1896 CALL getcwd(path)
1897 WRITE(*,*) TRIM(path)
1898 CALL chdir("/tmp")
1899 CALL getcwd(path)
1900 WRITE(*,*) TRIM(path)
1901END PROGRAM
1902@end smallexample
1903
cd051390 1904@item @emph{See also}:
fe284266 1905@ref{GETCWD}
eaef357b
JD
1906@end table
1907
1908
fe284266 1909
cd051390
DF
1910@node CHMOD
1911@section @code{CHMOD} --- Change access permissions of files
4ba96c02
BM
1912@cindex @code{CHMOD} intrinsic
1913@cindex file system operations
cd051390 1914
cd051390
DF
1915@table @asis
1916@item @emph{Description}:
26d29061
TB
1917@code{CHMOD} changes the permissions of a file. This function invokes
1918@code{/bin/chmod} and might therefore not work on all platforms.
08d7f64e
TB
1919
1920This intrinsic is provided in both subroutine and function forms; however,
1921only one form can be used in any given program unit.
cd051390
DF
1922
1923@item @emph{Standard}:
1924GNU extension
1925
1926@item @emph{Class}:
08d7f64e 1927Subroutine, non-elemental function
cd051390
DF
1928
1929@item @emph{Syntax}:
08d7f64e
TB
1930@multitable @columnfractions .80
1931@item @code{CALL CHMOD(NAME, MODE[, STATUS])}
1932@item @code{STATUS = CHMOD(NAME, MODE)}
1933@end multitable
26d29061 1934
cd051390 1935@item @emph{Arguments}:
26d29061
TB
1936@multitable @columnfractions .15 .80
1937@item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
1938Trailing blanks are ignored unless the character @code{achar(0)} is
1939present, then all characters up to and excluding @code{achar(0)} are
1940used as the file name.
1941
1942@item @var{MODE} @tab Scalar @code{CHARACTER} giving the file permission.
1943@var{MODE} uses the same syntax as the @var{MODE} argument of
1944@code{/bin/chmod}.
1945
1946@item @var{STATUS} @tab (optional) scalar @code{INTEGER}, which is
1947@code{0} on success and non-zero otherwise.
1948@end multitable
1949
08d7f64e
TB
1950@item @emph{Return value}:
1951In either syntax, @var{STATUS} is set to @code{0} on success and non-zero
1952otherwise.
1953
cd051390 1954@item @emph{Example}:
08d7f64e 1955@code{CHMOD} as subroutine
26d29061
TB
1956@smallexample
1957program chmod_test
1958 implicit none
1959 integer :: status
1960 call chmod('test.dat','u+x',status)
1961 print *, 'Status: ', status
1962end program chmod_test
1963@end smallexample
08d7f64e
TB
1964@code{CHMOD} as non-elemental function:
1965@smallexample
1966program chmod_test
1967 implicit none
1968 integer :: status
1969 status = chmod('test.dat','u+x')
1970 print *, 'Status: ', status
1971end program chmod_test
1972@end smallexample
cd051390
DF
1973@item @emph{Specific names}:
1974@item @emph{See also}:
cd051390
DF
1975
1976@end table
1977
eaef357b
JD
1978
1979@node CMPLX
1980@section @code{CMPLX} --- Complex conversion function
4ba96c02
BM
1981@cindex @code{CMPLX} intrinsic
1982@cindex complex numbers, conversion to
eaef357b
JD
1983
1984@table @asis
1985@item @emph{Description}:
d3dfa1fe 1986@code{CMPLX(X [, Y [, KIND]])} returns a complex number where @var{X} is converted to
323d0f0b
JD
1987the real component. If @var{Y} is present it is converted to the imaginary
1988component. If @var{Y} is not present then the imaginary component is set to
eaef357b
JD
19890.0. If @var{X} is complex then @var{Y} must not be present.
1990
cd051390
DF
1991@item @emph{Standard}:
1992F77 and later
eaef357b
JD
1993
1994@item @emph{Class}:
cd051390 1995Elemental function
eaef357b
JD
1996
1997@item @emph{Syntax}:
d565bb3a 1998@code{RESULT = CMPLX(X [, Y [, KIND]])}
eaef357b
JD
1999
2000@item @emph{Arguments}:
2001@multitable @columnfractions .15 .80
ea8dda63
BM
2002@item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)},
2003 or @code{COMPLEX(*)}.
d3dfa1fe
BM
2004@item @var{Y} @tab (Optional; only allowed if @var{X} is not
2005 @code{COMPLEX(*)}.) May be @code{INTEGER(*)}
2006 or @code{REAL(*)}.
2007@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
2008 expression indicating the kind parameter of
2009 the result.
eaef357b
JD
2010@end multitable
2011
2012@item @emph{Return value}:
2013The return value is of type @code{COMPLEX(*)}
2014
2015@item @emph{Example}:
2016@smallexample
2017program test_cmplx
2018 integer :: i = 42
2019 real :: x = 3.14
2020 complex :: z
2021 z = cmplx(i, x)
2022 print *, z, cmplx(x)
2023end program test_cmplx
2024@end smallexample
2025@end table
2026
2027
2028
323d0f0b 2029@node COMMAND_ARGUMENT_COUNT
21825fd6 2030@section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
4ba96c02
BM
2031@cindex @code{COMMAND_ARGUMENT_COUNT} intrinsic
2032@cindex command-line arguments, to program
323d0f0b
JD
2033
2034@table @asis
2035@item @emph{Description}:
2036@code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
2037command line when the containing program was invoked.
2038
cd051390
DF
2039@item @emph{Standard}:
2040F2003
323d0f0b
JD
2041
2042@item @emph{Class}:
cd051390 2043Inquiry function
323d0f0b
JD
2044
2045@item @emph{Syntax}:
d565bb3a 2046@code{RESULT = COMMAND_ARGUMENT_COUNT()}
323d0f0b
JD
2047
2048@item @emph{Arguments}:
2049@multitable @columnfractions .15 .80
2050@item None
2051@end multitable
2052
2053@item @emph{Return value}:
2054The return value is of type @code{INTEGER(4)}
2055
2056@item @emph{Example}:
2057@smallexample
2058program test_command_argument_count
2059 integer :: count
2060 count = command_argument_count()
2061 print *, count
2062end program test_command_argument_count
2063@end smallexample
323d0f0b 2064
21825fd6
DF
2065@item @emph{See also}:
2066@ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
2067@end table
323d0f0b
JD
2068
2069@node CONJG
2070@section @code{CONJG} --- Complex conjugate function
4ba96c02
BM
2071@cindex @code{CONJG} intrinsic
2072@cindex @code{DCONJG} intrinsic
323d0f0b
JD
2073@cindex complex conjugate
2074@table @asis
2075@item @emph{Description}:
2076@code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
2077then the result is @code{(x, -y)}
2078
cd051390
DF
2079@item @emph{Standard}:
2080F77 and later, has overloads that are GNU extensions
323d0f0b
JD
2081
2082@item @emph{Class}:
cd051390 2083Elemental function
323d0f0b
JD
2084
2085@item @emph{Syntax}:
2086@code{Z = CONJG(Z)}
2087
2088@item @emph{Arguments}:
2089@multitable @columnfractions .15 .80
2090@item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2091@end multitable
2092
2093@item @emph{Return value}:
2094The return value is of type @code{COMPLEX(*)}.
2095
2096@item @emph{Example}:
2097@smallexample
2098program test_conjg
2099 complex :: z = (2.0, 3.0)
2100 complex(8) :: dz = (2.71_8, -3.14_8)
2101 z= conjg(z)
2102 print *, z
2103 dz = dconjg(dz)
2104 print *, dz
2105end program test_conjg
2106@end smallexample
2107
2108@item @emph{Specific names}:
cd051390
DF
2109@multitable @columnfractions .20 .20 .20 .40
2110@item Name @tab Argument @tab Return type @tab Standard
2111@item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
323d0f0b
JD
2112@end multitable
2113@end table
2114
2115
2116
a5d58aeb
FXC
2117@node COS
2118@section @code{COS} --- Cosine function
4ba96c02
BM
2119@cindex @code{COS} intrinsic
2120@cindex @code{DCOS} intrinsic
2121@cindex @code{ZCOS} intrinsic
2122@cindex @code{CDCOS} intrinsic
cd051390 2123@cindex trigonometric functions
a5d58aeb
FXC
2124
2125@table @asis
2126@item @emph{Description}:
2127@code{COS(X)} computes the cosine of @var{X}.
2128
cd051390
DF
2129@item @emph{Standard}:
2130F77 and later, has overloads that are GNU extensions
a5d58aeb 2131
eaef357b 2132@item @emph{Class}:
cd051390 2133Elemental function
a5d58aeb
FXC
2134
2135@item @emph{Syntax}:
d565bb3a 2136@code{RESULT = COS(X)}
a5d58aeb
FXC
2137
2138@item @emph{Arguments}:
2139@multitable @columnfractions .15 .80
eaef357b 2140@item @var{X} @tab The type shall be @code{REAL(*)} or
a5d58aeb
FXC
2141@code{COMPLEX(*)}.
2142@end multitable
2143
2144@item @emph{Return value}:
cd051390
DF
2145The return value is of type @code{REAL(*)} and it lies in the
2146range @math{ -1 \leq \cos (x) \leq 1}. The kind type
2147parameter is the same as @var{X}.
a5d58aeb
FXC
2148
2149@item @emph{Example}:
2150@smallexample
2151program test_cos
2152 real :: x = 0.0
2153 x = cos(x)
2154end program test_cos
2155@end smallexample
2156
2157@item @emph{Specific names}:
cd051390
DF
2158@multitable @columnfractions .20 .20 .20 .40
2159@item Name @tab Argument @tab Return type @tab Standard
2160@item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2161@item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2162@item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2163@item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
a5d58aeb 2164@end multitable
cd051390
DF
2165
2166@item @emph{See also}:
2167Inverse function: @ref{ACOS}
2168
a5d58aeb
FXC
2169@end table
2170
f7cdcbf1 2171
eaef357b 2172
f7cdcbf1
FXC
2173@node COSH
2174@section @code{COSH} --- Hyperbolic cosine function
4ba96c02
BM
2175@cindex @code{COSH} intrinsic
2176@cindex @code{DCOSH} intrinsic
f7cdcbf1
FXC
2177@cindex hyperbolic cosine
2178
2179@table @asis
2180@item @emph{Description}:
2181@code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2182
cd051390
DF
2183@item @emph{Standard}:
2184F77 and later
f7cdcbf1 2185
eaef357b 2186@item @emph{Class}:
cd051390 2187Elemental function
f7cdcbf1
FXC
2188
2189@item @emph{Syntax}:
2190@code{X = COSH(X)}
2191
2192@item @emph{Arguments}:
2193@multitable @columnfractions .15 .80
eaef357b 2194@item @var{X} @tab The type shall be @code{REAL(*)}.
f7cdcbf1
FXC
2195@end multitable
2196
2197@item @emph{Return value}:
2198The return value is of type @code{REAL(*)} and it is positive
2199(@math{ \cosh (x) \geq 0 }.
2200
2201@item @emph{Example}:
2202@smallexample
2203program test_cosh
2204 real(8) :: x = 1.0_8
2205 x = cosh(x)
2206end program test_cosh
2207@end smallexample
2208
2209@item @emph{Specific names}:
cd051390
DF
2210@multitable @columnfractions .20 .20 .20 .40
2211@item Name @tab Argument @tab Return type @tab Standard
2212@item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
f7cdcbf1 2213@end multitable
cd051390
DF
2214
2215@item @emph{See also}:
2216Inverse function: @ref{ACOSH}
2217
f7cdcbf1
FXC
2218@end table
2219
2220
eaef357b 2221
323d0f0b
JD
2222@node COUNT
2223@section @code{COUNT} --- Count function
4ba96c02 2224@cindex @code{COUNT} intrinsic
323d0f0b
JD
2225@cindex count
2226
2227@table @asis
2228@item @emph{Description}:
d565bb3a 2229@code{COUNT(MASK [, DIM])} counts the number of @code{.TRUE.} elements of
323d0f0b
JD
2230@var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2231taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2232range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2233
cd051390
DF
2234@item @emph{Standard}:
2235F95 and later
323d0f0b
JD
2236
2237@item @emph{Class}:
2238transformational function
2239
2240@item @emph{Syntax}:
d565bb3a 2241@code{RESULT = COUNT(MASK [, DIM])}
323d0f0b
JD
2242
2243@item @emph{Arguments}:
2244@multitable @columnfractions .15 .80
2245@item @var{MASK} @tab The type shall be @code{LOGICAL}.
2246@item @var{DIM} @tab The type shall be @code{INTEGER}.
2247@end multitable
2248
2249@item @emph{Return value}:
2250The return value is of type @code{INTEGER} with rank equal to that of
2251@var{MASK}.
2252
2253@item @emph{Example}:
2254@smallexample
2255program test_count
2256 integer, dimension(2,3) :: a, b
2257 logical, dimension(2,3) :: mask
2258 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2259 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2260 print '(3i3)', a(1,:)
2261 print '(3i3)', a(2,:)
2262 print *
2263 print '(3i3)', b(1,:)
2264 print '(3i3)', b(2,:)
2265 print *
2266 mask = a.ne.b
2267 print '(3l3)', mask(1,:)
2268 print '(3l3)', mask(2,:)
2269 print *
2270 print '(3i3)', count(mask)
2271 print *
2272 print '(3i3)', count(mask, 1)
2273 print *
2274 print '(3i3)', count(mask, 2)
2275end program test_count
2276@end smallexample
2277@end table
2278
2279
2280
2281@node CPU_TIME
2282@section @code{CPU_TIME} --- CPU elapsed time in seconds
4ba96c02
BM
2283@cindex @code{CPU_TIME} intrinsic
2284@cindex time, elapsed
2285@cindex elapsed time
323d0f0b
JD
2286
2287@table @asis
2288@item @emph{Description}:
2289Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
2290is useful for testing segments of code to determine execution time.
2291
cd051390
DF
2292@item @emph{Standard}:
2293F95 and later
323d0f0b
JD
2294
2295@item @emph{Class}:
cd051390 2296Subroutine
323d0f0b
JD
2297
2298@item @emph{Syntax}:
d565bb3a 2299@code{CALL CPU_TIME(X)}
323d0f0b
JD
2300
2301@item @emph{Arguments}:
2302@multitable @columnfractions .15 .80
0d519038 2303@item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
323d0f0b
JD
2304@end multitable
2305
2306@item @emph{Return value}:
2307None
2308
2309@item @emph{Example}:
2310@smallexample
2311program test_cpu_time
2312 real :: start, finish
2313 call cpu_time(start)
2314 ! put code to test here
2315 call cpu_time(finish)
2316 print '("Time = ",f6.3," seconds.")',finish-start
2317end program test_cpu_time
2318@end smallexample
2319@end table
2320
2321
2322
2323@node CSHIFT
2324@section @code{CSHIFT} --- Circular shift function
4ba96c02
BM
2325@cindex @code{CSHIFT} intrinsic
2326@cindex bit operations
323d0f0b
JD
2327
2328@table @asis
2329@item @emph{Description}:
d565bb3a 2330@code{CSHIFT(ARRAY, SHIFT [, DIM])} performs a circular shift on elements of
323d0f0b
JD
2331@var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2332taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2333range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2334If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2335by @var{SHIFT} places. If rank is greater than one, then all complete rank one
2336sections of @var{ARRAY} along the given dimension are shifted. Elements
2337shifted out one end of each rank one section are shifted back in the other end.
2338
cd051390
DF
2339@item @emph{Standard}:
2340F95 and later
323d0f0b
JD
2341
2342@item @emph{Class}:
2343transformational function
2344
2345@item @emph{Syntax}:
d565bb3a 2346@code{RESULT = CSHIFT(A, SHIFT [, DIM])}
323d0f0b
JD
2347
2348@item @emph{Arguments}:
2349@multitable @columnfractions .15 .80
2350@item @var{ARRAY} @tab May be any type, not scaler.
2351@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2352@item @var{DIM} @tab The type shall be @code{INTEGER}.
2353@end multitable
2354
2355@item @emph{Return value}:
2356Returns an array of same type and rank as the @var{ARRAY} argument.
2357
2358@item @emph{Example}:
2359@smallexample
2360program test_cshift
2361 integer, dimension(3,3) :: a
2362 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2363 print '(3i3)', a(1,:)
2364 print '(3i3)', a(2,:)
2365 print '(3i3)', a(3,:)
2366 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2367 print *
2368 print '(3i3)', a(1,:)
2369 print '(3i3)', a(2,:)
2370 print '(3i3)', a(3,:)
2371end program test_cshift
2372@end smallexample
2373@end table
2374
2375
35059811
FXC
2376@node CTIME
2377@section @code{CTIME} --- Convert a time into a string
4ba96c02
BM
2378@cindex @code{CTIME} intrinsic
2379@cindex time, conversion function
35059811
FXC
2380
2381@table @asis
2382@item @emph{Description}:
2383@code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2384by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
23851995}, and returns that string into @var{S}.
2386
2387If @code{CTIME} is invoked as a function, it can not be invoked as a
2388subroutine, and vice versa.
2389
2390@var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2391@var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2392
cd051390
DF
2393@item @emph{Standard}:
2394GNU extension
35059811
FXC
2395
2396@item @emph{Class}:
cd051390 2397Subroutine
35059811
FXC
2398
2399@item @emph{Syntax}:
2400@multitable @columnfractions .80
2401@item @code{CALL CTIME(T,S)}.
2402@item @code{S = CTIME(T)}, (not recommended).
2403@end multitable
2404
2405@item @emph{Arguments}:
2406@multitable @columnfractions .15 .80
2407@item @var{S}@tab The type shall be of type @code{CHARACTER}.
2408@item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2409@end multitable
2410
2411@item @emph{Return value}:
2412The converted date and time as a string.
2413
2414@item @emph{Example}:
2415@smallexample
2416program test_ctime
2417 integer(8) :: i
2418 character(len=30) :: date
2419 i = time8()
2420
2421 ! Do something, main part of the program
2422
2423 call ctime(i,date)
2424 print *, 'Program was started on ', date
2425end program test_ctime
2426@end smallexample
d3dfa1fe
BM
2427
2428@item @emph{See Also}:
2429@ref{GMTIME}, @ref{LTIME}, @ref{TIME}, @ref{TIME8}
2430
35059811 2431@end table
323d0f0b 2432
d3dfa1fe
BM
2433
2434
323d0f0b
JD
2435@node DATE_AND_TIME
2436@section @code{DATE_AND_TIME} --- Date and time subroutine
4ba96c02
BM
2437@cindex @code{DATE_AND_TIME} intrinsic
2438@cindex date, current
2439@cindex current date
2440@cindex time, current
2441@cindex current time
323d0f0b
JD
2442
2443@table @asis
2444@item @emph{Description}:
2445@code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2446time information from the real-time system clock. @var{DATE} is
2447@code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
2448has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2449representing the difference with respect to Coordinated Universal Time (UTC).
2450Unavailable time and date parameters return blanks.
2451
2452@var{VALUES} is @code{INTENT(OUT)} and provides the following:
2453
2454@multitable @columnfractions .15 .30 .60
3435a71e 2455@item @tab @code{VALUE(1)}: @tab The year
323d0f0b
JD
2456@item @tab @code{VALUE(2)}: @tab The month
2457@item @tab @code{VALUE(3)}: @tab The day of the month
fe284266 2458@item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
323d0f0b
JD
2459@item @tab @code{VALUE(5)}: @tab The hour of the day
2460@item @tab @code{VALUE(6)}: @tab The minutes of the hour
2461@item @tab @code{VALUE(7)}: @tab The seconds of the minute
2462@item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2463@end multitable
2464
cd051390
DF
2465@item @emph{Standard}:
2466F95 and later
323d0f0b
JD
2467
2468@item @emph{Class}:
cd051390 2469Subroutine
323d0f0b
JD
2470
2471@item @emph{Syntax}:
2472@code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2473
323d0f0b
JD
2474@item @emph{Arguments}:
2475@multitable @columnfractions .15 .80
2476@item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
5189dd41 2477@item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
323d0f0b 2478@item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
3435a71e 2479@item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
323d0f0b
JD
2480@end multitable
2481
2482@item @emph{Return value}:
2483None
2484
2485@item @emph{Example}:
2486@smallexample
2487program test_time_and_date
2488 character(8) :: date
2489 character(10) :: time
2490 character(5) :: zone
2491 integer,dimension(8) :: values
2492 ! using keyword arguments
2493 call date_and_time(date,time,zone,values)
2494 call date_and_time(DATE=date,ZONE=zone)
2495 call date_and_time(TIME=time)
2496 call date_and_time(VALUES=values)
2497 print '(a,2x,a,2x,a)', date, time, zone
2498 print '(8i5))', values
2499end program test_time_and_date
2500@end smallexample
2501@end table
2502
2503
2504
2505@node DBLE
2506@section @code{DBLE} --- Double conversion function
4ba96c02 2507@cindex @code{DBLE} intrinsic
323d0f0b
JD
2508@cindex double conversion
2509
2510@table @asis
2511@item @emph{Description}:
2512@code{DBLE(X)} Converts @var{X} to double precision real type.
323d0f0b 2513
cd051390
DF
2514@item @emph{Standard}:
2515F77 and later
323d0f0b
JD
2516
2517@item @emph{Class}:
cd051390 2518Elemental function
323d0f0b
JD
2519
2520@item @emph{Syntax}:
d565bb3a 2521@code{RESULT = DBLE(X)}
323d0f0b
JD
2522
2523@item @emph{Arguments}:
2524@multitable @columnfractions .15 .80
ea8dda63
BM
2525@item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)},
2526 or @code{COMPLEX(*)}.
323d0f0b
JD
2527@end multitable
2528
2529@item @emph{Return value}:
2530The return value is of type double precision real.
2531
2532@item @emph{Example}:
2533@smallexample
2534program test_dble
2535 real :: x = 2.18
2536 integer :: i = 5
2537 complex :: z = (2.3,1.14)
cd051390 2538 print *, dble(x), dble(i), dble(z)
323d0f0b
JD
2539end program test_dble
2540@end smallexample
cd051390
DF
2541
2542@item @emph{See also}:
2543@ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
323d0f0b
JD
2544@end table
2545
2546
2547
3435a71e
JD
2548@node DCMPLX
2549@section @code{DCMPLX} --- Double complex conversion function
4ba96c02
BM
2550@cindex @code{DCMPLX} intrinsic
2551@cindex complex numbers, conversion to
3435a71e
JD
2552
2553@table @asis
2554@item @emph{Description}:
2555@code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2556converted to the real component. If @var{Y} is present it is converted to the
2557imaginary component. If @var{Y} is not present then the imaginary component is
2558set to 0.0. If @var{X} is complex then @var{Y} must not be present.
2559
cd051390
DF
2560@item @emph{Standard}:
2561GNU extension
3435a71e
JD
2562
2563@item @emph{Class}:
cd051390 2564Elemental function
3435a71e
JD
2565
2566@item @emph{Syntax}:
d565bb3a 2567@code{RESULT = DCMPLX(X [, Y])}
3435a71e
JD
2568
2569@item @emph{Arguments}:
2570@multitable @columnfractions .15 .80
ea8dda63
BM
2571@item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)},
2572 or @code{COMPLEX(*)}.
d3dfa1fe 2573@item @var{Y} @tab (Optional if @var{X} is not @code{COMPLEX(*)}.) May be
ea8dda63 2574 @code{INTEGER(*)} or @code{REAL(*)}.
3435a71e
JD
2575@end multitable
2576
2577@item @emph{Return value}:
2578The return value is of type @code{COMPLEX(8)}
2579
2580@item @emph{Example}:
2581@smallexample
2582program test_dcmplx
2583 integer :: i = 42
2584 real :: x = 3.14
2585 complex :: z
2586 z = cmplx(i, x)
2587 print *, dcmplx(i)
2588 print *, dcmplx(x)
2589 print *, dcmplx(z)
2590 print *, dcmplx(x,i)
2591end program test_dcmplx
2592@end smallexample
2593@end table
2594
2595
2596
323d0f0b
JD
2597@node DFLOAT
2598@section @code{DFLOAT} --- Double conversion function
4ba96c02 2599@cindex @code{DFLOAT} intrinsic
323d0f0b
JD
2600@cindex double float conversion
2601
2602@table @asis
2603@item @emph{Description}:
2604@code{DFLOAT(X)} Converts @var{X} to double precision real type.
cd051390
DF
2605
2606@item @emph{Standard}:
2607GNU extension
2608
2609@item @emph{Class}:
2610Elemental function
2611
2612@item @emph{Syntax}:
d565bb3a 2613@code{RESULT = DFLOAT(X)}
cd051390
DF
2614
2615@item @emph{Arguments}:
2616@multitable @columnfractions .15 .80
2617@item @var{X} @tab The type shall be @code{INTEGER(*)}.
2618@end multitable
2619
2620@item @emph{Return value}:
2621The return value is of type double precision real.
2622
2623@item @emph{Example}:
2624@smallexample
2625program test_dfloat
2626 integer :: i = 5
2627 print *, dfloat(i)
2628end program test_dfloat
2629@end smallexample
2630
2631@item @emph{See also}:
2632@ref{DBLE}, @ref{FLOAT}, @ref{REAL}
323d0f0b
JD
2633@end table
2634
2635
2636
3435a71e
JD
2637@node DIGITS
2638@section @code{DIGITS} --- Significant digits function
4ba96c02 2639@cindex @code{DIGITS} intrinsic
3435a71e
JD
2640@cindex digits, significant
2641
2642@table @asis
2643@item @emph{Description}:
2644@code{DIGITS(X)} returns the number of significant digits of the internal model
2645representation of @var{X}. For example, on a system using a 32-bit
2646floating point representation, a default real number would likely return 24.
2647
cd051390
DF
2648@item @emph{Standard}:
2649F95 and later
3435a71e
JD
2650
2651@item @emph{Class}:
cd051390 2652Inquiry function
3435a71e
JD
2653
2654@item @emph{Syntax}:
d565bb3a 2655@code{RESULT = DIGITS(X)}
3435a71e
JD
2656
2657@item @emph{Arguments}:
2658@multitable @columnfractions .15 .80
2659@item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2660@end multitable
2661
2662@item @emph{Return value}:
2663The return value is of type @code{INTEGER}.
2664
2665@item @emph{Example}:
2666@smallexample
2667program test_digits
2668 integer :: i = 12345
2669 real :: x = 3.143
2670 real(8) :: y = 2.33
3435a71e
JD
2671 print *, digits(i)
2672 print *, digits(x)
2673 print *, digits(y)
2674end program test_digits
2675@end smallexample
2676@end table
2677
2678
2679
2680@node DIM
2681@section @code{DIM} --- Dim function
4ba96c02
BM
2682@cindex @code{DIM} intrinsic
2683@cindex @code{IDIM} intrinsic
2684@cindex @code{DDIM} intrinsic
3435a71e
JD
2685@cindex dim
2686
2687@table @asis
2688@item @emph{Description}:
2689@code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2690otherwise returns zero.
2691
cd051390
DF
2692@item @emph{Standard}:
2693F77 and later
3435a71e
JD
2694
2695@item @emph{Class}:
cd051390 2696Elemental function
3435a71e
JD
2697
2698@item @emph{Syntax}:
d565bb3a 2699@code{RESULT = DIM(X, Y)}
3435a71e
JD
2700
2701@item @emph{Arguments}:
2702@multitable @columnfractions .15 .80
2703@item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2704@item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2705@end multitable
2706
2707@item @emph{Return value}:
2708The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2709
2710@item @emph{Example}:
2711@smallexample
2712program test_dim
2713 integer :: i
2714 real(8) :: x
2715 i = dim(4, 15)
2716 x = dim(4.345_8, 2.111_8)
2717 print *, i
2718 print *, x
2719end program test_dim
2720@end smallexample
2721
2722@item @emph{Specific names}:
cd051390
DF
2723@multitable @columnfractions .20 .20 .20 .40
2724@item Name @tab Argument @tab Return type @tab Standard
2725@item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2726@item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab F77 and later
3435a71e
JD
2727@end multitable
2728@end table
2729
2730
2731
2732@node DOT_PRODUCT
2733@section @code{DOT_PRODUCT} --- Dot product function
4ba96c02
BM
2734@cindex @code{DOT_PRODUCT} intrinsic
2735@cindex dot product
3435a71e
JD
2736
2737@table @asis
2738@item @emph{Description}:
2739@code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2740@var{X} and @var{Y}. The two vectors may be either numeric or logical
2741and must be arrays of rank one and of equal size. If the vectors are
2742@code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2743vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2744vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2745
cd051390
DF
2746@item @emph{Standard}:
2747F95 and later
3435a71e
JD
2748
2749@item @emph{Class}:
2750transformational function
2751
2752@item @emph{Syntax}:
d565bb3a 2753@code{RESULT = DOT_PRODUCT(X, Y)}
3435a71e
JD
2754
2755@item @emph{Arguments}:
2756@multitable @columnfractions .15 .80
2757@item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2758@item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2759@end multitable
2760
2761@item @emph{Return value}:
2762If the arguments are numeric, the return value is a scaler of numeric type,
2763@code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2764@code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2765
2766@item @emph{Example}:
2767@smallexample
2768program test_dot_prod
2769 integer, dimension(3) :: a, b
2770 a = (/ 1, 2, 3 /)
2771 b = (/ 4, 5, 6 /)
2772 print '(3i3)', a
2773 print *
2774 print '(3i3)', b
2775 print *
2776 print *, dot_product(a,b)
2777end program test_dot_prod
2778@end smallexample
2779@end table
2780
2781
2782
2783@node DPROD
2784@section @code{DPROD} --- Double product function
4ba96c02
BM
2785@cindex @code{DPROD} intrinsic
2786@cindex double-precision product
3435a71e
JD
2787
2788@table @asis
2789@item @emph{Description}:
2790@code{DPROD(X,Y)} returns the product @code{X*Y}.
2791
cd051390
DF
2792@item @emph{Standard}:
2793F77 and later
3435a71e
JD
2794
2795@item @emph{Class}:
cd051390 2796Elemental function
3435a71e
JD
2797
2798@item @emph{Syntax}:
d565bb3a 2799@code{RESULT = DPROD(X, Y)}
3435a71e
JD
2800
2801@item @emph{Arguments}:
2802@multitable @columnfractions .15 .80
2803@item @var{X} @tab The type shall be @code{REAL}.
2804@item @var{Y} @tab The type shall be @code{REAL}.
2805@end multitable
2806
2807@item @emph{Return value}:
2808The return value is of type @code{REAL(8)}.
2809
2810@item @emph{Example}:
2811@smallexample
2812program test_dprod
2813 integer :: i
2814 real :: x = 5.2
2815 real :: y = 2.3
2816 real(8) :: d
2817 d = dprod(x,y)
2818 print *, d
2819end program test_dprod
2820@end smallexample
2821@end table
2822
2823
2824
2825@node DREAL
2826@section @code{DREAL} --- Double real part function
4ba96c02
BM
2827@cindex @code{DREAL} intrinsic
2828@cindex double-precision real part
3435a71e
JD
2829
2830@table @asis
2831@item @emph{Description}:
2832@code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2833
cd051390
DF
2834@item @emph{Standard}:
2835GNU extension
3435a71e
JD
2836
2837@item @emph{Class}:
cd051390 2838Elemental function
3435a71e
JD
2839
2840@item @emph{Syntax}:
d565bb3a 2841@code{RESULT = DREAL(Z)}
3435a71e
JD
2842
2843@item @emph{Arguments}:
2844@multitable @columnfractions .15 .80
2845@item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2846@end multitable
2847
2848@item @emph{Return value}:
2849The return value is of type @code{REAL(8)}.
2850
2851@item @emph{Example}:
2852@smallexample
2853program test_dreal
2854 complex(8) :: z = (1.3_8,7.2_8)
2855 print *, dreal(z)
2856end program test_dreal
2857@end smallexample
cd051390
DF
2858
2859@item @emph{See also}:
2860@ref{AIMAG}
2861
3435a71e
JD
2862@end table
2863
2864
2865
2866@node DTIME
2867@section @code{DTIME} --- Execution time subroutine (or function)
4ba96c02
BM
2868@cindex @code{DTIME} intrinsic
2869@cindex time, elapsed
2870@cindex elapsed time
3435a71e
JD
2871
2872@table @asis
2873@item @emph{Description}:
2874@code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2875since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2876returns the user and system components of this time in @code{TARRAY(1)} and
f60d6481
JD
2877@code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2878TARRAY(2)}.
3435a71e 2879
f60d6481
JD
2880Subsequent invocations of @code{DTIME} return values accumulated since the
2881previous invocation.
3435a71e
JD
2882
2883On some systems, the underlying timings are represented using types with
fe284266 2884sufficiently small limits that overflows (wrap around) are possible, such as
3435a71e
JD
288532-bit types. Therefore, the values returned by this intrinsic might be, or
2886become, negative, or numerically less than previous values, during a single
2887run of the compiled program.
2888
2889If @code{DTIME} is invoked as a function, it can not be invoked as a
2890subroutine, and vice versa.
2891
2892@var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2893
2894@multitable @columnfractions .15 .30 .60
2895@item @tab @code{TARRAY(1)}: @tab User time in seconds.
2896@item @tab @code{TARRAY(2)}: @tab System time in seconds.
2897@item @tab @code{RESULT}: @tab Run time since start in seconds.
2898@end multitable
2899
cd051390
DF
2900@item @emph{Standard}:
2901GNU extension
3435a71e
JD
2902
2903@item @emph{Class}:
cd051390 2904Subroutine
3435a71e
JD
2905
2906@item @emph{Syntax}:
f60d6481
JD
2907@multitable @columnfractions .80
2908@item @code{CALL DTIME(TARRAY, RESULT)}.
2909@item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2910@end multitable
3435a71e
JD
2911
2912@item @emph{Arguments}:
2913@multitable @columnfractions .15 .80
2914@item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2915@item @var{RESULT}@tab The type shall be @code{REAL}.
2916@end multitable
2917
2918@item @emph{Return value}:
2919Elapsed time in seconds since the start of program execution.
2920
2921@item @emph{Example}:
2922@smallexample
2923program test_dtime
2924 integer(8) :: i, j
2925 real, dimension(2) :: tarray
2926 real :: result
2927 call dtime(tarray, result)
2928 print *, result
2929 print *, tarray(1)
2930 print *, tarray(2)
2931 do i=1,100000000 ! Just a delay
2932 j = i * i - i
2933 end do
2934 call dtime(tarray, result)
2935 print *, result
2936 print *, tarray(1)
2937 print *, tarray(2)
2938end program test_dtime
2939@end smallexample
2940@end table
2941
2942
2943
f60d6481
JD
2944@node EOSHIFT
2945@section @code{EOSHIFT} --- End-off shift function
4ba96c02
BM
2946@cindex @code{EOSHIFT} intrinsic
2947@cindex bit operations
f60d6481
JD
2948
2949@table @asis
2950@item @emph{Description}:
2951@code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2952elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2953omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2954@code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2955rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2956@var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2957then all complete rank one sections of @var{ARRAY} along the given dimension are
2958shifted. Elements shifted out one end of each rank one section are dropped. If
5189dd41 2959@var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
f60d6481
JD
2960is copied back in the other end. If @var{BOUNDARY} is not present then the
2961following are copied in depending on the type of @var{ARRAY}.
2962
2963@multitable @columnfractions .15 .80
2964@item @emph{Array Type} @tab @emph{Boundary Value}
2965@item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2966@item Logical @tab @code{.FALSE.}.
2967@item Character(@var{len}) @tab @var{len} blanks.
2968@end multitable
2969
cd051390
DF
2970@item @emph{Standard}:
2971F95 and later
f60d6481
JD
2972
2973@item @emph{Class}:
2974transformational function
2975
2976@item @emph{Syntax}:
d565bb3a 2977@code{RESULT = EOSHIFT(A, SHIFT [, BOUNDARY, DIM])}
f60d6481
JD
2978
2979@item @emph{Arguments}:
2980@multitable @columnfractions .15 .80
2981@item @var{ARRAY} @tab May be any type, not scaler.
2982@item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2983@item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2984@item @var{DIM} @tab The type shall be @code{INTEGER}.
2985@end multitable
2986
2987@item @emph{Return value}:
2988Returns an array of same type and rank as the @var{ARRAY} argument.
2989
2990@item @emph{Example}:
2991@smallexample
2992program test_eoshift
2993 integer, dimension(3,3) :: a
2994 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2995 print '(3i3)', a(1,:)
2996 print '(3i3)', a(2,:)
2997 print '(3i3)', a(3,:)
2998 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2999 print *
3000 print '(3i3)', a(1,:)
3001 print '(3i3)', a(2,:)
3002 print '(3i3)', a(3,:)
3003end program test_eoshift
3004@end smallexample
3005@end table
3006
3007
3008
3009@node EPSILON
3010@section @code{EPSILON} --- Epsilon function
4ba96c02 3011@cindex @code{EPSILON} intrinsic
f60d6481
JD
3012@cindex epsilon, significant
3013
3014@table @asis
3015@item @emph{Description}:
3016@code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
3017
cd051390
DF
3018@item @emph{Standard}:
3019F95 and later
f60d6481
JD
3020
3021@item @emph{Class}:
cd051390 3022Inquiry function
f60d6481
JD
3023
3024@item @emph{Syntax}:
d565bb3a 3025@code{RESULT = EPSILON(X)}
f60d6481
JD
3026
3027@item @emph{Arguments}:
3028@multitable @columnfractions .15 .80
3029@item @var{X} @tab The type shall be @code{REAL(*)}.
3030@end multitable
3031
3032@item @emph{Return value}:
3033The return value is of same type as the argument.
3034
3035@item @emph{Example}:
3036@smallexample
3037program test_epsilon
3038 real :: x = 3.143
3039 real(8) :: y = 2.33
3040 print *, EPSILON(x)
3041 print *, EPSILON(y)
3042end program test_epsilon
3043@end smallexample
3044@end table
3045
3046
3047
f7cdcbf1
FXC
3048@node ERF
3049@section @code{ERF} --- Error function
4ba96c02 3050@cindex @code{ERF} intrinsic
a6334742 3051@cindex error function
f7cdcbf1
FXC
3052
3053@table @asis
3054@item @emph{Description}:
3055@code{ERF(X)} computes the error function of @var{X}.
3056
cd051390
DF
3057@item @emph{Standard}:
3058GNU Extension
f7cdcbf1 3059
eaef357b 3060@item @emph{Class}:
cd051390 3061Elemental function
f7cdcbf1
FXC
3062
3063@item @emph{Syntax}:
d565bb3a 3064@code{RESULT = ERF(X)}
f7cdcbf1
FXC
3065
3066@item @emph{Arguments}:
3067@multitable @columnfractions .15 .80
eaef357b 3068@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
3069@end multitable
3070
3071@item @emph{Return value}:
a6334742 3072The return value is a scalar of type @code{REAL(*)} and it is positive
f7cdcbf1
FXC
3073(@math{ - 1 \leq erf (x) \leq 1 }.
3074
3075@item @emph{Example}:
3076@smallexample
3077program test_erf
3078 real(8) :: x = 0.17_8
3079 x = erf(x)
3080end program test_erf
3081@end smallexample
3082
3083@item @emph{Specific names}:
cd051390
DF
3084@multitable @columnfractions .20 .20 .20 .40
3085@item Name @tab Argument @tab Return type @tab Standard
3086@item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
f7cdcbf1
FXC
3087@end multitable
3088@end table
3089
3090
3091
3092@node ERFC
3093@section @code{ERFC} --- Error function
4ba96c02 3094@cindex @code{ERFC} intrinsic
a6334742 3095@cindex error function
f7cdcbf1
FXC
3096
3097@table @asis
3098@item @emph{Description}:
3099@code{ERFC(X)} computes the complementary error function of @var{X}.
3100
cd051390
DF
3101@item @emph{Standard}:
3102GNU extension
f7cdcbf1 3103
eaef357b 3104@item @emph{Class}:
cd051390 3105Elemental function
f7cdcbf1
FXC
3106
3107@item @emph{Syntax}:
d565bb3a 3108@code{RESULT = ERFC(X)}
f7cdcbf1
FXC
3109
3110@item @emph{Arguments}:
3111@multitable @columnfractions .15 .80
eaef357b 3112@item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
f7cdcbf1
FXC
3113@end multitable
3114
3115@item @emph{Return value}:
a6334742 3116The return value is a scalar of type @code{REAL(*)} and it is positive
f7cdcbf1
FXC
3117(@math{ 0 \leq erfc (x) \leq 2 }.
3118
3119@item @emph{Example}:
3120@smallexample
3121program test_erfc
3122 real(8) :: x = 0.17_8
3123 x = erfc(x)
3124end program test_erfc
3125@end smallexample
3126
3127@item @emph{Specific names}:
cd051390
DF
3128@multitable @columnfractions .20 .20 .20 .40
3129@item Name @tab Argument @tab Return type @tab Standard
3130@item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
a5d58aeb
FXC
3131@end multitable
3132@end table
3133
3134
3135
f60d6481
JD
3136@node ETIME
3137@section @code{ETIME} --- Execution time subroutine (or function)
4ba96c02
BM
3138@cindex @code{ETIME} intrinsic
3139@cindex time, elapsed
f60d6481
JD
3140
3141@table @asis
3142@item @emph{Description}:
3143@code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3144since the start of the process's execution in @var{RESULT}. @var{TARRAY}
3145returns the user and system components of this time in @code{TARRAY(1)} and
3146@code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3147
3148On some systems, the underlying timings are represented using types with
fe284266 3149sufficiently small limits that overflows (wrap around) are possible, such as
f60d6481
JD
315032-bit types. Therefore, the values returned by this intrinsic might be, or
3151become, negative, or numerically less than previous values, during a single
3152run of the compiled program.
3153
3154If @code{ETIME} is invoked as a function, it can not be invoked as a
3155subroutine, and vice versa.
3156
3157@var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3158
3159@multitable @columnfractions .15 .30 .60
3160@item @tab @code{TARRAY(1)}: @tab User time in seconds.
3161@item @tab @code{TARRAY(2)}: @tab System time in seconds.
3162@item @tab @code{RESULT}: @tab Run time since start in seconds.
3163@end multitable
3164
cd051390
DF
3165@item @emph{Standard}:
3166GNU extension
f60d6481
JD
3167
3168@item @emph{Class}:
cd051390 3169Subroutine
f60d6481
JD
3170
3171@item @emph{Syntax}:
3172@multitable @columnfractions .8
3173@item @code{CALL ETIME(TARRAY, RESULT)}.
3174@item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3175@end multitable
3176
3177@item @emph{Arguments}:
3178@multitable @columnfractions .15 .80
3179@item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3180@item @var{RESULT}@tab The type shall be @code{REAL}.
3181@end multitable
3182
3183@item @emph{Return value}:
3184Elapsed time in seconds since the start of program execution.
3185
3186@item @emph{Example}:
3187@smallexample
3188program test_etime
3189 integer(8) :: i, j
3190 real, dimension(2) :: tarray
3191 real :: result
3192 call ETIME(tarray, result)
3193 print *, result
3194 print *, tarray(1)
3195 print *, tarray(2)
3196 do i=1,100000000 ! Just a delay
3197 j = i * i - i
3198 end do
3199 call ETIME(tarray, result)
3200 print *, result
3201 print *, tarray(1)
3202 print *, tarray(2)
3203end program test_etime
3204@end smallexample
cd051390
DF
3205
3206@item @emph{See also}:
3207@ref{CPU_TIME}
3208
f60d6481
JD
3209@end table
3210
3211
3212
3213@node EXIT
3214@section @code{EXIT} --- Exit the program with status.
4ba96c02
BM
3215@cindex @code{EXIT} intrinsic
3216@cindex exit program
f60d6481
JD
3217
3218@table @asis
3219@item @emph{Description}:
3220@code{EXIT} causes immediate termination of the program with status. If status
5189dd41 3221is omitted it returns the canonical @emph{success} for the system. All Fortran
f60d6481
JD
3222I/O units are closed.
3223
cd051390
DF
3224@item @emph{Standard}:
3225GNU extension
f60d6481
JD
3226
3227@item @emph{Class}:
cd051390 3228Subroutine
f60d6481
JD
3229
3230@item @emph{Syntax}:
3231@code{CALL EXIT([STATUS])}
3232
3233@item @emph{Arguments}:
3234@multitable @columnfractions .15 .80
3235@item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3236@end multitable
3237
3238@item @emph{Return value}:
3239@code{STATUS} is passed to the parent process on exit.
3240
3241@item @emph{Example}:
3242@smallexample
3243program test_exit
3244 integer :: STATUS = 0
3245 print *, 'This program is going to exit.'
3246 call EXIT(STATUS)
3247end program test_exit
3248@end smallexample
cd051390
DF
3249
3250@item @emph{See also}:
3251@ref{ABORT}, @ref{KILL}
f60d6481
JD
3252@end table
3253
3254
3255
a5d58aeb
FXC
3256@node EXP
3257@section @code{EXP} --- Exponential function
4ba96c02
BM
3258@cindex @code{EXP} intrinsic
3259@cindex @code{DEXP} intrinsic
3260@cindex @code{ZEXP} intrinsic
3261@cindex @code{CDEXP} intrinsic
a5d58aeb
FXC
3262@cindex exponential
3263
3264@table @asis
3265@item @emph{Description}:
3266@code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3267
cd051390
DF
3268@item @emph{Standard}:
3269F77 and later, has overloads that are GNU extensions
a5d58aeb 3270
eaef357b 3271@item @emph{Class}:
cd051390 3272Elemental function
a5d58aeb
FXC
3273
3274@item @emph{Syntax}:
d565bb3a 3275@code{RESULT = EXP(X)}
a5d58aeb
FXC
3276
3277@item @emph{Arguments}:
3278@multitable @columnfractions .15 .80
eaef357b 3279@item @var{X} @tab The type shall be @code{REAL(*)} or
a5d58aeb
FXC
3280@code{COMPLEX(*)}.
3281@end multitable
3282
3283@item @emph{Return value}:
eaef357b 3284The return value has same type and kind as @var{X}.
a5d58aeb
FXC
3285
3286@item @emph{Example}:
3287@smallexample
3288program test_exp
3289 real :: x = 1.0
3290 x = exp(x)
3291end program test_exp
3292@end smallexample
3293
3294@item @emph{Specific names}:
cd051390
DF
3295@multitable @columnfractions .20 .20 .20 .40
3296@item Name @tab Argument @tab Return type @tab Standard
3297@item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
3298@item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
3299@item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3300@item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
a5d58aeb
FXC
3301@end multitable
3302@end table
3303
3304
eaef357b 3305
ee2242a2
JD
3306@node EXPONENT
3307@section @code{EXPONENT} --- Exponent function
4ba96c02
BM
3308@cindex @code{EXPONENT} intrinsic
3309@cindex exponent part of a real number
ee2242a2
JD
3310
3311@table @asis
3312@item @emph{Description}:
3313@code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3314is zero the value returned is zero.
3315
cd051390
DF
3316@item @emph{Standard}:
3317F95 and later
ee2242a2
JD
3318
3319@item @emph{Class}:
cd051390 3320Elemental function
ee2242a2
JD
3321
3322@item @emph{Syntax}:
d565bb3a 3323@code{RESULT = EXPONENT(X)}
ee2242a2
JD
3324
3325@item @emph{Arguments}:
3326@multitable @columnfractions .15 .80
3327@item @var{X} @tab The type shall be @code{REAL(*)}.
3328@end multitable
3329
3330@item @emph{Return value}:
3331The return value is of type default @code{INTEGER}.
3332
3333@item @emph{Example}:
3334@smallexample
3335program test_exponent
3336 real :: x = 1.0
3337 integer :: i
3338 i = exponent(x)
3339 print *, i
3340 print *, exponent(0.0)
3341end program test_exponent
3342@end smallexample
3343@end table
3344
3345
35059811
FXC
3346@node FDATE
3347@section @code{FDATE} --- Get the current time as a string
4ba96c02
BM
3348@cindex @code{FDATE} intrinsic
3349@cindex time, current
3350@cindex current time
3351@cindex date, current
3352@cindex current date
35059811
FXC
3353
3354@table @asis
3355@item @emph{Description}:
3356@code{FDATE(DATE)} returns the current date (using the same format as
3357@code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
4ba96c02 3358TIME())}.
35059811
FXC
3359
3360If @code{FDATE} is invoked as a function, it can not be invoked as a
3361subroutine, and vice versa.
3362
3363@var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3364
cd051390
DF
3365@item @emph{Standard}:
3366GNU extension
35059811
FXC
3367
3368@item @emph{Class}:
cd051390 3369Subroutine
35059811
FXC
3370
3371@item @emph{Syntax}:
3372@multitable @columnfractions .80
3373@item @code{CALL FDATE(DATE)}.
3374@item @code{DATE = FDATE()}, (not recommended).
3375@end multitable
3376
3377@item @emph{Arguments}:
3378@multitable @columnfractions .15 .80
3379@item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3380@end multitable
3381
3382@item @emph{Return value}:
0c5a1cbc 3383The current date as a string.
35059811
FXC
3384
3385@item @emph{Example}:
3386@smallexample
3387program test_fdate
3388 integer(8) :: i, j
3389 character(len=30) :: date
3390 call fdate(date)
3391 print *, 'Program started on ', date
3392 do i = 1, 100000000 ! Just a delay
3393 j = i * i - i
3394 end do
3395 call fdate(date)
3396 print *, 'Program ended on ', date
3397end program test_fdate
3398@end smallexample
3399@end table
3400
6110b776 3401@node FLOAT
cd051390 3402
6110b776 3403@section @code{FLOAT} --- Convert integer to default real
4ba96c02 3404@cindex @code{FLOAT} intrinsic
cd051390 3405@cindex conversion function (float)
6110b776
SK
3406
3407@table @asis
3408@item @emph{Description}:
3409@code{FLOAT(I)} converts the integer @var{I} to a default real value.
3410
cd051390
DF
3411@item @emph{Standard}:
3412GNU extension
6110b776
SK
3413
3414@item @emph{Class}:
cd051390 3415Elemental function
6110b776
SK
3416
3417@item @emph{Syntax}:
d565bb3a 3418@code{RESULT = FLOAT(I)}
6110b776
SK
3419
3420@item @emph{Arguments}:
3421@multitable @columnfractions .15 .80
3422@item @var{I} @tab The type shall be @code{INTEGER(*)}.
3423@end multitable
3424
3425@item @emph{Return value}:
d565bb3a 3426The return value is of type default @code{REAL}.
6110b776
SK
3427
3428@item @emph{Example}:
3429@smallexample
3430program test_float
3431 integer :: i = 1
3432 if (float(i) /= 1.) call abort
3433end program test_float
3434@end smallexample
cd051390
DF
3435
3436@item @emph{See also}:
3437@ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3438@end table
3439
3440
3441
fe284266
DF
3442@node FGET
3443@section @code{FGET} --- Read a single character in stream mode from stdin
4ba96c02 3444@cindex @code{FGET} intrinsic
fe284266
DF
3445@cindex file operations
3446@cindex stream operations
cd051390
DF
3447
3448@table @asis
3449@item @emph{Description}:
fe284266
DF
3450Read a single character in stream mode from stdin by bypassing normal
3451formatted output. Stream I/O should not be mixed with normal record-oriented
3452(formatted or unformatted) I/O on the same unit; the results are unpredictable.
3453
3454This intrinsic routine is provided for backwards compatibility with
7fc15ba5 3455@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
fe284266
DF
3456Programmers should consider the use of new stream IO feature in new code
3457for future portability. See also @ref{Fortran 2003 status}.
3458
cd051390
DF
3459@item @emph{Standard}:
3460GNU extension
3461
3462@item @emph{Class}:
fe284266
DF
3463Non-elemental subroutine
3464
cd051390 3465@item @emph{Syntax}:
d565bb3a 3466@code{CALL FGET(C [, STATUS])}
fe284266 3467
cd051390 3468@item @emph{Arguments}:
fe284266
DF
3469@multitable @columnfractions .15 .80
3470@item @var{C} @tab The type shall be @code{CHARACTER}.
d3dfa1fe
BM
3471@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
3472 Returns 0 on success, -1 on end-of-file, and a
3473 system specific positive error code otherwise.
fe284266
DF
3474@end multitable
3475
cd051390 3476@item @emph{Example}:
fe284266
DF
3477@smallexample
3478PROGRAM test_fget
3479 INTEGER, PARAMETER :: strlen = 100
3480 INTEGER :: status, i = 1
3481 CHARACTER(len=strlen) :: str = ""
3482
3483 WRITE (*,*) 'Enter text:'
3484 DO
3485 CALL fget(str(i:i), status)
3486 if (status /= 0 .OR. i > strlen) exit
3487 i = i + 1
3488 END DO
3489 WRITE (*,*) TRIM(str)
3490END PROGRAM
3491@end smallexample
3492
cd051390 3493@item @emph{See also}:
fe284266 3494@ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
cd051390
DF
3495@end table
3496
3497
fe284266
DF
3498@node FGETC
3499@section @code{FGETC} --- Read a single character in stream mode
4ba96c02 3500@cindex @code{FGETC} intrinsic
fe284266
DF
3501@cindex file operations
3502@cindex stream operations
cd051390
DF
3503
3504@table @asis
3505@item @emph{Description}:
fe284266
DF
3506Read a single character in stream mode by bypassing normal formatted output.
3507Stream I/O should not be mixed with normal record-oriented (formatted or
3508unformatted) I/O on the same unit; the results are unpredictable.
3509
3510This intrinsic routine is provided for backwards compatibility with
7fc15ba5 3511@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
fe284266
DF
3512Programmers should consider the use of new stream IO feature in new code
3513for future portability. See also @ref{Fortran 2003 status}.
3514
cd051390
DF
3515@item @emph{Standard}:
3516GNU extension
3517
3518@item @emph{Class}:
fe284266
DF
3519Non-elemental subroutine
3520
cd051390 3521@item @emph{Syntax}:
d565bb3a 3522@code{CALL FGETC(UNIT, C [, STATUS])}
fe284266 3523
cd051390 3524@item @emph{Arguments}:
fe284266
DF
3525@multitable @columnfractions .15 .80
3526@item @var{UNIT} @tab The type shall be @code{INTEGER}.
3527@item @var{C} @tab The type shall be @code{CHARACTER}.
3528@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3529 -1 on end-of-file and a system specific positive error code otherwise.
3530@end multitable
3531
cd051390 3532@item @emph{Example}:
fe284266
DF
3533@smallexample
3534PROGRAM test_fgetc
3535 INTEGER :: fd = 42, status
3536 CHARACTER :: c
3537
3538 OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3539 DO
3540 CALL fgetc(fd, c, status)
3541 IF (status /= 0) EXIT
3542 call fput(c)
3543 END DO
3544 CLOSE(UNIT=fd)
3545END PROGRAM
3546@end smallexample
3547
cd051390 3548@item @emph{See also}:
fe284266 3549@ref{FGET}, @ref{FPUT}, @ref{FPUTC}
6110b776
SK
3550@end table
3551
35059811 3552
fe284266 3553
ee2242a2
JD
3554@node FLOOR
3555@section @code{FLOOR} --- Integer floor function
4ba96c02 3556@cindex @code{FLOOR} intrinsic
ee2242a2
JD
3557@cindex floor
3558
3559@table @asis
3560@item @emph{Description}:
3561@code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3562
cd051390
DF
3563@item @emph{Standard}:
3564F95 and later
ee2242a2
JD
3565
3566@item @emph{Class}:
cd051390 3567Elemental function
ee2242a2
JD
3568
3569@item @emph{Syntax}:
d565bb3a 3570@code{RESULT = FLOOR(X [, KIND])}
ee2242a2
JD
3571
3572@item @emph{Arguments}:
3573@multitable @columnfractions .15 .80
3574@item @var{X} @tab The type shall be @code{REAL(*)}.
d3dfa1fe
BM
3575@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
3576 expression indicating the kind parameter of
3577 the result.
ee2242a2
JD
3578@end multitable
3579
3580@item @emph{Return value}:
3581The return value is of type @code{INTEGER(KIND)}
3582
3583@item @emph{Example}:
3584@smallexample
3585program test_floor
3586 real :: x = 63.29
3587 real :: y = -63.59
3588 print *, floor(x) ! returns 63
3589 print *, floor(y) ! returns -64
3590end program test_floor
3591@end smallexample
cd051390
DF
3592
3593@item @emph{See also}:
3594@ref{CEILING}, @ref{NINT}
3595
ee2242a2
JD
3596@end table
3597
3598
3599
3a3977a8
FXC
3600@node FLUSH
3601@section @code{FLUSH} --- Flush I/O unit(s)
4ba96c02
BM
3602@cindex @code{FLUSH} intrinsic
3603@cindex flush output files
3a3977a8
FXC
3604
3605@table @asis
3606@item @emph{Description}:
3607Flushes Fortran unit(s) currently open for output. Without the optional
3608argument, all units are flushed, otherwise just the unit specified.
3609
cd051390
DF
3610@item @emph{Standard}:
3611GNU extension
3a3977a8
FXC
3612
3613@item @emph{Class}:
3614non-elemental subroutine
3615
3616@item @emph{Syntax}:
3617@code{CALL FLUSH(UNIT)}
3618
3619@item @emph{Arguments}:
3620@multitable @columnfractions .15 .80
3621@item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3622@end multitable
3623
3624@item @emph{Note}:
3625Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
929e2b92 3626statement that should be preferred over the @code{FLUSH} intrinsic.
3a3977a8
FXC
3627
3628@end table
3629
3630
3631
ee2242a2
JD
3632@node FNUM
3633@section @code{FNUM} --- File number function
4ba96c02 3634@cindex @code{FNUM} intrinsic
ee2242a2
JD
3635@cindex fnum
3636
3637@table @asis
3638@item @emph{Description}:
fe284266 3639@code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
ee2242a2
JD
3640open Fortran I/O unit @code{UNIT}.
3641
cd051390
DF
3642@item @emph{Standard}:
3643GNU extension
ee2242a2
JD
3644
3645@item @emph{Class}:
3646non-elemental function
3647
3648@item @emph{Syntax}:
d565bb3a 3649@code{RESULT = FNUM(UNIT)}
ee2242a2
JD
3650
3651@item @emph{Arguments}:
3652@multitable @columnfractions .15 .80
3653@item @var{UNIT} @tab The type shall be @code{INTEGER}.
3654@end multitable
3655
3656@item @emph{Return value}:
3657The return value is of type @code{INTEGER}
3658
3659@item @emph{Example}:
3660@smallexample
3661program test_fnum
3662 integer :: i
3663 open (unit=10, status = "scratch")
3664 i = fnum(10)
3665 print *, i
3666 close (10)
3667end program test_fnum
3668@end smallexample
3669@end table
3670
3a3977a8
FXC
3671
3672
cd051390 3673@node FPUT
fe284266 3674@section @code{FPUT} --- Write a single character in stream mode to stdout
4ba96c02 3675@cindex @code{FPUT} intrinsic
fe284266
DF
3676@cindex file operations
3677@cindex stream operations
ee2242a2 3678
83d890b9
AL
3679@table @asis
3680@item @emph{Description}:
fe284266
DF
3681Write a single character in stream mode to stdout by bypassing normal
3682formatted output. Stream I/O should not be mixed with normal record-oriented
3683(formatted or unformatted) I/O on the same unit; the results are unpredictable.
3684
3685This intrinsic routine is provided for backwards compatibility with
7fc15ba5 3686@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
fe284266
DF
3687Programmers should consider the use of new stream IO feature in new code
3688for future portability. See also @ref{Fortran 2003 status}.
3689
cd051390
DF
3690@item @emph{Standard}:
3691GNU extension
3a3977a8
FXC
3692
3693@item @emph{Class}:
fe284266
DF
3694Non-elemental subroutine
3695
3a3977a8 3696@item @emph{Syntax}:
d565bb3a 3697@code{CALL FPUT(C [, STATUS])}
fe284266 3698
3a3977a8 3699@item @emph{Arguments}:
fe284266
DF
3700@multitable @columnfractions .15 .80
3701@item @var{C} @tab The type shall be @code{CHARACTER}.
3702@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3703 -1 on end-of-file and a system specific positive error code otherwise.
3704@end multitable
3705
3a3977a8 3706@item @emph{Example}:
fe284266
DF
3707@smallexample
3708PROGRAM test_fput
3709 CHARACTER(len=*) :: str = "gfortran"
3710 INTEGER :: i
3711 DO i = 1, len_trim(str)
3712 CALL fput(str(i:i))
3713 END DO
3714END PROGRAM
3715@end smallexample
3716
cd051390 3717@item @emph{See also}:
fe284266 3718@ref{FPUTC}, @ref{FGET}, @ref{FGETC}
cd051390
DF
3719@end table
3720
3721
3722
3723@node FPUTC
3724@section @code{FPUTC} --- Write a single character in stream mode
4ba96c02 3725@cindex @code{FPUTC} intrinsic
fe284266
DF
3726@cindex file operations
3727@cindex stream operations
cd051390
DF
3728
3729@table @asis
3730@item @emph{Description}:
fe284266
DF
3731Write a single character in stream mode by bypassing normal formatted
3732output. Stream I/O should not be mixed with normal record-oriented
3733(formatted or unformatted) I/O on the same unit; the results are unpredictable.
3734
3735This intrinsic routine is provided for backwards compatibility with
7fc15ba5 3736@command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
fe284266
DF
3737Programmers should consider the use of new stream IO feature in new code
3738for future portability. See also @ref{Fortran 2003 status}.
3739
cd051390
DF
3740@item @emph{Standard}:
3741GNU extension
3742
3743@item @emph{Class}:
fe284266
DF
3744Non-elemental subroutine
3745
cd051390 3746@item @emph{Syntax}:
d565bb3a 3747@code{CALL FPUTC(UNIT, C [, STATUS])}
fe284266 3748
cd051390 3749@item @emph{Arguments}:
fe284266
DF
3750@multitable @columnfractions .15 .80
3751@item @var{UNIT} @tab The type shall be @code{INTEGER}.
3752@item @var{C} @tab The type shall be @code{CHARACTER}.
3753@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3754 -1 on end-of-file and a system specific positive error code otherwise.
3755@end multitable
3756
cd051390 3757@item @emph{Example}:
fe284266
DF
3758@smallexample
3759PROGRAM test_fputc
3760 CHARACTER(len=*) :: str = "gfortran"
3761 INTEGER :: fd = 42, i
3762
3763 OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3764 DO i = 1, len_trim(str)
3765 CALL fputc(fd, str(i:i))
3766 END DO
3767 CLOSE(fd)
3768END PROGRAM
3769@end smallexample
3770
cd051390 3771@item @emph{See also}:
fe284266 3772@ref{FPUT}, @ref{FGET}, @ref{FGETC}
cd051390
DF
3773@end table
3774
3775
3776
3777@node FRACTION
3778@section @code{FRACTION} --- Fractional part of the model representation
4ba96c02 3779@cindex @code{FRACTION} intrinsic
cd051390
DF
3780@cindex fractional part
3781
3782@table @asis
3783@item @emph{Description}:
3784@code{FRACTION(X)} returns the fractional part of the model
3785representation of @code{X}.
3786
3787@item @emph{Standard}:
3788F95 and later
3789
3790@item @emph{Class}:
3791Elemental function
3792
3793@item @emph{Syntax}:
3794@code{Y = FRACTION(X)}
3795
3796@item @emph{Arguments}:
3797@multitable @columnfractions .15 .80
3798@item @var{X} @tab The type of the argument shall be a @code{REAL}.
3799@end multitable
3800
3801@item @emph{Return value}:
3802The return value is of the same type and kind as the argument.
3803The fractional part of the model representation of @code{X} is returned;
3804it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3805
3806@item @emph{Example}:
3807@smallexample
3808program test_fraction
3809 real :: x
3810 x = 178.1387e-4
3a3977a8
FXC
3811 print *, fraction(x), x * radix(x)**(-exponent(x))
3812end program test_fraction
3813@end smallexample
3814
3815@end table
3816
3817
3818
3819@node FREE
3820@section @code{FREE} --- Frees memory
4ba96c02
BM
3821@cindex @code{FREE} intrinsic
3822@cindex Cray pointers
3a3977a8
FXC
3823
3824@table @asis
3825@item @emph{Description}:
3826Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3827intrinsic is an extension intended to be used with Cray pointers, and is
7fc15ba5 3828provided in GNU Fortran to allow user to compile legacy code. For
3a3977a8
FXC
3829new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3830@code{DEALLOCATE}.
83d890b9 3831
cd051390
DF
3832@item @emph{Standard}:
3833GNU extension
83d890b9
AL
3834
3835@item @emph{Class}:
cd051390 3836Subroutine
83d890b9
AL
3837
3838@item @emph{Syntax}:
3a3977a8 3839@code{FREE(PTR)}
83d890b9
AL
3840
3841@item @emph{Arguments}:
3842@multitable @columnfractions .15 .80
3a3977a8
FXC
3843@item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3844location of the memory that should be de-allocated.
83d890b9
AL
3845@end multitable
3846
3847@item @emph{Return value}:
3a3977a8
FXC
3848None
3849
3850@item @emph{Example}:
3851See @code{MALLOC} for an example.
cd051390
DF
3852
3853@item @emph{See also}:
3854@ref{MALLOC}
3855@end table
3856
3857
3858
3859
3860@node FSTAT
3861@section @code{FSTAT} --- Get file status
4ba96c02 3862@cindex @code{FSTAT} intrinsic
21825fd6 3863@cindex file system operations
cd051390
DF
3864
3865@table @asis
3866@item @emph{Description}:
21825fd6
DF
3867@code{FSTAT} is identical to @ref{STAT}, except that information about an
3868already opened file is obtained.
3869
3870The elements in @code{BUFF} are the same as described by @ref{STAT}.
cd051390
DF
3871
3872@item @emph{Standard}:
21825fd6
DF
3873GNU extension
3874
cd051390 3875@item @emph{Class}:
21825fd6
DF
3876Non-elemental subroutine
3877
cd051390 3878@item @emph{Syntax}:
d565bb3a 3879@code{CALL FSTAT(UNIT, BUFF [, STATUS])}
21825fd6 3880
cd051390 3881@item @emph{Arguments}:
21825fd6
DF
3882@multitable @columnfractions .15 .80
3883@item @var{UNIT} @tab An open I/O unit number of type @code{INTEGER}.
3884@item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
3885@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
3886 on success and a system specific error code otherwise.
3887@end multitable
3888
cd051390 3889@item @emph{Example}:
21825fd6
DF
3890See @ref{STAT} for an example.
3891
cd051390 3892@item @emph{See also}:
21825fd6 3893To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
cd051390
DF
3894@end table
3895
3896
3897
3898@node FSEEK
3899@section @code{FSEEK} --- Low level file positioning subroutine
4ba96c02
BM
3900@cindex @code{FSEEK} intrinsic
3901@cindex file system operations
cd051390 3902
7fc15ba5 3903Not yet implemented in GNU Fortran.
cd051390
DF
3904
3905@table @asis
3906@item @emph{Description}:
3907
3908@item @emph{Standard}:
3909GNU extension
3910
3911@item @emph{Class}:
3912Subroutine
3913
3914@item @emph{Syntax}:
3915@item @emph{Arguments}:
3916@item @emph{Return value}:
3917@item @emph{Example}:
3918@item @emph{Specific names}:
3919@item @emph{See also}:
3920@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3921
3922@end table
3923
3924
3925
3926@node FTELL
3927@section @code{FTELL} --- Current stream position
4ba96c02 3928@cindex @code{FTELL} intrinsic
cd051390
DF
3929
3930@table @asis
3931@item @emph{Description}:
a1758c52
BM
3932Retrieves the current position within an open file.
3933
3934This intrinsic is provided in both subroutine and function forms; however,
3935only one form can be used in any given program unit.
3936
cd051390
DF
3937@item @emph{Standard}:
3938GNU extension
3939
3940@item @emph{Class}:
a1758c52
BM
3941Subroutine, function
3942
cd051390 3943@item @emph{Syntax}:
a1758c52
BM
3944@multitable @columnfractions .80
3945@item @code{CALL FTELL(UNIT, OFFSET)}
3946@item @code{OFFSET = FTELL(UNIT)}
3947@end multitable
3948
cd051390 3949@item @emph{Arguments}:
a1758c52
BM
3950@multitable @columnfractions .15 .80
3951@item @var{OFFSET} @tab Shall of type @code{INTEGER}.
3952@item @var{UNIT} @tab Shall of type @code{INTEGER}.
3953@end multitable
3954
cd051390 3955@item @emph{Return value}:
a1758c52
BM
3956In either syntax, @var{OFFSET} is set to the current offset of unit
3957number @var{UNIT}, or to @math{-1} if the unit is not currently open.
3958
cd051390 3959@item @emph{Example}:
a1758c52
BM
3960@smallexample
3961PROGRAM test_ftell
3962 INTEGER :: i
3963 OPEN(10, FILE="temp.dat")
3964 CALL ftell(10,i)
3965 WRITE(*,*) i
3966END PROGRAM
3967@end smallexample
21825fd6 3968
cd051390 3969@item @emph{See also}:
21825fd6 3970@ref{FSEEK}
cd051390
DF
3971@end table
3972
3973
3974
3975@node GETARG
3976@section @code{GETARG} --- Get command line arguments
4ba96c02
BM
3977@cindex @code{GETARG} intrinsic
3978@cindex command-line arguments, to program
cd051390
DF
3979
3980@table @asis
3981@item @emph{Description}:
21825fd6
DF
3982Retrieve the @var{N}th argument that was passed on the
3983command line when the containing program was invoked.
3984
3985This intrinsic routine is provided for backwards compatibility with
3986GNU Fortran 77. In new code, programmers should consider the use of
3987the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003
3988standard.
3989
cd051390
DF
3990@item @emph{Standard}:
3991GNU extension
3992
3993@item @emph{Class}:
21825fd6
DF
3994Subroutine
3995
cd051390 3996@item @emph{Syntax}:
d565bb3a 3997@code{CALL GETARG(N, ARG)}
21825fd6 3998
cd051390 3999@item @emph{Arguments}:
21825fd6
DF
4000@multitable @columnfractions .15 .80
4001@item @var{N} @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
4002@item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
4003@end multitable
4004
cd051390 4005@item @emph{Return value}:
21825fd6
DF
4006After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th
4007command line argument. If @var{ARG} can not hold the argument, it is
4008truncated to fit the length of @var{ARG}. If there are less than @var{N}
4009arguments specified at the command line, @var{ARG} will be filled with blanks.
4010If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
4011that support this feature).
4012
cd051390 4013@item @emph{Example}:
21825fd6
DF
4014@smallexample
4015PROGRAM test_getarg
4016 INTEGER :: i
4017 CHARACTER(len=32) :: arg
4018
4019 DO i = 1, iargc()
4020 CALL getarg(i, arg)
4021 WRITE (*,*) arg
4022 END DO
4023END PROGRAM
4024@end smallexample
cd051390
DF
4025
4026@item @emph{See also}:
b2a43373 4027GNU Fortran 77 compatibility function: @ref{IARGC}
21825fd6 4028
ea8dda63
BM
4029F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT},
4030@ref{COMMAND_ARGUMENT_COUNT}
cd051390
DF
4031@end table
4032
4033
4034
4035@node GET_COMMAND
21825fd6 4036@section @code{GET_COMMAND} --- Get the entire command line
4ba96c02
BM
4037@cindex @code{GET_COMMAND} intrinsic
4038@cindex command-line arguments, to program
cd051390
DF
4039
4040@table @asis
4041@item @emph{Description}:
21825fd6
DF
4042Retrieve the entire command line that was used to invoke the program.
4043
cd051390
DF
4044@item @emph{Standard}:
4045F2003
4046
4047@item @emph{Class}:
21825fd6
DF
4048Subroutine
4049
cd051390 4050@item @emph{Syntax}:
21825fd6
DF
4051@code{CALL GET_COMMAND(CMD)}
4052
cd051390 4053@item @emph{Arguments}:
21825fd6
DF
4054@multitable @columnfractions .15 .80
4055@item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}.
4056@end multitable
4057
cd051390 4058@item @emph{Return value}:
21825fd6
DF
4059Stores the entire command line that was used to invoke the program in @var{ARG}.
4060If @var{ARG} is not large enough, the command will be truncated.
4061
cd051390 4062@item @emph{Example}:
21825fd6
DF
4063@smallexample
4064PROGRAM test_get_command
4065 CHARACTER(len=255) :: cmd
4066 CALL get_command(cmd)
4067 WRITE (*,*) TRIM(cmd)
4068END PROGRAM
4069@end smallexample
4070
cd051390 4071@item @emph{See also}:
21825fd6 4072@ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
cd051390
DF
4073@end table
4074
4075
4076
4077@node GET_COMMAND_ARGUMENT
21825fd6 4078@section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
4ba96c02
BM
4079@cindex @code{GET_COMMAND_ARGUMENT} intrinsic
4080@cindex command-line arguments, to program
cd051390
DF
4081
4082@table @asis
4083@item @emph{Description}:
21825fd6
DF
4084Retrieve the @var{N}th argument that was passed on the
4085command line when the containing program was invoked.
4086
cd051390
DF
4087@item @emph{Standard}:
4088F2003
4089
4090@item @emph{Class}:
21825fd6
DF
4091Subroutine
4092
cd051390 4093@item @emph{Syntax}:
d565bb3a 4094@code{CALL GET_COMMAND_ARGUMENT(N, ARG)}
21825fd6 4095
cd051390 4096@item @emph{Arguments}:
21825fd6
DF
4097@multitable @columnfractions .15 .80
4098@item @var{N} @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
4099@item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
4100@end multitable
4101
cd051390 4102@item @emph{Return value}:
21825fd6
DF
4103After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the
4104@var{N}th command line argument. If @var{ARG} can not hold the argument, it is
4105truncated to fit the length of @var{ARG}. If there are less than @var{N}
4106arguments specified at the command line, @var{ARG} will be filled with blanks.
4107If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
4108that support this feature).
4109
cd051390 4110@item @emph{Example}:
21825fd6
DF
4111@smallexample
4112PROGRAM test_get_command_argument
4113 INTEGER :: i
4114 CHARACTER(len=32) :: arg
4115
4116 i = 0
4117 DO
4118 CALL get_command_argument(i, arg)
4119 IF (LEN_TRIM(arg) == 0) EXIT
4120
4121 WRITE (*,*) TRIM(arg)
4122 i = i+1
4123 END DO
4124END PROGRAM
4125@end smallexample
4126
cd051390 4127@item @emph{See also}:
21825fd6 4128@ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
cd051390
DF
4129@end table
4130
4131
4132
4133@node GETCWD
4134@section @code{GETCWD} --- Get current working directory
4ba96c02
BM
4135@cindex @code{GETCWD} intrinsic
4136@cindex file system operations
cd051390
DF
4137
4138@table @asis
4139@item @emph{Description}:
fe284266
DF
4140Get current working directory.
4141
cd051390
DF
4142@item @emph{Standard}:
4143GNU extension
4144
4145@item @emph{Class}:
fe284266
DF
4146Non-elemental subroutine.
4147
cd051390 4148@item @emph{Syntax}:
d565bb3a 4149@code{CALL GETCWD(CWD [, STATUS])}
fe284266 4150
cd051390 4151@item @emph{Arguments}:
fe284266
DF
4152@multitable @columnfractions .15 .80
4153@item @var{CWD} @tab The type shall be @code{CHARACTER(*)}.
4154@item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
4155 a system specific and non-zero error code otherwise.
4156@end multitable
4157
cd051390 4158@item @emph{Example}:
fe284266
DF
4159@smallexample
4160PROGRAM test_getcwd
4161 CHARACTER(len=255) :: cwd
4162 CALL getcwd(cwd)
4163 WRITE(*,*) TRIM(cwd)
4164END PROGRAM
4165@end smallexample
4166
cd051390 4167@item @emph{See also}:
fe284266 4168@ref{CHDIR}
cd051390
DF
4169@end table
4170
4171
4172
4173@node GETENV
4174@section @code{GETENV} --- Get an environmental variable
4ba96c02 4175@cindex @code{GETENV} intrinsic
21825fd6 4176@cindex environment variable
cd051390
DF
4177
4178@table @asis
4179@item @emph{Description}:
21825fd6
DF
4180Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4181
4182This intrinsic routine is provided for backwards compatibility with
4183GNU Fortran 77. In new code, programmers should consider the use of
4184the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
41852003 standard.
4186
cd051390
DF
4187@item @emph{Standard}:
4188GNU extension
4189
4190@item @emph{Class}:
21825fd6
DF
4191Subroutine
4192
cd051390 4193@item @emph{Syntax}:
d565bb3a 4194@code{CALL GETENV(ENVVAR, VALUE)}
21825fd6 4195
cd051390 4196@item @emph{Arguments}:
21825fd6
DF
4197@multitable @columnfractions .15 .80
4198@item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}.
4199@item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
4200@end multitable
4201
cd051390 4202@item @emph{Return value}:
21825fd6
DF
4203Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is
4204not large enough to hold the data, it is truncated. If @var{ENVVAR}
4205is not set, @var{VALUE} will be filled with blanks.
4206
cd051390 4207@item @emph{Example}:
21825fd6
DF
4208@smallexample
4209PROGRAM test_getenv
4210 CHARACTER(len=255) :: homedir
4211 CALL getenv("HOME", homedir)
4212 WRITE (*,*) TRIM(homedir)
4213END PROGRAM
4214@end smallexample
4215
cd051390
DF
4216@item @emph{See also}:
4217@ref{GET_ENVIRONMENT_VARIABLE}
4218@end table
4219
4220
4221
4222@node GET_ENVIRONMENT_VARIABLE
4223@section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
4ba96c02 4224@cindex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
21825fd6 4225@cindex environment variable
cd051390
DF
4226
4227@table @asis
4228@item @emph{Description}:
21825fd6
DF
4229Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4230
cd051390
DF
4231@item @emph{Standard}:
4232F2003
4233
4234@item @emph{Class}:
4235Subroutine
4236
4237@item @emph{Syntax}:
d565bb3a 4238@code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR, VALUE)}
21825fd6 4239
cd051390 4240@item @emph{Arguments}:
21825fd6
DF
4241@multitable @columnfractions .15 .80
4242@item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}.
4243@item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
4244@end multitable
4245
cd051390 4246@item @emph{Return value}:
21825fd6
DF
4247Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is
4248not large enough to hold the data, it is truncated. If @var{ENVVAR}
4249is not set, @var{VALUE} will be filled with blanks.
4250
cd051390 4251@item @emph{Example}:
21825fd6
DF
4252@smallexample
4253PROGRAM test_getenv
4254 CHARACTER(len=255) :: homedir
4255 CALL get_environment_variable("HOME", homedir)
4256 WRITE (*,*) TRIM(homedir)
4257END PROGRAM
4258@end smallexample
3a3977a8
FXC
4259@end table
4260
4261
4262
4263@node GETGID
4264@section @code{GETGID} --- Group ID function
4ba96c02
BM
4265@cindex @code{GETGID} intrinsic
4266@cindex file system operations
3a3977a8
FXC
4267
4268@table @asis
4269@item @emph{Description}:
4270Returns the numerical group ID of the current process.
4271
cd051390
DF
4272@item @emph{Standard}:
4273GNU extension
3a3977a8
FXC
4274
4275@item @emph{Class}:
4276function
4277
4278@item @emph{Syntax}:
d565bb3a 4279@code{RESULT = GETGID()}
3a3977a8
FXC
4280
4281@item @emph{Return value}:
4282The return value of @code{GETGID} is an @code{INTEGER} of the default
4283kind.
4284
4285
4286@item @emph{Example}:
4287See @code{GETPID} for an example.
4288
cd051390 4289@item @emph{See also}:
a1758c52 4290@ref{GETPID}, @ref{GETUID}
cd051390
DF
4291@end table
4292
4293
4294
4295@node GETLOG
4296@section @code{GETLOG} --- Get login name
4ba96c02 4297@cindex @code{GETLOG} intrinsic
cd051390
DF
4298
4299@table @asis
4300@item @emph{Description}:
a1758c52
BM
4301Gets the username under which the program is running.
4302
cd051390
DF
4303@item @emph{Standard}:
4304GNU extension
4305
4306@item @emph{Class}:
4307Subroutine
4308
4309@item @emph{Syntax}:
a1758c52
BM
4310@code{CALL GETLOG(LOGIN)}
4311
cd051390 4312@item @emph{Arguments}:
a1758c52
BM
4313@multitable @columnfractions .15 .80
4314@item @var{LOGIN} @tab Shall be of type @code{CHARACTER(*)}.
4315@end multitable
4316
cd051390 4317@item @emph{Return value}:
a1758c52
BM
4318Stores the current user name in @var{LOGIN}. (On systems where
4319the @code{getlogin(3)} function is not implemented, this will
4320return a blank string.)
4321
cd051390 4322@item @emph{Example}:
a1758c52
BM
4323@smallexample
4324PROGRAM TEST_GETLOG
4325 CHARACTER(32) :: login
4326 CALL GETLOG(login)
4327 WRITE(*,*) login
4328END PROGRAM
4329@end smallexample
4330
cd051390 4331@item @emph{See also}:
a1758c52 4332@ref{GETUID}
3a3977a8
FXC
4333@end table
4334
4335
4336
4337@node GETPID
4338@section @code{GETPID} --- Process ID function
4ba96c02
BM
4339@cindex @code{GETPID} intrinsic
4340@cindex process ID, current
3a3977a8
FXC
4341
4342@table @asis
4343@item @emph{Description}:
cd051390 4344Returns the numerical process identifier of the current process.
3a3977a8 4345
cd051390
DF
4346@item @emph{Standard}:
4347GNU extension
3a3977a8
FXC
4348
4349@item @emph{Class}:
4350function
4351
4352@item @emph{Syntax}:
d565bb3a 4353@code{RESULT = GETPID()}
3a3977a8
FXC
4354
4355@item @emph{Return value}:
4356The return value of @code{GETPID} is an @code{INTEGER} of the default
4357kind.
4358
83d890b9
AL
4359
4360@item @emph{Example}:
4361@smallexample
3a3977a8
FXC
4362program info
4363 print *, "The current process ID is ", getpid()
4364 print *, "Your numerical user ID is ", getuid()
4365 print *, "Your numerical group ID is ", getgid()
4366end program info
83d890b9 4367@end smallexample
3a3977a8 4368
a1758c52
BM
4369@item @emph{See also}:
4370@ref{GETGID}, @ref{GETUID}
83d890b9 4371@end table
ee2242a2 4372
3a3977a8
FXC
4373
4374
4375@node GETUID
4376@section @code{GETUID} --- User ID function
4ba96c02
BM
4377@cindex @code{GETUID} intrinsic
4378@cindex user ID, current
a5d58aeb
FXC
4379
4380@table @asis
4381@item @emph{Description}:
3a3977a8
FXC
4382Returns the numerical user ID of the current process.
4383
cd051390
DF
4384@item @emph{Standard}:
4385GNU extension
3a3977a8
FXC
4386
4387@item @emph{Class}:
4388function
4389
4390@item @emph{Syntax}:
d565bb3a 4391@code{RESULT = GETUID()}
3a3977a8
FXC
4392
4393@item @emph{Return value}:
4394The return value of @code{GETUID} is an @code{INTEGER} of the default
4395kind.
4396
4397
4398@item @emph{Example}:
4399See @code{GETPID} for an example.
4400
cd051390 4401@item @emph{See also}:
a1758c52 4402@ref{GETPID}, @ref{GETLOG}
cd051390
DF
4403@end table
4404
4405
4406
4407@node GMTIME
4408@section @code{GMTIME} --- Convert time to GMT info
4ba96c02
BM
4409@cindex @code{GMTIME} intrinsic
4410@cindex time, conversion function
cd051390 4411
cd051390
DF
4412@table @asis
4413@item @emph{Description}:
d3dfa1fe
BM
4414Given a system time value @var{STIME} (as provided by the @code{TIME8()}
4415intrinsic), fills @var{TARRAY} with values extracted from it appropriate
4416to the UTC time zone (Universal Coordinated Time, also known in some
4417countries as GMT, Greenwich Mean Time), using @code{gmtime(3)}.
cd051390
DF
4418
4419@item @emph{Standard}:
4420GNU extension
4421
4422@item @emph{Class}:
4423Subroutine
4424
4425@item @emph{Syntax}:
d3dfa1fe
BM
4426@code{CALL GMTIME(STIME, TARRAY)}
4427
cd051390 4428@item @emph{Arguments}:
d3dfa1fe
BM
4429@multitable @columnfractions .15 .80
4430@item @var{STIME} @tab An @code{INTEGER(*)} scalar expression
4431 corresponding to a system time, with
4432 @code{INTENT(IN)}.
4433@item @var{TARRAY} @tab A default @code{INTEGER} array with 9 elements,
4434 with @code{INTENT(OUT)}.
4435@end multitable
4436
cd051390 4437@item @emph{Return value}:
d3dfa1fe
BM
4438The elements of @var{TARRAY} are assigned as follows:
4439@enumerate
4440@item Seconds after the minute, range 0--59 or 0--61 to allow for leap
4441 seconds
4442@item Minutes after the hour, range 0--59
4443@item Hours past midnight, range 0--23
4444@item Day of month, range 0--31
4445@item Number of months since January, range 0--12
4446@item Years since 1900
4447@item Number of days since Sunday, range 0--6
4448@item Days since January 1
4449@item Daylight savings indicator: positive if daylight savings is in
4450 effect, zero if not, and negative if the information is not
4451 available.
4452@end enumerate
4453
cd051390 4454@item @emph{See also}:
d3dfa1fe 4455@ref{CTIME}, @ref{LTIME}, @ref{TIME}, @ref{TIME8}
cd051390
DF
4456
4457@end table
4458
4459
4460
4461@node HOSTNM
4462@section @code{HOSTNM} --- Get system host name
4ba96c02 4463@cindex @code{HOSTNM} intrinsic
cd051390
DF
4464
4465@table @asis
4466@item @emph{Description}:
a1758c52
BM
4467Retrieves the host name of the system on which the program is running.
4468
4469This intrinsic is provided in both subroutine and function forms; however,
4470only one form can be used in any given program unit.
4471
cd051390
DF
4472@item @emph{Standard}:
4473GNU extension
4474
4475@item @emph{Class}:
a1758c52
BM
4476Subroutine, function
4477
cd051390 4478@item @emph{Syntax}:
a1758c52
BM
4479@multitable @columnfractions .80
4480@item @code{CALL HOSTNM(NAME, STATUS)}
4481@item @code{STATUS = HOSTNM(NAME)}
4482@end multitable
4483
cd051390 4484@item @emph{Arguments}:
a1758c52
BM
4485@multitable @columnfractions .15 .80
4486@item @var{NAME} @tab Shall of type @code{CHARACTER(*)}.
4487@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
4488 Returns 0 on success, or a system specific error
4489 code otherwise.
4490@end multitable
4491
cd051390 4492@item @emph{Return value}:
a1758c52
BM
4493In either syntax, @var{NAME} is set to the current hostname if it can
4494be obtained, or to a blank string otherwise.
4495
3a3977a8
FXC
4496@end table
4497
4498
4499
4500@node HUGE
4501@section @code{HUGE} --- Largest number of a kind
4ba96c02 4502@cindex @code{HUGE} intrinsic
3a3977a8
FXC
4503@cindex huge
4504
4505@table @asis
4506@item @emph{Description}:
4507@code{HUGE(X)} returns the largest number that is not an infinity in
4508the model of the type of @code{X}.
a5d58aeb 4509
cd051390
DF
4510@item @emph{Standard}:
4511F95 and later
a5d58aeb 4512
eaef357b 4513@item @emph{Class}:
cd051390 4514Elemental function
a5d58aeb
FXC
4515
4516@item @emph{Syntax}:
d565bb3a 4517@code{RESULT = HUGE(X)}
a5d58aeb
FXC
4518
4519@item @emph{Arguments}:
4520@multitable @columnfractions .15 .80
3a3977a8 4521@item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
a5d58aeb
FXC
4522@end multitable
4523
4524@item @emph{Return value}:
3a3977a8 4525The return value is of the same type and kind as @var{X}
a5d58aeb
FXC
4526
4527@item @emph{Example}:
4528@smallexample
3a3977a8
FXC
4529program test_huge_tiny
4530 print *, huge(0), huge(0.0), huge(0.0d0)
4531 print *, tiny(0.0), tiny(0.0d0)
4532end program test_huge_tiny
a5d58aeb 4533@end smallexample
3a3977a8 4534@end table
a5d58aeb 4535
3a3977a8
FXC
4536
4537
4538@node IACHAR
4539@section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence
4ba96c02 4540@cindex @code{IACHAR} intrinsic
3a3977a8 4541@cindex @acronym{ASCII} collating sequence
cd051390 4542@cindex conversion function (character)
3a3977a8
FXC
4543
4544@table @asis
4545@item @emph{Description}:
4546@code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4547in the first character position of @code{C}.
4548
cd051390
DF
4549@item @emph{Standard}:
4550F95 and later
3a3977a8
FXC
4551
4552@item @emph{Class}:
cd051390 4553Elemental function
3a3977a8
FXC
4554
4555@item @emph{Syntax}:
d565bb3a 4556@code{RESULT = IACHAR(C)}
3a3977a8
FXC
4557
4558@item @emph{Arguments}:
4559@multitable @columnfractions .15 .80
4560@item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
a5d58aeb 4561@end multitable
3a3977a8
FXC
4562
4563@item @emph{Return value}:
4564The return value is of type @code{INTEGER} and of the default integer
4565kind.
4566
4567@item @emph{Example}:
4568@smallexample
4569program test_iachar
4570 integer i
4571 i = iachar(' ')
4572end program test_iachar
4573@end smallexample
cd051390
DF
4574
4575@item @emph{See also}:
7f4e7e0f 4576@ref{ACHAR}, @ref{CHAR}, @ref{ICHAR}
cd051390 4577
a5d58aeb
FXC
4578@end table
4579
4580
cd051390
DF
4581@node IAND
4582@section @code{IAND} --- Bitwise logical and
4ba96c02 4583@cindex @code{IAND} intrinsic
cd051390 4584@cindex bit operations
a5d58aeb 4585
a5d58aeb
FXC
4586@table @asis
4587@item @emph{Description}:
21825fd6
DF
4588Bitwise logical @code{AND}.
4589
cd051390
DF
4590@item @emph{Standard}:
4591F95 and later
a5d58aeb 4592
eaef357b 4593@item @emph{Class}:
cd051390 4594Elemental function
a5d58aeb
FXC
4595
4596@item @emph{Syntax}:
6d413586 4597@code{RESULT = IAND(I, J)}
21825fd6 4598
cd051390 4599@item @emph{Arguments}:
21825fd6 4600@multitable @columnfractions .15 .80
6d413586
BM
4601@item @var{I} @tab The type shall be @code{INTEGER(*)}.
4602@item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
4603kind as @var{I}. (As a GNU extension, different kinds are also
4604permitted.)
21825fd6
DF
4605@end multitable
4606
cd051390 4607@item @emph{Return value}:
6d413586
BM
4608The return type is @code{INTEGER(*)}, of the same kind as the
4609arguments. (If the argument kinds differ, it is of the same kind as
4610the larger argument.)
21825fd6 4611
cd051390 4612@item @emph{Example}:
21825fd6
DF
4613@smallexample
4614PROGRAM test_iand
4615 INTEGER :: a, b
4616 DATA a / Z'F' /, b / Z'3' /
4617 WRITE (*,*) IAND(a, b)
4618END PROGRAM
4619@end smallexample
cd051390
DF
4620
4621@item @emph{See also}:
d3dfa1fe
BM
4622@ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
4623
cd051390
DF
4624@end table
4625
4626
4627
cd051390 4628@node IARGC
21825fd6 4629@section @code{IARGC} --- Get the number of command line arguments
4ba96c02
BM
4630@cindex @code{IARGC} intrinsic
4631@cindex command-line arguments, to program
cd051390
DF
4632
4633@table @asis
4634@item @emph{Description}:
21825fd6
DF
4635@code{IARGC()} returns the number of arguments passed on the
4636command line when the containing program was invoked.
4637
4638This intrinsic routine is provided for backwards compatibility with
4639GNU Fortran 77. In new code, programmers should consider the use of
4640the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003
4641standard.
4642
cd051390
DF
4643@item @emph{Standard}:
4644GNU extension
4645
4646@item @emph{Class}:
21825fd6
DF
4647Non-elemental Function
4648
cd051390 4649@item @emph{Syntax}:
d565bb3a 4650@code{RESULT = IARGC()}
21825fd6 4651
cd051390 4652@item @emph{Arguments}:
21825fd6
DF
4653None.
4654
cd051390 4655@item @emph{Return value}:
21825fd6
DF
4656The number of command line arguments, type @code{INTEGER(4)}.
4657
cd051390 4658@item @emph{Example}:
21825fd6
DF
4659See @ref{GETARG}
4660
cd051390 4661@item @emph{See also}:
b2a43373 4662GNU Fortran 77 compatibility subroutine: @ref{GETARG}
cd051390 4663
ea8dda63
BM
4664F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT},
4665@ref{COMMAND_ARGUMENT_COUNT}
cd051390
DF
4666@end table
4667
4668
4669
cd051390
DF
4670@node IBCLR
4671@section @code{IBCLR} --- Clear bit
4ba96c02 4672@cindex @code{IBCLR} intrinsic
cd051390
DF
4673@cindex bit operations
4674
cd051390
DF
4675@table @asis
4676@item @emph{Description}:
6d413586
BM
4677@code{IBCLR} returns the value of @var{I} with the bit at position
4678@var{POS} set to zero.
4679
cd051390
DF
4680@item @emph{Standard}:
4681F95 and later
4682
4683@item @emph{Class}:
4684Elemental function
4685
4686@item @emph{Syntax}:
6d413586
BM
4687@code{RESULT = IBCLR(I, POS)}
4688
cd051390 4689@item @emph{Arguments}:
6d413586
BM
4690@multitable @columnfractions .15 .80
4691@item @var{I} @tab The type shall be @code{INTEGER(*)}.
4692@item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4693@end multitable
4694
cd051390 4695@item @emph{Return value}:
6d413586
BM
4696The return value is of type @code{INTEGER(*)} and of the same kind as
4697@var{I}.
cd051390
DF
4698
4699@item @emph{See also}:
d3dfa1fe
BM
4700@ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}, @ref{MVBITS}
4701
cd051390
DF
4702@end table
4703
4704
4705
cd051390
DF
4706@node IBITS
4707@section @code{IBITS} --- Bit extraction
4ba96c02 4708@cindex @code{IBITS} intrinsic
cd051390
DF
4709@cindex bit operations
4710
cd051390
DF
4711@table @asis
4712@item @emph{Description}:
6d413586
BM
4713@code{IBITS} extracts a field of length @var{LEN} from @var{I},
4714starting from bit position @var{POS} and extending left for @var{LEN}
4715bits. The result is right-justified and the remaining bits are
4716zeroed. The value of @code{POS+LEN} must be less than or equal to the
4717value @code{BIT_SIZE(I)}.
4718
cd051390
DF
4719@item @emph{Standard}:
4720F95 and later
4721
4722@item @emph{Class}:
4723Elemental function
4724
4725@item @emph{Syntax}:
6d413586
BM
4726@code{RESULT = IBITS(I, POS, LEN)}
4727
cd051390 4728@item @emph{Arguments}:
6d413586
BM
4729@multitable @columnfractions .15 .80
4730@item @var{I} @tab The type shall be @code{INTEGER(*)}.
4731@item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4732@item @var{LEN} @tab The type shall be @code{INTEGER(*)}.
4733@end multitable
4734
cd051390 4735@item @emph{Return value}:
6d413586
BM
4736The return value is of type @code{INTEGER(*)} and of the same kind as
4737@var{I}.
cd051390 4738
6d413586
BM
4739@item @emph{See also}:
4740@ref{BIT_SIZE}, @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
cd051390
DF
4741@end table
4742
4743
4744
cd051390
DF
4745@node IBSET
4746@section @code{IBSET} --- Set bit
4ba96c02 4747@cindex @code{IBSET} intrinsic
cd051390
DF
4748@cindex bit operations
4749
cd051390
DF
4750@table @asis
4751@item @emph{Description}:
6d413586
BM
4752@code{IBSET} returns the value of @var{I} with the bit at position
4753@var{POS} set to one.
4754
cd051390
DF
4755@item @emph{Standard}:
4756F95 and later
4757
4758@item @emph{Class}:
4759Elemental function
4760
4761@item @emph{Syntax}:
6d413586
BM
4762@code{RESULT = IBSET(I, POS)}
4763
cd051390 4764@item @emph{Arguments}:
6d413586
BM
4765@multitable @columnfractions .15 .80
4766@item @var{I} @tab The type shall be @code{INTEGER(*)}.
4767@item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4768@end multitable
4769
cd051390 4770@item @emph{Return value}:
6d413586
BM
4771The return value is of type @code{INTEGER(*)} and of the same kind as
4772@var{I}.
cd051390
DF
4773
4774@item @emph{See also}:
d3dfa1fe
BM
4775@ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}, @ref{MVBITS}
4776
cd051390
DF
4777@end table
4778
4779
4780
4781@node ICHAR
4782@section @code{ICHAR} --- Character-to-integer conversion function
4ba96c02 4783@cindex @code{ICHAR} intrinsic
cd051390
DF
4784@cindex conversion function (character)
4785
4786@table @asis
4787@item @emph{Description}:
4788@code{ICHAR(C)} returns the code for the character in the first character
4789position of @code{C} in the system's native character set.
4790The correspondence between characters and their codes is not necessarily
4791the same across different GNU Fortran implementations.
4792
4793@item @emph{Standard}:
4794F95 and later
4795
4796@item @emph{Class}:
4797Elemental function
4798
4799@item @emph{Syntax}:
d565bb3a 4800@code{RESULT = ICHAR(C)}
cd051390 4801
a5d58aeb
FXC
4802@item @emph{Arguments}:
4803@multitable @columnfractions .15 .80
3a3977a8
FXC
4804@item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4805@end multitable
4806
4807@item @emph{Return value}:
4808The return value is of type @code{INTEGER} and of the default integer
4809kind.
4810
4811@item @emph{Example}:
4812@smallexample
4813program test_ichar
4814 integer i
4815 i = ichar(' ')
4816end program test_ichar
4817@end smallexample
4818
4819@item @emph{Note}:
4820No intrinsic exists to convert a printable character string to a numerical
4821value. For example, there is no intrinsic that, given the @code{CHARACTER}
4822value 154, returns an @code{INTEGER} or @code{REAL} value with the
4823value 154.
4824
4825Instead, you can use internal-file I/O to do this kind of conversion. For
4826example:
4827@smallexample
4828program read_val
4829 integer value
4830 character(len=10) string
4831
4832 string = '154'
4833 read (string,'(I10)') value
4834 print *, value
4835end program read_val
4836@end smallexample
7f4e7e0f
BM
4837
4838@item @emph{See also}:
4839@ref{ACHAR}, @ref{CHAR}, @ref{IACHAR}
4840
3a3977a8
FXC
4841@end table
4842
7f4e7e0f
BM
4843
4844
12197210
FXC
4845@node IDATE
4846@section @code{IDATE} --- Get current local time subroutine (day/month/year)
4ba96c02 4847@cindex @code{IDATE} intrinsic
12197210
FXC
4848
4849@table @asis
4850@item @emph{Description}:
4851@code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4852current local time. The day (in the range 1-31), month (in the range 1-12),
4853and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively.
4854The year has four significant digits.
4855
cd051390
DF
4856@item @emph{Standard}:
4857GNU extension
12197210
FXC
4858
4859@item @emph{Class}:
cd051390 4860Subroutine
12197210
FXC
4861
4862@item @emph{Syntax}:
4863@code{CALL IDATE(TARRAY)}
4864
4865@item @emph{Arguments}:
4866@multitable @columnfractions .15 .80
4867@item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4868the kind shall be the default integer kind.
4869@end multitable
4870
4871@item @emph{Return value}:
4872Does not return.
4873
4874@item @emph{Example}:
4875@smallexample
4876program test_idate
4877 integer, dimension(3) :: tarray
4878 call idate(tarray)
4879 print *, tarray(1)
4880 print *, tarray(2)
4881 print *, tarray(3)
4882end program test_idate
4883@end smallexample
4884@end table
3a3977a8
FXC
4885
4886
cd051390
DF
4887
4888@node IEOR
4889@section @code{IEOR} --- Bitwise logical exclusive or
4ba96c02 4890@cindex @code{IEOR} intrinsic
cd051390
DF
4891@cindex bit operations
4892
cd051390
DF
4893@table @asis
4894@item @emph{Description}:
6d413586
BM
4895@code{IEOR} returns the bitwise boolean exclusive-OR of @var{I} and
4896@var{J}.
4897
cd051390
DF
4898@item @emph{Standard}:
4899F95 and later
4900
4901@item @emph{Class}:
4902Elemental function
4903
4904@item @emph{Syntax}:
6d413586
BM
4905@code{RESULT = IEOR(I, J)}
4906
cd051390 4907@item @emph{Arguments}:
6d413586
BM
4908@multitable @columnfractions .15 .80
4909@item @var{I} @tab The type shall be @code{INTEGER(*)}.
4910@item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
4911kind as @var{I}. (As a GNU extension, different kinds are also
4912permitted.)
4913@end multitable
4914
cd051390 4915@item @emph{Return value}:
6d413586
BM
4916The return type is @code{INTEGER(*)}, of the same kind as the
4917arguments. (If the argument kinds differ, it is of the same kind as
4918the larger argument.)
cd051390
DF
4919
4920@item @emph{See also}:
d3dfa1fe 4921@ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
cd051390
DF
4922@end table
4923
4924
4925
cd051390
DF
4926@node IERRNO
4927@section @code{IERRNO} --- Get the last system error number
4ba96c02 4928@cindex @code{IERRNO} intrinsic
cd051390
DF
4929
4930@table @asis
4931@item @emph{Description}:
6d413586
BM
4932Returns the last system error number, as given by the C @code{errno()}
4933function.
4934
cd051390
DF
4935@item @emph{Standard}:
4936GNU extension
4937
4938@item @emph{Class}:
6d413586
BM
4939Elemental function
4940
cd051390 4941@item @emph{Syntax}:
d565bb3a 4942@code{RESULT = IERRNO()}
6d413586 4943
cd051390 4944@item @emph{Arguments}:
6d413586
BM
4945None.
4946
cd051390 4947@item @emph{Return value}:
6d413586
BM
4948The return value is of type @code{INTEGER} and of the default integer
4949kind.
cd051390
DF
4950
4951@item @emph{See also}:
4952@ref{PERROR}
4953@end table
4954
4955
4956
cd051390
DF
4957@node INDEX
4958@section @code{INDEX} --- Position of a substring within a string
4ba96c02 4959@cindex @code{INDEX} intrinsic
cd051390
DF
4960
4961@table @asis
4962@item @emph{Description}:
6d413586
BM
4963Returns the position of the start of the first occurrence of string
4964@var{SUBSTRING} as a substring in @var{STRING}, counting from one. If
4965@var{SUBSTRING} is not present in @var{STRING}, zero is returned. If
4966the @var{BACK} argument is present and true, the return value is the
4967start of the last occurrence rather than the first.
4968
cd051390
DF
4969@item @emph{Standard}:
4970F77 and later
4971
4972@item @emph{Class}:
4973Elemental function
4974
4975@item @emph{Syntax}:
d565bb3a 4976@code{RESULT = INDEX(STRING, SUBSTRING [, BACK])}
6d413586 4977
cd051390 4978@item @emph{Arguments}:
6d413586
BM
4979@multitable @columnfractions .15 .80
4980@item @var{STRING} @tab Shall be a scalar @code{CHARACTER(*)}, with
4981@code{INTENT(IN)}
4982@item @var{SUBSTRING} @tab Shall be a scalar @code{CHARACTER(*)}, with
4983@code{INTENT(IN)}
4984@item @var{BACK} @tab (Optional) Shall be a scalar @code{LOGICAL(*)}, with
4985@code{INTENT(IN)}
4986@end multitable
4987
cd051390 4988@item @emph{Return value}:
6d413586
BM
4989The return value is of type @code{INTEGER} and of the default integer
4990kind.
4991
cd051390
DF
4992@item @emph{See also}:
4993@end table
4994
4995
4996
cd051390
DF
4997@node INT
4998@section @code{INT} --- Convert to integer type
4ba96c02
BM
4999@cindex @code{INT} intrinsic
5000@cindex @code{IFIX} intrinsic
5001@cindex @code{IDINT} intrinsic
cd051390
DF
5002@cindex conversion function (integer)
5003
5004@table @asis
5005@item @emph{Description}:
5006Convert to integer type
5007
5008@item @emph{Standard}:
5009F77 and later
5010
5011@item @emph{Class}:
5012Elemental function
5013
5014@item @emph{Syntax}:
d565bb3a 5015@item @code{RESULT = INT(X [, KIND))}
cd051390
DF
5016
5017@item @emph{Arguments}:
5018@multitable @columnfractions .15 .80
d3dfa1fe
BM
5019@item @var{X} @tab shall be of type @code{INTEGER(*)},
5020 @code{REAL(*)}, or @code{COMPLEX(*)}.
5021@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
5022 expression indicating the kind parameter of
5023 the result.
cd051390
DF
5024@end multitable
5025
5026@item @emph{Return value}:
5027These functions return a @code{INTEGER(*)} variable or array under
5028the following rules:
5029
5030@table @asis
5031@item (A)
5032If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X}
5033@item (B)
d3dfa1fe 5034If @var{X} is of type @code{REAL(*)} and @math{|X| < 1}, @code{INT(X)} equals @var{0}.
cd051390
DF
5035If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed
5036the range of @var{X} and whose sign is the same as the sign of @var{X}.
5037@item (C)
5038If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
5039@end table
5040
5041@item @emph{Example}:
5042@smallexample
5043program test_int
5044 integer :: i = 42
5045 complex :: z = (-3.7, 1.0)
5046 print *, int(i)
5047 print *, int(z), int(z,8)
5048end program
5049@end smallexample
5050
5051@item @emph{Specific names}:
5052@multitable @columnfractions .20 .20 .20 .40
5053@item Name @tab Argument @tab Return type @tab Standard
5054@item @code{IFIX(X)} @tab @code{REAL(4) X} @tab @code{INTEGER} @tab F77 and later
5055@item @code{IDINT(X)} @tab @code{REAL(8) X} @tab @code{INTEGER} @tab F77 and later
5056@end multitable
5057
5058@comment @item @emph{See also}:
5059@end table
5060
5061
5062
cd051390
DF
5063@node IOR
5064@section @code{IOR} --- Bitwise logical or
4ba96c02 5065@cindex @code{IOR} intrinsic
cd051390
DF
5066@cindex bit operations
5067
cd051390
DF
5068@table @asis
5069@item @emph{Description}:
6d413586
BM
5070@code{IEOR} returns the bitwise boolean OR of @var{I} and
5071@var{J}.
5072
cd051390
DF
5073@item @emph{Standard}:
5074F95 and later
5075
5076@item @emph{Class}:
5077Elemental function
5078
5079@item @emph{Syntax}:
6d413586
BM
5080@code{RESULT = IEOR(I, J)}
5081
cd051390 5082@item @emph{Arguments}:
6d413586
BM
5083@multitable @columnfractions .15 .80
5084@item @var{I} @tab The type shall be @code{INTEGER(*)}.
5085@item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
5086kind as @var{I}. (As a GNU extension, different kinds are also
5087permitted.)
5088@end multitable
5089
cd051390 5090@item @emph{Return value}:
6d413586
BM
5091The return type is @code{INTEGER(*)}, of the same kind as the
5092arguments. (If the argument kinds differ, it is of the same kind as
5093the larger argument.)
cd051390
DF
5094
5095@item @emph{See also}:
d3dfa1fe 5096@ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}, @ref{NOT}
cd051390
DF
5097@end table
5098
5099
5100
5101
3a3977a8
FXC
5102@node IRAND
5103@section @code{IRAND} --- Integer pseudo-random number
4ba96c02
BM
5104@cindex @code{IRAND} intrinsic
5105@cindex random numbers
3a3977a8
FXC
5106
5107@table @asis
5108@item @emph{Description}:
5109@code{IRAND(FLAG)} returns a pseudo-random number from a uniform
5110distribution between 0 and a system-dependent limit (which is in most
5111cases 2147483647). If @var{FLAG} is 0, the next number
5112in the current sequence is returned; if @var{FLAG} is 1, the generator
5113is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
5114it is used as a new seed with @code{SRAND}.
5115
cd051390
DF
5116@item @emph{Standard}:
5117GNU extension
3a3977a8
FXC
5118
5119@item @emph{Class}:
5120non-elemental function
5121
5122@item @emph{Syntax}:
d565bb3a 5123@code{RESULT = IRAND(FLAG)}
3a3977a8
FXC
5124
5125@item @emph{Arguments}:
5126@multitable @columnfractions .15 .80
5127@item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
5128@end multitable
5129
5130@item @emph{Return value}:
5131The return value is of @code{INTEGER(kind=4)} type.
5132
5133@item @emph{Example}:
5134@smallexample
5135program test_irand
5136 integer,parameter :: seed = 86456
5137
5138 call srand(seed)
5139 print *, irand(), irand(), irand(), irand()
5140 print *, irand(seed), irand(), irand(), irand()
5141end program test_irand
5142@end smallexample
5143
5144@end table
5145
cd051390
DF
5146
5147
5148@node ISHFT
5149@section @code{ISHFT} --- Shift bits
4ba96c02
BM
5150@cindex @code{ISHFT} intrinsic
5151@cindex bit operations
cd051390 5152
cd051390
DF
5153@table @asis
5154@item @emph{Description}:
6d413586
BM
5155@code{ISHFT} returns a value corresponding to @var{I} with all of the
5156bits shifted @var{SHIFT} places. A value of @var{SHIFT} greater than
5157zero corresponds to a left shift, a value of zero corresponds to no
5158shift, and a value less than zero corresponds to a right shift. If the
5159absolute value of @var{SHIFT} is greater than @code{BIT_SIZE(I)}, the
5160value is undefined. Bits shifted out from the left end or right end are
5161lost; zeros are shifted in from the opposite end.
5162
cd051390
DF
5163@item @emph{Standard}:
5164F95 and later
5165
5166@item @emph{Class}:
5167Elemental function
5168
5169@item @emph{Syntax}:
6d413586
BM
5170@code{RESULT = ISHFT(I, SHIFT)}
5171
cd051390 5172@item @emph{Arguments}:
6d413586
BM
5173@multitable @columnfractions .15 .80
5174@item @var{I} @tab The type shall be @code{INTEGER(*)}.
5175@item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5176@end multitable
5177
cd051390 5178@item @emph{Return value}:
6d413586
BM
5179The return value is of type @code{INTEGER(*)} and of the same kind as
5180@var{I}.
cd051390
DF
5181
5182@item @emph{See also}:
5183@ref{ISHFTC}
5184@end table
5185
5186
5187
5188
5189@node ISHFTC
5190@section @code{ISHFTC} --- Shift bits circularly
4ba96c02
BM
5191@cindex @code{ISHFTC} intrinsic
5192@cindex bit operations
cd051390 5193
cd051390
DF
5194@table @asis
5195@item @emph{Description}:
6d413586
BM
5196@code{ISHFTC} returns a value corresponding to @var{I} with the
5197rightmost @var{SIZE} bits shifted circularly @var{SHIFT} places; that
5198is, bits shifted out one end are shifted into the opposite end. A value
5199of @var{SHIFT} greater than zero corresponds to a left shift, a value of
5200zero corresponds to no shift, and a value less than zero corresponds to
5201a right shift. The absolute value of @var{SHIFT} must be less than
5202@var{SIZE}. If the @var{SIZE} argument is omitted, it is taken to be
5203equivalent to @code{BIT_SIZE(I)}.
5204
cd051390
DF
5205@item @emph{Standard}:
5206F95 and later
5207
5208@item @emph{Class}:
5209Elemental function
5210
5211@item @emph{Syntax}:
6d413586
BM
5212@code{RESULT = ISHFTC(I, SHIFT [, SIZE])}
5213
cd051390 5214@item @emph{Arguments}:
6d413586
BM
5215@multitable @columnfractions .15 .80
5216@item @var{I} @tab The type shall be @code{INTEGER(*)}.
5217@item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5218@item @var{SIZE} @tab (Optional) The type shall be @code{INTEGER(*)};
5219the value must be greater than zero and less than or equal to
5220@code{BIT_SIZE(I)}.
5221@end multitable
5222
cd051390 5223@item @emph{Return value}:
6d413586
BM
5224The return value is of type @code{INTEGER(*)} and of the same kind as
5225@var{I}.
cd051390
DF
5226
5227@item @emph{See also}:
5228@ref{ISHFT}
5229@end table
5230
5231
5232
12197210
FXC
5233@node ITIME
5234@section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds)
4ba96c02 5235@cindex @code{ITIME} intrinsic
12197210
FXC
5236
5237@table @asis
5238@item @emph{Description}:
5239@code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
5240current local time. The hour (in the range 1-24), minute (in the range 1-60),
5241and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY},
5242respectively.
5243
cd051390
DF
5244@item @emph{Standard}:
5245GNU extension
12197210
FXC
5246
5247@item @emph{Class}:
cd051390 5248Subroutine
12197210
FXC
5249
5250@item @emph{Syntax}:
5251@code{CALL ITIME(TARRAY)}
5252
5253@item @emph{Arguments}:
5254@multitable @columnfractions .15 .80
5255@item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
5256and the kind shall be the default integer kind.
5257@end multitable
5258
5259@item @emph{Return value}:
5260Does not return.
5261
5262
5263@item @emph{Example}:
5264@smallexample
5265program test_itime
5266 integer, dimension(3) :: tarray
5267 call itime(tarray)
5268 print *, tarray(1)
5269 print *, tarray(2)
5270 print *, tarray(3)
5271end program test_itime
5272@end smallexample
5273@end table
3a3977a8
FXC
5274
5275
cd051390
DF
5276
5277@node KILL
5278@section @code{KILL} --- Send a signal to a process
4ba96c02 5279@cindex @code{KILL} intrinsic
3a3977a8
FXC
5280
5281@table @asis
5282@item @emph{Description}:
cd051390 5283@item @emph{Standard}:
6d413586
BM
5284Sends the signal specified by @var{SIGNAL} to the process @var{PID}.
5285See @code{kill(2)}.
3a3977a8
FXC
5286
5287@item @emph{Class}:
cd051390 5288Subroutine
3a3977a8
FXC
5289
5290@item @emph{Syntax}:
6d413586
BM
5291@code{CALL KILL(PID, SIGNAL [, STATUS])}
5292
3a3977a8 5293@item @emph{Arguments}:
6d413586
BM
5294@multitable @columnfractions .15 .80
5295@item @var{PID} @tab Shall be a scalar @code{INTEGER}, with
5296@code{INTENT(IN)}
5297@item @var{SIGNAL} @tab Shall be a scalar @code{INTEGER}, with
5298@code{INTENT(IN)}
5299@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)} or
5300 @code{INTEGER(8)}. Returns 0 on success, or a
5301 system-specific error code otherwise.
5302@end multitable
cd051390
DF
5303
5304@item @emph{See also}:
5305@ref{ABORT}, @ref{EXIT}
5306@end table
5307
5308
5309
5310@node KIND
5311@section @code{KIND} --- Kind of an entity
4ba96c02 5312@cindex @code{KIND} intrinsic
cd051390
DF
5313
5314@table @asis
5315@item @emph{Description}:
5316@code{KIND(X)} returns the kind value of the entity @var{X}.
5317
5318@item @emph{Standard}:
5319F95 and later
5320
5321@item @emph{Class}:
5322Inquiry function
5323
5324@item @emph{Syntax}:
5325@code{K = KIND(X)}
5326
5327@item @emph{Arguments}:
5328@multitable @columnfractions .15 .80
5329@item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
5330@code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
5331@end multitable
5332
5333@item @emph{Return value}:
5334The return value is a scalar of type @code{INTEGER} and of the default
5335integer kind.
3a3977a8
FXC
5336
5337@item @emph{Example}:
5338@smallexample
5339program test_kind
5340 integer,parameter :: kc = kind(' ')
5341 integer,parameter :: kl = kind(.true.)
5342
5343 print *, "The default character kind is ", kc
5344 print *, "The default logical kind is ", kl
5345end program test_kind
5346@end smallexample
5347
5348@end table
5349
5350
5351
cd051390
DF
5352@node LBOUND
5353@section @code{LBOUND} --- Lower dimension bounds of an array
4ba96c02 5354@cindex @code{LBOUND} intrinsic
cd051390
DF
5355
5356@table @asis
5357@item @emph{Description}:
bc5b7642
BM
5358Returns the lower bounds of an array, or a single lower bound
5359along the @var{DIM} dimension.
cd051390
DF
5360@item @emph{Standard}:
5361F95 and later
5362
5363@item @emph{Class}:
5364Inquiry function
5365
5366@item @emph{Syntax}:
d565bb3a 5367@code{RESULT = LBOUND(ARRAY [, DIM])}
bc5b7642 5368
cd051390 5369@item @emph{Arguments}:
bc5b7642
BM
5370@multitable @columnfractions .15 .80
5371@item @var{ARRAY} @tab Shall be an array, of any type.
5372@item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER(*)}.
5373@end multitable
5374
cd051390 5375@item @emph{Return value}:
bc5b7642
BM
5376If @var{DIM} is absent, the result is an array of the lower bounds of
5377@var{ARRAY}. If @var{DIM} is present, the result is a scalar
5378corresponding to the lower bound of the array along that dimension. If
5379@var{ARRAY} is an expression rather than a whole array or array
5380structure component, or if it has a zero extent along the relevant
5381dimension, the lower bound is taken to be 1.
5382
cd051390
DF
5383@item @emph{See also}:
5384@ref{UBOUND}
5385@end table
5386
5387
5388
cd051390
DF
5389@node LEN
5390@section @code{LEN} --- Length of a character entity
4ba96c02 5391@cindex @code{LEN} intrinsic
cd051390
DF
5392
5393@table @asis
5394@item @emph{Description}:
6d413586
BM
5395Returns the length of a character string. If @var{STRING} is an array,
5396the length of an element of @var{STRING} is returned. Note that
5397@var{STRING} need not be defined when this intrinsic is invoked, since
5398only the length, not the content, of @var{STRING} is needed.
5399
cd051390
DF
5400@item @emph{Standard}:
5401F77 and later
5402
5403@item @emph{Class}:
5404Inquiry function
5405
5406@item @emph{Syntax}:
6d413586
BM
5407@code{L = LEN(STRING)}
5408
cd051390 5409@item @emph{Arguments}:
6d413586
BM
5410@multitable @columnfractions .15 .80
5411@item @var{STRING} @tab Shall be a scalar or array of type
5412@code{CHARACTER(*)}, with @code{INTENT(IN)}
5413@end multitable
5414
cd051390 5415@item @emph{Return value}:
6d413586 5416The return value is an @code{INTEGER} of the default kind.
cd051390
DF
5417
5418@item @emph{See also}:
5419@ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
5420@end table
5421
5422
5423
cd051390
DF
5424@node LEN_TRIM
5425@section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
4ba96c02 5426@cindex @code{LEN_TRIM} intrinsic
cd051390
DF
5427
5428@table @asis
5429@item @emph{Description}:
6d413586
BM
5430Returns the length of a character string, ignoring any trailing blanks.
5431
cd051390
DF
5432@item @emph{Standard}:
5433F95 and later
5434
5435@item @emph{Class}:
5436Elemental function
5437
5438@item @emph{Syntax}:
d565bb3a 5439@code{RESULT = LEN_TRIM(STRING)}
6d413586 5440
cd051390 5441@item @emph{Arguments}:
6d413586
BM
5442@multitable @columnfractions .15 .80
5443@item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER(*)},
5444with @code{INTENT(IN)}
5445@end multitable
5446
cd051390 5447@item @emph{Return value}:
d3dfa1fe 5448The return value is an @code{INTEGER} of the default kind.
cd051390
DF
5449
5450@item @emph{See also}:
5451@ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
5452@end table
5453
5454
5455
cd051390
DF
5456@node LGE
5457@section @code{LGE} --- Lexical greater than or equal
4ba96c02 5458@cindex @code{LGE} intrinsic
cd051390 5459@cindex comparison (lexical)
bc5b7642 5460@cindex lexical comparison
cd051390
DF
5461
5462@table @asis
5463@item @emph{Description}:
bc5b7642
BM
5464Determines whether one string is lexically greater than or equal to
5465another string, where the two strings are interpreted as containing
5466ASCII character codes. If the String A and String B are not the same
5467length, the shorter is compared as if spaces were appended to it to form
5468a value that has the same length as the longer.
5469
5470In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5471@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5472operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5473that the latter use the processor's character ordering (which is not
5474ASCII on some targets), whereas the former always use the ASCII
5475ordering.
5476
cd051390
DF
5477@item @emph{Standard}:
5478F77 and later
5479
5480@item @emph{Class}:
5481Elemental function
5482
5483@item @emph{Syntax}:
d565bb3a 5484@code{RESULT = LGE(STRING_A, STRING_B)}
bc5b7642 5485
cd051390 5486@item @emph{Arguments}:
bc5b7642
BM
5487@multitable @columnfractions .15 .80
5488@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5489@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5490@end multitable
5491
cd051390 5492@item @emph{Return value}:
bc5b7642
BM
5493Returns @code{.TRUE.} if @code{STRING_A >= STRING_B}, and @code{.FALSE.}
5494otherwise, based on the ASCII ordering.
cd051390
DF
5495
5496@item @emph{See also}:
5497@ref{LGT}, @ref{LLE}, @ref{LLT}
5498@end table
5499
5500
5501
cd051390
DF
5502@node LGT
5503@section @code{LGT} --- Lexical greater than
4ba96c02 5504@cindex @code{LGT} intrinsic
cd051390 5505@cindex comparison (lexical)
bc5b7642 5506@cindex lexical comparison
cd051390
DF
5507
5508@table @asis
5509@item @emph{Description}:
bc5b7642
BM
5510Determines whether one string is lexically greater than another string,
5511where the two strings are interpreted as containing ASCII character
5512codes. If the String A and String B are not the same length, the
5513shorter is compared as if spaces were appended to it to form a value
5514that has the same length as the longer.
5515
5516In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5517@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5518operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5519that the latter use the processor's character ordering (which is not
5520ASCII on some targets), whereas the former always use the ASCII
5521ordering.
5522
cd051390
DF
5523@item @emph{Standard}:
5524F77 and later
5525
5526@item @emph{Class}:
5527Elemental function
5528
5529@item @emph{Syntax}:
d565bb3a 5530@code{RESULT = LGT(STRING_A, STRING_B)}
bc5b7642 5531
cd051390 5532@item @emph{Arguments}:
bc5b7642
BM
5533@multitable @columnfractions .15 .80
5534@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5535@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5536@end multitable
5537
cd051390 5538@item @emph{Return value}:
bc5b7642
BM
5539Returns @code{.TRUE.} if @code{STRING_A > STRING_B}, and @code{.FALSE.}
5540otherwise, based on the ASCII ordering.
cd051390
DF
5541
5542@item @emph{See also}:
5543@ref{LGE}, @ref{LLE}, @ref{LLT}
5544@end table
5545
5546
5547
cd051390
DF
5548@node LINK
5549@section @code{LINK} --- Create a hard link
4ba96c02 5550@cindex @code{LINK} intrinsic
cd051390
DF
5551@cindex file system operations
5552
cd051390
DF
5553@table @asis
5554@item @emph{Description}:
ea8dda63
BM
5555Makes a (hard) link from file @var{PATH1} to @var{PATH2}. A null
5556character (@code{CHAR(0)}) can be used to mark the end of the names in
5557@var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
5558names are ignored. If the @var{STATUS} argument is supplied, it
5559contains 0 on success or a nonzero error code upon return; see
5560@code{link(2)}.
bc5b7642 5561
cd051390
DF
5562@item @emph{Standard}:
5563GNU extension
5564
5565@item @emph{Class}:
5566Subroutine
5567
5568@item @emph{Syntax}:
bc5b7642
BM
5569@code{CALL LINK(PATH1, PATH2 [, STATUS])}
5570
cd051390 5571@item @emph{Arguments}:
bc5b7642
BM
5572@multitable @columnfractions .15 .80
5573@item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
5574@item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
5575@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
5576@end multitable
cd051390
DF
5577
5578@item @emph{See also}:
d3dfa1fe 5579@ref{SYMLNK}, @ref{UNLINK}
cd051390
DF
5580@end table
5581
5582
5583
cd051390
DF
5584@node LLE
5585@section @code{LLE} --- Lexical less than or equal
4ba96c02 5586@cindex @code{LLE} intrinsic
cd051390 5587@cindex comparison (lexical)
bc5b7642 5588@cindex lexical comparison
cd051390
DF
5589
5590@table @asis
5591@item @emph{Description}:
bc5b7642
BM
5592Determines whether one string is lexically less than or equal to another
5593string, where the two strings are interpreted as containing ASCII
5594character codes. If the String A and String B are not the same length,
5595the shorter is compared as if spaces were appended to it to form a value
5596that has the same length as the longer.
5597
5598In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5599@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5600operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5601that the latter use the processor's character ordering (which is not
5602ASCII on some targets), whereas the former always use the ASCII
5603ordering.
5604
cd051390
DF
5605@item @emph{Standard}:
5606F77 and later
5607
5608@item @emph{Class}:
5609Elemental function
5610
5611@item @emph{Syntax}:
d565bb3a 5612@code{RESULT = LLE(STRING_A, STRING_B)}
bc5b7642 5613
cd051390 5614@item @emph{Arguments}:
bc5b7642
BM
5615@multitable @columnfractions .15 .80
5616@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5617@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5618@end multitable
5619
cd051390 5620@item @emph{Return value}:
bc5b7642
BM
5621Returns @code{.TRUE.} if @code{STRING_A <= STRING_B}, and @code{.FALSE.}
5622otherwise, based on the ASCII ordering.
cd051390
DF
5623
5624@item @emph{See also}:
5625@ref{LGE}, @ref{LGT}, @ref{LLT}
5626@end table
5627
5628
5629
cd051390
DF
5630@node LLT
5631@section @code{LLT} --- Lexical less than
4ba96c02 5632@cindex @code{LLT} intrinsic
cd051390 5633@cindex comparison (lexical)
bc5b7642 5634@cindex lexical comparison
cd051390 5635
cd051390
DF
5636@table @asis
5637@item @emph{Description}:
bc5b7642
BM
5638Determines whether one string is lexically less than another string,
5639where the two strings are interpreted as containing ASCII character
5640codes. If the String A and String B are not the same length, the
5641shorter is compared as if spaces were appended to it to form a value
5642that has the same length as the longer.
5643
5644In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5645@code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5646operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5647that the latter use the processor's character ordering (which is not
5648ASCII on some targets), whereas the former always use the ASCII
5649ordering.
5650
cd051390
DF
5651@item @emph{Standard}:
5652F77 and later
5653
5654@item @emph{Class}:
5655Elemental function
5656
5657@item @emph{Syntax}:
d565bb3a 5658@code{RESULT = LLT(STRING_A, STRING_B)}
bc5b7642 5659
cd051390 5660@item @emph{Arguments}:
bc5b7642
BM
5661@multitable @columnfractions .15 .80
5662@item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5663@item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5664@end multitable
5665
cd051390 5666@item @emph{Return value}:
bc5b7642
BM
5667Returns @code{.TRUE.} if @code{STRING_A < STRING_B}, and @code{.FALSE.}
5668otherwise, based on the ASCII ordering.
cd051390
DF
5669
5670@item @emph{See also}:
5671@ref{LGE}, @ref{LGT}, @ref{LLE}
5672@end table
5673
5674
5675
cd051390
DF
5676@node LNBLNK
5677@section @code{LNBLNK} --- Index of the last non-blank character in a string
4ba96c02 5678@cindex @code{LNBLNK} intrinsic
cd051390
DF
5679
5680@table @asis
5681@item @emph{Description}:
bc5b7642
BM
5682Returns the length of a character string, ignoring any trailing blanks.
5683This is identical to the standard @code{LEN_TRIM} intrinsic, and is only
5684included for backwards compatibility.
5685
cd051390
DF
5686@item @emph{Standard}:
5687GNU extension
5688
5689@item @emph{Class}:
bc5b7642
BM
5690Elemental function
5691
cd051390 5692@item @emph{Syntax}:
d565bb3a 5693@code{RESULT = LNBLNK(STRING)}
bc5b7642 5694
cd051390 5695@item @emph{Arguments}:
bc5b7642
BM
5696@multitable @columnfractions .15 .80
5697@item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER(*)},
5698with @code{INTENT(IN)}
5699@end multitable
5700
cd051390 5701@item @emph{Return value}:
bc5b7642 5702The return value is of @code{INTEGER(kind=4)} type.
cd051390
DF
5703
5704@item @emph{See also}:
0c5a1cbc 5705@ref{INDEX}, @ref{LEN_TRIM}
cd051390
DF
5706@end table
5707
5708
5709
3a3977a8
FXC
5710@node LOC
5711@section @code{LOC} --- Returns the address of a variable
4ba96c02
BM
5712@cindex @code{LOC} intrinsic
5713@cindex location of a variable in memory
3a3977a8
FXC
5714
5715@table @asis
5716@item @emph{Description}:
5717@code{LOC(X)} returns the address of @var{X} as an integer.
5718
cd051390
DF
5719@item @emph{Standard}:
5720GNU extension
3a3977a8
FXC
5721
5722@item @emph{Class}:
cd051390 5723Inquiry function
3a3977a8
FXC
5724
5725@item @emph{Syntax}:
d565bb3a 5726@code{RESULT = LOC(X)}
3a3977a8
FXC
5727
5728@item @emph{Arguments}:
5729@multitable @columnfractions .15 .80
5730@item @var{X} @tab Variable of any type.
5731@end multitable
5732
5733@item @emph{Return value}:
0c5a1cbc
BM
5734The return value is of type @code{INTEGER}, with a @code{KIND}
5735corresponding to the size (in bytes) of a memory address on the target
5736machine.
3a3977a8
FXC
5737
5738@item @emph{Example}:
5739@smallexample
5740program test_loc
5741 integer :: i
5742 real :: r
5743 i = loc(r)
5744 print *, i
5745end program test_loc
5746@end smallexample
5747@end table
5748
ea8dda63
BM
5749
5750
3a3977a8
FXC
5751@node LOG
5752@section @code{LOG} --- Logarithm function
4ba96c02
BM
5753@cindex @code{LOG} intrinsic
5754@cindex @code{ALOG} intrinsic
5755@cindex @code{DLOG} intrinsic
5756@cindex @code{CLOG} intrinsic
5757@cindex @code{ZLOG} intrinsic
5758@cindex @code{CDLOG} intrinsic
3a3977a8
FXC
5759@cindex logarithm
5760
5761@table @asis
5762@item @emph{Description}:
5763@code{LOG(X)} computes the logarithm of @var{X}.
5764
cd051390
DF
5765@item @emph{Standard}:
5766F77 and later
3a3977a8
FXC
5767
5768@item @emph{Class}:
cd051390 5769Elemental function
3a3977a8
FXC
5770
5771@item @emph{Syntax}:
d565bb3a 5772@code{RESULT = LOG(X)}
3a3977a8
FXC
5773
5774@item @emph{Arguments}:
5775@multitable @columnfractions .15 .80
5776@item @var{X} @tab The type shall be @code{REAL(*)} or
5777@code{COMPLEX(*)}.
5778@end multitable
5779
5780@item @emph{Return value}:
5781The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5782The kind type parameter is the same as @var{X}.
5783
5784@item @emph{Example}:
5785@smallexample
5786program test_log
5787 real(8) :: x = 1.0_8
5788 complex :: z = (1.0, 2.0)
5789 x = log(x)
5790 z = log(z)
5791end program test_log
5792@end smallexample
5793
5794@item @emph{Specific names}:
cd051390
DF
5795@multitable @columnfractions .20 .20 .20 .40
5796@item Name @tab Argument @tab Return type @tab Standard
3a3977a8
FXC
5797@item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
5798@item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
5799@item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
5800@item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5801@item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5802@end multitable
5803@end table
5804
5805
5806
5807@node LOG10
5808@section @code{LOG10} --- Base 10 logarithm function
4ba96c02
BM
5809@cindex @code{LOG10} intrinsic
5810@cindex @code{ALOG10} intrinsic
5811@cindex @code{DLOG10} intrinsic
3a3977a8
FXC
5812@cindex logarithm
5813
5814@table @asis
5815@item @emph{Description}:
5816@code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5817
cd051390
DF
5818@item @emph{Standard}:
5819F77 and later
3a3977a8
FXC
5820
5821@item @emph{Class}:
cd051390 5822Elemental function
3a3977a8
FXC
5823
5824@item @emph{Syntax}:
d565bb3a 5825@code{RESULT = LOG10(X)}
3a3977a8
FXC
5826
5827@item @emph{Arguments}:
5828@multitable @columnfractions .15 .80
5829@item @var{X} @tab The type shall be @code{REAL(*)} or
5830@code{COMPLEX(*)}.
5831@end multitable
5832
5833@item @emph{Return value}:
5834The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5835The kind type parameter is the same as @var{X}.
5836
5837@item @emph{Example}:
5838@smallexample
5839program test_log10
5840 real(8) :: x = 10.0_8
5841 x = log10(x)
5842end program test_log10
5843@end smallexample
5844
5845@item @emph{Specific names}:
cd051390
DF
5846@multitable @columnfractions .20 .20 .20 .40
5847@item Name @tab Argument @tab Return type @tab Standard
5848@item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F95 and later
5849@item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
3a3977a8
FXC
5850@end multitable
5851@end table
5852
5853
ea8dda63 5854
cd051390
DF
5855@node LOGICAL
5856@section @code{LOGICAL} --- Convert to logical type
4ba96c02 5857@cindex @code{LOGICAL} intrinsic
cd051390
DF
5858@cindex conversion function (logical)
5859
cd051390
DF
5860@table @asis
5861@item @emph{Description}:
d3dfa1fe
BM
5862Converts one kind of @code{LOGICAL} variable to another.
5863
cd051390
DF
5864@item @emph{Standard}:
5865F95 and later
5866
5867@item @emph{Class}:
5868Elemental function
5869
5870@item @emph{Syntax}:
d3dfa1fe
BM
5871@code{RESULT = LOGICAL(L [, KIND])}
5872
cd051390 5873@item @emph{Arguments}:
d3dfa1fe
BM
5874@multitable @columnfractions .15 .80
5875@item @var{L} @tab The type shall be @code{LOGICAL(*)}.
5876@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
5877 expression indicating the kind parameter of
5878 the result.
5879@end multitable
5880
cd051390 5881@item @emph{Return value}:
d3dfa1fe
BM
5882The return value is a @code{LOGICAL} value equal to @var{L}, with a
5883kind corresponding to @var{KIND}, or of the default logical kind if
5884@var{KIND} is not given.
5885
cd051390 5886@item @emph{See also}:
d3dfa1fe 5887@ref{INT}, @ref{REAL}, @ref{CMPLX}
cd051390
DF
5888@end table
5889
5890
5891
5892
5893@node LSHIFT
5894@section @code{LSHIFT} --- Left shift bits
4ba96c02
BM
5895@cindex @code{LSHIFT} intrinsic
5896@cindex bit operations
cd051390 5897
cd051390
DF
5898@table @asis
5899@item @emph{Description}:
d3dfa1fe
BM
5900@code{LSHIFT} returns a value corresponding to @var{I} with all of the
5901bits shifted left by @var{SHIFT} places. If the absolute value of
5902@var{SHIFT} is greater than @code{BIT_SIZE(I)}, the value is undefined.
5903Bits shifted out from the left end are lost; zeros are shifted in from
5904the opposite end.
5905
8370304d 5906This function has been superseded by the @code{ISHFT} intrinsic, which
d3dfa1fe 5907is standard in Fortran 95 and later.
cd051390
DF
5908
5909@item @emph{Standard}:
5910GNU extension
5911
5912@item @emph{Class}:
d3dfa1fe 5913Elemental function
cd051390
DF
5914
5915@item @emph{Syntax}:
d3dfa1fe
BM
5916@code{RESULT = LSHIFT(I, SHIFT)}
5917
cd051390 5918@item @emph{Arguments}:
d3dfa1fe
BM
5919@multitable @columnfractions .15 .80
5920@item @var{I} @tab The type shall be @code{INTEGER(*)}.
5921@item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5922@end multitable
5923
cd051390 5924@item @emph{Return value}:
d3dfa1fe
BM
5925The return value is of type @code{INTEGER(*)} and of the same kind as
5926@var{I}.
5927
cd051390 5928@item @emph{See also}:
d3dfa1fe 5929@ref{ISHFT}, @ref{ISHFTC}, @ref{RSHIFT}
cd051390
DF
5930
5931@end table
5932
5933
21825fd6
DF
5934@node LSTAT
5935@section @code{LSTAT} --- Get file status
4ba96c02 5936@cindex @code{LSTAT} intrinsic
21825fd6
DF
5937@cindex file system operations
5938
5939@table @asis
5940@item @emph{Description}:
5941@code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link,
5942then the link itself is statted, not the file that it refers to.
5943
5944The elements in @code{BUFF} are the same as described by @ref{STAT}.
5945
5946@item @emph{Standard}:
5947GNU extension
5948
5949@item @emph{Class}:
5950Non-elemental subroutine
5951
5952@item @emph{Syntax}:
d565bb3a 5953@code{CALL LSTAT(FILE, BUFF [, STATUS])}
21825fd6
DF
5954
5955@item @emph{Arguments}:
5956@multitable @columnfractions .15 .80
5957@item @var{FILE} @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
5958@item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
5959@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
5960 on success and a system specific error code otherwise.
5961@end multitable
5962
5963@item @emph{Example}:
5964See @ref{STAT} for an example.
5965
5966@item @emph{See also}:
5967To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
5968@end table
5969
5970
cd051390
DF
5971
5972@node LTIME
5973@section @code{LTIME} --- Convert time to local time info
4ba96c02
BM
5974@cindex @code{LTIME} intrinsic
5975@cindex time, conversion function
cd051390 5976
cd051390
DF
5977@table @asis
5978@item @emph{Description}:
d3dfa1fe
BM
5979Given a system time value @var{STIME} (as provided by the @code{TIME8()}
5980intrinsic), fills @var{TARRAY} with values extracted from it appropriate
5981to the local time zone using @code{localtime(3)}.
cd051390
DF
5982
5983@item @emph{Standard}:
5984GNU extension
5985
5986@item @emph{Class}:
5987Subroutine
5988
5989@item @emph{Syntax}:
d3dfa1fe
BM
5990@code{CALL LTIME(STIME, TARRAY)}
5991
cd051390 5992@item @emph{Arguments}:
d3dfa1fe
BM
5993@multitable @columnfractions .15 .80
5994@item @var{STIME} @tab An @code{INTEGER(*)} scalar expression
5995 corresponding to a system time, with
5996 @code{INTENT(IN)}.
5997@item @var{TARRAY} @tab A default @code{INTEGER} array with 9 elements,
5998 with @code{INTENT(OUT)}.
5999@end multitable
6000
cd051390 6001@item @emph{Return value}:
d3dfa1fe
BM
6002The elements of @var{TARRAY} are assigned as follows:
6003@enumerate
6004@item Seconds after the minute, range 0--59 or 0--61 to allow for leap
6005 seconds
6006@item Minutes after the hour, range 0--59
6007@item Hours past midnight, range 0--23
6008@item Day of month, range 0--31
6009@item Number of months since January, range 0--12
6010@item Years since 1900
6011@item Number of days since Sunday, range 0--6
6012@item Days since January 1
6013@item Daylight savings indicator: positive if daylight savings is in
6014 effect, zero if not, and negative if the information is not
6015 available.
6016@end enumerate
6017
cd051390 6018@item @emph{See also}:
d3dfa1fe 6019@ref{CTIME}, @ref{GMTIME}, @ref{TIME}, @ref{TIME8}
cd051390
DF
6020
6021@end table
6022
6023
6024
3a3977a8
FXC
6025@node MALLOC
6026@section @code{MALLOC} --- Allocate dynamic memory
4ba96c02
BM
6027@cindex @code{MALLOC} intrinsic
6028@cindex Cray pointers
3a3977a8
FXC
6029
6030@table @asis
6031@item @emph{Description}:
6032@code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
6033returns the address of the allocated memory. The @code{MALLOC} intrinsic
6034is an extension intended to be used with Cray pointers, and is provided
7fc15ba5 6035in GNU Fortran to allow the user to compile legacy code. For new code
3a3977a8
FXC
6036using Fortran 95 pointers, the memory allocation intrinsic is
6037@code{ALLOCATE}.
6038
cd051390
DF
6039@item @emph{Standard}:
6040GNU extension
3a3977a8
FXC
6041
6042@item @emph{Class}:
6043non-elemental function
6044
6045@item @emph{Syntax}:
6046@code{PTR = MALLOC(SIZE)}
6047
6048@item @emph{Arguments}:
6049@multitable @columnfractions .15 .80
6050@item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
6051@end multitable
6052
6053@item @emph{Return value}:
6054The return value is of type @code{INTEGER(K)}, with @var{K} such that
6055variables of type @code{INTEGER(K)} have the same size as
6056C pointers (@code{sizeof(void *)}).
6057
6058@item @emph{Example}:
6059The following example demonstrates the use of @code{MALLOC} and
6060@code{FREE} with Cray pointers. This example is intended to run on
606132-bit systems, where the default integer kind is suitable to store
6062pointers; on 64-bit systems, ptr_x would need to be declared as
6063@code{integer(kind=8)}.
6064
6065@smallexample
6066program test_malloc
6067 integer i
6068 integer ptr_x
6069 real*8 x(*), z
6070 pointer(ptr_x,x)
6071
6072 ptr_x = malloc(20*8)
6073 do i = 1, 20
6074 x(i) = sqrt(1.0d0 / i)
6075 end do
6076 z = 0
6077 do i = 1, 20
6078 z = z + x(i)
6079 print *, z
6080 end do
6081 call free(ptr_x)
6082end program test_malloc
6083@end smallexample
cd051390
DF
6084
6085@item @emph{See also}:
6086@ref{FREE}
3a3977a8
FXC
6087@end table
6088
6089
d3dfa1fe 6090
cd051390
DF
6091@node MATMUL
6092@section @code{MATMUL} --- matrix multiplication
4ba96c02 6093@cindex @code{MATMUL} intrinsic
cd051390 6094@cindex matrix operations
3a3977a8 6095
3a3977a8
FXC
6096@table @asis
6097@item @emph{Description}:
d3dfa1fe
BM
6098Performs a matrix multiplication on numeric or logical arguments.
6099
cd051390
DF
6100@item @emph{Standard}:
6101F95 and later
3a3977a8
FXC
6102
6103@item @emph{Class}:
cd051390 6104Transformational function
3a3977a8
FXC
6105
6106@item @emph{Syntax}:
d3dfa1fe
BM
6107@code{RESULT = MATMUL(MATRIX_A, MATRIX_B)}
6108
3a3977a8 6109@item @emph{Arguments}:
d3dfa1fe
BM
6110@multitable @columnfractions .15 .80
6111@item @var{MATRIX_A} @tab An array of @code{INTEGER(*)},
6112 @code{REAL(*)}, @code{COMPLEX(*)}, or
6113 @code{LOGICAL(*)} type, with a rank of
6114 one or two.
6115@item @var{MATRIX_B} @tab An array of @code{INTEGER(*)},
6116 @code{REAL(*)}, or @code{COMPLEX(*)} type if
6117 @var{MATRIX_A} is of a numeric type;
6118 otherwise, an array of @code{LOGICAL(*)}
6119 type. The rank shall be one or two, and the
d6e25700 6120 first (or only) dimension of @var{MATRIX_B}
d3dfa1fe
BM
6121 shall be equal to the last (or only)
6122 dimension of @var{MATRIX_A}.
6123@end multitable
6124
3a3977a8 6125@item @emph{Return value}:
d3dfa1fe
BM
6126The matrix product of @var{MATRIX_A} and @var{MATRIX_B}. The type and
6127kind of the result follow the usual type and kind promotion rules, as
6128for the @code{*} or @code{.AND.} operators.
6129
cd051390
DF
6130@item @emph{See also}:
6131@end table
6132
6133
d3dfa1fe 6134
cd051390
DF
6135@node MAX
6136@section @code{MAX} --- Maximum value of an argument list
4ba96c02 6137@cindex @code{MAX} intrinsic
cd051390
DF
6138
6139@table @asis
6140@item @emph{Description}:
d3dfa1fe
BM
6141Returns the argument with the largest (most positive) value.
6142
cd051390
DF
6143@item @emph{Standard}:
6144F77 and later
6145
6146@item @emph{Class}:
6147Elemental function
6148
6149@item @emph{Syntax}:
d3dfa1fe
BM
6150@code{RESULT = MAX(A1, A2 [, A3 [, ...]])}
6151
cd051390 6152@item @emph{Arguments}:
d3dfa1fe
BM
6153@multitable @columnfractions .15 .80
6154@item @var{A1} @tab The type shall be @code{INTEGER(*)} or
6155 @code{REAL(*)}.
d6e25700 6156@item @var{A2}, @var{A3}, ... @tab An expression of the same type and kind
d3dfa1fe
BM
6157 as @var{A1}. (As a GNU extension,
6158 arguments of different kinds are
6159 permitted.)
6160@end multitable
6161
cd051390 6162@item @emph{Return value}:
d3dfa1fe
BM
6163The return value corresponds to the maximum value among the arguments,
6164and has the same type and kind as the first argument.
cd051390
DF
6165
6166@item @emph{Specific names}:
6167@multitable @columnfractions .20 .20 .20 .40
6168@item Name @tab Argument @tab Return type @tab Standard
6169@item @code{MAX0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
6170@item @code{AMAX0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
6171@item @code{MAX1(X)} @tab @code{REAL(*) X} @tab @code{INT(MAX(X))} @tab F77 and later
6172@item @code{AMAX1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
6173@item @code{DMAX1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6174@end multitable
6175
6176@item @emph{See also}:
d3dfa1fe
BM
6177@ref{MAXLOC} @ref{MAXVAL}, @ref{MIN}
6178
cd051390
DF
6179@end table
6180
6181
d3dfa1fe 6182
cd051390
DF
6183@node MAXEXPONENT
6184@section @code{MAXEXPONENT} --- Maximum exponent of a real kind
4ba96c02
BM
6185@cindex @code{MAXEXPONENT} intrinsic
6186@cindex maximum exponent
6187@cindex exponent, maximum
cd051390
DF
6188
6189@table @asis
6190@item @emph{Description}:
6191@code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
6192type of @code{X}.
6193
6194@item @emph{Standard}:
6195F95 and later
6196
6197@item @emph{Class}:
6198Inquiry function
6199
6200@item @emph{Syntax}:
d565bb3a 6201@code{RESULT = MAXEXPONENT(X)}
cd051390
DF
6202
6203@item @emph{Arguments}:
6204@multitable @columnfractions .15 .80
6205@item @var{X} @tab shall be of type @code{REAL}.
6206@end multitable
6207
6208@item @emph{Return value}:
6209The return value is of type @code{INTEGER} and of the default integer
6210kind.
3a3977a8
FXC
6211
6212@item @emph{Example}:
6213@smallexample
6214program exponents
6215 real(kind=4) :: x
6216 real(kind=8) :: y
6217
6218 print *, minexponent(x), maxexponent(x)
6219 print *, minexponent(y), maxexponent(y)
6220end program exponents
6221@end smallexample
6222@end table
6223
6224
d3dfa1fe 6225
cd051390
DF
6226@node MAXLOC
6227@section @code{MAXLOC} --- Location of the maximum value within an array
4ba96c02 6228@cindex @code{MAXLOC} intrinsic
cd051390
DF
6229
6230@table @asis
6231@item @emph{Description}:
d3dfa1fe
BM
6232Determines the location of the element in the array with the maximum
6233value, or, if the @var{DIM} argument is supplied, determines the
6234locations of the maximum element along each row of the array in the
6235@var{DIM} direction. If @var{MASK} is present, only the elements for
6236which @var{MASK} is @code{.TRUE.} are considered. If more than one
6237element in the array has the maximum value, the location returned is
6238that of the first such element in array element order. If the array has
6239zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then
6240the result is an array of zeroes. Similarly, if @var{DIM} is supplied
6241and all of the elements of @var{MASK} along a given row are zero, the
6242result value for that row is zero.
6243
cd051390
DF
6244@item @emph{Standard}:
6245F95 and later
6246
6247@item @emph{Class}:
6248Transformational function
6249
6250@item @emph{Syntax}:
d3dfa1fe
BM
6251@multitable @columnfractions .80
6252@item @code{RESULT = MAXLOC(ARRAY, DIM [, MASK])}
6253@item @code{RESULT = MAXLOC(ARRAY [, MASK])}
6254@end multitable
6255
cd051390 6256@item @emph{Arguments}:
d3dfa1fe
BM
6257@multitable @columnfractions .15 .80
6258@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER(*)},
6259 @code{REAL(*)}, or @code{CHARACTER(*)}.
6260@item @var{DIM} @tab (Optional) Shall be a scalar of type
6261 @code{INTEGER(*)}, with a value between one
6262 and the rank of @var{ARRAY}, inclusive. It
6263 may not be an optional dummy argument.
6264@item @var{MASK} @tab Shall be an array of type @code{LOGICAL(*)},
6265 and conformable with @var{ARRAY}.
6266@end multitable
6267
cd051390 6268@item @emph{Return value}:
d3dfa1fe
BM
6269If @var{DIM} is absent, the result is a rank-one array with a length
6270equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result
6271is an array with a rank one less than the rank of @var{ARRAY}, and a
6272size corresponding to the size of @var{ARRAY} with the @var{DIM}
6273dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank
6274of one, the result is a scalar. In all cases, the result is of default
6275@code{INTEGER} type.
6276
cd051390
DF
6277@item @emph{See also}:
6278@ref{MAX}, @ref{MAXVAL}
d3dfa1fe 6279
cd051390
DF
6280@end table
6281
6282
6283
6284@node MAXVAL
6285@section @code{MAXVAL} --- Maximum value of an array
4ba96c02 6286@cindex @code{MAXVAL} intrinsic
cd051390
DF
6287
6288@table @asis
6289@item @emph{Description}:
d3dfa1fe
BM
6290Determines the maximum value of the elements in an array value, or, if
6291the @var{DIM} argument is supplied, determines the maximum value along
6292each row of the array in the @var{DIM} direction. If @var{MASK} is
6293present, only the elements for which @var{MASK} is @code{.TRUE.} are
6294considered. If the array has zero size, or all of the elements of
6295@var{MASK} are @code{.FALSE.}, then the result is the most negative
6296number of the type and kind of @var{ARRAY} if @var{ARRAY} is numeric, or
6297a string of nulls if @var{ARRAY} is of character type.
cd051390 6298
d3dfa1fe
BM
6299@item @emph{Standard}:
6300F95 and later
cd051390
DF
6301
6302@item @emph{Class}:
6303Transformational function
6304
6305@item @emph{Syntax}:
d3dfa1fe
BM
6306@multitable @columnfractions .80
6307@item @code{RESULT = MAXVAL(ARRAY, DIM [, MASK])}
6308@item @code{RESULT = MAXVAL(ARRAY [, MASK])}
6309@end multitable
6310
cd051390 6311@item @emph{Arguments}:
d3dfa1fe
BM
6312@multitable @columnfractions .15 .80
6313@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER(*)},
6314 @code{REAL(*)}, or @code{CHARACTER(*)}.
6315@item @var{DIM} @tab (Optional) Shall be a scalar of type
6316 @code{INTEGER(*)}, with a value between one
6317 and the rank of @var{ARRAY}, inclusive. It
6318 may not be an optional dummy argument.
6319@item @var{MASK} @tab Shall be an array of type @code{LOGICAL(*)},
6320 and conformable with @var{ARRAY}.
6321@end multitable
6322
cd051390 6323@item @emph{Return value}:
d565bb3a
BM
6324If @var{DIM} is absent, or if @var{ARRAY} has a rank of one, the result
6325is a scalar. If @var{DIM} is present, the result is an array with a
6326rank one less than the rank of @var{ARRAY}, and a size corresponding to
6327the size of @var{ARRAY} with the @var{DIM} dimension removed. In all
6328cases, the result is of the same type and kind as @var{ARRAY}.
cd051390
DF
6329
6330@item @emph{See also}:
6331@ref{MAX}, @ref{MAXLOC}
6332@end table
6333
6334
6335
cd051390 6336@node MERGE
d3dfa1fe 6337@section @code{MERGE} --- Merge variables
4ba96c02 6338@cindex @code{MERGE} intrinsic
cd051390
DF
6339
6340@table @asis
6341@item @emph{Description}:
d3dfa1fe
BM
6342Select values from two arrays according to a logical mask. The result
6343is equal to @var{TSOURCE} if @var{MASK} is @code{.TRUE.}, or equal to
6344@var{FSOURCE} if it is @code{.FALSE.}.
6345
cd051390
DF
6346@item @emph{Standard}:
6347F95 and later
6348
6349@item @emph{Class}:
d3dfa1fe 6350Elemental function
cd051390
DF
6351
6352@item @emph{Syntax}:
d3dfa1fe
BM
6353@code{RESULT = MERGE(TSOURCE, FSOURCE, MASK)}
6354
cd051390 6355@item @emph{Arguments}:
d3dfa1fe
BM
6356@multitable @columnfractions .15 .80
6357@item @var{TSOURCE} @tab May be of any type.
6358@item @var{FSOURCE} @tab Shall be of the same type and type parameters
6359 as @var{TSOURCE}.
6360@item @var{MASK} @tab Shall be of type @code{LOGICAL(*)}.
6361@end multitable
6362
cd051390 6363@item @emph{Return value}:
d3dfa1fe
BM
6364The result is of the same type and type parameters as @var{TSOURCE}.
6365
cd051390
DF
6366@end table
6367
6368
d3dfa1fe 6369
cd051390
DF
6370@node MIN
6371@section @code{MIN} --- Minimum value of an argument list
4ba96c02 6372@cindex @code{MIN} intrinsic
cd051390
DF
6373
6374@table @asis
6375@item @emph{Description}:
d3dfa1fe
BM
6376Returns the argument with the smallest (most negative) value.
6377
cd051390
DF
6378@item @emph{Standard}:
6379F77 and later
6380
6381@item @emph{Class}:
6382Elemental function
6383
6384@item @emph{Syntax}:
d565bb3a 6385@code{RESULT = MIN(A1, A2 [, A3, ...])}
d3dfa1fe 6386
cd051390 6387@item @emph{Arguments}:
d3dfa1fe
BM
6388@multitable @columnfractions .15 .80
6389@item @var{A1} @tab The type shall be @code{INTEGER(*)} or
6390 @code{REAL(*)}.
d6e25700 6391@item @var{A2}, @var{A3}, ... @tab An expression of the same type and kind
d3dfa1fe
BM
6392 as @var{A1}. (As a GNU extension,
6393 arguments of different kinds are
6394 permitted.)
6395@end multitable
6396
cd051390 6397@item @emph{Return value}:
d3dfa1fe
BM
6398The return value corresponds to the maximum value among the arguments,
6399and has the same type and kind as the first argument.
cd051390
DF
6400
6401@item @emph{Specific names}:
6402@multitable @columnfractions .20 .20 .20 .40
6403@item Name @tab Argument @tab Return type @tab Standard
6404@item @code{MIN0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
6405@item @code{AMIN0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
6406@item @code{MIN1(X)} @tab @code{REAL(*) X} @tab @code{INT(MIN(X))} @tab F77 and later
6407@item @code{AMIN1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
6408@item @code{DMIN1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6409@end multitable
6410
6411@item @emph{See also}:
d3dfa1fe 6412@ref{MAX}, @ref{MINLOC}, @ref{MINVAL}
cd051390 6413@end table
3a3977a8
FXC
6414
6415@node MINEXPONENT
6416@section @code{MINEXPONENT} --- Minimum exponent of a real kind
4ba96c02
BM
6417@cindex @code{MINEXPONENT} intrinsic
6418@cindex minimum exponent
6419@cindex exponent, minimum
3a3977a8
FXC
6420
6421@table @asis
6422@item @emph{Description}:
6423@code{MINEXPONENT(X)} returns the minimum exponent in the model of the
6424type of @code{X}.
6425
cd051390
DF
6426@item @emph{Standard}:
6427F95 and later
3a3977a8
FXC
6428
6429@item @emph{Class}:
cd051390 6430Inquiry function
3a3977a8
FXC
6431
6432@item @emph{Syntax}:
d565bb3a 6433@code{RESULT = MINEXPONENT(X)}
3a3977a8
FXC
6434
6435@item @emph{Arguments}:
6436@multitable @columnfractions .15 .80
6437@item @var{X} @tab shall be of type @code{REAL}.
6438@end multitable
6439
6440@item @emph{Return value}:
6441The return value is of type @code{INTEGER} and of the default integer
6442kind.
6443
6444@item @emph{Example}:
6445See @code{MAXEXPONENT} for an example.
6446@end table
6447
6448
d3dfa1fe 6449
cd051390
DF
6450@node MINLOC
6451@section @code{MINLOC} --- Location of the minimum value within an array
4ba96c02 6452@cindex @code{MINLOC} intrinsic
cd051390
DF
6453
6454@table @asis
6455@item @emph{Description}:
d3dfa1fe
BM
6456Determines the location of the element in the array with the minimum
6457value, or, if the @var{DIM} argument is supplied, determines the
6458locations of the minimum element along each row of the array in the
6459@var{DIM} direction. If @var{MASK} is present, only the elements for
6460which @var{MASK} is @code{.TRUE.} are considered. If more than one
6461element in the array has the minimum value, the location returned is
6462that of the first such element in array element order. If the array has
6463zero size, or all of the elements of @var{MASK} are @code{.FALSE.}, then
6464the result is an array of zeroes. Similarly, if @var{DIM} is supplied
6465and all of the elements of @var{MASK} along a given row are zero, the
6466result value for that row is zero.
6467
cd051390
DF
6468@item @emph{Standard}:
6469F95 and later
6470
6471@item @emph{Class}:
6472Transformational function
6473
6474@item @emph{Syntax}:
d3dfa1fe
BM
6475@multitable @columnfractions .80
6476@item @code{RESULT = MINLOC(ARRAY, DIM [, MASK])}
6477@item @code{RESULT = MINLOC(ARRAY [, MASK])}
6478@end multitable
6479
cd051390 6480@item @emph{Arguments}:
d3dfa1fe
BM
6481@multitable @columnfractions .15 .80
6482@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER(*)},
6483 @code{REAL(*)}, or @code{CHARACTER(*)}.
6484@item @var{DIM} @tab (Optional) Shall be a scalar of type
6485 @code{INTEGER(*)}, with a value between one
6486 and the rank of @var{ARRAY}, inclusive. It
6487 may not be an optional dummy argument.
6488@item @var{MASK} @tab Shall be an array of type @code{LOGICAL(*)},
6489 and conformable with @var{ARRAY}.
6490@end multitable
6491
cd051390 6492@item @emph{Return value}:
d3dfa1fe
BM
6493If @var{DIM} is absent, the result is a rank-one array with a length
6494equal to the rank of @var{ARRAY}. If @var{DIM} is present, the result
6495is an array with a rank one less than the rank of @var{ARRAY}, and a
6496size corresponding to the size of @var{ARRAY} with the @var{DIM}
6497dimension removed. If @var{DIM} is present and @var{ARRAY} has a rank
6498of one, the result is a scalar. In all cases, the result is of default
6499@code{INTEGER} type.
cd051390
DF
6500
6501@item @emph{See also}:
6502@ref{MIN}, @ref{MINVAL}
6503
6504@end table
6505
6506
d3dfa1fe 6507
cd051390
DF
6508@node MINVAL
6509@section @code{MINVAL} --- Minimum value of an array
4ba96c02 6510@cindex @code{MINVAL} intrinsic
cd051390
DF
6511
6512@table @asis
6513@item @emph{Description}:
d3dfa1fe
BM
6514Determines the minimum value of the elements in an array value, or, if
6515the @var{DIM} argument is supplied, determines the minimum value along
6516each row of the array in the @var{DIM} direction. If @var{MASK} is
6517present, only the elements for which @var{MASK} is @code{.TRUE.} are
6518considered. If the array has zero size, or all of the elements of
6519@var{MASK} are @code{.FALSE.}, then the result is @code{HUGE(ARRAY)} if
6520@var{ARRAY} is numeric, or a string of @code{CHAR(255)} characters if
6521@var{ARRAY} is of character type.
6522
cd051390
DF
6523@item @emph{Standard}:
6524F95 and later
6525
6526@item @emph{Class}:
6527Transformational function
6528
6529@item @emph{Syntax}:
d3dfa1fe
BM
6530@multitable @columnfractions .80
6531@item @code{RESULT = MINVAL(ARRAY, DIM [, MASK])}
6532@item @code{RESULT = MINVAL(ARRAY [, MASK])}
6533@end multitable
6534
cd051390 6535@item @emph{Arguments}:
d3dfa1fe
BM
6536@multitable @columnfractions .15 .80
6537@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER(*)},
6538 @code{REAL(*)}, or @code{CHARACTER(*)}.
6539@item @var{DIM} @tab (Optional) Shall be a scalar of type
6540 @code{INTEGER(*)}, with a value between one
6541 and the rank of @var{ARRAY}, inclusive. It
6542 may not be an optional dummy argument.
6543@item @var{MASK} @tab Shall be an array of type @code{LOGICAL(*)},
6544 and conformable with @var{ARRAY}.
6545@end multitable
6546
cd051390 6547@item @emph{Return value}:
d565bb3a
BM
6548If @var{DIM} is absent, or if @var{ARRAY} has a rank of one, the result
6549is a scalar. If @var{DIM} is present, the result is an array with a
6550rank one less than the rank of @var{ARRAY}, and a size corresponding to
6551the size of @var{ARRAY} with the @var{DIM} dimension removed. In all
6552cases, the result is of the same type and kind as @var{ARRAY}.
cd051390
DF
6553
6554@item @emph{See also}:
6555@ref{MIN}, @ref{MINLOC}
cd051390 6556
d3dfa1fe 6557@end table
cd051390
DF
6558
6559
3a3977a8
FXC
6560
6561@node MOD
6562@section @code{MOD} --- Remainder function
4ba96c02
BM
6563@cindex @code{MOD} intrinsic
6564@cindex @code{AMOD} intrinsic
6565@cindex @code{DMOD} intrinsic
3a3977a8
FXC
6566@cindex remainder
6567
6568@table @asis
6569@item @emph{Description}:
6570@code{MOD(A,P)} computes the remainder of the division of A by P. It is
6571calculated as @code{A - (INT(A/P) * P)}.
6572
cd051390
DF
6573@item @emph{Standard}:
6574F77 and later
3a3977a8
FXC
6575
6576@item @emph{Class}:
cd051390 6577Elemental function
3a3977a8
FXC
6578
6579@item @emph{Syntax}:
d565bb3a 6580@code{RESULT = MOD(A, P)}
3a3977a8
FXC
6581
6582@item @emph{Arguments}:
6583@multitable @columnfractions .15 .80
6584@item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6585@item @var{P} @tab shall be a scalar of the same type as @var{A} and not
6586equal to zero
6587@end multitable
6588
6589@item @emph{Return value}:
6590The kind of the return value is the result of cross-promoting
6591the kinds of the arguments.
6592
6593@item @emph{Example}:
6594@smallexample
6595program test_mod
6596 print *, mod(17,3)
6597 print *, mod(17.5,5.5)
6598 print *, mod(17.5d0,5.5)
6599 print *, mod(17.5,5.5d0)
6600
6601 print *, mod(-17,3)
6602 print *, mod(-17.5,5.5)
6603 print *, mod(-17.5d0,5.5)
6604 print *, mod(-17.5,5.5d0)
6605
6606 print *, mod(17,-3)
6607 print *, mod(17.5,-5.5)
6608 print *, mod(17.5d0,-5.5)
6609 print *, mod(17.5,-5.5d0)
6610end program test_mod
6611@end smallexample
6612
6613@item @emph{Specific names}:
cd051390
DF
6614@multitable @columnfractions .20 .20 .20 .40
6615@item Name @tab Arguments @tab Return type @tab Standard
6616@item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
6617@item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
3a3977a8
FXC
6618@end multitable
6619@end table
6620
6621
6622
6623@node MODULO
6624@section @code{MODULO} --- Modulo function
4ba96c02 6625@cindex @code{MODULO} intrinsic
3a3977a8
FXC
6626@cindex modulo
6627
6628@table @asis
6629@item @emph{Description}:
6630@code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
6631
cd051390
DF
6632@item @emph{Standard}:
6633F95 and later
3a3977a8
FXC
6634
6635@item @emph{Class}:
cd051390 6636Elemental function
3a3977a8
FXC
6637
6638@item @emph{Syntax}:
d565bb3a 6639@code{RESULT = MODULO(A, P)}
3a3977a8
FXC
6640
6641@item @emph{Arguments}:
6642@multitable @columnfractions .15 .80
6643@item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6644@item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
6645@end multitable
6646
6647@item @emph{Return value}:
6648The type and kind of the result are those of the arguments.
6649@table @asis
6650@item If @var{A} and @var{P} are of type @code{INTEGER}:
6651@code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
6652@var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
6653(exclusive).
6654@item If @var{A} and @var{P} are of type @code{REAL}:
6655@code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
6656@end table
6657In all cases, if @var{P} is zero the result is processor-dependent.
6658
6659@item @emph{Example}:
6660@smallexample
cd051390 6661program test_modulo
3a3977a8
FXC
6662 print *, modulo(17,3)
6663 print *, modulo(17.5,5.5)
6664
6665 print *, modulo(-17,3)
6666 print *, modulo(-17.5,5.5)
6667
6668 print *, modulo(17,-3)
6669 print *, modulo(17.5,-5.5)
6670end program test_mod
6671@end smallexample
6672
3a3977a8
FXC
6673@end table
6674
6675
6676
5046aff5
PT
6677@node MOVE_ALLOC
6678@section @code{MOVE_ALLOC} --- Move allocation from one object to another
4ba96c02
BM
6679@cindex @code{MOVE_ALLOC} intrinsic
6680@cindex moving allocation
6681@cindex allocation, moving
5046aff5
PT
6682
6683@table @asis
6684@item @emph{Description}:
6685@code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
6686@var{DEST}. @var{SRC} will become deallocated in the process.
6687
3d614c74
BM
6688@item @emph{Standard}:
6689F2003 and later
5046aff5
PT
6690
6691@item @emph{Class}:
6692Subroutine
6693
6694@item @emph{Syntax}:
6695@code{CALL MOVE_ALLOC(SRC, DEST)}
6696
6697@item @emph{Arguments}:
6698@multitable @columnfractions .15 .80
ea8dda63
BM
6699@item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be
6700 of any type and kind.
6701@item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be
6702 of the same type, kind and rank as @var{SRC}
5046aff5
PT
6703@end multitable
6704
6705@item @emph{Return value}:
6706None
6707
6708@item @emph{Example}:
6709@smallexample
6710program test_move_alloc
6711 integer, allocatable :: a(:), b(:)
6712
6713 allocate(a(3))
6714 a = [ 1, 2, 3 ]
6715 call move_alloc(a, b)
6716 print *, allocated(a), allocated(b)
6717 print *, b
6718end program test_move_alloc
6719@end smallexample
6720@end table
6721
6722
6723
d3dfa1fe
BM
6724@node MVBITS
6725@section @code{MVBITS} --- Move bits from one integer to another
6726@cindex @code{MVBITS} intrinsic
6727@cindex bit operations
6728
6729@table @asis
6730@item @emph{Description}:
6731Moves @var{LEN} bits from positions @var{FROMPOS} through
6732@code{FROMPOS+LEN-1} of @var{FROM} to positions @var{TOPOS} through
6733@code{TOPOS+LEN-1} of @var{TO}. The portion of argument @var{TO} not
6734affected by the movement of bits is unchanged. The values of
6735@code{FROMPOS+LEN-1} and @code{TOPOS+LEN-1} must be less than
6736@code{BIT_SIZE(FROM)}.
6737
6738@item @emph{Standard}:
6739F95 and later
6740
6741@item @emph{Class}:
6742Elemental function
6743
6744@item @emph{Syntax}:
6745@code{RESULT = MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)}
6746
6747@item @emph{Arguments}:
6748@multitable @columnfractions .15 .80
6749@item @var{FROM} @tab The type shall be @code{INTEGER(*)}.
6750@item @var{FROMPOS} @tab The type shall be @code{INTEGER(*)}.
6751@item @var{LEN} @tab The type shall be @code{INTEGER(*)}.
6752@item @var{TO} @tab The type shall be @code{INTEGER(*)}, of the
6753 same kind as @var{FROM}.
6754@item @var{TOPOS} @tab The type shall be @code{INTEGER(*)}.
6755@end multitable
6756
6757@item @emph{Return value}:
6758The return value is of type @code{INTEGER(*)} and of the same kind as
6759@var{FROM}.
6760
6761@item @emph{See also}:
6762@ref{IBCLR}, @ref{IBSET}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
6763
6764@end table
6765
6766
6767
3a3977a8
FXC
6768@node NEAREST
6769@section @code{NEAREST} --- Nearest representable number
4ba96c02 6770@cindex @code{NEAREST} intrinsic
3a3977a8
FXC
6771@cindex processor-representable number
6772
6773@table @asis
6774@item @emph{Description}:
6775@code{NEAREST(X, S)} returns the processor-representable number nearest
6776to @code{X} in the direction indicated by the sign of @code{S}.
6777
cd051390
DF
6778@item @emph{Standard}:
6779F95 and later
3a3977a8
FXC
6780
6781@item @emph{Class}:
cd051390 6782Elemental function
3a3977a8
FXC
6783
6784@item @emph{Syntax}:
d565bb3a 6785@code{RESULT = NEAREST(X, S)}
3a3977a8
FXC
6786
6787@item @emph{Arguments}:
6788@multitable @columnfractions .15 .80
6789@item @var{X} @tab shall be of type @code{REAL}.
6790@item @var{S} @tab (Optional) shall be of type @code{REAL} and
6791not equal to zero.
6792@end multitable
6793
6794@item @emph{Return value}:
6795The return value is of the same type as @code{X}. If @code{S} is
6796positive, @code{NEAREST} returns the processor-representable number
6797greater than @code{X} and nearest to it. If @code{S} is negative,
6798@code{NEAREST} returns the processor-representable number smaller than
6799@code{X} and nearest to it.
6800
6801@item @emph{Example}:
6802@smallexample
6803program test_nearest
6804 real :: x, y
6805 x = nearest(42.0, 1.0)
6806 y = nearest(42.0, -1.0)
6807 write (*,"(3(G20.15))") x, y, x - y
6808end program test_nearest
6809@end smallexample
6810@end table
6811
6812
6813
bec93d79
TB
6814@node NEW_LINE
6815@section @code{NEW_LINE} --- New line character
4ba96c02
BM
6816@cindex @code{NEW_LINE} intrinsic
6817@cindex @code{NEW_LINE} intrinsic
bec93d79
TB
6818
6819@table @asis
6820@item @emph{Description}:
d3dfa1fe 6821@code{NEW_LINE(C)} returns the new-line character.
bec93d79
TB
6822
6823@item @emph{Standard}:
6824F2003 and later
6825
6826@item @emph{Class}:
6827Elemental function
6828
6829@item @emph{Syntax}:
d565bb3a 6830@code{RESULT = NEW_LINE(C)}
bec93d79
TB
6831
6832@item @emph{Arguments}:
6833@multitable @columnfractions .15 .80
6834@item @var{C} @tab The argument shall be a scalar or array of the
6835 type @code{CHARACTER}.
6836@end multitable
6837
6838@item @emph{Return value}:
6839Returns a @var{CHARACTER} scalar of length one with the new-line character of
6840the same kind as parameter @var{C}.
6841
6842@item @emph{Example}:
6843@smallexample
6844program newline
6845 implicit none
6846 write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
6847end program newline
6848@end smallexample
6849@end table
6850
6851
6852
3a3977a8
FXC
6853@node NINT
6854@section @code{NINT} --- Nearest whole number
4ba96c02
BM
6855@cindex @code{NINT} intrinsic
6856@cindex @code{IDNINT} intrinsic
3a3977a8
FXC
6857@cindex whole number
6858
6859@table @asis
6860@item @emph{Description}:
6861@code{NINT(X)} rounds its argument to the nearest whole number.
6862
cd051390
DF
6863@item @emph{Standard}:
6864F77 and later
3a3977a8
FXC
6865
6866@item @emph{Class}:
cd051390 6867Elemental function
3a3977a8
FXC
6868
6869@item @emph{Syntax}:
d565bb3a 6870@code{RESULT = NINT(X)}
3a3977a8
FXC
6871
6872@item @emph{Arguments}:
6873@multitable @columnfractions .15 .80
6874@item @var{X} @tab The type of the argument shall be @code{REAL}.
6875@end multitable
6876
6877@item @emph{Return value}:
6878Returns @var{A} with the fractional portion of its magnitude eliminated by
6879rounding to the nearest whole number and with its sign preserved,
6880converted to an @code{INTEGER} of the default kind.
6881
6882@item @emph{Example}:
6883@smallexample
6884program test_nint
6885 real(4) x4
6886 real(8) x8
6887 x4 = 1.234E0_4
6888 x8 = 4.321_8
6889 print *, nint(x4), idnint(x8)
6890end program test_nint
6891@end smallexample
6892
6893@item @emph{Specific names}:
6894@multitable @columnfractions .33 .33 .33
cd051390
DF
6895@item Name @tab Argument @tab Standard
6896@item @code{IDNINT(X)} @tab @code{REAL(8)} @tab F95 and later
3a3977a8 6897@end multitable
cd051390
DF
6898
6899@item @emph{See also}:
6900@ref{CEILING}, @ref{FLOOR}
6901
3a3977a8
FXC
6902@end table
6903
6904
cd051390
DF
6905@node NOT
6906@section @code{NOT} --- Logical negation
4ba96c02 6907@cindex @code{NOT} intrinsic
d3dfa1fe 6908@cindex bit operations
3a3977a8
FXC
6909
6910@table @asis
6911@item @emph{Description}:
d3dfa1fe
BM
6912@code{NOT} returns the bitwise boolean inverse of @var{I}.
6913
cd051390 6914@item @emph{Standard}:
d3dfa1fe 6915F95 and later
3a3977a8
FXC
6916
6917@item @emph{Class}:
cd051390 6918Elemental function
3a3977a8
FXC
6919
6920@item @emph{Syntax}:
d3dfa1fe
BM
6921@code{RESULT = NOT(I)}
6922
3a3977a8 6923@item @emph{Arguments}:
d3dfa1fe
BM
6924@multitable @columnfractions .15 .80
6925@item @var{I} @tab The type shall be @code{INTEGER(*)}.
6926@end multitable
6927
3a3977a8 6928@item @emph{Return value}:
d3dfa1fe
BM
6929The return type is @code{INTEGER(*)}, of the same kind as the
6930argument.
6931
cd051390 6932@item @emph{See also}:
d3dfa1fe
BM
6933@ref{IAND}, @ref{IEOR}, @ref{IOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR}
6934
3a3977a8
FXC
6935@end table
6936
6937
6938
cd051390
DF
6939
6940@node NULL
fe284266 6941@section @code{NULL} --- Function that returns an disassociated pointer
4ba96c02 6942@cindex @code{NULL} intrinsic
cd051390
DF
6943@cindex undocumented intrinsic
6944
6945Intrinsic implemented, documentation pending.
3a3977a8
FXC
6946
6947@table @asis
6948@item @emph{Description}:
cd051390
DF
6949@item @emph{Standard}:
6950F95 and later
3a3977a8
FXC
6951
6952@item @emph{Class}:
cd051390 6953Transformational function
3a3977a8
FXC
6954
6955@item @emph{Syntax}:
3a3977a8 6956@item @emph{Arguments}:
3a3977a8 6957@item @emph{Return value}:
3a3977a8 6958@item @emph{Example}:
cd051390
DF
6959@item @emph{See also}:
6960@ref{ASSOCIATED}
3a3977a8
FXC
6961@end table
6962
6963
6964
cd051390
DF
6965
6966@node OR
fe284266 6967@section @code{OR} --- Bitwise logical OR
4ba96c02 6968@cindex @code{OR} intrinsic
fe284266 6969@cindex bit operations
3a3977a8
FXC
6970
6971@table @asis
6972@item @emph{Description}:
fe284266
DF
6973Bitwise logical @code{OR}.
6974
6975This intrinsic routine is provided for backwards compatibility with
6976GNU Fortran 77. For integer arguments, programmers should consider
6977the use of the @ref{IOR} intrinsic defined by the Fortran standard.
6978
cd051390 6979@item @emph{Standard}:
fe284266 6980GNU extension
3a3977a8
FXC
6981
6982@item @emph{Class}:
fe284266
DF
6983Non-elemental function
6984
3a3977a8 6985@item @emph{Syntax}:
fe284266
DF
6986@code{RESULT = OR(X, Y)}
6987
3a3977a8 6988@item @emph{Arguments}:
fe284266
DF
6989@multitable @columnfractions .15 .80
6990@item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6991@item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6992@end multitable
6993
cd051390 6994@item @emph{Return value}:
fe284266
DF
6995The return type is either @code{INTEGER(*)} or @code{LOGICAL}
6996after cross-promotion of the arguments.
6997
cd051390 6998@item @emph{Example}:
fe284266
DF
6999@smallexample
7000PROGRAM test_or
7001 LOGICAL :: T = .TRUE., F = ..FALSE.
7002 INTEGER :: a, b
7003 DATA a / Z'F' /, b / Z'3' /
7004
7005 WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
7006 WRITE (*,*) OR(a, b)
7007END PROGRAM
7008@end smallexample
7009
cd051390 7010@item @emph{See also}:
fe284266 7011F95 elemental function: @ref{IOR}
cd051390
DF
7012@end table
7013
7014
7015
7016
7017@node PACK
7018@section @code{PACK} --- Pack an array into an array of rank one
4ba96c02 7019@cindex @code{PACK} intrinsic
cd051390
DF
7020@cindex undocumented intrinsic
7021
7022Intrinsic implemented, documentation pending.
7023
7024@table @asis
7025@item @emph{Description}:
7026@item @emph{Standard}:
7027F95 and later
7028
7029@item @emph{Class}:
7030Transformational function
7031
7032@item @emph{Syntax}:
7033@item @emph{Arguments}:
7034@item @emph{Return value}:
7035@item @emph{Example}:
7036@item @emph{Specific names}:
7037@item @emph{See also}:
7038@ref{UNPACK}
7039@end table
7040
7041
7042
cd051390
DF
7043@node PERROR
7044@section @code{PERROR} --- Print system error message
4ba96c02 7045@cindex @code{PERROR} intrinsic
cd051390
DF
7046
7047@table @asis
7048@item @emph{Description}:
d3dfa1fe
BM
7049Prints (on the C @code{stderr} stream) a newline-terminated error
7050message corresponding to the last system error. This is prefixed by
7051@var{STRING}, a colon and a space. See @code{perror(3)}.
7052
cd051390
DF
7053@item @emph{Standard}:
7054GNU extension
7055
7056@item @emph{Class}:
7057Subroutine
7058
7059@item @emph{Syntax}:
d3dfa1fe
BM
7060@code{CALL PERROR(STRING)}
7061
cd051390 7062@item @emph{Arguments}:
d3dfa1fe
BM
7063@multitable @columnfractions .15 .80
7064@item @var{STRING} @tab A scalar of default @code{CHARACTER} type.
7065@end multitable
7066
cd051390
DF
7067@item @emph{See also}:
7068@ref{IERRNO}
7069@end table
7070
7071
7072
cd051390
DF
7073@node PRECISION
7074@section @code{PRECISION} --- Decimal precision of a real kind
4ba96c02
BM
7075@cindex @code{PRECISION} intrinsic
7076@cindex precision of a real variable
cd051390
DF
7077
7078@table @asis
7079@item @emph{Description}:
7080@code{PRECISION(X)} returns the decimal precision in the model of the
7081type of @code{X}.
7082
7083@item @emph{Standard}:
7084F95 and later
7085
7086@item @emph{Class}:
7087Inquiry function
7088
7089@item @emph{Syntax}:
d565bb3a 7090@code{RESULT = PRECISION(X)}
cd051390
DF
7091
7092@item @emph{Arguments}:
7093@multitable @columnfractions .15 .80
7094@item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
7095@end multitable
7096
7097@item @emph{Return value}:
7098The return value is of type @code{INTEGER} and of the default integer
7099kind.
7100
7101@item @emph{Example}:
7102@smallexample
7103program prec_and_range
7104 real(kind=4) :: x(2)
7105 complex(kind=8) :: y
7106
7107 print *, precision(x), range(x)
7108 print *, precision(y), range(y)
7109end program prec_and_range
7110@end smallexample
7111@end table
7112
7113
7114
7115@node PRESENT
7116@section @code{PRESENT} --- Determine whether an optional argument is specified
4ba96c02 7117@cindex @code{PRESENT} intrinsic
cd051390
DF
7118@cindex undocumented intrinsic
7119
7120Intrinsic implemented, documentation pending.
7121
7122@table @asis
7123@item @emph{Description}:
7124@item @emph{Standard}:
7125F95 and later
7126
7127@item @emph{Class}:
7128Inquiry function
7129
7130@item @emph{Syntax}:
7131@item @emph{Arguments}:
7132@item @emph{Return value}:
7133@item @emph{Example}:
7134@item @emph{See also}:
7135@end table
7136
7137
7138
cd051390
DF
7139@node PRODUCT
7140@section @code{PRODUCT} --- Product of array elements
4ba96c02 7141@cindex @code{PRODUCT} intrinsic
cd051390
DF
7142@cindex undocumented intrinsic
7143
7144Intrinsic implemented, documentation pending.
7145
7146@table @asis
7147@item @emph{Description}:
7148@item @emph{Standard}:
7149F95 and later
7150
7151@item @emph{Class}:
7152Transformational function
7153
7154@item @emph{Syntax}:
7155@item @emph{Arguments}:
7156@item @emph{Return value}:
7157@item @emph{Example}:
7158@item @emph{Specific names}:
7159@item @emph{See also}:
7160@ref{SUM}
7161@end table
7162
7163
7164
cd051390
DF
7165@node RADIX
7166@section @code{RADIX} --- Base of a model number
4ba96c02 7167@cindex @code{RADIX} intrinsic
cd051390
DF
7168@cindex base
7169
7170@table @asis
7171@item @emph{Description}:
7172@code{RADIX(X)} returns the base of the model representing the entity @var{X}.
7173
7174@item @emph{Standard}:
7175F95 and later
7176
7177@item @emph{Class}:
7178Inquiry function
7179
7180@item @emph{Syntax}:
d565bb3a 7181@code{RESULT = RADIX(X)}
cd051390
DF
7182
7183@item @emph{Arguments}:
7184@multitable @columnfractions .15 .80
7185@item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
7186@end multitable
7187
7188@item @emph{Return value}:
7189The return value is a scalar of type @code{INTEGER} and of the default
7190integer kind.
7191
7192@item @emph{Example}:
7193@smallexample
7194program test_radix
7195 print *, "The radix for the default integer kind is", radix(0)
7196 print *, "The radix for the default real kind is", radix(0.0)
7197end program test_radix
7198@end smallexample
7199
7200@end table
7201
7202
7203
d3dfa1fe
BM
7204@node RAN
7205@section @code{RAN} --- Real pseudo-random number
7206@cindex @code{RAN} intrinsic
cd051390
DF
7207@cindex random numbers
7208
cd051390
DF
7209@table @asis
7210@item @emph{Description}:
d3dfa1fe
BM
7211For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
7212provided as an alias for @code{RAND}. See @ref{RAND} for complete
7213documentation.
cd051390 7214
cd051390 7215@item @emph{Standard}:
d3dfa1fe 7216GNU extension
cd051390
DF
7217
7218@item @emph{Class}:
d3dfa1fe 7219Non-elemental function
cd051390 7220
cd051390 7221@item @emph{See also}:
d3dfa1fe 7222@ref{RAND}, @ref{RANDOM_NUMBER}
cd051390
DF
7223@end table
7224
7225
7226
cd051390
DF
7227@node RAND
7228@section @code{RAND} --- Real pseudo-random number
4ba96c02 7229@cindex @code{RAND} intrinsic
4ba96c02 7230@cindex random numbers
cd051390
DF
7231
7232@table @asis
7233@item @emph{Description}:
7234@code{RAND(FLAG)} returns a pseudo-random number from a uniform
7235distribution between 0 and 1. If @var{FLAG} is 0, the next number
7236in the current sequence is returned; if @var{FLAG} is 1, the generator
7237is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
7238it is used as a new seed with @code{SRAND}.
7239
7240@item @emph{Standard}:
7241GNU extension
7242
7243@item @emph{Class}:
d3dfa1fe 7244Non-elemental function
cd051390
DF
7245
7246@item @emph{Syntax}:
d565bb3a 7247@code{RESULT = RAND(FLAG)}
cd051390
DF
7248
7249@item @emph{Arguments}:
7250@multitable @columnfractions .15 .80
7251@item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
7252@end multitable
3a3977a8
FXC
7253
7254@item @emph{Return value}:
7255The return value is of @code{REAL} type and the default kind.
7256
7257@item @emph{Example}:
7258@smallexample
7259program test_rand
7260 integer,parameter :: seed = 86456
7261
7262 call srand(seed)
7263 print *, rand(), rand(), rand(), rand()
7264 print *, rand(seed), rand(), rand(), rand()
7265end program test_rand
7266@end smallexample
7267
cd051390
DF
7268@item @emph{See also}:
7269@ref{SRAND}, @ref{RANDOM_NUMBER}
7270
3a3977a8
FXC
7271@end table
7272
7273
7274
d3dfa1fe
BM
7275@node RANDOM_NUMBER
7276@section @code{RANDOM_NUMBER} --- Pseudo-random number
7277@cindex @code{RANDOM_NUMBER} intrinsic
7278@cindex random numbers
7279
7280Intrinsic implemented, documentation pending.
7281
7282@table @asis
7283@item @emph{Description}:
7284@item @emph{Standard}:
7285F95 and later
7286
7287@item @emph{Class}:
7288Elemental subroutine
7289
7290@item @emph{Syntax}:
7291@item @emph{Arguments}:
7292@item @emph{Return value}:
7293@item @emph{Example}:
7294@item @emph{See also}:
7295@ref{RANDOM_SEED}
7296@end table
7297
7298
7299
7300@node RANDOM_SEED
7301@section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
7302@cindex @code{RANDOM_SEED} intrinsic
7303@cindex random numbers
7304
7305Intrinsic implemented, documentation pending.
7306
7307@table @asis
7308@item @emph{Description}:
7309@item @emph{Standard}:
7310F95 and later
7311
7312@item @emph{Class}:
7313Subroutine
7314
7315@item @emph{Syntax}:
7316@item @emph{Arguments}:
7317@item @emph{Return value}:
7318@item @emph{Example}:
7319@item @emph{See also}:
7320@ref{RANDOM_NUMBER}
7321@end table
7322
7323
7324
3a3977a8
FXC
7325@node RANGE
7326@section @code{RANGE} --- Decimal exponent range of a real kind
4ba96c02
BM
7327@cindex @code{RANGE} intrinsic
7328@cindex range of a real variable
3a3977a8
FXC
7329
7330@table @asis
7331@item @emph{Description}:
7332@code{RANGE(X)} returns the decimal exponent range in the model of the
7333type of @code{X}.
7334
cd051390
DF
7335@item @emph{Standard}:
7336F95 and later
3a3977a8
FXC
7337
7338@item @emph{Class}:
cd051390 7339Inquiry function
3a3977a8
FXC
7340
7341@item @emph{Syntax}:
d565bb3a 7342@code{RESULT = RANGE(X)}
3a3977a8
FXC
7343
7344@item @emph{Arguments}:
7345@multitable @columnfractions .15 .80
7346@item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
7347@end multitable
7348
7349@item @emph{Return value}:
7350The return value is of type @code{INTEGER} and of the default integer
7351kind.
7352
7353@item @emph{Example}:
7354See @code{PRECISION} for an example.
7355@end table
7356
7357
7358
7359@node REAL
7360@section @code{REAL} --- Convert to real type
4ba96c02
BM
7361@cindex @code{REAL} intrinsic
7362@cindex @code{REALPART} intrinsic
3a3977a8
FXC
7363@cindex true values
7364
7365@table @asis
7366@item @emph{Description}:
7367@code{REAL(X [, KIND])} converts its argument @var{X} to a real type. The
7368@code{REALPART(X)} function is provided for compatibility with @command{g77},
7369and its use is strongly discouraged.
7370
cd051390
DF
7371@item @emph{Standard}:
7372F77 and later
3a3977a8
FXC
7373
7374@item @emph{Class}:
cd051390 7375Elemental function
3a3977a8
FXC
7376
7377@item @emph{Syntax}:
7378@multitable @columnfractions .30 .80
d565bb3a
BM
7379@item @code{RESULT = REAL(X [, KIND])}
7380@item @code{RESULT = REALPART(Z)}
3a3977a8
FXC
7381@end multitable
7382
7383@item @emph{Arguments}:
7384@multitable @columnfractions .15 .80
d3dfa1fe
BM
7385@item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or
7386 @code{COMPLEX(*)}.
7387@item @var{KIND} @tab (Optional) An @code{INTEGER(*)} initialization
7388 expression indicating the kind parameter of
7389 the result.
3a3977a8
FXC
7390@end multitable
7391
7392@item @emph{Return value}:
cd051390 7393These functions return a @code{REAL(*)} variable or array under
3a3977a8
FXC
7394the following rules:
7395
7396@table @asis
7397@item (A)
7398@code{REAL(X)} is converted to a default real type if @var{X} is an
7399integer or real variable.
7400@item (B)
7401@code{REAL(X)} is converted to a real type with the kind type parameter
7402of @var{X} if @var{X} is a complex variable.
7403@item (C)
7404@code{REAL(X, KIND)} is converted to a real type with kind type
7405parameter @var{KIND} if @var{X} is a complex, integer, or real
7406variable.
7407@end table
7408
7409@item @emph{Example}:
7410@smallexample
7411program test_real
7412 complex :: x = (1.0, 2.0)
7413 print *, real(x), real(x,8), realpart(x)
7414end program test_real
7415@end smallexample
cd051390
DF
7416
7417@item @emph{See also}:
7418@ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
7419
7420@end table
7421
7422
d3dfa1fe 7423
cd051390
DF
7424@node RENAME
7425@section @code{RENAME} --- Rename a file
4ba96c02 7426@cindex @code{RENAME} intrinsic
cd051390
DF
7427@cindex file system operations
7428
cd051390
DF
7429@table @asis
7430@item @emph{Description}:
d3dfa1fe
BM
7431Renames a file from file @var{PATH1} to @var{PATH2}. A null
7432character (@code{CHAR(0)}) can be used to mark the end of the names in
7433@var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
7434names are ignored. If the @var{STATUS} argument is supplied, it
7435contains 0 on success or a nonzero error code upon return; see
7436@code{rename(2)}.
7437
cd051390
DF
7438@item @emph{Standard}:
7439GNU extension
7440
7441@item @emph{Class}:
7442Subroutine
7443
7444@item @emph{Syntax}:
d3dfa1fe
BM
7445@code{CALL RENAME(PATH1, PATH2 [, STATUS])}
7446
cd051390 7447@item @emph{Arguments}:
d3dfa1fe
BM
7448@multitable @columnfractions .15 .80
7449@item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
7450@item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
7451@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
7452@end multitable
7453
cd051390 7454@item @emph{See also}:
d3dfa1fe 7455@ref{LINK}
cd051390 7456
d3dfa1fe 7457@end table
cd051390
DF
7458
7459
7460
7461@node REPEAT
7462@section @code{REPEAT} --- Repeated string concatenation
4ba96c02 7463@cindex @code{REPEAT} intrinsic
cd051390
DF
7464@cindex string manipulation
7465
7466Intrinsic implemented, documentation pending.
7467
7468@table @asis
7469@item @emph{Description}:
7470@item @emph{Standard}:
7471F95 and later
7472
7473@item @emph{Class}:
7474Transformational function
7475
7476@item @emph{Syntax}:
7477@item @emph{Arguments}:
7478@item @emph{Return value}:
7479@item @emph{Example}:
7480@item @emph{See also}:
7481@end table
7482
7483
7484
7485
7486@node RESHAPE
7487@section @code{RESHAPE} --- Function to reshape an array
4ba96c02 7488@cindex @code{RESHAPE} intrinsic
cd051390
DF
7489@cindex array manipulation
7490
7491Intrinsic implemented, documentation pending.
7492
7493@table @asis
7494@item @emph{Description}:
7495@item @emph{Standard}:
7496F95 and later
7497
7498@item @emph{Class}:
7499Transformational function
7500
7501@item @emph{Syntax}:
7502@item @emph{Arguments}:
7503@item @emph{Return value}:
7504@item @emph{Example}:
7505@item @emph{See also}:
7506@ref{SHAPE}
3a3977a8
FXC
7507@end table
7508
7509
7510
7511@node RRSPACING
7512@section @code{RRSPACING} --- Reciprocal of the relative spacing
4ba96c02 7513@cindex @code{RRSPACING} intrinsic
3a3977a8
FXC
7514
7515@table @asis
7516@item @emph{Description}:
7517@code{RRSPACING(X)} returns the reciprocal of the relative spacing of
7518model numbers near @var{X}.
7519
cd051390
DF
7520@item @emph{Standard}:
7521F95 and later
3a3977a8
FXC
7522
7523@item @emph{Class}:
cd051390 7524Elemental function
3a3977a8
FXC
7525
7526@item @emph{Syntax}:
d565bb3a 7527@code{RESULT = RRSPACING(X)}
3a3977a8
FXC
7528
7529@item @emph{Arguments}:
7530@multitable @columnfractions .15 .80
7531@item @var{X} @tab shall be of type @code{REAL}.
7532@end multitable
7533
7534@item @emph{Return value}:
7535The return value is of the same type and kind as @var{X}.
7536The value returned is equal to
7537@code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
7538
7539@end table
7540
7541
7542
cd051390
DF
7543@node RSHIFT
7544@section @code{RSHIFT} --- Right shift bits
4ba96c02
BM
7545@cindex @code{RSHIFT} intrinsic
7546@cindex bit operations
cd051390 7547
cd051390
DF
7548@table @asis
7549@item @emph{Description}:
d3dfa1fe
BM
7550@code{RSHIFT} returns a value corresponding to @var{I} with all of the
7551bits shifted right by @var{SHIFT} places. If the absolute value of
7552@var{SHIFT} is greater than @code{BIT_SIZE(I)}, the value is undefined.
7553Bits shifted out from the left end are lost; zeros are shifted in from
7554the opposite end.
7555
8370304d 7556This function has been superseded by the @code{ISHFT} intrinsic, which
d3dfa1fe 7557is standard in Fortran 95 and later.
cd051390
DF
7558
7559@item @emph{Standard}:
7560GNU extension
7561
7562@item @emph{Class}:
d3dfa1fe 7563Elemental function
cd051390
DF
7564
7565@item @emph{Syntax}:
d3dfa1fe
BM
7566@code{RESULT = RSHIFT(I, SHIFT)}
7567
cd051390 7568@item @emph{Arguments}:
d3dfa1fe
BM
7569@multitable @columnfractions .15 .80
7570@item @var{I} @tab The type shall be @code{INTEGER(*)}.
7571@item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
7572@end multitable
7573
cd051390 7574@item @emph{Return value}:
d3dfa1fe
BM
7575The return value is of type @code{INTEGER(*)} and of the same kind as
7576@var{I}.
7577
cd051390 7578@item @emph{See also}:
d3dfa1fe 7579@ref{ISHFT}, @ref{ISHFTC}, @ref{LSHIFT}
cd051390
DF
7580
7581@end table
7582
7583
7584
3a3977a8
FXC
7585@node SCALE
7586@section @code{SCALE} --- Scale a real value
4ba96c02 7587@cindex @code{SCALE} intrinsic
3a3977a8
FXC
7588
7589@table @asis
7590@item @emph{Description}:
7591@code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
7592
cd051390
DF
7593@item @emph{Standard}:
7594F95 and later
3a3977a8
FXC
7595
7596@item @emph{Class}:
cd051390 7597Elemental function
3a3977a8
FXC
7598
7599@item @emph{Syntax}:
d565bb3a 7600@code{RESULT = SCALE(X, I)}
3a3977a8
FXC
7601
7602@item @emph{Arguments}:
7603@multitable @columnfractions .15 .80
7604@item @var{X} @tab The type of the argument shall be a @code{REAL}.
7605@item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
7606@end multitable
7607
7608@item @emph{Return value}:
7609The return value is of the same type and kind as @var{X}.
7610Its value is @code{X * RADIX(X)**I}.
7611
7612@item @emph{Example}:
7613@smallexample
7614program test_scale
7615 real :: x = 178.1387e-4
7616 integer :: i = 5
7617 print *, scale(x,i), x*radix(x)**i
7618end program test_scale
7619@end smallexample
cd051390
DF
7620
7621@end table
7622
7623
7624@node SCAN
7625@section @code{SCAN} --- Scan a string for the presence of a set of characters
4ba96c02 7626@cindex @code{SCAN} intrinsic
cd051390
DF
7627@cindex string manipulation
7628
7629Intrinsic implemented, documentation pending.
7630
7631@table @asis
7632@item @emph{Description}:
7633@item @emph{Standard}:
7634F95 and later
7635
7636@item @emph{Class}:
7637Elemental function
7638
7639@item @emph{Syntax}:
7640@item @emph{Arguments}:
7641@item @emph{Return value}:
7642@item @emph{Example}:
7643@item @emph{See also}:
7644@end table
7645
7646
7647
7648
7649@node SECNDS
7650@section @code{SECNDS} --- Time function
4ba96c02
BM
7651@cindex @code{SECNDS} intrinsic
7652@cindex time, current
7653@cindex current time
cd051390
DF
7654
7655@table @asis
7656@item @emph{Description}:
7657@code{SECNDS(X)} gets the time in seconds from the real-time system clock.
7658@var{X} is a reference time, also in seconds. If this is zero, the time in
7659seconds from midnight is returned. This function is non-standard and its
7660use is discouraged.
7661
7662@item @emph{Standard}:
7663GNU extension
7664
7665@item @emph{Class}:
7666function
7667
7668@item @emph{Syntax}:
d565bb3a 7669@code{RESULT = SECNDS (X)}
cd051390
DF
7670
7671@item @emph{Arguments}:
7672@multitable @columnfractions .15 .80
7673@item Name @tab Type
7674@item @var{T} @tab REAL(4)
7675@item @var{X} @tab REAL(4)
7676@end multitable
7677
7678@item @emph{Return value}:
7679None
7680
7681@item @emph{Example}:
7682@smallexample
7683program test_secnds
7684 real(4) :: t1, t2
7685 print *, secnds (0.0) ! seconds since midnight
7686 t1 = secnds (0.0) ! reference time
7687 do i = 1, 10000000 ! do something
7688 end do
7689 t2 = secnds (t1) ! elapsed time
7690 print *, "Something took ", t2, " seconds."
7691end program test_secnds
7692@end smallexample
3a3977a8
FXC
7693@end table
7694
7695
7696
7697@node SELECTED_INT_KIND
7698@section @code{SELECTED_INT_KIND} --- Choose integer kind
4ba96c02 7699@cindex @code{SELECTED_INT_KIND} intrinsic
3a3977a8
FXC
7700@cindex integer kind
7701
7702@table @asis
7703@item @emph{Description}:
7704@code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
7705type that can represent all values ranging from @math{-10^I} (exclusive)
929e2b92 7706to @math{10^I} (exclusive). If there is no integer kind that accommodates
3a3977a8
FXC
7707this range, @code{SELECTED_INT_KIND} returns @math{-1}.
7708
cd051390
DF
7709@item @emph{Standard}:
7710F95 and later
3a3977a8
FXC
7711
7712@item @emph{Class}:
cd051390 7713Transformational function
3a3977a8
FXC
7714
7715@item @emph{Syntax}:
d565bb3a 7716@code{RESULT = SELECTED_INT_KIND(I)}
3a3977a8
FXC
7717
7718@item @emph{Arguments}:
7719@multitable @columnfractions .15 .80
7720@item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
7721@end multitable
7722
7723@item @emph{Example}:
7724@smallexample
7725program large_integers
7726 integer,parameter :: k5 = selected_int_kind(5)
7727 integer,parameter :: k15 = selected_int_kind(15)
7728 integer(kind=k5) :: i5
7729 integer(kind=k15) :: i15
7730
7731 print *, huge(i5), huge(i15)
7732
7733 ! The following inequalities are always true
7734 print *, huge(i5) >= 10_k5**5-1
7735 print *, huge(i15) >= 10_k15**15-1
7736end program large_integers
7737@end smallexample
7738@end table
7739
7740
7741
7742@node SELECTED_REAL_KIND
7743@section @code{SELECTED_REAL_KIND} --- Choose real kind
4ba96c02 7744@cindex @code{SELECTED_REAL_KIND} intrinsic
3a3977a8
FXC
7745@cindex real kind
7746
7747@table @asis
7748@item @emph{Description}:
7749@code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
7750with decimal precision greater of at least @code{P} digits and exponent
7751range greater at least @code{R}.
7752
cd051390
DF
7753@item @emph{Standard}:
7754F95 and later
3a3977a8
FXC
7755
7756@item @emph{Class}:
cd051390 7757Transformational function
3a3977a8
FXC
7758
7759@item @emph{Syntax}:
d565bb3a 7760@code{RESULT = SELECTED_REAL_KIND(P, R)}
3a3977a8
FXC
7761
7762@item @emph{Arguments}:
7763@multitable @columnfractions .15 .80
7764@item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7765@item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7766@end multitable
7767At least one argument shall be present.
7768
7769@item @emph{Return value}:
7770
7771@code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
7772a real data type with decimal precision of at least @code{P} digits and a
7773decimal exponent range of at least @code{R}. If more than one real data
7774type meet the criteria, the kind of the data type with the smallest
7775decimal precision is returned. If no real data type matches the criteria,
7776the result is
7777@table @asis
7778@item -1 if the processor does not support a real data type with a
7779precision greater than or equal to @code{P}
7780@item -2 if the processor does not support a real type with an exponent
7781range greater than or equal to @code{R}
7782@item -3 if neither is supported.
7783@end table
7784
7785@item @emph{Example}:
7786@smallexample
7787program real_kinds
7788 integer,parameter :: p6 = selected_real_kind(6)
7789 integer,parameter :: p10r100 = selected_real_kind(10,100)
7790 integer,parameter :: r400 = selected_real_kind(r=400)
7791 real(kind=p6) :: x
7792 real(kind=p10r100) :: y
7793 real(kind=r400) :: z
7794
7795 print *, precision(x), range(x)
7796 print *, precision(y), range(y)
7797 print *, precision(z), range(z)
7798end program real_kinds
7799@end smallexample
7800@end table
7801
7802
7803
3a3977a8
FXC
7804@node SET_EXPONENT
7805@section @code{SET_EXPONENT} --- Set the exponent of the model
4ba96c02
BM
7806@cindex @code{SET_EXPONENT} intrinsic
7807@cindex exponent part of a real number
0d519038
FXC
7808
7809@table @asis
7810@item @emph{Description}:
3a3977a8 7811@code{SET_EXPONENT(X, I)} returns the real number whose fractional part
4ba96c02 7812is that that of @var{X} and whose exponent part is @var{I}.
0d519038 7813
cd051390
DF
7814@item @emph{Standard}:
7815F95 and later
0d519038
FXC
7816
7817@item @emph{Class}:
cd051390 7818Elemental function
0d519038
FXC
7819
7820@item @emph{Syntax}:
d565bb3a 7821@code{RESULT = SET_EXPONENT(X, I)}
0d519038
FXC
7822
7823@item @emph{Arguments}:
7824@multitable @columnfractions .15 .80
3a3977a8
FXC
7825@item @var{X} @tab shall be of type @code{REAL}.
7826@item @var{I} @tab shall be of type @code{INTEGER}.
0d519038
FXC
7827@end multitable
7828
7829@item @emph{Return value}:
3a3977a8
FXC
7830The return value is of the same type and kind as @var{X}.
7831The real number whose fractional part
7832is that that of @var{X} and whose exponent part if @var{I} is returned;
7833it is @code{FRACTION(X) * RADIX(X)**I}.
0d519038
FXC
7834
7835@item @emph{Example}:
0d519038 7836@smallexample
3a3977a8
FXC
7837program test_setexp
7838 real :: x = 178.1387e-4
7839 integer :: i = 17
7840 print *, set_exponent(x), fraction(x) * radix(x)**i
7841end program test_setexp
0d519038 7842@end smallexample
3a3977a8 7843
0d519038
FXC
7844@end table
7845
7846
3a3977a8 7847
cd051390
DF
7848@node SHAPE
7849@section @code{SHAPE} --- Determine the shape of an array
4ba96c02 7850@cindex @code{SHAPE} intrinsic
cd051390
DF
7851@cindex array manipulation
7852
7853Intrinsic implemented, documentation pending.
7854
7855@table @asis
7856@item @emph{Description}:
7857@item @emph{Standard}:
7858F95 and later
7859
7860@item @emph{Class}:
7861Inquiry function
7862
7863@item @emph{Syntax}:
7864@item @emph{Arguments}:
7865@item @emph{Return value}:
7866@item @emph{Example}:
7867@item @emph{See also}:
7868@ref{RESHAPE}
7869@end table
7870
7871
7872
3a3977a8
FXC
7873@node SIGN
7874@section @code{SIGN} --- Sign copying function
4ba96c02
BM
7875@cindex @code{SIGN} intrinsic
7876@cindex @code{ISIGN} intrinsic
7877@cindex @code{DSIGN} intrinsic
3a3977a8 7878@cindex sign copying
6970fcc8
SK
7879
7880@table @asis
7881@item @emph{Description}:
3a3977a8 7882@code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
6970fcc8 7883
cd051390
DF
7884@item @emph{Standard}:
7885F77 and later
6970fcc8
SK
7886
7887@item @emph{Class}:
cd051390 7888Elemental function
6970fcc8
SK
7889
7890@item @emph{Syntax}:
d565bb3a 7891@code{RESULT = SIGN(A, B)}
6970fcc8
SK
7892
7893@item @emph{Arguments}:
7894@multitable @columnfractions .15 .80
3a3977a8
FXC
7895@item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
7896@item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
6970fcc8
SK
7897@end multitable
7898
7899@item @emph{Return value}:
3a3977a8
FXC
7900The kind of the return value is that of @var{A} and @var{B}.
7901If @math{B\ge 0} then the result is @code{ABS(A)}, else
7902it is @code{-ABS(A)}.
6970fcc8
SK
7903
7904@item @emph{Example}:
7905@smallexample
3a3977a8
FXC
7906program test_sign
7907 print *, sign(-12,1)
7908 print *, sign(-12,0)
7909 print *, sign(-12,-1)
7910
7911 print *, sign(-12.,1.)
7912 print *, sign(-12.,0.)
7913 print *, sign(-12.,-1.)
7914end program test_sign
6970fcc8 7915@end smallexample
3a3977a8
FXC
7916
7917@item @emph{Specific names}:
cd051390
DF
7918@multitable @columnfractions .20 .20 .20 .40
7919@item Name @tab Arguments @tab Return type @tab Standard
3a3977a8
FXC
7920@item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
7921@item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
7922@end multitable
6970fcc8
SK
7923@end table
7924
f7cdcbf1 7925
185d7d97
FXC
7926
7927@node SIGNAL
7928@section @code{SIGNAL} --- Signal handling subroutine (or function)
4ba96c02
BM
7929@cindex @code{SIGNAL} intrinsic
7930@cindex signal handling
185d7d97
FXC
7931
7932@table @asis
7933@item @emph{Description}:
7934@code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
7935@var{HANDLER} to be executed with a single integer argument when signal
7936@var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to
7937turn off handling of signal @var{NUMBER} or revert to its default
7938action. See @code{signal(2)}.
7939
7940If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
7941is supplied, it is set to the value returned by @code{signal(2)}.
7942
cd051390
DF
7943@item @emph{Standard}:
7944GNU extension
185d7d97
FXC
7945
7946@item @emph{Class}:
7947subroutine, non-elemental function
7948
7949@item @emph{Syntax}:
d3dfa1fe 7950@multitable @columnfractions .80
d565bb3a 7951@item @code{CALL SIGNAL(NUMBER, HANDLER [, STATUS])}
4ba96c02 7952@item @code{STATUS = SIGNAL(NUMBER, HANDLER)}
185d7d97
FXC
7953@end multitable
7954
7955@item @emph{Arguments}:
7956@multitable @columnfractions .15 .80
7957@item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
7958@item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
7959@code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
7960@code{INTEGER}. It is @code{INTENT(IN)}.
7961@item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
7962integer. It has @code{INTENT(OUT)}.
7963@end multitable
7964
7965@item @emph{Return value}:
4ba96c02 7966The @code{SIGNAL} function returns the value returned by @code{signal(2)}.
185d7d97
FXC
7967
7968@item @emph{Example}:
7969@smallexample
7970program test_signal
7971 intrinsic signal
7972 external handler_print
7973
7974 call signal (12, handler_print)
7975 call signal (10, 1)
7976
7977 call sleep (30)
7978end program test_signal
7979@end smallexample
7980@end table
7981
7982
7983
a5d58aeb
FXC
7984@node SIN
7985@section @code{SIN} --- Sine function
4ba96c02
BM
7986@cindex @code{SIN} intrinsic
7987@cindex @code{DSIN} intrinsic
7988@cindex @code{ZSIN} intrinsic
7989@cindex @code{CDSIN} intrinsic
cd051390 7990@cindex trigonometric functions
a5d58aeb
FXC
7991
7992@table @asis
7993@item @emph{Description}:
7994@code{SIN(X)} computes the sine of @var{X}.
7995
cd051390
DF
7996@item @emph{Standard}:
7997F77 and later
a5d58aeb 7998
eaef357b 7999@item @emph{Class}:
cd051390 8000Elemental function
a5d58aeb
FXC
8001
8002@item @emph{Syntax}:
d565bb3a 8003@code{RESULT = SIN(X)}
a5d58aeb
FXC
8004
8005@item @emph{Arguments}:
8006@multitable @columnfractions .15 .80
eaef357b 8007@item @var{X} @tab The type shall be @code{REAL(*)} or
a5d58aeb
FXC
8008@code{COMPLEX(*)}.
8009@end multitable
8010
8011@item @emph{Return value}:
cd051390 8012The return value has same type and kind as @var{X}.
a5d58aeb
FXC
8013
8014@item @emph{Example}:
8015@smallexample
8016program test_sin
8017 real :: x = 0.0
8018 x = sin(x)
8019end program test_sin
8020@end smallexample
8021
8022@item @emph{Specific names}:
cd051390
DF
8023@multitable @columnfractions .20 .20 .20 .40
8024@item Name @tab Argument @tab Return type @tab Standard
a5d58aeb
FXC
8025@item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
8026@item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
8027@item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
8028@item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
8029@end multitable
cd051390
DF
8030
8031@item @emph{See also}:
8032@ref{ASIN}
a5d58aeb
FXC
8033@end table
8034
8035
8036
f7cdcbf1
FXC
8037@node SINH
8038@section @code{SINH} --- Hyperbolic sine function
4ba96c02
BM
8039@cindex @code{SINH} intrinsic
8040@cindex @code{DSINH} intrinsic
f7cdcbf1
FXC
8041@cindex hyperbolic sine
8042
8043@table @asis
8044@item @emph{Description}:
8045@code{SINH(X)} computes the hyperbolic sine of @var{X}.
8046
cd051390
DF
8047@item @emph{Standard}:
8048F95 and later
f7cdcbf1 8049
eaef357b 8050@item @emph{Class}:
cd051390 8051Elemental function
f7cdcbf1
FXC
8052
8053@item @emph{Syntax}:
d565bb3a 8054@code{RESULT = SINH(X)}
f7cdcbf1
FXC
8055
8056@item @emph{Arguments}:
8057@multitable @columnfractions .15 .80
eaef357b 8058@item @var{X} @tab The type shall be @code{REAL(*)}.
f7cdcbf1
FXC
8059@end multitable
8060
8061@item @emph{Return value}:
8062The return value is of type @code{REAL(*)}.
8063
8064@item @emph{Example}:
8065@smallexample
8066program test_sinh
8067 real(8) :: x = - 1.0_8
8068 x = sinh(x)
8069end program test_sinh
8070@end smallexample
8071
8072@item @emph{Specific names}:
cd051390
DF
8073@multitable @columnfractions .20 .20 .20 .40
8074@item Name @tab Argument @tab Return type @tab Standard
8075@item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
f7cdcbf1 8076@end multitable
cd051390
DF
8077
8078@item @emph{See also}:
8079@ref{ASINH}
8080@end table
8081
8082
8083
8084@node SIZE
8085@section @code{SIZE} --- Determine the size of an array
4ba96c02 8086@cindex @code{SIZE} intrinsic
cd051390
DF
8087@cindex array manipulation
8088
8089Intrinsic implemented, documentation pending.
8090
8091@table @asis
8092@item @emph{Description}:
8093@item @emph{Standard}:
8094F95 and later
8095
8096@item @emph{Class}:
8097Inquiry function
8098
8099@item @emph{Syntax}:
8100@item @emph{Arguments}:
8101@item @emph{Return value}:
8102@item @emph{Example}:
8103@item @emph{See also}:
f7cdcbf1
FXC
8104@end table
8105
8106
8107
3a3977a8
FXC
8108@node SNGL
8109@section @code{SNGL} --- Convert double precision real to default real
4ba96c02 8110@cindex @code{SNGL} intrinsic
cd051390 8111@cindex conversion function (real)
3a3977a8
FXC
8112
8113@table @asis
8114@item @emph{Description}:
8115@code{SNGL(A)} converts the double precision real @var{A}
8116to a default real value. This is an archaic form of @code{REAL}
8117that is specific to one type for @var{A}.
8118
cd051390
DF
8119@item @emph{Standard}:
8120GNU extension
3a3977a8
FXC
8121
8122@item @emph{Class}:
8123function
8124
8125@item @emph{Syntax}:
d565bb3a 8126@code{RESULT = SNGL(A)}
cd051390
DF
8127
8128@item @emph{Arguments}:
8129@multitable @columnfractions .15 .80
8130@item @var{A} @tab The type shall be a double precision @code{REAL}.
8131@end multitable
8132
8133@item @emph{Return value}:
8134The return value is of type default @code{REAL}.
8135
8136@item @emph{See also}:
8137@ref{DBLE}
8138@end table
8139
8140
8141
8142@node SPACING
8143@section @code{SPACING} --- Smallest distance between two numbers of a given type
4ba96c02 8144@cindex @code{SPACING} intrinsic
cd051390
DF
8145@cindex undocumented intrinsic
8146
8147Intrinsic implemented, documentation pending.
8148
8149@table @asis
8150@item @emph{Description}:
8151@item @emph{Standard}:
8152F95 and later
8153
8154@item @emph{Class}:
8155Elemental function
8156
8157@item @emph{Syntax}:
8158@item @emph{Arguments}:
8159@item @emph{Return value}:
8160@item @emph{Example}:
8161@item @emph{See also}:
8162@end table
8163
8164
8165
8166
8167@node SPREAD
8168@section @code{SPREAD} --- Add a dimension to an array
4ba96c02 8169@cindex @code{SPREAD} intrinsic
cd051390
DF
8170@cindex array manipulation
8171
8172Intrinsic implemented, documentation pending.
8173
8174@table @asis
8175@item @emph{Description}:
8176@item @emph{Standard}:
8177F95 and later
8178
8179@item @emph{Class}:
8180Transformational function
8181
8182@item @emph{Syntax}:
8183@item @emph{Arguments}:
8184@item @emph{Return value}:
8185@item @emph{Example}:
8186@item @emph{See also}:
8187@end table
8188
8189
8190
8191
8192@node SQRT
8193@section @code{SQRT} --- Square-root function
4ba96c02
BM
8194@cindex @code{SQRT} intrinsic
8195@cindex @code{DSQRT} intrinsic
8196@cindex @code{CSQRT} intrinsic
8197@cindex @code{ZSQRT} intrinsic
8198@cindex @code{CDSQRT} intrinsic
cd051390
DF
8199@cindex square-root
8200
8201@table @asis
8202@item @emph{Description}:
8203@code{SQRT(X)} computes the square root of @var{X}.
8204
8205@item @emph{Standard}:
8206F77 and later
8207
8208@item @emph{Class}:
8209Elemental function
8210
8211@item @emph{Syntax}:
d565bb3a 8212@code{RESULT = SQRT(X)}
cd051390
DF
8213
8214@item @emph{Arguments}:
8215@multitable @columnfractions .15 .80
8216@item @var{X} @tab The type shall be @code{REAL(*)} or
8217@code{COMPLEX(*)}.
8218@end multitable
8219
8220@item @emph{Return value}:
8221The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
8222The kind type parameter is the same as @var{X}.
8223
8224@item @emph{Example}:
8225@smallexample
8226program test_sqrt
8227 real(8) :: x = 2.0_8
8228 complex :: z = (1.0, 2.0)
8229 x = sqrt(x)
8230 z = sqrt(z)
8231end program test_sqrt
8232@end smallexample
8233
8234@item @emph{Specific names}:
8235@multitable @columnfractions .20 .20 .20 .40
8236@item Name @tab Argument @tab Return type @tab Standard
8237@item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
8238@item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F95 and later
8239@item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
8240@item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
8241@end multitable
8242@end table
8243
8244
8245
8246@node SRAND
8247@section @code{SRAND} --- Reinitialize the random number generator
4ba96c02
BM
8248@cindex @code{SRAND} intrinsic
8249@cindex random numbers
cd051390
DF
8250
8251@table @asis
8252@item @emph{Description}:
8253@code{SRAND} reinitializes the pseudo-random number generator
8254called by @code{RAND} and @code{IRAND}. The new seed used by the
8255generator is specified by the required argument @var{SEED}.
8256
8257@item @emph{Standard}:
8258GNU extension
8259
8260@item @emph{Class}:
8261non-elemental subroutine
8262
8263@item @emph{Syntax}:
8264@code{CALL SRAND(SEED)}
8265
8266@item @emph{Arguments}:
8267@multitable @columnfractions .15 .80
8268@item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
8269@end multitable
8270
8271@item @emph{Return value}:
8272Does not return.
8273
8274@item @emph{Example}:
8275See @code{RAND} and @code{IRAND} for examples.
8276
8277@item @emph{Notes}:
8278The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
8279initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
8280to generate pseudo-random numbers. Please note that in
7fc15ba5 8281GNU Fortran, these two sets of intrinsics (@code{RAND},
cd051390
DF
8282@code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
8283@code{RANDOM_SEED} on the other hand) access two independent
8284pseudo-random number generators.
8285
8286@item @emph{See also}:
8287@ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
8288
8289@end table
8290
8291
d3dfa1fe 8292
cd051390
DF
8293@node STAT
8294@section @code{STAT} --- Get file status
4ba96c02 8295@cindex @code{STAT} intrinsic
cd051390
DF
8296@cindex file system operations
8297
cd051390
DF
8298@table @asis
8299@item @emph{Description}:
21825fd6
DF
8300This function returns information about a file. No permissions are required on
8301the file itself, but execute (search) permission is required on all of the
8302directories in path that lead to the file.
8303
8304The elements that are obtained and stored in the array @code{BUFF}:
8305@multitable @columnfractions .15 .80
8306@item @code{buff(1)} @tab Device ID
8307@item @code{buff(2)} @tab Inode number
8308@item @code{buff(3)} @tab File mode
8309@item @code{buff(4)} @tab Number of links
8310@item @code{buff(5)} @tab Owner's uid
8311@item @code{buff(6)} @tab Owner's gid
8312@item @code{buff(7)} @tab ID of device containing directory entry for file (0 if not available)
8313@item @code{buff(8)} @tab File size (bytes)
8314@item @code{buff(9)} @tab Last access time
8315@item @code{buff(10)} @tab Last modification time
8316@item @code{buff(11)} @tab Last file status change time
8317@item @code{buff(12)} @tab Preferred I/O block size (-1 if not available)
8318@item @code{buff(13)} @tab Number of blocks allocated (-1 if not available)
8319@end multitable
8320
8321Not all these elements are relevant on all systems.
8322If an element is not relevant, it is returned as 0.
8323
8324
cd051390
DF
8325@item @emph{Standard}:
8326GNU extension
8327
8328@item @emph{Class}:
21825fd6
DF
8329Non-elemental subroutine
8330
cd051390 8331@item @emph{Syntax}:
21825fd6
DF
8332@code{CALL STAT(FILE,BUFF[,STATUS])}
8333
cd051390 8334@item @emph{Arguments}:
21825fd6
DF
8335@multitable @columnfractions .15 .80
8336@item @var{FILE} @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
8337@item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
8338@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
8339 on success and a system specific error code otherwise.
8340@end multitable
8341
cd051390 8342@item @emph{Example}:
21825fd6 8343@smallexample
25f32574 8344PROGRAM test_stat
21825fd6
DF
8345 INTEGER, DIMENSION(13) :: buff
8346 INTEGER :: status
8347
25f32574 8348 CALL STAT("/etc/passwd", buff, status)
21825fd6
DF
8349
8350 IF (status == 0) THEN
25f32574
BM
8351 WRITE (*, FMT="('Device ID:', T30, I19)") buff(1)
8352 WRITE (*, FMT="('Inode number:', T30, I19)") buff(2)
cdfd6b4b 8353 WRITE (*, FMT="('File mode (octal):', T30, O19)") buff(3)
25f32574
BM
8354 WRITE (*, FMT="('Number of links:', T30, I19)") buff(4)
8355 WRITE (*, FMT="('Owner''s uid:', T30, I19)") buff(5)
8356 WRITE (*, FMT="('Owner''s gid:', T30, I19)") buff(6)
8357 WRITE (*, FMT="('Device where located:', T30, I19)") buff(7)
8358 WRITE (*, FMT="('File size:', T30, I19)") buff(8)
8359 WRITE (*, FMT="('Last access time:', T30, A19)") CTIME(buff(9))
8360 WRITE (*, FMT="('Last modification time', T30, A19)") CTIME(buff(10))
8361 WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
8362 WRITE (*, FMT="('Preferred block size:', T30, I19)") buff(12)
8363 WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
21825fd6
DF
8364 END IF
8365END PROGRAM
8366@end smallexample
8367
cd051390 8368@item @emph{See also}:
21825fd6 8369To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
cd051390
DF
8370@end table
8371
8372
8373
cd051390
DF
8374@node SUM
8375@section @code{SUM} --- Sum of array elements
4ba96c02 8376@cindex @code{SUM} intrinsic
cd051390
DF
8377@cindex array manipulation
8378
8379Intrinsic implemented, documentation pending.
8380
8381@table @asis
8382@item @emph{Description}:
8383@item @emph{Standard}:
8384F95 and later
8385
8386@item @emph{Class}:
8387Transformational function
8388
8389@item @emph{Syntax}:
8390@item @emph{Arguments}:
8391@item @emph{Return value}:
8392@item @emph{Example}:
8393@item @emph{See also}:
8394@ref{PRODUCT}
8395@end table
8396
8397
8398
cd051390
DF
8399@node SYMLNK
8400@section @code{SYMLNK} --- Create a symbolic link
4ba96c02 8401@cindex @code{SYMLNK} intrinsic
cd051390
DF
8402@cindex file system operations
8403
cd051390
DF
8404@table @asis
8405@item @emph{Description}:
d3dfa1fe
BM
8406Makes a symbolic link from file @var{PATH1} to @var{PATH2}. A null
8407character (@code{CHAR(0)}) can be used to mark the end of the names in
8408@var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
8409names are ignored. If the @var{STATUS} argument is supplied, it
8410contains 0 on success or a nonzero error code upon return; see
8411@code{symlink(2)}. If the system does not supply @code{symlink(2)},
8412@code{ENOSYS} is returned.
8413
cd051390 8414@item @emph{Standard}:
cd051390
DF
8415GNU extension
8416
d3dfa1fe
BM
8417@item @emph{Class}:
8418Subroutine
8419
cd051390 8420@item @emph{Syntax}:
d3dfa1fe
BM
8421@code{CALL SYMLNK(PATH1, PATH2 [, STATUS])}
8422
3a3977a8 8423@item @emph{Arguments}:
d3dfa1fe
BM
8424@multitable @columnfractions .15 .80
8425@item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
8426@item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
8427@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
8428@end multitable
8429
cd051390 8430@item @emph{See also}:
d3dfa1fe 8431@ref{LINK}, @ref{UNLINK}
3a3977a8 8432
d3dfa1fe 8433@end table
3a3977a8
FXC
8434
8435
cd051390
DF
8436
8437@node SYSTEM
8438@section @code{SYSTEM} --- Execute a shell command
4ba96c02 8439@cindex @code{SYSTEM} intrinsic
a5d58aeb
FXC
8440
8441@table @asis
8442@item @emph{Description}:
d3dfa1fe
BM
8443Passes the command @var{COMMAND} to a shell (see @code{system(3)}). If
8444argument @var{STATUS} is present, it contains the value returned by
8445@code{system(3)}, which is presumably 0 if the shell command succeeded.
8446Note that which shell is used to invoke the command is system-dependent
8447and environment-dependent.
8448
cd051390
DF
8449@item @emph{Standard}:
8450GNU extension
a5d58aeb 8451
eaef357b 8452@item @emph{Class}:
cd051390 8453Subroutine
a5d58aeb
FXC
8454
8455@item @emph{Syntax}:
d3dfa1fe
BM
8456@code{CALL SYSTEM(COMMAND [, STATUS])}
8457
a5d58aeb 8458@item @emph{Arguments}:
d3dfa1fe
BM
8459@multitable @columnfractions .15 .80
8460@item @var{COMMAND} @tab Shall be of default @code{CHARACTER} type.
8461@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
8462@end multitable
8463
cd051390 8464@item @emph{See also}:
a5d58aeb
FXC
8465@end table
8466
8467
8468
cd051390
DF
8469@node SYSTEM_CLOCK
8470@section @code{SYSTEM_CLOCK} --- Time function
4ba96c02
BM
8471@cindex @code{SYSTEM_CLOCK} intrinsic
8472@cindex time, current
8473@cindex current time
cd051390
DF
8474
8475Intrinsic implemented, documentation pending.
3a3977a8
FXC
8476
8477@table @asis
8478@item @emph{Description}:
cd051390
DF
8479@item @emph{Standard}:
8480F95 and later
3a3977a8
FXC
8481
8482@item @emph{Class}:
cd051390 8483Subroutine
3a3977a8
FXC
8484
8485@item @emph{Syntax}:
3a3977a8 8486@item @emph{Arguments}:
3a3977a8 8487@item @emph{Return value}:
3a3977a8 8488@item @emph{Example}:
cd051390 8489@item @emph{See also}:
3a3977a8
FXC
8490@end table
8491
8492
8493
a5d58aeb
FXC
8494@node TAN
8495@section @code{TAN} --- Tangent function
4ba96c02
BM
8496@cindex @code{TAN} intrinsic
8497@cindex @code{DTAN} intrinsic
cd051390 8498@cindex trigonometric functions
a5d58aeb
FXC
8499
8500@table @asis
8501@item @emph{Description}:
8502@code{TAN(X)} computes the tangent of @var{X}.
8503
cd051390
DF
8504@item @emph{Standard}:
8505F77 and later
a5d58aeb 8506
eaef357b 8507@item @emph{Class}:
cd051390 8508Elemental function
a5d58aeb
FXC
8509
8510@item @emph{Syntax}:
d565bb3a 8511@code{RESULT = TAN(X)}
a5d58aeb
FXC
8512
8513@item @emph{Arguments}:
8514@multitable @columnfractions .15 .80
eaef357b 8515@item @var{X} @tab The type shall be @code{REAL(*)}.
a5d58aeb
FXC
8516@end multitable
8517
8518@item @emph{Return value}:
8519The return value is of type @code{REAL(*)}. The kind type parameter is
8520the same as @var{X}.
8521
8522@item @emph{Example}:
8523@smallexample
8524program test_tan
8525 real(8) :: x = 0.165_8
8526 x = tan(x)
8527end program test_tan
8528@end smallexample
8529
8530@item @emph{Specific names}:
cd051390
DF
8531@multitable @columnfractions .20 .20 .20 .40
8532@item Name @tab Argument @tab Return type @tab Standard
8533@item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
a5d58aeb 8534@end multitable
cd051390
DF
8535
8536@item @emph{See also}:
8537@ref{ATAN}
a5d58aeb
FXC
8538@end table
8539
8540
eaef357b 8541
f7cdcbf1
FXC
8542@node TANH
8543@section @code{TANH} --- Hyperbolic tangent function
4ba96c02
BM
8544@cindex @code{TANH} intrinsic
8545@cindex @code{DTANH} intrinsic
f7cdcbf1
FXC
8546@cindex hyperbolic tangent
8547
8548@table @asis
8549@item @emph{Description}:
8550@code{TANH(X)} computes the hyperbolic tangent of @var{X}.
8551
cd051390
DF
8552@item @emph{Standard}:
8553F77 and later
f7cdcbf1 8554
eaef357b 8555@item @emph{Class}:
cd051390 8556Elemental function
f7cdcbf1
FXC
8557
8558@item @emph{Syntax}:
8559@code{X = TANH(X)}
8560
8561@item @emph{Arguments}:
8562@multitable @columnfractions .15 .80
eaef357b 8563@item @var{X} @tab The type shall be @code{REAL(*)}.
f7cdcbf1
FXC
8564@end multitable
8565
8566@item @emph{Return value}:
8567The return value is of type @code{REAL(*)} and lies in the range
8568@math{ - 1 \leq tanh(x) \leq 1 }.
8569
8570@item @emph{Example}:
8571@smallexample
8572program test_tanh
8573 real(8) :: x = 2.1_8
8574 x = tanh(x)
8575end program test_tanh
8576@end smallexample
8577
8578@item @emph{Specific names}:
cd051390
DF
8579@multitable @columnfractions .20 .20 .20 .40
8580@item Name @tab Argument @tab Return type @tab Standard
8581@item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
f7cdcbf1 8582@end multitable
cd051390
DF
8583
8584@item @emph{See also}:
8585@ref{ATANH}
8586@end table
8587
8588
8589
8590@node TIME
8591@section @code{TIME} --- Time function
4ba96c02
BM
8592@cindex @code{TIME} intrinsic
8593@cindex time, current
8594@cindex current time
cd051390 8595
d3dfa1fe
BM
8596@table @asis
8597@item @emph{Description}:
8598Returns the current time encoded as an integer (in the manner of the
8599UNIX function @code{time(3)}). This value is suitable for passing to
8600@code{CTIME()}, @code{GMTIME()}, and @code{LTIME()}.
8601
8602This intrinsic is not fully portable, such as to systems with 32-bit
8603@code{INTEGER} types but supporting times wider than 32 bits. Therefore,
8604the values returned by this intrinsic might be, or become, negative, or
8605numerically less than previous values, during a single run of the
8606compiled program.
8607
8608See @ref{TIME8}, for information on a similar intrinsic that might be
8609portable to more GNU Fortran implementations, though to fewer Fortran
8610compilers.
8611
8612@item @emph{Standard}:
8613GNU extension
8614
8615@item @emph{Class}:
8616Non-elemental function
8617
8618@item @emph{Syntax}:
8619@code{RESULT = TIME()}
8620
8621@item @emph{Return value}:
8622The return value is a scalar of type @code{INTEGER(4)}.
8623
8624@item @emph{See also}:
8625@ref{CTIME}, @ref{GMTIME}, @ref{LTIME}, @ref{TIME8}
8626
8627@end table
8628
8629
8630
8631@node TIME8
8632@section @code{TIME8} --- Time function (64-bit)
8633@cindex @code{TIME8} intrinsic
8634@cindex time, current
8635@cindex current time
cd051390
DF
8636
8637@table @asis
8638@item @emph{Description}:
d3dfa1fe
BM
8639Returns the current time encoded as an integer (in the manner of the
8640UNIX function @code{time(3)}). This value is suitable for passing to
8641@code{CTIME()}, @code{GMTIME()}, and @code{LTIME()}.
8642
8643@emph{Warning:} this intrinsic does not increase the range of the timing
8644values over that returned by @code{time(3)}. On a system with a 32-bit
8645@code{time(3)}, @code{TIME8()} will return a 32-bit value, even though
8646it is converted to a 64-bit @code{INTEGER(8)} value. That means
8647overflows of the 32-bit value can still occur. Therefore, the values
8648returned by this intrinsic might be or become negative or numerically
8649less than previous values during a single run of the compiled program.
8650
cd051390
DF
8651@item @emph{Standard}:
8652GNU extension
8653
8654@item @emph{Class}:
8655Non-elemental function
8656
8657@item @emph{Syntax}:
d3dfa1fe
BM
8658@code{RESULT = TIME8()}
8659
cd051390 8660@item @emph{Return value}:
d3dfa1fe
BM
8661The return value is a scalar of type @code{INTEGER(8)}.
8662
cd051390 8663@item @emph{See also}:
d3dfa1fe
BM
8664@ref{CTIME}, @ref{GMTIME}, @ref{LTIME}, @ref{TIME}
8665
f7cdcbf1 8666@end table
6230d276
SK
8667
8668
8669
3a3977a8
FXC
8670@node TINY
8671@section @code{TINY} --- Smallest positive number of a real kind
4ba96c02 8672@cindex @code{TINY} intrinsic
3a3977a8
FXC
8673@cindex tiny
8674
8675@table @asis
8676@item @emph{Description}:
8677@code{TINY(X)} returns the smallest positive (non zero) number
8678in the model of the type of @code{X}.
8679
cd051390
DF
8680@item @emph{Standard}:
8681F95 and later
3a3977a8
FXC
8682
8683@item @emph{Class}:
cd051390 8684Elemental function
3a3977a8
FXC
8685
8686@item @emph{Syntax}:
d565bb3a 8687@code{RESULT = TINY(X)}
3a3977a8
FXC
8688
8689@item @emph{Arguments}:
8690@multitable @columnfractions .15 .80
8691@item @var{X} @tab shall be of type @code{REAL}.
8692@end multitable
8693
8694@item @emph{Return value}:
8695The return value is of the same type and kind as @var{X}
8696
8697@item @emph{Example}:
8698See @code{HUGE} for an example.
8699@end table
8700
8701
8702
cd051390
DF
8703@node TRANSFER
8704@section @code{TRANSFER} --- Transfer bit patterns
4ba96c02
BM
8705@cindex @code{TRANSFER} intrinsic
8706@cindex bit operations
cd051390
DF
8707
8708Intrinsic implemented, documentation pending.
8709
8710@table @asis
8711@item @emph{Description}:
8712@item @emph{Standard}:
8713F95 and later
8714
8715@item @emph{Class}:
8716Transformational function
8717
8718@item @emph{Syntax}:
8719@item @emph{Arguments}:
8720@item @emph{Return value}:
8721@item @emph{Example}:
8722@item @emph{See also}:
8723@end table
8724
8725
8726
cd051390
DF
8727@node TRANSPOSE
8728@section @code{TRANSPOSE} --- Transpose an array of rank two
4ba96c02 8729@cindex @code{TRANSPOSE} intrinsic
cd051390
DF
8730@cindex matrix manipulation
8731
8732Intrinsic implemented, documentation pending.
8733
8734@table @asis
8735@item @emph{Description}:
8736@item @emph{Standard}:
8737F95 and later
8738
8739@item @emph{Class}:
8740Transformational function
8741
8742@item @emph{Syntax}:
8743@item @emph{Arguments}:
8744@item @emph{Return value}:
8745@item @emph{Example}:
8746@item @emph{See also}:
8747@end table
8748
8749
8750
cd051390
DF
8751@node TRIM
8752@section @code{TRIM} --- Function to remove trailing blank characters of a string
4ba96c02 8753@cindex @code{TRIM} intrinsic
cd051390
DF
8754@cindex string manipulation
8755
8756Intrinsic implemented, documentation pending.
8757
8758@table @asis
8759@item @emph{Description}:
8760@item @emph{Standard}:
8761F95 and later
8762
8763@item @emph{Class}:
8764Transformational function
8765
8766@item @emph{Syntax}:
8767@item @emph{Arguments}:
8768@item @emph{Return value}:
8769@item @emph{Example}:
8770@item @emph{See also}:
8771@end table
8772
8773
8774
cd051390
DF
8775@node UBOUND
8776@section @code{UBOUND} --- Upper dimension bounds of an array
4ba96c02 8777@cindex @code{UBOUND} intrinsic
cd051390
DF
8778
8779@table @asis
8780@item @emph{Description}:
bc5b7642
BM
8781Returns the upper bounds of an array, or a single upper bound
8782along the @var{DIM} dimension.
cd051390
DF
8783@item @emph{Standard}:
8784F95 and later
8785
8786@item @emph{Class}:
8787Inquiry function
8788
8789@item @emph{Syntax}:
d565bb3a 8790@code{RESULT = UBOUND(ARRAY [, DIM])}
bc5b7642 8791
cd051390 8792@item @emph{Arguments}:
bc5b7642
BM
8793@multitable @columnfractions .15 .80
8794@item @var{ARRAY} @tab Shall be an array, of any type.
8795@item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER(*)}.
8796@end multitable
8797
cd051390 8798@item @emph{Return value}:
bc5b7642
BM
8799If @var{DIM} is absent, the result is an array of the upper bounds of
8800@var{ARRAY}. If @var{DIM} is present, the result is a scalar
8801corresponding to the upper bound of the array along that dimension. If
8802@var{ARRAY} is an expression rather than a whole array or array
8803structure component, or if it has a zero extent along the relevant
8804dimension, the upper bound is taken to be the number of elements along
8805the relevant dimension.
cd051390
DF
8806
8807@item @emph{See also}:
8808@ref{LBOUND}
8809@end table
8810
8811
8812
cd051390
DF
8813@node UMASK
8814@section @code{UMASK} --- Set the file creation mask
4ba96c02 8815@cindex @code{UMASK} intrinsic
cd051390
DF
8816@cindex file system operations
8817
cd051390
DF
8818@table @asis
8819@item @emph{Description}:
d565bb3a
BM
8820Sets the file creation mask to @var{MASK} and returns the old value in
8821argument @var{OLD} if it is supplied. See @code{umask(2)}.
8822
cd051390
DF
8823@item @emph{Standard}:
8824GNU extension
8825
8826@item @emph{Class}:
8827Subroutine
8828
8829@item @emph{Syntax}:
d565bb3a
BM
8830@code{CALL UMASK(MASK [, OLD])}
8831
cd051390 8832@item @emph{Arguments}:
d565bb3a
BM
8833@multitable @columnfractions .15 .80
8834@item @var{MASK} @tab Shall be a scalar of type @code{INTEGER(*)}.
8835@item @var{MASK} @tab (Optional) Shall be a scalar of type
8836 @code{INTEGER(*)}.
8837@end multitable
8838
cd051390
DF
8839@end table
8840
8841
8842
cd051390
DF
8843@node UNLINK
8844@section @code{UNLINK} --- Remove a file from the file system
4ba96c02 8845@cindex @code{UNLINK} intrinsic
cd051390
DF
8846@cindex file system operations
8847
cd051390
DF
8848@table @asis
8849@item @emph{Description}:
ea8dda63
BM
8850Unlinks the file @var{PATH}. A null character (@code{CHAR(0)}) can be
8851used to mark the end of the name in @var{PATH}; otherwise, trailing
8852blanks in the file name are ignored. If the @var{STATUS} argument is
8853supplied, it contains 0 on success or a nonzero error code upon return;
d3dfa1fe 8854see @code{unlink(2)}.
bc5b7642 8855
cd051390
DF
8856@item @emph{Standard}:
8857GNU extension
8858
8859@item @emph{Class}:
8860Subroutine
8861
8862@item @emph{Syntax}:
bc5b7642
BM
8863@code{CALL UNLINK(PATH [, STATUS])}
8864
cd051390 8865@item @emph{Arguments}:
bc5b7642
BM
8866@multitable @columnfractions .15 .80
8867@item @var{PATH} @tab Shall be of default @code{CHARACTER} type.
8868@item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
8869@end multitable
cd051390
DF
8870
8871@item @emph{See also}:
d3dfa1fe 8872@ref{LINK}, @ref{SYMLNK}
cd051390
DF
8873@end table
8874
8875
8876
cd051390
DF
8877@node UNPACK
8878@section @code{UNPACK} --- Unpack an array of rank one into an array
4ba96c02 8879@cindex @code{UNPACK} intrinsic
cd051390
DF
8880@cindex array manipulation
8881
8882Intrinsic implemented, documentation pending.
8883
8884@table @asis
8885@item @emph{Description}:
8886@item @emph{Standard}:
8887F95 and later
8888
8889@item @emph{Class}:
8890Transformational function
8891
8892@item @emph{Syntax}:
8893@item @emph{Arguments}:
8894@item @emph{Return value}:
8895@item @emph{Example}:
8896
8897@item @emph{See also}:
8898@ref{PACK}
8899@end table
8900
8901
8902
cd051390
DF
8903@node VERIFY
8904@section @code{VERIFY} --- Scan a string for the absence of a set of characters
4ba96c02 8905@cindex @code{VERIFY} intrinsic
cd051390
DF
8906@cindex string manipulation
8907
8908Intrinsic implemented, documentation pending.
8909
8910@table @asis
8911@item @emph{Description}:
8912@item @emph{Standard}:
8913F95 and later
8914
8915@item @emph{Class}:
8916Elemental function
8917
8918@item @emph{Syntax}:
8919@item @emph{Arguments}:
8920@item @emph{Return value}:
8921@item @emph{Example}:
8922@item @emph{Specific names}:
8923@item @emph{See also}:
8924@end table
8925
8926
d3dfa1fe 8927
cd051390 8928@node XOR
fe284266 8929@section @code{XOR} --- Bitwise logical exclusive OR
4ba96c02 8930@cindex @code{XOR} intrinsic
fe284266 8931@cindex bit operations
cd051390
DF
8932
8933@table @asis
8934@item @emph{Description}:
fe284266
DF
8935Bitwise logical exclusive or.
8936
8937This intrinsic routine is provided for backwards compatibility with
8938GNU Fortran 77. For integer arguments, programmers should consider
8939the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
8940
cd051390 8941@item @emph{Standard}:
fe284266 8942GNU extension
cd051390
DF
8943
8944@item @emph{Class}:
fe284266
DF
8945Non-elemental function
8946
cd051390 8947@item @emph{Syntax}:
fe284266
DF
8948@code{RESULT = XOR(X, Y)}
8949
cd051390 8950@item @emph{Arguments}:
fe284266
DF
8951@multitable @columnfractions .15 .80
8952@item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8953@item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8954@end multitable
8955
cd051390 8956@item @emph{Return value}:
fe284266
DF
8957The return type is either @code{INTEGER(*)} or @code{LOGICAL}
8958after cross-promotion of the arguments.
8959
cd051390 8960@item @emph{Example}:
fe284266
DF
8961@smallexample
8962PROGRAM test_xor
8963 LOGICAL :: T = .TRUE., F = .FALSE.
8964 INTEGER :: a, b
8965 DATA a / Z,'F' /, b / Z'3' /
8966
8967 WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
8968 WRITE (*,*) XOR(a, b)
8969END PROGRAM
8970@end smallexample
8971
cd051390 8972@item @emph{See also}:
fe284266 8973F95 elemental function: @ref{IEOR}
cd051390
DF
8974@end table
8975
8976
This page took 1.592295 seconds and 5 git commands to generate.