* intrinsic.texi: Minor cleanup, reflowing overlong
[official-gcc.git] / gcc / fortran / intrinsic.texi
blob077fa876360521c257ceee3526abcdb8e4ee81c4
1 @ignore
2 Copyright (C) 2005, 2006, 2007
3 Free Software Foundation, Inc.
4 This is part of the GNU Fortran manual.   
5 For copying conditions, see the file gfortran.texi.
7 Permission is granted to copy, distribute and/or modify this document
8 under the terms of the GNU Free Documentation License, Version 1.2 or
9 any later version published by the Free Software Foundation; with the
10 Invariant Sections being ``GNU General Public License'' and ``Funding
11 Free Software'', the Front-Cover texts being (a) (see below), and with
12 the Back-Cover Texts being (b) (see below).  A copy of the license is
13 included in the gfdl(7) man page.
16 Some basic guidelines for editing this document:
18   (1) The intrinsic procedures are to be listed in alphabetical order.
19   (2) The generic name is to be used.
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.
25 @end ignore
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
37 @node Intrinsic Procedures
38 @chapter Intrinsic Procedures
39 @cindex intrinsic procedures
41 This portion of the document is incomplete and undergoing massive expansion 
42 and editing.  All contributions and corrections are strongly encouraged. 
44 Implemented intrinsics are fully functional and available to the user to apply. 
45 Some intrinsics have documentation yet to be completed as indicated by 'documentation pending'.
47 @comment Missing intrinsics (double check with #19292)
48 @comment  - MClock
49 @comment  - Short
51 @menu
52 * Introduction:         Introduction to Intrinsics
53 * @code{ABORT}:         ABORT,     Abort the program     
54 * @code{ABS}:           ABS,       Absolute value     
55 * @code{ACCESS}:        ACCESS,    Checks file access modes
56 * @code{ACHAR}:         ACHAR,     Character in @acronym{ASCII} collating sequence
57 * @code{ACOS}:          ACOS,      Arccosine function
58 * @code{ACOSH}:         ACOSH,     Hyperbolic arccosine function
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
63 * @code{ALARM}:         ALARM,     Set an alarm clock
64 * @code{ALL}:           ALL,       Determine if all values are true
65 * @code{ALLOCATED}:     ALLOCATED, Status of allocatable entity
66 * @code{AND}:           AND,       Bitwise logical AND
67 * @code{ANINT}:         ANINT,     Nearest whole number
68 * @code{ANY}:           ANY,       Determine if any values are true
69 * @code{ASIN}:          ASIN,      Arcsine function
70 * @code{ASINH}:         ASINH,     Hyperbolic arcsine function
71 * @code{ASSOCIATED}:    ASSOCIATED, Status of a pointer or pointer/target pair
72 * @code{ATAN}:          ATAN,      Arctangent function
73 * @code{ATAN2}:         ATAN2,     Arctangent function
74 * @code{ATANH}:         ATANH,     Hyperbolic arctangent function
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
84 * @code{CHAR}:          CHAR,      Integer-to-character conversion function
85 * @code{CHDIR}:         CHDIR,     Change working directory
86 * @code{CHMOD}:         CHMOD,     Change access permissions of files
87 * @code{CMPLX}:         CMPLX,     Complex conversion function
88 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Get number of command line arguments
89 * @code{CONJG}:         CONJG,     Complex conjugate function
90 * @code{COS}:           COS,       Cosine function
91 * @code{COSH}:          COSH,      Hyperbolic cosine function
92 * @code{COUNT}:         COUNT,     Count occurrences of TRUE in an array
93 * @code{CPU_TIME}:      CPU_TIME,  CPU time subroutine
94 * @code{CSHIFT}:        CSHIFT,    Circular array shift function
95 * @code{CTIME}:         CTIME,     Subroutine (or function) to convert a time into a string
96 * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
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)
106 * @code{EOSHIFT}:       EOSHIFT,   End-off shift function
107 * @code{EPSILON}:       EPSILON,   Epsilon function
108 * @code{ERF}:           ERF,       Error function
109 * @code{ERFC}:          ERFC,      Complementary error function
110 * @code{ETIME}:         ETIME,     Execution time subroutine (or function)
111 * @code{EXIT}:          EXIT,      Exit the program with status.
112 * @code{EXP}:           EXP,       Exponential function
113 * @code{EXPONENT}:      EXPONENT,  Exponent function
114 * @code{FDATE}:         FDATE,     Subroutine (or function) to get the current time as a string
115 * @code{FGET}:          FGET,      Read a single character in stream mode from stdin
116 * @code{FGETC}:         FGETC,     Read a single character in stream mode
117 * @code{FLOAT}:         FLOAT,     Convert integer to default real
118 * @code{FLOOR}:         FLOOR,     Integer floor function
119 * @code{FLUSH}:         FLUSH,     Flush I/O unit(s)
120 * @code{FNUM}:          FNUM,      File number function
121 * @code{FPUT}:          FPUT,      Write a single character in stream mode to stdout
122 * @code{FPUTC}:         FPUTC,     Write a single character in stream mode
123 * @code{FRACTION}:      FRACTION,  Fractional part of the model representation
124 * @code{FREE}:          FREE,      Memory de-allocation subroutine
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
129 * @code{GET_COMMAND}:   GET_COMMAND, Get the entire command line
130 * @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Get command line arguments
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
134 * @code{GETGID}:        GETGID,    Group ID function
135 * @code{GETLOG}:        GETLOG,    Get login name
136 * @code{GETPID}:        GETPID,    Process ID function
137 * @code{GETUID}:        GETUID,    User ID function
138 * @code{GMTIME}:        GMTIME,    Convert time to GMT info
139 * @code{HOSTNM}:        HOSTNM,    Get system host name
140 * @code{HUGE}:          HUGE,      Largest number of a kind
141 * @code{IACHAR}:        IACHAR,    Code in @acronym{ASCII} collating sequence
142 * @code{IAND}:          IAND,      Bitwise logical and
143 * @code{IARGC}:         IARGC,     Get the number of command line arguments
144 * @code{IBCLR}:         IBCLR,     Clear bit
145 * @code{IBITS}:         IBITS,     Bit extraction
146 * @code{IBSET}:         IBSET,     Set bit
147 * @code{ICHAR}:         ICHAR,     Character-to-integer conversion function
148 * @code{IDATE}:         IDATE,     Current local time (day/month/year)
149 * @code{IEOR}:          IEOR,      Bitwise logical exclusive or
150 * @code{IERRNO}:        IERRNO,    Function to get the last system error number
151 * @code{INDEX}:         INDEX,     Position of a substring within a string
152 * @code{INT}:           INT,       Convert to integer type
153 * @code{IOR}:           IOR,       Bitwise logical or
154 * @code{IRAND}:         IRAND,     Integer pseudo-random number
155 * @code{ISHFT}:         ISHFT,     Shift bits
156 * @code{ISHFTC}:        ISHFTC,    Shift bits circularly
157 * @code{ITIME}:         ITIME,     Current local time (hour/minutes/seconds)
158 * @code{KILL}:          KILL,      Send a signal to a process
159 * @code{KIND}:          KIND,      Kind of an entity
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
169 * @code{LOC}:           LOC,       Returns the address of a variable
170 * @code{LOG}:           LOG,       Logarithm function
171 * @code{LOG10}:         LOG10,     Base 10 logarithm function 
172 * @code{LOGICAL}:       LOGICAL,   Convert to logical type
173 * @code{LSHIFT}:        LSHIFT,    Left shift bits
174 * @code{LSTAT}:         LSTAT,     Get file status
175 * @code{LTIME}:         LTIME,     Convert time to local time info
176 * @code{MALLOC}:        MALLOC,    Dynamic memory allocation function
177 * @code{MATMUL}:        MATMUL,    matrix multiplication
178 * @code{MAX}:           MAX,       Maximum value of an argument list
179 * @code{MAXEXPONENT}:   MAXEXPONENT, Maximum exponent of a real kind
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
184 * @code{MINEXPONENT}:   MINEXPONENT, Minimum exponent of a real kind
185 * @code{MINLOC}:        MINLOC,    Location of the minimum value within an array
186 * @code{MINVAL}:        MINVAL,    Minimum value of an array
187 * @code{MOD}:           MOD,       Remainder function
188 * @code{MODULO}:        MODULO,    Modulo function
189 * @code{MOVE_ALLOC}:    MOVE_ALLOC, Move allocation from one object to another
190 * @code{MVBITS}:        MVBITS,    Move bits from one integer to another
191 * @code{NEAREST}:       NEAREST,   Nearest representable number
192 * @code{NEW_LINE}:      NEW_LINE,  New line character
193 * @code{NINT}:          NINT,      Nearest whole number
194 * @code{NOT}:           NOT,       Logical negation
195 * @code{NULL}:          NULL,      Function that returns an disassociated pointer
196 * @code{OR}:            OR,        Bitwise logical OR
197 * @code{PACK}:          PACK,      Pack an array into an array of rank one
198 * @code{PERROR}:        PERROR,    Print system error message
199 * @code{PRECISION}:     PRECISION, Decimal precision of a real kind
200 * @code{PRESENT}:       PRESENT,   Determine whether an optional argument is specified
201 * @code{PRODUCT}:       PRODUCT,   Product of array elements
202 * @code{RADIX}:         RADIX,     Base of a data model
203 * @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number
204 * @code{RANDOM_SEED}:   RANDOM_SEED, Initialize a pseudo-random number sequence
205 * @code{RAND}:          RAND,      Real pseudo-random number
206 * @code{RANGE}:         RANGE,     Decimal exponent range of a real kind
207 * @code{RAN}:           RAN,       Real pseudo-random number
208 * @code{REAL}:          REAL,      Convert to real type 
209 * @code{RENAME}:        RENAME,    Rename a file
210 * @code{REPEAT}:        REPEAT,    Repeated string concatenation
211 * @code{RESHAPE}:       RESHAPE,   Function to reshape an array
212 * @code{RRSPACING}:     RRSPACING, Reciprocal of the relative spacing
213 * @code{RSHIFT}:        RSHIFT,    Right shift bits
214 * @code{SCALE}:         SCALE,     Scale a real value
215 * @code{SCAN}:          SCAN,      Scan a string for the presence of a set of characters
216 * @code{SECNDS}:        SECNDS,    Time function
217 @comment * @code{SECOND}:        SECOND,    (?)
218 @comment * @code{SECONDS}:       SECONDS,   (?)
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
222 * @code{SHAPE}:         SHAPE,     Determine the shape of an array
223 * @code{SIGN}:          SIGN,      Sign copying function
224 * @code{SIGNAL}:        SIGNAL,    Signal handling subroutine (or function)
225 * @code{SIN}:           SIN,       Sine function
226 * @code{SINH}:          SINH,      Hyperbolic sine function
227 * @code{SIZE}:          SIZE,      Function to determine the size of an array
228 * @code{SNGL}:          SNGL,      Convert double precision real to default real
229 * @code{SPACING}:       SPACING,   Smallest distance between two numbers of a given type
230 * @code{SPREAD}:        SPREAD,    Add a dimension to an array 
231 * @code{SQRT}:          SQRT,      Square-root function
232 * @code{SRAND}:         SRAND,     Reinitialize the random number generator
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
238 * @code{TAN}:           TAN,       Tangent function
239 * @code{TANH}:          TANH,      Hyperbolic tangent function
240 * @code{TIME}:          TIME,      Time function
241 * @code{TINY}:          TINY,      Smallest positive number of a real kind
242 * @code{TRANSFER}:      TRANSFER,  Transfer bit patterns
243 * @code{TRANSPOSE}:     TRANSPOSE, Transpose an array of rank two
244 * @code{TRIM}:          TRIM,      Function to remove trailing blank characters of a string
245 * @code{UBOUND}:        UBOUND,    Upper dimension bounds of an array
246 * @code{UMASK}:         UMASK,     Set the file creation mask
247 * @code{UNLINK}:        UNLINK,    Remove a file from the file system
248 * @code{UNMASK}:        UNMASK,    (?)
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
251 * @code{XOR}:           XOR,       Bitwise logical exclusive or
252 @end menu
254 @node Introduction to Intrinsics
255 @section Introduction to intrinsic procedures
257 The intrinsic procedures provided by GNU Fortran include all of the
258 intrinsic procedures required by the Fortran 95 standard, a set of
259 intrinsic procedures for backwards compatibility with G77, and a small
260 selection of intrinsic procedures from the Fortran 2003 standard.  Any
261 conflict between a description here and a description in either the
262 Fortran 95 standard or the Fortran 2003 standard is unintentional, and
263 the standard(s) should be considered authoritative.
265 The enumeration of the @code{KIND} type parameter is processor defined in
266 the Fortran 95 standard.  GNU Fortran defines the default integer type and
267 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
268 respectively.  The standard mandates that both data types shall have
269 another kind, which have more precision.  On typical target architectures
270 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
271 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
272 In the description of generic intrinsic procedures, the kind type parameter
273 will be specified by @code{KIND=*}, and in the description of specific
274 names for an intrinsic procedure the kind type parameter will be explicitly
275 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}).  Finally, for
276 brevity the optional @code{KIND=} syntax will be omitted.
278 Many of the intrinsic procedures take one or more optional arguments.
279 This document follows the convention used in the Fortran 95 standard,
280 and denotes such arguments by square brackets.
282 GNU Fortran offers the @option{-std=f95} and @option{-std=gnu} options,
283 which can be used to restrict the set of intrinsic procedures to a 
284 given standard.  By default, @command{gfortran} sets the @option{-std=gnu}
285 option, and so all intrinsic procedures described here are accepted.  There
286 is one caveat.  For a select group of intrinsic procedures, @command{g77}
287 implemented both a function and a subroutine.  Both classes 
288 have been implemented in @command{gfortran} for backwards compatibility
289 with @command{g77}.  It is noted here that these functions and subroutines
290 cannot be intermixed in a given subprogram.  In the descriptions that follow,
291 the applicable standard for each intrinsic procedure is noted.
295 @node ABORT
296 @section @code{ABORT} --- Abort the program  
297 @cindex @code{ABORT} intrinsic
298 @cindex abort
300 @table @asis
301 @item @emph{Description}:
302 @code{ABORT} causes immediate termination of the program.  On operating
303 systems that support a core dump, @code{ABORT} will produce a core dump,
304 which is suitable for debugging purposes.
306 @item @emph{Standard}:
307 GNU extension
309 @item @emph{Class}:
310 non-elemental subroutine
312 @item @emph{Syntax}:
313 @code{CALL ABORT}
315 @item @emph{Return value}:
316 Does not return.
318 @item @emph{Example}:
319 @smallexample
320 program test_abort
321   integer :: i = 1, j = 2
322   if (i /= j) call abort
323 end program test_abort
324 @end smallexample
326 @item @emph{See also}:
327 @ref{EXIT}, @ref{KILL}
329 @end table
332 @node ABS
333 @section @code{ABS} --- Absolute value  
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
340 @cindex absolute value
342 @table @asis
343 @item @emph{Description}:
344 @code{ABS(X)} computes the absolute value of @code{X}.
346 @item @emph{Standard}:
347 F77 and later, has overloads that are GNU extensions
349 @item @emph{Class}:
350 Elemental function
352 @item @emph{Syntax}:
353 @code{X = ABS(X)}
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
361 @item @emph{Return value}:
362 The return value is of the same type and
363 kind as the argument except the return value is @code{REAL(*)} for a
364 @code{COMPLEX(*)} argument.
366 @item @emph{Example}:
367 @smallexample
368 program test_abs
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)
375 end program test_abs
376 @end smallexample
378 @item @emph{Specific names}:
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
386 @end multitable
387 @end table
390 @node ACCESS
391 @section @code{ACCESS} --- Checks file access modes
392 @cindex @code{ACCESS} 
393 @cindex file system operations
395 @table @asis
396 @item @emph{Description}:
397 @code{ACCESS(NAME, MODE)} checks whether the file @var{NAME} 
398 exists, is readable, writable or executable. Except for the
399 executable check, @code{ACCESS} can be replaced by
400 Fortran 95's @code{INQUIRE}.
402 @item @emph{Standard}:
403 GNU extension
405 @item @emph{Class}:
406 Inquiry function
408 @item @emph{Syntax}:
409 @code{I = ACCESS(NAME, MODE)}
411 @item @emph{Arguments}:
412 @multitable @columnfractions .15 .80
413 @item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
414 Tailing blank are ignored unless the character @code{achar(0)} is
415 present, then all characters up to and excluding @code{achar(0)} are
416 used as file name.
417 @item @var{MODE} @tab Scalar @code{CHARACTER} with the file access mode,
418 may be any concatenation of @code{"r"} (readable), @code{"w"} (writable)
419 and @code{"x"} (executable), or @code{" "} to check for existence.
420 @end multitable
422 @item @emph{Return value}:
423 Returns a scalar @code{INTEGER}, which is @code{0} if the file is
424 accessable in the given mode; otherwise or if an invalid argument
425 has been given for @code{MODE} the value @code{1} is returned.
427 @item @emph{Example}:
428 @smallexample
429 program 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'
439 end program access_test
440 @end smallexample
441 @item @emph{Specific names}:
442 @item @emph{See also}:
444 @end table
447 @node ACHAR
448 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence 
449 @cindex @code{ACHAR} intrinsic
450 @cindex @acronym{ASCII} collating sequence
452 @table @asis
453 @item @emph{Description}:
454 @code{ACHAR(I)} returns the character located at position @code{I}
455 in the @acronym{ASCII} collating sequence.
457 @item @emph{Standard}:
458 F77 and later
460 @item @emph{Class}:
461 Elemental function
463 @item @emph{Syntax}:
464 @code{C = ACHAR(I)}
466 @item @emph{Arguments}:
467 @multitable @columnfractions .15 .80
468 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
469 @end multitable
471 @item @emph{Return value}:
472 The return value is of type @code{CHARACTER} with a length of one.  The
473 kind type parameter is the same as  @code{KIND('A')}.
475 @item @emph{Example}:
476 @smallexample
477 program test_achar
478   character c
479   c = achar(32)
480 end program test_achar
481 @end smallexample
482 @end table
486 @node ACOS
487 @section @code{ACOS} --- Arccosine function 
488 @cindex @code{ACOS} intrinsic
489 @cindex @code{DACOS} intrinsic
490 @cindex trigonometric functions (inverse)
492 @table @asis
493 @item @emph{Description}:
494 @code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
496 @item @emph{Standard}:
497 F77 and later
499 @item @emph{Class}:
500 Elemental function
502 @item @emph{Syntax}:
503 @code{X = ACOS(X)}
505 @item @emph{Arguments}:
506 @multitable @columnfractions .15 .80
507 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
508 less than one.
509 @end multitable
511 @item @emph{Return value}:
512 The return value is of type @code{REAL(*)} and it lies in the
513 range @math{ 0 \leq \acos(x) \leq \pi}. The kind type parameter 
514 is the same as @var{X}.
516 @item @emph{Example}:
517 @smallexample
518 program test_acos
519   real(8) :: x = 0.866_8
520   x = acos(x)
521 end program test_acos
522 @end smallexample
524 @item @emph{Specific names}:
525 @multitable @columnfractions .20 .20 .20 .40
526 @item Name            @tab Argument          @tab Return type       @tab Standard
527 @item @code{DACOS(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
528 @end multitable
530 @item @emph{See also}:
531 Inverse function: @ref{COS}
533 @end table
536 @node ACOSH
537 @section @code{ACOSH} --- Hyperbolic arccosine function
538 @cindex @code{ACOSH} intrinsic
539 @cindex hyperbolic arccosine
540 @cindex hyperbolic cosine (inverse)
542 @table @asis
543 @item @emph{Description}:
544 @code{ACOSH(X)} computes the area hyperbolic cosine of @var{X} (inverse of @code{COSH(X)}).
546 @item @emph{Standard}:
547 GNU extension
549 @item @emph{Class}:
550 Elemental function
552 @item @emph{Syntax}:
553 @code{X = ACOSH(X)}
555 @item @emph{Arguments}:
556 @multitable @columnfractions .15 .80
557 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
558 greater or equal to one.
559 @end multitable
561 @item @emph{Return value}:
562 The return value is of type @code{REAL(*)} and it lies in the
563 range @math{0 \leq \acosh (x) \leq \infty}.
565 @item @emph{Example}:
566 @smallexample
567 PROGRAM test_acosh
568   REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
569   WRITE (*,*) ACOSH(x)
570 END PROGRAM
571 @end smallexample
573 @item @emph{See also}:
574 Inverse function: @ref{COSH}
575 @end table
579 @node ADJUSTL
580 @section @code{ADJUSTL} --- Left adjust a string 
581 @cindex @code{ADJUSTL} intrinsic
582 @cindex adjust string
584 @table @asis
585 @item @emph{Description}:
586 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
587 Spaces are inserted at the end of the string as needed.
589 @item @emph{Standard}:
590 F95 and later
592 @item @emph{Class}:
593 Elemental function
595 @item @emph{Syntax}:
596 @code{STR = ADJUSTL(STR)}
598 @item @emph{Arguments}:
599 @multitable @columnfractions .15 .80
600 @item @var{STR} @tab The type shall be @code{CHARACTER}.
601 @end multitable
603 @item @emph{Return value}:
604 The return value is of type @code{CHARACTER} where leading spaces 
605 are removed and the same number of spaces are inserted on the end
606 of @var{STR}.
608 @item @emph{Example}:
609 @smallexample
610 program test_adjustl
611   character(len=20) :: str = '   gfortran'
612   str = adjustl(str)
613   print *, str
614 end program test_adjustl
615 @end smallexample
616 @end table
620 @node ADJUSTR
621 @section @code{ADJUSTR} --- Right adjust a string 
622 @cindex @code{ADJUSTR} intrinsic
623 @cindex adjust string
625 @table @asis
626 @item @emph{Description}:
627 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
628 Spaces are inserted at the start of the string as needed.
630 @item @emph{Standard}:
631 F95 and later
633 @item @emph{Class}:
634 Elemental function
636 @item @emph{Syntax}:
637 @code{STR = ADJUSTR(STR)}
639 @item @emph{Arguments}:
640 @multitable @columnfractions .15 .80
641 @item @var{STR} @tab The type shall be @code{CHARACTER}.
642 @end multitable
644 @item @emph{Return value}:
645 The return value is of type @code{CHARACTER} where trailing spaces 
646 are removed and the same number of spaces are inserted at the start
647 of @var{STR}.
649 @item @emph{Example}:
650 @smallexample
651 program test_adjustr
652   character(len=20) :: str = 'gfortran'
653   str = adjustr(str)
654   print *, str
655 end program test_adjustr
656 @end smallexample
657 @end table
661 @node AIMAG
662 @section @code{AIMAG} --- Imaginary part of complex number  
663 @cindex @code{AIMAG} intrinsic
664 @cindex @code{DIMAG} intrinsic
665 @cindex @code{IMAG} intrinsic
666 @cindex @code{IMAGPART} intrinsic
667 @cindex imaginary part of a complex number
669 @table @asis
670 @item @emph{Description}:
671 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
672 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
673 for compatibility with @command{g77}, and their use in new code is 
674 strongly discouraged.
676 @item @emph{Standard}:
677 F77 and later, has overloads that are GNU extensions
679 @item @emph{Class}:
680 Elemental function
682 @item @emph{Syntax}:
683 @code{X = AIMAG(Z)}
685 @item @emph{Arguments}:
686 @multitable @columnfractions .15 .80
687 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
688 @end multitable
690 @item @emph{Return value}:
691 The return value is of type real with the
692 kind type parameter of the argument.
694 @item @emph{Example}:
695 @smallexample
696 program test_aimag
697   complex(4) z4
698   complex(8) z8
699   z4 = cmplx(1.e0_4, 0.e0_4)
700   z8 = cmplx(0.e0_8, 1.e0_8)
701   print *, aimag(z4), dimag(z8)
702 end program test_aimag
703 @end smallexample
705 @item @emph{Specific names}:
706 @multitable @columnfractions .20 .20 .20 .40
707 @item Name            @tab Argument            @tab Return type       @tab Standard
708 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)}    @tab GNU extension
709 @item @code{IMAG(Z)}  @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)}    @tab GNU extension
710 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
711 @end multitable
712 @end table
716 @node AINT
717 @section @code{AINT} --- Truncate to a whole number
718 @cindex @code{AINT} intrinsic
719 @cindex @code{DINT} intrinsic
720 @cindex whole number
722 @table @asis
723 @item @emph{Description}:
724 @code{AINT(X [, KIND])} truncates its argument to a whole number.
726 @item @emph{Standard}:
727 F77 and later
729 @item @emph{Class}:
730 Elemental function
732 @item @emph{Syntax}:
733 @code{X = AINT(X [, KIND])} 
735 @item @emph{Arguments}:
736 @multitable @columnfractions .15 .80
737 @item @var{X}    @tab The type of the argument shall be @code{REAL(*)}.
738 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
739 initialization expression.
740 @end multitable
742 @item @emph{Return value}:
743 The return value is of type real with the kind type parameter of the
744 argument if the optional @var{KIND} is absent; otherwise, the kind
745 type parameter will be given by @var{KIND}.  If the magnitude of 
746 @var{X} is less than one, then @code{AINT(X)} returns zero.  If the
747 magnitude is equal to or greater than one, then it returns the largest
748 whole number that does not exceed its magnitude.  The sign is the same
749 as the sign of @var{X}. 
751 @item @emph{Example}:
752 @smallexample
753 program test_aint
754   real(4) x4
755   real(8) x8
756   x4 = 1.234E0_4
757   x8 = 4.321_8
758   print *, aint(x4), dint(x8)
759   x8 = aint(x4,8)
760 end program test_aint
761 @end smallexample
763 @item @emph{Specific names}:
764 @multitable @columnfractions .20 .20 .20 .40
765 @item Name           @tab Argument         @tab Return type      @tab Standard
766 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)}   @tab F77 and later
767 @end multitable
768 @end table
772 @node ALARM
773 @section @code{ALARM} --- Execute a routine after a given delay
774 @cindex @code{ALARM} intrinsic
776 @table @asis
777 @item @emph{Description}:
778 @code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
779 to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
780 set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
781 supplied, it will be returned with the number of seconds remaining until
782 any previously scheduled alarm was due to be delivered, or zero if there
783 was no previously scheduled alarm.
785 @item @emph{Standard}:
786 GNU extension
788 @item @emph{Class}:
789 Subroutine
791 @item @emph{Syntax}:
792 @code{CALL ALARM(SECONDS, HANDLER [, STATUS])}
794 @item @emph{Arguments}:
795 @multitable @columnfractions .15 .80
796 @item @var{SECONDS} @tab The type of the argument shall be a scalar
797 @code{INTEGER}. It is @code{INTENT(IN)}.
798 @item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
799 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
800 @code{INTEGER}. It is @code{INTENT(IN)}.
801 @item @var{STATUS}  @tab (Optional) @var{STATUS} shall be a scalar
802 @code{INTEGER} variable. It is @code{INTENT(OUT)}.
803 @end multitable
805 @item @emph{Example}:
806 @smallexample
807 program test_alarm
808   external handler_print
809   integer i
810   call alarm (3, handler_print, i)
811   print *, i
812   call sleep(10)
813 end program test_alarm
814 @end smallexample
815 This will cause the external routine @var{handler_print} to be called
816 after 3 seconds.
817 @end table
821 @node ALL
822 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true 
823 @cindex @code{ALL} intrinsic
824 @cindex true values
826 @table @asis
827 @item @emph{Description}:
828 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
829 in the array along dimension @var{DIM}.
831 @item @emph{Standard}:
832 F95 and later
834 @item @emph{Class}:
835 transformational function
837 @item @emph{Syntax}:
838 @code{L = ALL(MASK [, DIM])}
840 @item @emph{Arguments}:
841 @multitable @columnfractions .15 .80
842 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
843 it shall not be scalar.
844 @item @var{DIM}  @tab (Optional) @var{DIM} shall be a scalar integer
845 with a value that lies between one and the rank of @var{MASK}.
846 @end multitable
848 @item @emph{Return value}:
849 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
850 the kind type parameter is the same as the kind type parameter of
851 @var{MASK}.  If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
852 an array with the rank of @var{MASK} minus 1.  The shape is determined from
853 the shape of @var{MASK} where the @var{DIM} dimension is elided. 
855 @table @asis
856 @item (A)
857 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
858 It also is true if @var{MASK} has zero size; otherwise, it is false.
859 @item (B)
860 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
861 to @code{ALL(MASK)}.  If the rank is greater than one, then @code{ALL(MASK,DIM)}
862 is determined by applying @code{ALL} to the array sections.
863 @end table
865 @item @emph{Example}:
866 @smallexample
867 program test_all
868   logical l
869   l = all((/.true., .true., .true./))
870   print *, l
871   call section
872   contains
873     subroutine section
874       integer a(2,3), b(2,3)
875       a = 1
876       b = 1
877       b(2,2) = 2
878       print *, all(a .eq. b, 1)
879       print *, all(a .eq. b, 2)
880     end subroutine section
881 end program test_all
882 @end smallexample
883 @end table
887 @node ALLOCATED
888 @section @code{ALLOCATED} --- Status of an allocatable entity
889 @cindex @code{ALLOCATED} intrinsic
890 @cindex allocation status
892 @table @asis
893 @item @emph{Description}:
894 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
896 @item @emph{Standard}:
897 F95 and later
899 @item @emph{Class}:
900 Inquiry function
902 @item @emph{Syntax}:
903 @code{L = ALLOCATED(X)}
905 @item @emph{Arguments}:
906 @multitable @columnfractions .15 .80
907 @item @var{X}    @tab The argument shall be an @code{ALLOCATABLE} array.
908 @end multitable
910 @item @emph{Return value}:
911 The return value is a scalar @code{LOGICAL} with the default logical
912 kind type parameter.  If @var{X} is allocated, @code{ALLOCATED(X)}
913 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.} 
915 @item @emph{Example}:
916 @smallexample
917 program test_allocated
918   integer :: i = 4
919   real(4), allocatable :: x(:)
920   if (allocated(x) .eqv. .false.) allocate(x(i))
921 end program test_allocated
922 @end smallexample
923 @end table
926 @node AND
927 @section @code{AND} --- Bitwise logical AND
928 @cindex @code{AND} intrinsic
929 @cindex bit operations
931 @table @asis
932 @item @emph{Description}:
933 Bitwise logical @code{AND}.
935 This intrinsic routine is provided for backwards compatibility with 
936 GNU Fortran 77.  For integer arguments, programmers should consider
937 the use of the @ref{IAND} intrinsic defined by the Fortran standard.
939 @item @emph{Standard}:
940 GNU extension
942 @item @emph{Class}:
943 Non-elemental function
945 @item @emph{Syntax}:
946 @code{RESULT = AND(X, Y)}
948 @item @emph{Arguments}:
949 @multitable @columnfractions .15 .80
950 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
951 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
952 @end multitable
954 @item @emph{Return value}:
955 The return type is either @code{INTEGER(*)} or @code{LOGICAL} after
956 cross-promotion of the arguments. 
958 @item @emph{Example}:
959 @smallexample
960 PROGRAM test_and
961   LOGICAL :: T = .TRUE., F = ..FALSE.
962   INTEGER :: a, b
963   DATA a / Z'F' /, b / Z'3' /
965   WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
966   WRITE (*,*) AND(a, b)
967 END PROGRAM
968 @end smallexample
970 @item @emph{See also}:
971 F95 elemental function: @ref{IAND}
972 @end table
976 @node ANINT
977 @section @code{ANINT} --- Nearest whole number
978 @cindex @code{ANINT} intrinsic
979 @cindex @code{DNINT} intrinsic
980 @cindex whole number
982 @table @asis
983 @item @emph{Description}:
984 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
986 @item @emph{Standard}:
987 F77 and later
989 @item @emph{Class}:
990 Elemental function
992 @item @emph{Syntax}:
993 @code{X = ANINT(X)}
994 @code{X = ANINT(X, KIND)}
996 @item @emph{Arguments}:
997 @multitable @columnfractions .15 .80
998 @item @var{X}    @tab The type of the argument shall be @code{REAL(*)}.
999 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
1000 initialization expression.
1001 @end multitable
1003 @item @emph{Return value}:
1004 The return value is of type real with the kind type parameter of the
1005 argument if the optional @var{KIND} is absent; otherwise, the kind
1006 type parameter will be given by @var{KIND}.  If @var{X} is greater than
1007 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}.  If @var{X} is
1008 less than or equal to zero, then it returns @code{AINT(X-0.5)}.
1010 @item @emph{Example}:
1011 @smallexample
1012 program test_anint
1013   real(4) x4
1014   real(8) x8
1015   x4 = 1.234E0_4
1016   x8 = 4.321_8
1017   print *, anint(x4), dnint(x8)
1018   x8 = anint(x4,8)
1019 end program test_anint
1020 @end smallexample
1022 @item @emph{Specific names}:
1023 @multitable @columnfractions .20 .20 .20 .40
1024 @item Name            @tab Argument         @tab Return type      @tab Standard
1025 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)}   @tab F77 and later
1026 @end multitable
1027 @end table
1031 @node ANY
1032 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true 
1033 @cindex @code{ANY} intrinsic
1034 @cindex true values
1036 @table @asis
1037 @item @emph{Description}:
1038 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
1039 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
1041 @item @emph{Standard}:
1042 F95 and later
1044 @item @emph{Class}:
1045 transformational function
1047 @item @emph{Syntax}:
1048 @code{L = ANY(MASK)} 
1049 @code{L = ANY(MASK, DIM)}
1051 @item @emph{Arguments}:
1052 @multitable @columnfractions .15 .80
1053 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
1054 it shall not be scalar.
1055 @item @var{DIM}  @tab (Optional) @var{DIM} shall be a scalar integer
1056 with a value that lies between one and the rank of @var{MASK}.
1057 @end multitable
1059 @item @emph{Return value}:
1060 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
1061 the kind type parameter is the same as the kind type parameter of
1062 @var{MASK}.  If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
1063 an array with the rank of @var{MASK} minus 1.  The shape is determined from
1064 the shape of @var{MASK} where the @var{DIM} dimension is elided. 
1066 @table @asis
1067 @item (A)
1068 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
1069 otherwise, it is false.  It also is false if @var{MASK} has zero size.
1070 @item (B)
1071 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
1072 to @code{ANY(MASK)}.  If the rank is greater than one, then @code{ANY(MASK,DIM)}
1073 is determined by applying @code{ANY} to the array sections.
1074 @end table
1076 @item @emph{Example}:
1077 @smallexample
1078 program test_any
1079   logical l
1080   l = any((/.true., .true., .true./))
1081   print *, l
1082   call section
1083   contains
1084     subroutine section
1085       integer a(2,3), b(2,3)
1086       a = 1
1087       b = 1
1088       b(2,2) = 2
1089       print *, any(a .eq. b, 1)
1090       print *, any(a .eq. b, 2)
1091     end subroutine section
1092 end program test_any
1093 @end smallexample
1094 @end table
1098 @node ASIN
1099 @section @code{ASIN} --- Arcsine function 
1100 @cindex @code{ASIN} intrinsic
1101 @cindex @code{DASIN} intrinsic
1102 @cindex trigonometric functions (inverse)
1104 @table @asis
1105 @item @emph{Description}:
1106 @code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
1108 @item @emph{Standard}:
1109 F77 and later
1111 @item @emph{Class}:
1112 Elemental function
1114 @item @emph{Syntax}:
1115 @code{X = ASIN(X)}
1117 @item @emph{Arguments}:
1118 @multitable @columnfractions .15 .80
1119 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
1120 less than one.
1121 @end multitable
1123 @item @emph{Return value}:
1124 The return value is of type @code{REAL(*)} and it lies in the
1125 range @math{-\pi / 2 \leq \asin (x) \leq \pi / 2}.  The kind type
1126 parameter is the same as @var{X}.
1128 @item @emph{Example}:
1129 @smallexample
1130 program test_asin
1131   real(8) :: x = 0.866_8
1132   x = asin(x)
1133 end program test_asin
1134 @end smallexample
1136 @item @emph{Specific names}:
1137 @multitable @columnfractions .20 .20 .20 .40
1138 @item Name            @tab Argument          @tab Return type       @tab Standard
1139 @item @code{DASIN(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
1140 @end multitable
1142 @item @emph{See also}:
1143 Inverse function: @ref{SIN}
1145 @end table
1148 @node ASINH
1149 @section @code{ASINH} --- Hyperbolic arcsine function
1150 @cindex @code{ASINH} intrinsic
1151 @cindex hyperbolic arcsine
1152 @cindex hyperbolic sine (inverse)
1154 @table @asis
1155 @item @emph{Description}:
1156 @code{ASINH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{SINH(X)}).
1158 @item @emph{Standard}:
1159 GNU extension
1161 @item @emph{Class}:
1162 Elemental function
1164 @item @emph{Syntax}:
1165 @code{X = ASINH(X)}
1167 @item @emph{Arguments}:
1168 @multitable @columnfractions .15 .80
1169 @item @var{X} @tab The type shall be @code{REAL(*)}, with @var{X} a real number.
1170 @end multitable
1172 @item @emph{Return value}:
1173 The return value is of type @code{REAL(*)} and it lies in the
1174 range @math{-\infty \leq \asinh (x) \leq \infty}.
1176 @item @emph{Example}:
1177 @smallexample
1178 PROGRAM test_asinh
1179   REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1180   WRITE (*,*) ASINH(x)
1181 END PROGRAM
1182 @end smallexample
1184 @item @emph{See also}:
1185 Inverse function: @ref{SINH}
1186 @end table
1190 @node ASSOCIATED
1191 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair 
1192 @cindex @code{ASSOCIATED} intrinsic
1193 @cindex pointer status
1195 @table @asis
1196 @item @emph{Description}:
1197 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1198 or if @var{PTR} is associated with the target @var{TGT}.
1200 @item @emph{Standard}:
1201 F95 and later
1203 @item @emph{Class}:
1204 Inquiry function
1206 @item @emph{Syntax}:
1207 @code{L = ASSOCIATED(PTR)} 
1208 @code{L = ASSOCIATED(PTR [, TGT])}
1210 @item @emph{Arguments}:
1211 @multitable @columnfractions .15 .80
1212 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1213 it can be of any type.
1214 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1215 a @code{TARGET}.  It must have the same type, kind type parameter, and
1216 array rank as @var{PTR}.
1217 @end multitable
1218 The status of neither @var{PTR} nor @var{TGT} can be undefined.
1220 @item @emph{Return value}:
1221 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1222 There are several cases:
1223 @table @asis
1224 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1225 is true if @var{PTR} is associated with a target; otherwise, it returns false.
1226 @item (B) If @var{TGT} is present and a scalar target, the result is true if
1227 @var{TGT}
1228 is not a 0 sized storage sequence and the target associated with @var{PTR}
1229 occupies the same storage units.  If @var{PTR} is disassociated, then the 
1230 result is false.
1231 @item (C) If @var{TGT} is present and an array target, the result is true if
1232 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1233 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1234 @var{PTR} occupy the same storage units in array element order.
1235 As in case(B), the result is false, if @var{PTR} is disassociated.
1236 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1237 target associated with @var{PTR} and the target associated with @var{TGT}
1238 are not 0 sized storage sequences and occupy the same storage units.
1239 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1240 @item (E) If @var{TGT} is present and an array pointer, the result is true if
1241 target associated with @var{PTR} and the target associated with @var{TGT}
1242 have the same shape, are not 0 sized arrays, are arrays whose elements are
1243 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1244 storage units in array element order.
1245 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1246 @end table
1248 @item @emph{Example}:
1249 @smallexample
1250 program test_associated
1251    implicit none
1252    real, target  :: tgt(2) = (/1., 2./)
1253    real, pointer :: ptr(:)
1254    ptr => tgt
1255    if (associated(ptr)     .eqv. .false.) call abort
1256    if (associated(ptr,tgt) .eqv. .false.) call abort
1257 end program test_associated
1258 @end smallexample
1260 @item @emph{See also}:
1261 @ref{NULL}
1262 @end table
1266 @node ATAN
1267 @section @code{ATAN} --- Arctangent function 
1268 @cindex @code{ATAN} intrinsic
1269 @cindex @code{DATAN} intrinsic
1270 @cindex trigonometric functions (inverse)
1272 @table @asis
1273 @item @emph{Description}:
1274 @code{ATAN(X)} computes the arctangent of @var{X}.
1276 @item @emph{Standard}:
1277 F77 and later
1279 @item @emph{Class}:
1280 Elemental function
1282 @item @emph{Syntax}:
1283 @code{X = ATAN(X)}
1285 @item @emph{Arguments}:
1286 @multitable @columnfractions .15 .80
1287 @item @var{X} @tab The type shall be @code{REAL(*)}.
1288 @end multitable
1290 @item @emph{Return value}:
1291 The return value is of type @code{REAL(*)} and it lies in the
1292 range @math{ - \pi / 2 \leq \atan (x) \leq \pi / 2}.
1294 @item @emph{Example}:
1295 @smallexample
1296 program test_atan
1297   real(8) :: x = 2.866_8
1298   x = atan(x)
1299 end program test_atan
1300 @end smallexample
1302 @item @emph{Specific names}:
1303 @multitable @columnfractions .20 .20 .20 .40
1304 @item Name            @tab Argument          @tab Return type       @tab Standard
1305 @item @code{DATAN(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
1306 @end multitable
1308 @item @emph{See also}:
1309 Inverse function: @ref{TAN}
1311 @end table
1315 @node ATAN2
1316 @section @code{ATAN2} --- Arctangent function 
1317 @cindex @code{ATAN2} intrinsic
1318 @cindex @code{DATAN2} intrinsic
1319 @cindex trigonometric functions (inverse)
1321 @table @asis
1322 @item @emph{Description}:
1323 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1325 @item @emph{Standard}:
1326 F77 and later
1328 @item @emph{Class}:
1329 Elemental function
1331 @item @emph{Syntax}:
1332 @code{X = ATAN2(Y,X)}
1334 @item @emph{Arguments}:
1335 @multitable @columnfractions .15 .80
1336 @item @var{Y} @tab The type shall be @code{REAL(*)}.
1337 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
1338 If @var{Y} is zero, then @var{X} must be nonzero.
1339 @end multitable
1341 @item @emph{Return value}:
1342 The return value has the same type and kind type parameter as @var{Y}.
1343 It is the principal value of the complex number @math{X + i Y}.  If
1344 @var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
1345 The sign is positive if @var{Y} is positive.  If @var{Y} is zero, then
1346 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1347 is negative.  Finally, if @var{X} is zero, then the magnitude of the result
1348 is @math{\pi/2}.
1350 @item @emph{Example}:
1351 @smallexample
1352 program test_atan2
1353   real(4) :: x = 1.e0_4, y = 0.5e0_4
1354   x = atan2(y,x)
1355 end program test_atan2
1356 @end smallexample
1358 @item @emph{Specific names}:
1359 @multitable @columnfractions .20 .20 .20 .40
1360 @item Name            @tab Argument          @tab Return type    @tab Standard
1361 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1362 @end multitable
1363 @end table
1367 @node ATANH
1368 @section @code{ATANH} --- Hyperbolic arctangent function
1369 @cindex @code{ASINH} intrinsic
1370 @cindex hyperbolic arctangent
1371 @cindex hyperbolic tangent (inverse)
1373 @table @asis
1374 @item @emph{Description}:
1375 @code{ATANH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{TANH(X)}).
1377 @item @emph{Standard}:
1378 GNU extension
1380 @item @emph{Class}:
1381 Elemental function
1383 @item @emph{Syntax}:
1384 @code{X = ATANH(X)}
1386 @item @emph{Arguments}:
1387 @multitable @columnfractions .15 .80
1388 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude
1389 that is less than or equal to one.
1390 @end multitable
1392 @item @emph{Return value}:
1393 The return value is of type @code{REAL(*)} and it lies in the
1394 range @math{-\infty \leq \atanh(x) \leq \infty}.
1396 @item @emph{Example}:
1397 @smallexample
1398 PROGRAM test_atanh
1399   REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1400   WRITE (*,*) ATANH(x)
1401 END PROGRAM
1402 @end smallexample
1404 @item @emph{See also}:
1405 Inverse function: @ref{TANH}
1406 @end table
1411 @node BESJ0
1412 @section @code{BESJ0} --- Bessel function of the first kind of order 0
1413 @cindex @code{BESJ0} intrinsic
1414 @cindex @code{DBESJ0} intrinsic
1415 @cindex Bessel
1417 @table @asis
1418 @item @emph{Description}:
1419 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1420 of @var{X}.
1422 @item @emph{Standard}:
1423 GNU extension
1425 @item @emph{Class}:
1426 Elemental function
1428 @item @emph{Syntax}:
1429 @code{X = BESJ0(X)}
1431 @item @emph{Arguments}:
1432 @multitable @columnfractions .15 .80
1433 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1434 @end multitable
1436 @item @emph{Return value}:
1437 The return value is of type @code{REAL(*)} and it lies in the
1438 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1440 @item @emph{Example}:
1441 @smallexample
1442 program test_besj0
1443   real(8) :: x = 0.0_8
1444   x = besj0(x)
1445 end program test_besj0
1446 @end smallexample
1448 @item @emph{Specific names}:
1449 @multitable @columnfractions .20 .20 .20 .40
1450 @item Name            @tab Argument          @tab Return type       @tab Standard
1451 @item @code{DBESJ0(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}   @tab GNU extension
1452 @end multitable
1453 @end table
1457 @node BESJ1
1458 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1459 @cindex @code{BESJ1} intrinsic
1460 @cindex @code{DBESJ1} intrinsic
1461 @cindex Bessel
1463 @table @asis
1464 @item @emph{Description}:
1465 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1466 of @var{X}.
1468 @item @emph{Standard}:
1469 GNU extension
1471 @item @emph{Class}:
1472 Elemental function
1474 @item @emph{Syntax}:
1475 @code{X = BESJ1(X)}
1477 @item @emph{Arguments}:
1478 @multitable @columnfractions .15 .80
1479 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1480 @end multitable
1482 @item @emph{Return value}:
1483 The return value is of type @code{REAL(*)} and it lies in the
1484 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1486 @item @emph{Example}:
1487 @smallexample
1488 program test_besj1
1489   real(8) :: x = 1.0_8
1490   x = besj1(x)
1491 end program test_besj1
1492 @end smallexample
1494 @item @emph{Specific names}:
1495 @multitable @columnfractions .20 .20 .20 .40
1496 @item Name            @tab Argument          @tab Return type       @tab Standard
1497 @item @code{DBESJ1(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
1498 @end multitable
1499 @end table
1503 @node BESJN
1504 @section @code{BESJN} --- Bessel function of the first kind
1505 @cindex @code{BESJN} intrinsic
1506 @cindex @code{DBESJN} intrinsic
1507 @cindex Bessel
1509 @table @asis
1510 @item @emph{Description}:
1511 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1512 @var{N} of @var{X}.
1514 @item @emph{Standard}:
1515 GNU extension
1517 @item @emph{Class}:
1518 Elemental function
1520 @item @emph{Syntax}:
1521 @code{Y = BESJN(N, X)}
1523 @item @emph{Arguments}:
1524 @multitable @columnfractions .15 .80
1525 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1526 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1527 @end multitable
1529 @item @emph{Return value}:
1530 The return value is a scalar of type @code{REAL(*)}.
1532 @item @emph{Example}:
1533 @smallexample
1534 program test_besjn
1535   real(8) :: x = 1.0_8
1536   x = besjn(5,x)
1537 end program test_besjn
1538 @end smallexample
1540 @item @emph{Specific names}:
1541 @multitable @columnfractions .20 .20 .20 .40
1542 @item Name             @tab Argument            @tab Return type       @tab Standard
1543 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)}    @tab GNU extension
1544 @item                  @tab @code{REAL(8) X}    @tab                   @tab
1545 @end multitable
1546 @end table
1550 @node BESY0
1551 @section @code{BESY0} --- Bessel function of the second kind of order 0
1552 @cindex @code{BESY0} intrinsic
1553 @cindex @code{DBESY0} intrinsic
1554 @cindex Bessel
1556 @table @asis
1557 @item @emph{Description}:
1558 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1559 of @var{X}.
1561 @item @emph{Standard}:
1562 GNU extension
1564 @item @emph{Class}:
1565 Elemental function
1567 @item @emph{Syntax}:
1568 @code{X = BESY0(X)}
1570 @item @emph{Arguments}:
1571 @multitable @columnfractions .15 .80
1572 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1573 @end multitable
1575 @item @emph{Return value}:
1576 The return value is a scalar of type @code{REAL(*)}.
1578 @item @emph{Example}:
1579 @smallexample
1580 program test_besy0
1581   real(8) :: x = 0.0_8
1582   x = besy0(x)
1583 end program test_besy0
1584 @end smallexample
1586 @item @emph{Specific names}:
1587 @multitable @columnfractions .20 .20 .20 .40
1588 @item Name            @tab Argument          @tab Return type       @tab Standard
1589 @item @code{DBESY0(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
1590 @end multitable
1591 @end table
1595 @node BESY1
1596 @section @code{BESY1} --- Bessel function of the second kind of order 1
1597 @cindex @code{BESY1} intrinsic
1598 @cindex @code{DBESY1} intrinsic
1599 @cindex Bessel
1601 @table @asis
1602 @item @emph{Description}:
1603 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1604 of @var{X}.
1606 @item @emph{Standard}:
1607 GNU extension
1609 @item @emph{Class}:
1610 Elemental function
1612 @item @emph{Syntax}:
1613 @code{X = BESY1(X)}
1615 @item @emph{Arguments}:
1616 @multitable @columnfractions .15 .80
1617 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1618 @end multitable
1620 @item @emph{Return value}:
1621 The return value is a scalar of type @code{REAL(*)}.
1623 @item @emph{Example}:
1624 @smallexample
1625 program test_besy1
1626   real(8) :: x = 1.0_8
1627   x = besy1(x)
1628 end program test_besy1
1629 @end smallexample
1631 @item @emph{Specific names}:
1632 @multitable @columnfractions .20 .20 .20 .40
1633 @item Name            @tab Argument          @tab Return type       @tab Standard
1634 @item @code{DBESY1(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
1635 @end multitable
1636 @end table
1640 @node BESYN
1641 @section @code{BESYN} --- Bessel function of the second kind
1642 @cindex @code{BESYN} intrinsic
1643 @cindex @code{DBESYN} intrinsic
1644 @cindex Bessel
1646 @table @asis
1647 @item @emph{Description}:
1648 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1649 @var{N} of @var{X}.
1651 @item @emph{Standard}:
1652 GNU extension
1654 @item @emph{Class}:
1655 Elemental function
1657 @item @emph{Syntax}:
1658 @code{Y = BESYN(N, X)}
1660 @item @emph{Arguments}:
1661 @multitable @columnfractions .15 .80
1662 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1663 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1664 @end multitable
1666 @item @emph{Return value}:
1667 The return value is a scalar of type @code{REAL(*)}.
1669 @item @emph{Example}:
1670 @smallexample
1671 program test_besyn
1672   real(8) :: x = 1.0_8
1673   x = besyn(5,x)
1674 end program test_besyn
1675 @end smallexample
1677 @item @emph{Specific names}:
1678 @multitable @columnfractions .20 .20 .20 .40
1679 @item Name               @tab Argument            @tab Return type     @tab Standard
1680 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)}  @tab GNU extension
1681 @item                    @tab @code{REAL(8)    X} @tab                 @tab 
1682 @end multitable
1683 @end table
1687 @node BIT_SIZE
1688 @section @code{BIT_SIZE} --- Bit size inquiry function
1689 @cindex @code{BIT_SIZE} intrinsic
1690 @cindex bit size of a variable
1691 @cindex size of a variable, in bits
1693 @table @asis
1694 @item @emph{Description}:
1695 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1696 represented by the type of @var{I}.
1698 @item @emph{Standard}:
1699 F95 and later
1701 @item @emph{Class}:
1702 Inquiry function
1704 @item @emph{Syntax}:
1705 @code{I = BIT_SIZE(I)}
1707 @item @emph{Arguments}:
1708 @multitable @columnfractions .15 .80
1709 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1710 @end multitable
1712 @item @emph{Return value}:
1713 The return value is of type @code{INTEGER(*)}
1715 @item @emph{Example}:
1716 @smallexample
1717 program test_bit_size
1718     integer :: i = 123
1719     integer :: size
1720     size = bit_size(i)
1721     print *, size
1722 end program test_bit_size
1723 @end smallexample
1724 @end table
1728 @node BTEST
1729 @section @code{BTEST} --- Bit test function
1730 @cindex @code{BTEST} intrinsic
1731 @cindex bit operations
1733 @table @asis
1734 @item @emph{Description}:
1735 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1736 in @var{I} is set.
1738 @item @emph{Standard}:
1739 F95 and later
1741 @item @emph{Class}:
1742 Elemental function
1744 @item @emph{Syntax}:
1745 @code{I = BTEST(I,POS)}
1747 @item @emph{Arguments}:
1748 @multitable @columnfractions .15 .80
1749 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1750 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1751 @end multitable
1753 @item @emph{Return value}:
1754 The return value is of type @code{LOGICAL}
1756 @item @emph{Example}:
1757 @smallexample
1758 program test_btest
1759     integer :: i = 32768 + 1024 + 64
1760     integer :: pos
1761     logical :: bool
1762     do pos=0,16
1763         bool = btest(i, pos) 
1764         print *, pos, bool
1765     end do
1766 end program test_btest
1767 @end smallexample
1768 @end table
1772 @node CEILING
1773 @section @code{CEILING} --- Integer ceiling function
1774 @cindex @code{CEILING} intrinsic
1775 @cindex ceiling
1777 @table @asis
1778 @item @emph{Description}:
1779 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1781 @item @emph{Standard}:
1782 F95 and later
1784 @item @emph{Class}:
1785 Elemental function
1787 @item @emph{Syntax}:
1788 @code{I = CEILING(X[,KIND])}
1790 @item @emph{Arguments}:
1791 @multitable @columnfractions .15 .80
1792 @item @var{X} @tab The type shall be @code{REAL(*)}.
1793 @item @var{KIND} @tab (Optional) scalar integer initialization expression.
1794 @end multitable
1796 @item @emph{Return value}:
1797 The return value is of type @code{INTEGER(KIND)}
1799 @item @emph{Example}:
1800 @smallexample
1801 program test_ceiling
1802     real :: x = 63.29
1803     real :: y = -63.59
1804     print *, ceiling(x) ! returns 64
1805     print *, ceiling(y) ! returns -63
1806 end program test_ceiling
1807 @end smallexample
1809 @item @emph{See also}:
1810 @ref{FLOOR}, @ref{NINT}
1812 @end table
1816 @node CHAR
1817 @section @code{CHAR} --- Character conversion function
1818 @cindex @code{CHAR} intrinsic
1819 @cindex conversion function (character)
1821 @table @asis
1822 @item @emph{Description}:
1823 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1825 @item @emph{Standard}:
1826 F77 and later
1828 @item @emph{Class}:
1829 Elemental function
1831 @item @emph{Syntax}:
1832 @code{C = CHAR(I[,KIND])}
1834 @item @emph{Arguments}:
1835 @multitable @columnfractions .15 .80
1836 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1837 @item @var{KIND} @tab Optional scaler integer initialization expression.
1838 @end multitable
1840 @item @emph{Return value}:
1841 The return value is of type @code{CHARACTER(1)}
1843 @item @emph{Example}:
1844 @smallexample
1845 program test_char
1846     integer :: i = 74
1847     character(1) :: c
1848     c = char(i)
1849     print *, i, c ! returns 'J'
1850 end program test_char
1851 @end smallexample
1853 @item @emph{See also}:
1854 @ref{ACHAR}, @ref{ICHAR}, @ref{IACHAR}
1856 @end table
1859 @node CHDIR
1860 @section @code{CHDIR} --- Change working directory
1861 @cindex @code{CHDIR} intrinsic
1862 @cindex file system operations
1864 @table @asis
1865 @item @emph{Description}:
1866 Change current working directory to a specified @var{PATH}.
1868 @item @emph{Standard}:
1869 GNU extension
1871 @item @emph{Class}:
1872 Non-elemental subroutine
1874 @item @emph{Syntax}:
1875 @code{CALL chdir(PATH[,STATUS])}
1877 @item @emph{Arguments}:
1878 @multitable @columnfractions .15 .80
1879 @item @var{PATH}   @tab The type shall be @code{CHARACTER(*)} and shall
1880                         specify a valid path within the file system.
1881 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success, 
1882                         a system specific and non-zero error code otherwise.
1883 @end multitable
1885 @item @emph{Example}:
1886 @smallexample
1887 PROGRAM test_chdir
1888   CHARACTER(len=255) :: path
1889   CALL getcwd(path)
1890   WRITE(*,*) TRIM(path)
1891   CALL chdir("/tmp")
1892   CALL getcwd(path)
1893   WRITE(*,*) TRIM(path)
1894 END PROGRAM
1895 @end smallexample
1897 @item @emph{See also}:
1898 @ref{GETCWD}
1899 @end table
1903 @node CHMOD
1904 @section @code{CHMOD} --- Change access permissions of files
1905 @cindex @code{CHMOD} intrinsic
1906 @cindex file system operations
1908 @table @asis
1909 @item @emph{Description}:
1910 @code{CHMOD} changes the permissions of a file. This function invokes
1911 @code{/bin/chmod} and might therefore not work on all platforms.
1913 This intrinsic is provided in both subroutine and function forms; however,
1914 only one form can be used in any given program unit.
1916 @item @emph{Standard}:
1917 GNU extension
1919 @item @emph{Class}:
1920 Subroutine, non-elemental function
1922 @item @emph{Syntax}:
1923 @multitable @columnfractions .80
1924 @item @code{CALL CHMOD(NAME, MODE[, STATUS])}
1925 @item @code{STATUS = CHMOD(NAME, MODE)}
1926 @end multitable
1928 @item @emph{Arguments}:
1929 @multitable @columnfractions .15 .80
1930 @item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
1931 Trailing blanks are ignored unless the character @code{achar(0)} is
1932 present, then all characters up to and excluding @code{achar(0)} are
1933 used as the file name.
1935 @item @var{MODE} @tab Scalar @code{CHARACTER} giving the file permission.
1936 @var{MODE} uses the same syntax as the @var{MODE} argument of
1937 @code{/bin/chmod}.
1939 @item @var{STATUS} @tab (optional) scalar @code{INTEGER}, which is
1940 @code{0} on success and non-zero otherwise.
1941 @end multitable
1943 @item @emph{Return value}:
1944 In either syntax, @var{STATUS} is set to @code{0} on success and non-zero
1945 otherwise.
1947 @item @emph{Example}:
1948 @code{CHMOD} as subroutine
1949 @smallexample
1950 program chmod_test
1951   implicit none
1952   integer :: status
1953   call chmod('test.dat','u+x',status)
1954   print *, 'Status: ', status
1955 end program chmod_test
1956 @end smallexample
1957 @code{CHMOD} as non-elemental function:
1958 @smallexample
1959 program chmod_test
1960   implicit none
1961   integer :: status
1962   status = chmod('test.dat','u+x')
1963   print *, 'Status: ', status
1964 end program chmod_test
1965 @end smallexample
1966 @item @emph{Specific names}:
1967 @item @emph{See also}:
1969 @end table
1972 @node CMPLX
1973 @section @code{CMPLX} --- Complex conversion function
1974 @cindex @code{CMPLX} intrinsic
1975 @cindex complex numbers, conversion to
1977 @table @asis
1978 @item @emph{Description}:
1979 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1980 the real component.  If @var{Y} is present it is converted to the imaginary
1981 component.  If @var{Y} is not present then the imaginary component is set to
1982 0.0.  If @var{X} is complex then @var{Y} must not be present.
1984 @item @emph{Standard}:
1985 F77 and later
1987 @item @emph{Class}:
1988 Elemental function
1990 @item @emph{Syntax}:
1991 @code{C = CMPLX(X[,Y[,KIND]])}
1993 @item @emph{Arguments}:
1994 @multitable @columnfractions .15 .80
1995 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)},
1996                    or @code{COMPLEX(*)}.
1997 @item @var{Y} @tab Optional, allowed if @var{X} is not
1998                    @code{COMPLEX(*)}.  May be @code{INTEGER(*)}
1999                    or @code{REAL(*)}. 
2000 @item @var{KIND} @tab Optional scaler integer initialization expression.
2001 @end multitable
2003 @item @emph{Return value}:
2004 The return value is of type @code{COMPLEX(*)}
2006 @item @emph{Example}:
2007 @smallexample
2008 program test_cmplx
2009     integer :: i = 42
2010     real :: x = 3.14
2011     complex :: z
2012     z = cmplx(i, x)
2013     print *, z, cmplx(x)
2014 end program test_cmplx
2015 @end smallexample
2016 @end table
2020 @node COMMAND_ARGUMENT_COUNT
2021 @section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
2022 @cindex @code{COMMAND_ARGUMENT_COUNT} intrinsic
2023 @cindex command-line arguments, to program
2025 @table @asis
2026 @item @emph{Description}:
2027 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
2028 command line when the containing program was invoked.
2030 @item @emph{Standard}:
2031 F2003
2033 @item @emph{Class}:
2034 Inquiry function
2036 @item @emph{Syntax}:
2037 @code{I = COMMAND_ARGUMENT_COUNT()}
2039 @item @emph{Arguments}:
2040 @multitable @columnfractions .15 .80
2041 @item None
2042 @end multitable
2044 @item @emph{Return value}:
2045 The return value is of type @code{INTEGER(4)}
2047 @item @emph{Example}:
2048 @smallexample
2049 program test_command_argument_count
2050     integer :: count
2051     count = command_argument_count()
2052     print *, count
2053 end program test_command_argument_count
2054 @end smallexample
2056 @item @emph{See also}:
2057 @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
2058 @end table
2060 @node CONJG
2061 @section @code{CONJG} --- Complex conjugate function 
2062 @cindex @code{CONJG} intrinsic
2063 @cindex @code{DCONJG} intrinsic
2064 @cindex complex conjugate
2065 @table @asis
2066 @item @emph{Description}:
2067 @code{CONJG(Z)} returns the conjugate of @var{Z}.  If @var{Z} is @code{(x, y)}
2068 then the result is @code{(x, -y)}
2070 @item @emph{Standard}:
2071 F77 and later, has overloads that are GNU extensions
2073 @item @emph{Class}:
2074 Elemental function
2076 @item @emph{Syntax}:
2077 @code{Z = CONJG(Z)}
2079 @item @emph{Arguments}:
2080 @multitable @columnfractions .15 .80
2081 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2082 @end multitable
2084 @item @emph{Return value}:
2085 The return value is of type @code{COMPLEX(*)}.
2087 @item @emph{Example}:
2088 @smallexample
2089 program test_conjg
2090     complex :: z = (2.0, 3.0)
2091     complex(8) :: dz = (2.71_8, -3.14_8)
2092     z= conjg(z)
2093     print *, z
2094     dz = dconjg(dz)
2095     print *, dz
2096 end program test_conjg
2097 @end smallexample
2099 @item @emph{Specific names}:
2100 @multitable @columnfractions .20 .20 .20 .40
2101 @item Name             @tab Argument             @tab Return type          @tab Standard
2102 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z}  @tab @code{COMPLEX(8)}    @tab GNU extension
2103 @end multitable
2104 @end table
2108 @node COS
2109 @section @code{COS} --- Cosine function 
2110 @cindex @code{COS} intrinsic
2111 @cindex @code{DCOS} intrinsic
2112 @cindex @code{ZCOS} intrinsic
2113 @cindex @code{CDCOS} intrinsic
2114 @cindex trigonometric functions
2116 @table @asis
2117 @item @emph{Description}:
2118 @code{COS(X)} computes the cosine of @var{X}.
2120 @item @emph{Standard}:
2121 F77 and later, has overloads that are GNU extensions
2123 @item @emph{Class}:
2124 Elemental function
2126 @item @emph{Syntax}:
2127 @code{X = COS(X)}
2129 @item @emph{Arguments}:
2130 @multitable @columnfractions .15 .80
2131 @item @var{X} @tab The type shall be @code{REAL(*)} or
2132 @code{COMPLEX(*)}.
2133 @end multitable
2135 @item @emph{Return value}:
2136 The return value is of type @code{REAL(*)} and it lies in the
2137 range @math{ -1 \leq \cos (x) \leq 1}.  The kind type
2138 parameter is the same as @var{X}.
2140 @item @emph{Example}:
2141 @smallexample
2142 program test_cos
2143   real :: x = 0.0
2144   x = cos(x)
2145 end program test_cos
2146 @end smallexample
2148 @item @emph{Specific names}:
2149 @multitable @columnfractions .20 .20 .20 .40
2150 @item Name            @tab Argument            @tab Return type       @tab Standard
2151 @item @code{DCOS(X)}  @tab @code{REAL(8) X}    @tab @code{REAL(8)}    @tab F77 and later
2152 @item @code{CCOS(X)}  @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2153 @item @code{ZCOS(X)}  @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2154 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2155 @end multitable
2157 @item @emph{See also}:
2158 Inverse function: @ref{ACOS}
2160 @end table
2164 @node COSH
2165 @section @code{COSH} --- Hyperbolic cosine function 
2166 @cindex @code{COSH} intrinsic
2167 @cindex @code{DCOSH} intrinsic
2168 @cindex hyperbolic cosine
2170 @table @asis
2171 @item @emph{Description}:
2172 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2174 @item @emph{Standard}:
2175 F77 and later
2177 @item @emph{Class}:
2178 Elemental function
2180 @item @emph{Syntax}:
2181 @code{X = COSH(X)}
2183 @item @emph{Arguments}:
2184 @multitable @columnfractions .15 .80
2185 @item @var{X} @tab The type shall be @code{REAL(*)}.
2186 @end multitable
2188 @item @emph{Return value}:
2189 The return value is of type @code{REAL(*)} and it is positive
2190 (@math{ \cosh (x) \geq 0 }.
2192 @item @emph{Example}:
2193 @smallexample
2194 program test_cosh
2195   real(8) :: x = 1.0_8
2196   x = cosh(x)
2197 end program test_cosh
2198 @end smallexample
2200 @item @emph{Specific names}:
2201 @multitable @columnfractions .20 .20 .20 .40
2202 @item Name            @tab Argument          @tab Return type       @tab Standard
2203 @item @code{DCOSH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
2204 @end multitable
2206 @item @emph{See also}:
2207 Inverse function: @ref{ACOSH}
2209 @end table
2213 @node COUNT
2214 @section @code{COUNT} --- Count function
2215 @cindex @code{COUNT} intrinsic
2216 @cindex count
2218 @table @asis
2219 @item @emph{Description}:
2220 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2221 @var{MASK} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
2222 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
2223 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2225 @item @emph{Standard}:
2226 F95 and later
2228 @item @emph{Class}:
2229 transformational function
2231 @item @emph{Syntax}:
2232 @code{I = COUNT(MASK[,DIM])}
2234 @item @emph{Arguments}:
2235 @multitable @columnfractions .15 .80
2236 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2237 @item @var{DIM}  @tab The type shall be @code{INTEGER}.
2238 @end multitable
2240 @item @emph{Return value}:
2241 The return value is of type @code{INTEGER} with rank equal to that of
2242 @var{MASK}.
2244 @item @emph{Example}:
2245 @smallexample
2246 program test_count
2247     integer, dimension(2,3) :: a, b
2248     logical, dimension(2,3) :: mask
2249     a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2250     b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2251     print '(3i3)', a(1,:)
2252     print '(3i3)', a(2,:)
2253     print *
2254     print '(3i3)', b(1,:)
2255     print '(3i3)', b(2,:)
2256     print *
2257     mask = a.ne.b
2258     print '(3l3)', mask(1,:)
2259     print '(3l3)', mask(2,:)
2260     print *
2261     print '(3i3)', count(mask)
2262     print *
2263     print '(3i3)', count(mask, 1)
2264     print *
2265     print '(3i3)', count(mask, 2)
2266 end program test_count
2267 @end smallexample
2268 @end table
2272 @node CPU_TIME
2273 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2274 @cindex @code{CPU_TIME} intrinsic
2275 @cindex time, elapsed
2276 @cindex elapsed time
2278 @table @asis
2279 @item @emph{Description}:
2280 Returns a @code{REAL} value representing the elapsed CPU time in seconds.  This
2281 is useful for testing segments of code to determine execution time.
2283 @item @emph{Standard}:
2284 F95 and later
2286 @item @emph{Class}:
2287 Subroutine
2289 @item @emph{Syntax}:
2290 @code{CPU_TIME(X)}
2292 @item @emph{Arguments}:
2293 @multitable @columnfractions .15 .80
2294 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2295 @end multitable
2297 @item @emph{Return value}:
2298 None
2300 @item @emph{Example}:
2301 @smallexample
2302 program test_cpu_time
2303     real :: start, finish
2304     call cpu_time(start)
2305         ! put code to test here
2306     call cpu_time(finish)
2307     print '("Time = ",f6.3," seconds.")',finish-start
2308 end program test_cpu_time
2309 @end smallexample
2310 @end table
2314 @node CSHIFT
2315 @section @code{CSHIFT} --- Circular shift function
2316 @cindex @code{CSHIFT} intrinsic
2317 @cindex bit operations
2319 @table @asis
2320 @item @emph{Description}:
2321 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2322 @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
2323 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
2324 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2325 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2326 by @var{SHIFT} places.  If rank is greater than one, then all complete rank one
2327 sections of @var{ARRAY} along the given dimension are shifted.  Elements
2328 shifted out one end of each rank one section are shifted back in the other end.
2330 @item @emph{Standard}:
2331 F95 and later
2333 @item @emph{Class}:
2334 transformational function
2336 @item @emph{Syntax}:
2337 @code{A = CSHIFT(A, SHIFT[,DIM])}
2339 @item @emph{Arguments}:
2340 @multitable @columnfractions .15 .80
2341 @item @var{ARRAY}  @tab May be any type, not scaler.
2342 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2343 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2344 @end multitable
2346 @item @emph{Return value}:
2347 Returns an array of same type and rank as the @var{ARRAY} argument.
2349 @item @emph{Example}:
2350 @smallexample
2351 program test_cshift
2352     integer, dimension(3,3) :: a
2353     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2354     print '(3i3)', a(1,:)
2355     print '(3i3)', a(2,:)
2356     print '(3i3)', a(3,:)    
2357     a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2358     print *
2359     print '(3i3)', a(1,:)
2360     print '(3i3)', a(2,:)
2361     print '(3i3)', a(3,:)
2362 end program test_cshift
2363 @end smallexample
2364 @end table
2367 @node CTIME
2368 @section @code{CTIME} --- Convert a time into a string
2369 @cindex @code{CTIME} intrinsic
2370 @cindex time, conversion function
2372 @table @asis
2373 @item @emph{Description}:
2374 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2375 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2376 1995}, and returns that string into @var{S}.
2378 If @code{CTIME} is invoked as a function, it can not be invoked as a
2379 subroutine, and vice versa.
2381 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2382 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2384 @item @emph{Standard}:
2385 GNU extension
2387 @item @emph{Class}:
2388 Subroutine
2390 @item @emph{Syntax}:
2391 @multitable @columnfractions .80
2392 @item @code{CALL CTIME(T,S)}.
2393 @item @code{S = CTIME(T)}, (not recommended).
2394 @end multitable
2396 @item @emph{Arguments}:
2397 @multitable @columnfractions .15 .80
2398 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2399 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2400 @end multitable
2402 @item @emph{Return value}:
2403 The converted date and time as a string.
2405 @item @emph{Example}:
2406 @smallexample
2407 program test_ctime
2408     integer(8) :: i
2409     character(len=30) :: date
2410     i = time8()
2412     ! Do something, main part of the program
2413     
2414     call ctime(i,date)
2415     print *, 'Program was started on ', date
2416 end program test_ctime
2417 @end smallexample
2418 @end table
2420 @node DATE_AND_TIME
2421 @section @code{DATE_AND_TIME} --- Date and time subroutine
2422 @cindex @code{DATE_AND_TIME} intrinsic
2423 @cindex date, current
2424 @cindex current date
2425 @cindex time, current
2426 @cindex current time
2428 @table @asis
2429 @item @emph{Description}:
2430 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2431 time information from the real-time system clock.  @var{DATE} is
2432 @code{INTENT(OUT)} and has form ccyymmdd.  @var{TIME} is @code{INTENT(OUT)} and
2433 has form hhmmss.sss.  @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2434 representing the difference with respect to Coordinated Universal Time (UTC).
2435 Unavailable time and date parameters return blanks.
2437 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2439 @multitable @columnfractions .15 .30 .60
2440 @item @tab @code{VALUE(1)}: @tab The year
2441 @item @tab @code{VALUE(2)}: @tab The month
2442 @item @tab @code{VALUE(3)}: @tab The day of the month
2443 @item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
2444 @item @tab @code{VALUE(5)}: @tab The hour of the day
2445 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2446 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2447 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2448 @end multitable     
2450 @item @emph{Standard}:
2451 F95 and later
2453 @item @emph{Class}:
2454 Subroutine
2456 @item @emph{Syntax}:
2457 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2459 @item @emph{Arguments}:
2460 @multitable @columnfractions .15 .80
2461 @item @var{DATE}  @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2462 @item @var{TIME}  @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2463 @item @var{ZONE}  @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2464 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2465 @end multitable
2467 @item @emph{Return value}:
2468 None
2470 @item @emph{Example}:
2471 @smallexample
2472 program test_time_and_date
2473     character(8)  :: date
2474     character(10) :: time
2475     character(5)  :: zone
2476     integer,dimension(8) :: values
2477     ! using keyword arguments
2478     call date_and_time(date,time,zone,values)
2479     call date_and_time(DATE=date,ZONE=zone)
2480     call date_and_time(TIME=time)
2481     call date_and_time(VALUES=values)
2482     print '(a,2x,a,2x,a)', date, time, zone
2483     print '(8i5))', values
2484 end program test_time_and_date
2485 @end smallexample
2486 @end table
2490 @node DBLE
2491 @section @code{DBLE} --- Double conversion function 
2492 @cindex @code{DBLE} intrinsic
2493 @cindex double conversion
2495 @table @asis
2496 @item @emph{Description}:
2497 @code{DBLE(X)} Converts @var{X} to double precision real type.
2499 @item @emph{Standard}:
2500 F77 and later
2502 @item @emph{Class}:
2503 Elemental function
2505 @item @emph{Syntax}:
2506 @code{X = DBLE(X)}
2508 @item @emph{Arguments}:
2509 @multitable @columnfractions .15 .80
2510 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)},
2511                    or @code{COMPLEX(*)}.
2512 @end multitable
2514 @item @emph{Return value}:
2515 The return value is of type double precision real.
2517 @item @emph{Example}:
2518 @smallexample
2519 program test_dble
2520     real    :: x = 2.18
2521     integer :: i = 5
2522     complex :: z = (2.3,1.14)
2523     print *, dble(x), dble(i), dble(z)
2524 end program test_dble
2525 @end smallexample
2527 @item @emph{See also}:
2528 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2529 @end table
2533 @node DCMPLX
2534 @section @code{DCMPLX} --- Double complex conversion function
2535 @cindex @code{DCMPLX} intrinsic
2536 @cindex complex numbers, conversion to
2538 @table @asis
2539 @item @emph{Description}:
2540 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2541 converted to the real component.  If @var{Y} is present it is converted to the
2542 imaginary component.  If @var{Y} is not present then the imaginary component is
2543 set to 0.0.  If @var{X} is complex then @var{Y} must not be present.
2545 @item @emph{Standard}:
2546 GNU extension
2548 @item @emph{Class}:
2549 Elemental function
2551 @item @emph{Syntax}:
2552 @code{C = DCMPLX(X)}
2553 @code{C = DCMPLX(X,Y)}
2555 @item @emph{Arguments}:
2556 @multitable @columnfractions .15 .80
2557 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)},
2558                    or @code{COMPLEX(*)}.
2559 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be
2560                    @code{INTEGER(*)} or @code{REAL(*)}. 
2561 @end multitable
2563 @item @emph{Return value}:
2564 The return value is of type @code{COMPLEX(8)}
2566 @item @emph{Example}:
2567 @smallexample
2568 program test_dcmplx
2569     integer :: i = 42
2570     real :: x = 3.14
2571     complex :: z
2572     z = cmplx(i, x)
2573     print *, dcmplx(i)
2574     print *, dcmplx(x)
2575     print *, dcmplx(z)
2576     print *, dcmplx(x,i)
2577 end program test_dcmplx
2578 @end smallexample
2579 @end table
2583 @node DFLOAT
2584 @section @code{DFLOAT} --- Double conversion function 
2585 @cindex @code{DFLOAT} intrinsic
2586 @cindex double float conversion
2588 @table @asis
2589 @item @emph{Description}:
2590 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2592 @item @emph{Standard}:
2593 GNU extension
2595 @item @emph{Class}:
2596 Elemental function
2598 @item @emph{Syntax}:
2599 @code{X = DFLOAT(X)}
2601 @item @emph{Arguments}:
2602 @multitable @columnfractions .15 .80
2603 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2604 @end multitable
2606 @item @emph{Return value}:
2607 The return value is of type double precision real.
2609 @item @emph{Example}:
2610 @smallexample
2611 program test_dfloat
2612     integer :: i = 5
2613     print *, dfloat(i)
2614 end program test_dfloat
2615 @end smallexample
2617 @item @emph{See also}:
2618 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2619 @end table
2623 @node DIGITS
2624 @section @code{DIGITS} --- Significant digits function
2625 @cindex @code{DIGITS} intrinsic
2626 @cindex digits, significant
2628 @table @asis
2629 @item @emph{Description}:
2630 @code{DIGITS(X)} returns the number of significant digits of the internal model
2631 representation of @var{X}.  For example, on a system using a 32-bit
2632 floating point representation, a default real number would likely return 24.
2634 @item @emph{Standard}:
2635 F95 and later
2637 @item @emph{Class}:
2638 Inquiry function
2640 @item @emph{Syntax}:
2641 @code{C = DIGITS(X)}
2643 @item @emph{Arguments}:
2644 @multitable @columnfractions .15 .80
2645 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2646 @end multitable
2648 @item @emph{Return value}:
2649 The return value is of type @code{INTEGER}.
2651 @item @emph{Example}:
2652 @smallexample
2653 program test_digits
2654     integer :: i = 12345
2655     real :: x = 3.143
2656     real(8) :: y = 2.33
2657     print *, digits(i)
2658     print *, digits(x)
2659     print *, digits(y)
2660 end program test_digits
2661 @end smallexample
2662 @end table
2666 @node DIM
2667 @section @code{DIM} --- Dim function
2668 @cindex @code{DIM} intrinsic
2669 @cindex @code{IDIM} intrinsic
2670 @cindex @code{DDIM} intrinsic
2671 @cindex dim
2673 @table @asis
2674 @item @emph{Description}:
2675 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2676 otherwise returns zero.
2678 @item @emph{Standard}:
2679 F77 and later
2681 @item @emph{Class}:
2682 Elemental function
2684 @item @emph{Syntax}:
2685 @code{X = DIM(X,Y)}
2687 @item @emph{Arguments}:
2688 @multitable @columnfractions .15 .80
2689 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2690 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2691 @end multitable
2693 @item @emph{Return value}:
2694 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2696 @item @emph{Example}:
2697 @smallexample
2698 program test_dim
2699     integer :: i
2700     real(8) :: x
2701     i = dim(4, 15)
2702     x = dim(4.345_8, 2.111_8)
2703     print *, i
2704     print *, x
2705 end program test_dim
2706 @end smallexample
2708 @item @emph{Specific names}:
2709 @multitable @columnfractions .20 .20 .20 .40
2710 @item Name             @tab Argument              @tab Return type       @tab Standard
2711 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2712 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y}    @tab @code{REAL(8)}    @tab F77 and later
2713 @end multitable
2714 @end table
2718 @node DOT_PRODUCT
2719 @section @code{DOT_PRODUCT} --- Dot product function
2720 @cindex @code{DOT_PRODUCT} intrinsic
2721 @cindex dot product
2723 @table @asis
2724 @item @emph{Description}:
2725 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2726 @var{X} and @var{Y}.  The two vectors may be either numeric or logical
2727 and must be arrays of rank one and of equal size. If the vectors are
2728 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2729 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the 
2730 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2732 @item @emph{Standard}:
2733 F95 and later
2735 @item @emph{Class}:
2736 transformational function
2738 @item @emph{Syntax}:
2739 @code{S = DOT_PRODUCT(X,Y)}
2741 @item @emph{Arguments}:
2742 @multitable @columnfractions .15 .80
2743 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2744 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2745 @end multitable
2747 @item @emph{Return value}:
2748 If the arguments are numeric, the return value is a scaler of numeric type,
2749 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.  If the arguments are
2750 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2752 @item @emph{Example}:
2753 @smallexample
2754 program test_dot_prod
2755     integer, dimension(3) :: a, b
2756     a = (/ 1, 2, 3 /)
2757     b = (/ 4, 5, 6 /)
2758     print '(3i3)', a
2759     print *
2760     print '(3i3)', b
2761     print *
2762     print *, dot_product(a,b)
2763 end program test_dot_prod
2764 @end smallexample
2765 @end table
2769 @node DPROD
2770 @section @code{DPROD} --- Double product function
2771 @cindex @code{DPROD} intrinsic
2772 @cindex double-precision product
2774 @table @asis
2775 @item @emph{Description}:
2776 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2778 @item @emph{Standard}:
2779 F77 and later
2781 @item @emph{Class}:
2782 Elemental function
2784 @item @emph{Syntax}:
2785 @code{D = DPROD(X,Y)}
2787 @item @emph{Arguments}:
2788 @multitable @columnfractions .15 .80
2789 @item @var{X} @tab The type shall be @code{REAL}.
2790 @item @var{Y} @tab The type shall be @code{REAL}.
2791 @end multitable
2793 @item @emph{Return value}:
2794 The return value is of type @code{REAL(8)}.
2796 @item @emph{Example}:
2797 @smallexample
2798 program test_dprod
2799     integer :: i
2800     real :: x = 5.2
2801     real :: y = 2.3
2802     real(8) :: d
2803     d = dprod(x,y)
2804     print *, d
2805 end program test_dprod
2806 @end smallexample
2807 @end table
2811 @node DREAL
2812 @section @code{DREAL} --- Double real part function
2813 @cindex @code{DREAL} intrinsic
2814 @cindex double-precision real part
2816 @table @asis
2817 @item @emph{Description}:
2818 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2820 @item @emph{Standard}:
2821 GNU extension
2823 @item @emph{Class}:
2824 Elemental function
2826 @item @emph{Syntax}:
2827 @code{D = DREAL(Z)}
2829 @item @emph{Arguments}:
2830 @multitable @columnfractions .15 .80
2831 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2832 @end multitable
2834 @item @emph{Return value}:
2835 The return value is of type @code{REAL(8)}.
2837 @item @emph{Example}:
2838 @smallexample
2839 program test_dreal
2840     complex(8) :: z = (1.3_8,7.2_8)
2841     print *, dreal(z)
2842 end program test_dreal
2843 @end smallexample
2845 @item @emph{See also}:
2846 @ref{AIMAG}
2848 @end table
2852 @node DTIME
2853 @section @code{DTIME} --- Execution time subroutine (or function)
2854 @cindex @code{DTIME} intrinsic
2855 @cindex time, elapsed
2856 @cindex elapsed time
2858 @table @asis
2859 @item @emph{Description}:
2860 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2861 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
2862 returns the user and system components of this time in @code{TARRAY(1)} and
2863 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2864 TARRAY(2)}.
2866 Subsequent invocations of @code{DTIME} return values accumulated since the
2867 previous invocation.
2869 On some systems, the underlying timings are represented using types with
2870 sufficiently small limits that overflows (wrap around) are possible, such as
2871 32-bit types. Therefore, the values returned by this intrinsic might be, or
2872 become, negative, or numerically less than previous values, during a single
2873 run of the compiled program.
2875 If @code{DTIME} is invoked as a function, it can not be invoked as a
2876 subroutine, and vice versa.
2878 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2880 @multitable @columnfractions .15 .30 .60
2881 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2882 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2883 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2884 @end multitable
2886 @item @emph{Standard}:
2887 GNU extension
2889 @item @emph{Class}:
2890 Subroutine
2892 @item @emph{Syntax}:
2893 @multitable @columnfractions .80
2894 @item @code{CALL DTIME(TARRAY, RESULT)}.
2895 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2896 @end multitable
2898 @item @emph{Arguments}:
2899 @multitable @columnfractions .15 .80
2900 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2901 @item @var{RESULT}@tab The type shall be @code{REAL}.
2902 @end multitable
2904 @item @emph{Return value}:
2905 Elapsed time in seconds since the start of program execution.
2907 @item @emph{Example}:
2908 @smallexample
2909 program test_dtime
2910     integer(8) :: i, j
2911     real, dimension(2) :: tarray
2912     real :: result
2913     call dtime(tarray, result)
2914     print *, result
2915     print *, tarray(1)
2916     print *, tarray(2)   
2917     do i=1,100000000    ! Just a delay
2918         j = i * i - i
2919     end do
2920     call dtime(tarray, result)
2921     print *, result
2922     print *, tarray(1)
2923     print *, tarray(2)
2924 end program test_dtime
2925 @end smallexample
2926 @end table
2930 @node EOSHIFT
2931 @section @code{EOSHIFT} --- End-off shift function
2932 @cindex @code{EOSHIFT} intrinsic
2933 @cindex bit operations
2935 @table @asis
2936 @item @emph{Description}:
2937 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2938 elements of @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is
2939 omitted it is taken to be @code{1}.  @var{DIM} is a scaler of type
2940 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2941 rank of @var{ARRAY}.  If the rank of @var{ARRAY} is one, then all elements of
2942 @var{ARRAY} are shifted by @var{SHIFT} places.  If rank is greater than one,
2943 then all complete rank one sections of @var{ARRAY} along the given dimension are
2944 shifted.  Elements shifted out one end of each rank one section are dropped.  If
2945 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2946 is copied back in the other end.  If @var{BOUNDARY} is not present then the
2947 following are copied in depending on the type of @var{ARRAY}.
2949 @multitable @columnfractions .15 .80
2950 @item @emph{Array Type} @tab @emph{Boundary Value}
2951 @item Numeric  @tab 0 of the type and kind of @var{ARRAY}.
2952 @item Logical  @tab @code{.FALSE.}.
2953 @item Character(@var{len}) @tab @var{len} blanks.
2954 @end multitable
2956 @item @emph{Standard}:
2957 F95 and later
2959 @item @emph{Class}:
2960 transformational function
2962 @item @emph{Syntax}:
2963 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2965 @item @emph{Arguments}:
2966 @multitable @columnfractions .15 .80
2967 @item @var{ARRAY}  @tab May be any type, not scaler.
2968 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2969 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}. 
2970 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2971 @end multitable
2973 @item @emph{Return value}:
2974 Returns an array of same type and rank as the @var{ARRAY} argument.
2976 @item @emph{Example}:
2977 @smallexample
2978 program test_eoshift
2979     integer, dimension(3,3) :: a
2980     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2981     print '(3i3)', a(1,:)
2982     print '(3i3)', a(2,:)
2983     print '(3i3)', a(3,:)    
2984     a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2985     print *
2986     print '(3i3)', a(1,:)
2987     print '(3i3)', a(2,:)
2988     print '(3i3)', a(3,:)
2989 end program test_eoshift
2990 @end smallexample
2991 @end table
2995 @node EPSILON
2996 @section @code{EPSILON} --- Epsilon function
2997 @cindex @code{EPSILON} intrinsic
2998 @cindex epsilon, significant
3000 @table @asis
3001 @item @emph{Description}:
3002 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
3004 @item @emph{Standard}:
3005 F95 and later
3007 @item @emph{Class}:
3008 Inquiry function
3010 @item @emph{Syntax}:
3011 @code{C = EPSILON(X)}
3013 @item @emph{Arguments}:
3014 @multitable @columnfractions .15 .80
3015 @item @var{X} @tab The type shall be @code{REAL(*)}.
3016 @end multitable
3018 @item @emph{Return value}:
3019 The return value is of same type as the argument.
3021 @item @emph{Example}:
3022 @smallexample
3023 program test_epsilon
3024     real :: x = 3.143
3025     real(8) :: y = 2.33
3026     print *, EPSILON(x)
3027     print *, EPSILON(y)
3028 end program test_epsilon
3029 @end smallexample
3030 @end table
3034 @node ERF
3035 @section @code{ERF} --- Error function 
3036 @cindex @code{ERF} intrinsic
3037 @cindex error function
3039 @table @asis
3040 @item @emph{Description}:
3041 @code{ERF(X)} computes the error function of @var{X}.
3043 @item @emph{Standard}:
3044 GNU Extension
3046 @item @emph{Class}:
3047 Elemental function
3049 @item @emph{Syntax}:
3050 @code{X = ERF(X)}
3052 @item @emph{Arguments}:
3053 @multitable @columnfractions .15 .80
3054 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3055 @end multitable
3057 @item @emph{Return value}:
3058 The return value is a scalar of type @code{REAL(*)} and it is positive
3059 (@math{ - 1 \leq erf (x) \leq 1 }.
3061 @item @emph{Example}:
3062 @smallexample
3063 program test_erf
3064   real(8) :: x = 0.17_8
3065   x = erf(x)
3066 end program test_erf
3067 @end smallexample
3069 @item @emph{Specific names}:
3070 @multitable @columnfractions .20 .20 .20 .40
3071 @item Name            @tab Argument          @tab Return type       @tab Standard
3072 @item @code{DERF(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
3073 @end multitable
3074 @end table
3078 @node ERFC
3079 @section @code{ERFC} --- Error function 
3080 @cindex @code{ERFC} intrinsic
3081 @cindex error function
3083 @table @asis
3084 @item @emph{Description}:
3085 @code{ERFC(X)} computes the complementary error function of @var{X}.
3087 @item @emph{Standard}:
3088 GNU extension
3090 @item @emph{Class}:
3091 Elemental function
3093 @item @emph{Syntax}:
3094 @code{X = ERFC(X)}
3096 @item @emph{Arguments}:
3097 @multitable @columnfractions .15 .80
3098 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3099 @end multitable
3101 @item @emph{Return value}:
3102 The return value is a scalar of type @code{REAL(*)} and it is positive
3103 (@math{ 0 \leq erfc (x) \leq 2 }.
3105 @item @emph{Example}:
3106 @smallexample
3107 program test_erfc
3108   real(8) :: x = 0.17_8
3109   x = erfc(x)
3110 end program test_erfc
3111 @end smallexample
3113 @item @emph{Specific names}:
3114 @multitable @columnfractions .20 .20 .20 .40
3115 @item Name            @tab Argument          @tab Return type       @tab Standard
3116 @item @code{DERFC(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
3117 @end multitable
3118 @end table
3122 @node ETIME
3123 @section @code{ETIME} --- Execution time subroutine (or function)
3124 @cindex @code{ETIME} intrinsic
3125 @cindex time, elapsed
3127 @table @asis
3128 @item @emph{Description}:
3129 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3130 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
3131 returns the user and system components of this time in @code{TARRAY(1)} and
3132 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3134 On some systems, the underlying timings are represented using types with
3135 sufficiently small limits that overflows (wrap around) are possible, such as
3136 32-bit types. Therefore, the values returned by this intrinsic might be, or
3137 become, negative, or numerically less than previous values, during a single
3138 run of the compiled program.
3140 If @code{ETIME} is invoked as a function, it can not be invoked as a
3141 subroutine, and vice versa.
3143 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3145 @multitable @columnfractions .15 .30 .60
3146 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
3147 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
3148 @item @tab @code{RESULT}: @tab Run time since start in seconds.
3149 @end multitable
3151 @item @emph{Standard}:
3152 GNU extension
3154 @item @emph{Class}:
3155 Subroutine
3157 @item @emph{Syntax}:
3158 @multitable @columnfractions .8
3159 @item @code{CALL ETIME(TARRAY, RESULT)}.
3160 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3161 @end multitable
3163 @item @emph{Arguments}:
3164 @multitable @columnfractions .15 .80
3165 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3166 @item @var{RESULT}@tab The type shall be @code{REAL}.
3167 @end multitable
3169 @item @emph{Return value}:
3170 Elapsed time in seconds since the start of program execution.
3172 @item @emph{Example}:
3173 @smallexample
3174 program test_etime
3175     integer(8) :: i, j
3176     real, dimension(2) :: tarray
3177     real :: result
3178     call ETIME(tarray, result)
3179     print *, result
3180     print *, tarray(1)
3181     print *, tarray(2)   
3182     do i=1,100000000    ! Just a delay
3183         j = i * i - i
3184     end do
3185     call ETIME(tarray, result)
3186     print *, result
3187     print *, tarray(1)
3188     print *, tarray(2)
3189 end program test_etime
3190 @end smallexample
3192 @item @emph{See also}:
3193 @ref{CPU_TIME}
3195 @end table
3199 @node EXIT
3200 @section @code{EXIT} --- Exit the program with status. 
3201 @cindex @code{EXIT} intrinsic
3202 @cindex exit program
3204 @table @asis
3205 @item @emph{Description}:
3206 @code{EXIT} causes immediate termination of the program with status.  If status
3207 is omitted it returns the canonical @emph{success} for the system.  All Fortran
3208 I/O units are closed. 
3210 @item @emph{Standard}:
3211 GNU extension
3213 @item @emph{Class}:
3214 Subroutine
3216 @item @emph{Syntax}:
3217 @code{CALL EXIT([STATUS])}
3219 @item @emph{Arguments}:
3220 @multitable @columnfractions .15 .80
3221 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3222 @end multitable
3224 @item @emph{Return value}:
3225 @code{STATUS} is passed to the parent process on exit.
3227 @item @emph{Example}:
3228 @smallexample
3229 program test_exit
3230   integer :: STATUS = 0
3231   print *, 'This program is going to exit.'
3232   call EXIT(STATUS)
3233 end program test_exit
3234 @end smallexample
3236 @item @emph{See also}:
3237 @ref{ABORT}, @ref{KILL}
3238 @end table
3242 @node EXP
3243 @section @code{EXP} --- Exponential function 
3244 @cindex @code{EXP} intrinsic
3245 @cindex @code{DEXP} intrinsic
3246 @cindex @code{ZEXP} intrinsic
3247 @cindex @code{CDEXP} intrinsic
3248 @cindex exponential
3250 @table @asis
3251 @item @emph{Description}:
3252 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3254 @item @emph{Standard}:
3255 F77 and later, has overloads that are GNU extensions
3257 @item @emph{Class}:
3258 Elemental function
3260 @item @emph{Syntax}:
3261 @code{X = EXP(X)}
3263 @item @emph{Arguments}:
3264 @multitable @columnfractions .15 .80
3265 @item @var{X} @tab The type shall be @code{REAL(*)} or
3266 @code{COMPLEX(*)}.
3267 @end multitable
3269 @item @emph{Return value}:
3270 The return value has same type and kind as @var{X}.
3272 @item @emph{Example}:
3273 @smallexample
3274 program test_exp
3275   real :: x = 1.0
3276   x = exp(x)
3277 end program test_exp
3278 @end smallexample
3280 @item @emph{Specific names}:
3281 @multitable @columnfractions .20 .20 .20 .40
3282 @item Name            @tab Argument             @tab Return type         @tab Standard
3283 @item @code{DEXP(X)}  @tab @code{REAL(8) X}     @tab @code{REAL(8)}      @tab F77 and later
3284 @item @code{CEXP(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}   @tab F77 and later
3285 @item @code{ZEXP(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}   @tab GNU extension
3286 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}   @tab GNU extension
3287 @end multitable
3288 @end table
3292 @node EXPONENT
3293 @section @code{EXPONENT} --- Exponent function 
3294 @cindex @code{EXPONENT} intrinsic
3295 @cindex exponent part of a real number
3297 @table @asis
3298 @item @emph{Description}:
3299 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3300 is zero the value returned is zero. 
3302 @item @emph{Standard}:
3303 F95 and later
3305 @item @emph{Class}:
3306 Elemental function
3308 @item @emph{Syntax}:
3309 @code{I = EXPONENT(X)}
3311 @item @emph{Arguments}:
3312 @multitable @columnfractions .15 .80
3313 @item @var{X} @tab The type shall be @code{REAL(*)}.
3314 @end multitable
3316 @item @emph{Return value}:
3317 The return value is of type default @code{INTEGER}.
3319 @item @emph{Example}:
3320 @smallexample
3321 program test_exponent
3322   real :: x = 1.0
3323   integer :: i
3324   i = exponent(x)
3325   print *, i
3326   print *, exponent(0.0)
3327 end program test_exponent
3328 @end smallexample
3329 @end table
3332 @node FDATE
3333 @section @code{FDATE} --- Get the current time as a string
3334 @cindex @code{FDATE} intrinsic
3335 @cindex time, current
3336 @cindex current time
3337 @cindex date, current
3338 @cindex current date
3340 @table @asis
3341 @item @emph{Description}:
3342 @code{FDATE(DATE)} returns the current date (using the same format as
3343 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3344 TIME())}.
3346 If @code{FDATE} is invoked as a function, it can not be invoked as a
3347 subroutine, and vice versa.
3349 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3351 @item @emph{Standard}:
3352 GNU extension
3354 @item @emph{Class}:
3355 Subroutine
3357 @item @emph{Syntax}:
3358 @multitable @columnfractions .80
3359 @item @code{CALL FDATE(DATE)}.
3360 @item @code{DATE = FDATE()}, (not recommended).
3361 @end multitable
3363 @item @emph{Arguments}:
3364 @multitable @columnfractions .15 .80
3365 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3366 @end multitable
3368 @item @emph{Return value}:
3369 The current date as a string.
3371 @item @emph{Example}:
3372 @smallexample
3373 program test_fdate
3374     integer(8) :: i, j
3375     character(len=30) :: date
3376     call fdate(date)
3377     print *, 'Program started on ', date
3378     do i = 1, 100000000 ! Just a delay
3379         j = i * i - i
3380     end do
3381     call fdate(date)
3382     print *, 'Program ended on ', date
3383 end program test_fdate
3384 @end smallexample
3385 @end table
3387 @node FLOAT
3389 @section @code{FLOAT} --- Convert integer to default real
3390 @cindex @code{FLOAT} intrinsic
3391 @cindex conversion function (float)
3393 @table @asis
3394 @item @emph{Description}:
3395 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3397 @item @emph{Standard}:
3398 GNU extension
3400 @item @emph{Class}:
3401 Elemental function
3403 @item @emph{Syntax}:
3404 @code{X = FLOAT(I)}
3406 @item @emph{Arguments}:
3407 @multitable @columnfractions .15 .80
3408 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3409 @end multitable
3411 @item @emph{Return value}:
3412 The return value is of type default @code{REAL}
3414 @item @emph{Example}:
3415 @smallexample
3416 program test_float
3417     integer :: i = 1
3418     if (float(i) /= 1.) call abort
3419 end program test_float
3420 @end smallexample
3422 @item @emph{See also}:
3423 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3424 @end table
3428 @node FGET
3429 @section @code{FGET} --- Read a single character in stream mode from stdin 
3430 @cindex @code{FGET} intrinsic
3431 @cindex file operations
3432 @cindex stream operations
3434 @table @asis
3435 @item @emph{Description}:
3436 Read a single character in stream mode from stdin by bypassing normal 
3437 formatted output. Stream I/O should not be mixed with normal record-oriented 
3438 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3440 This intrinsic routine is provided for backwards compatibility with 
3441 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3442 Programmers should consider the use of new stream IO feature in new code 
3443 for future portability. See also @ref{Fortran 2003 status}.
3445 @item @emph{Standard}:
3446 GNU extension
3448 @item @emph{Class}:
3449 Non-elemental subroutine
3451 @item @emph{Syntax}:
3452 @code{CALL FGET(C[,STATUS])}
3454 @item @emph{Arguments}:
3455 @multitable @columnfractions .15 .80
3456 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3457 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3458                         -1 on end-of-file and a system specific positive error code otherwise.
3459 @end multitable
3461 @item @emph{Example}:
3462 @smallexample
3463 PROGRAM test_fget
3464   INTEGER, PARAMETER :: strlen = 100
3465   INTEGER :: status, i = 1
3466   CHARACTER(len=strlen) :: str = ""
3468   WRITE (*,*) 'Enter text:'
3469   DO
3470     CALL fget(str(i:i), status)
3471     if (status /= 0 .OR. i > strlen) exit
3472     i = i + 1
3473   END DO
3474   WRITE (*,*) TRIM(str)
3475 END PROGRAM
3476 @end smallexample
3478 @item @emph{See also}:
3479 @ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
3480 @end table
3483 @node FGETC
3484 @section @code{FGETC} --- Read a single character in stream mode
3485 @cindex @code{FGETC} intrinsic
3486 @cindex file operations
3487 @cindex stream operations
3489 @table @asis
3490 @item @emph{Description}:
3491 Read a single character in stream mode by bypassing normal formatted output. 
3492 Stream I/O should not be mixed with normal record-oriented (formatted or 
3493 unformatted) I/O on the same unit; the results are unpredictable.
3495 This intrinsic routine is provided for backwards compatibility with 
3496 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3497 Programmers should consider the use of new stream IO feature in new code 
3498 for future portability. See also @ref{Fortran 2003 status}.
3500 @item @emph{Standard}:
3501 GNU extension
3503 @item @emph{Class}:
3504 Non-elemental subroutine
3506 @item @emph{Syntax}:
3507 @code{CALL FGETC(UNIT,C[,STATUS])}
3509 @item @emph{Arguments}:
3510 @multitable @columnfractions .15 .80
3511 @item @var{UNIT}   @tab The type shall be @code{INTEGER}.
3512 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3513 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3514                         -1 on end-of-file and a system specific positive error code otherwise.
3515 @end multitable
3517 @item @emph{Example}:
3518 @smallexample
3519 PROGRAM test_fgetc
3520   INTEGER :: fd = 42, status
3521   CHARACTER :: c
3523   OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3524   DO
3525     CALL fgetc(fd, c, status)
3526     IF (status /= 0) EXIT
3527     call fput(c)
3528   END DO
3529   CLOSE(UNIT=fd)
3530 END PROGRAM
3531 @end smallexample
3533 @item @emph{See also}:
3534 @ref{FGET}, @ref{FPUT}, @ref{FPUTC}
3535 @end table
3539 @node FLOOR
3540 @section @code{FLOOR} --- Integer floor function
3541 @cindex @code{FLOOR} intrinsic
3542 @cindex floor
3544 @table @asis
3545 @item @emph{Description}:
3546 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3548 @item @emph{Standard}:
3549 F95 and later
3551 @item @emph{Class}:
3552 Elemental function
3554 @item @emph{Syntax}:
3555 @code{I = FLOOR(X[,KIND])}
3557 @item @emph{Arguments}:
3558 @multitable @columnfractions .15 .80
3559 @item @var{X} @tab The type shall be @code{REAL(*)}.
3560 @item @var{KIND} @tab Optional scaler integer initialization expression.
3561 @end multitable
3563 @item @emph{Return value}:
3564 The return value is of type @code{INTEGER(KIND)}
3566 @item @emph{Example}:
3567 @smallexample
3568 program test_floor
3569     real :: x = 63.29
3570     real :: y = -63.59
3571     print *, floor(x) ! returns 63
3572     print *, floor(y) ! returns -64
3573 end program test_floor
3574 @end smallexample
3576 @item @emph{See also}:
3577 @ref{CEILING}, @ref{NINT}
3579 @end table
3583 @node FLUSH
3584 @section @code{FLUSH} --- Flush I/O unit(s)
3585 @cindex @code{FLUSH} intrinsic
3586 @cindex flush output files
3588 @table @asis
3589 @item @emph{Description}:
3590 Flushes Fortran unit(s) currently open for output. Without the optional
3591 argument, all units are flushed, otherwise just the unit specified.
3593 @item @emph{Standard}:
3594 GNU extension
3596 @item @emph{Class}:
3597 non-elemental subroutine
3599 @item @emph{Syntax}:
3600 @code{CALL FLUSH(UNIT)}
3602 @item @emph{Arguments}:
3603 @multitable @columnfractions .15 .80
3604 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3605 @end multitable
3607 @item @emph{Note}:
3608 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3609 statement that should be preferred over the @code{FLUSH} intrinsic.
3611 @end table
3615 @node FNUM
3616 @section @code{FNUM} --- File number function
3617 @cindex @code{FNUM} intrinsic
3618 @cindex fnum
3620 @table @asis
3621 @item @emph{Description}:
3622 @code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
3623 open Fortran I/O unit @code{UNIT}.
3625 @item @emph{Standard}:
3626 GNU extension
3628 @item @emph{Class}:
3629 non-elemental function
3631 @item @emph{Syntax}:
3632 @code{I = FNUM(UNIT)}
3634 @item @emph{Arguments}:
3635 @multitable @columnfractions .15 .80
3636 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3637 @end multitable
3639 @item @emph{Return value}:
3640 The return value is of type @code{INTEGER}
3642 @item @emph{Example}:
3643 @smallexample
3644 program test_fnum
3645   integer :: i
3646   open (unit=10, status = "scratch")
3647   i = fnum(10)
3648   print *, i
3649   close (10)
3650 end program test_fnum
3651 @end smallexample
3652 @end table
3656 @node FPUT
3657 @section @code{FPUT} --- Write a single character in stream mode to stdout 
3658 @cindex @code{FPUT} intrinsic
3659 @cindex file operations
3660 @cindex stream operations
3662 @table @asis
3663 @item @emph{Description}:
3664 Write a single character in stream mode to stdout by bypassing normal 
3665 formatted output. Stream I/O should not be mixed with normal record-oriented 
3666 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3668 This intrinsic routine is provided for backwards compatibility with 
3669 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3670 Programmers should consider the use of new stream IO feature in new code 
3671 for future portability. See also @ref{Fortran 2003 status}.
3673 @item @emph{Standard}:
3674 GNU extension
3676 @item @emph{Class}:
3677 Non-elemental subroutine
3679 @item @emph{Syntax}:
3680 @code{CALL FPUT(C[,STATUS])}
3682 @item @emph{Arguments}:
3683 @multitable @columnfractions .15 .80
3684 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3685 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3686                         -1 on end-of-file and a system specific positive error code otherwise.
3687 @end multitable
3689 @item @emph{Example}:
3690 @smallexample
3691 PROGRAM test_fput
3692   CHARACTER(len=*) :: str = "gfortran"
3693   INTEGER :: i
3694   DO i = 1, len_trim(str)
3695     CALL fput(str(i:i))
3696   END DO
3697 END PROGRAM
3698 @end smallexample
3700 @item @emph{See also}:
3701 @ref{FPUTC}, @ref{FGET}, @ref{FGETC}
3702 @end table
3706 @node FPUTC
3707 @section @code{FPUTC} --- Write a single character in stream mode
3708 @cindex @code{FPUTC} intrinsic
3709 @cindex file operations
3710 @cindex stream operations
3712 @table @asis
3713 @item @emph{Description}:
3714 Write a single character in stream mode by bypassing normal formatted 
3715 output. Stream I/O should not be mixed with normal record-oriented 
3716 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3718 This intrinsic routine is provided for backwards compatibility with 
3719 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3720 Programmers should consider the use of new stream IO feature in new code 
3721 for future portability. See also @ref{Fortran 2003 status}.
3723 @item @emph{Standard}:
3724 GNU extension
3726 @item @emph{Class}:
3727 Non-elemental subroutine
3729 @item @emph{Syntax}:
3730 @code{CALL FPUTC(UNIT,C[,STATUS])}
3732 @item @emph{Arguments}:
3733 @multitable @columnfractions .15 .80
3734 @item @var{UNIT}   @tab The type shall be @code{INTEGER}.
3735 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3736 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3737                         -1 on end-of-file and a system specific positive error code otherwise.
3738 @end multitable
3740 @item @emph{Example}:
3741 @smallexample
3742 PROGRAM test_fputc
3743   CHARACTER(len=*) :: str = "gfortran"
3744   INTEGER :: fd = 42, i
3746   OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3747   DO i = 1, len_trim(str)
3748     CALL fputc(fd, str(i:i))
3749   END DO
3750   CLOSE(fd)
3751 END PROGRAM
3752 @end smallexample
3754 @item @emph{See also}:
3755 @ref{FPUT}, @ref{FGET}, @ref{FGETC}
3756 @end table
3760 @node FRACTION
3761 @section @code{FRACTION} --- Fractional part of the model representation
3762 @cindex @code{FRACTION} intrinsic
3763 @cindex fractional part
3765 @table @asis
3766 @item @emph{Description}:
3767 @code{FRACTION(X)} returns the fractional part of the model
3768 representation of @code{X}.
3770 @item @emph{Standard}:
3771 F95 and later
3773 @item @emph{Class}:
3774 Elemental function
3776 @item @emph{Syntax}:
3777 @code{Y = FRACTION(X)}
3779 @item @emph{Arguments}:
3780 @multitable @columnfractions .15 .80
3781 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3782 @end multitable
3784 @item @emph{Return value}:
3785 The return value is of the same type and kind as the argument.
3786 The fractional part of the model representation of @code{X} is returned;
3787 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3789 @item @emph{Example}:
3790 @smallexample
3791 program test_fraction
3792   real :: x
3793   x = 178.1387e-4
3794   print *, fraction(x), x * radix(x)**(-exponent(x))
3795 end program test_fraction
3796 @end smallexample
3798 @end table
3802 @node FREE
3803 @section @code{FREE} --- Frees memory
3804 @cindex @code{FREE} intrinsic
3805 @cindex Cray pointers
3807 @table @asis
3808 @item @emph{Description}:
3809 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3810 intrinsic is an extension intended to be used with Cray pointers, and is
3811 provided in GNU Fortran to allow user to compile legacy code. For
3812 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3813 @code{DEALLOCATE}.
3815 @item @emph{Standard}:
3816 GNU extension
3818 @item @emph{Class}:
3819 Subroutine
3821 @item @emph{Syntax}:
3822 @code{FREE(PTR)}
3824 @item @emph{Arguments}:
3825 @multitable @columnfractions .15 .80
3826 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3827 location of the memory that should be de-allocated.
3828 @end multitable
3830 @item @emph{Return value}:
3831 None
3833 @item @emph{Example}:
3834 See @code{MALLOC} for an example.
3836 @item @emph{See also}:
3837 @ref{MALLOC}
3838 @end table
3843 @node FSTAT
3844 @section @code{FSTAT} --- Get file status
3845 @cindex @code{FSTAT} intrinsic
3846 @cindex file system operations 
3848 @table @asis
3849 @item @emph{Description}:
3850 @code{FSTAT} is identical to @ref{STAT}, except that information about an 
3851 already opened file is obtained.
3853 The elements in @code{BUFF} are the same as described by @ref{STAT}.
3855 @item @emph{Standard}:
3856 GNU extension
3858 @item @emph{Class}:
3859 Non-elemental subroutine
3861 @item @emph{Syntax}:
3862 @code{CALL fstat(UNIT,BUFF[,STATUS])}
3864 @item @emph{Arguments}:
3865 @multitable @columnfractions .15 .80
3866 @item @var{UNIT}   @tab An open I/O unit number of type @code{INTEGER}.
3867 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
3868 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
3869                         on success and a system specific error code otherwise.
3870 @end multitable
3872 @item @emph{Example}:
3873 See @ref{STAT} for an example.
3875 @item @emph{See also}:
3876 To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
3877 @end table
3881 @node FSEEK
3882 @section @code{FSEEK} --- Low level file positioning subroutine
3883 @cindex @code{FSEEK} intrinsic
3884 @cindex file system operations
3886 Not yet implemented in GNU Fortran.
3888 @table @asis
3889 @item @emph{Description}:
3891 @item @emph{Standard}:
3892 GNU extension
3894 @item @emph{Class}:
3895 Subroutine
3897 @item @emph{Syntax}:
3898 @item @emph{Arguments}:
3899 @item @emph{Return value}:
3900 @item @emph{Example}:
3901 @item @emph{Specific names}:
3902 @item @emph{See also}:
3903 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3905 @end table
3909 @node FTELL
3910 @section @code{FTELL} --- Current stream position
3911 @cindex @code{FTELL} intrinsic
3913 @table @asis
3914 @item @emph{Description}:
3915 Retrieves the current position within an open file.
3917 This intrinsic is provided in both subroutine and function forms; however,
3918 only one form can be used in any given program unit.
3920 @item @emph{Standard}:
3921 GNU extension
3923 @item @emph{Class}:
3924 Subroutine, function
3926 @item @emph{Syntax}:
3927 @multitable @columnfractions .80
3928 @item @code{CALL FTELL(UNIT, OFFSET)}
3929 @item @code{OFFSET = FTELL(UNIT)}
3930 @end multitable
3932 @item @emph{Arguments}:
3933 @multitable @columnfractions .15 .80
3934 @item @var{OFFSET}  @tab Shall of type @code{INTEGER}.
3935 @item @var{UNIT}    @tab Shall of type @code{INTEGER}.
3936 @end multitable
3938 @item @emph{Return value}:
3939 In either syntax, @var{OFFSET} is set to the current offset of unit
3940 number @var{UNIT}, or to @math{-1} if the unit is not currently open.
3942 @item @emph{Example}:
3943 @smallexample
3944 PROGRAM test_ftell
3945   INTEGER :: i
3946   OPEN(10, FILE="temp.dat")
3947   CALL ftell(10,i)
3948   WRITE(*,*) i
3949 END PROGRAM
3950 @end smallexample
3952 @item @emph{See also}:
3953 @ref{FSEEK}
3954 @end table
3958 @node GETARG
3959 @section @code{GETARG} --- Get command line arguments
3960 @cindex @code{GETARG} intrinsic
3961 @cindex command-line arguments, to program
3963 @table @asis
3964 @item @emph{Description}:
3965 Retrieve the @var{N}th argument that was passed on the
3966 command line when the containing program was invoked.
3968 This intrinsic routine is provided for backwards compatibility with 
3969 GNU Fortran 77.  In new code, programmers should consider the use of 
3970 the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003 
3971 standard.
3973 @item @emph{Standard}:
3974 GNU extension
3976 @item @emph{Class}:
3977 Subroutine
3979 @item @emph{Syntax}:
3980 @code{CALL GETARG(N,ARG)}
3982 @item @emph{Arguments}:
3983 @multitable @columnfractions .15 .80
3984 @item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3985 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
3986 @end multitable
3988 @item @emph{Return value}:
3989 After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th 
3990 command line argument. If @var{ARG} can not hold the argument, it is 
3991 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3992 arguments specified at the command line, @var{ARG} will be filled with blanks.
3993 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3994 that support this feature).
3996 @item @emph{Example}:
3997 @smallexample
3998 PROGRAM test_getarg
3999   INTEGER :: i
4000   CHARACTER(len=32) :: arg
4002   DO i = 1, iargc()
4003     CALL getarg(i, arg)
4004     WRITE (*,*) arg
4005   END DO
4006 END PROGRAM
4007 @end smallexample
4009 @item @emph{See also}:
4010 GNU Fortran 77 compatibility function: @ref{IARGC}
4012 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT},
4013 @ref{COMMAND_ARGUMENT_COUNT}
4014 @end table
4018 @node GET_COMMAND
4019 @section @code{GET_COMMAND} --- Get the entire command line
4020 @cindex @code{GET_COMMAND} intrinsic
4021 @cindex command-line arguments, to program
4023 @table @asis
4024 @item @emph{Description}:
4025 Retrieve the entire command line that was used to invoke the program.
4027 @item @emph{Standard}:
4028 F2003
4030 @item @emph{Class}:
4031 Subroutine
4033 @item @emph{Syntax}:
4034 @code{CALL GET_COMMAND(CMD)}
4036 @item @emph{Arguments}:
4037 @multitable @columnfractions .15 .80
4038 @item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}. 
4039 @end multitable
4041 @item @emph{Return value}:
4042 Stores the entire command line that was used to invoke the program in @var{ARG}. 
4043 If @var{ARG} is not large enough, the command will be truncated. 
4045 @item @emph{Example}:
4046 @smallexample
4047 PROGRAM test_get_command
4048   CHARACTER(len=255) :: cmd
4049   CALL get_command(cmd)
4050   WRITE (*,*) TRIM(cmd)
4051 END PROGRAM
4052 @end smallexample
4054 @item @emph{See also}:
4055 @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4056 @end table
4060 @node GET_COMMAND_ARGUMENT
4061 @section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
4062 @cindex @code{GET_COMMAND_ARGUMENT} intrinsic
4063 @cindex command-line arguments, to program
4065 @table @asis
4066 @item @emph{Description}:
4067 Retrieve the @var{N}th argument that was passed on the
4068 command line when the containing program was invoked.
4070 @item @emph{Standard}:
4071 F2003
4073 @item @emph{Class}:
4074 Subroutine
4076 @item @emph{Syntax}:
4077 @code{CALL GET_COMMAND_ARGUMENT(N,ARG)}
4079 @item @emph{Arguments}:
4080 @multitable @columnfractions .15 .80
4081 @item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
4082 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
4083 @end multitable
4085 @item @emph{Return value}:
4086 After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the 
4087 @var{N}th command line argument. If @var{ARG} can not hold the argument, it is 
4088 truncated to fit the length of @var{ARG}. If there are less than @var{N}
4089 arguments specified at the command line, @var{ARG} will be filled with blanks. 
4090 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
4091 that support this feature).
4093 @item @emph{Example}:
4094 @smallexample
4095 PROGRAM test_get_command_argument
4096   INTEGER :: i
4097   CHARACTER(len=32) :: arg
4099   i = 0
4100   DO
4101     CALL get_command_argument(i, arg)
4102     IF (LEN_TRIM(arg) == 0) EXIT
4104     WRITE (*,*) TRIM(arg)
4105     i = i+1
4106   END DO
4107 END PROGRAM
4108 @end smallexample
4110 @item @emph{See also}:
4111 @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
4112 @end table
4116 @node GETCWD
4117 @section @code{GETCWD} --- Get current working directory
4118 @cindex @code{GETCWD} intrinsic
4119 @cindex file system operations
4121 @table @asis
4122 @item @emph{Description}:
4123 Get current working directory.
4125 @item @emph{Standard}:
4126 GNU extension
4128 @item @emph{Class}:
4129 Non-elemental subroutine.
4131 @item @emph{Syntax}:
4132 @code{CALL GETCWD(CWD[,STATUS])}
4134 @item @emph{Arguments}:
4135 @multitable @columnfractions .15 .80
4136 @item @var{CWD}    @tab The type shall be @code{CHARACTER(*)}.
4137 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success, 
4138                         a system specific and non-zero error code otherwise.
4139 @end multitable
4141 @item @emph{Example}:
4142 @smallexample
4143 PROGRAM test_getcwd
4144   CHARACTER(len=255) :: cwd
4145   CALL getcwd(cwd)
4146   WRITE(*,*) TRIM(cwd)
4147 END PROGRAM
4148 @end smallexample
4150 @item @emph{See also}:
4151 @ref{CHDIR}
4152 @end table
4156 @node GETENV
4157 @section @code{GETENV} --- Get an environmental variable
4158 @cindex @code{GETENV} intrinsic
4159 @cindex environment variable
4161 @table @asis
4162 @item @emph{Description}:
4163 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4165 This intrinsic routine is provided for backwards compatibility with 
4166 GNU Fortran 77.  In new code, programmers should consider the use of 
4167 the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
4168 2003 standard.
4170 @item @emph{Standard}:
4171 GNU extension
4173 @item @emph{Class}:
4174 Subroutine
4176 @item @emph{Syntax}:
4177 @code{CALL GETENV(ENVVAR,VALUE)}
4179 @item @emph{Arguments}:
4180 @multitable @columnfractions .15 .80
4181 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
4182 @item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
4183 @end multitable
4185 @item @emph{Return value}:
4186 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
4187 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4188 is not set, @var{VALUE} will be filled with blanks.
4190 @item @emph{Example}:
4191 @smallexample
4192 PROGRAM test_getenv
4193   CHARACTER(len=255) :: homedir
4194   CALL getenv("HOME", homedir)
4195   WRITE (*,*) TRIM(homedir)
4196 END PROGRAM
4197 @end smallexample
4199 @item @emph{See also}:
4200 @ref{GET_ENVIRONMENT_VARIABLE}
4201 @end table
4205 @node GET_ENVIRONMENT_VARIABLE
4206 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
4207 @cindex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
4208 @cindex environment variable
4210 @table @asis
4211 @item @emph{Description}:
4212 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4214 @item @emph{Standard}:
4215 F2003
4217 @item @emph{Class}:
4218 Subroutine
4220 @item @emph{Syntax}:
4221 @code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR,VALUE)}
4223 @item @emph{Arguments}:
4224 @multitable @columnfractions .15 .80
4225 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
4226 @item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
4227 @end multitable
4229 @item @emph{Return value}:
4230 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
4231 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4232 is not set, @var{VALUE} will be filled with blanks.
4234 @item @emph{Example}:
4235 @smallexample
4236 PROGRAM test_getenv
4237   CHARACTER(len=255) :: homedir
4238   CALL get_environment_variable("HOME", homedir)
4239   WRITE (*,*) TRIM(homedir)
4240 END PROGRAM
4241 @end smallexample
4242 @end table
4246 @node GETGID
4247 @section @code{GETGID} --- Group ID function
4248 @cindex @code{GETGID} intrinsic
4249 @cindex file system operations
4251 @table @asis
4252 @item @emph{Description}:
4253 Returns the numerical group ID of the current process.
4255 @item @emph{Standard}:
4256 GNU extension
4258 @item @emph{Class}:
4259 function
4261 @item @emph{Syntax}:
4262 @code{I = GETGID()}
4264 @item @emph{Return value}:
4265 The return value of @code{GETGID} is an @code{INTEGER} of the default
4266 kind.
4269 @item @emph{Example}:
4270 See @code{GETPID} for an example.
4272 @item @emph{See also}:
4273 @ref{GETPID}, @ref{GETUID}
4274 @end table
4278 @node GETLOG
4279 @section @code{GETLOG} --- Get login name
4280 @cindex @code{GETLOG} intrinsic
4282 @table @asis
4283 @item @emph{Description}:
4284 Gets the username under which the program is running.
4286 @item @emph{Standard}:
4287 GNU extension
4289 @item @emph{Class}:
4290 Subroutine
4292 @item @emph{Syntax}:
4293 @code{CALL GETLOG(LOGIN)}
4295 @item @emph{Arguments}:
4296 @multitable @columnfractions .15 .80
4297 @item @var{LOGIN} @tab Shall be of type @code{CHARACTER(*)}.
4298 @end multitable
4300 @item @emph{Return value}:
4301 Stores the current user name in @var{LOGIN}.  (On systems where 
4302 the @code{getlogin(3)} function is not implemented, this will
4303 return a blank string.)
4305 @item @emph{Example}:
4306 @smallexample
4307 PROGRAM TEST_GETLOG
4308   CHARACTER(32) :: login
4309   CALL GETLOG(login)
4310   WRITE(*,*) login
4311 END PROGRAM
4312 @end smallexample
4314 @item @emph{See also}:
4315 @ref{GETUID}
4316 @end table
4320 @node GETPID
4321 @section @code{GETPID} --- Process ID function
4322 @cindex @code{GETPID} intrinsic
4323 @cindex process ID, current
4325 @table @asis
4326 @item @emph{Description}:
4327 Returns the numerical process identifier of the current process.
4329 @item @emph{Standard}:
4330 GNU extension
4332 @item @emph{Class}:
4333 function
4335 @item @emph{Syntax}:
4336 @code{I = GETPID()}
4338 @item @emph{Return value}:
4339 The return value of @code{GETPID} is an @code{INTEGER} of the default
4340 kind.
4343 @item @emph{Example}:
4344 @smallexample
4345 program info
4346   print *, "The current process ID is ", getpid()
4347   print *, "Your numerical user ID is ", getuid()
4348   print *, "Your numerical group ID is ", getgid()
4349 end program info
4350 @end smallexample
4352 @item @emph{See also}:
4353 @ref{GETGID}, @ref{GETUID}
4354 @end table
4358 @node GETUID
4359 @section @code{GETUID} --- User ID function
4360 @cindex @code{GETUID} intrinsic
4361 @cindex user ID, current
4363 @table @asis
4364 @item @emph{Description}:
4365 Returns the numerical user ID of the current process.
4367 @item @emph{Standard}:
4368 GNU extension
4370 @item @emph{Class}:
4371 function
4373 @item @emph{Syntax}:
4374 @code{GETUID()}
4376 @item @emph{Return value}:
4377 The return value of @code{GETUID} is an @code{INTEGER} of the default
4378 kind.
4381 @item @emph{Example}:
4382 See @code{GETPID} for an example.
4384 @item @emph{See also}:
4385 @ref{GETPID}, @ref{GETLOG}
4386 @end table
4390 @node GMTIME
4391 @section @code{GMTIME} --- Convert time to GMT info
4392 @cindex @code{GMTIME} intrinsic
4393 @cindex time, conversion function
4395 Not yet implemented in GNU Fortran.
4397 @table @asis
4398 @item @emph{Description}:
4400 @item @emph{Standard}:
4401 GNU extension
4403 @item @emph{Class}:
4404 Subroutine
4406 @item @emph{Syntax}:
4407 @item @emph{Arguments}:
4408 @item @emph{Return value}:
4409 @item @emph{Example}:
4410 @item @emph{Specific names}:
4411 @item @emph{See also}:
4413 @end table
4417 @node HOSTNM
4418 @section @code{HOSTNM} --- Get system host name
4419 @cindex @code{HOSTNM} intrinsic
4421 @table @asis
4422 @item @emph{Description}:
4423 Retrieves the host name of the system on which the program is running.
4425 This intrinsic is provided in both subroutine and function forms; however,
4426 only one form can be used in any given program unit.
4428 @item @emph{Standard}:
4429 GNU extension
4431 @item @emph{Class}:
4432 Subroutine, function
4434 @item @emph{Syntax}:
4435 @multitable @columnfractions .80
4436 @item @code{CALL HOSTNM(NAME, STATUS)}
4437 @item @code{STATUS = HOSTNM(NAME)}
4438 @end multitable
4440 @item @emph{Arguments}:
4441 @multitable @columnfractions .15 .80
4442 @item @var{NAME}    @tab Shall of type @code{CHARACTER(*)}.
4443 @item @var{STATUS}  @tab (Optional) status flag of type @code{INTEGER}.
4444                          Returns 0 on success, or a system specific error
4445                          code otherwise.
4446 @end multitable
4448 @item @emph{Return value}:
4449 In either syntax, @var{NAME} is set to the current hostname if it can
4450 be obtained, or to a blank string otherwise.
4452 @end table
4456 @node HUGE
4457 @section @code{HUGE} --- Largest number of a kind
4458 @cindex @code{HUGE} intrinsic
4459 @cindex huge
4461 @table @asis
4462 @item @emph{Description}:
4463 @code{HUGE(X)} returns the largest number that is not an infinity in
4464 the model of the type of @code{X}.
4466 @item @emph{Standard}:
4467 F95 and later
4469 @item @emph{Class}:
4470 Elemental function
4472 @item @emph{Syntax}:
4473 @code{Y = HUGE(X)}
4475 @item @emph{Arguments}:
4476 @multitable @columnfractions .15 .80
4477 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
4478 @end multitable
4480 @item @emph{Return value}:
4481 The return value is of the same type and kind as @var{X}
4483 @item @emph{Example}:
4484 @smallexample
4485 program test_huge_tiny
4486   print *, huge(0), huge(0.0), huge(0.0d0)
4487   print *, tiny(0.0), tiny(0.0d0)
4488 end program test_huge_tiny
4489 @end smallexample
4490 @end table
4494 @node IACHAR
4495 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence 
4496 @cindex @code{IACHAR} intrinsic
4497 @cindex @acronym{ASCII} collating sequence
4498 @cindex conversion function (character)
4500 @table @asis
4501 @item @emph{Description}:
4502 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4503 in the first character position of @code{C}.
4505 @item @emph{Standard}:
4506 F95 and later
4508 @item @emph{Class}:
4509 Elemental function
4511 @item @emph{Syntax}:
4512 @code{I = IACHAR(C)}
4514 @item @emph{Arguments}:
4515 @multitable @columnfractions .15 .80
4516 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4517 @end multitable
4519 @item @emph{Return value}:
4520 The return value is of type @code{INTEGER} and of the default integer
4521 kind.
4523 @item @emph{Example}:
4524 @smallexample
4525 program test_iachar
4526   integer i
4527   i = iachar(' ')
4528 end program test_iachar
4529 @end smallexample
4531 @item @emph{See also}:
4532 @ref{CHAR},@ref{ICHAR}
4534 @end table
4537 @node IAND
4538 @section @code{IAND} --- Bitwise logical and
4539 @cindex @code{IAND} intrinsic
4540 @cindex bit operations
4542 @table @asis
4543 @item @emph{Description}:
4544 Bitwise logical @code{AND}.
4546 @item @emph{Standard}:
4547 F95 and later
4549 @item @emph{Class}:
4550 Elemental function
4552 @item @emph{Syntax}:
4553 @code{RESULT = IAND(I, J)}
4555 @item @emph{Arguments}:
4556 @multitable @columnfractions .15 .80
4557 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4558 @item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
4559 kind as @var{I}.  (As a GNU extension, different kinds are also 
4560 permitted.)
4561 @end multitable
4563 @item @emph{Return value}:
4564 The return type is @code{INTEGER(*)}, of the same kind as the
4565 arguments.  (If the argument kinds differ, it is of the same kind as
4566 the larger argument.)
4568 @item @emph{Example}:
4569 @smallexample
4570 PROGRAM test_iand
4571   INTEGER :: a, b
4572   DATA a / Z'F' /, b / Z'3' /
4573   WRITE (*,*) IAND(a, b)
4574 END PROGRAM
4575 @end smallexample
4577 @item @emph{See also}:
4578 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4579 @end table
4583 @node IARGC
4584 @section @code{IARGC} --- Get the number of command line arguments
4585 @cindex @code{IARGC} intrinsic
4586 @cindex command-line arguments, to program
4588 @table @asis
4589 @item @emph{Description}:
4590 @code{IARGC()} returns the number of arguments passed on the
4591 command line when the containing program was invoked.
4593 This intrinsic routine is provided for backwards compatibility with 
4594 GNU Fortran 77.  In new code, programmers should consider the use of 
4595 the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003 
4596 standard.
4598 @item @emph{Standard}:
4599 GNU extension
4601 @item @emph{Class}:
4602 Non-elemental Function
4604 @item @emph{Syntax}:
4605 @code{I = IARGC()}
4607 @item @emph{Arguments}:
4608 None.
4610 @item @emph{Return value}:
4611 The number of command line arguments, type @code{INTEGER(4)}.
4613 @item @emph{Example}:
4614 See @ref{GETARG}
4616 @item @emph{See also}:
4617 GNU Fortran 77 compatibility subroutine: @ref{GETARG}
4619 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT},
4620 @ref{COMMAND_ARGUMENT_COUNT}
4621 @end table
4625 @node IBCLR
4626 @section @code{IBCLR} --- Clear bit
4627 @cindex @code{IBCLR} intrinsic
4628 @cindex bit operations
4630 @table @asis
4631 @item @emph{Description}:
4632 @code{IBCLR} returns the value of @var{I} with the bit at position
4633 @var{POS} set to zero.
4635 @item @emph{Standard}:
4636 F95 and later
4638 @item @emph{Class}:
4639 Elemental function
4641 @item @emph{Syntax}:
4642 @code{RESULT = IBCLR(I, POS)}
4644 @item @emph{Arguments}:
4645 @multitable @columnfractions .15 .80
4646 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4647 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4648 @end multitable
4650 @item @emph{Return value}:
4651 The return value is of type @code{INTEGER(*)} and of the same kind as
4652 @var{I}.
4654 @item @emph{See also}:
4655 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4656 @end table
4660 @node IBITS
4661 @section @code{IBITS} --- Bit extraction
4662 @cindex @code{IBITS} intrinsic
4663 @cindex bit operations
4665 @table @asis
4666 @item @emph{Description}:
4667 @code{IBITS} extracts a field of length @var{LEN} from @var{I},
4668 starting from bit position @var{POS} and extending left for @var{LEN}
4669 bits.  The result is right-justified and the remaining bits are
4670 zeroed.  The value of @code{POS+LEN} must be less than or equal to the
4671 value @code{BIT_SIZE(I)}.
4673 @item @emph{Standard}:
4674 F95 and later
4676 @item @emph{Class}:
4677 Elemental function
4679 @item @emph{Syntax}:
4680 @code{RESULT = IBITS(I, POS, LEN)}
4682 @item @emph{Arguments}:
4683 @multitable @columnfractions .15 .80
4684 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4685 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4686 @item @var{LEN} @tab The type shall be @code{INTEGER(*)}.
4687 @end multitable
4689 @item @emph{Return value}:
4690 The return value is of type @code{INTEGER(*)} and of the same kind as
4691 @var{I}.
4693 @item @emph{See also}:
4694 @ref{BIT_SIZE}, @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4695 @end table
4699 @node IBSET
4700 @section @code{IBSET} --- Set bit
4701 @cindex @code{IBSET} intrinsic
4702 @cindex bit operations
4704 @table @asis
4705 @item @emph{Description}:
4706 @code{IBSET} returns the value of @var{I} with the bit at position
4707 @var{POS} set to one.
4709 @item @emph{Standard}:
4710 F95 and later
4712 @item @emph{Class}:
4713 Elemental function
4715 @item @emph{Syntax}:
4716 @code{RESULT = IBSET(I, POS)}
4718 @item @emph{Arguments}:
4719 @multitable @columnfractions .15 .80
4720 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4721 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4722 @end multitable
4724 @item @emph{Return value}:
4725 The return value is of type @code{INTEGER(*)} and of the same kind as
4726 @var{I}.
4728 @item @emph{See also}:
4729 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4730 @end table
4734 @node ICHAR
4735 @section @code{ICHAR} --- Character-to-integer conversion function
4736 @cindex @code{ICHAR} intrinsic
4737 @cindex conversion function (character)
4739 @table @asis
4740 @item @emph{Description}:
4741 @code{ICHAR(C)} returns the code for the character in the first character
4742 position of @code{C} in the system's native character set.
4743 The correspondence between characters and their codes is not necessarily
4744 the same across different GNU Fortran implementations.
4746 @item @emph{Standard}:
4747 F95 and later
4749 @item @emph{Class}:
4750 Elemental function
4752 @item @emph{Syntax}:
4753 @code{I = ICHAR(C)}
4755 @item @emph{Arguments}:
4756 @multitable @columnfractions .15 .80
4757 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4758 @end multitable
4760 @item @emph{Return value}:
4761 The return value is of type @code{INTEGER} and of the default integer
4762 kind.
4764 @item @emph{Example}:
4765 @smallexample
4766 program test_ichar
4767   integer i
4768   i = ichar(' ')
4769 end program test_ichar
4770 @end smallexample
4772 @item @emph{Note}:
4773 No intrinsic exists to convert a printable character string to a numerical
4774 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4775 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4776 value 154.
4778 Instead, you can use internal-file I/O to do this kind of conversion. For
4779 example:
4780 @smallexample
4781 program read_val
4782   integer value
4783   character(len=10) string
4785   string = '154'
4786   read (string,'(I10)') value
4787   print *, value
4788 end program read_val
4789 @end smallexample
4790 @end table
4792 @node IDATE
4793 @section @code{IDATE} --- Get current local time subroutine (day/month/year) 
4794 @cindex @code{IDATE} intrinsic
4796 @table @asis
4797 @item @emph{Description}:
4798 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the  
4799 current local time. The day (in the range 1-31), month (in the range 1-12), 
4800 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively. 
4801 The year has four significant digits.
4803 @item @emph{Standard}:
4804 GNU extension
4806 @item @emph{Class}:
4807 Subroutine
4809 @item @emph{Syntax}:
4810 @code{CALL IDATE(TARRAY)}
4812 @item @emph{Arguments}:
4813 @multitable @columnfractions .15 .80
4814 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4815 the kind shall be the default integer kind.
4816 @end multitable
4818 @item @emph{Return value}:
4819 Does not return.
4821 @item @emph{Example}:
4822 @smallexample
4823 program test_idate
4824   integer, dimension(3) :: tarray
4825   call idate(tarray)
4826   print *, tarray(1)
4827   print *, tarray(2)
4828   print *, tarray(3)
4829 end program test_idate
4830 @end smallexample
4831 @end table
4835 @node IEOR
4836 @section @code{IEOR} --- Bitwise logical exclusive or
4837 @cindex @code{IEOR} intrinsic
4838 @cindex bit operations
4840 @table @asis
4841 @item @emph{Description}:
4842 @code{IEOR} returns the bitwise boolean exclusive-OR of @var{I} and
4843 @var{J}.
4845 @item @emph{Standard}:
4846 F95 and later
4848 @item @emph{Class}:
4849 Elemental function
4851 @item @emph{Syntax}:
4852 @code{RESULT = IEOR(I, J)}
4854 @item @emph{Arguments}:
4855 @multitable @columnfractions .15 .80
4856 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4857 @item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
4858 kind as @var{I}.  (As a GNU extension, different kinds are also 
4859 permitted.)
4860 @end multitable
4862 @item @emph{Return value}:
4863 The return type is @code{INTEGER(*)}, of the same kind as the
4864 arguments.  (If the argument kinds differ, it is of the same kind as
4865 the larger argument.)
4867 @item @emph{See also}:
4868 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4869 @end table
4873 @node IERRNO
4874 @section @code{IERRNO} --- Get the last system error number
4875 @cindex @code{IERRNO} intrinsic
4877 @table @asis
4878 @item @emph{Description}:
4879 Returns the last system error number, as given by the C @code{errno()}
4880 function.
4882 @item @emph{Standard}:
4883 GNU extension
4885 @item @emph{Class}:
4886 Elemental function
4888 @item @emph{Syntax}:
4889 @code{I = IERRNO()}
4891 @item @emph{Arguments}:
4892 None.
4894 @item @emph{Return value}:
4895 The return value is of type @code{INTEGER} and of the default integer
4896 kind.
4898 @item @emph{See also}:
4899 @ref{PERROR}
4900 @end table
4904 @node INDEX
4905 @section @code{INDEX} --- Position of a substring within a string
4906 @cindex @code{INDEX} intrinsic
4908 @table @asis
4909 @item @emph{Description}:
4910 Returns the position of the start of the first occurrence of string
4911 @var{SUBSTRING} as a substring in @var{STRING}, counting from one.  If
4912 @var{SUBSTRING} is not present in @var{STRING}, zero is returned.  If 
4913 the @var{BACK} argument is present and true, the return value is the
4914 start of the last occurrence rather than the first.
4916 @item @emph{Standard}:
4917 F77 and later
4919 @item @emph{Class}:
4920 Elemental function
4922 @item @emph{Syntax}:
4923 @code{I = INDEX(STRING, SUBSTRING [, BACK])}
4925 @item @emph{Arguments}:
4926 @multitable @columnfractions .15 .80
4927 @item @var{STRING} @tab Shall be a scalar @code{CHARACTER(*)}, with
4928 @code{INTENT(IN)}
4929 @item @var{SUBSTRING} @tab Shall be a scalar @code{CHARACTER(*)}, with
4930 @code{INTENT(IN)}
4931 @item @var{BACK} @tab (Optional) Shall be a scalar @code{LOGICAL(*)}, with
4932 @code{INTENT(IN)}
4933 @end multitable
4935 @item @emph{Return value}:
4936 The return value is of type @code{INTEGER} and of the default integer
4937 kind.
4939 @item @emph{See also}:
4940 @end table
4944 @node INT
4945 @section @code{INT} --- Convert to integer type
4946 @cindex @code{INT} intrinsic
4947 @cindex @code{IFIX} intrinsic
4948 @cindex @code{IDINT} intrinsic
4949 @cindex conversion function (integer)
4951 @table @asis
4952 @item @emph{Description}:
4953 Convert to integer type
4955 @item @emph{Standard}:
4956 F77 and later
4958 @item @emph{Class}:
4959 Elemental function
4961 @item @emph{Syntax}:
4962 @multitable @columnfractions .30 .80
4963 @item @code{X = INT(X)}
4964 @item @code{X = INT(X, KIND)}
4965 @end multitable
4967 @item @emph{Arguments}:
4968 @multitable @columnfractions .15 .80
4969 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or
4970 @code{COMPLEX(*)} @item @var{KIND}  @tab (Optional) @var{KIND} shall be
4971 a scalar integer.
4972 @end multitable
4974 @item @emph{Return value}:
4975 These functions return a @code{INTEGER(*)} variable or array under 
4976 the following rules: 
4978 @table @asis
4979 @item (A)
4980 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X} 
4981 @item (B)
4982 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}. 
4983 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed 
4984 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4985 @item (C)
4986 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4987 @end table
4989 @item @emph{Example}:
4990 @smallexample
4991 program test_int
4992   integer :: i = 42
4993   complex :: z = (-3.7, 1.0)
4994   print *, int(i)
4995   print *, int(z), int(z,8)
4996 end program
4997 @end smallexample
4999 @item @emph{Specific names}:
5000 @multitable @columnfractions .20 .20 .20 .40
5001 @item Name             @tab Argument            @tab Return type       @tab Standard
5002 @item @code{IFIX(X)}   @tab @code{REAL(4) X}    @tab @code{INTEGER}    @tab F77 and later
5003 @item @code{IDINT(X)}  @tab @code{REAL(8) X}    @tab @code{INTEGER}    @tab F77 and later
5004 @end multitable
5006 @comment @item @emph{See also}:
5007 @end table
5011 @node IOR
5012 @section @code{IOR} --- Bitwise logical or
5013 @cindex @code{IOR} intrinsic
5014 @cindex bit operations
5016 @table @asis
5017 @item @emph{Description}:
5018 @code{IEOR} returns the bitwise boolean OR of @var{I} and
5019 @var{J}.
5021 @item @emph{Standard}:
5022 F95 and later
5024 @item @emph{Class}:
5025 Elemental function
5027 @item @emph{Syntax}:
5028 @code{RESULT = IEOR(I, J)}
5030 @item @emph{Arguments}:
5031 @multitable @columnfractions .15 .80
5032 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
5033 @item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
5034 kind as @var{I}.  (As a GNU extension, different kinds are also 
5035 permitted.)
5036 @end multitable
5038 @item @emph{Return value}:
5039 The return type is @code{INTEGER(*)}, of the same kind as the
5040 arguments.  (If the argument kinds differ, it is of the same kind as
5041 the larger argument.)
5043 @item @emph{See also}:
5044 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
5045 @end table
5050 @node IRAND
5051 @section @code{IRAND} --- Integer pseudo-random number
5052 @cindex @code{IRAND} intrinsic
5053 @cindex random numbers
5055 @table @asis
5056 @item @emph{Description}:
5057 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
5058 distribution between 0 and a system-dependent limit (which is in most
5059 cases 2147483647). If @var{FLAG} is 0, the next number
5060 in the current sequence is returned; if @var{FLAG} is 1, the generator
5061 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
5062 it is used as a new seed with @code{SRAND}.
5064 @item @emph{Standard}:
5065 GNU extension
5067 @item @emph{Class}:
5068 non-elemental function
5070 @item @emph{Syntax}:
5071 @code{I = IRAND(FLAG)}
5073 @item @emph{Arguments}:
5074 @multitable @columnfractions .15 .80
5075 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
5076 @end multitable
5078 @item @emph{Return value}:
5079 The return value is of @code{INTEGER(kind=4)} type.
5081 @item @emph{Example}:
5082 @smallexample
5083 program test_irand
5084   integer,parameter :: seed = 86456
5085   
5086   call srand(seed)
5087   print *, irand(), irand(), irand(), irand()
5088   print *, irand(seed), irand(), irand(), irand()
5089 end program test_irand
5090 @end smallexample
5092 @end table
5096 @node ISHFT
5097 @section @code{ISHFT} --- Shift bits
5098 @cindex @code{ISHFT} intrinsic
5099 @cindex bit operations
5101 @table @asis
5102 @item @emph{Description}:
5103 @code{ISHFT} returns a value corresponding to @var{I} with all of the
5104 bits shifted @var{SHIFT} places.  A value of @var{SHIFT} greater than
5105 zero corresponds to a left shift, a value of zero corresponds to no
5106 shift, and a value less than zero corresponds to a right shift.  If the
5107 absolute value of @var{SHIFT} is greater than @code{BIT_SIZE(I)}, the
5108 value is undefined.  Bits shifted out from the left end or right end are
5109 lost; zeros are shifted in from the opposite end.
5111 @item @emph{Standard}:
5112 F95 and later
5114 @item @emph{Class}:
5115 Elemental function
5117 @item @emph{Syntax}:
5118 @code{RESULT = ISHFT(I, SHIFT)}
5120 @item @emph{Arguments}:
5121 @multitable @columnfractions .15 .80
5122 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
5123 @item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5124 @end multitable
5126 @item @emph{Return value}:
5127 The return value is of type @code{INTEGER(*)} and of the same kind as
5128 @var{I}.
5130 @item @emph{See also}:
5131 @ref{ISHFTC}
5132 @end table
5137 @node ISHFTC
5138 @section @code{ISHFTC} --- Shift bits circularly
5139 @cindex @code{ISHFTC} intrinsic
5140 @cindex bit operations
5142 @table @asis
5143 @item @emph{Description}:
5144 @code{ISHFTC} returns a value corresponding to @var{I} with the
5145 rightmost @var{SIZE} bits shifted circularly @var{SHIFT} places; that
5146 is, bits shifted out one end are shifted into the opposite end.  A value
5147 of @var{SHIFT} greater than zero corresponds to a left shift, a value of
5148 zero corresponds to no shift, and a value less than zero corresponds to
5149 a right shift.  The absolute value of @var{SHIFT} must be less than
5150 @var{SIZE}.  If the @var{SIZE} argument is omitted, it is taken to be
5151 equivalent to @code{BIT_SIZE(I)}.
5153 @item @emph{Standard}:
5154 F95 and later
5156 @item @emph{Class}:
5157 Elemental function
5159 @item @emph{Syntax}:
5160 @code{RESULT = ISHFTC(I, SHIFT [, SIZE])}
5162 @item @emph{Arguments}:
5163 @multitable @columnfractions .15 .80
5164 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
5165 @item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5166 @item @var{SIZE} @tab (Optional) The type shall be @code{INTEGER(*)};
5167 the value must be greater than zero and less than or equal to
5168 @code{BIT_SIZE(I)}.
5169 @end multitable
5171 @item @emph{Return value}:
5172 The return value is of type @code{INTEGER(*)} and of the same kind as
5173 @var{I}.
5175 @item @emph{See also}:
5176 @ref{ISHFT}
5177 @end table
5181 @node ITIME
5182 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds) 
5183 @cindex @code{ITIME} intrinsic
5185 @table @asis
5186 @item @emph{Description}:
5187 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the  
5188 current local time. The hour (in the range 1-24), minute (in the range 1-60), 
5189 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY}, 
5190 respectively.
5192 @item @emph{Standard}:
5193 GNU extension
5195 @item @emph{Class}:
5196 Subroutine
5198 @item @emph{Syntax}:
5199 @code{CALL ITIME(TARRAY)}
5201 @item @emph{Arguments}:
5202 @multitable @columnfractions .15 .80
5203 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
5204 and the kind shall be the default integer kind.
5205 @end multitable
5207 @item @emph{Return value}:
5208 Does not return.
5211 @item @emph{Example}:
5212 @smallexample
5213 program test_itime
5214   integer, dimension(3) :: tarray
5215   call itime(tarray)
5216   print *, tarray(1)
5217   print *, tarray(2)
5218   print *, tarray(3)
5219 end program test_itime
5220 @end smallexample
5221 @end table
5225 @node KILL
5226 @section @code{KILL} --- Send a signal to a process
5227 @cindex @code{KILL} intrinsic
5229 @table @asis
5230 @item @emph{Description}:
5231 @item @emph{Standard}:
5232 Sends the signal specified by @var{SIGNAL} to the process @var{PID}.
5233 See @code{kill(2)}.
5235 @item @emph{Class}:
5236 Subroutine
5238 @item @emph{Syntax}:
5239 @code{CALL KILL(PID, SIGNAL [, STATUS])}
5241 @item @emph{Arguments}:
5242 @multitable @columnfractions .15 .80
5243 @item @var{PID} @tab Shall be a scalar @code{INTEGER}, with
5244 @code{INTENT(IN)}
5245 @item @var{SIGNAL} @tab Shall be a scalar @code{INTEGER}, with
5246 @code{INTENT(IN)}
5247 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)} or
5248                         @code{INTEGER(8)}. Returns 0 on success, or a
5249                         system-specific error code otherwise.
5250 @end multitable
5252 @item @emph{See also}:
5253 @ref{ABORT}, @ref{EXIT}
5254 @end table
5258 @node KIND
5259 @section @code{KIND} --- Kind of an entity
5260 @cindex @code{KIND} intrinsic
5262 @table @asis
5263 @item @emph{Description}:
5264 @code{KIND(X)} returns the kind value of the entity @var{X}.
5266 @item @emph{Standard}:
5267 F95 and later
5269 @item @emph{Class}:
5270 Inquiry function
5272 @item @emph{Syntax}:
5273 @code{K = KIND(X)}
5275 @item @emph{Arguments}:
5276 @multitable @columnfractions .15 .80
5277 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
5278 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
5279 @end multitable
5281 @item @emph{Return value}:
5282 The return value is a scalar of type @code{INTEGER} and of the default
5283 integer kind.
5285 @item @emph{Example}:
5286 @smallexample
5287 program test_kind
5288   integer,parameter :: kc = kind(' ')
5289   integer,parameter :: kl = kind(.true.)
5291   print *, "The default character kind is ", kc
5292   print *, "The default logical kind is ", kl
5293 end program test_kind
5294 @end smallexample
5296 @end table
5300 @node LBOUND
5301 @section @code{LBOUND} --- Lower dimension bounds of an array
5302 @cindex @code{LBOUND} intrinsic
5304 @table @asis
5305 @item @emph{Description}:
5306 Returns the lower bounds of an array, or a single lower bound
5307 along the @var{DIM} dimension.
5308 @item @emph{Standard}:
5309 F95 and later
5311 @item @emph{Class}:
5312 Inquiry function
5314 @item @emph{Syntax}:
5315 @code{I = LBOUND(ARRAY [, DIM])}
5317 @item @emph{Arguments}:
5318 @multitable @columnfractions .15 .80
5319 @item @var{ARRAY} @tab Shall be an array, of any type.
5320 @item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER(*)}.
5321 @end multitable
5323 @item @emph{Return value}:
5324 If @var{DIM} is absent, the result is an array of the lower bounds of
5325 @var{ARRAY}.  If @var{DIM} is present, the result is a scalar
5326 corresponding to the lower bound of the array along that dimension.  If
5327 @var{ARRAY} is an expression rather than a whole array or array
5328 structure component, or if it has a zero extent along the relevant
5329 dimension, the lower bound is taken to be 1.
5331 @item @emph{See also}:
5332 @ref{UBOUND}
5333 @end table
5337 @node LEN
5338 @section @code{LEN} --- Length of a character entity
5339 @cindex @code{LEN} intrinsic
5341 @table @asis
5342 @item @emph{Description}:
5343 Returns the length of a character string.  If @var{STRING} is an array,
5344 the length of an element of @var{STRING} is returned.  Note that
5345 @var{STRING} need not be defined when this intrinsic is invoked, since
5346 only the length, not the content, of @var{STRING} is needed.
5348 @item @emph{Standard}:
5349 F77 and later
5351 @item @emph{Class}:
5352 Inquiry function
5354 @item @emph{Syntax}:
5355 @code{L = LEN(STRING)}
5357 @item @emph{Arguments}:
5358 @multitable @columnfractions .15 .80
5359 @item @var{STRING} @tab Shall be a scalar or array of type
5360 @code{CHARACTER(*)}, with @code{INTENT(IN)}
5361 @end multitable
5363 @item @emph{Return value}:
5364 The return value is an @code{INTEGER} of the default kind.
5366 @item @emph{See also}:
5367 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
5368 @end table
5372 @node LEN_TRIM
5373 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
5374 @cindex @code{LEN_TRIM} intrinsic
5376 @table @asis
5377 @item @emph{Description}:
5378 Returns the length of a character string, ignoring any trailing blanks.
5380 @item @emph{Standard}:
5381 F95 and later
5383 @item @emph{Class}:
5384 Elemental function
5386 @item @emph{Syntax}:
5387 @code{L = LEN_TRIM(STRING)}
5389 @item @emph{Arguments}:
5390 @multitable @columnfractions .15 .80
5391 @item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER(*)},
5392 with @code{INTENT(IN)}
5393 @end multitable
5395 @item @emph{Return value}:
5396 The return value is of @code{INTEGER(kind=4)} type.
5398 @item @emph{See also}:
5399 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
5400 @end table
5404 @node LGE
5405 @section @code{LGE} --- Lexical greater than or equal
5406 @cindex @code{LGE} intrinsic
5407 @cindex comparison (lexical)
5408 @cindex lexical comparison
5410 @table @asis
5411 @item @emph{Description}:
5412 Determines whether one string is lexically greater than or equal to
5413 another string, where the two strings are interpreted as containing
5414 ASCII character codes.  If the String A and String B are not the same
5415 length, the shorter is compared as if spaces were appended to it to form
5416 a value that has the same length as the longer.
5418 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5419 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5420 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5421 that the latter use the processor's character ordering (which is not
5422 ASCII on some targets), whereas the former always use the ASCII
5423 ordering.
5425 @item @emph{Standard}:
5426 F77 and later
5428 @item @emph{Class}:
5429 Elemental function
5431 @item @emph{Syntax}:
5432 @code{L = LGE(STRING_A, STRING_B)}
5434 @item @emph{Arguments}:
5435 @multitable @columnfractions .15 .80
5436 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5437 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5438 @end multitable
5440 @item @emph{Return value}:
5441 Returns @code{.TRUE.} if @code{STRING_A >= STRING_B}, and @code{.FALSE.}
5442 otherwise, based on the ASCII ordering.
5444 @item @emph{See also}:
5445 @ref{LGT}, @ref{LLE}, @ref{LLT}
5446 @end table
5450 @node LGT
5451 @section @code{LGT} --- Lexical greater than
5452 @cindex @code{LGT} intrinsic
5453 @cindex comparison (lexical)
5454 @cindex lexical comparison
5456 @table @asis
5457 @item @emph{Description}:
5458 Determines whether one string is lexically greater than another string,
5459 where the two strings are interpreted as containing ASCII character
5460 codes.  If the String A and String B are not the same length, the
5461 shorter is compared as if spaces were appended to it to form a value
5462 that has the same length as the longer.
5464 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5465 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5466 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5467 that the latter use the processor's character ordering (which is not
5468 ASCII on some targets), whereas the former always use the ASCII
5469 ordering.
5471 @item @emph{Standard}:
5472 F77 and later
5474 @item @emph{Class}:
5475 Elemental function
5477 @item @emph{Syntax}:
5478 @code{L = LGT(STRING_A, STRING_B)}
5480 @item @emph{Arguments}:
5481 @multitable @columnfractions .15 .80
5482 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5483 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5484 @end multitable
5486 @item @emph{Return value}:
5487 Returns @code{.TRUE.} if @code{STRING_A > STRING_B}, and @code{.FALSE.}
5488 otherwise, based on the ASCII ordering.
5490 @item @emph{See also}:
5491 @ref{LGE}, @ref{LLE}, @ref{LLT}
5492 @end table
5496 @node LINK
5497 @section @code{LINK} --- Create a hard link
5498 @cindex @code{LINK} intrinsic
5499 @cindex file system operations
5501 @table @asis
5502 @item @emph{Description}:
5503 Makes a (hard) link from file @var{PATH1} to @var{PATH2}. A null
5504 character (@code{CHAR(0)}) can be used to mark the end of the names in
5505 @var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
5506 names are ignored.  If the @var{STATUS} argument is supplied, it
5507 contains 0 on success or a nonzero error code upon return; see
5508 @code{link(2)}.
5510 @item @emph{Standard}:
5511 GNU extension
5513 @item @emph{Class}:
5514 Subroutine
5516 @item @emph{Syntax}:
5517 @code{CALL LINK(PATH1, PATH2 [, STATUS])}
5519 @item @emph{Arguments}:
5520 @multitable @columnfractions .15 .80
5521 @item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
5522 @item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
5523 @item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
5524 @end multitable
5526 @item @emph{See also}:
5527 @ref{UNLINK}
5528 @end table
5532 @node LLE
5533 @section @code{LLE} --- Lexical less than or equal
5534 @cindex @code{LLE} intrinsic
5535 @cindex comparison (lexical)
5536 @cindex lexical comparison
5538 @table @asis
5539 @item @emph{Description}:
5540 Determines whether one string is lexically less than or equal to another
5541 string, where the two strings are interpreted as containing ASCII
5542 character codes.  If the String A and String B are not the same length,
5543 the shorter is compared as if spaces were appended to it to form a value
5544 that has the same length as the longer.
5546 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5547 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5548 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5549 that the latter use the processor's character ordering (which is not
5550 ASCII on some targets), whereas the former always use the ASCII
5551 ordering.
5553 @item @emph{Standard}:
5554 F77 and later
5556 @item @emph{Class}:
5557 Elemental function
5559 @item @emph{Syntax}:
5560 @code{L = LLE(STRING_A, STRING_B)}
5562 @item @emph{Arguments}:
5563 @multitable @columnfractions .15 .80
5564 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5565 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5566 @end multitable
5568 @item @emph{Return value}:
5569 Returns @code{.TRUE.} if @code{STRING_A <= STRING_B}, and @code{.FALSE.}
5570 otherwise, based on the ASCII ordering.
5572 @item @emph{See also}:
5573 @ref{LGE}, @ref{LGT}, @ref{LLT}
5574 @end table
5578 @node LLT
5579 @section @code{LLT} --- Lexical less than
5580 @cindex @code{LLT} intrinsic
5581 @cindex comparison (lexical)
5582 @cindex lexical comparison
5584 Intrinsic implemented, documentation pending.
5586 @table @asis
5587 @item @emph{Description}:
5588 Determines whether one string is lexically less than another string,
5589 where the two strings are interpreted as containing ASCII character
5590 codes.  If the String A and String B are not the same length, the
5591 shorter is compared as if spaces were appended to it to form a value
5592 that has the same length as the longer.
5594 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5595 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5596 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5597 that the latter use the processor's character ordering (which is not
5598 ASCII on some targets), whereas the former always use the ASCII
5599 ordering.
5601 @item @emph{Standard}:
5602 F77 and later
5604 @item @emph{Class}:
5605 Elemental function
5607 @item @emph{Syntax}:
5608 @code{L = LLT(STRING_A, STRING_B)}
5610 @item @emph{Arguments}:
5611 @multitable @columnfractions .15 .80
5612 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5613 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5614 @end multitable
5616 @item @emph{Return value}:
5617 Returns @code{.TRUE.} if @code{STRING_A < STRING_B}, and @code{.FALSE.}
5618 otherwise, based on the ASCII ordering.
5620 @item @emph{See also}:
5621 @ref{LGE}, @ref{LGT}, @ref{LLE}
5622 @end table
5626 @node LNBLNK
5627 @section @code{LNBLNK} --- Index of the last non-blank character in a string
5628 @cindex @code{LNBLNK} intrinsic
5630 @table @asis
5631 @item @emph{Description}:
5632 Returns the length of a character string, ignoring any trailing blanks.
5633 This is identical to the standard @code{LEN_TRIM} intrinsic, and is only
5634 included for backwards compatibility.
5636 @item @emph{Standard}:
5637 GNU extension
5639 @item @emph{Class}:
5640 Elemental function
5642 @item @emph{Syntax}:
5643 @code{L = LNBLNK(STRING)}
5645 @item @emph{Arguments}:
5646 @multitable @columnfractions .15 .80
5647 @item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER(*)},
5648 with @code{INTENT(IN)}
5649 @end multitable
5651 @item @emph{Return value}:
5652 The return value is of @code{INTEGER(kind=4)} type.
5654 @item @emph{See also}:
5655 @ref{INDEX}, @ref{LEN_TRIM}
5656 @end table
5660 @node LOC
5661 @section @code{LOC} --- Returns the address of a variable
5662 @cindex @code{LOC} intrinsic
5663 @cindex location of a variable in memory
5665 @table @asis
5666 @item @emph{Description}:
5667 @code{LOC(X)} returns the address of @var{X} as an integer.
5669 @item @emph{Standard}:
5670 GNU extension
5672 @item @emph{Class}:
5673 Inquiry function
5675 @item @emph{Syntax}:
5676 @code{I = LOC(X)}
5678 @item @emph{Arguments}:
5679 @multitable @columnfractions .15 .80
5680 @item @var{X} @tab Variable of any type.
5681 @end multitable
5683 @item @emph{Return value}:
5684 The return value is of type @code{INTEGER}, with a @code{KIND}
5685 corresponding to the size (in bytes) of a memory address on the target
5686 machine.
5688 @item @emph{Example}:
5689 @smallexample
5690 program test_loc
5691   integer :: i
5692   real :: r
5693   i = loc(r)
5694   print *, i
5695 end program test_loc
5696 @end smallexample
5697 @end table
5701 @node LOG
5702 @section @code{LOG} --- Logarithm function
5703 @cindex @code{LOG} intrinsic
5704 @cindex @code{ALOG} intrinsic
5705 @cindex @code{DLOG} intrinsic
5706 @cindex @code{CLOG} intrinsic
5707 @cindex @code{ZLOG} intrinsic
5708 @cindex @code{CDLOG} intrinsic
5709 @cindex logarithm
5711 @table @asis
5712 @item @emph{Description}:
5713 @code{LOG(X)} computes the logarithm of @var{X}.
5715 @item @emph{Standard}:
5716 F77 and later
5718 @item @emph{Class}:
5719 Elemental function
5721 @item @emph{Syntax}:
5722 @code{X = LOG(X)}
5724 @item @emph{Arguments}:
5725 @multitable @columnfractions .15 .80
5726 @item @var{X} @tab The type shall be @code{REAL(*)} or
5727 @code{COMPLEX(*)}.
5728 @end multitable
5730 @item @emph{Return value}:
5731 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5732 The kind type parameter is the same as @var{X}.
5734 @item @emph{Example}:
5735 @smallexample
5736 program test_log
5737   real(8) :: x = 1.0_8
5738   complex :: z = (1.0, 2.0)
5739   x = log(x)
5740   z = log(z)
5741 end program test_log
5742 @end smallexample
5744 @item @emph{Specific names}:
5745 @multitable @columnfractions .20 .20 .20 .40
5746 @item Name            @tab Argument          @tab Return type       @tab Standard
5747 @item @code{ALOG(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab f95, gnu
5748 @item @code{DLOG(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
5749 @item @code{CLOG(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
5750 @item @code{ZLOG(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
5751 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
5752 @end multitable
5753 @end table
5757 @node LOG10
5758 @section @code{LOG10} --- Base 10 logarithm function
5759 @cindex @code{LOG10} intrinsic
5760 @cindex @code{ALOG10} intrinsic
5761 @cindex @code{DLOG10} intrinsic
5762 @cindex logarithm
5764 @table @asis
5765 @item @emph{Description}:
5766 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5768 @item @emph{Standard}:
5769 F77 and later
5771 @item @emph{Class}:
5772 Elemental function
5774 @item @emph{Syntax}:
5775 @code{X = LOG10(X)}
5777 @item @emph{Arguments}:
5778 @multitable @columnfractions .15 .80
5779 @item @var{X} @tab The type shall be @code{REAL(*)} or
5780 @code{COMPLEX(*)}.
5781 @end multitable
5783 @item @emph{Return value}:
5784 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5785 The kind type parameter is the same as @var{X}.
5787 @item @emph{Example}:
5788 @smallexample
5789 program test_log10
5790   real(8) :: x = 10.0_8
5791   x = log10(x)
5792 end program test_log10
5793 @end smallexample
5795 @item @emph{Specific names}:
5796 @multitable @columnfractions .20 .20 .20 .40
5797 @item Name            @tab Argument          @tab Return type       @tab Standard
5798 @item @code{ALOG10(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab F95 and later
5799 @item @code{DLOG10(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
5800 @end multitable
5801 @end table
5805 @node LOGICAL
5806 @section @code{LOGICAL} --- Convert to logical type
5807 @cindex @code{LOGICAL} intrinsic
5808 @cindex conversion function (logical)
5810 Intrinsic implemented, documentation pending.
5812 @table @asis
5813 @item @emph{Description}:
5814 @item @emph{Standard}:
5815 F95 and later
5817 @item @emph{Class}:
5818 Elemental function
5820 @item @emph{Syntax}:
5821 @item @emph{Arguments}:
5822 @item @emph{Return value}:
5823 @item @emph{Example}:
5824 @item @emph{Specific names}:
5825 @item @emph{See also}:
5826 @end table
5831 @node LSHIFT
5832 @section @code{LSHIFT} --- Left shift bits
5833 @cindex @code{LSHIFT} intrinsic
5834 @cindex bit operations
5836 Intrinsic implemented, documentation pending.
5838 @table @asis
5839 @item @emph{Description}:
5841 @item @emph{Standard}:
5842 GNU extension
5844 @item @emph{Class}:
5845 Function
5847 @item @emph{Syntax}:
5848 @item @emph{Arguments}:
5849 @item @emph{Return value}:
5850 @item @emph{Example}:
5851 @item @emph{Specific names}:
5852 @item @emph{See also}:
5854 @end table
5857 @node LSTAT
5858 @section @code{LSTAT} --- Get file status
5859 @cindex @code{LSTAT} intrinsic
5860 @cindex file system operations 
5862 @table @asis
5863 @item @emph{Description}:
5864 @code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link, 
5865 then the link itself is statted, not the file that it refers to.
5867 The elements in @code{BUFF} are the same as described by @ref{STAT}.
5869 @item @emph{Standard}:
5870 GNU extension
5872 @item @emph{Class}:
5873 Non-elemental subroutine
5875 @item @emph{Syntax}:
5876 @code{CALL LSTAT(FILE,BUFF[,STATUS])}
5878 @item @emph{Arguments}:
5879 @multitable @columnfractions .15 .80
5880 @item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
5881 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
5882 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
5883                         on success and a system specific error code otherwise.
5884 @end multitable
5886 @item @emph{Example}:
5887 See @ref{STAT} for an example.
5889 @item @emph{See also}:
5890 To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
5891 @end table
5895 @node LTIME
5896 @section @code{LTIME} --- Convert time to local time info
5897 @cindex @code{LTIME} intrinsic
5898 @cindex time, conversion function
5900 Intrinsic implemented, documentation pending.
5902 @table @asis
5903 @item @emph{Description}:
5905 @item @emph{Standard}:
5906 GNU extension
5908 @item @emph{Class}:
5909 Subroutine
5911 @item @emph{Syntax}:
5912 @item @emph{Arguments}:
5913 @item @emph{Return value}:
5914 @item @emph{Example}:
5915 @item @emph{Specific names}:
5916 @item @emph{See also}:
5918 @end table
5922 @node MALLOC
5923 @section @code{MALLOC} --- Allocate dynamic memory
5924 @cindex @code{MALLOC} intrinsic
5925 @cindex Cray pointers
5927 @table @asis
5928 @item @emph{Description}:
5929 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5930 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5931 is an extension intended to be used with Cray pointers, and is provided
5932 in GNU Fortran to allow the user to compile legacy code. For new code
5933 using Fortran 95 pointers, the memory allocation intrinsic is
5934 @code{ALLOCATE}.
5936 @item @emph{Standard}:
5937 GNU extension
5939 @item @emph{Class}:
5940 non-elemental function
5942 @item @emph{Syntax}:
5943 @code{PTR = MALLOC(SIZE)}
5945 @item @emph{Arguments}:
5946 @multitable @columnfractions .15 .80
5947 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5948 @end multitable
5950 @item @emph{Return value}:
5951 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5952 variables of type @code{INTEGER(K)} have the same size as
5953 C pointers (@code{sizeof(void *)}).
5955 @item @emph{Example}:
5956 The following example demonstrates the use of @code{MALLOC} and
5957 @code{FREE} with Cray pointers. This example is intended to run on
5958 32-bit systems, where the default integer kind is suitable to store
5959 pointers; on 64-bit systems, ptr_x would need to be declared as
5960 @code{integer(kind=8)}.
5962 @smallexample
5963 program test_malloc
5964   integer i
5965   integer ptr_x
5966   real*8 x(*), z
5967   pointer(ptr_x,x)
5969   ptr_x = malloc(20*8)
5970   do i = 1, 20
5971     x(i) = sqrt(1.0d0 / i)
5972   end do
5973   z = 0
5974   do i = 1, 20
5975     z = z + x(i)
5976     print *, z
5977   end do
5978   call free(ptr_x)
5979 end program test_malloc
5980 @end smallexample
5982 @item @emph{See also}:
5983 @ref{FREE}
5984 @end table
5987 @node MATMUL
5988 @section @code{MATMUL} --- matrix multiplication
5989 @cindex @code{MATMUL} intrinsic
5990 @cindex matrix operations
5992 Intrinsic implemented, documentation pending.
5994 @table @asis
5995 @item @emph{Description}:
5996 @item @emph{Standard}:
5997 F95 and later
5999 @item @emph{Class}:
6000 Transformational function
6002 @item @emph{Syntax}:
6003 @item @emph{Arguments}:
6004 @item @emph{Return value}:
6005 @item @emph{Example}:
6006 @item @emph{See also}:
6007 @end table
6010 @node MAX
6011 @section @code{MAX} --- Maximum value of an argument list
6012 @cindex @code{MAX} intrinsic
6013 @cindex undocumented intrinsic 
6015 Intrinsic implemented, documentation pending.
6017 @table @asis
6018 @item @emph{Description}:
6019 @item @emph{Standard}:
6020 F77 and later
6022 @item @emph{Class}:
6023 Elemental function
6025 @item @emph{Syntax}:
6026 @item @emph{Arguments}:
6027 @item @emph{Return value}:
6028 @item @emph{Example}:
6030 @item @emph{Specific names}:
6031 @multitable @columnfractions .20 .20 .20 .40
6032 @item Name             @tab Argument            @tab Return type         @tab Standard
6033 @item @code{MAX0(I)}   @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)}   @tab F77 and later
6034 @item @code{AMAX0(I)}  @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
6035 @item @code{MAX1(X)}   @tab @code{REAL(*) X}    @tab @code{INT(MAX(X))}  @tab F77 and later
6036 @item @code{AMAX1(X)}  @tab @code{REAL(4)    X} @tab @code{REAL(4)}      @tab F77 and later
6037 @item @code{DMAX1(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}      @tab F77 and later
6038 @end multitable
6040 @item @emph{See also}:
6041 @ref{MAXLOC} @ref{MAXVAL}
6042 @end table
6045 @node MAXEXPONENT
6046 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
6047 @cindex @code{MAXEXPONENT} intrinsic
6048 @cindex maximum exponent
6049 @cindex exponent, maximum
6051 @table @asis
6052 @item @emph{Description}:
6053 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
6054 type of @code{X}.
6056 @item @emph{Standard}:
6057 F95 and later
6059 @item @emph{Class}:
6060 Inquiry function
6062 @item @emph{Syntax}:
6063 @code{I = MAXEXPONENT(X)}
6065 @item @emph{Arguments}:
6066 @multitable @columnfractions .15 .80
6067 @item @var{X} @tab shall be of type @code{REAL}.
6068 @end multitable
6070 @item @emph{Return value}:
6071 The return value is of type @code{INTEGER} and of the default integer
6072 kind.
6074 @item @emph{Example}:
6075 @smallexample
6076 program exponents
6077   real(kind=4) :: x
6078   real(kind=8) :: y
6080   print *, minexponent(x), maxexponent(x)
6081   print *, minexponent(y), maxexponent(y)
6082 end program exponents
6083 @end smallexample
6084 @end table
6087 @node MAXLOC
6088 @section @code{MAXLOC} --- Location of the maximum value within an array
6089 @cindex @code{MAXLOC} intrinsic
6090 @cindex undocumented intrinsic 
6092 Intrinsic implemented, documentation pending.
6094 @table @asis
6095 @item @emph{Description}:
6096 @item @emph{Standard}:
6097 F95 and later
6099 @item @emph{Class}:
6100 Transformational function
6102 @item @emph{Syntax}:
6103 @item @emph{Arguments}:
6104 @item @emph{Return value}:
6105 @item @emph{Example}:
6106 @item @emph{See also}:
6107 @ref{MAX}, @ref{MAXVAL}
6108 @end table
6112 @node MAXVAL
6113 @section @code{MAXVAL} --- Maximum value of an array
6114 @cindex @code{MAXVAL} intrinsic
6115 @cindex undocumented intrinsic 
6117 Intrinsic implemented, documentation pending.
6119 @table @asis
6120 @item @emph{Description}:
6121 @item @emph{Standard}:
6124 @item @emph{Class}:
6125 Transformational function
6127 @item @emph{Syntax}:
6128 @item @emph{Arguments}:
6129 @item @emph{Return value}:
6130 @item @emph{Example}:
6131 @item @emph{Specific names}:
6133 @item @emph{See also}:
6134 @ref{MAX}, @ref{MAXLOC}
6135 @end table
6140 @node MERGE
6141 @section @code{MERGE} --- Merge arrays
6142 @cindex @code{MERGE} intrinsic
6143 @cindex undocumented intrinsic 
6145 Intrinsic implemented, documentation pending.
6147 @table @asis
6148 @item @emph{Description}:
6149 @item @emph{Standard}:
6150 F95 and later
6152 @item @emph{Class}:
6153 elemental function
6155 @item @emph{Syntax}:
6156 @item @emph{Arguments}:
6157 @item @emph{Return value}:
6158 @item @emph{Example}:
6159 @item @emph{Specific names}:
6160 @item @emph{See also}:
6161 @end table
6164 @node MIN
6165 @section @code{MIN} --- Minimum value of an argument list
6166 @cindex @code{MIN} intrinsic
6167 @cindex undocumented intrinsic 
6169 Intrinsic implemented, documentation pending.
6171 @table @asis
6172 @item @emph{Description}:
6173 @item @emph{Standard}:
6174 F77 and later
6176 @item @emph{Class}:
6177 Elemental function
6179 @item @emph{Syntax}:
6180 @item @emph{Arguments}:
6181 @item @emph{Return value}:
6182 @item @emph{Example}:
6184 @item @emph{Specific names}:
6185 @multitable @columnfractions .20 .20 .20 .40
6186 @item Name             @tab Argument            @tab Return type         @tab Standard
6187 @item @code{MIN0(I)}   @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)}   @tab F77 and later
6188 @item @code{AMIN0(I)}  @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
6189 @item @code{MIN1(X)}   @tab @code{REAL(*) X}    @tab @code{INT(MIN(X))}  @tab F77 and later
6190 @item @code{AMIN1(X)}  @tab @code{REAL(4)    X} @tab @code{REAL(4)}      @tab F77 and later
6191 @item @code{DMIN1(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}      @tab F77 and later
6192 @end multitable
6194 @item @emph{See also}:
6195 @ref{MINLOC}, @ref{MINVAL}
6196 @end table
6198 @node MINEXPONENT
6199 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
6200 @cindex @code{MINEXPONENT} intrinsic
6201 @cindex minimum exponent
6202 @cindex exponent, minimum
6204 @table @asis
6205 @item @emph{Description}:
6206 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
6207 type of @code{X}.
6209 @item @emph{Standard}:
6210 F95 and later
6212 @item @emph{Class}:
6213 Inquiry function
6215 @item @emph{Syntax}:
6216 @code{I = MINEXPONENT(X)}
6218 @item @emph{Arguments}:
6219 @multitable @columnfractions .15 .80
6220 @item @var{X} @tab shall be of type @code{REAL}.
6221 @end multitable
6223 @item @emph{Return value}:
6224 The return value is of type @code{INTEGER} and of the default integer
6225 kind.
6227 @item @emph{Example}:
6228 See @code{MAXEXPONENT} for an example.
6229 @end table
6232 @node MINLOC
6233 @section @code{MINLOC} --- Location of the minimum value within an array
6234 @cindex @code{MINLOC} intrinsic
6235 @cindex undocumented intrinsic 
6237 Intrinsic implemented, documentation pending.
6239 @table @asis
6240 @item @emph{Description}:
6241 @item @emph{Standard}:
6242 F95 and later
6244 @item @emph{Class}:
6245 Transformational function
6247 @item @emph{Syntax}:
6248 @item @emph{Arguments}:
6249 @item @emph{Return value}:
6250 @item @emph{Example}:
6252 @item @emph{See also}:
6253 @ref{MIN}, @ref{MINVAL}
6255 @end table
6258 @node MINVAL
6259 @section @code{MINVAL} --- Minimum value of an array
6260 @cindex @code{MINVAL} intrinsic
6261 @cindex undocumented intrinsic 
6263 Intrinsic implemented, documentation pending.
6265 @table @asis
6266 @item @emph{Description}:
6267 @item @emph{Standard}:
6268 F95 and later
6270 @item @emph{Class}:
6271 Transformational function
6273 @item @emph{Syntax}:
6274 @item @emph{Arguments}:
6275 @item @emph{Return value}:
6276 @item @emph{Example}:
6278 @item @emph{See also}:
6279 @ref{MIN}, @ref{MINLOC}
6280 @end table
6285 @node MOD
6286 @section @code{MOD} --- Remainder function
6287 @cindex @code{MOD} intrinsic
6288 @cindex @code{AMOD} intrinsic
6289 @cindex @code{DMOD} intrinsic
6290 @cindex remainder
6292 @table @asis
6293 @item @emph{Description}:
6294 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
6295 calculated as @code{A - (INT(A/P) * P)}.
6297 @item @emph{Standard}:
6298 F77 and later
6300 @item @emph{Class}:
6301 Elemental function
6303 @item @emph{Syntax}:
6304 @code{X = MOD(A,P)}
6306 @item @emph{Arguments}:
6307 @multitable @columnfractions .15 .80
6308 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6309 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
6310 equal to zero
6311 @end multitable
6313 @item @emph{Return value}:
6314 The kind of the return value is the result of cross-promoting
6315 the kinds of the arguments.
6317 @item @emph{Example}:
6318 @smallexample
6319 program test_mod
6320   print *, mod(17,3)
6321   print *, mod(17.5,5.5)
6322   print *, mod(17.5d0,5.5)
6323   print *, mod(17.5,5.5d0)
6325   print *, mod(-17,3)
6326   print *, mod(-17.5,5.5)
6327   print *, mod(-17.5d0,5.5)
6328   print *, mod(-17.5,5.5d0)
6330   print *, mod(17,-3)
6331   print *, mod(17.5,-5.5)
6332   print *, mod(17.5d0,-5.5)
6333   print *, mod(17.5,-5.5d0)
6334 end program test_mod
6335 @end smallexample
6337 @item @emph{Specific names}:
6338 @multitable @columnfractions .20 .20 .20 .40
6339 @item Name             @tab Arguments      @tab Return type    @tab Standard
6340 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
6341 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
6342 @end multitable
6343 @end table
6347 @node MODULO
6348 @section @code{MODULO} --- Modulo function
6349 @cindex @code{MODULO} intrinsic
6350 @cindex modulo
6352 @table @asis
6353 @item @emph{Description}:
6354 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
6356 @item @emph{Standard}:
6357 F95 and later
6359 @item @emph{Class}:
6360 Elemental function
6362 @item @emph{Syntax}:
6363 @code{X = MODULO(A,P)}
6365 @item @emph{Arguments}:
6366 @multitable @columnfractions .15 .80
6367 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6368 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
6369 @end multitable
6371 @item @emph{Return value}:
6372 The type and kind of the result are those of the arguments.
6373 @table @asis
6374 @item If @var{A} and @var{P} are of type @code{INTEGER}:
6375 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
6376 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
6377 (exclusive).
6378 @item If @var{A} and @var{P} are of type @code{REAL}:
6379 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
6380 @end table
6381 In all cases, if @var{P} is zero the result is processor-dependent.
6383 @item @emph{Example}:
6384 @smallexample
6385 program test_modulo
6386   print *, modulo(17,3)
6387   print *, modulo(17.5,5.5)
6389   print *, modulo(-17,3)
6390   print *, modulo(-17.5,5.5)
6392   print *, modulo(17,-3)
6393   print *, modulo(17.5,-5.5)
6394 end program test_mod
6395 @end smallexample
6397 @end table
6401 @node MVBITS
6402 @section @code{MVBITS} --- Move bits from one integer to another
6403 @cindex @code{MVBITS} intrinsic
6404 @cindex bit operations
6406 Intrinsic implemented, documentation pending.
6408 @table @asis
6409 @item @emph{Description}:
6410 @item @emph{Standard}:
6411 F95 and later
6413 @item @emph{Class}:
6414 Elemental subroutine
6416 @item @emph{Syntax}:
6417 @item @emph{Arguments}:
6418 @item @emph{Return value}:
6419 @item @emph{Example}:
6420 @item @emph{See also}:
6421 @end table
6426 @node MOVE_ALLOC
6427 @section @code{MOVE_ALLOC} --- Move allocation from one object to another
6428 @cindex @code{MOVE_ALLOC} intrinsic
6429 @cindex moving allocation
6430 @cindex allocation, moving
6432 @table @asis
6433 @item @emph{Description}:
6434 @code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
6435 @var{DEST}.  @var{SRC} will become deallocated in the process.
6437 @item @emph{Standard}:
6438 F2003 and later
6440 @item @emph{Class}:
6441 Subroutine
6443 @item @emph{Syntax}:
6444 @code{CALL MOVE_ALLOC(SRC, DEST)}
6446 @item @emph{Arguments}:
6447 @multitable @columnfractions .15 .80
6448 @item @var{SRC}  @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be
6449                       of any type and kind.
6450 @item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be
6451                       of the same type, kind and rank as @var{SRC}
6452 @end multitable
6454 @item @emph{Return value}:
6455 None
6457 @item @emph{Example}:
6458 @smallexample
6459 program test_move_alloc
6460     integer, allocatable :: a(:), b(:)
6462     allocate(a(3))
6463     a = [ 1, 2, 3 ]
6464     call move_alloc(a, b)
6465     print *, allocated(a), allocated(b)
6466     print *, b
6467 end program test_move_alloc
6468 @end smallexample
6469 @end table
6473 @node NEAREST
6474 @section @code{NEAREST} --- Nearest representable number
6475 @cindex @code{NEAREST} intrinsic
6476 @cindex processor-representable number
6478 @table @asis
6479 @item @emph{Description}:
6480 @code{NEAREST(X, S)} returns the processor-representable number nearest
6481 to @code{X} in the direction indicated by the sign of @code{S}.
6483 @item @emph{Standard}:
6484 F95 and later
6486 @item @emph{Class}:
6487 Elemental function
6489 @item @emph{Syntax}:
6490 @code{Y = NEAREST(X, S)}
6492 @item @emph{Arguments}:
6493 @multitable @columnfractions .15 .80
6494 @item @var{X} @tab shall be of type @code{REAL}.
6495 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
6496 not equal to zero.
6497 @end multitable
6499 @item @emph{Return value}:
6500 The return value is of the same type as @code{X}. If @code{S} is
6501 positive, @code{NEAREST} returns the processor-representable number
6502 greater than @code{X} and nearest to it. If @code{S} is negative,
6503 @code{NEAREST} returns the processor-representable number smaller than
6504 @code{X} and nearest to it.
6506 @item @emph{Example}:
6507 @smallexample
6508 program test_nearest
6509   real :: x, y
6510   x = nearest(42.0, 1.0)
6511   y = nearest(42.0, -1.0)
6512   write (*,"(3(G20.15))") x, y, x - y
6513 end program test_nearest
6514 @end smallexample
6515 @end table
6519 @node NEW_LINE
6520 @section @code{NEW_LINE} --- New line character
6521 @cindex @code{NEW_LINE} intrinsic
6522 @cindex @code{NEW_LINE} intrinsic
6524 @table @asis
6525 @item @emph{Description}:
6526 @code{NEW_LINE(C)} returns the new-line character
6528 @item @emph{Standard}:
6529 F2003 and later
6531 @item @emph{Class}:
6532 Elemental function
6534 @item @emph{Syntax}:
6535 @code{C = NEW_LINE(C)}
6537 @item @emph{Arguments}:
6538 @multitable @columnfractions .15 .80
6539 @item @var{C}    @tab The argument shall be a scalar or array of the
6540                       type @code{CHARACTER}.
6541 @end multitable
6543 @item @emph{Return value}:
6544 Returns a @var{CHARACTER} scalar of length one with the new-line character of
6545 the same kind as parameter @var{C}.
6547 @item @emph{Example}:
6548 @smallexample
6549 program newline
6550   implicit none
6551   write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
6552 end program newline
6553 @end smallexample
6554 @end table
6558 @node NINT
6559 @section @code{NINT} --- Nearest whole number
6560 @cindex @code{NINT} intrinsic
6561 @cindex @code{IDNINT} intrinsic
6562 @cindex whole number
6564 @table @asis
6565 @item @emph{Description}:
6566 @code{NINT(X)} rounds its argument to the nearest whole number.
6568 @item @emph{Standard}:
6569 F77 and later
6571 @item @emph{Class}:
6572 Elemental function
6574 @item @emph{Syntax}:
6575 @code{X = NINT(X)}
6577 @item @emph{Arguments}:
6578 @multitable @columnfractions .15 .80
6579 @item @var{X}    @tab The type of the argument shall be @code{REAL}.
6580 @end multitable
6582 @item @emph{Return value}:
6583 Returns @var{A} with the fractional portion of its magnitude eliminated by
6584 rounding to the nearest whole number and with its sign preserved,
6585 converted to an @code{INTEGER} of the default kind.
6587 @item @emph{Example}:
6588 @smallexample
6589 program test_nint
6590   real(4) x4
6591   real(8) x8
6592   x4 = 1.234E0_4
6593   x8 = 4.321_8
6594   print *, nint(x4), idnint(x8)
6595 end program test_nint
6596 @end smallexample
6598 @item @emph{Specific names}:
6599 @multitable @columnfractions .33 .33 .33
6600 @item Name             @tab Argument         @tab Standard
6601 @item @code{IDNINT(X)} @tab @code{REAL(8)}   @tab F95 and later
6602 @end multitable
6604 @item @emph{See also}:
6605 @ref{CEILING}, @ref{FLOOR}
6607 @end table
6610 @node NOT
6611 @section @code{NOT} --- Logical negation
6612 @cindex @code{NOT} intrinsic
6613 @cindex logical operations
6615 Intrinsic implemented, documentation pending.
6617 @table @asis
6618 @item @emph{Description}:
6619 @item @emph{Standard}:
6620 F77 and later
6622 @item @emph{Class}:
6623 Elemental function
6625 @item @emph{Syntax}:
6626 @item @emph{Arguments}:
6627 @item @emph{Return value}:
6628 @item @emph{Example}:
6629 @item @emph{See also}:
6630 @end table
6635 @node NULL
6636 @section @code{NULL} --- Function that returns an disassociated pointer
6637 @cindex @code{NULL} intrinsic
6638 @cindex undocumented intrinsic 
6640 Intrinsic implemented, documentation pending.
6642 @table @asis
6643 @item @emph{Description}:
6644 @item @emph{Standard}:
6645 F95 and later
6647 @item @emph{Class}:
6648 Transformational function
6650 @item @emph{Syntax}:
6651 @item @emph{Arguments}:
6652 @item @emph{Return value}:
6653 @item @emph{Example}:
6654 @item @emph{See also}:
6655 @ref{ASSOCIATED}
6656 @end table
6661 @node OR
6662 @section @code{OR} --- Bitwise logical OR
6663 @cindex @code{OR} intrinsic
6664 @cindex bit operations
6666 @table @asis
6667 @item @emph{Description}:
6668 Bitwise logical @code{OR}.
6670 This intrinsic routine is provided for backwards compatibility with 
6671 GNU Fortran 77.  For integer arguments, programmers should consider
6672 the use of the @ref{IOR} intrinsic defined by the Fortran standard.
6674 @item @emph{Standard}:
6675 GNU extension
6677 @item @emph{Class}:
6678 Non-elemental function
6680 @item @emph{Syntax}:
6681 @code{RESULT = OR(X, Y)}
6683 @item @emph{Arguments}:
6684 @multitable @columnfractions .15 .80
6685 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6686 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6687 @end multitable
6689 @item @emph{Return value}:
6690 The return type is either @code{INTEGER(*)} or @code{LOGICAL} 
6691 after cross-promotion of the arguments.
6693 @item @emph{Example}:
6694 @smallexample
6695 PROGRAM test_or
6696   LOGICAL :: T = .TRUE., F = ..FALSE.
6697   INTEGER :: a, b
6698   DATA a / Z'F' /, b / Z'3' /
6700   WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
6701   WRITE (*,*) OR(a, b)
6702 END PROGRAM
6703 @end smallexample
6705 @item @emph{See also}:
6706 F95 elemental function: @ref{IOR}
6707 @end table
6712 @node PACK
6713 @section @code{PACK} --- Pack an array into an array of rank one
6714 @cindex @code{PACK} intrinsic
6715 @cindex undocumented intrinsic 
6717 Intrinsic implemented, documentation pending.
6719 @table @asis
6720 @item @emph{Description}:
6721 @item @emph{Standard}:
6722 F95 and later
6724 @item @emph{Class}:
6725 Transformational function
6727 @item @emph{Syntax}:
6728 @item @emph{Arguments}:
6729 @item @emph{Return value}:
6730 @item @emph{Example}:
6731 @item @emph{Specific names}:
6732 @item @emph{See also}:
6733 @ref{UNPACK}
6734 @end table
6739 @node PERROR
6740 @section @code{PERROR} --- Print system error message
6741 @cindex @code{PERROR} intrinsic
6742 @cindex undocumented intrinsic 
6744 Intrinsic implemented, documentation pending.
6746 @table @asis
6747 @item @emph{Description}:
6748 @item @emph{Standard}:
6749 GNU extension
6751 @item @emph{Class}:
6752 Subroutine
6754 @item @emph{Syntax}:
6755 @item @emph{Arguments}:
6756 @item @emph{Return value}:
6757 @item @emph{Example}:
6758 @item @emph{Specific names}:
6759 @item @emph{See also}:
6760 @ref{IERRNO}
6761 @end table
6766 @node PRECISION
6767 @section @code{PRECISION} --- Decimal precision of a real kind
6768 @cindex @code{PRECISION} intrinsic
6769 @cindex precision of a real variable
6771 @table @asis
6772 @item @emph{Description}:
6773 @code{PRECISION(X)} returns the decimal precision in the model of the
6774 type of @code{X}.
6776 @item @emph{Standard}:
6777 F95 and later
6779 @item @emph{Class}:
6780 Inquiry function
6782 @item @emph{Syntax}:
6783 @code{I = PRECISION(X)}
6785 @item @emph{Arguments}:
6786 @multitable @columnfractions .15 .80
6787 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6788 @end multitable
6790 @item @emph{Return value}:
6791 The return value is of type @code{INTEGER} and of the default integer
6792 kind.
6794 @item @emph{Example}:
6795 @smallexample
6796 program prec_and_range
6797   real(kind=4) :: x(2)
6798   complex(kind=8) :: y
6800   print *, precision(x), range(x)
6801   print *, precision(y), range(y)
6802 end program prec_and_range
6803 @end smallexample
6804 @end table
6808 @node PRESENT
6809 @section @code{PRESENT} --- Determine whether an optional argument is specified
6810 @cindex @code{PRESENT} intrinsic
6811 @cindex undocumented intrinsic 
6813 Intrinsic implemented, documentation pending.
6815 @table @asis
6816 @item @emph{Description}:
6817 @item @emph{Standard}:
6818 F95 and later
6820 @item @emph{Class}:
6821 Inquiry function
6823 @item @emph{Syntax}:
6824 @item @emph{Arguments}:
6825 @item @emph{Return value}:
6826 @item @emph{Example}:
6827 @item @emph{See also}:
6828 @end table
6833 @node PRODUCT
6834 @section @code{PRODUCT} --- Product of array elements
6835 @cindex @code{PRODUCT} intrinsic
6836 @cindex undocumented intrinsic 
6838 Intrinsic implemented, documentation pending.
6840 @table @asis
6841 @item @emph{Description}:
6842 @item @emph{Standard}:
6843 F95 and later
6845 @item @emph{Class}:
6846 Transformational function
6848 @item @emph{Syntax}:
6849 @item @emph{Arguments}:
6850 @item @emph{Return value}:
6851 @item @emph{Example}:
6852 @item @emph{Specific names}:
6853 @item @emph{See also}:
6854 @ref{SUM}
6855 @end table
6860 @node RADIX
6861 @section @code{RADIX} --- Base of a model number
6862 @cindex @code{RADIX} intrinsic
6863 @cindex base
6865 @table @asis
6866 @item @emph{Description}:
6867 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
6869 @item @emph{Standard}:
6870 F95 and later
6872 @item @emph{Class}:
6873 Inquiry function
6875 @item @emph{Syntax}:
6876 @code{R = RADIX(X)}
6878 @item @emph{Arguments}:
6879 @multitable @columnfractions .15 .80
6880 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
6881 @end multitable
6883 @item @emph{Return value}:
6884 The return value is a scalar of type @code{INTEGER} and of the default
6885 integer kind.
6887 @item @emph{Example}:
6888 @smallexample
6889 program test_radix
6890   print *, "The radix for the default integer kind is", radix(0)
6891   print *, "The radix for the default real kind is", radix(0.0)
6892 end program test_radix
6893 @end smallexample
6895 @end table
6899 @node RANDOM_NUMBER
6900 @section @code{RANDOM_NUMBER} --- Pseudo-random number
6901 @cindex @code{RANDOM_NUMBER} intrinsic
6902 @cindex random numbers
6904 Intrinsic implemented, documentation pending.
6906 @table @asis
6907 @item @emph{Description}:
6908 @item @emph{Standard}:
6909 F95 and later
6911 @item @emph{Class}:
6912 Elemental subroutine
6914 @item @emph{Syntax}:
6915 @item @emph{Arguments}:
6916 @item @emph{Return value}:
6917 @item @emph{Example}:
6918 @item @emph{See also}:
6919 @ref{RANDOM_SEED}
6920 @end table
6925 @node RANDOM_SEED
6926 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6927 @cindex @code{RANDOM_SEED} intrinsic
6928 @cindex random numbers
6930 Intrinsic implemented, documentation pending.
6932 @table @asis
6933 @item @emph{Description}:
6934 @item @emph{Standard}:
6935 F95 and later
6937 @item @emph{Class}:
6938 Subroutine
6940 @item @emph{Syntax}:
6941 @item @emph{Arguments}:
6942 @item @emph{Return value}:
6943 @item @emph{Example}:
6944 @item @emph{See also}:
6945 @ref{RANDOM_NUMBER}
6946 @end table
6951 @node RAND
6952 @section @code{RAND} --- Real pseudo-random number
6953 @cindex @code{RAND} intrinsic
6954 @cindex @code{RAN} intrinsic
6955 @cindex random numbers
6957 @table @asis
6958 @item @emph{Description}:
6959 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6960 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6961 in the current sequence is returned; if @var{FLAG} is 1, the generator
6962 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6963 it is used as a new seed with @code{SRAND}.
6965 @item @emph{Standard}:
6966 GNU extension
6968 @item @emph{Class}:
6969 non-elemental function
6971 @item @emph{Syntax}:
6972 @code{X = RAND(FLAG)}
6974 @item @emph{Arguments}:
6975 @multitable @columnfractions .15 .80
6976 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6977 @end multitable
6979 @item @emph{Return value}:
6980 The return value is of @code{REAL} type and the default kind.
6982 @item @emph{Example}:
6983 @smallexample
6984 program test_rand
6985   integer,parameter :: seed = 86456
6986   
6987   call srand(seed)
6988   print *, rand(), rand(), rand(), rand()
6989   print *, rand(seed), rand(), rand(), rand()
6990 end program test_rand
6991 @end smallexample
6993 @item @emph{Note}:
6994 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6995 provided as an alias for @code{RAND}.
6997 @item @emph{See also}:
6998 @ref{SRAND}, @ref{RANDOM_NUMBER}
7000 @end table
7004 @node RANGE
7005 @section @code{RANGE} --- Decimal exponent range of a real kind
7006 @cindex @code{RANGE} intrinsic
7007 @cindex range of a real variable
7009 @table @asis
7010 @item @emph{Description}:
7011 @code{RANGE(X)} returns the decimal exponent range in the model of the
7012 type of @code{X}.
7014 @item @emph{Standard}:
7015 F95 and later
7017 @item @emph{Class}:
7018 Inquiry function
7020 @item @emph{Syntax}:
7021 @code{I = RANGE(X)}
7023 @item @emph{Arguments}:
7024 @multitable @columnfractions .15 .80
7025 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
7026 @end multitable
7028 @item @emph{Return value}:
7029 The return value is of type @code{INTEGER} and of the default integer
7030 kind.
7032 @item @emph{Example}:
7033 See @code{PRECISION} for an example.
7034 @end table
7038 @node RAN
7039 @section @code{RAN} --- Real pseudo-random number
7040 @cindex @code{RAN} intrinsic
7041 @cindex random numbers
7043 @table @asis
7044 @item @emph{Standard}:
7045 GNU extension
7047 @item @emph{See also}:
7048 @ref{RAND}, @ref{RANDOM_NUMBER}
7049 @end table
7053 @node REAL
7054 @section @code{REAL} --- Convert to real type 
7055 @cindex @code{REAL} intrinsic
7056 @cindex @code{REALPART} intrinsic
7057 @cindex true values
7059 @table @asis
7060 @item @emph{Description}:
7061 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type.  The
7062 @code{REALPART(X)} function is provided for compatibility with @command{g77},
7063 and its use is strongly discouraged.
7065 @item @emph{Standard}:
7066 F77 and later
7068 @item @emph{Class}:
7069 Elemental function
7071 @item @emph{Syntax}:
7072 @multitable @columnfractions .30 .80
7073 @item @code{X = REAL(X)}
7074 @item @code{X = REAL(X, KIND)}
7075 @item @code{X = REALPART(Z)}
7076 @end multitable
7078 @item @emph{Arguments}:
7079 @multitable @columnfractions .15 .80
7080 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or  
7081 @code{COMPLEX(*)}.
7082 @item @var{KIND}  @tab (Optional) @var{KIND} shall be a scalar integer.
7083 @end multitable
7085 @item @emph{Return value}:
7086 These functions return a @code{REAL(*)} variable or array under
7087 the following rules: 
7089 @table @asis
7090 @item (A)
7091 @code{REAL(X)} is converted to a default real type if @var{X} is an 
7092 integer or real variable.
7093 @item (B)
7094 @code{REAL(X)} is converted to a real type with the kind type parameter
7095 of @var{X} if @var{X} is a complex variable.
7096 @item (C)
7097 @code{REAL(X, KIND)} is converted to a real type with kind type
7098 parameter @var{KIND} if @var{X} is a complex, integer, or real
7099 variable.
7100 @end table
7102 @item @emph{Example}:
7103 @smallexample
7104 program test_real
7105   complex :: x = (1.0, 2.0)
7106   print *, real(x), real(x,8), realpart(x)
7107 end program test_real
7108 @end smallexample
7110 @item @emph{See also}:
7111 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
7113 @end table
7116 @node RENAME
7117 @section @code{RENAME} --- Rename a file
7118 @cindex @code{RENAME} intrinsic
7119 @cindex file system operations
7121 Intrinsic implemented, documentation pending.
7123 @table @asis
7124 @item @emph{Description}:
7125 @item @emph{Standard}:
7126 GNU extension
7128 @item @emph{Class}:
7129 Subroutine
7131 @item @emph{Syntax}:
7132 @item @emph{Arguments}:
7133 @item @emph{Return value}:
7134 @item @emph{Example}:
7135 @item @emph{See also}:
7136 @end table
7141 @node REPEAT
7142 @section @code{REPEAT} --- Repeated string concatenation 
7143 @cindex @code{REPEAT} intrinsic
7144 @cindex string manipulation
7146 Intrinsic implemented, documentation pending.
7148 @table @asis
7149 @item @emph{Description}:
7150 @item @emph{Standard}:
7151 F95 and later
7153 @item @emph{Class}:
7154 Transformational function
7156 @item @emph{Syntax}:
7157 @item @emph{Arguments}:
7158 @item @emph{Return value}:
7159 @item @emph{Example}:
7160 @item @emph{See also}:
7161 @end table
7166 @node RESHAPE
7167 @section @code{RESHAPE} --- Function to reshape an array
7168 @cindex @code{RESHAPE} intrinsic
7169 @cindex array manipulation
7171 Intrinsic implemented, documentation pending.
7173 @table @asis
7174 @item @emph{Description}:
7175 @item @emph{Standard}:
7176 F95 and later
7178 @item @emph{Class}:
7179 Transformational function
7181 @item @emph{Syntax}:
7182 @item @emph{Arguments}:
7183 @item @emph{Return value}:
7184 @item @emph{Example}:
7185 @item @emph{See also}:
7186 @ref{SHAPE}
7187 @end table
7191 @node RRSPACING
7192 @section @code{RRSPACING} --- Reciprocal of the relative spacing
7193 @cindex @code{RRSPACING} intrinsic
7195 @table @asis
7196 @item @emph{Description}:
7197 @code{RRSPACING(X)} returns the  reciprocal of the relative spacing of
7198 model numbers near @var{X}.
7200 @item @emph{Standard}:
7201 F95 and later
7203 @item @emph{Class}:
7204 Elemental function
7206 @item @emph{Syntax}:
7207 @code{Y = RRSPACING(X)}
7209 @item @emph{Arguments}:
7210 @multitable @columnfractions .15 .80
7211 @item @var{X} @tab shall be of type @code{REAL}.
7212 @end multitable
7214 @item @emph{Return value}:
7215 The return value is of the same type and kind as @var{X}.
7216 The value returned is equal to
7217 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
7219 @end table
7223 @node RSHIFT
7224 @section @code{RSHIFT} --- Right shift bits
7225 @cindex @code{RSHIFT} intrinsic
7226 @cindex bit operations
7228 Intrinsic implemented, documentation pending.
7230 @table @asis
7231 @item @emph{Description}:
7233 @item @emph{Standard}:
7234 GNU extension
7236 @item @emph{Class}:
7237 Function
7239 @item @emph{Syntax}:
7240 @item @emph{Arguments}:
7241 @item @emph{Return value}:
7242 @item @emph{Example}:
7243 @item @emph{See also}:
7245 @end table
7249 @node SCALE
7250 @section @code{SCALE} --- Scale a real value
7251 @cindex @code{SCALE} intrinsic
7253 @table @asis
7254 @item @emph{Description}:
7255 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
7257 @item @emph{Standard}:
7258 F95 and later
7260 @item @emph{Class}:
7261 Elemental function
7263 @item @emph{Syntax}:
7264 @code{Y = SCALE(X, I)}
7266 @item @emph{Arguments}:
7267 @multitable @columnfractions .15 .80
7268 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
7269 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
7270 @end multitable
7272 @item @emph{Return value}:
7273 The return value is of the same type and kind as @var{X}.
7274 Its value is @code{X * RADIX(X)**I}.
7276 @item @emph{Example}:
7277 @smallexample
7278 program test_scale
7279   real :: x = 178.1387e-4
7280   integer :: i = 5
7281   print *, scale(x,i), x*radix(x)**i
7282 end program test_scale
7283 @end smallexample
7285 @end table
7288 @node SCAN
7289 @section @code{SCAN} --- Scan a string for the presence of a set of characters
7290 @cindex @code{SCAN} intrinsic
7291 @cindex string manipulation
7293 Intrinsic implemented, documentation pending.
7295 @table @asis
7296 @item @emph{Description}:
7297 @item @emph{Standard}:
7298 F95 and later
7300 @item @emph{Class}:
7301 Elemental function
7303 @item @emph{Syntax}:
7304 @item @emph{Arguments}:
7305 @item @emph{Return value}:
7306 @item @emph{Example}:
7307 @item @emph{See also}:
7308 @end table
7313 @node SECNDS
7314 @section @code{SECNDS} --- Time function
7315 @cindex @code{SECNDS} intrinsic
7316 @cindex time, current
7317 @cindex current time
7319 @table @asis
7320 @item @emph{Description}:
7321 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
7322 @var{X} is a reference time, also in seconds. If this is zero, the time in
7323 seconds from midnight is returned. This function is non-standard and its
7324 use is discouraged.
7326 @item @emph{Standard}:
7327 GNU extension
7329 @item @emph{Class}:
7330 function
7332 @item @emph{Syntax}:
7333 @code{T = SECNDS (X)}
7335 @item @emph{Arguments}:
7336 @multitable @columnfractions .15 .80
7337 @item Name        @tab Type
7338 @item @var{T}     @tab REAL(4)
7339 @item @var{X}     @tab REAL(4)
7340 @end multitable
7342 @item @emph{Return value}:
7343 None
7345 @item @emph{Example}:
7346 @smallexample
7347 program test_secnds
7348     real(4) :: t1, t2
7349     print *, secnds (0.0)   ! seconds since midnight
7350     t1 = secnds (0.0)       ! reference time
7351     do i = 1, 10000000      ! do something
7352     end do
7353     t2 = secnds (t1)        ! elapsed time
7354     print *, "Something took ", t2, " seconds."
7355 end program test_secnds
7356 @end smallexample
7357 @end table
7361 @node SELECTED_INT_KIND
7362 @section @code{SELECTED_INT_KIND} --- Choose integer kind
7363 @cindex @code{SELECTED_INT_KIND} intrinsic
7364 @cindex integer kind
7366 @table @asis
7367 @item @emph{Description}:
7368 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
7369 type that can represent all values ranging from @math{-10^I} (exclusive)
7370 to @math{10^I} (exclusive). If there is no integer kind that accommodates
7371 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
7373 @item @emph{Standard}:
7374 F95 and later
7376 @item @emph{Class}:
7377 Transformational function
7379 @item @emph{Syntax}:
7380 @multitable @columnfractions .30 .80
7381 @item @code{J = SELECTED_INT_KIND(I)}
7382 @end multitable
7384 @item @emph{Arguments}:
7385 @multitable @columnfractions .15 .80
7386 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
7387 @end multitable
7389 @item @emph{Example}:
7390 @smallexample
7391 program large_integers
7392   integer,parameter :: k5 = selected_int_kind(5)
7393   integer,parameter :: k15 = selected_int_kind(15)
7394   integer(kind=k5) :: i5
7395   integer(kind=k15) :: i15
7397   print *, huge(i5), huge(i15)
7399   ! The following inequalities are always true
7400   print *, huge(i5) >= 10_k5**5-1
7401   print *, huge(i15) >= 10_k15**15-1
7402 end program large_integers
7403 @end smallexample
7404 @end table
7408 @node SELECTED_REAL_KIND
7409 @section @code{SELECTED_REAL_KIND} --- Choose real kind
7410 @cindex @code{SELECTED_REAL_KIND} intrinsic
7411 @cindex real kind
7413 @table @asis
7414 @item @emph{Description}:
7415 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
7416 with decimal precision greater of at least @code{P} digits and exponent
7417 range greater at least @code{R}. 
7419 @item @emph{Standard}:
7420 F95 and later
7422 @item @emph{Class}:
7423 Transformational function
7425 @item @emph{Syntax}:
7426 @multitable @columnfractions .30 .80
7427 @item @code{I = SELECTED_REAL_KIND(P,R)}
7428 @end multitable
7430 @item @emph{Arguments}:
7431 @multitable @columnfractions .15 .80
7432 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7433 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7434 @end multitable
7435 At least one argument shall be present.
7437 @item @emph{Return value}:
7439 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
7440 a real data type with decimal precision of at least @code{P} digits and a
7441 decimal exponent range of at least @code{R}. If more than one real data
7442 type meet the criteria, the kind of the data type with the smallest
7443 decimal precision is returned. If no real data type matches the criteria,
7444 the result is
7445 @table @asis
7446 @item -1 if the processor does not support a real data type with a
7447 precision greater than or equal to @code{P}
7448 @item -2 if the processor does not support a real type with an exponent
7449 range greater than or equal to @code{R}
7450 @item -3 if neither is supported.
7451 @end table
7453 @item @emph{Example}:
7454 @smallexample
7455 program real_kinds
7456   integer,parameter :: p6 = selected_real_kind(6)
7457   integer,parameter :: p10r100 = selected_real_kind(10,100)
7458   integer,parameter :: r400 = selected_real_kind(r=400)
7459   real(kind=p6) :: x
7460   real(kind=p10r100) :: y
7461   real(kind=r400) :: z
7463   print *, precision(x), range(x)
7464   print *, precision(y), range(y)
7465   print *, precision(z), range(z)
7466 end program real_kinds
7467 @end smallexample
7468 @end table
7472 @node SET_EXPONENT
7473 @section @code{SET_EXPONENT} --- Set the exponent of the model
7474 @cindex @code{SET_EXPONENT} intrinsic
7475 @cindex exponent part of a real number
7477 @table @asis
7478 @item @emph{Description}:
7479 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
7480 is that that of @var{X} and whose exponent part is @var{I}.
7482 @item @emph{Standard}:
7483 F95 and later
7485 @item @emph{Class}:
7486 Elemental function
7488 @item @emph{Syntax}:
7489 @code{Y = SET_EXPONENT(X, I)}
7491 @item @emph{Arguments}:
7492 @multitable @columnfractions .15 .80
7493 @item @var{X} @tab shall be of type @code{REAL}.
7494 @item @var{I} @tab shall be of type @code{INTEGER}.
7495 @end multitable
7497 @item @emph{Return value}:
7498 The return value is of the same type and kind as @var{X}.
7499 The real number whose fractional part
7500 is that that of @var{X} and whose exponent part if @var{I} is returned;
7501 it is @code{FRACTION(X) * RADIX(X)**I}.
7503 @item @emph{Example}:
7504 @smallexample
7505 program test_setexp
7506   real :: x = 178.1387e-4
7507   integer :: i = 17
7508   print *, set_exponent(x), fraction(x) * radix(x)**i
7509 end program test_setexp
7510 @end smallexample
7512 @end table
7516 @node SHAPE
7517 @section @code{SHAPE} --- Determine the shape of an array
7518 @cindex @code{SHAPE} intrinsic
7519 @cindex array manipulation
7521 Intrinsic implemented, documentation pending.
7523 @table @asis
7524 @item @emph{Description}:
7525 @item @emph{Standard}:
7526 F95 and later
7528 @item @emph{Class}:
7529 Inquiry function
7531 @item @emph{Syntax}:
7532 @item @emph{Arguments}:
7533 @item @emph{Return value}:
7534 @item @emph{Example}:
7535 @item @emph{See also}:
7536 @ref{RESHAPE}
7537 @end table
7542 @node SIGN
7543 @section @code{SIGN} --- Sign copying function
7544 @cindex @code{SIGN} intrinsic
7545 @cindex @code{ISIGN} intrinsic
7546 @cindex @code{DSIGN} intrinsic
7547 @cindex sign copying
7549 @table @asis
7550 @item @emph{Description}:
7551 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
7553 @item @emph{Standard}:
7554 F77 and later
7556 @item @emph{Class}:
7557 Elemental function
7559 @item @emph{Syntax}:
7560 @code{X = SIGN(A,B)}
7562 @item @emph{Arguments}:
7563 @multitable @columnfractions .15 .80
7564 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
7565 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
7566 @end multitable
7568 @item @emph{Return value}:
7569 The kind of the return value is that of @var{A} and @var{B}.
7570 If @math{B\ge 0} then the result is @code{ABS(A)}, else
7571 it is @code{-ABS(A)}.
7573 @item @emph{Example}:
7574 @smallexample
7575 program test_sign
7576   print *, sign(-12,1)
7577   print *, sign(-12,0)
7578   print *, sign(-12,-1)
7580   print *, sign(-12.,1.)
7581   print *, sign(-12.,0.)
7582   print *, sign(-12.,-1.)
7583 end program test_sign
7584 @end smallexample
7586 @item @emph{Specific names}:
7587 @multitable @columnfractions .20 .20 .20 .40
7588 @item Name              @tab Arguments      @tab Return type    @tab Standard
7589 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
7590 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
7591 @end multitable
7592 @end table
7596 @node SIGNAL
7597 @section @code{SIGNAL} --- Signal handling subroutine (or function)
7598 @cindex @code{SIGNAL} intrinsic
7599 @cindex signal handling
7601 @table @asis
7602 @item @emph{Description}:
7603 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
7604 @var{HANDLER} to be executed with a single integer argument when signal
7605 @var{NUMBER} occurs.  If @var{HANDLER} is an integer, it can be used to
7606 turn off handling of signal @var{NUMBER} or revert to its default
7607 action.  See @code{signal(2)}.
7609 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
7610 is supplied, it is set to the value returned by @code{signal(2)}.
7612 @item @emph{Standard}:
7613 GNU extension
7615 @item @emph{Class}:
7616 subroutine, non-elemental function
7618 @item @emph{Syntax}:
7619 @multitable @columnfractions .30 .80
7620 @item @code{CALL SIGNAL(NUMBER, HANDLER)}
7621 @item @code{CALL SIGNAL(NUMBER, HANDLER, STATUS)}
7622 @item @code{STATUS = SIGNAL(NUMBER, HANDLER)}
7623 @end multitable
7625 @item @emph{Arguments}:
7626 @multitable @columnfractions .15 .80
7627 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
7628 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
7629 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
7630 @code{INTEGER}. It is @code{INTENT(IN)}.
7631 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
7632 integer. It has @code{INTENT(OUT)}.
7633 @end multitable
7635 @item @emph{Return value}:
7636 The @code{SIGNAL} function returns the value returned by @code{signal(2)}.
7638 @item @emph{Example}:
7639 @smallexample
7640 program test_signal
7641   intrinsic signal
7642   external handler_print
7644   call signal (12, handler_print)
7645   call signal (10, 1)
7647   call sleep (30)
7648 end program test_signal
7649 @end smallexample
7650 @end table
7655 @node SIN
7656 @section @code{SIN} --- Sine function 
7657 @cindex @code{SIN} intrinsic
7658 @cindex @code{DSIN} intrinsic
7659 @cindex @code{ZSIN} intrinsic
7660 @cindex @code{CDSIN} intrinsic
7661 @cindex trigonometric functions
7663 @table @asis
7664 @item @emph{Description}:
7665 @code{SIN(X)} computes the sine of @var{X}.
7667 @item @emph{Standard}:
7668 F77 and later
7670 @item @emph{Class}:
7671 Elemental function
7673 @item @emph{Syntax}:
7674 @code{X = SIN(X)}
7676 @item @emph{Arguments}:
7677 @multitable @columnfractions .15 .80
7678 @item @var{X} @tab The type shall be @code{REAL(*)} or
7679 @code{COMPLEX(*)}.
7680 @end multitable
7682 @item @emph{Return value}:
7683 The return value has same type and kind as @var{X}.
7685 @item @emph{Example}:
7686 @smallexample
7687 program test_sin
7688   real :: x = 0.0
7689   x = sin(x)
7690 end program test_sin
7691 @end smallexample
7693 @item @emph{Specific names}:
7694 @multitable @columnfractions .20 .20 .20 .40
7695 @item Name            @tab Argument          @tab Return type       @tab Standard
7696 @item @code{DSIN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
7697 @item @code{CSIN(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
7698 @item @code{ZSIN(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
7699 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
7700 @end multitable
7702 @item @emph{See also}:
7703 @ref{ASIN}
7704 @end table
7708 @node SINH
7709 @section @code{SINH} --- Hyperbolic sine function 
7710 @cindex @code{SINH} intrinsic
7711 @cindex @code{DSINH} intrinsic
7712 @cindex hyperbolic sine
7714 @table @asis
7715 @item @emph{Description}:
7716 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
7718 @item @emph{Standard}:
7719 F95 and later
7721 @item @emph{Class}:
7722 Elemental function
7724 @item @emph{Syntax}:
7725 @code{X = SINH(X)}
7727 @item @emph{Arguments}:
7728 @multitable @columnfractions .15 .80
7729 @item @var{X} @tab The type shall be @code{REAL(*)}.
7730 @end multitable
7732 @item @emph{Return value}:
7733 The return value is of type @code{REAL(*)}.
7735 @item @emph{Example}:
7736 @smallexample
7737 program test_sinh
7738   real(8) :: x = - 1.0_8
7739   x = sinh(x)
7740 end program test_sinh
7741 @end smallexample
7743 @item @emph{Specific names}:
7744 @multitable @columnfractions .20 .20 .20 .40
7745 @item Name            @tab Argument          @tab Return type       @tab Standard
7746 @item @code{DSINH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7747 @end multitable
7749 @item @emph{See also}:
7750 @ref{ASINH}
7751 @end table
7755 @node SIZE
7756 @section @code{SIZE} --- Determine the size of an array
7757 @cindex @code{SIZE} intrinsic
7758 @cindex array manipulation
7760 Intrinsic implemented, documentation pending.
7762 @table @asis
7763 @item @emph{Description}:
7764 @item @emph{Standard}:
7765 F95 and later
7767 @item @emph{Class}:
7768 Inquiry function
7770 @item @emph{Syntax}:
7771 @item @emph{Arguments}:
7772 @item @emph{Return value}:
7773 @item @emph{Example}:
7774 @item @emph{See also}:
7775 @end table
7779 @node SNGL
7780 @section @code{SNGL} --- Convert double precision real to default real
7781 @cindex @code{SNGL} intrinsic
7782 @cindex conversion function (real)
7784 @table @asis
7785 @item @emph{Description}:
7786 @code{SNGL(A)} converts the double precision real @var{A}
7787 to a default real value. This is an archaic form of @code{REAL}
7788 that is specific to one type for @var{A}.
7790 @item @emph{Standard}:
7791 GNU extension
7793 @item @emph{Class}:
7794 function
7796 @item @emph{Syntax}:
7797 @code{X = SNGL(A)}
7799 @item @emph{Arguments}:
7800 @multitable @columnfractions .15 .80
7801 @item @var{A} @tab The type shall be a double precision @code{REAL}.
7802 @end multitable
7804 @item @emph{Return value}:
7805 The return value is of type default @code{REAL}.
7807 @item @emph{See also}:
7808 @ref{DBLE}
7809 @end table
7813 @node SPACING
7814 @section @code{SPACING} --- Smallest distance between two numbers of a given type
7815 @cindex @code{SPACING} intrinsic
7816 @cindex undocumented intrinsic 
7818 Intrinsic implemented, documentation pending.
7820 @table @asis
7821 @item @emph{Description}:
7822 @item @emph{Standard}:
7823 F95 and later
7825 @item @emph{Class}:
7826 Elemental function
7828 @item @emph{Syntax}:
7829 @item @emph{Arguments}:
7830 @item @emph{Return value}:
7831 @item @emph{Example}:
7832 @item @emph{See also}:
7833 @end table
7838 @node SPREAD
7839 @section @code{SPREAD} --- Add a dimension to an array
7840 @cindex @code{SPREAD} intrinsic
7841 @cindex array manipulation
7843 Intrinsic implemented, documentation pending.
7845 @table @asis
7846 @item @emph{Description}:
7847 @item @emph{Standard}:
7848 F95 and later
7850 @item @emph{Class}:
7851 Transformational function
7853 @item @emph{Syntax}:
7854 @item @emph{Arguments}:
7855 @item @emph{Return value}:
7856 @item @emph{Example}:
7857 @item @emph{See also}:
7858 @end table
7863 @node SQRT
7864 @section @code{SQRT} --- Square-root function
7865 @cindex @code{SQRT} intrinsic
7866 @cindex @code{DSQRT} intrinsic
7867 @cindex @code{CSQRT} intrinsic
7868 @cindex @code{ZSQRT} intrinsic
7869 @cindex @code{CDSQRT} intrinsic
7870 @cindex square-root
7872 @table @asis
7873 @item @emph{Description}:
7874 @code{SQRT(X)} computes the square root of @var{X}.
7876 @item @emph{Standard}:
7877 F77 and later
7879 @item @emph{Class}:
7880 Elemental function
7882 @item @emph{Syntax}:
7883 @code{X = SQRT(X)}
7885 @item @emph{Arguments}:
7886 @multitable @columnfractions .15 .80
7887 @item @var{X} @tab The type shall be @code{REAL(*)} or
7888 @code{COMPLEX(*)}.
7889 @end multitable
7891 @item @emph{Return value}:
7892 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
7893 The kind type parameter is the same as @var{X}.
7895 @item @emph{Example}:
7896 @smallexample
7897 program test_sqrt
7898   real(8) :: x = 2.0_8
7899   complex :: z = (1.0, 2.0)
7900   x = sqrt(x)
7901   z = sqrt(z)
7902 end program test_sqrt
7903 @end smallexample
7905 @item @emph{Specific names}:
7906 @multitable @columnfractions .20 .20 .20 .40
7907 @item Name             @tab Argument             @tab Return type          @tab Standard
7908 @item @code{DSQRT(X)}  @tab @code{REAL(8) X}     @tab @code{REAL(8)}       @tab F95 and later
7909 @item @code{CSQRT(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab F95 and later
7910 @item @code{ZSQRT(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab GNU extension
7911 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab GNU extension
7912 @end multitable
7913 @end table
7917 @node SRAND
7918 @section @code{SRAND} --- Reinitialize the random number generator
7919 @cindex @code{SRAND} intrinsic
7920 @cindex random numbers
7922 @table @asis
7923 @item @emph{Description}:
7924 @code{SRAND} reinitializes the pseudo-random number generator
7925 called by @code{RAND} and @code{IRAND}. The new seed used by the
7926 generator is specified by the required argument @var{SEED}.
7928 @item @emph{Standard}:
7929 GNU extension
7931 @item @emph{Class}:
7932 non-elemental subroutine
7934 @item @emph{Syntax}:
7935 @code{CALL SRAND(SEED)}
7937 @item @emph{Arguments}:
7938 @multitable @columnfractions .15 .80
7939 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7940 @end multitable
7942 @item @emph{Return value}:
7943 Does not return.
7945 @item @emph{Example}:
7946 See @code{RAND} and @code{IRAND} for examples.
7948 @item @emph{Notes}:
7949 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7950 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7951 to generate pseudo-random numbers. Please note that in
7952 GNU Fortran, these two sets of intrinsics (@code{RAND},
7953 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7954 @code{RANDOM_SEED} on the other hand) access two independent
7955 pseudo-random number generators.
7957 @item @emph{See also}:
7958 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7960 @end table
7963 @node STAT
7964 @section @code{STAT} --- Get file status
7965 @cindex @code{STAT} intrinsic
7966 @cindex file system operations
7968 @table @asis
7969 @item @emph{Description}:
7970 This function returns information about a file. No permissions are required on 
7971 the file itself, but execute (search) permission is required on all of the 
7972 directories in path that lead to the file.
7974 The elements that are obtained and stored in the array @code{BUFF}:
7975 @multitable @columnfractions .15 .80
7976 @item @code{buff(1)}   @tab  Device ID 
7977 @item @code{buff(2)}   @tab  Inode number 
7978 @item @code{buff(3)}   @tab  File mode 
7979 @item @code{buff(4)}   @tab  Number of links 
7980 @item @code{buff(5)}   @tab  Owner's uid 
7981 @item @code{buff(6)}   @tab  Owner's gid 
7982 @item @code{buff(7)}   @tab  ID of device containing directory entry for file (0 if not available) 
7983 @item @code{buff(8)}   @tab  File size (bytes) 
7984 @item @code{buff(9)}   @tab  Last access time 
7985 @item @code{buff(10)}  @tab  Last modification time 
7986 @item @code{buff(11)}  @tab  Last file status change time 
7987 @item @code{buff(12)}  @tab  Preferred I/O block size (-1 if not available) 
7988 @item @code{buff(13)}  @tab  Number of blocks allocated (-1 if not available)
7989 @end multitable
7991 Not all these elements are relevant on all systems. 
7992 If an element is not relevant, it is returned as 0.
7995 @item @emph{Standard}:
7996 GNU extension
7998 @item @emph{Class}:
7999 Non-elemental subroutine
8001 @item @emph{Syntax}:
8002 @code{CALL STAT(FILE,BUFF[,STATUS])}
8004 @item @emph{Arguments}:
8005 @multitable @columnfractions .15 .80
8006 @item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
8007 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
8008 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
8009                         on success and a system specific error code otherwise.
8010 @end multitable
8012 @item @emph{Example}:
8013 @smallexample
8014 PROGRAM test_stat
8015   INTEGER, DIMENSION(13) :: buff
8016   INTEGER :: status
8018   CALL STAT("/etc/passwd", buff, status)
8020   IF (status == 0) THEN
8021     WRITE (*, FMT="('Device ID:',               T30, I19)") buff(1)
8022     WRITE (*, FMT="('Inode number:',            T30, I19)") buff(2)
8023     WRITE (*, FMT="('File mode (octal):',       T30, O19)") buff(3)
8024     WRITE (*, FMT="('Number of links:',         T30, I19)") buff(4)
8025     WRITE (*, FMT="('Owner''s uid:',            T30, I19)") buff(5)
8026     WRITE (*, FMT="('Owner''s gid:',            T30, I19)") buff(6)
8027     WRITE (*, FMT="('Device where located:',    T30, I19)") buff(7)
8028     WRITE (*, FMT="('File size:',               T30, I19)") buff(8)
8029     WRITE (*, FMT="('Last access time:',        T30, A19)") CTIME(buff(9))
8030     WRITE (*, FMT="('Last modification time',   T30, A19)") CTIME(buff(10))
8031     WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
8032     WRITE (*, FMT="('Preferred block size:',    T30, I19)") buff(12)
8033     WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
8034   END IF
8035 END PROGRAM
8036 @end smallexample
8038 @item @emph{See also}:
8039 To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
8040 @end table
8044 @node SUM
8045 @section @code{SUM} --- Sum of array elements
8046 @cindex @code{SUM} intrinsic
8047 @cindex array manipulation
8049 Intrinsic implemented, documentation pending.
8051 @table @asis
8052 @item @emph{Description}:
8053 @item @emph{Standard}:
8054 F95 and later
8056 @item @emph{Class}:
8057 Transformational function
8059 @item @emph{Syntax}:
8060 @item @emph{Arguments}:
8061 @item @emph{Return value}:
8062 @item @emph{Example}:
8063 @item @emph{See also}:
8064 @ref{PRODUCT}
8065 @end table
8070 @node SYMLNK
8071 @section @code{SYMLNK} --- Create a symbolic link
8072 @cindex @code{SYMLNK} intrinsic
8073 @cindex file system operations
8075 Intrinsic implemented, documentation pending.
8077 @table @asis
8078 @item @emph{Description}:
8079 @item @emph{Standard}:
8080 @item @emph{Class}:
8081 GNU extension
8083 @item @emph{Syntax}:
8084 @item @emph{Arguments}:
8085 @item @emph{Return value}:
8086 @item @emph{Example}:
8087 @item @emph{See also}:
8088 @end table
8093 @node SYSTEM
8094 @section @code{SYSTEM} --- Execute a shell command
8095 @cindex @code{SYSTEM} intrinsic
8096 @cindex undocumented intrinsic 
8098 Intrinsic implemented, documentation pending.
8100 @table @asis
8101 @item @emph{Description}:
8102 @item @emph{Standard}:
8103 GNU extension
8105 @item @emph{Class}:
8106 Subroutine
8108 @item @emph{Syntax}:
8109 @item @emph{Arguments}:
8110 @item @emph{Return value}:
8111 @item @emph{Example}:
8112 @item @emph{See also}:
8113 @end table
8118 @node SYSTEM_CLOCK
8119 @section @code{SYSTEM_CLOCK} --- Time function
8120 @cindex @code{SYSTEM_CLOCK} intrinsic
8121 @cindex time, current
8122 @cindex current time
8124 Intrinsic implemented, documentation pending.
8126 @table @asis
8127 @item @emph{Description}:
8128 @item @emph{Standard}:
8129 F95 and later
8131 @item @emph{Class}:
8132 Subroutine
8134 @item @emph{Syntax}:
8135 @item @emph{Arguments}:
8136 @item @emph{Return value}:
8137 @item @emph{Example}:
8138 @item @emph{See also}:
8139 @end table
8143 @node TAN
8144 @section @code{TAN} --- Tangent function
8145 @cindex @code{TAN} intrinsic
8146 @cindex @code{DTAN} intrinsic
8147 @cindex trigonometric functions
8149 @table @asis
8150 @item @emph{Description}:
8151 @code{TAN(X)} computes the tangent of @var{X}.
8153 @item @emph{Standard}:
8154 F77 and later
8156 @item @emph{Class}:
8157 Elemental function
8159 @item @emph{Syntax}:
8160 @code{X = TAN(X)}
8162 @item @emph{Arguments}:
8163 @multitable @columnfractions .15 .80
8164 @item @var{X} @tab The type shall be @code{REAL(*)}.
8165 @end multitable
8167 @item @emph{Return value}:
8168 The return value is of type @code{REAL(*)}.  The kind type parameter is
8169 the same as @var{X}.
8171 @item @emph{Example}:
8172 @smallexample
8173 program test_tan
8174   real(8) :: x = 0.165_8
8175   x = tan(x)
8176 end program test_tan
8177 @end smallexample
8179 @item @emph{Specific names}:
8180 @multitable @columnfractions .20 .20 .20 .40
8181 @item Name            @tab Argument          @tab Return type       @tab Standard
8182 @item @code{DTAN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
8183 @end multitable
8185 @item @emph{See also}:
8186 @ref{ATAN}
8187 @end table
8191 @node TANH
8192 @section @code{TANH} --- Hyperbolic tangent function 
8193 @cindex @code{TANH} intrinsic
8194 @cindex @code{DTANH} intrinsic
8195 @cindex hyperbolic tangent
8197 @table @asis
8198 @item @emph{Description}:
8199 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
8201 @item @emph{Standard}:
8202 F77 and later
8204 @item @emph{Class}:
8205 Elemental function
8207 @item @emph{Syntax}:
8208 @code{X = TANH(X)}
8210 @item @emph{Arguments}:
8211 @multitable @columnfractions .15 .80
8212 @item @var{X} @tab The type shall be @code{REAL(*)}.
8213 @end multitable
8215 @item @emph{Return value}:
8216 The return value is of type @code{REAL(*)} and lies in the range
8217 @math{ - 1 \leq tanh(x) \leq 1 }.
8219 @item @emph{Example}:
8220 @smallexample
8221 program test_tanh
8222   real(8) :: x = 2.1_8
8223   x = tanh(x)
8224 end program test_tanh
8225 @end smallexample
8227 @item @emph{Specific names}:
8228 @multitable @columnfractions .20 .20 .20 .40
8229 @item Name            @tab Argument          @tab Return type       @tab Standard
8230 @item @code{DTANH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
8231 @end multitable
8233 @item @emph{See also}:
8234 @ref{ATANH}
8235 @end table
8239 @node TIME
8240 @section @code{TIME} --- Time function
8241 @cindex @code{TIME} intrinsic
8242 @cindex time, current
8243 @cindex current time
8245 Intrinsic implemented, documentation pending.
8247 @table @asis
8248 @item @emph{Description}:
8249 @item @emph{Standard}:
8250 GNU extension
8252 @item @emph{Class}:
8253 Non-elemental function
8255 @item @emph{Syntax}:
8256 @item @emph{Arguments}:
8257 @item @emph{Return value}:
8258 @item @emph{Example}:
8259 @item @emph{See also}:
8260 @end table
8264 @node TINY
8265 @section @code{TINY} --- Smallest positive number of a real kind
8266 @cindex @code{TINY} intrinsic
8267 @cindex tiny
8269 @table @asis
8270 @item @emph{Description}:
8271 @code{TINY(X)} returns the smallest positive (non zero) number
8272 in the model of the type of @code{X}.
8274 @item @emph{Standard}:
8275 F95 and later
8277 @item @emph{Class}:
8278 Elemental function
8280 @item @emph{Syntax}:
8281 @code{Y = TINY(X)}
8283 @item @emph{Arguments}:
8284 @multitable @columnfractions .15 .80
8285 @item @var{X} @tab shall be of type @code{REAL}.
8286 @end multitable
8288 @item @emph{Return value}:
8289 The return value is of the same type and kind as @var{X}
8291 @item @emph{Example}:
8292 See @code{HUGE} for an example.
8293 @end table
8297 @node TRANSFER
8298 @section @code{TRANSFER} --- Transfer bit patterns
8299 @cindex @code{TRANSFER} intrinsic
8300 @cindex bit operations
8302 Intrinsic implemented, documentation pending.
8304 @table @asis
8305 @item @emph{Description}:
8306 @item @emph{Standard}:
8307 F95 and later
8309 @item @emph{Class}:
8310 Transformational function
8312 @item @emph{Syntax}:
8313 @item @emph{Arguments}:
8314 @item @emph{Return value}:
8315 @item @emph{Example}:
8316 @item @emph{See also}:
8317 @end table
8322 @node TRANSPOSE
8323 @section @code{TRANSPOSE} --- Transpose an array of rank two
8324 @cindex @code{TRANSPOSE} intrinsic
8325 @cindex matrix manipulation
8327 Intrinsic implemented, documentation pending.
8329 @table @asis
8330 @item @emph{Description}:
8331 @item @emph{Standard}:
8332 F95 and later
8334 @item @emph{Class}:
8335 Transformational function
8337 @item @emph{Syntax}:
8338 @item @emph{Arguments}:
8339 @item @emph{Return value}:
8340 @item @emph{Example}:
8341 @item @emph{See also}:
8342 @end table
8347 @node TRIM
8348 @section @code{TRIM} --- Function to remove trailing blank characters of a string
8349 @cindex @code{TRIM} intrinsic
8350 @cindex string manipulation
8352 Intrinsic implemented, documentation pending.
8354 @table @asis
8355 @item @emph{Description}:
8356 @item @emph{Standard}:
8357 F95 and later
8359 @item @emph{Class}:
8360 Transformational function
8362 @item @emph{Syntax}:
8363 @item @emph{Arguments}:
8364 @item @emph{Return value}:
8365 @item @emph{Example}:
8366 @item @emph{See also}:
8367 @end table
8371 @node UBOUND
8372 @section @code{UBOUND} --- Upper dimension bounds of an array
8373 @cindex @code{UBOUND} intrinsic
8375 @table @asis
8376 @item @emph{Description}:
8377 Returns the upper bounds of an array, or a single upper bound
8378 along the @var{DIM} dimension.
8379 @item @emph{Standard}:
8380 F95 and later
8382 @item @emph{Class}:
8383 Inquiry function
8385 @item @emph{Syntax}:
8386 @code{I = UBOUND(ARRAY [, DIM])}
8388 @item @emph{Arguments}:
8389 @multitable @columnfractions .15 .80
8390 @item @var{ARRAY} @tab Shall be an array, of any type.
8391 @item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER(*)}.
8392 @end multitable
8394 @item @emph{Return value}:
8395 If @var{DIM} is absent, the result is an array of the upper bounds of
8396 @var{ARRAY}.  If @var{DIM} is present, the result is a scalar
8397 corresponding to the upper bound of the array along that dimension.  If
8398 @var{ARRAY} is an expression rather than a whole array or array
8399 structure component, or if it has a zero extent along the relevant
8400 dimension, the upper bound is taken to be the number of elements along
8401 the relevant dimension.
8403 @item @emph{See also}:
8404 @ref{LBOUND}
8405 @end table
8409 @node UMASK
8410 @section @code{UMASK} --- Set the file creation mask
8411 @cindex @code{UMASK} intrinsic
8412 @cindex file system operations
8414 Intrinsic implemented, documentation pending.
8416 @table @asis
8417 @item @emph{Description}:
8418 @item @emph{Standard}:
8419 GNU extension
8421 @item @emph{Class}:
8422 Subroutine
8424 @item @emph{Syntax}:
8425 @item @emph{Arguments}:
8426 @item @emph{Return value}:
8427 @item @emph{Example}:
8428 @item @emph{Specific names}:
8429 @item @emph{See also}:
8430 @end table
8434 @node UNLINK
8435 @section @code{UNLINK} --- Remove a file from the file system
8436 @cindex @code{UNLINK} intrinsic
8437 @cindex file system operations
8439 @table @asis
8440 @item @emph{Description}:
8441 Unlinks the file @var{PATH}. A null character (@code{CHAR(0)}) can be
8442 used to mark the end of the name in @var{PATH}; otherwise, trailing
8443 blanks in the file name are ignored.  If the @var{STATUS} argument is
8444 supplied, it contains 0 on success or a nonzero error code upon return;
8445 see @code{link(2)}.
8447 @item @emph{Standard}:
8448 GNU extension
8450 @item @emph{Class}:
8451 Subroutine
8453 @item @emph{Syntax}:
8454 @code{CALL UNLINK(PATH [, STATUS])}
8456 @item @emph{Arguments}:
8457 @multitable @columnfractions .15 .80
8458 @item @var{PATH} @tab Shall be of default @code{CHARACTER} type.
8459 @item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
8460 @end multitable
8462 @item @emph{See also}:
8463 @ref{LINK}
8464 @end table
8468 @node UNMASK
8469 @section @code{UNMASK} --- (?)
8470 @cindex @code{UNMASK} intrinsic
8471 @cindex undocumented intrinsic 
8473 Intrinsic implemented, documentation pending.
8475 @table @asis
8476 @item @emph{Description}:
8477 @item @emph{Standard}:
8478 @item @emph{Class}:
8479 @item @emph{Syntax}:
8480 @item @emph{Arguments}:
8481 @item @emph{Return value}:
8482 @item @emph{Example}:
8483 @item @emph{Specific names}:
8484 @item @emph{See also}:
8485 @end table
8490 @node UNPACK
8491 @section @code{UNPACK} --- Unpack an array of rank one into an array
8492 @cindex @code{UNPACK} intrinsic
8493 @cindex array manipulation
8495 Intrinsic implemented, documentation pending.
8497 @table @asis
8498 @item @emph{Description}:
8499 @item @emph{Standard}:
8500 F95 and later
8502 @item @emph{Class}:
8503 Transformational function
8505 @item @emph{Syntax}:
8506 @item @emph{Arguments}:
8507 @item @emph{Return value}:
8508 @item @emph{Example}:
8510 @item @emph{See also}:
8511 @ref{PACK}
8512 @end table
8517 @node VERIFY
8518 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
8519 @cindex @code{VERIFY} intrinsic
8520 @cindex string manipulation
8522 Intrinsic implemented, documentation pending.
8524 @table @asis
8525 @item @emph{Description}:
8526 @item @emph{Standard}:
8527 F95 and later
8529 @item @emph{Class}:
8530 Elemental function
8532 @item @emph{Syntax}:
8533 @item @emph{Arguments}:
8534 @item @emph{Return value}:
8535 @item @emph{Example}:
8536 @item @emph{Specific names}:
8537 @item @emph{See also}:
8538 @end table
8541 @node XOR
8542 @section @code{XOR} --- Bitwise logical exclusive OR
8543 @cindex @code{XOR} intrinsic
8544 @cindex bit operations
8546 @table @asis
8547 @item @emph{Description}:
8548 Bitwise logical exclusive or. 
8550 This intrinsic routine is provided for backwards compatibility with 
8551 GNU Fortran 77.  For integer arguments, programmers should consider
8552 the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
8554 @item @emph{Standard}:
8555 GNU extension
8557 @item @emph{Class}:
8558 Non-elemental function
8560 @item @emph{Syntax}:
8561 @code{RESULT = XOR(X, Y)}
8563 @item @emph{Arguments}:
8564 @multitable @columnfractions .15 .80
8565 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8566 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8567 @end multitable
8569 @item @emph{Return value}:
8570 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
8571 after cross-promotion of the arguments.
8573 @item @emph{Example}:
8574 @smallexample
8575 PROGRAM test_xor
8576   LOGICAL :: T = .TRUE., F = .FALSE.
8577   INTEGER :: a, b
8578   DATA a / Z,'F' /, b / Z'3' /
8580   WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
8581   WRITE (*,*) XOR(a, b)
8582 END PROGRAM
8583 @end smallexample
8585 @item @emph{See also}:
8586 F95 elemental function: @ref{IEOR}
8587 @end table