* intrinsic.texi: Fix typos.
[official-gcc.git] / gcc / fortran / intrinsic.texi
blob55494cfef0ee997df1aec4fef54d62d9362e763c
1 @ignore
2 Copyright (C) 2005, 2006
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 use.
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
53 * @code{ABORT}:         ABORT,     Abort the program     
54 * @code{ABS}:           ABS,       Absolute value     
55 * @code{ACCESS}:        ACCESS,    Checks file access method
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
255 @section Introduction to intrinsic procedures
257 GNU Fortran provides a rich set of intrinsic procedures that includes all
258 the intrinsic procedures required by the Fortran 95 standard, a set of
259 intrinsic procedures for backwards compatibility with Gnu Fortran 77
260 (i.e., @command{g77}), and a small selection of intrinsic procedures
261 from the Fortran 2003 standard.  Any description here, which conflicts with a 
262 description in either the Fortran 95 standard or the Fortran 2003 standard,
263 is unintentional and 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 intrinsics 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 option(s) is noted.
295 @node ABORT
296 @section @code{ABORT} --- Abort the program  
297 @findex @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
333 @node ABS
334 @section @code{ABS} --- Absolute value  
335 @findex @code{ABS} intrinsic
336 @findex @code{CABS} intrinsic
337 @findex @code{DABS} intrinsic
338 @findex @code{IABS} intrinsic
339 @findex @code{ZABS} intrinsic
340 @findex @code{CDABS} intrinsic
341 @cindex absolute value
343 @table @asis
344 @item @emph{Description}:
345 @code{ABS(X)} computes the absolute value of @code{X}.
347 @item @emph{Standard}:
348 F77 and later, has overloads that are GNU extensions
350 @item @emph{Class}:
351 Elemental function
353 @item @emph{Syntax}:
354 @code{X = ABS(X)}
356 @item @emph{Arguments}:
357 @multitable @columnfractions .15 .80
358 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
359 @code{REAL(*)}, or @code{COMPLEX(*)}.
360 @end multitable
362 @item @emph{Return value}:
363 The return value is of the same type and
364 kind as the argument except the return value is @code{REAL(*)} for a
365 @code{COMPLEX(*)} argument.
367 @item @emph{Example}:
368 @smallexample
369 program test_abs
370   integer :: i = -1
371   real :: x = -1.e0
372   complex :: z = (-1.e0,0.e0)
373   i = abs(i)
374   x = abs(x)
375   x = abs(z)
376 end program test_abs
377 @end smallexample
379 @item @emph{Specific names}:
380 @multitable @columnfractions .20 .20 .20 .40
381 @item Name            @tab Argument            @tab Return type       @tab Standard
382 @item @code{CABS(Z)}  @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)}    @tab F77 and later
383 @item @code{DABS(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}    @tab F77 and later
384 @item @code{IABS(I)}  @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
385 @item @code{ZABS(Z)}  @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
386 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
387 @end multitable
388 @end table
391 @node ACCESS
392 @section @code{ACCESS} --- Checks file access method
393 @findex @code{ACCESS} 
394 @cindex file system functions
396 Not yet implemented in GNU Fortran.
398 @table @asis
399 @item @emph{Description}:
401 @item @emph{Standard}:
402 GNU extension
404 @item @emph{Class}:
405 @item @emph{Syntax}:
406 @item @emph{Arguments}:
407 @item @emph{Return value}:
408 @item @emph{Example}:
409 @item @emph{Specific names}:
410 @item @emph{See also}:
412 @end table
415 @node ACHAR
416 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence 
417 @findex @code{ACHAR} intrinsic
418 @cindex @acronym{ASCII} collating sequence
420 @table @asis
421 @item @emph{Description}:
422 @code{ACHAR(I)} returns the character located at position @code{I}
423 in the @acronym{ASCII} collating sequence.
425 @item @emph{Standard}:
426 F77 and later
428 @item @emph{Class}:
429 Elemental function
431 @item @emph{Syntax}:
432 @code{C = ACHAR(I)}
434 @item @emph{Arguments}:
435 @multitable @columnfractions .15 .80
436 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
437 @end multitable
439 @item @emph{Return value}:
440 The return value is of type @code{CHARACTER} with a length of one.  The
441 kind type parameter is the same as  @code{KIND('A')}.
443 @item @emph{Example}:
444 @smallexample
445 program test_achar
446   character c
447   c = achar(32)
448 end program test_achar
449 @end smallexample
450 @end table
454 @node ACOS
455 @section @code{ACOS} --- Arccosine function 
456 @findex @code{ACOS} intrinsic
457 @findex @code{DACOS} intrinsic
458 @cindex trigonometric functions (inverse)
460 @table @asis
461 @item @emph{Description}:
462 @code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
464 @item @emph{Standard}:
465 F77 and later
467 @item @emph{Class}:
468 Elemental function
470 @item @emph{Syntax}:
471 @code{X = ACOS(X)}
473 @item @emph{Arguments}:
474 @multitable @columnfractions .15 .80
475 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
476 less than one.
477 @end multitable
479 @item @emph{Return value}:
480 The return value is of type @code{REAL(*)} and it lies in the
481 range @math{ 0 \leq \acos(x) \leq \pi}. The kind type parameter 
482 is the same as @var{X}.
484 @item @emph{Example}:
485 @smallexample
486 program test_acos
487   real(8) :: x = 0.866_8
488   x = acos(x)
489 end program test_acos
490 @end smallexample
492 @item @emph{Specific names}:
493 @multitable @columnfractions .20 .20 .20 .40
494 @item Name            @tab Argument          @tab Return type       @tab Standard
495 @item @code{DACOS(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
496 @end multitable
498 @item @emph{See also}:
499 Inverse function: @ref{COS}
501 @end table
504 @node ACOSH
505 @section @code{ACOSH} --- Hyperbolic arccosine function
506 @findex @code{ACOSH} intrinsic
507 @cindex hyperbolic arccosine
508 @cindex hyperbolic cosine (inverse)
510 @table @asis
511 @item @emph{Description}:
512 @code{ACOSH(X)} computes the area hyperbolic cosine of @var{X} (inverse of @code{COSH(X)}).
514 @item @emph{Standard}:
515 GNU extension
517 @item @emph{Class}:
518 Elemental function
520 @item @emph{Syntax}:
521 @code{X = ACOSH(X)}
523 @item @emph{Arguments}:
524 @multitable @columnfractions .15 .80
525 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
526 greater or equal to one.
527 @end multitable
529 @item @emph{Return value}:
530 The return value is of type @code{REAL(*)} and it lies in the
531 range @math{0 \leq \acosh (x) \leq \infty}.
533 @item @emph{Example}:
534 @smallexample
535 PROGRAM test_acosh
536   REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
537   WRITE (*,*) ACOSH(x)
538 END PROGRAM
539 @end smallexample
541 @item @emph{See also}:
542 Inverse function: @ref{COSH}
543 @end table
547 @node ADJUSTL
548 @section @code{ADJUSTL} --- Left adjust a string 
549 @findex @code{ADJUSTL} intrinsic
550 @cindex adjust string
552 @table @asis
553 @item @emph{Description}:
554 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
555 Spaces are inserted at the end of the string as needed.
557 @item @emph{Standard}:
558 F95 and later
560 @item @emph{Class}:
561 Elemental function
563 @item @emph{Syntax}:
564 @code{STR = ADJUSTL(STR)}
566 @item @emph{Arguments}:
567 @multitable @columnfractions .15 .80
568 @item @var{STR} @tab The type shall be @code{CHARACTER}.
569 @end multitable
571 @item @emph{Return value}:
572 The return value is of type @code{CHARACTER} where leading spaces 
573 are removed and the same number of spaces are inserted on the end
574 of @var{STR}.
576 @item @emph{Example}:
577 @smallexample
578 program test_adjustl
579   character(len=20) :: str = '   gfortran'
580   str = adjustl(str)
581   print *, str
582 end program test_adjustl
583 @end smallexample
584 @end table
588 @node ADJUSTR
589 @section @code{ADJUSTR} --- Right adjust a string 
590 @findex @code{ADJUSTR} intrinsic
591 @cindex adjust string
593 @table @asis
594 @item @emph{Description}:
595 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
596 Spaces are inserted at the start of the string as needed.
598 @item @emph{Standard}:
599 F95 and later
601 @item @emph{Class}:
602 Elemental function
604 @item @emph{Syntax}:
605 @code{STR = ADJUSTR(STR)}
607 @item @emph{Arguments}:
608 @multitable @columnfractions .15 .80
609 @item @var{STR} @tab The type shall be @code{CHARACTER}.
610 @end multitable
612 @item @emph{Return value}:
613 The return value is of type @code{CHARACTER} where trailing spaces 
614 are removed and the same number of spaces are inserted at the start
615 of @var{STR}.
617 @item @emph{Example}:
618 @smallexample
619 program test_adjustr
620   character(len=20) :: str = 'gfortran'
621   str = adjustr(str)
622   print *, str
623 end program test_adjustr
624 @end smallexample
625 @end table
629 @node AIMAG
630 @section @code{AIMAG} --- Imaginary part of complex number  
631 @findex @code{AIMAG} intrinsic
632 @findex @code{DIMAG} intrinsic
633 @findex @code{IMAG} intrinsic
634 @findex @code{IMAGPART} intrinsic
635 @cindex Imaginary part
637 @table @asis
638 @item @emph{Description}:
639 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
640 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
641 for compatibility with @command{g77}, and their use in new code is 
642 strongly discouraged.
644 @item @emph{Standard}:
645 F77 and later, has overloads that are GNU extensions
647 @item @emph{Class}:
648 Elemental function
650 @item @emph{Syntax}:
651 @code{X = AIMAG(Z)}
653 @item @emph{Arguments}:
654 @multitable @columnfractions .15 .80
655 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
656 @end multitable
658 @item @emph{Return value}:
659 The return value is of type real with the
660 kind type parameter of the argument.
662 @item @emph{Example}:
663 @smallexample
664 program test_aimag
665   complex(4) z4
666   complex(8) z8
667   z4 = cmplx(1.e0_4, 0.e0_4)
668   z8 = cmplx(0.e0_8, 1.e0_8)
669   print *, aimag(z4), dimag(z8)
670 end program test_aimag
671 @end smallexample
673 @item @emph{Specific names}:
674 @multitable @columnfractions .20 .20 .20 .40
675 @item Name            @tab Argument            @tab Return type       @tab Standard
676 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)}    @tab GNU extension
677 @item @code{IMAG(Z)}  @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)}    @tab GNU extension
678 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
679 @end multitable
680 @end table
684 @node AINT
685 @section @code{AINT} --- Truncate to a whole number
686 @findex @code{AINT} intrinsic
687 @findex @code{DINT} intrinsic
688 @cindex whole number
690 @table @asis
691 @item @emph{Description}:
692 @code{AINT(X [, KIND])} truncates its argument to a whole number.
694 @item @emph{Standard}:
695 F77 and later
697 @item @emph{Class}:
698 Elemental function
700 @item @emph{Syntax}:
701 @code{X = AINT(X)} 
702 @code{X = AINT(X, KIND)}
704 @item @emph{Arguments}:
705 @multitable @columnfractions .15 .80
706 @item @var{X}    @tab The type of the argument shall be @code{REAL(*)}.
707 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
708 initialization expression.
709 @end multitable
711 @item @emph{Return value}:
712 The return value is of type real with the kind type parameter of the
713 argument if the optional @var{KIND} is absent; otherwise, the kind
714 type parameter will be given by @var{KIND}.  If the magnitude of 
715 @var{X} is less than one, then @code{AINT(X)} returns zero.  If the
716 magnitude is equal to or greater than one, then it returns the largest
717 whole number that does not exceed its magnitude.  The sign is the same
718 as the sign of @var{X}. 
720 @item @emph{Example}:
721 @smallexample
722 program test_aint
723   real(4) x4
724   real(8) x8
725   x4 = 1.234E0_4
726   x8 = 4.321_8
727   print *, aint(x4), dint(x8)
728   x8 = aint(x4,8)
729 end program test_aint
730 @end smallexample
732 @item @emph{Specific names}:
733 @multitable @columnfractions .20 .20 .20 .40
734 @item Name           @tab Argument         @tab Return type      @tab Standard
735 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)}   @tab F77 and later
736 @end multitable
737 @end table
741 @node ALARM
742 @section @code{ALARM} --- Execute a routine after a given delay
743 @findex @code{ALARM} intrinsic
745 @table @asis
746 @item @emph{Description}:
747 @code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
748 to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
749 set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
750 supplied, it will be returned with the number of seconds remaining until
751 any previously scheduled alarm was due to be delivered, or zero if there
752 was no previously scheduled alarm.
754 @item @emph{Standard}:
755 GNU extension
757 @item @emph{Class}:
758 Subroutine
760 @item @emph{Syntax}:
761 @code{CALL ALARM(SECONDS, HANDLER)} 
762 @code{CALL ALARM(SECONDS, HANDLER, STATUS)}
764 @item @emph{Arguments}:
765 @multitable @columnfractions .15 .80
766 @item @var{SECONDS} @tab The type of the argument shall be a scalar
767 @code{INTEGER}. It is @code{INTENT(IN)}.
768 @item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
769 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
770 @code{INTEGER}. It is @code{INTENT(IN)}.
771 @item @var{STATUS}  @tab (Optional) @var{STATUS} shall be a scalar
772 @code{INTEGER} variable. It is @code{INTENT(OUT)}.
773 @end multitable
775 @item @emph{Example}:
776 @smallexample
777 program test_alarm
778   external handler_print
779   integer i
780   call alarm (3, handler_print, i)
781   print *, i
782   call sleep(10)
783 end program test_alarm
784 @end smallexample
785 This will cause the external routine @var{handler_print} to be called
786 after 3 seconds.
787 @end table
791 @node ALL
792 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true 
793 @findex @code{ALL} intrinsic
794 @cindex true values
796 @table @asis
797 @item @emph{Description}:
798 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
799 in the array along dimension @var{DIM}.
801 @item @emph{Standard}:
802 F95 and later
804 @item @emph{Class}:
805 transformational function
807 @item @emph{Syntax}:
808 @code{L = ALL(MASK)} 
809 @code{L = ALL(MASK, DIM)}
811 @item @emph{Arguments}:
812 @multitable @columnfractions .15 .80
813 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
814 it shall not be scalar.
815 @item @var{DIM}  @tab (Optional) @var{DIM} shall be a scalar integer
816 with a value that lies between one and the rank of @var{MASK}.
817 @end multitable
819 @item @emph{Return value}:
820 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
821 the kind type parameter is the same as the kind type parameter of
822 @var{MASK}.  If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
823 an array with the rank of @var{MASK} minus 1.  The shape is determined from
824 the shape of @var{MASK} where the @var{DIM} dimension is elided. 
826 @table @asis
827 @item (A)
828 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
829 It also is true if @var{MASK} has zero size; otherwise, it is false.
830 @item (B)
831 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
832 to @code{ALL(MASK)}.  If the rank is greater than one, then @code{ALL(MASK,DIM)}
833 is determined by applying @code{ALL} to the array sections.
834 @end table
836 @item @emph{Example}:
837 @smallexample
838 program test_all
839   logical l
840   l = all((/.true., .true., .true./))
841   print *, l
842   call section
843   contains
844     subroutine section
845       integer a(2,3), b(2,3)
846       a = 1
847       b = 1
848       b(2,2) = 2
849       print *, all(a .eq. b, 1)
850       print *, all(a .eq. b, 2)
851     end subroutine section
852 end program test_all
853 @end smallexample
854 @end table
858 @node ALLOCATED
859 @section @code{ALLOCATED} --- Status of an allocatable entity
860 @findex @code{ALLOCATED} intrinsic
861 @cindex allocation status
863 @table @asis
864 @item @emph{Description}:
865 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
867 @item @emph{Standard}:
868 F95 and later
870 @item @emph{Class}:
871 Inquiry function
873 @item @emph{Syntax}:
874 @code{L = ALLOCATED(X)}
876 @item @emph{Arguments}:
877 @multitable @columnfractions .15 .80
878 @item @var{X}    @tab The argument shall be an @code{ALLOCATABLE} array.
879 @end multitable
881 @item @emph{Return value}:
882 The return value is a scalar @code{LOGICAL} with the default logical
883 kind type parameter.  If @var{X} is allocated, @code{ALLOCATED(X)}
884 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.} 
886 @item @emph{Example}:
887 @smallexample
888 program test_allocated
889   integer :: i = 4
890   real(4), allocatable :: x(:)
891   if (allocated(x) .eqv. .false.) allocate(x(i))
892 end program test_allocated
893 @end smallexample
894 @end table
897 @node AND
898 @section @code{AND} --- Bitwise logical AND
899 @findex @code{AND} intrinsic
900 @cindex bit operations
902 @table @asis
903 @item @emph{Description}:
904 Bitwise logical @code{AND}.
906 This intrinsic routine is provided for backwards compatibility with 
907 GNU Fortran 77.  For integer arguments, programmers should consider
908 the use of the @ref{IAND} intrinsic defined by the Fortran standard.
910 @item @emph{Standard}:
911 GNU extension
913 @item @emph{Class}:
914 Non-elemental function
916 @item @emph{Syntax}:
917 @code{RESULT = AND(X, Y)}
919 @item @emph{Arguments}:
920 @multitable @columnfractions .15 .80
921 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
922 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
923 @end multitable
925 @item @emph{Return value}:
926 The return type is either @code{INTEGER(*)} or @code{LOGICAL} after
927 cross-promotion of the arguments. 
929 @item @emph{Example}:
930 @smallexample
931 PROGRAM test_and
932   LOGICAL :: T = .TRUE., F = ..FALSE.
933   INTEGER :: a, b
934   DATA a / Z'F' /, b / Z'3' /
936   WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
937   WRITE (*,*) AND(a, b)
938 END PROGRAM
939 @end smallexample
941 @item @emph{See also}:
942 F95 elemental function: @ref{IAND}
943 @end table
947 @node ANINT
948 @section @code{ANINT} --- Nearest whole number
949 @findex @code{ANINT} intrinsic
950 @findex @code{DNINT} intrinsic
951 @cindex whole number
953 @table @asis
954 @item @emph{Description}:
955 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
957 @item @emph{Standard}:
958 F77 and later
960 @item @emph{Class}:
961 Elemental function
963 @item @emph{Syntax}:
964 @code{X = ANINT(X)}
965 @code{X = ANINT(X, KIND)}
967 @item @emph{Arguments}:
968 @multitable @columnfractions .15 .80
969 @item @var{X}    @tab The type of the argument shall be @code{REAL(*)}.
970 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
971 initialization expression.
972 @end multitable
974 @item @emph{Return value}:
975 The return value is of type real with the kind type parameter of the
976 argument if the optional @var{KIND} is absent; otherwise, the kind
977 type parameter will be given by @var{KIND}.  If @var{X} is greater than
978 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}.  If @var{X} is
979 less than or equal to zero, then it returns @code{AINT(X-0.5)}.
981 @item @emph{Example}:
982 @smallexample
983 program test_anint
984   real(4) x4
985   real(8) x8
986   x4 = 1.234E0_4
987   x8 = 4.321_8
988   print *, anint(x4), dnint(x8)
989   x8 = anint(x4,8)
990 end program test_anint
991 @end smallexample
993 @item @emph{Specific names}:
994 @multitable @columnfractions .20 .20 .20 .40
995 @item Name            @tab Argument         @tab Return type      @tab Standard
996 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)}   @tab F77 and later
997 @end multitable
998 @end table
1002 @node ANY
1003 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true 
1004 @findex @code{ANY} intrinsic
1005 @cindex true values
1007 @table @asis
1008 @item @emph{Description}:
1009 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
1010 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
1012 @item @emph{Standard}:
1013 F95 and later
1015 @item @emph{Class}:
1016 transformational function
1018 @item @emph{Syntax}:
1019 @code{L = ANY(MASK)} 
1020 @code{L = ANY(MASK, DIM)}
1022 @item @emph{Arguments}:
1023 @multitable @columnfractions .15 .80
1024 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
1025 it shall not be scalar.
1026 @item @var{DIM}  @tab (Optional) @var{DIM} shall be a scalar integer
1027 with a value that lies between one and the rank of @var{MASK}.
1028 @end multitable
1030 @item @emph{Return value}:
1031 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
1032 the kind type parameter is the same as the kind type parameter of
1033 @var{MASK}.  If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
1034 an array with the rank of @var{MASK} minus 1.  The shape is determined from
1035 the shape of @var{MASK} where the @var{DIM} dimension is elided. 
1037 @table @asis
1038 @item (A)
1039 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
1040 otherwise, it is false.  It also is false if @var{MASK} has zero size.
1041 @item (B)
1042 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
1043 to @code{ANY(MASK)}.  If the rank is greater than one, then @code{ANY(MASK,DIM)}
1044 is determined by applying @code{ANY} to the array sections.
1045 @end table
1047 @item @emph{Example}:
1048 @smallexample
1049 program test_any
1050   logical l
1051   l = any((/.true., .true., .true./))
1052   print *, l
1053   call section
1054   contains
1055     subroutine section
1056       integer a(2,3), b(2,3)
1057       a = 1
1058       b = 1
1059       b(2,2) = 2
1060       print *, any(a .eq. b, 1)
1061       print *, any(a .eq. b, 2)
1062     end subroutine section
1063 end program test_any
1064 @end smallexample
1065 @end table
1069 @node ASIN
1070 @section @code{ASIN} --- Arcsine function 
1071 @findex @code{ASIN} intrinsic
1072 @findex @code{DASIN} intrinsic
1073 @cindex trigonometric functions (inverse)
1075 @table @asis
1076 @item @emph{Description}:
1077 @code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
1079 @item @emph{Standard}:
1080 F77 and later
1082 @item @emph{Class}:
1083 Elemental function
1085 @item @emph{Syntax}:
1086 @code{X = ASIN(X)}
1088 @item @emph{Arguments}:
1089 @multitable @columnfractions .15 .80
1090 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
1091 less than one.
1092 @end multitable
1094 @item @emph{Return value}:
1095 The return value is of type @code{REAL(*)} and it lies in the
1096 range @math{-\pi / 2 \leq \asin (x) \leq \pi / 2}.  The kind type
1097 parameter is the same as @var{X}.
1099 @item @emph{Example}:
1100 @smallexample
1101 program test_asin
1102   real(8) :: x = 0.866_8
1103   x = asin(x)
1104 end program test_asin
1105 @end smallexample
1107 @item @emph{Specific names}:
1108 @multitable @columnfractions .20 .20 .20 .40
1109 @item Name            @tab Argument          @tab Return type       @tab Standard
1110 @item @code{DASIN(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
1111 @end multitable
1113 @item @emph{See also}:
1114 Inverse function: @ref{SIN}
1116 @end table
1119 @node ASINH
1120 @section @code{ASINH} --- Hyperbolic arcsine function
1121 @findex @code{ASINH} intrinsic
1122 @cindex hyperbolic arcsine
1123 @cindex hyperbolic sine (inverse)
1125 @table @asis
1126 @item @emph{Description}:
1127 @code{ASINH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{SINH(X)}).
1129 @item @emph{Standard}:
1130 GNU extension
1132 @item @emph{Class}:
1133 Elemental function
1135 @item @emph{Syntax}:
1136 @code{X = ASINH(X)}
1138 @item @emph{Arguments}:
1139 @multitable @columnfractions .15 .80
1140 @item @var{X} @tab The type shall be @code{REAL(*)}, with @var{X} a real number.
1141 @end multitable
1143 @item @emph{Return value}:
1144 The return value is of type @code{REAL(*)} and it lies in the
1145 range @math{-\infty \leq \asinh (x) \leq \infty}.
1147 @item @emph{Example}:
1148 @smallexample
1149 PROGRAM test_asinh
1150   REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1151   WRITE (*,*) ASINH(x)
1152 END PROGRAM
1153 @end smallexample
1155 @item @emph{See also}:
1156 Inverse function: @ref{SINH}
1157 @end table
1161 @node ASSOCIATED
1162 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair 
1163 @findex @code{ASSOCIATED} intrinsic
1164 @cindex pointer status
1166 @table @asis
1167 @item @emph{Description}:
1168 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1169 or if @var{PTR} is associated with the target @var{TGT}.
1171 @item @emph{Standard}:
1172 F95 and later
1174 @item @emph{Class}:
1175 Inquiry function
1177 @item @emph{Syntax}:
1178 @code{L = ASSOCIATED(PTR)} 
1179 @code{L = ASSOCIATED(PTR [, TGT])}
1181 @item @emph{Arguments}:
1182 @multitable @columnfractions .15 .80
1183 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1184 it can be of any type.
1185 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1186 a @code{TARGET}.  It must have the same type, kind type parameter, and
1187 array rank as @var{PTR}.
1188 @end multitable
1189 The status of neither @var{PTR} nor @var{TGT} can be undefined.
1191 @item @emph{Return value}:
1192 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1193 There are several cases:
1194 @table @asis
1195 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1196 is true if @var{PTR} is associated with a target; otherwise, it returns false.
1197 @item (B) If @var{TGT} is present and a scalar target, the result is true if
1198 @var{TGT}
1199 is not a 0 sized storage sequence and the target associated with @var{PTR}
1200 occupies the same storage units.  If @var{PTR} is disassociated, then the 
1201 result is false.
1202 @item (C) If @var{TGT} is present and an array target, the result is true if
1203 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1204 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1205 @var{PTR} occupy the same storage units in array element order.
1206 As in case(B), the result is false, if @var{PTR} is disassociated.
1207 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1208 target associated with @var{PTR} and the target associated with @var{TGT}
1209 are not 0 sized storage sequences and occupy the same storage units.
1210 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1211 @item (E) If @var{TGT} is present and an array pointer, the result is true if
1212 target associated with @var{PTR} and the target associated with @var{TGT}
1213 have the same shape, are not 0 sized arrays, are arrays whose elements are
1214 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1215 storage units in array element order.
1216 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1217 @end table
1219 @item @emph{Example}:
1220 @smallexample
1221 program test_associated
1222    implicit none
1223    real, target  :: tgt(2) = (/1., 2./)
1224    real, pointer :: ptr(:)
1225    ptr => tgt
1226    if (associated(ptr)     .eqv. .false.) call abort
1227    if (associated(ptr,tgt) .eqv. .false.) call abort
1228 end program test_associated
1229 @end smallexample
1231 @item @emph{See also}:
1232 @ref{NULL}
1233 @end table
1237 @node ATAN
1238 @section @code{ATAN} --- Arctangent function 
1239 @findex @code{ATAN} intrinsic
1240 @findex @code{DATAN} intrinsic
1241 @cindex trigonometric functions (inverse)
1243 @table @asis
1244 @item @emph{Description}:
1245 @code{ATAN(X)} computes the arctangent of @var{X}.
1247 @item @emph{Standard}:
1248 F77 and later
1250 @item @emph{Class}:
1251 Elemental function
1253 @item @emph{Syntax}:
1254 @code{X = ATAN(X)}
1256 @item @emph{Arguments}:
1257 @multitable @columnfractions .15 .80
1258 @item @var{X} @tab The type shall be @code{REAL(*)}.
1259 @end multitable
1261 @item @emph{Return value}:
1262 The return value is of type @code{REAL(*)} and it lies in the
1263 range @math{ - \pi / 2 \leq \atan (x) \leq \pi / 2}.
1265 @item @emph{Example}:
1266 @smallexample
1267 program test_atan
1268   real(8) :: x = 2.866_8
1269   x = atan(x)
1270 end program test_atan
1271 @end smallexample
1273 @item @emph{Specific names}:
1274 @multitable @columnfractions .20 .20 .20 .40
1275 @item Name            @tab Argument          @tab Return type       @tab Standard
1276 @item @code{DATAN(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
1277 @end multitable
1279 @item @emph{See also}:
1280 Inverse function: @ref{TAN}
1282 @end table
1286 @node ATAN2
1287 @section @code{ATAN2} --- Arctangent function 
1288 @findex @code{ATAN2} intrinsic
1289 @findex @code{DATAN2} intrinsic
1290 @cindex trigonometric functions (inverse)
1292 @table @asis
1293 @item @emph{Description}:
1294 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1296 @item @emph{Standard}:
1297 F77 and later
1299 @item @emph{Class}:
1300 Elemental function
1302 @item @emph{Syntax}:
1303 @code{X = ATAN2(Y,X)}
1305 @item @emph{Arguments}:
1306 @multitable @columnfractions .15 .80
1307 @item @var{Y} @tab The type shall be @code{REAL(*)}.
1308 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
1309 If @var{Y} is zero, then @var{X} must be nonzero.
1310 @end multitable
1312 @item @emph{Return value}:
1313 The return value has the same type and kind type parameter as @var{Y}.
1314 It is the principal value of the complex number @math{X + i Y}.  If
1315 @var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
1316 The sign is positive if @var{Y} is positive.  If @var{Y} is zero, then
1317 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1318 is negative.  Finally, if @var{X} is zero, then the magnitude of the result
1319 is @math{\pi/2}.
1321 @item @emph{Example}:
1322 @smallexample
1323 program test_atan2
1324   real(4) :: x = 1.e0_4, y = 0.5e0_4
1325   x = atan2(y,x)
1326 end program test_atan2
1327 @end smallexample
1329 @item @emph{Specific names}:
1330 @multitable @columnfractions .20 .20 .20 .40
1331 @item Name            @tab Argument          @tab Return type    @tab Standard
1332 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1333 @end multitable
1334 @end table
1338 @node ATANH
1339 @section @code{ATANH} --- Hyperbolic arctangent function
1340 @findex @code{ASINH} intrinsic
1341 @cindex hyperbolic arctangent
1342 @cindex hyperbolic tangent (inverse)
1344 @table @asis
1345 @item @emph{Description}:
1346 @code{ATANH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{TANH(X)}).
1348 @item @emph{Standard}:
1349 GNU extension
1351 @item @emph{Class}:
1352 Elemental function
1354 @item @emph{Syntax}:
1355 @code{X = ATANH(X)}
1357 @item @emph{Arguments}:
1358 @multitable @columnfractions .15 .80
1359 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is less than or equal to one.
1360 @end multitable
1362 @item @emph{Return value}:
1363 The return value is of type @code{REAL(*)} and it lies in the
1364 range @math{-\infty \leq \atanh(x) \leq \infty}.
1366 @item @emph{Example}:
1367 @smallexample
1368 PROGRAM test_atanh
1369   REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1370   WRITE (*,*) ATANH(x)
1371 END PROGRAM
1372 @end smallexample
1374 @item @emph{See also}:
1375 Inverse function: @ref{TANH}
1376 @end table
1381 @node BESJ0
1382 @section @code{BESJ0} --- Bessel function of the first kind of order 0
1383 @findex @code{BESJ0} intrinsic
1384 @findex @code{DBESJ0} intrinsic
1385 @cindex Bessel
1387 @table @asis
1388 @item @emph{Description}:
1389 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1390 of @var{X}.
1392 @item @emph{Standard}:
1393 GNU extension
1395 @item @emph{Class}:
1396 Elemental function
1398 @item @emph{Syntax}:
1399 @code{X = BESJ0(X)}
1401 @item @emph{Arguments}:
1402 @multitable @columnfractions .15 .80
1403 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1404 @end multitable
1406 @item @emph{Return value}:
1407 The return value is of type @code{REAL(*)} and it lies in the
1408 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1410 @item @emph{Example}:
1411 @smallexample
1412 program test_besj0
1413   real(8) :: x = 0.0_8
1414   x = besj0(x)
1415 end program test_besj0
1416 @end smallexample
1418 @item @emph{Specific names}:
1419 @multitable @columnfractions .20 .20 .20 .40
1420 @item Name            @tab Argument          @tab Return type       @tab Standard
1421 @item @code{DBESJ0(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}   @tab GNU extension
1422 @end multitable
1423 @end table
1427 @node BESJ1
1428 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1429 @findex @code{BESJ1} intrinsic
1430 @findex @code{DBESJ1} intrinsic
1431 @cindex Bessel
1433 @table @asis
1434 @item @emph{Description}:
1435 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1436 of @var{X}.
1438 @item @emph{Standard}:
1439 GNU extension
1441 @item @emph{Class}:
1442 Elemental function
1444 @item @emph{Syntax}:
1445 @code{X = BESJ1(X)}
1447 @item @emph{Arguments}:
1448 @multitable @columnfractions .15 .80
1449 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1450 @end multitable
1452 @item @emph{Return value}:
1453 The return value is of type @code{REAL(*)} and it lies in the
1454 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1456 @item @emph{Example}:
1457 @smallexample
1458 program test_besj1
1459   real(8) :: x = 1.0_8
1460   x = besj1(x)
1461 end program test_besj1
1462 @end smallexample
1464 @item @emph{Specific names}:
1465 @multitable @columnfractions .20 .20 .20 .40
1466 @item Name            @tab Argument          @tab Return type       @tab Standard
1467 @item @code{DBESJ1(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
1468 @end multitable
1469 @end table
1473 @node BESJN
1474 @section @code{BESJN} --- Bessel function of the first kind
1475 @findex @code{BESJN} intrinsic
1476 @findex @code{DBESJN} intrinsic
1477 @cindex Bessel
1479 @table @asis
1480 @item @emph{Description}:
1481 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1482 @var{N} of @var{X}.
1484 @item @emph{Standard}:
1485 GNU extension
1487 @item @emph{Class}:
1488 Elemental function
1490 @item @emph{Syntax}:
1491 @code{Y = BESJN(N, X)}
1493 @item @emph{Arguments}:
1494 @multitable @columnfractions .15 .80
1495 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1496 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1497 @end multitable
1499 @item @emph{Return value}:
1500 The return value is a scalar of type @code{REAL(*)}.
1502 @item @emph{Example}:
1503 @smallexample
1504 program test_besjn
1505   real(8) :: x = 1.0_8
1506   x = besjn(5,x)
1507 end program test_besjn
1508 @end smallexample
1510 @item @emph{Specific names}:
1511 @multitable @columnfractions .20 .20 .20 .40
1512 @item Name             @tab Argument            @tab Return type       @tab Standard
1513 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)}    @tab GNU extension
1514 @item                  @tab @code{REAL(8) X}    @tab                   @tab
1515 @end multitable
1516 @end table
1520 @node BESY0
1521 @section @code{BESY0} --- Bessel function of the second kind of order 0
1522 @findex @code{BESY0} intrinsic
1523 @findex @code{DBESY0} intrinsic
1524 @cindex Bessel
1526 @table @asis
1527 @item @emph{Description}:
1528 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1529 of @var{X}.
1531 @item @emph{Standard}:
1532 GNU extension
1534 @item @emph{Class}:
1535 Elemental function
1537 @item @emph{Syntax}:
1538 @code{X = BESY0(X)}
1540 @item @emph{Arguments}:
1541 @multitable @columnfractions .15 .80
1542 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1543 @end multitable
1545 @item @emph{Return value}:
1546 The return value is a scalar of type @code{REAL(*)}.
1548 @item @emph{Example}:
1549 @smallexample
1550 program test_besy0
1551   real(8) :: x = 0.0_8
1552   x = besy0(x)
1553 end program test_besy0
1554 @end smallexample
1556 @item @emph{Specific names}:
1557 @multitable @columnfractions .20 .20 .20 .40
1558 @item Name            @tab Argument          @tab Return type       @tab Standard
1559 @item @code{DBESY0(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
1560 @end multitable
1561 @end table
1565 @node BESY1
1566 @section @code{BESY1} --- Bessel function of the second kind of order 1
1567 @findex @code{BESY1} intrinsic
1568 @findex @code{DBESY1} intrinsic
1569 @cindex Bessel
1571 @table @asis
1572 @item @emph{Description}:
1573 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1574 of @var{X}.
1576 @item @emph{Standard}:
1577 GNU extension
1579 @item @emph{Class}:
1580 Elemental function
1582 @item @emph{Syntax}:
1583 @code{X = BESY1(X)}
1585 @item @emph{Arguments}:
1586 @multitable @columnfractions .15 .80
1587 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1588 @end multitable
1590 @item @emph{Return value}:
1591 The return value is a scalar of type @code{REAL(*)}.
1593 @item @emph{Example}:
1594 @smallexample
1595 program test_besy1
1596   real(8) :: x = 1.0_8
1597   x = besy1(x)
1598 end program test_besy1
1599 @end smallexample
1601 @item @emph{Specific names}:
1602 @multitable @columnfractions .20 .20 .20 .40
1603 @item Name            @tab Argument          @tab Return type       @tab Standard
1604 @item @code{DBESY1(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
1605 @end multitable
1606 @end table
1610 @node BESYN
1611 @section @code{BESYN} --- Bessel function of the second kind
1612 @findex @code{BESYN} intrinsic
1613 @findex @code{DBESYN} intrinsic
1614 @cindex Bessel
1616 @table @asis
1617 @item @emph{Description}:
1618 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1619 @var{N} of @var{X}.
1621 @item @emph{Standard}:
1622 GNU extension
1624 @item @emph{Class}:
1625 Elemental function
1627 @item @emph{Syntax}:
1628 @code{Y = BESYN(N, X)}
1630 @item @emph{Arguments}:
1631 @multitable @columnfractions .15 .80
1632 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1633 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1634 @end multitable
1636 @item @emph{Return value}:
1637 The return value is a scalar of type @code{REAL(*)}.
1639 @item @emph{Example}:
1640 @smallexample
1641 program test_besyn
1642   real(8) :: x = 1.0_8
1643   x = besyn(5,x)
1644 end program test_besyn
1645 @end smallexample
1647 @item @emph{Specific names}:
1648 @multitable @columnfractions .20 .20 .20 .40
1649 @item Name               @tab Argument            @tab Return type     @tab Standard
1650 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)}  @tab GNU extension
1651 @item                    @tab @code{REAL(8)    X} @tab                 @tab 
1652 @end multitable
1653 @end table
1657 @node BIT_SIZE
1658 @section @code{BIT_SIZE} --- Bit size inquiry function
1659 @findex @code{BIT_SIZE} intrinsic
1660 @cindex bit_size
1662 @table @asis
1663 @item @emph{Description}:
1664 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1665 represented by the type of @var{I}.
1667 @item @emph{Standard}:
1668 F95 and later
1670 @item @emph{Class}:
1671 Inquiry function
1673 @item @emph{Syntax}:
1674 @code{I = BIT_SIZE(I)}
1676 @item @emph{Arguments}:
1677 @multitable @columnfractions .15 .80
1678 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1679 @end multitable
1681 @item @emph{Return value}:
1682 The return value is of type @code{INTEGER(*)}
1684 @item @emph{Example}:
1685 @smallexample
1686 program test_bit_size
1687     integer :: i = 123
1688     integer :: size
1689     size = bit_size(i)
1690     print *, size
1691 end program test_bit_size
1692 @end smallexample
1693 @end table
1697 @node BTEST
1698 @section @code{BTEST} --- Bit test function
1699 @findex @code{BTEST} intrinsic
1700 @cindex bit operations
1702 @table @asis
1703 @item @emph{Description}:
1704 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1705 in @var{I} is set.
1707 @item @emph{Standard}:
1708 F95 and later
1710 @item @emph{Class}:
1711 Elemental function
1713 @item @emph{Syntax}:
1714 @code{I = BTEST(I,POS)}
1716 @item @emph{Arguments}:
1717 @multitable @columnfractions .15 .80
1718 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1719 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1720 @end multitable
1722 @item @emph{Return value}:
1723 The return value is of type @code{LOGICAL}
1725 @item @emph{Example}:
1726 @smallexample
1727 program test_btest
1728     integer :: i = 32768 + 1024 + 64
1729     integer :: pos
1730     logical :: bool
1731     do pos=0,16
1732         bool = btest(i, pos) 
1733         print *, pos, bool
1734     end do
1735 end program test_btest
1736 @end smallexample
1737 @end table
1741 @node CEILING
1742 @section @code{CEILING} --- Integer ceiling function
1743 @findex @code{CEILING} intrinsic
1744 @cindex CEILING
1746 @table @asis
1747 @item @emph{Description}:
1748 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1750 @item @emph{Standard}:
1751 F95 and later
1753 @item @emph{Class}:
1754 Elemental function
1756 @item @emph{Syntax}:
1757 @code{I = CEILING(X[,KIND])}
1759 @item @emph{Arguments}:
1760 @multitable @columnfractions .15 .80
1761 @item @var{X} @tab The type shall be @code{REAL(*)}.
1762 @item @var{KIND} @tab (Optional) scalar integer initialization expression.
1763 @end multitable
1765 @item @emph{Return value}:
1766 The return value is of type @code{INTEGER(KIND)}
1768 @item @emph{Example}:
1769 @smallexample
1770 program test_ceiling
1771     real :: x = 63.29
1772     real :: y = -63.59
1773     print *, ceiling(x) ! returns 64
1774     print *, ceiling(y) ! returns -63
1775 end program test_ceiling
1776 @end smallexample
1778 @item @emph{See also}:
1779 @ref{FLOOR}, @ref{NINT}
1781 @end table
1785 @node CHAR
1786 @section @code{CHAR} --- Character conversion function
1787 @findex @code{CHAR} intrinsic
1788 @cindex conversion function (character)
1790 @table @asis
1791 @item @emph{Description}:
1792 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1794 @item @emph{Standard}:
1795 F77 and later
1797 @item @emph{Class}:
1798 Elemental function
1800 @item @emph{Syntax}:
1801 @code{C = CHAR(I[,KIND])}
1803 @item @emph{Arguments}:
1804 @multitable @columnfractions .15 .80
1805 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1806 @item @var{KIND} @tab Optional scaler integer initialization expression.
1807 @end multitable
1809 @item @emph{Return value}:
1810 The return value is of type @code{CHARACTER(1)}
1812 @item @emph{Example}:
1813 @smallexample
1814 program test_char
1815     integer :: i = 74
1816     character(1) :: c
1817     c = char(i)
1818     print *, i, c ! returns 'J'
1819 end program test_char
1820 @end smallexample
1822 @item @emph{See also}:
1823 @ref{ACHAR}, @ref{ICHAR}, @ref{IACHAR}
1825 @end table
1828 @node CHDIR
1829 @section @code{CHDIR} --- Change working directory
1830 @findex @code{CHDIR} intrinsic
1831 @cindex file system functions
1833 @table @asis
1834 @item @emph{Description}:
1835 Change current working directory to a specified @var{PATH}.
1837 @item @emph{Standard}:
1838 GNU extension
1840 @item @emph{Class}:
1841 Non-elemental subroutine
1843 @item @emph{Syntax}:
1844 @code{CALL chdir(PATH[,STATUS])}
1846 @item @emph{Arguments}:
1847 @multitable @columnfractions .15 .80
1848 @item @var{PATH}   @tab The type shall be @code{CHARACTER(*)} and shall specify a valid path within the file system.
1849 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success, 
1850                         a system specific and non-zero error code otherwise.
1851 @end multitable
1853 @item @emph{Example}:
1854 @smallexample
1855 PROGRAM test_chdir
1856   CHARACTER(len=255) :: path
1857   CALL getcwd(path)
1858   WRITE(*,*) TRIM(path)
1859   CALL chdir("/tmp")
1860   CALL getcwd(path)
1861   WRITE(*,*) TRIM(path)
1862 END PROGRAM
1863 @end smallexample
1865 @item @emph{See also}:
1866 @ref{GETCWD}
1867 @end table
1871 @node CHMOD
1872 @section @code{CHMOD} --- Change access permissions of files
1873 @findex @code{CHMOD} 
1874 @cindex file system functions
1876 Not yet implemented in GNU Fortran.
1878 @table @asis
1879 @item @emph{Description}:
1881 @item @emph{Standard}:
1882 GNU extension
1884 @item @emph{Class}:
1885 Subroutine
1887 @item @emph{Syntax}:
1888 @item @emph{Arguments}:
1889 @item @emph{Return value}:
1890 @item @emph{Example}:
1891 @item @emph{Specific names}:
1892 @item @emph{See also}:
1894 @end table
1897 @node CMPLX
1898 @section @code{CMPLX} --- Complex conversion function
1899 @findex @code{CMPLX} intrinsic
1900 @cindex CMPLX
1902 @table @asis
1903 @item @emph{Description}:
1904 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1905 the real component.  If @var{Y} is present it is converted to the imaginary
1906 component.  If @var{Y} is not present then the imaginary component is set to
1907 0.0.  If @var{X} is complex then @var{Y} must not be present.
1909 @item @emph{Standard}:
1910 F77 and later
1912 @item @emph{Class}:
1913 Elemental function
1915 @item @emph{Syntax}:
1916 @code{C = CMPLX(X[,Y[,KIND]])}
1918 @item @emph{Arguments}:
1919 @multitable @columnfractions .15 .80
1920 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1921 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}.  May be @code{INTEGER(*)} or @code{REAL(*)}. 
1922 @item @var{KIND} @tab Optional scaler integer initialization expression.
1923 @end multitable
1925 @item @emph{Return value}:
1926 The return value is of type @code{COMPLEX(*)}
1928 @item @emph{Example}:
1929 @smallexample
1930 program test_cmplx
1931     integer :: i = 42
1932     real :: x = 3.14
1933     complex :: z
1934     z = cmplx(i, x)
1935     print *, z, cmplx(x)
1936 end program test_cmplx
1937 @end smallexample
1938 @end table
1942 @node COMMAND_ARGUMENT_COUNT
1943 @section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
1944 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1945 @cindex command line arguments
1946 @cindex getopt
1948 @table @asis
1949 @item @emph{Description}:
1950 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1951 command line when the containing program was invoked.
1953 @item @emph{Standard}:
1954 F2003
1956 @item @emph{Class}:
1957 Inquiry function
1959 @item @emph{Syntax}:
1960 @code{I = COMMAND_ARGUMENT_COUNT()}
1962 @item @emph{Arguments}:
1963 @multitable @columnfractions .15 .80
1964 @item None
1965 @end multitable
1967 @item @emph{Return value}:
1968 The return value is of type @code{INTEGER(4)}
1970 @item @emph{Example}:
1971 @smallexample
1972 program test_command_argument_count
1973     integer :: count
1974     count = command_argument_count()
1975     print *, count
1976 end program test_command_argument_count
1977 @end smallexample
1979 @item @emph{See also}:
1980 @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
1981 @end table
1983 @node CONJG
1984 @section @code{CONJG} --- Complex conjugate function 
1985 @findex @code{CONJG} intrinsic
1986 @findex @code{DCONJG} intrinsic
1987 @cindex complex conjugate
1988 @table @asis
1989 @item @emph{Description}:
1990 @code{CONJG(Z)} returns the conjugate of @var{Z}.  If @var{Z} is @code{(x, y)}
1991 then the result is @code{(x, -y)}
1993 @item @emph{Standard}:
1994 F77 and later, has overloads that are GNU extensions
1996 @item @emph{Class}:
1997 Elemental function
1999 @item @emph{Syntax}:
2000 @code{Z = CONJG(Z)}
2002 @item @emph{Arguments}:
2003 @multitable @columnfractions .15 .80
2004 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2005 @end multitable
2007 @item @emph{Return value}:
2008 The return value is of type @code{COMPLEX(*)}.
2010 @item @emph{Example}:
2011 @smallexample
2012 program test_conjg
2013     complex :: z = (2.0, 3.0)
2014     complex(8) :: dz = (2.71_8, -3.14_8)
2015     z= conjg(z)
2016     print *, z
2017     dz = dconjg(dz)
2018     print *, dz
2019 end program test_conjg
2020 @end smallexample
2022 @item @emph{Specific names}:
2023 @multitable @columnfractions .20 .20 .20 .40
2024 @item Name             @tab Argument             @tab Return type          @tab Standard
2025 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z}  @tab @code{COMPLEX(8)}    @tab GNU extension
2026 @end multitable
2027 @end table
2031 @node COS
2032 @section @code{COS} --- Cosine function 
2033 @findex @code{COS} intrinsic
2034 @findex @code{DCOS} intrinsic
2035 @findex @code{ZCOS} intrinsic
2036 @findex @code{CDCOS} intrinsic
2037 @cindex trigonometric functions
2039 @table @asis
2040 @item @emph{Description}:
2041 @code{COS(X)} computes the cosine of @var{X}.
2043 @item @emph{Standard}:
2044 F77 and later, has overloads that are GNU extensions
2046 @item @emph{Class}:
2047 Elemental function
2049 @item @emph{Syntax}:
2050 @code{X = COS(X)}
2052 @item @emph{Arguments}:
2053 @multitable @columnfractions .15 .80
2054 @item @var{X} @tab The type shall be @code{REAL(*)} or
2055 @code{COMPLEX(*)}.
2056 @end multitable
2058 @item @emph{Return value}:
2059 The return value is of type @code{REAL(*)} and it lies in the
2060 range @math{ -1 \leq \cos (x) \leq 1}.  The kind type
2061 parameter is the same as @var{X}.
2063 @item @emph{Example}:
2064 @smallexample
2065 program test_cos
2066   real :: x = 0.0
2067   x = cos(x)
2068 end program test_cos
2069 @end smallexample
2071 @item @emph{Specific names}:
2072 @multitable @columnfractions .20 .20 .20 .40
2073 @item Name            @tab Argument            @tab Return type       @tab Standard
2074 @item @code{DCOS(X)}  @tab @code{REAL(8) X}    @tab @code{REAL(8)}    @tab F77 and later
2075 @item @code{CCOS(X)}  @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2076 @item @code{ZCOS(X)}  @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2077 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2078 @end multitable
2080 @item @emph{See also}:
2081 Inverse function: @ref{ACOS}
2083 @end table
2087 @node COSH
2088 @section @code{COSH} --- Hyperbolic cosine function 
2089 @findex @code{COSH} intrinsic
2090 @findex @code{DCOSH} intrinsic
2091 @cindex hyperbolic cosine
2093 @table @asis
2094 @item @emph{Description}:
2095 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2097 @item @emph{Standard}:
2098 F77 and later
2100 @item @emph{Class}:
2101 Elemental function
2103 @item @emph{Syntax}:
2104 @code{X = COSH(X)}
2106 @item @emph{Arguments}:
2107 @multitable @columnfractions .15 .80
2108 @item @var{X} @tab The type shall be @code{REAL(*)}.
2109 @end multitable
2111 @item @emph{Return value}:
2112 The return value is of type @code{REAL(*)} and it is positive
2113 (@math{ \cosh (x) \geq 0 }.
2115 @item @emph{Example}:
2116 @smallexample
2117 program test_cosh
2118   real(8) :: x = 1.0_8
2119   x = cosh(x)
2120 end program test_cosh
2121 @end smallexample
2123 @item @emph{Specific names}:
2124 @multitable @columnfractions .20 .20 .20 .40
2125 @item Name            @tab Argument          @tab Return type       @tab Standard
2126 @item @code{DCOSH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
2127 @end multitable
2129 @item @emph{See also}:
2130 Inverse function: @ref{ACOSH}
2132 @end table
2136 @node COUNT
2137 @section @code{COUNT} --- Count function
2138 @findex @code{COUNT} intrinsic
2139 @cindex count
2141 @table @asis
2142 @item @emph{Description}:
2143 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2144 @var{MASK} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
2145 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
2146 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2148 @item @emph{Standard}:
2149 F95 and later
2151 @item @emph{Class}:
2152 transformational function
2154 @item @emph{Syntax}:
2155 @code{I = COUNT(MASK[,DIM])}
2157 @item @emph{Arguments}:
2158 @multitable @columnfractions .15 .80
2159 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2160 @item @var{DIM}  @tab The type shall be @code{INTEGER}.
2161 @end multitable
2163 @item @emph{Return value}:
2164 The return value is of type @code{INTEGER} with rank equal to that of
2165 @var{MASK}.
2167 @item @emph{Example}:
2168 @smallexample
2169 program test_count
2170     integer, dimension(2,3) :: a, b
2171     logical, dimension(2,3) :: mask
2172     a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2173     b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2174     print '(3i3)', a(1,:)
2175     print '(3i3)', a(2,:)
2176     print *
2177     print '(3i3)', b(1,:)
2178     print '(3i3)', b(2,:)
2179     print *
2180     mask = a.ne.b
2181     print '(3l3)', mask(1,:)
2182     print '(3l3)', mask(2,:)
2183     print *
2184     print '(3i3)', count(mask)
2185     print *
2186     print '(3i3)', count(mask, 1)
2187     print *
2188     print '(3i3)', count(mask, 2)
2189 end program test_count
2190 @end smallexample
2191 @end table
2195 @node CPU_TIME
2196 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2197 @findex @code{CPU_TIME} intrinsic
2198 @cindex CPU_TIME
2200 @table @asis
2201 @item @emph{Description}:
2202 Returns a @code{REAL} value representing the elapsed CPU time in seconds.  This
2203 is useful for testing segments of code to determine execution time.
2205 @item @emph{Standard}:
2206 F95 and later
2208 @item @emph{Class}:
2209 Subroutine
2211 @item @emph{Syntax}:
2212 @code{CPU_TIME(X)}
2214 @item @emph{Arguments}:
2215 @multitable @columnfractions .15 .80
2216 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2217 @end multitable
2219 @item @emph{Return value}:
2220 None
2222 @item @emph{Example}:
2223 @smallexample
2224 program test_cpu_time
2225     real :: start, finish
2226     call cpu_time(start)
2227         ! put code to test here
2228     call cpu_time(finish)
2229     print '("Time = ",f6.3," seconds.")',finish-start
2230 end program test_cpu_time
2231 @end smallexample
2232 @end table
2236 @node CSHIFT
2237 @section @code{CSHIFT} --- Circular shift function
2238 @findex @code{CSHIFT} intrinsic
2239 @cindex bit manipulation
2241 @table @asis
2242 @item @emph{Description}:
2243 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2244 @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
2245 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
2246 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2247 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2248 by @var{SHIFT} places.  If rank is greater than one, then all complete rank one
2249 sections of @var{ARRAY} along the given dimension are shifted.  Elements
2250 shifted out one end of each rank one section are shifted back in the other end.
2252 @item @emph{Standard}:
2253 F95 and later
2255 @item @emph{Class}:
2256 transformational function
2258 @item @emph{Syntax}:
2259 @code{A = CSHIFT(A, SHIFT[,DIM])}
2261 @item @emph{Arguments}:
2262 @multitable @columnfractions .15 .80
2263 @item @var{ARRAY}  @tab May be any type, not scaler.
2264 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2265 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2266 @end multitable
2268 @item @emph{Return value}:
2269 Returns an array of same type and rank as the @var{ARRAY} argument.
2271 @item @emph{Example}:
2272 @smallexample
2273 program test_cshift
2274     integer, dimension(3,3) :: a
2275     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2276     print '(3i3)', a(1,:)
2277     print '(3i3)', a(2,:)
2278     print '(3i3)', a(3,:)    
2279     a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2280     print *
2281     print '(3i3)', a(1,:)
2282     print '(3i3)', a(2,:)
2283     print '(3i3)', a(3,:)
2284 end program test_cshift
2285 @end smallexample
2286 @end table
2289 @node CTIME
2290 @section @code{CTIME} --- Convert a time into a string
2291 @findex @code{CTIME} intrinsic
2292 @cindex ctime subroutine 
2294 @table @asis
2295 @item @emph{Description}:
2296 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2297 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2298 1995}, and returns that string into @var{S}.
2300 If @code{CTIME} is invoked as a function, it can not be invoked as a
2301 subroutine, and vice versa.
2303 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2304 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2306 @item @emph{Standard}:
2307 GNU extension
2309 @item @emph{Class}:
2310 Subroutine
2312 @item @emph{Syntax}:
2313 @multitable @columnfractions .80
2314 @item @code{CALL CTIME(T,S)}.
2315 @item @code{S = CTIME(T)}, (not recommended).
2316 @end multitable
2318 @item @emph{Arguments}:
2319 @multitable @columnfractions .15 .80
2320 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2321 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2322 @end multitable
2324 @item @emph{Return value}:
2325 The converted date and time as a string.
2327 @item @emph{Example}:
2328 @smallexample
2329 program test_ctime
2330     integer(8) :: i
2331     character(len=30) :: date
2332     i = time8()
2334     ! Do something, main part of the program
2335     
2336     call ctime(i,date)
2337     print *, 'Program was started on ', date
2338 end program test_ctime
2339 @end smallexample
2340 @end table
2342 @node DATE_AND_TIME
2343 @section @code{DATE_AND_TIME} --- Date and time subroutine
2344 @findex @code{DATE_AND_TIME} intrinsic
2345 @cindex DATE_AND_TIME
2347 @table @asis
2348 @item @emph{Description}:
2349 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2350 time information from the real-time system clock.  @var{DATE} is
2351 @code{INTENT(OUT)} and has form ccyymmdd.  @var{TIME} is @code{INTENT(OUT)} and
2352 has form hhmmss.sss.  @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2353 representing the difference with respect to Coordinated Universal Time (UTC).
2354 Unavailable time and date parameters return blanks.
2356 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2358 @multitable @columnfractions .15 .30 .60
2359 @item @tab @code{VALUE(1)}: @tab The year
2360 @item @tab @code{VALUE(2)}: @tab The month
2361 @item @tab @code{VALUE(3)}: @tab The day of the month
2362 @item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
2363 @item @tab @code{VALUE(5)}: @tab The hour of the day
2364 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2365 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2366 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2367 @end multitable     
2369 @item @emph{Standard}:
2370 F95 and later
2372 @item @emph{Class}:
2373 Subroutine
2375 @item @emph{Syntax}:
2376 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2378 @item @emph{Arguments}:
2379 @multitable @columnfractions .15 .80
2380 @item @var{DATE}  @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2381 @item @var{TIME}  @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2382 @item @var{ZONE}  @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2383 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2384 @end multitable
2386 @item @emph{Return value}:
2387 None
2389 @item @emph{Example}:
2390 @smallexample
2391 program test_time_and_date
2392     character(8)  :: date
2393     character(10) :: time
2394     character(5)  :: zone
2395     integer,dimension(8) :: values
2396     ! using keyword arguments
2397     call date_and_time(date,time,zone,values)
2398     call date_and_time(DATE=date,ZONE=zone)
2399     call date_and_time(TIME=time)
2400     call date_and_time(VALUES=values)
2401     print '(a,2x,a,2x,a)', date, time, zone
2402     print '(8i5))', values
2403 end program test_time_and_date
2404 @end smallexample
2405 @end table
2409 @node DBLE
2410 @section @code{DBLE} --- Double conversion function 
2411 @findex @code{DBLE} intrinsic
2412 @cindex double conversion
2414 @table @asis
2415 @item @emph{Description}:
2416 @code{DBLE(X)} Converts @var{X} to double precision real type.
2418 @item @emph{Standard}:
2419 F77 and later
2421 @item @emph{Class}:
2422 Elemental function
2424 @item @emph{Syntax}:
2425 @code{X = DBLE(X)}
2427 @item @emph{Arguments}:
2428 @multitable @columnfractions .15 .80
2429 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2430 @end multitable
2432 @item @emph{Return value}:
2433 The return value is of type double precision real.
2435 @item @emph{Example}:
2436 @smallexample
2437 program test_dble
2438     real    :: x = 2.18
2439     integer :: i = 5
2440     complex :: z = (2.3,1.14)
2441     print *, dble(x), dble(i), dble(z)
2442 end program test_dble
2443 @end smallexample
2445 @item @emph{See also}:
2446 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2447 @end table
2451 @node DCMPLX
2452 @section @code{DCMPLX} --- Double complex conversion function
2453 @findex @code{DCMPLX} intrinsic
2454 @cindex DCMPLX
2456 @table @asis
2457 @item @emph{Description}:
2458 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2459 converted to the real component.  If @var{Y} is present it is converted to the
2460 imaginary component.  If @var{Y} is not present then the imaginary component is
2461 set to 0.0.  If @var{X} is complex then @var{Y} must not be present.
2463 @item @emph{Standard}:
2464 GNU extension
2466 @item @emph{Class}:
2467 Elemental function
2469 @item @emph{Syntax}:
2470 @code{C = DCMPLX(X)}
2471 @code{C = DCMPLX(X,Y)}
2473 @item @emph{Arguments}:
2474 @multitable @columnfractions .15 .80
2475 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2476 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}. 
2477 @end multitable
2479 @item @emph{Return value}:
2480 The return value is of type @code{COMPLEX(8)}
2482 @item @emph{Example}:
2483 @smallexample
2484 program test_dcmplx
2485     integer :: i = 42
2486     real :: x = 3.14
2487     complex :: z
2488     z = cmplx(i, x)
2489     print *, dcmplx(i)
2490     print *, dcmplx(x)
2491     print *, dcmplx(z)
2492     print *, dcmplx(x,i)
2493 end program test_dcmplx
2494 @end smallexample
2495 @end table
2499 @node DFLOAT
2500 @section @code{DFLOAT} --- Double conversion function 
2501 @findex @code{DFLOAT} intrinsic
2502 @cindex double float conversion
2504 @table @asis
2505 @item @emph{Description}:
2506 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2508 @item @emph{Standard}:
2509 GNU extension
2511 @item @emph{Class}:
2512 Elemental function
2514 @item @emph{Syntax}:
2515 @code{X = DFLOAT(X)}
2517 @item @emph{Arguments}:
2518 @multitable @columnfractions .15 .80
2519 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2520 @end multitable
2522 @item @emph{Return value}:
2523 The return value is of type double precision real.
2525 @item @emph{Example}:
2526 @smallexample
2527 program test_dfloat
2528     integer :: i = 5
2529     print *, dfloat(i)
2530 end program test_dfloat
2531 @end smallexample
2533 @item @emph{See also}:
2534 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2535 @end table
2539 @node DIGITS
2540 @section @code{DIGITS} --- Significant digits function
2541 @findex @code{DIGITS} intrinsic
2542 @cindex digits, significant
2544 @table @asis
2545 @item @emph{Description}:
2546 @code{DIGITS(X)} returns the number of significant digits of the internal model
2547 representation of @var{X}.  For example, on a system using a 32-bit
2548 floating point representation, a default real number would likely return 24.
2550 @item @emph{Standard}:
2551 F95 and later
2553 @item @emph{Class}:
2554 Inquiry function
2556 @item @emph{Syntax}:
2557 @code{C = DIGITS(X)}
2559 @item @emph{Arguments}:
2560 @multitable @columnfractions .15 .80
2561 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2562 @end multitable
2564 @item @emph{Return value}:
2565 The return value is of type @code{INTEGER}.
2567 @item @emph{Example}:
2568 @smallexample
2569 program test_digits
2570     integer :: i = 12345
2571     real :: x = 3.143
2572     real(8) :: y = 2.33
2573     print *, digits(i)
2574     print *, digits(x)
2575     print *, digits(y)
2576 end program test_digits
2577 @end smallexample
2578 @end table
2582 @node DIM
2583 @section @code{DIM} --- Dim function
2584 @findex @code{DIM} intrinsic
2585 @findex @code{IDIM} intrinsic
2586 @findex @code{DDIM} intrinsic
2587 @cindex dim
2589 @table @asis
2590 @item @emph{Description}:
2591 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2592 otherwise returns zero.
2594 @item @emph{Standard}:
2595 F77 and later
2597 @item @emph{Class}:
2598 Elemental function
2600 @item @emph{Syntax}:
2601 @code{X = DIM(X,Y)}
2603 @item @emph{Arguments}:
2604 @multitable @columnfractions .15 .80
2605 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2606 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2607 @end multitable
2609 @item @emph{Return value}:
2610 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2612 @item @emph{Example}:
2613 @smallexample
2614 program test_dim
2615     integer :: i
2616     real(8) :: x
2617     i = dim(4, 15)
2618     x = dim(4.345_8, 2.111_8)
2619     print *, i
2620     print *, x
2621 end program test_dim
2622 @end smallexample
2624 @item @emph{Specific names}:
2625 @multitable @columnfractions .20 .20 .20 .40
2626 @item Name             @tab Argument              @tab Return type       @tab Standard
2627 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2628 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y}    @tab @code{REAL(8)}    @tab F77 and later
2629 @end multitable
2630 @end table
2634 @node DOT_PRODUCT
2635 @section @code{DOT_PRODUCT} --- Dot product function
2636 @findex @code{DOT_PRODUCT} intrinsic
2637 @cindex Dot product
2639 @table @asis
2640 @item @emph{Description}:
2641 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2642 @var{X} and @var{Y}.  The two vectors may be either numeric or logical
2643 and must be arrays of rank one and of equal size. If the vectors are
2644 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2645 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the 
2646 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2648 @item @emph{Standard}:
2649 F95 and later
2651 @item @emph{Class}:
2652 transformational function
2654 @item @emph{Syntax}:
2655 @code{S = DOT_PRODUCT(X,Y)}
2657 @item @emph{Arguments}:
2658 @multitable @columnfractions .15 .80
2659 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2660 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2661 @end multitable
2663 @item @emph{Return value}:
2664 If the arguments are numeric, the return value is a scaler of numeric type,
2665 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.  If the arguments are
2666 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2668 @item @emph{Example}:
2669 @smallexample
2670 program test_dot_prod
2671     integer, dimension(3) :: a, b
2672     a = (/ 1, 2, 3 /)
2673     b = (/ 4, 5, 6 /)
2674     print '(3i3)', a
2675     print *
2676     print '(3i3)', b
2677     print *
2678     print *, dot_product(a,b)
2679 end program test_dot_prod
2680 @end smallexample
2681 @end table
2685 @node DPROD
2686 @section @code{DPROD} --- Double product function
2687 @findex @code{DPROD} intrinsic
2688 @cindex Double product
2690 @table @asis
2691 @item @emph{Description}:
2692 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2694 @item @emph{Standard}:
2695 F77 and later
2697 @item @emph{Class}:
2698 Elemental function
2700 @item @emph{Syntax}:
2701 @code{D = DPROD(X,Y)}
2703 @item @emph{Arguments}:
2704 @multitable @columnfractions .15 .80
2705 @item @var{X} @tab The type shall be @code{REAL}.
2706 @item @var{Y} @tab The type shall be @code{REAL}.
2707 @end multitable
2709 @item @emph{Return value}:
2710 The return value is of type @code{REAL(8)}.
2712 @item @emph{Example}:
2713 @smallexample
2714 program test_dprod
2715     integer :: i
2716     real :: x = 5.2
2717     real :: y = 2.3
2718     real(8) :: d
2719     d = dprod(x,y)
2720     print *, d
2721 end program test_dprod
2722 @end smallexample
2723 @end table
2727 @node DREAL
2728 @section @code{DREAL} --- Double real part function
2729 @findex @code{DREAL} intrinsic
2730 @cindex Double real part
2732 @table @asis
2733 @item @emph{Description}:
2734 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2736 @item @emph{Standard}:
2737 GNU extension
2739 @item @emph{Class}:
2740 Elemental function
2742 @item @emph{Syntax}:
2743 @code{D = DREAL(Z)}
2745 @item @emph{Arguments}:
2746 @multitable @columnfractions .15 .80
2747 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2748 @end multitable
2750 @item @emph{Return value}:
2751 The return value is of type @code{REAL(8)}.
2753 @item @emph{Example}:
2754 @smallexample
2755 program test_dreal
2756     complex(8) :: z = (1.3_8,7.2_8)
2757     print *, dreal(z)
2758 end program test_dreal
2759 @end smallexample
2761 @item @emph{See also}:
2762 @ref{AIMAG}
2764 @end table
2768 @node DTIME
2769 @section @code{DTIME} --- Execution time subroutine (or function)
2770 @findex @code{DTIME} intrinsic
2771 @cindex dtime subroutine 
2773 @table @asis
2774 @item @emph{Description}:
2775 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2776 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
2777 returns the user and system components of this time in @code{TARRAY(1)} and
2778 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2779 TARRAY(2)}.
2781 Subsequent invocations of @code{DTIME} return values accumulated since the
2782 previous invocation.
2784 On some systems, the underlying timings are represented using types with
2785 sufficiently small limits that overflows (wrap around) are possible, such as
2786 32-bit types. Therefore, the values returned by this intrinsic might be, or
2787 become, negative, or numerically less than previous values, during a single
2788 run of the compiled program.
2790 If @code{DTIME} is invoked as a function, it can not be invoked as a
2791 subroutine, and vice versa.
2793 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2795 @multitable @columnfractions .15 .30 .60
2796 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2797 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2798 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2799 @end multitable
2801 @item @emph{Standard}:
2802 GNU extension
2804 @item @emph{Class}:
2805 Subroutine
2807 @item @emph{Syntax}:
2808 @multitable @columnfractions .80
2809 @item @code{CALL DTIME(TARRAY, RESULT)}.
2810 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2811 @end multitable
2813 @item @emph{Arguments}:
2814 @multitable @columnfractions .15 .80
2815 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2816 @item @var{RESULT}@tab The type shall be @code{REAL}.
2817 @end multitable
2819 @item @emph{Return value}:
2820 Elapsed time in seconds since the start of program execution.
2822 @item @emph{Example}:
2823 @smallexample
2824 program test_dtime
2825     integer(8) :: i, j
2826     real, dimension(2) :: tarray
2827     real :: result
2828     call dtime(tarray, result)
2829     print *, result
2830     print *, tarray(1)
2831     print *, tarray(2)   
2832     do i=1,100000000    ! Just a delay
2833         j = i * i - i
2834     end do
2835     call dtime(tarray, result)
2836     print *, result
2837     print *, tarray(1)
2838     print *, tarray(2)
2839 end program test_dtime
2840 @end smallexample
2841 @end table
2845 @node EOSHIFT
2846 @section @code{EOSHIFT} --- End-off shift function
2847 @findex @code{EOSHIFT} intrinsic
2848 @cindex bit manipulation
2850 @table @asis
2851 @item @emph{Description}:
2852 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2853 elements of @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is
2854 omitted it is taken to be @code{1}.  @var{DIM} is a scaler of type
2855 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2856 rank of @var{ARRAY}.  If the rank of @var{ARRAY} is one, then all elements of
2857 @var{ARRAY} are shifted by @var{SHIFT} places.  If rank is greater than one,
2858 then all complete rank one sections of @var{ARRAY} along the given dimension are
2859 shifted.  Elements shifted out one end of each rank one section are dropped.  If
2860 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2861 is copied back in the other end.  If @var{BOUNDARY} is not present then the
2862 following are copied in depending on the type of @var{ARRAY}.
2864 @multitable @columnfractions .15 .80
2865 @item @emph{Array Type} @tab @emph{Boundary Value}
2866 @item Numeric  @tab 0 of the type and kind of @var{ARRAY}.
2867 @item Logical  @tab @code{.FALSE.}.
2868 @item Character(@var{len}) @tab @var{len} blanks.
2869 @end multitable
2871 @item @emph{Standard}:
2872 F95 and later
2874 @item @emph{Class}:
2875 transformational function
2877 @item @emph{Syntax}:
2878 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2880 @item @emph{Arguments}:
2881 @multitable @columnfractions .15 .80
2882 @item @var{ARRAY}  @tab May be any type, not scaler.
2883 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2884 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}. 
2885 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2886 @end multitable
2888 @item @emph{Return value}:
2889 Returns an array of same type and rank as the @var{ARRAY} argument.
2891 @item @emph{Example}:
2892 @smallexample
2893 program test_eoshift
2894     integer, dimension(3,3) :: a
2895     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2896     print '(3i3)', a(1,:)
2897     print '(3i3)', a(2,:)
2898     print '(3i3)', a(3,:)    
2899     a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2900     print *
2901     print '(3i3)', a(1,:)
2902     print '(3i3)', a(2,:)
2903     print '(3i3)', a(3,:)
2904 end program test_eoshift
2905 @end smallexample
2906 @end table
2910 @node EPSILON
2911 @section @code{EPSILON} --- Epsilon function
2912 @findex @code{EPSILON} intrinsic
2913 @cindex epsilon, significant
2915 @table @asis
2916 @item @emph{Description}:
2917 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2919 @item @emph{Standard}:
2920 F95 and later
2922 @item @emph{Class}:
2923 Inquiry function
2925 @item @emph{Syntax}:
2926 @code{C = EPSILON(X)}
2928 @item @emph{Arguments}:
2929 @multitable @columnfractions .15 .80
2930 @item @var{X} @tab The type shall be @code{REAL(*)}.
2931 @end multitable
2933 @item @emph{Return value}:
2934 The return value is of same type as the argument.
2936 @item @emph{Example}:
2937 @smallexample
2938 program test_epsilon
2939     real :: x = 3.143
2940     real(8) :: y = 2.33
2941     print *, EPSILON(x)
2942     print *, EPSILON(y)
2943 end program test_epsilon
2944 @end smallexample
2945 @end table
2949 @node ERF
2950 @section @code{ERF} --- Error function 
2951 @findex @code{ERF} intrinsic
2952 @cindex error function
2954 @table @asis
2955 @item @emph{Description}:
2956 @code{ERF(X)} computes the error function of @var{X}.
2958 @item @emph{Standard}:
2959 GNU Extension
2961 @item @emph{Class}:
2962 Elemental function
2964 @item @emph{Syntax}:
2965 @code{X = ERF(X)}
2967 @item @emph{Arguments}:
2968 @multitable @columnfractions .15 .80
2969 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2970 @end multitable
2972 @item @emph{Return value}:
2973 The return value is a scalar of type @code{REAL(*)} and it is positive
2974 (@math{ - 1 \leq erf (x) \leq 1 }.
2976 @item @emph{Example}:
2977 @smallexample
2978 program test_erf
2979   real(8) :: x = 0.17_8
2980   x = erf(x)
2981 end program test_erf
2982 @end smallexample
2984 @item @emph{Specific names}:
2985 @multitable @columnfractions .20 .20 .20 .40
2986 @item Name            @tab Argument          @tab Return type       @tab Standard
2987 @item @code{DERF(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
2988 @end multitable
2989 @end table
2993 @node ERFC
2994 @section @code{ERFC} --- Error function 
2995 @findex @code{ERFC} intrinsic
2996 @cindex error function
2998 @table @asis
2999 @item @emph{Description}:
3000 @code{ERFC(X)} computes the complementary error function of @var{X}.
3002 @item @emph{Standard}:
3003 GNU extension
3005 @item @emph{Class}:
3006 Elemental function
3008 @item @emph{Syntax}:
3009 @code{X = ERFC(X)}
3011 @item @emph{Arguments}:
3012 @multitable @columnfractions .15 .80
3013 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3014 @end multitable
3016 @item @emph{Return value}:
3017 The return value is a scalar of type @code{REAL(*)} and it is positive
3018 (@math{ 0 \leq erfc (x) \leq 2 }.
3020 @item @emph{Example}:
3021 @smallexample
3022 program test_erfc
3023   real(8) :: x = 0.17_8
3024   x = erfc(x)
3025 end program test_erfc
3026 @end smallexample
3028 @item @emph{Specific names}:
3029 @multitable @columnfractions .20 .20 .20 .40
3030 @item Name            @tab Argument          @tab Return type       @tab Standard
3031 @item @code{DERFC(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
3032 @end multitable
3033 @end table
3037 @node ETIME
3038 @section @code{ETIME} --- Execution time subroutine (or function)
3039 @findex @code{ETIME} intrinsic
3040 @cindex time functions
3042 @table @asis
3043 @item @emph{Description}:
3044 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3045 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
3046 returns the user and system components of this time in @code{TARRAY(1)} and
3047 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3049 On some systems, the underlying timings are represented using types with
3050 sufficiently small limits that overflows (wrap around) are possible, such as
3051 32-bit types. Therefore, the values returned by this intrinsic might be, or
3052 become, negative, or numerically less than previous values, during a single
3053 run of the compiled program.
3055 If @code{ETIME} is invoked as a function, it can not be invoked as a
3056 subroutine, and vice versa.
3058 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3060 @multitable @columnfractions .15 .30 .60
3061 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
3062 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
3063 @item @tab @code{RESULT}: @tab Run time since start in seconds.
3064 @end multitable
3066 @item @emph{Standard}:
3067 GNU extension
3069 @item @emph{Class}:
3070 Subroutine
3072 @item @emph{Syntax}:
3073 @multitable @columnfractions .8
3074 @item @code{CALL ETIME(TARRAY, RESULT)}.
3075 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3076 @end multitable
3078 @item @emph{Arguments}:
3079 @multitable @columnfractions .15 .80
3080 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3081 @item @var{RESULT}@tab The type shall be @code{REAL}.
3082 @end multitable
3084 @item @emph{Return value}:
3085 Elapsed time in seconds since the start of program execution.
3087 @item @emph{Example}:
3088 @smallexample
3089 program test_etime
3090     integer(8) :: i, j
3091     real, dimension(2) :: tarray
3092     real :: result
3093     call ETIME(tarray, result)
3094     print *, result
3095     print *, tarray(1)
3096     print *, tarray(2)   
3097     do i=1,100000000    ! Just a delay
3098         j = i * i - i
3099     end do
3100     call ETIME(tarray, result)
3101     print *, result
3102     print *, tarray(1)
3103     print *, tarray(2)
3104 end program test_etime
3105 @end smallexample
3107 @item @emph{See also}:
3108 @ref{CPU_TIME}
3110 @end table
3114 @node EXIT
3115 @section @code{EXIT} --- Exit the program with status. 
3116 @findex @code{EXIT}
3117 @cindex exit
3119 @table @asis
3120 @item @emph{Description}:
3121 @code{EXIT} causes immediate termination of the program with status.  If status
3122 is omitted it returns the canonical @emph{success} for the system.  All Fortran
3123 I/O units are closed. 
3125 @item @emph{Standard}:
3126 GNU extension
3128 @item @emph{Class}:
3129 Subroutine
3131 @item @emph{Syntax}:
3132 @code{CALL EXIT([STATUS])}
3134 @item @emph{Arguments}:
3135 @multitable @columnfractions .15 .80
3136 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3137 @end multitable
3139 @item @emph{Return value}:
3140 @code{STATUS} is passed to the parent process on exit.
3142 @item @emph{Example}:
3143 @smallexample
3144 program test_exit
3145   integer :: STATUS = 0
3146   print *, 'This program is going to exit.'
3147   call EXIT(STATUS)
3148 end program test_exit
3149 @end smallexample
3151 @item @emph{See also}:
3152 @ref{ABORT}, @ref{KILL}
3153 @end table
3157 @node EXP
3158 @section @code{EXP} --- Exponential function 
3159 @findex @code{EXP} intrinsic
3160 @findex @code{DEXP} intrinsic
3161 @findex @code{ZEXP} intrinsic
3162 @findex @code{CDEXP} intrinsic
3163 @cindex exponential
3165 @table @asis
3166 @item @emph{Description}:
3167 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3169 @item @emph{Standard}:
3170 F77 and later, has overloads that are GNU extensions
3172 @item @emph{Class}:
3173 Elemental function
3175 @item @emph{Syntax}:
3176 @code{X = EXP(X)}
3178 @item @emph{Arguments}:
3179 @multitable @columnfractions .15 .80
3180 @item @var{X} @tab The type shall be @code{REAL(*)} or
3181 @code{COMPLEX(*)}.
3182 @end multitable
3184 @item @emph{Return value}:
3185 The return value has same type and kind as @var{X}.
3187 @item @emph{Example}:
3188 @smallexample
3189 program test_exp
3190   real :: x = 1.0
3191   x = exp(x)
3192 end program test_exp
3193 @end smallexample
3195 @item @emph{Specific names}:
3196 @multitable @columnfractions .20 .20 .20 .40
3197 @item Name            @tab Argument             @tab Return type         @tab Standard
3198 @item @code{DEXP(X)}  @tab @code{REAL(8) X}     @tab @code{REAL(8)}      @tab F77 and later
3199 @item @code{CEXP(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}   @tab F77 and later
3200 @item @code{ZEXP(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}   @tab GNU extension
3201 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}   @tab GNU extension
3202 @end multitable
3203 @end table
3207 @node EXPONENT
3208 @section @code{EXPONENT} --- Exponent function 
3209 @findex @code{EXPONENT} intrinsic
3210 @cindex exponent function
3212 @table @asis
3213 @item @emph{Description}:
3214 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3215 is zero the value returned is zero. 
3217 @item @emph{Standard}:
3218 F95 and later
3220 @item @emph{Class}:
3221 Elemental function
3223 @item @emph{Syntax}:
3224 @code{I = EXPONENT(X)}
3226 @item @emph{Arguments}:
3227 @multitable @columnfractions .15 .80
3228 @item @var{X} @tab The type shall be @code{REAL(*)}.
3229 @end multitable
3231 @item @emph{Return value}:
3232 The return value is of type default @code{INTEGER}.
3234 @item @emph{Example}:
3235 @smallexample
3236 program test_exponent
3237   real :: x = 1.0
3238   integer :: i
3239   i = exponent(x)
3240   print *, i
3241   print *, exponent(0.0)
3242 end program test_exponent
3243 @end smallexample
3244 @end table
3247 @node FDATE
3248 @section @code{FDATE} --- Get the current time as a string
3249 @findex @code{FDATE} intrinsic
3250 @cindex fdate subroutine 
3252 @table @asis
3253 @item @emph{Description}:
3254 @code{FDATE(DATE)} returns the current date (using the same format as
3255 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3256 TIME8())}.
3258 If @code{FDATE} is invoked as a function, it can not be invoked as a
3259 subroutine, and vice versa.
3261 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3263 @item @emph{Standard}:
3264 GNU extension
3266 @item @emph{Class}:
3267 Subroutine
3269 @item @emph{Syntax}:
3270 @multitable @columnfractions .80
3271 @item @code{CALL FDATE(DATE)}.
3272 @item @code{DATE = FDATE()}, (not recommended).
3273 @end multitable
3275 @item @emph{Arguments}:
3276 @multitable @columnfractions .15 .80
3277 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3278 @end multitable
3280 @item @emph{Return value}:
3281 The current date and time as a string.
3283 @item @emph{Example}:
3284 @smallexample
3285 program test_fdate
3286     integer(8) :: i, j
3287     character(len=30) :: date
3288     call fdate(date)
3289     print *, 'Program started on ', date
3290     do i = 1, 100000000 ! Just a delay
3291         j = i * i - i
3292     end do
3293     call fdate(date)
3294     print *, 'Program ended on ', date
3295 end program test_fdate
3296 @end smallexample
3297 @end table
3299 @node FLOAT
3301 @section @code{FLOAT} --- Convert integer to default real
3302 @findex @code{FLOAT} intrinsic
3303 @cindex conversion function (float)
3305 @table @asis
3306 @item @emph{Description}:
3307 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3309 @item @emph{Standard}:
3310 GNU extension
3312 @item @emph{Class}:
3313 Elemental function
3315 @item @emph{Syntax}:
3316 @code{X = FLOAT(I)}
3318 @item @emph{Arguments}:
3319 @multitable @columnfractions .15 .80
3320 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3321 @end multitable
3323 @item @emph{Return value}:
3324 The return value is of type default @code{REAL}
3326 @item @emph{Example}:
3327 @smallexample
3328 program test_float
3329     integer :: i = 1
3330     if (float(i) /= 1.) call abort
3331 end program test_float
3332 @end smallexample
3334 @item @emph{See also}:
3335 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3336 @end table
3340 @node FGET
3341 @section @code{FGET} --- Read a single character in stream mode from stdin 
3342 @findex @code{FGET} intrinsic
3343 @cindex file operations
3344 @cindex stream operations
3346 @table @asis
3347 @item @emph{Description}:
3348 Read a single character in stream mode from stdin by bypassing normal 
3349 formatted output. Stream I/O should not be mixed with normal record-oriented 
3350 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3352 This intrinsic routine is provided for backwards compatibility with 
3353 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3354 Programmers should consider the use of new stream IO feature in new code 
3355 for future portability. See also @ref{Fortran 2003 status}.
3357 @item @emph{Standard}:
3358 GNU extension
3360 @item @emph{Class}:
3361 Non-elemental subroutine
3363 @item @emph{Syntax}:
3364 @code{CALL fget(C[,STATUS])}
3366 @item @emph{Arguments}:
3367 @multitable @columnfractions .15 .80
3368 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3369 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3370                         -1 on end-of-file and a system specific positive error code otherwise.
3371 @end multitable
3373 @item @emph{Example}:
3374 @smallexample
3375 PROGRAM test_fget
3376   INTEGER, PARAMETER :: strlen = 100
3377   INTEGER :: status, i = 1
3378   CHARACTER(len=strlen) :: str = ""
3380   WRITE (*,*) 'Enter text:'
3381   DO
3382     CALL fget(str(i:i), status)
3383     if (status /= 0 .OR. i > strlen) exit
3384     i = i + 1
3385   END DO
3386   WRITE (*,*) TRIM(str)
3387 END PROGRAM
3388 @end smallexample
3390 @item @emph{See also}:
3391 @ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
3392 @end table
3395 @node FGETC
3396 @section @code{FGETC} --- Read a single character in stream mode
3397 @findex @code{FGETC} intrinsic
3398 @cindex file operations
3399 @cindex stream operations
3401 @table @asis
3402 @item @emph{Description}:
3403 Read a single character in stream mode by bypassing normal formatted output. 
3404 Stream I/O should not be mixed with normal record-oriented (formatted or 
3405 unformatted) I/O on the same unit; the results are unpredictable.
3407 This intrinsic routine is provided for backwards compatibility with 
3408 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3409 Programmers should consider the use of new stream IO feature in new code 
3410 for future portability. See also @ref{Fortran 2003 status}.
3412 @item @emph{Standard}:
3413 GNU extension
3415 @item @emph{Class}:
3416 Non-elemental subroutine
3418 @item @emph{Syntax}:
3419 @code{CALL fgetc(UNIT,C[,STATUS])}
3421 @item @emph{Arguments}:
3422 @multitable @columnfractions .15 .80
3423 @item @var{UNIT}   @tab The type shall be @code{INTEGER}.
3424 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3425 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3426                         -1 on end-of-file and a system specific positive error code otherwise.
3427 @end multitable
3429 @item @emph{Example}:
3430 @smallexample
3431 PROGRAM test_fgetc
3432   INTEGER :: fd = 42, status
3433   CHARACTER :: c
3435   OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3436   DO
3437     CALL fgetc(fd, c, status)
3438     IF (status /= 0) EXIT
3439     call fput(c)
3440   END DO
3441   CLOSE(UNIT=fd)
3442 END PROGRAM
3443 @end smallexample
3445 @item @emph{See also}:
3446 @ref{FGET}, @ref{FPUT}, @ref{FPUTC}
3447 @end table
3451 @node FLOOR
3452 @section @code{FLOOR} --- Integer floor function
3453 @findex @code{FLOOR} intrinsic
3454 @cindex floor
3456 @table @asis
3457 @item @emph{Description}:
3458 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3460 @item @emph{Standard}:
3461 F95 and later
3463 @item @emph{Class}:
3464 Elemental function
3466 @item @emph{Syntax}:
3467 @code{I = FLOOR(X[,KIND])}
3469 @item @emph{Arguments}:
3470 @multitable @columnfractions .15 .80
3471 @item @var{X} @tab The type shall be @code{REAL(*)}.
3472 @item @var{KIND} @tab Optional scaler integer initialization expression.
3473 @end multitable
3475 @item @emph{Return value}:
3476 The return value is of type @code{INTEGER(KIND)}
3478 @item @emph{Example}:
3479 @smallexample
3480 program test_floor
3481     real :: x = 63.29
3482     real :: y = -63.59
3483     print *, floor(x) ! returns 63
3484     print *, floor(y) ! returns -64
3485 end program test_floor
3486 @end smallexample
3488 @item @emph{See also}:
3489 @ref{CEILING}, @ref{NINT}
3491 @end table
3495 @node FLUSH
3496 @section @code{FLUSH} --- Flush I/O unit(s)
3497 @findex @code{FLUSH}
3498 @cindex flush
3500 @table @asis
3501 @item @emph{Description}:
3502 Flushes Fortran unit(s) currently open for output. Without the optional
3503 argument, all units are flushed, otherwise just the unit specified.
3505 @item @emph{Standard}:
3506 GNU extension
3508 @item @emph{Class}:
3509 non-elemental subroutine
3511 @item @emph{Syntax}:
3512 @code{CALL FLUSH(UNIT)}
3514 @item @emph{Arguments}:
3515 @multitable @columnfractions .15 .80
3516 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3517 @end multitable
3519 @item @emph{Note}:
3520 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3521 statement that should be preferred over the @code{FLUSH} intrinsic.
3523 @end table
3527 @node FNUM
3528 @section @code{FNUM} --- File number function
3529 @findex @code{FNUM} intrinsic
3530 @cindex fnum
3532 @table @asis
3533 @item @emph{Description}:
3534 @code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
3535 open Fortran I/O unit @code{UNIT}.
3537 @item @emph{Standard}:
3538 GNU extension
3540 @item @emph{Class}:
3541 non-elemental function
3543 @item @emph{Syntax}:
3544 @code{I = FNUM(UNIT)}
3546 @item @emph{Arguments}:
3547 @multitable @columnfractions .15 .80
3548 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3549 @end multitable
3551 @item @emph{Return value}:
3552 The return value is of type @code{INTEGER}
3554 @item @emph{Example}:
3555 @smallexample
3556 program test_fnum
3557   integer :: i
3558   open (unit=10, status = "scratch")
3559   i = fnum(10)
3560   print *, i
3561   close (10)
3562 end program test_fnum
3563 @end smallexample
3564 @end table
3568 @node FPUT
3569 @section @code{FPUT} --- Write a single character in stream mode to stdout 
3570 @findex @code{FPUT} intrinsic
3571 @cindex file operations
3572 @cindex stream operations
3574 @table @asis
3575 @item @emph{Description}:
3576 Write a single character in stream mode to stdout by bypassing normal 
3577 formatted output. Stream I/O should not be mixed with normal record-oriented 
3578 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3580 This intrinsic routine is provided for backwards compatibility with 
3581 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3582 Programmers should consider the use of new stream IO feature in new code 
3583 for future portability. See also @ref{Fortran 2003 status}.
3585 @item @emph{Standard}:
3586 GNU extension
3588 @item @emph{Class}:
3589 Non-elemental subroutine
3591 @item @emph{Syntax}:
3592 @code{CALL fput(C[,STATUS])}
3594 @item @emph{Arguments}:
3595 @multitable @columnfractions .15 .80
3596 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3597 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3598                         -1 on end-of-file and a system specific positive error code otherwise.
3599 @end multitable
3601 @item @emph{Example}:
3602 @smallexample
3603 PROGRAM test_fput
3604   CHARACTER(len=*) :: str = "gfortran"
3605   INTEGER :: i
3606   DO i = 1, len_trim(str)
3607     CALL fput(str(i:i))
3608   END DO
3609 END PROGRAM
3610 @end smallexample
3612 @item @emph{See also}:
3613 @ref{FPUTC}, @ref{FGET}, @ref{FGETC}
3614 @end table
3618 @node FPUTC
3619 @section @code{FPUTC} --- Write a single character in stream mode
3620 @findex @code{FPUTC} intrinsic
3621 @cindex file operations
3622 @cindex stream operations
3624 @table @asis
3625 @item @emph{Description}:
3626 Write a single character in stream mode by bypassing normal formatted 
3627 output. Stream I/O should not be mixed with normal record-oriented 
3628 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3630 This intrinsic routine is provided for backwards compatibility with 
3631 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3632 Programmers should consider the use of new stream IO feature in new code 
3633 for future portability. See also @ref{Fortran 2003 status}.
3635 @item @emph{Standard}:
3636 GNU extension
3638 @item @emph{Class}:
3639 Non-elemental subroutine
3641 @item @emph{Syntax}:
3642 @code{CALL fputc(UNIT,C[,STATUS])}
3644 @item @emph{Arguments}:
3645 @multitable @columnfractions .15 .80
3646 @item @var{UNIT}   @tab The type shall be @code{INTEGER}.
3647 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3648 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3649                         -1 on end-of-file and a system specific positive error code otherwise.
3650 @end multitable
3652 @item @emph{Example}:
3653 @smallexample
3654 PROGRAM test_fputc
3655   CHARACTER(len=*) :: str = "gfortran"
3656   INTEGER :: fd = 42, i
3658   OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3659   DO i = 1, len_trim(str)
3660     CALL fputc(fd, str(i:i))
3661   END DO
3662   CLOSE(fd)
3663 END PROGRAM
3664 @end smallexample
3666 @item @emph{See also}:
3667 @ref{FPUT}, @ref{FGET}, @ref{FGETC}
3668 @end table
3672 @node FRACTION
3673 @section @code{FRACTION} --- Fractional part of the model representation
3674 @findex @code{FRACTION} intrinsic
3675 @cindex fractional part
3677 @table @asis
3678 @item @emph{Description}:
3679 @code{FRACTION(X)} returns the fractional part of the model
3680 representation of @code{X}.
3682 @item @emph{Standard}:
3683 F95 and later
3685 @item @emph{Class}:
3686 Elemental function
3688 @item @emph{Syntax}:
3689 @code{Y = FRACTION(X)}
3691 @item @emph{Arguments}:
3692 @multitable @columnfractions .15 .80
3693 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3694 @end multitable
3696 @item @emph{Return value}:
3697 The return value is of the same type and kind as the argument.
3698 The fractional part of the model representation of @code{X} is returned;
3699 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3701 @item @emph{Example}:
3702 @smallexample
3703 program test_fraction
3704   real :: x
3705   x = 178.1387e-4
3706   print *, fraction(x), x * radix(x)**(-exponent(x))
3707 end program test_fraction
3708 @end smallexample
3710 @end table
3714 @node FREE
3715 @section @code{FREE} --- Frees memory
3716 @findex @code{FREE} intrinsic
3717 @cindex FREE
3719 @table @asis
3720 @item @emph{Description}:
3721 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3722 intrinsic is an extension intended to be used with Cray pointers, and is
3723 provided in GNU Fortran to allow user to compile legacy code. For
3724 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3725 @code{DEALLOCATE}.
3727 @item @emph{Standard}:
3728 GNU extension
3730 @item @emph{Class}:
3731 Subroutine
3733 @item @emph{Syntax}:
3734 @code{FREE(PTR)}
3736 @item @emph{Arguments}:
3737 @multitable @columnfractions .15 .80
3738 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3739 location of the memory that should be de-allocated.
3740 @end multitable
3742 @item @emph{Return value}:
3743 None
3745 @item @emph{Example}:
3746 See @code{MALLOC} for an example.
3748 @item @emph{See also}:
3749 @ref{MALLOC}
3750 @end table
3755 @node FSTAT
3756 @section @code{FSTAT} --- Get file status
3757 @findex @code{FSTAT} intrinsic
3758 @cindex file system operations 
3760 @table @asis
3761 @item @emph{Description}:
3762 @code{FSTAT} is identical to @ref{STAT}, except that information about an 
3763 already opened file is obtained.
3765 The elements in @code{BUFF} are the same as described by @ref{STAT}.
3767 @item @emph{Standard}:
3768 GNU extension
3770 @item @emph{Class}:
3771 Non-elemental subroutine
3773 @item @emph{Syntax}:
3774 @code{CALL fstat(UNIT,BUFF[,STATUS])}
3776 @item @emph{Arguments}:
3777 @multitable @columnfractions .15 .80
3778 @item @var{UNIT}   @tab An open I/O unit number of type @code{INTEGER}.
3779 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
3780 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
3781                         on success and a system specific error code otherwise.
3782 @end multitable
3784 @item @emph{Example}:
3785 See @ref{STAT} for an example.
3787 @item @emph{See also}:
3788 To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
3789 @end table
3793 @node FSEEK
3794 @section @code{FSEEK} --- Low level file positioning subroutine
3795 @findex @code{FSEEK} 
3796 @cindex file system functions
3798 Not yet implemented in GNU Fortran.
3800 @table @asis
3801 @item @emph{Description}:
3803 @item @emph{Standard}:
3804 GNU extension
3806 @item @emph{Class}:
3807 Subroutine
3809 @item @emph{Syntax}:
3810 @item @emph{Arguments}:
3811 @item @emph{Return value}:
3812 @item @emph{Example}:
3813 @item @emph{Specific names}:
3814 @item @emph{See also}:
3815 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3817 @end table
3821 @node FTELL
3822 @section @code{FTELL} --- Current stream position
3823 @findex @code{FTELL} intrinsic
3824 @cindex undocumented intrinsic 
3826 Intrinsic implemented, documentation pending.
3828 @table @asis
3829 @item @emph{Description}:
3830 @item @emph{Standard}:
3831 GNU extension
3833 @item @emph{Class}:
3834 @item @emph{Syntax}:
3835 @item @emph{Arguments}:
3836 @item @emph{Return value}:
3837 @item @emph{Example}:
3839 @item @emph{See also}:
3840 @ref{FSEEK}
3841 @end table
3845 @node GETARG
3846 @section @code{GETARG} --- Get command line arguments
3847 @findex @code{GETARG} intrinsic
3848 @cindex command line arguments
3849 @cindex getopt
3851 @table @asis
3852 @item @emph{Description}:
3853 Retrieve the @var{N}th argument that was passed on the
3854 command line when the containing program was invoked.
3856 This intrinsic routine is provided for backwards compatibility with 
3857 GNU Fortran 77.  In new code, programmers should consider the use of 
3858 the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003 
3859 standard.
3861 @item @emph{Standard}:
3862 GNU extension
3864 @item @emph{Class}:
3865 Subroutine
3867 @item @emph{Syntax}:
3868 @code{CALL GETARG(N,ARG)}
3870 @item @emph{Arguments}:
3871 @multitable @columnfractions .15 .80
3872 @item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3873 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
3874 @end multitable
3876 @item @emph{Return value}:
3877 After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th 
3878 command line argument. If @var{ARG} can not hold the argument, it is 
3879 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3880 arguments specified at the command line, @var{ARG} will be filled with blanks.
3881 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3882 that support this feature).
3884 @item @emph{Example}:
3885 @smallexample
3886 PROGRAM test_getarg
3887   INTEGER :: i
3888   CHARACTER(len=32) :: arg
3890   DO i = 1, iargc()
3891     CALL getarg(i, arg)
3892     WRITE (*,*) arg
3893   END DO
3894 END PROGRAM
3895 @end smallexample
3897 @item @emph{See also}:
3898 GNU Fortran 77 compatibility function: @ref{IARGC}
3900 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
3901 @end table
3905 @node GET_COMMAND
3906 @section @code{GET_COMMAND} --- Get the entire command line
3907 @findex @code{GET_COMMAND} intrinsic
3908 @cindex command line arguments
3909 @cindex getopt
3911 @table @asis
3912 @item @emph{Description}:
3913 Retrieve the entire command line that was used to invoke the program.
3915 @item @emph{Standard}:
3916 F2003
3918 @item @emph{Class}:
3919 Subroutine
3921 @item @emph{Syntax}:
3922 @code{CALL GET_COMMAND(CMD)}
3924 @item @emph{Arguments}:
3925 @multitable @columnfractions .15 .80
3926 @item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}. 
3927 @end multitable
3929 @item @emph{Return value}:
3930 Stores the entire command line that was used to invoke the program in @var{ARG}. 
3931 If @var{ARG} is not large enough, the command will be truncated. 
3933 @item @emph{Example}:
3934 @smallexample
3935 PROGRAM test_get_command
3936   CHARACTER(len=255) :: cmd
3937   CALL get_command(cmd)
3938   WRITE (*,*) TRIM(cmd)
3939 END PROGRAM
3940 @end smallexample
3942 @item @emph{See also}:
3943 @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
3944 @end table
3948 @node GET_COMMAND_ARGUMENT
3949 @section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
3950 @findex @code{GET_COMMAND_ARGUMENT} intrinsic
3951 @cindex command line arguments
3952 @cindex getopt
3954 @table @asis
3955 @item @emph{Description}:
3956 Retrieve the @var{N}th argument that was passed on the
3957 command line when the containing program was invoked.
3959 @item @emph{Standard}:
3960 F2003
3962 @item @emph{Class}:
3963 Subroutine
3965 @item @emph{Syntax}:
3966 @code{CALL GET_COMMAND_ARGUMENT(N,ARG)}
3968 @item @emph{Arguments}:
3969 @multitable @columnfractions .15 .80
3970 @item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3971 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
3972 @end multitable
3974 @item @emph{Return value}:
3975 After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the 
3976 @var{N}th command line argument. If @var{ARG} can not hold the argument, it is 
3977 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3978 arguments specified at the command line, @var{ARG} will be filled with blanks. 
3979 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3980 that support this feature).
3982 @item @emph{Example}:
3983 @smallexample
3984 PROGRAM test_get_command_argument
3985   INTEGER :: i
3986   CHARACTER(len=32) :: arg
3988   i = 0
3989   DO
3990     CALL get_command_argument(i, arg)
3991     IF (LEN_TRIM(arg) == 0) EXIT
3993     WRITE (*,*) TRIM(arg)
3994     i = i+1
3995   END DO
3996 END PROGRAM
3997 @end smallexample
3999 @item @emph{See also}:
4000 @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
4001 @end table
4005 @node GETCWD
4006 @section @code{GETCWD} --- Get current working directory
4007 @findex @code{GETCWD} intrinsic
4008 @cindex file system functions
4010 @table @asis
4011 @item @emph{Description}:
4012 Get current working directory.
4014 @item @emph{Standard}:
4015 GNU extension
4017 @item @emph{Class}:
4018 Non-elemental subroutine.
4020 @item @emph{Syntax}:
4021 @code{CALL getcwd(CWD[,STATUS])}
4023 @item @emph{Arguments}:
4024 @multitable @columnfractions .15 .80
4025 @item @var{CWD}    @tab The type shall be @code{CHARACTER(*)}.
4026 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success, 
4027                         a system specific and non-zero error code otherwise.
4028 @end multitable
4030 @item @emph{Example}:
4031 @smallexample
4032 PROGRAM test_getcwd
4033   CHARACTER(len=255) :: cwd
4034   CALL getcwd(cwd)
4035   WRITE(*,*) TRIM(cwd)
4036 END PROGRAM
4037 @end smallexample
4039 @item @emph{See also}:
4040 @ref{CHDIR}
4041 @end table
4045 @node GETENV
4046 @section @code{GETENV} --- Get an environmental variable
4047 @findex @code{GETENV} intrinsic
4048 @cindex environment variable
4050 @table @asis
4051 @item @emph{Description}:
4052 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4054 This intrinsic routine is provided for backwards compatibility with 
4055 GNU Fortran 77.  In new code, programmers should consider the use of 
4056 the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
4057 2003 standard.
4059 @item @emph{Standard}:
4060 GNU extension
4062 @item @emph{Class}:
4063 Subroutine
4065 @item @emph{Syntax}:
4066 @code{CALL GETENV(ENVVAR,VALUE)}
4068 @item @emph{Arguments}:
4069 @multitable @columnfractions .15 .80
4070 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
4071 @item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
4072 @end multitable
4074 @item @emph{Return value}:
4075 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
4076 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4077 is not set, @var{VALUE} will be filled with blanks.
4079 @item @emph{Example}:
4080 @smallexample
4081 PROGRAM test_getenv
4082   CHARACTER(len=255) :: homedir
4083   CALL getenv("HOME", homedir)
4084   WRITE (*,*) TRIM(homedir)
4085 END PROGRAM
4086 @end smallexample
4088 @item @emph{See also}:
4089 @ref{GET_ENVIRONMENT_VARIABLE}
4090 @end table
4094 @node GET_ENVIRONMENT_VARIABLE
4095 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
4096 @findex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
4097 @cindex environment variable
4099 @table @asis
4100 @item @emph{Description}:
4101 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4103 @item @emph{Standard}:
4104 F2003
4106 @item @emph{Class}:
4107 Subroutine
4109 @item @emph{Syntax}:
4110 @code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR,VALUE)}
4112 @item @emph{Arguments}:
4113 @multitable @columnfractions .15 .80
4114 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
4115 @item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
4116 @end multitable
4118 @item @emph{Return value}:
4119 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
4120 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4121 is not set, @var{VALUE} will be filled with blanks.
4123 @item @emph{Example}:
4124 @smallexample
4125 PROGRAM test_getenv
4126   CHARACTER(len=255) :: homedir
4127   CALL get_environment_variable("HOME", homedir)
4128   WRITE (*,*) TRIM(homedir)
4129 END PROGRAM
4130 @end smallexample
4131 @end table
4135 @node GETGID
4136 @section @code{GETGID} --- Group ID function
4137 @findex @code{GETGID} intrinsic
4138 @cindex GETGID
4140 @table @asis
4141 @item @emph{Description}:
4142 Returns the numerical group ID of the current process.
4144 @item @emph{Standard}:
4145 GNU extension
4147 @item @emph{Class}:
4148 function
4150 @item @emph{Syntax}:
4151 @code{I = GETGID()}
4153 @item @emph{Return value}:
4154 The return value of @code{GETGID} is an @code{INTEGER} of the default
4155 kind.
4158 @item @emph{Example}:
4159 See @code{GETPID} for an example.
4161 @item @emph{See also}:
4162 @ref{GETPID}
4163 @end table
4167 @node GETLOG
4168 @section @code{GETLOG} --- Get login name
4169 @findex @code{GETLOG} intrinsic
4170 @cindex undocumented intrinsic 
4172 Intrinsic implemented, documentation pending.
4174 @table @asis
4175 @item @emph{Description}:
4176 @item @emph{Standard}:
4177 GNU extension
4179 @item @emph{Class}:
4180 Subroutine
4182 @item @emph{Syntax}:
4183 @item @emph{Arguments}:
4184 @item @emph{Return value}:
4185 @item @emph{Example}:
4186 @item @emph{Specific names}:
4187 @item @emph{See also}:
4188 @end table
4193 @node GETPID
4194 @section @code{GETPID} --- Process ID function
4195 @findex @code{GETPID} intrinsic
4196 @cindex GETPID
4198 @table @asis
4199 @item @emph{Description}:
4200 Returns the numerical process identifier of the current process.
4202 @item @emph{Standard}:
4203 GNU extension
4205 @item @emph{Class}:
4206 function
4208 @item @emph{Syntax}:
4209 @code{I = GETPID()}
4211 @item @emph{Return value}:
4212 The return value of @code{GETPID} is an @code{INTEGER} of the default
4213 kind.
4216 @item @emph{Example}:
4217 @smallexample
4218 program info
4219   print *, "The current process ID is ", getpid()
4220   print *, "Your numerical user ID is ", getuid()
4221   print *, "Your numerical group ID is ", getgid()
4222 end program info
4223 @end smallexample
4225 @end table
4229 @node GETUID
4230 @section @code{GETUID} --- User ID function
4231 @findex @code{GETUID} intrinsic
4232 @cindex GETUID
4234 @table @asis
4235 @item @emph{Description}:
4236 Returns the numerical user ID of the current process.
4238 @item @emph{Standard}:
4239 GNU extension
4241 @item @emph{Class}:
4242 function
4244 @item @emph{Syntax}:
4245 @code{GETUID()}
4247 @item @emph{Return value}:
4248 The return value of @code{GETUID} is an @code{INTEGER} of the default
4249 kind.
4252 @item @emph{Example}:
4253 See @code{GETPID} for an example.
4255 @item @emph{See also}:
4256 @ref{GETPID}
4257 @end table
4261 @node GMTIME
4262 @section @code{GMTIME} --- Convert time to GMT info
4263 @findex @code{GMTIME} 
4264 @cindex time function
4266 Not yet implemented in GNU Fortran.
4268 @table @asis
4269 @item @emph{Description}:
4271 @item @emph{Standard}:
4272 GNU extension
4274 @item @emph{Class}:
4275 Subroutine
4277 @item @emph{Syntax}:
4278 @item @emph{Arguments}:
4279 @item @emph{Return value}:
4280 @item @emph{Example}:
4281 @item @emph{Specific names}:
4282 @item @emph{See also}:
4284 @end table
4288 @node HOSTNM
4289 @section @code{HOSTNM} --- Get system host name
4290 @findex @code{HOSTNM} intrinsic
4291 @cindex undocumented intrinsic 
4293 Intrinsic implemented, documentation pending.
4295 @table @asis
4296 @item @emph{Description}:
4297 @item @emph{Standard}:
4298 GNU extension
4300 @item @emph{Class}:
4301 @item @emph{Syntax}:
4302 @item @emph{Arguments}:
4303 @item @emph{Return value}:
4304 @item @emph{Example}:
4305 @item @emph{Specific names}:
4306 @item @emph{See also}:
4307 @end table
4311 @node HUGE
4312 @section @code{HUGE} --- Largest number of a kind
4313 @findex @code{HUGE} intrinsic
4314 @cindex huge
4316 @table @asis
4317 @item @emph{Description}:
4318 @code{HUGE(X)} returns the largest number that is not an infinity in
4319 the model of the type of @code{X}.
4321 @item @emph{Standard}:
4322 F95 and later
4324 @item @emph{Class}:
4325 Elemental function
4327 @item @emph{Syntax}:
4328 @code{Y = HUGE(X)}
4330 @item @emph{Arguments}:
4331 @multitable @columnfractions .15 .80
4332 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
4333 @end multitable
4335 @item @emph{Return value}:
4336 The return value is of the same type and kind as @var{X}
4338 @item @emph{Example}:
4339 @smallexample
4340 program test_huge_tiny
4341   print *, huge(0), huge(0.0), huge(0.0d0)
4342   print *, tiny(0.0), tiny(0.0d0)
4343 end program test_huge_tiny
4344 @end smallexample
4345 @end table
4349 @node IACHAR
4350 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence 
4351 @findex @code{IACHAR} intrinsic
4352 @cindex @acronym{ASCII} collating sequence
4353 @cindex conversion function (character)
4355 @table @asis
4356 @item @emph{Description}:
4357 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4358 in the first character position of @code{C}.
4360 @item @emph{Standard}:
4361 F95 and later
4363 @item @emph{Class}:
4364 Elemental function
4366 @item @emph{Syntax}:
4367 @code{I = IACHAR(C)}
4369 @item @emph{Arguments}:
4370 @multitable @columnfractions .15 .80
4371 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4372 @end multitable
4374 @item @emph{Return value}:
4375 The return value is of type @code{INTEGER} and of the default integer
4376 kind.
4378 @item @emph{Example}:
4379 @smallexample
4380 program test_iachar
4381   integer i
4382   i = iachar(' ')
4383 end program test_iachar
4384 @end smallexample
4386 @item @emph{See also}:
4387 @ref{CHAR},@ref{ICHAR}
4389 @end table
4392 @node IAND
4393 @section @code{IAND} --- Bitwise logical and
4394 @findex @code{IAND} intrinsic
4395 @cindex bit operations
4397 @table @asis
4398 @item @emph{Description}:
4399 Bitwise logical @code{AND}.
4401 @item @emph{Standard}:
4402 F95 and later
4404 @item @emph{Class}:
4405 Elemental function
4407 @item @emph{Syntax}:
4408 @code{RESULT = IAND(X, Y)}
4410 @item @emph{Arguments}:
4411 @multitable @columnfractions .15 .80
4412 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
4413 @item @var{Y} @tab The type shall be @code{INTEGER(*)}.
4414 @end multitable
4416 @item @emph{Return value}:
4417 The return type is @code{INTEGER(*)} after cross-promotion of the arguments. 
4419 @item @emph{Example}:
4420 @smallexample
4421 PROGRAM test_iand
4422   INTEGER :: a, b
4423   DATA a / Z'F' /, b / Z'3' /
4424   WRITE (*,*) IAND(a, b)
4425 END PROGRAM
4426 @end smallexample
4428 @item @emph{See also}:
4429 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4430 @end table
4434 @node IARGC
4435 @section @code{IARGC} --- Get the number of command line arguments
4436 @findex @code{IARGC} intrinsic
4437 @cindex command line arguments
4438 @cindex getopt
4440 @table @asis
4441 @item @emph{Description}:
4442 @code{IARGC()} returns the number of arguments passed on the
4443 command line when the containing program was invoked.
4445 This intrinsic routine is provided for backwards compatibility with 
4446 GNU Fortran 77.  In new code, programmers should consider the use of 
4447 the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003 
4448 standard.
4450 @item @emph{Standard}:
4451 GNU extension
4453 @item @emph{Class}:
4454 Non-elemental Function
4456 @item @emph{Syntax}:
4457 @code{I = IARGC()}
4459 @item @emph{Arguments}:
4460 None.
4462 @item @emph{Return value}:
4463 The number of command line arguments, type @code{INTEGER(4)}.
4465 @item @emph{Example}:
4466 See @ref{GETARG}
4468 @item @emph{See also}:
4469 GNU Fortran 77 compatibility subroutine: @ref{GETARG}
4471 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4472 @end table
4476 @node IBCLR
4477 @section @code{IBCLR} --- Clear bit
4478 @findex @code{IBCLR} intrinsic
4479 @cindex bit operations
4481 Intrinsic implemented, documentation pending.
4483 @table @asis
4484 @item @emph{Description}:
4485 @item @emph{Standard}:
4486 F95 and later
4488 @item @emph{Class}:
4489 Elemental function
4491 @item @emph{Syntax}:
4492 @item @emph{Arguments}:
4493 @item @emph{Return value}:
4494 @item @emph{Example}:
4495 @item @emph{Specific names}:
4497 @item @emph{See also}:
4498 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4499 @end table
4504 @node IBITS
4505 @section @code{IBITS} --- Bit extraction
4506 @findex @code{IBITS} intrinsic
4507 @cindex bit operations
4509 Intrinsic implemented, documentation pending.
4511 @table @asis
4512 @item @emph{Description}:
4513 @item @emph{Standard}:
4514 F95 and later
4516 @item @emph{Class}:
4517 Elemental function
4519 @item @emph{Syntax}:
4520 @item @emph{Arguments}:
4521 @item @emph{Return value}:
4522 @item @emph{Example}:
4523 @item @emph{Specific names}:
4524 @item @emph{See also}:
4525 @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4527 @end table
4532 @node IBSET
4533 @section @code{IBSET} --- Set bit
4534 @findex @code{IBSET} intrinsic
4535 @cindex bit operations
4537 Intrinsic implemented, documentation pending.
4539 @table @asis
4540 @item @emph{Description}:
4541 @item @emph{Standard}:
4542 F95 and later
4544 @item @emph{Class}:
4545 Elemental function
4547 @item @emph{Syntax}:
4548 @item @emph{Arguments}:
4549 @item @emph{Return value}:
4550 @item @emph{Example}:
4551 @item @emph{Specific names}:
4553 @item @emph{See also}:
4554 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4556 @end table
4560 @node ICHAR
4561 @section @code{ICHAR} --- Character-to-integer conversion function
4562 @findex @code{ICHAR} intrinsic
4563 @cindex conversion function (character)
4565 @table @asis
4566 @item @emph{Description}:
4567 @code{ICHAR(C)} returns the code for the character in the first character
4568 position of @code{C} in the system's native character set.
4569 The correspondence between characters and their codes is not necessarily
4570 the same across different GNU Fortran implementations.
4572 @item @emph{Standard}:
4573 F95 and later
4575 @item @emph{Class}:
4576 Elemental function
4578 @item @emph{Syntax}:
4579 @code{I = ICHAR(C)}
4581 @item @emph{Arguments}:
4582 @multitable @columnfractions .15 .80
4583 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4584 @end multitable
4586 @item @emph{Return value}:
4587 The return value is of type @code{INTEGER} and of the default integer
4588 kind.
4590 @item @emph{Example}:
4591 @smallexample
4592 program test_ichar
4593   integer i
4594   i = ichar(' ')
4595 end program test_ichar
4596 @end smallexample
4598 @item @emph{Note}:
4599 No intrinsic exists to convert a printable character string to a numerical
4600 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4601 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4602 value 154.
4604 Instead, you can use internal-file I/O to do this kind of conversion. For
4605 example:
4606 @smallexample
4607 program read_val
4608   integer value
4609   character(len=10) string
4611   string = '154'
4612   read (string,'(I10)') value
4613   print *, value
4614 end program read_val
4615 @end smallexample
4616 @end table
4618 @node IDATE
4619 @section @code{IDATE} --- Get current local time subroutine (day/month/year) 
4620 @findex @code{IDATE} intrinsic
4622 @table @asis
4623 @item @emph{Description}:
4624 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the  
4625 current local time. The day (in the range 1-31), month (in the range 1-12), 
4626 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively. 
4627 The year has four significant digits.
4629 @item @emph{Standard}:
4630 GNU extension
4632 @item @emph{Class}:
4633 Subroutine
4635 @item @emph{Syntax}:
4636 @code{CALL IDATE(TARRAY)}
4638 @item @emph{Arguments}:
4639 @multitable @columnfractions .15 .80
4640 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4641 the kind shall be the default integer kind.
4642 @end multitable
4644 @item @emph{Return value}:
4645 Does not return.
4647 @item @emph{Example}:
4648 @smallexample
4649 program test_idate
4650   integer, dimension(3) :: tarray
4651   call idate(tarray)
4652   print *, tarray(1)
4653   print *, tarray(2)
4654   print *, tarray(3)
4655 end program test_idate
4656 @end smallexample
4657 @end table
4661 @node IEOR
4662 @section @code{IEOR} --- Bitwise logical exclusive or
4663 @findex @code{IEOR} intrinsic
4664 @cindex bit operations
4666 Intrinsic implemented, documentation pending.
4668 @table @asis
4669 @item @emph{Description}:
4670 @item @emph{Standard}:
4671 F95 and later
4673 @item @emph{Class}:
4674 Elemental function
4676 @item @emph{Syntax}:
4677 @item @emph{Arguments}:
4678 @item @emph{Return value}:
4679 @item @emph{Example}:
4680 @item @emph{Specific names}:
4682 @item @emph{See also}:
4683 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4684 @end table
4689 @node IERRNO
4690 @section @code{IERRNO} --- Get the last system error number
4691 @findex @code{IERRNO} intrinsic
4692 @cindex undocumented intrinsic 
4694 Intrinsic implemented, documentation pending.
4696 @table @asis
4697 @item @emph{Description}:
4698 @item @emph{Standard}:
4699 GNU extension
4701 @item @emph{Class}:
4702 @item @emph{Syntax}:
4703 @item @emph{Arguments}:
4704 @item @emph{Return value}:
4705 @item @emph{Example}:
4707 @item @emph{See also}:
4708 @ref{PERROR}
4709 @end table
4714 @node INDEX
4715 @section @code{INDEX} --- Position of a substring within a string
4716 @findex @code{INDEX} intrinsic
4717 @cindex undocumented intrinsic 
4719 Intrinsic implemented, documentation pending.
4721 @table @asis
4722 @item @emph{Description}:
4723 @item @emph{Standard}:
4724 F77 and later
4726 @item @emph{Class}:
4727 Elemental function
4729 @item @emph{Syntax}:
4730 @item @emph{Arguments}:
4731 @item @emph{Return value}:
4732 @item @emph{Example}:
4733 @item @emph{Specific names}:
4734 @item @emph{See also}:
4735 @end table
4740 @node INT
4741 @section @code{INT} --- Convert to integer type
4742 @findex @code{INT} intrinsic
4743 @findex @code{IFIX} intrinsic
4744 @findex @code{IDINT} intrinsic
4745 @cindex conversion function (integer)
4747 @table @asis
4748 @item @emph{Description}:
4749 Convert to integer type
4751 @item @emph{Standard}:
4752 F77 and later
4754 @item @emph{Class}:
4755 Elemental function
4757 @item @emph{Syntax}:
4758 @multitable @columnfractions .30 .80
4759 @item @code{X = INT(X)}
4760 @item @code{X = INT(X, KIND)}
4761 @end multitable
4763 @item @emph{Arguments}:
4764 @multitable @columnfractions .15 .80
4765 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or @code{COMPLEX(*)}
4766 @item @var{KIND}  @tab (Optional) @var{KIND} shall be a scalar integer.
4767 @end multitable
4769 @item @emph{Return value}:
4770 These functions return a @code{INTEGER(*)} variable or array under 
4771 the following rules: 
4773 @table @asis
4774 @item (A)
4775 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X} 
4776 @item (B)
4777 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}. 
4778 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed 
4779 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4780 @item (C)
4781 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4782 @end table
4784 @item @emph{Example}:
4785 @smallexample
4786 program test_int
4787   integer :: i = 42
4788   complex :: z = (-3.7, 1.0)
4789   print *, int(i)
4790   print *, int(z), int(z,8)
4791 end program
4792 @end smallexample
4794 @item @emph{Specific names}:
4795 @multitable @columnfractions .20 .20 .20 .40
4796 @item Name             @tab Argument            @tab Return type       @tab Standard
4797 @item @code{IFIX(X)}   @tab @code{REAL(4) X}    @tab @code{INTEGER}    @tab F77 and later
4798 @item @code{IDINT(X)}  @tab @code{REAL(8) X}    @tab @code{INTEGER}    @tab F77 and later
4799 @end multitable
4801 @comment @item @emph{See also}:
4802 @end table
4807 @node IOR
4808 @section @code{IOR} --- Bitwise logical or
4809 @findex @code{IOR} intrinsic
4810 @cindex bit operations
4812 Intrinsic implemented, documentation pending.
4814 @table @asis
4815 @item @emph{Description}:
4816 @item @emph{Standard}:
4817 F95 and later
4819 @item @emph{Class}:
4820 Elemental function
4822 @item @emph{Syntax}:
4823 @item @emph{Arguments}:
4824 @item @emph{Return value}:
4825 @item @emph{Example}:
4826 @item @emph{Specific names}:
4828 @item @emph{See also}:
4829 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4830 @end table
4835 @node IRAND
4836 @section @code{IRAND} --- Integer pseudo-random number
4837 @findex @code{IRAND} intrinsic
4838 @cindex random number
4840 @table @asis
4841 @item @emph{Description}:
4842 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
4843 distribution between 0 and a system-dependent limit (which is in most
4844 cases 2147483647). If @var{FLAG} is 0, the next number
4845 in the current sequence is returned; if @var{FLAG} is 1, the generator
4846 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
4847 it is used as a new seed with @code{SRAND}.
4849 @item @emph{Standard}:
4850 GNU extension
4852 @item @emph{Class}:
4853 non-elemental function
4855 @item @emph{Syntax}:
4856 @code{I = IRAND(FLAG)}
4858 @item @emph{Arguments}:
4859 @multitable @columnfractions .15 .80
4860 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
4861 @end multitable
4863 @item @emph{Return value}:
4864 The return value is of @code{INTEGER(kind=4)} type.
4866 @item @emph{Example}:
4867 @smallexample
4868 program test_irand
4869   integer,parameter :: seed = 86456
4870   
4871   call srand(seed)
4872   print *, irand(), irand(), irand(), irand()
4873   print *, irand(seed), irand(), irand(), irand()
4874 end program test_irand
4875 @end smallexample
4877 @end table
4881 @node ISHFT
4882 @section @code{ISHFT} --- Shift bits
4883 @findex @code{ISHFT} intrinsic
4884 @cindex bit manipulation
4886 Intrinsic implemented, documentation pending.
4888 @table @asis
4889 @item @emph{Description}:
4890 @item @emph{Standard}:
4891 F95 and later
4893 @item @emph{Class}:
4894 Elemental function
4896 @item @emph{Syntax}:
4897 @item @emph{Arguments}:
4898 @item @emph{Return value}:
4899 @item @emph{Example}:
4900 @item @emph{Specific names}:
4902 @item @emph{See also}:
4903 @ref{ISHFTC}
4904 @end table
4909 @node ISHFTC
4910 @section @code{ISHFTC} --- Shift bits circularly
4911 @findex @code{ISHFTC} intrinsic
4912 @cindex bit manipulation
4914 Intrinsic implemented, documentation pending.
4916 @table @asis
4917 @item @emph{Description}:
4918 @item @emph{Standard}:
4919 F95 and later
4921 @item @emph{Class}:
4922 Elemental function
4924 @item @emph{Syntax}:
4925 @item @emph{Arguments}:
4926 @item @emph{Return value}:
4927 @item @emph{Example}:
4928 @item @emph{Specific names}:
4930 @item @emph{See also}:
4931 @ref{ISHFT}
4932 @end table
4936 @node ITIME
4937 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds) 
4938 @findex @code{ITIME} intrinsic
4940 @table @asis
4941 @item @emph{Description}:
4942 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the  
4943 current local time. The hour (in the range 1-24), minute (in the range 1-60), 
4944 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY}, 
4945 respectively.
4947 @item @emph{Standard}:
4948 GNU extension
4950 @item @emph{Class}:
4951 Subroutine
4953 @item @emph{Syntax}:
4954 @code{CALL ITIME(TARRAY)}
4956 @item @emph{Arguments}:
4957 @multitable @columnfractions .15 .80
4958 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
4959 and the kind shall be the default integer kind.
4960 @end multitable
4962 @item @emph{Return value}:
4963 Does not return.
4966 @item @emph{Example}:
4967 @smallexample
4968 program test_itime
4969   integer, dimension(3) :: tarray
4970   call itime(tarray)
4971   print *, tarray(1)
4972   print *, tarray(2)
4973   print *, tarray(3)
4974 end program test_itime
4975 @end smallexample
4976 @end table
4980 @node KILL
4981 @section @code{KILL} --- Send a signal to a process
4982 @findex @code{KILL} intrinsic
4983 @cindex undocumented intrinsic 
4985 Intrinsic implemented, documentation pending.
4987 @table @asis
4988 @item @emph{Description}:
4989 @item @emph{Standard}:
4990 GNU extension
4992 @item @emph{Class}:
4993 Subroutine
4995 @item @emph{Syntax}:
4996 @item @emph{Arguments}:
4997 @item @emph{Return value}:
4998 @item @emph{Example}:
4999 @item @emph{Specific names}:
5001 @item @emph{See also}:
5002 @ref{ABORT}, @ref{EXIT}
5003 @end table
5007 @node KIND
5008 @section @code{KIND} --- Kind of an entity
5009 @findex @code{KIND} intrinsic
5011 @table @asis
5012 @item @emph{Description}:
5013 @code{KIND(X)} returns the kind value of the entity @var{X}.
5015 @item @emph{Standard}:
5016 F95 and later
5018 @item @emph{Class}:
5019 Inquiry function
5021 @item @emph{Syntax}:
5022 @code{K = KIND(X)}
5024 @item @emph{Arguments}:
5025 @multitable @columnfractions .15 .80
5026 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
5027 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
5028 @end multitable
5030 @item @emph{Return value}:
5031 The return value is a scalar of type @code{INTEGER} and of the default
5032 integer kind.
5034 @item @emph{Example}:
5035 @smallexample
5036 program test_kind
5037   integer,parameter :: kc = kind(' ')
5038   integer,parameter :: kl = kind(.true.)
5040   print *, "The default character kind is ", kc
5041   print *, "The default logical kind is ", kl
5042 end program test_kind
5043 @end smallexample
5045 @end table
5049 @node LBOUND
5050 @section @code{LBOUND} --- Lower dimension bounds of an array
5051 @findex @code{LBOUND} intrinsic
5052 @cindex undocumented intrinsic 
5054 Intrinsic implemented, documentation pending.
5056 @table @asis
5057 @item @emph{Description}:
5058 @item @emph{Standard}:
5059 F95 and later
5061 @item @emph{Class}:
5062 Inquiry function
5064 @item @emph{Syntax}:
5065 @item @emph{Arguments}:
5066 @item @emph{Return value}:
5067 @item @emph{Example}:
5068 @item @emph{See also}:
5069 @ref{UBOUND}
5070 @end table
5075 @node LEN
5076 @section @code{LEN} --- Length of a character entity
5077 @findex @code{LEN} intrinsic
5078 @cindex undocumented intrinsic 
5080 Intrinsic implemented, documentation pending.
5082 @table @asis
5083 @item @emph{Description}:
5084 @item @emph{Standard}:
5085 F77 and later
5087 @item @emph{Class}:
5088 Inquiry function
5090 @item @emph{Syntax}:
5091 @item @emph{Arguments}:
5092 @item @emph{Return value}:
5093 @item @emph{Example}:
5094 @item @emph{Specific names}:
5096 @item @emph{See also}:
5097 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
5098 @end table
5103 @node LEN_TRIM
5104 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
5105 @findex @code{LEN_TRIM} intrinsic
5106 @cindex undocumented intrinsic 
5108 Intrinsic implemented, documentation pending.
5110 @table @asis
5111 @item @emph{Description}:
5112 @item @emph{Standard}:
5113 F95 and later
5115 @item @emph{Class}:
5116 Elemental function
5118 @item @emph{Syntax}:
5119 @item @emph{Arguments}:
5120 @item @emph{Return value}:
5121 @item @emph{Example}:
5123 @item @emph{See also}:
5124 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
5125 @end table
5130 @node LGE
5131 @section @code{LGE} --- Lexical greater than or equal
5132 @findex @code{LGE} intrinsic
5133 @cindex comparison (lexical)
5135 Intrinsic implemented, documentation pending.
5137 @table @asis
5138 @item @emph{Description}:
5139 @item @emph{Standard}:
5140 F77 and later
5142 @item @emph{Class}:
5143 Elemental function
5145 @item @emph{Syntax}:
5146 @item @emph{Arguments}:
5147 @item @emph{Return value}:
5148 @item @emph{Example}:
5150 @item @emph{See also}:
5151 @ref{LGT}, @ref{LLE}, @ref{LLT}
5152 @end table
5157 @node LGT
5158 @section @code{LGT} --- Lexical greater than
5159 @findex @code{LGT} intrinsic
5160 @cindex comparison (lexical)
5162 Intrinsic implemented, documentation pending.
5164 @table @asis
5165 @item @emph{Description}:
5166 @item @emph{Standard}:
5167 F77 and later
5169 @item @emph{Class}:
5170 Elemental function
5172 @item @emph{Syntax}:
5173 @item @emph{Arguments}:
5174 @item @emph{Return value}:
5175 @item @emph{Example}:
5177 @item @emph{See also}:
5178 @ref{LGE}, @ref{LLE}, @ref{LLT}
5179 @end table
5184 @node LINK
5185 @section @code{LINK} --- Create a hard link
5186 @findex @code{LINK} intrinsic
5187 @cindex file system operations
5189 Intrinsic implemented, documentation pending.
5191 @table @asis
5192 @item @emph{Description}:
5193 @item @emph{Standard}:
5194 GNU extension
5196 @item @emph{Class}:
5197 Subroutine
5199 @item @emph{Syntax}:
5200 @item @emph{Arguments}:
5201 @item @emph{Return value}:
5202 @item @emph{Example}:
5203 @item @emph{Specific names}:
5205 @item @emph{See also}:
5206 @ref{UNLINK}
5207 @end table
5212 @node LLE
5213 @section @code{LLE} --- Lexical less than or equal
5214 @findex @code{LLE} intrinsic
5215 @cindex comparison (lexical)
5217 Intrinsic implemented, documentation pending.
5219 @table @asis
5220 @item @emph{Description}:
5221 @item @emph{Standard}:
5222 F77 and later
5224 @item @emph{Class}:
5225 Elemental function
5227 @item @emph{Syntax}:
5228 @item @emph{Arguments}:
5229 @item @emph{Return value}:
5230 @item @emph{Example}:
5232 @item @emph{See also}:
5233 @ref{LGE}, @ref{LGT}, @ref{LLT}
5234 @end table
5239 @node LLT
5240 @section @code{LLT} --- Lexical less than
5241 @findex @code{LLT} intrinsic
5242 @cindex comparison (lexical)
5244 Intrinsic implemented, documentation pending.
5246 @table @asis
5247 @item @emph{Description}:
5248 @item @emph{Standard}:
5249 F77 and later
5251 @item @emph{Class}:
5252 Elemental function
5254 @item @emph{Syntax}:
5255 @item @emph{Arguments}:
5256 @item @emph{Return value}:
5257 @item @emph{Example}:
5259 @item @emph{See also}:
5260 @ref{LGE}, @ref{LGT}, @ref{LLE}
5261 @end table
5266 @node LNBLNK
5267 @section @code{LNBLNK} --- Index of the last non-blank character in a string
5268 @findex @code{LNBLNK} intrinsic
5269 @cindex undocumented intrinsic 
5271 Intrinsic implemented, documentation pending.
5273 @table @asis
5274 @item @emph{Description}:
5275 @item @emph{Standard}:
5276 GNU extension
5278 @item @emph{Class}:
5279 @item @emph{Syntax}:
5280 @item @emph{Arguments}:
5281 @item @emph{Return value}:
5282 @item @emph{Example}:
5283 @item @emph{Specific names}:
5285 @item @emph{See also}:
5286 @ref{INDEX}
5287 @end table
5292 @node LOC
5293 @section @code{LOC} --- Returns the address of a variable
5294 @findex @code{LOC} intrinsic
5295 @cindex loc
5297 @table @asis
5298 @item @emph{Description}:
5299 @code{LOC(X)} returns the address of @var{X} as an integer.
5301 @item @emph{Standard}:
5302 GNU extension
5304 @item @emph{Class}:
5305 Inquiry function
5307 @item @emph{Syntax}:
5308 @code{I = LOC(X)}
5310 @item @emph{Arguments}:
5311 @multitable @columnfractions .15 .80
5312 @item @var{X} @tab Variable of any type.
5313 @end multitable
5315 @item @emph{Return value}:
5316 The return value is of type @code{INTEGER(n)}, where @code{n} is the
5317 size (in bytes) of a memory address on the target machine.
5319 @item @emph{Example}:
5320 @smallexample
5321 program test_loc
5322   integer :: i
5323   real :: r
5324   i = loc(r)
5325   print *, i
5326 end program test_loc
5327 @end smallexample
5328 @end table
5330 @node LOG
5331 @section @code{LOG} --- Logarithm function
5332 @findex @code{LOG} intrinsic
5333 @findex @code{ALOG} intrinsic
5334 @findex @code{DLOG} intrinsic
5335 @findex @code{CLOG} intrinsic
5336 @findex @code{ZLOG} intrinsic
5337 @findex @code{CDLOG} intrinsic
5338 @cindex logarithm
5340 @table @asis
5341 @item @emph{Description}:
5342 @code{LOG(X)} computes the logarithm of @var{X}.
5344 @item @emph{Standard}:
5345 F77 and later
5347 @item @emph{Class}:
5348 Elemental function
5350 @item @emph{Syntax}:
5351 @code{X = LOG(X)}
5353 @item @emph{Arguments}:
5354 @multitable @columnfractions .15 .80
5355 @item @var{X} @tab The type shall be @code{REAL(*)} or
5356 @code{COMPLEX(*)}.
5357 @end multitable
5359 @item @emph{Return value}:
5360 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5361 The kind type parameter is the same as @var{X}.
5363 @item @emph{Example}:
5364 @smallexample
5365 program test_log
5366   real(8) :: x = 1.0_8
5367   complex :: z = (1.0, 2.0)
5368   x = log(x)
5369   z = log(z)
5370 end program test_log
5371 @end smallexample
5373 @item @emph{Specific names}:
5374 @multitable @columnfractions .20 .20 .20 .40
5375 @item Name            @tab Argument          @tab Return type       @tab Standard
5376 @item @code{ALOG(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab f95, gnu
5377 @item @code{DLOG(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
5378 @item @code{CLOG(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
5379 @item @code{ZLOG(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
5380 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
5381 @end multitable
5382 @end table
5386 @node LOG10
5387 @section @code{LOG10} --- Base 10 logarithm function
5388 @findex @code{LOG10} intrinsic
5389 @findex @code{ALOG10} intrinsic
5390 @findex @code{DLOG10} intrinsic
5391 @cindex logarithm
5393 @table @asis
5394 @item @emph{Description}:
5395 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5397 @item @emph{Standard}:
5398 F77 and later
5400 @item @emph{Class}:
5401 Elemental function
5403 @item @emph{Syntax}:
5404 @code{X = LOG10(X)}
5406 @item @emph{Arguments}:
5407 @multitable @columnfractions .15 .80
5408 @item @var{X} @tab The type shall be @code{REAL(*)} or
5409 @code{COMPLEX(*)}.
5410 @end multitable
5412 @item @emph{Return value}:
5413 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5414 The kind type parameter is the same as @var{X}.
5416 @item @emph{Example}:
5417 @smallexample
5418 program test_log10
5419   real(8) :: x = 10.0_8
5420   x = log10(x)
5421 end program test_log10
5422 @end smallexample
5424 @item @emph{Specific names}:
5425 @multitable @columnfractions .20 .20 .20 .40
5426 @item Name            @tab Argument          @tab Return type       @tab Standard
5427 @item @code{ALOG10(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab F95 and later
5428 @item @code{DLOG10(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
5429 @end multitable
5430 @end table
5433 @node LOGICAL
5434 @section @code{LOGICAL} --- Convert to logical type
5435 @findex @code{LOGICAL} intrinsic
5436 @cindex conversion function (logical)
5438 Intrinsic implemented, documentation pending.
5440 @table @asis
5441 @item @emph{Description}:
5442 @item @emph{Standard}:
5443 F95 and later
5445 @item @emph{Class}:
5446 Elemental function
5448 @item @emph{Syntax}:
5449 @item @emph{Arguments}:
5450 @item @emph{Return value}:
5451 @item @emph{Example}:
5452 @item @emph{Specific names}:
5453 @item @emph{See also}:
5454 @end table
5459 @node LSHIFT
5460 @section @code{LSHIFT} --- Left shift bits
5461 @findex @code{LSHIFT} 
5462 @cindex bit manipulation
5464 Not yet implemented in GNU Fortran.
5466 @table @asis
5467 @item @emph{Description}:
5469 @item @emph{Standard}:
5470 GNU extension
5472 @item @emph{Class}:
5473 Function
5475 @item @emph{Syntax}:
5476 @item @emph{Arguments}:
5477 @item @emph{Return value}:
5478 @item @emph{Example}:
5479 @item @emph{Specific names}:
5480 @item @emph{See also}:
5482 @end table
5485 @node LSTAT
5486 @section @code{LSTAT} --- Get file status
5487 @findex @code{LSTAT} intrinsic
5488 @cindex file system operations 
5490 @table @asis
5491 @item @emph{Description}:
5492 @code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link, 
5493 then the link itself is statted, not the file that it refers to.
5495 The elements in @code{BUFF} are the same as described by @ref{STAT}.
5497 @item @emph{Standard}:
5498 GNU extension
5500 @item @emph{Class}:
5501 Non-elemental subroutine
5503 @item @emph{Syntax}:
5504 @code{CALL LSTAT(FILE,BUFF[,STATUS])}
5506 @item @emph{Arguments}:
5507 @multitable @columnfractions .15 .80
5508 @item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
5509 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
5510 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
5511                         on success and a system specific error code otherwise.
5512 @end multitable
5514 @item @emph{Example}:
5515 See @ref{STAT} for an example.
5517 @item @emph{See also}:
5518 To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
5519 @end table
5523 @node LTIME
5524 @section @code{LTIME} --- Convert time to local time info
5525 @findex @code{LTIME} 
5526 @cindex time function
5528 Not yet implemented in GNU Fortran.
5530 @table @asis
5531 @item @emph{Description}:
5533 @item @emph{Standard}:
5534 GNU extension
5536 @item @emph{Class}:
5537 Subroutine
5539 @item @emph{Syntax}:
5540 @item @emph{Arguments}:
5541 @item @emph{Return value}:
5542 @item @emph{Example}:
5543 @item @emph{Specific names}:
5544 @item @emph{See also}:
5546 @end table
5550 @node MALLOC
5551 @section @code{MALLOC} --- Allocate dynamic memory
5552 @findex @code{MALLOC} intrinsic
5553 @cindex MALLOC
5555 @table @asis
5556 @item @emph{Description}:
5557 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5558 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5559 is an extension intended to be used with Cray pointers, and is provided
5560 in GNU Fortran to allow the user to compile legacy code. For new code
5561 using Fortran 95 pointers, the memory allocation intrinsic is
5562 @code{ALLOCATE}.
5564 @item @emph{Standard}:
5565 GNU extension
5567 @item @emph{Class}:
5568 non-elemental function
5570 @item @emph{Syntax}:
5571 @code{PTR = MALLOC(SIZE)}
5573 @item @emph{Arguments}:
5574 @multitable @columnfractions .15 .80
5575 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5576 @end multitable
5578 @item @emph{Return value}:
5579 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5580 variables of type @code{INTEGER(K)} have the same size as
5581 C pointers (@code{sizeof(void *)}).
5583 @item @emph{Example}:
5584 The following example demonstrates the use of @code{MALLOC} and
5585 @code{FREE} with Cray pointers. This example is intended to run on
5586 32-bit systems, where the default integer kind is suitable to store
5587 pointers; on 64-bit systems, ptr_x would need to be declared as
5588 @code{integer(kind=8)}.
5590 @smallexample
5591 program test_malloc
5592   integer i
5593   integer ptr_x
5594   real*8 x(*), z
5595   pointer(ptr_x,x)
5597   ptr_x = malloc(20*8)
5598   do i = 1, 20
5599     x(i) = sqrt(1.0d0 / i)
5600   end do
5601   z = 0
5602   do i = 1, 20
5603     z = z + x(i)
5604     print *, z
5605   end do
5606   call free(ptr_x)
5607 end program test_malloc
5608 @end smallexample
5610 @item @emph{See also}:
5611 @ref{FREE}
5612 @end table
5615 @node MATMUL
5616 @section @code{MATMUL} --- matrix multiplication
5617 @findex @code{MATMUL} intrinsic
5618 @cindex matrix operations
5620 Intrinsic implemented, documentation pending.
5622 @table @asis
5623 @item @emph{Description}:
5624 @item @emph{Standard}:
5625 F95 and later
5627 @item @emph{Class}:
5628 Transformational function
5630 @item @emph{Syntax}:
5631 @item @emph{Arguments}:
5632 @item @emph{Return value}:
5633 @item @emph{Example}:
5634 @item @emph{See also}:
5635 @end table
5638 @node MAX
5639 @section @code{MAX} --- Maximum value of an argument list
5640 @findex @code{MAX} intrinsic
5641 @cindex undocumented intrinsic 
5643 Intrinsic implemented, documentation pending.
5645 @table @asis
5646 @item @emph{Description}:
5647 @item @emph{Standard}:
5648 F77 and later
5650 @item @emph{Class}:
5651 Elemental function
5653 @item @emph{Syntax}:
5654 @item @emph{Arguments}:
5655 @item @emph{Return value}:
5656 @item @emph{Example}:
5658 @item @emph{Specific names}:
5659 @multitable @columnfractions .20 .20 .20 .40
5660 @item Name             @tab Argument            @tab Return type         @tab Standard
5661 @item @code{MAX0(I)}   @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)}   @tab F77 and later
5662 @item @code{AMAX0(I)}  @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
5663 @item @code{MAX1(X)}   @tab @code{REAL(*) X}    @tab @code{INT(MAX(X))}  @tab F77 and later
5664 @item @code{AMAX1(X)}  @tab @code{REAL(4)    X} @tab @code{REAL(4)}      @tab F77 and later
5665 @item @code{DMAX1(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}      @tab F77 and later
5666 @end multitable
5668 @item @emph{See also}:
5669 @ref{MAXLOC} @ref{MAXVAL}
5670 @end table
5673 @node MAXEXPONENT
5674 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
5675 @findex @code{MAXEXPONENT} intrinsic
5676 @cindex MAXEXPONENT
5678 @table @asis
5679 @item @emph{Description}:
5680 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
5681 type of @code{X}.
5683 @item @emph{Standard}:
5684 F95 and later
5686 @item @emph{Class}:
5687 Inquiry function
5689 @item @emph{Syntax}:
5690 @code{I = MAXEXPONENT(X)}
5692 @item @emph{Arguments}:
5693 @multitable @columnfractions .15 .80
5694 @item @var{X} @tab shall be of type @code{REAL}.
5695 @end multitable
5697 @item @emph{Return value}:
5698 The return value is of type @code{INTEGER} and of the default integer
5699 kind.
5701 @item @emph{Example}:
5702 @smallexample
5703 program exponents
5704   real(kind=4) :: x
5705   real(kind=8) :: y
5707   print *, minexponent(x), maxexponent(x)
5708   print *, minexponent(y), maxexponent(y)
5709 end program exponents
5710 @end smallexample
5711 @end table
5714 @node MAXLOC
5715 @section @code{MAXLOC} --- Location of the maximum value within an array
5716 @findex @code{MAXLOC} intrinsic
5717 @cindex undocumented intrinsic 
5719 Intrinsic implemented, documentation pending.
5721 @table @asis
5722 @item @emph{Description}:
5723 @item @emph{Standard}:
5724 F95 and later
5726 @item @emph{Class}:
5727 Transformational function
5729 @item @emph{Syntax}:
5730 @item @emph{Arguments}:
5731 @item @emph{Return value}:
5732 @item @emph{Example}:
5733 @item @emph{See also}:
5734 @ref{MAX}, @ref{MAXVAL}
5735 @end table
5739 @node MAXVAL
5740 @section @code{MAXVAL} --- Maximum value of an array
5741 @findex @code{MAXVAL} intrinsic
5742 @cindex undocumented intrinsic 
5744 Intrinsic implemented, documentation pending.
5746 @table @asis
5747 @item @emph{Description}:
5748 @item @emph{Standard}:
5751 @item @emph{Class}:
5752 Transformational function
5754 @item @emph{Syntax}:
5755 @item @emph{Arguments}:
5756 @item @emph{Return value}:
5757 @item @emph{Example}:
5758 @item @emph{Specific names}:
5760 @item @emph{See also}:
5761 @ref{MAX}, @ref{MAXLOC}
5762 @end table
5767 @node MERGE
5768 @section @code{MERGE} --- Merge arrays
5769 @findex @code{MERGE} intrinsic
5770 @cindex undocumented intrinsic 
5772 Intrinsic implemented, documentation pending.
5774 @table @asis
5775 @item @emph{Description}:
5776 @item @emph{Standard}:
5777 F95 and later
5779 @item @emph{Class}:
5780 elemental function
5782 @item @emph{Syntax}:
5783 @item @emph{Arguments}:
5784 @item @emph{Return value}:
5785 @item @emph{Example}:
5786 @item @emph{Specific names}:
5787 @item @emph{See also}:
5788 @end table
5791 @node MIN
5792 @section @code{MIN} --- Minimum value of an argument list
5793 @findex @code{MIN} intrinsic
5794 @cindex undocumented intrinsic 
5796 Intrinsic implemented, documentation pending.
5798 @table @asis
5799 @item @emph{Description}:
5800 @item @emph{Standard}:
5801 F77 and later
5803 @item @emph{Class}:
5804 Elemental function
5806 @item @emph{Syntax}:
5807 @item @emph{Arguments}:
5808 @item @emph{Return value}:
5809 @item @emph{Example}:
5811 @item @emph{Specific names}:
5812 @multitable @columnfractions .20 .20 .20 .40
5813 @item Name             @tab Argument            @tab Return type         @tab Standard
5814 @item @code{MIN0(I)}   @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)}   @tab F77 and later
5815 @item @code{AMIN0(I)}  @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
5816 @item @code{MIN1(X)}   @tab @code{REAL(*) X}    @tab @code{INT(MIN(X))}  @tab F77 and later
5817 @item @code{AMIN1(X)}  @tab @code{REAL(4)    X} @tab @code{REAL(4)}      @tab F77 and later
5818 @item @code{DMIN1(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}      @tab F77 and later
5819 @end multitable
5821 @item @emph{See also}:
5822 @ref{MINLOC}, @ref{MINVAL}
5823 @end table
5825 @node MINEXPONENT
5826 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
5827 @findex @code{MINEXPONENT} intrinsic
5828 @cindex MINEXPONENT
5830 @table @asis
5831 @item @emph{Description}:
5832 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
5833 type of @code{X}.
5835 @item @emph{Standard}:
5836 F95 and later
5838 @item @emph{Class}:
5839 Inquiry function
5841 @item @emph{Syntax}:
5842 @code{I = MINEXPONENT(X)}
5844 @item @emph{Arguments}:
5845 @multitable @columnfractions .15 .80
5846 @item @var{X} @tab shall be of type @code{REAL}.
5847 @end multitable
5849 @item @emph{Return value}:
5850 The return value is of type @code{INTEGER} and of the default integer
5851 kind.
5853 @item @emph{Example}:
5854 See @code{MAXEXPONENT} for an example.
5855 @end table
5858 @node MINLOC
5859 @section @code{MINLOC} --- Location of the minimum value within an array
5860 @findex @code{MINLOC} intrinsic
5861 @cindex undocumented intrinsic 
5863 Intrinsic implemented, documentation pending.
5865 @table @asis
5866 @item @emph{Description}:
5867 @item @emph{Standard}:
5868 F95 and later
5870 @item @emph{Class}:
5871 Transformational function
5873 @item @emph{Syntax}:
5874 @item @emph{Arguments}:
5875 @item @emph{Return value}:
5876 @item @emph{Example}:
5878 @item @emph{See also}:
5879 @ref{MIN}, @ref{MINVAL}
5881 @end table
5884 @node MINVAL
5885 @section @code{MINVAL} --- Minimum value of an array
5886 @findex @code{MINVAL} intrinsic
5887 @cindex undocumented intrinsic 
5889 Intrinsic implemented, documentation pending.
5891 @table @asis
5892 @item @emph{Description}:
5893 @item @emph{Standard}:
5894 F95 and later
5896 @item @emph{Class}:
5897 Transformational function
5899 @item @emph{Syntax}:
5900 @item @emph{Arguments}:
5901 @item @emph{Return value}:
5902 @item @emph{Example}:
5904 @item @emph{See also}:
5905 @ref{MIN}, @ref{MINLOC}
5906 @end table
5911 @node MOD
5912 @section @code{MOD} --- Remainder function
5913 @findex @code{MOD} intrinsic
5914 @findex @code{AMOD} intrinsic
5915 @findex @code{DMOD} intrinsic
5916 @cindex remainder
5918 @table @asis
5919 @item @emph{Description}:
5920 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
5921 calculated as @code{A - (INT(A/P) * P)}.
5923 @item @emph{Standard}:
5924 F77 and later
5926 @item @emph{Class}:
5927 Elemental function
5929 @item @emph{Syntax}:
5930 @code{X = MOD(A,P)}
5932 @item @emph{Arguments}:
5933 @multitable @columnfractions .15 .80
5934 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5935 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
5936 equal to zero
5937 @end multitable
5939 @item @emph{Return value}:
5940 The kind of the return value is the result of cross-promoting
5941 the kinds of the arguments.
5943 @item @emph{Example}:
5944 @smallexample
5945 program test_mod
5946   print *, mod(17,3)
5947   print *, mod(17.5,5.5)
5948   print *, mod(17.5d0,5.5)
5949   print *, mod(17.5,5.5d0)
5951   print *, mod(-17,3)
5952   print *, mod(-17.5,5.5)
5953   print *, mod(-17.5d0,5.5)
5954   print *, mod(-17.5,5.5d0)
5956   print *, mod(17,-3)
5957   print *, mod(17.5,-5.5)
5958   print *, mod(17.5d0,-5.5)
5959   print *, mod(17.5,-5.5d0)
5960 end program test_mod
5961 @end smallexample
5963 @item @emph{Specific names}:
5964 @multitable @columnfractions .20 .20 .20 .40
5965 @item Name             @tab Arguments      @tab Return type    @tab Standard
5966 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
5967 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
5968 @end multitable
5969 @end table
5973 @node MODULO
5974 @section @code{MODULO} --- Modulo function
5975 @findex @code{MODULO} intrinsic
5976 @cindex modulo
5978 @table @asis
5979 @item @emph{Description}:
5980 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
5982 @item @emph{Standard}:
5983 F95 and later
5985 @item @emph{Class}:
5986 Elemental function
5988 @item @emph{Syntax}:
5989 @code{X = MODULO(A,P)}
5991 @item @emph{Arguments}:
5992 @multitable @columnfractions .15 .80
5993 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
5994 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
5995 @end multitable
5997 @item @emph{Return value}:
5998 The type and kind of the result are those of the arguments.
5999 @table @asis
6000 @item If @var{A} and @var{P} are of type @code{INTEGER}:
6001 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
6002 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
6003 (exclusive).
6004 @item If @var{A} and @var{P} are of type @code{REAL}:
6005 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
6006 @end table
6007 In all cases, if @var{P} is zero the result is processor-dependent.
6009 @item @emph{Example}:
6010 @smallexample
6011 program test_modulo
6012   print *, modulo(17,3)
6013   print *, modulo(17.5,5.5)
6015   print *, modulo(-17,3)
6016   print *, modulo(-17.5,5.5)
6018   print *, modulo(17,-3)
6019   print *, modulo(17.5,-5.5)
6020 end program test_mod
6021 @end smallexample
6023 @end table
6027 @node MVBITS
6028 @section @code{MVBITS} --- Move bits from one integer to another
6029 @findex @code{MVBITS} intrinsic
6030 @cindex bit operations
6032 Intrinsic implemented, documentation pending.
6034 @table @asis
6035 @item @emph{Description}:
6036 @item @emph{Standard}:
6037 F95 and later
6039 @item @emph{Class}:
6040 Elemental subroutine
6042 @item @emph{Syntax}:
6043 @item @emph{Arguments}:
6044 @item @emph{Return value}:
6045 @item @emph{Example}:
6046 @item @emph{See also}:
6047 @end table
6052 @node MOVE_ALLOC
6053 @section @code{MOVE_ALLOC} --- Move allocation from one object to another
6054 @findex @code{MOVE_ALLOC} intrinsic
6055 @cindex MOVE_ALLOC
6057 @table @asis
6058 @item @emph{Description}:
6059 @code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
6060 @var{DEST}.  @var{SRC} will become deallocated in the process.
6062 @item @emph{Standard}:
6063 F2003 and later
6065 @item @emph{Class}:
6066 Subroutine
6068 @item @emph{Syntax}:
6069 @code{CALL MOVE_ALLOC(SRC, DEST)}
6071 @item @emph{Arguments}:
6072 @multitable @columnfractions .15 .80
6073 @item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be of any type and kind.
6074 @item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be of the same type, kind and rank as @var{SRC}
6075 @end multitable
6077 @item @emph{Return value}:
6078 None
6080 @item @emph{Example}:
6081 @smallexample
6082 program test_move_alloc
6083     integer, allocatable :: a(:), b(:)
6085     allocate(a(3))
6086     a = [ 1, 2, 3 ]
6087     call move_alloc(a, b)
6088     print *, allocated(a), allocated(b)
6089     print *, b
6090 end program test_move_alloc
6091 @end smallexample
6092 @end table
6096 @node NEAREST
6097 @section @code{NEAREST} --- Nearest representable number
6098 @findex @code{NEAREST} intrinsic
6099 @cindex processor-representable number
6101 @table @asis
6102 @item @emph{Description}:
6103 @code{NEAREST(X, S)} returns the processor-representable number nearest
6104 to @code{X} in the direction indicated by the sign of @code{S}.
6106 @item @emph{Standard}:
6107 F95 and later
6109 @item @emph{Class}:
6110 Elemental function
6112 @item @emph{Syntax}:
6113 @code{Y = NEAREST(X, S)}
6115 @item @emph{Arguments}:
6116 @multitable @columnfractions .15 .80
6117 @item @var{X} @tab shall be of type @code{REAL}.
6118 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
6119 not equal to zero.
6120 @end multitable
6122 @item @emph{Return value}:
6123 The return value is of the same type as @code{X}. If @code{S} is
6124 positive, @code{NEAREST} returns the processor-representable number
6125 greater than @code{X} and nearest to it. If @code{S} is negative,
6126 @code{NEAREST} returns the processor-representable number smaller than
6127 @code{X} and nearest to it.
6129 @item @emph{Example}:
6130 @smallexample
6131 program test_nearest
6132   real :: x, y
6133   x = nearest(42.0, 1.0)
6134   y = nearest(42.0, -1.0)
6135   write (*,"(3(G20.15))") x, y, x - y
6136 end program test_nearest
6137 @end smallexample
6138 @end table
6142 @node NEW_LINE
6143 @section @code{NEW_LINE} --- New line character
6144 @findex @code{NEW_LINE} intrinsic
6145 @findex @code{NEW_LINE} intrinsic
6147 @table @asis
6148 @item @emph{Description}:
6149 @code{NEW_LINE(C)} returns the new-line character
6151 @item @emph{Standard}:
6152 F2003 and later
6154 @item @emph{Class}:
6155 Elemental function
6157 @item @emph{Syntax}:
6158 @code{C = NEW_LINE(C)}
6160 @item @emph{Arguments}:
6161 @multitable @columnfractions .15 .80
6162 @item @var{C}    @tab The argument shall be a scalar or array of the
6163                       type @code{CHARACTER}.
6164 @end multitable
6166 @item @emph{Return value}:
6167 Returns a @var{CHARACTER} scalar of length one with the new-line character of
6168 the same kind as parameter @var{C}.
6170 @item @emph{Example}:
6171 @smallexample
6172 program newline
6173   implicit none
6174   write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
6175 end program newline
6176 @end smallexample
6177 @end table
6181 @node NINT
6182 @section @code{NINT} --- Nearest whole number
6183 @findex @code{NINT} intrinsic
6184 @findex @code{IDNINT} intrinsic
6185 @cindex whole number
6187 @table @asis
6188 @item @emph{Description}:
6189 @code{NINT(X)} rounds its argument to the nearest whole number.
6191 @item @emph{Standard}:
6192 F77 and later
6194 @item @emph{Class}:
6195 Elemental function
6197 @item @emph{Syntax}:
6198 @code{X = NINT(X)}
6200 @item @emph{Arguments}:
6201 @multitable @columnfractions .15 .80
6202 @item @var{X}    @tab The type of the argument shall be @code{REAL}.
6203 @end multitable
6205 @item @emph{Return value}:
6206 Returns @var{A} with the fractional portion of its magnitude eliminated by
6207 rounding to the nearest whole number and with its sign preserved,
6208 converted to an @code{INTEGER} of the default kind.
6210 @item @emph{Example}:
6211 @smallexample
6212 program test_nint
6213   real(4) x4
6214   real(8) x8
6215   x4 = 1.234E0_4
6216   x8 = 4.321_8
6217   print *, nint(x4), idnint(x8)
6218 end program test_nint
6219 @end smallexample
6221 @item @emph{Specific names}:
6222 @multitable @columnfractions .33 .33 .33
6223 @item Name             @tab Argument         @tab Standard
6224 @item @code{IDNINT(X)} @tab @code{REAL(8)}   @tab F95 and later
6225 @end multitable
6227 @item @emph{See also}:
6228 @ref{CEILING}, @ref{FLOOR}
6230 @end table
6233 @node NOT
6234 @section @code{NOT} --- Logical negation
6235 @findex @code{NOT} intrinsic
6236 @cindex logical operations
6238 Intrinsic implemented, documentation pending.
6240 @table @asis
6241 @item @emph{Description}:
6242 @item @emph{Standard}:
6243 F77 and later
6245 @item @emph{Class}:
6246 Elemental function
6248 @item @emph{Syntax}:
6249 @item @emph{Arguments}:
6250 @item @emph{Return value}:
6251 @item @emph{Example}:
6252 @item @emph{See also}:
6253 @end table
6258 @node NULL
6259 @section @code{NULL} --- Function that returns an disassociated pointer
6260 @findex @code{NULL} 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}:
6277 @item @emph{See also}:
6278 @ref{ASSOCIATED}
6279 @end table
6284 @node OR
6285 @section @code{OR} --- Bitwise logical OR
6286 @findex @code{OR} intrinsic
6287 @cindex bit operations
6289 @table @asis
6290 @item @emph{Description}:
6291 Bitwise logical @code{OR}.
6293 This intrinsic routine is provided for backwards compatibility with 
6294 GNU Fortran 77.  For integer arguments, programmers should consider
6295 the use of the @ref{IOR} intrinsic defined by the Fortran standard.
6297 @item @emph{Standard}:
6298 GNU extension
6300 @item @emph{Class}:
6301 Non-elemental function
6303 @item @emph{Syntax}:
6304 @code{RESULT = OR(X, Y)}
6306 @item @emph{Arguments}:
6307 @multitable @columnfractions .15 .80
6308 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6309 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6310 @end multitable
6312 @item @emph{Return value}:
6313 The return type is either @code{INTEGER(*)} or @code{LOGICAL} 
6314 after cross-promotion of the arguments.
6316 @item @emph{Example}:
6317 @smallexample
6318 PROGRAM test_or
6319   LOGICAL :: T = .TRUE., F = ..FALSE.
6320   INTEGER :: a, b
6321   DATA a / Z'F' /, b / Z'3' /
6323   WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
6324   WRITE (*,*) OR(a, b)
6325 END PROGRAM
6326 @end smallexample
6328 @item @emph{See also}:
6329 F95 elemental function: @ref{IOR}
6330 @end table
6335 @node PACK
6336 @section @code{PACK} --- Pack an array into an array of rank one
6337 @findex @code{PACK} intrinsic
6338 @cindex undocumented intrinsic 
6340 Intrinsic implemented, documentation pending.
6342 @table @asis
6343 @item @emph{Description}:
6344 @item @emph{Standard}:
6345 F95 and later
6347 @item @emph{Class}:
6348 Transformational function
6350 @item @emph{Syntax}:
6351 @item @emph{Arguments}:
6352 @item @emph{Return value}:
6353 @item @emph{Example}:
6354 @item @emph{Specific names}:
6355 @item @emph{See also}:
6356 @ref{UNPACK}
6357 @end table
6362 @node PERROR
6363 @section @code{PERROR} --- Print system error message
6364 @findex @code{PERROR} intrinsic
6365 @cindex undocumented intrinsic 
6367 Intrinsic implemented, documentation pending.
6369 @table @asis
6370 @item @emph{Description}:
6371 @item @emph{Standard}:
6372 GNU extension
6374 @item @emph{Class}:
6375 Subroutine
6377 @item @emph{Syntax}:
6378 @item @emph{Arguments}:
6379 @item @emph{Return value}:
6380 @item @emph{Example}:
6381 @item @emph{Specific names}:
6382 @item @emph{See also}:
6383 @ref{IERRNO}
6384 @end table
6389 @node PRECISION
6390 @section @code{PRECISION} --- Decimal precision of a real kind
6391 @findex @code{PRECISION} intrinsic
6392 @cindex PRECISION
6394 @table @asis
6395 @item @emph{Description}:
6396 @code{PRECISION(X)} returns the decimal precision in the model of the
6397 type of @code{X}.
6399 @item @emph{Standard}:
6400 F95 and later
6402 @item @emph{Class}:
6403 Inquiry function
6405 @item @emph{Syntax}:
6406 @code{I = PRECISION(X)}
6408 @item @emph{Arguments}:
6409 @multitable @columnfractions .15 .80
6410 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6411 @end multitable
6413 @item @emph{Return value}:
6414 The return value is of type @code{INTEGER} and of the default integer
6415 kind.
6417 @item @emph{Example}:
6418 @smallexample
6419 program prec_and_range
6420   real(kind=4) :: x(2)
6421   complex(kind=8) :: y
6423   print *, precision(x), range(x)
6424   print *, precision(y), range(y)
6425 end program prec_and_range
6426 @end smallexample
6427 @end table
6431 @node PRESENT
6432 @section @code{PRESENT} --- Determine whether an optional argument is specified
6433 @findex @code{PRESENT} intrinsic
6434 @cindex undocumented intrinsic 
6436 Intrinsic implemented, documentation pending.
6438 @table @asis
6439 @item @emph{Description}:
6440 @item @emph{Standard}:
6441 F95 and later
6443 @item @emph{Class}:
6444 Inquiry function
6446 @item @emph{Syntax}:
6447 @item @emph{Arguments}:
6448 @item @emph{Return value}:
6449 @item @emph{Example}:
6450 @item @emph{See also}:
6451 @end table
6456 @node PRODUCT
6457 @section @code{PRODUCT} --- Product of array elements
6458 @findex @code{PRODUCT} intrinsic
6459 @cindex undocumented intrinsic 
6461 Intrinsic implemented, documentation pending.
6463 @table @asis
6464 @item @emph{Description}:
6465 @item @emph{Standard}:
6466 F95 and later
6468 @item @emph{Class}:
6469 Transformational function
6471 @item @emph{Syntax}:
6472 @item @emph{Arguments}:
6473 @item @emph{Return value}:
6474 @item @emph{Example}:
6475 @item @emph{Specific names}:
6476 @item @emph{See also}:
6477 @ref{SUM}
6478 @end table
6483 @node RADIX
6484 @section @code{RADIX} --- Base of a model number
6485 @findex @code{RADIX} intrinsic
6486 @cindex base
6488 @table @asis
6489 @item @emph{Description}:
6490 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
6492 @item @emph{Standard}:
6493 F95 and later
6495 @item @emph{Class}:
6496 Inquiry function
6498 @item @emph{Syntax}:
6499 @code{R = RADIX(X)}
6501 @item @emph{Arguments}:
6502 @multitable @columnfractions .15 .80
6503 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
6504 @end multitable
6506 @item @emph{Return value}:
6507 The return value is a scalar of type @code{INTEGER} and of the default
6508 integer kind.
6510 @item @emph{Example}:
6511 @smallexample
6512 program test_radix
6513   print *, "The radix for the default integer kind is", radix(0)
6514   print *, "The radix for the default real kind is", radix(0.0)
6515 end program test_radix
6516 @end smallexample
6518 @end table
6522 @node RANDOM_NUMBER
6523 @section @code{RANDOM_NUMBER} --- Pseudo-random number
6524 @findex @code{RANDOM_NUMBER} intrinsic
6525 @cindex random numbers
6527 Intrinsic implemented, documentation pending.
6529 @table @asis
6530 @item @emph{Description}:
6531 @item @emph{Standard}:
6532 F95 and later
6534 @item @emph{Class}:
6535 Elemental subroutine
6537 @item @emph{Syntax}:
6538 @item @emph{Arguments}:
6539 @item @emph{Return value}:
6540 @item @emph{Example}:
6541 @item @emph{See also}:
6542 @ref{RANDOM_SEED}
6543 @end table
6548 @node RANDOM_SEED
6549 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6550 @findex @code{RANDOM_SEED} intrinsic
6551 @cindex random numbers
6553 Intrinsic implemented, documentation pending.
6555 @table @asis
6556 @item @emph{Description}:
6557 @item @emph{Standard}:
6558 F95 and later
6560 @item @emph{Class}:
6561 Subroutine
6563 @item @emph{Syntax}:
6564 @item @emph{Arguments}:
6565 @item @emph{Return value}:
6566 @item @emph{Example}:
6567 @item @emph{See also}:
6568 @ref{RANDOM_NUMBER}
6569 @end table
6574 @node RAND
6575 @section @code{RAND} --- Real pseudo-random number
6576 @findex @code{RAND} intrinsic
6577 @findex @code{RAN} intrinsic
6578 @cindex random number
6580 @table @asis
6581 @item @emph{Description}:
6582 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6583 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6584 in the current sequence is returned; if @var{FLAG} is 1, the generator
6585 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6586 it is used as a new seed with @code{SRAND}.
6588 @item @emph{Standard}:
6589 GNU extension
6591 @item @emph{Class}:
6592 non-elemental function
6594 @item @emph{Syntax}:
6595 @code{X = RAND(FLAG)}
6597 @item @emph{Arguments}:
6598 @multitable @columnfractions .15 .80
6599 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6600 @end multitable
6602 @item @emph{Return value}:
6603 The return value is of @code{REAL} type and the default kind.
6605 @item @emph{Example}:
6606 @smallexample
6607 program test_rand
6608   integer,parameter :: seed = 86456
6609   
6610   call srand(seed)
6611   print *, rand(), rand(), rand(), rand()
6612   print *, rand(seed), rand(), rand(), rand()
6613 end program test_rand
6614 @end smallexample
6616 @item @emph{Note}:
6617 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6618 provided as an alias for @code{RAND}.
6620 @item @emph{See also}:
6621 @ref{SRAND}, @ref{RANDOM_NUMBER}
6623 @end table
6627 @node RANGE
6628 @section @code{RANGE} --- Decimal exponent range of a real kind
6629 @findex @code{RANGE} intrinsic
6630 @cindex RANGE
6632 @table @asis
6633 @item @emph{Description}:
6634 @code{RANGE(X)} returns the decimal exponent range in the model of the
6635 type of @code{X}.
6637 @item @emph{Standard}:
6638 F95 and later
6640 @item @emph{Class}:
6641 Inquiry function
6643 @item @emph{Syntax}:
6644 @code{I = RANGE(X)}
6646 @item @emph{Arguments}:
6647 @multitable @columnfractions .15 .80
6648 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6649 @end multitable
6651 @item @emph{Return value}:
6652 The return value is of type @code{INTEGER} and of the default integer
6653 kind.
6655 @item @emph{Example}:
6656 See @code{PRECISION} for an example.
6657 @end table
6661 @node RAN
6662 @section @code{RAN} --- Real pseudo-random number
6663 @findex @code{RAN} intrinsic
6664 @cindex random number
6666 @table @asis
6667 @item @emph{Standard}:
6668 GNU extension
6670 @item @emph{See also}:
6671 @ref{RAND}, @ref{RANDOM_NUMBER}
6672 @end table
6676 @node REAL
6677 @section @code{REAL} --- Convert to real type 
6678 @findex @code{REAL} intrinsic
6679 @findex @code{REALPART} intrinsic
6680 @cindex true values
6682 @table @asis
6683 @item @emph{Description}:
6684 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type.  The
6685 @code{REALPART(X)} function is provided for compatibility with @command{g77},
6686 and its use is strongly discouraged.
6688 @item @emph{Standard}:
6689 F77 and later
6691 @item @emph{Class}:
6692 Elemental function
6694 @item @emph{Syntax}:
6695 @multitable @columnfractions .30 .80
6696 @item @code{X = REAL(X)}
6697 @item @code{X = REAL(X, KIND)}
6698 @item @code{X = REALPART(Z)}
6699 @end multitable
6701 @item @emph{Arguments}:
6702 @multitable @columnfractions .15 .80
6703 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or  
6704 @code{COMPLEX(*)}.
6705 @item @var{KIND}  @tab (Optional) @var{KIND} shall be a scalar integer.
6706 @end multitable
6708 @item @emph{Return value}:
6709 These functions return a @code{REAL(*)} variable or array under
6710 the following rules: 
6712 @table @asis
6713 @item (A)
6714 @code{REAL(X)} is converted to a default real type if @var{X} is an 
6715 integer or real variable.
6716 @item (B)
6717 @code{REAL(X)} is converted to a real type with the kind type parameter
6718 of @var{X} if @var{X} is a complex variable.
6719 @item (C)
6720 @code{REAL(X, KIND)} is converted to a real type with kind type
6721 parameter @var{KIND} if @var{X} is a complex, integer, or real
6722 variable.
6723 @end table
6725 @item @emph{Example}:
6726 @smallexample
6727 program test_real
6728   complex :: x = (1.0, 2.0)
6729   print *, real(x), real(x,8), realpart(x)
6730 end program test_real
6731 @end smallexample
6733 @item @emph{See also}:
6734 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
6736 @end table
6739 @node RENAME
6740 @section @code{RENAME} --- Rename a file
6741 @findex @code{RENAME} intrinsic
6742 @cindex file system operations
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{See also}:
6759 @end table
6764 @node REPEAT
6765 @section @code{REPEAT} --- Repeated string concatenation 
6766 @findex @code{REPEAT} intrinsic
6767 @cindex string manipulation
6769 Intrinsic implemented, documentation pending.
6771 @table @asis
6772 @item @emph{Description}:
6773 @item @emph{Standard}:
6774 F95 and later
6776 @item @emph{Class}:
6777 Transformational function
6779 @item @emph{Syntax}:
6780 @item @emph{Arguments}:
6781 @item @emph{Return value}:
6782 @item @emph{Example}:
6783 @item @emph{See also}:
6784 @end table
6789 @node RESHAPE
6790 @section @code{RESHAPE} --- Function to reshape an array
6791 @findex @code{RESHAPE} intrinsic
6792 @cindex array manipulation
6794 Intrinsic implemented, documentation pending.
6796 @table @asis
6797 @item @emph{Description}:
6798 @item @emph{Standard}:
6799 F95 and later
6801 @item @emph{Class}:
6802 Transformational function
6804 @item @emph{Syntax}:
6805 @item @emph{Arguments}:
6806 @item @emph{Return value}:
6807 @item @emph{Example}:
6808 @item @emph{See also}:
6809 @ref{SHAPE}
6810 @end table
6814 @node RRSPACING
6815 @section @code{RRSPACING} --- Reciprocal of the relative spacing
6816 @findex @code{RRSPACING} intrinsic
6818 @table @asis
6819 @item @emph{Description}:
6820 @code{RRSPACING(X)} returns the  reciprocal of the relative spacing of
6821 model numbers near @var{X}.
6823 @item @emph{Standard}:
6824 F95 and later
6826 @item @emph{Class}:
6827 Elemental function
6829 @item @emph{Syntax}:
6830 @code{Y = RRSPACING(X)}
6832 @item @emph{Arguments}:
6833 @multitable @columnfractions .15 .80
6834 @item @var{X} @tab shall be of type @code{REAL}.
6835 @end multitable
6837 @item @emph{Return value}:
6838 The return value is of the same type and kind as @var{X}.
6839 The value returned is equal to
6840 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
6842 @end table
6846 @node RSHIFT
6847 @section @code{RSHIFT} --- Right shift bits
6848 @findex @code{RSHIFT} 
6849 @cindex bit manipulation
6851 Not yet implemented in GNU Fortran.
6853 @table @asis
6854 @item @emph{Description}:
6856 @item @emph{Standard}:
6857 GNU extension
6859 @item @emph{Class}:
6860 Function
6862 @item @emph{Syntax}:
6863 @item @emph{Arguments}:
6864 @item @emph{Return value}:
6865 @item @emph{Example}:
6866 @item @emph{See also}:
6868 @end table
6872 @node SCALE
6873 @section @code{SCALE} --- Scale a real value
6874 @findex @code{SCALE} intrinsic
6876 @table @asis
6877 @item @emph{Description}:
6878 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
6880 @item @emph{Standard}:
6881 F95 and later
6883 @item @emph{Class}:
6884 Elemental function
6886 @item @emph{Syntax}:
6887 @code{Y = SCALE(X, I)}
6889 @item @emph{Arguments}:
6890 @multitable @columnfractions .15 .80
6891 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
6892 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
6893 @end multitable
6895 @item @emph{Return value}:
6896 The return value is of the same type and kind as @var{X}.
6897 Its value is @code{X * RADIX(X)**I}.
6899 @item @emph{Example}:
6900 @smallexample
6901 program test_scale
6902   real :: x = 178.1387e-4
6903   integer :: i = 5
6904   print *, scale(x,i), x*radix(x)**i
6905 end program test_scale
6906 @end smallexample
6908 @end table
6911 @node SCAN
6912 @section @code{SCAN} --- Scan a string for the presence of a set of characters
6913 @findex @code{SCAN} intrinsic
6914 @cindex string manipulation
6916 Intrinsic implemented, documentation pending.
6918 @table @asis
6919 @item @emph{Description}:
6920 @item @emph{Standard}:
6921 F95 and later
6923 @item @emph{Class}:
6924 Elemental function
6926 @item @emph{Syntax}:
6927 @item @emph{Arguments}:
6928 @item @emph{Return value}:
6929 @item @emph{Example}:
6930 @item @emph{See also}:
6931 @end table
6936 @node SECNDS
6937 @section @code{SECNDS} --- Time function
6938 @findex @code{SECNDS} intrinsic
6939 @cindex SECNDS
6941 @table @asis
6942 @item @emph{Description}:
6943 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
6944 @var{X} is a reference time, also in seconds. If this is zero, the time in
6945 seconds from midnight is returned. This function is non-standard and its
6946 use is discouraged.
6948 @item @emph{Standard}:
6949 GNU extension
6951 @item @emph{Class}:
6952 function
6954 @item @emph{Syntax}:
6955 @code{T = SECNDS (X)}
6957 @item @emph{Arguments}:
6958 @multitable @columnfractions .15 .80
6959 @item Name        @tab Type
6960 @item @var{T}     @tab REAL(4)
6961 @item @var{X}     @tab REAL(4)
6962 @end multitable
6964 @item @emph{Return value}:
6965 None
6967 @item @emph{Example}:
6968 @smallexample
6969 program test_secnds
6970     real(4) :: t1, t2
6971     print *, secnds (0.0)   ! seconds since midnight
6972     t1 = secnds (0.0)       ! reference time
6973     do i = 1, 10000000      ! do something
6974     end do
6975     t2 = secnds (t1)        ! elapsed time
6976     print *, "Something took ", t2, " seconds."
6977 end program test_secnds
6978 @end smallexample
6979 @end table
6983 @node SELECTED_INT_KIND
6984 @section @code{SELECTED_INT_KIND} --- Choose integer kind
6985 @findex @code{SELECTED_INT_KIND} intrinsic
6986 @cindex integer kind
6988 @table @asis
6989 @item @emph{Description}:
6990 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
6991 type that can represent all values ranging from @math{-10^I} (exclusive)
6992 to @math{10^I} (exclusive). If there is no integer kind that accommodates
6993 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
6995 @item @emph{Standard}:
6996 F95 and later
6998 @item @emph{Class}:
6999 Transformational function
7001 @item @emph{Syntax}:
7002 @multitable @columnfractions .30 .80
7003 @item @code{J = SELECTED_INT_KIND(I)}
7004 @end multitable
7006 @item @emph{Arguments}:
7007 @multitable @columnfractions .15 .80
7008 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
7009 @end multitable
7011 @item @emph{Example}:
7012 @smallexample
7013 program large_integers
7014   integer,parameter :: k5 = selected_int_kind(5)
7015   integer,parameter :: k15 = selected_int_kind(15)
7016   integer(kind=k5) :: i5
7017   integer(kind=k15) :: i15
7019   print *, huge(i5), huge(i15)
7021   ! The following inequalities are always true
7022   print *, huge(i5) >= 10_k5**5-1
7023   print *, huge(i15) >= 10_k15**15-1
7024 end program large_integers
7025 @end smallexample
7026 @end table
7030 @node SELECTED_REAL_KIND
7031 @section @code{SELECTED_REAL_KIND} --- Choose real kind
7032 @findex @code{SELECTED_REAL_KIND} intrinsic
7033 @cindex real kind
7035 @table @asis
7036 @item @emph{Description}:
7037 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
7038 with decimal precision greater of at least @code{P} digits and exponent
7039 range greater at least @code{R}. 
7041 @item @emph{Standard}:
7042 F95 and later
7044 @item @emph{Class}:
7045 Transformational function
7047 @item @emph{Syntax}:
7048 @multitable @columnfractions .30 .80
7049 @item @code{I = SELECTED_REAL_KIND(P,R)}
7050 @end multitable
7052 @item @emph{Arguments}:
7053 @multitable @columnfractions .15 .80
7054 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7055 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7056 @end multitable
7057 At least one argument shall be present.
7059 @item @emph{Return value}:
7061 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
7062 a real data type with decimal precision of at least @code{P} digits and a
7063 decimal exponent range of at least @code{R}. If more than one real data
7064 type meet the criteria, the kind of the data type with the smallest
7065 decimal precision is returned. If no real data type matches the criteria,
7066 the result is
7067 @table @asis
7068 @item -1 if the processor does not support a real data type with a
7069 precision greater than or equal to @code{P}
7070 @item -2 if the processor does not support a real type with an exponent
7071 range greater than or equal to @code{R}
7072 @item -3 if neither is supported.
7073 @end table
7075 @item @emph{Example}:
7076 @smallexample
7077 program real_kinds
7078   integer,parameter :: p6 = selected_real_kind(6)
7079   integer,parameter :: p10r100 = selected_real_kind(10,100)
7080   integer,parameter :: r400 = selected_real_kind(r=400)
7081   real(kind=p6) :: x
7082   real(kind=p10r100) :: y
7083   real(kind=r400) :: z
7085   print *, precision(x), range(x)
7086   print *, precision(y), range(y)
7087   print *, precision(z), range(z)
7088 end program real_kinds
7089 @end smallexample
7090 @end table
7094 @node SET_EXPONENT
7095 @section @code{SET_EXPONENT} --- Set the exponent of the model
7096 @findex @code{SET_EXPONENT} intrinsic
7097 @cindex exponent
7099 @table @asis
7100 @item @emph{Description}:
7101 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
7102 is that that of @var{X} and whose exponent part if @var{I}.
7104 @item @emph{Standard}:
7105 F95 and later
7107 @item @emph{Class}:
7108 Elemental function
7110 @item @emph{Syntax}:
7111 @code{Y = SET_EXPONENT(X, I)}
7113 @item @emph{Arguments}:
7114 @multitable @columnfractions .15 .80
7115 @item @var{X} @tab shall be of type @code{REAL}.
7116 @item @var{I} @tab shall be of type @code{INTEGER}.
7117 @end multitable
7119 @item @emph{Return value}:
7120 The return value is of the same type and kind as @var{X}.
7121 The real number whose fractional part
7122 is that that of @var{X} and whose exponent part if @var{I} is returned;
7123 it is @code{FRACTION(X) * RADIX(X)**I}.
7125 @item @emph{Example}:
7126 @smallexample
7127 program test_setexp
7128   real :: x = 178.1387e-4
7129   integer :: i = 17
7130   print *, set_exponent(x), fraction(x) * radix(x)**i
7131 end program test_setexp
7132 @end smallexample
7134 @end table
7138 @node SHAPE
7139 @section @code{SHAPE} --- Determine the shape of an array
7140 @findex @code{SHAPE} intrinsic
7141 @cindex array manipulation
7143 Intrinsic implemented, documentation pending.
7145 @table @asis
7146 @item @emph{Description}:
7147 @item @emph{Standard}:
7148 F95 and later
7150 @item @emph{Class}:
7151 Inquiry function
7153 @item @emph{Syntax}:
7154 @item @emph{Arguments}:
7155 @item @emph{Return value}:
7156 @item @emph{Example}:
7157 @item @emph{See also}:
7158 @ref{RESHAPE}
7159 @end table
7164 @node SIGN
7165 @section @code{SIGN} --- Sign copying function
7166 @findex @code{SIGN} intrinsic
7167 @findex @code{ISIGN} intrinsic
7168 @findex @code{DSIGN} intrinsic
7169 @cindex sign copying
7171 @table @asis
7172 @item @emph{Description}:
7173 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
7175 @item @emph{Standard}:
7176 F77 and later
7178 @item @emph{Class}:
7179 Elemental function
7181 @item @emph{Syntax}:
7182 @code{X = SIGN(A,B)}
7184 @item @emph{Arguments}:
7185 @multitable @columnfractions .15 .80
7186 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
7187 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
7188 @end multitable
7190 @item @emph{Return value}:
7191 The kind of the return value is that of @var{A} and @var{B}.
7192 If @math{B\ge 0} then the result is @code{ABS(A)}, else
7193 it is @code{-ABS(A)}.
7195 @item @emph{Example}:
7196 @smallexample
7197 program test_sign
7198   print *, sign(-12,1)
7199   print *, sign(-12,0)
7200   print *, sign(-12,-1)
7202   print *, sign(-12.,1.)
7203   print *, sign(-12.,0.)
7204   print *, sign(-12.,-1.)
7205 end program test_sign
7206 @end smallexample
7208 @item @emph{Specific names}:
7209 @multitable @columnfractions .20 .20 .20 .40
7210 @item Name              @tab Arguments      @tab Return type    @tab Standard
7211 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
7212 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
7213 @end multitable
7214 @end table
7218 @node SIGNAL
7219 @section @code{SIGNAL} --- Signal handling subroutine (or function)
7220 @findex @code{SIGNAL} intrinsic
7221 @cindex SIGNAL subroutine 
7223 @table @asis
7224 @item @emph{Description}:
7225 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
7226 @var{HANDLER} to be executed with a single integer argument when signal
7227 @var{NUMBER} occurs.  If @var{HANDLER} is an integer, it can be used to
7228 turn off handling of signal @var{NUMBER} or revert to its default
7229 action.  See @code{signal(2)}.
7231 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
7232 is supplied, it is set to the value returned by @code{signal(2)}.
7234 @item @emph{Standard}:
7235 GNU extension
7237 @item @emph{Class}:
7238 subroutine, non-elemental function
7240 @item @emph{Syntax}:
7241 @multitable @columnfractions .30 .80
7242 @item @code{CALL ALARM(NUMBER, HANDLER)}
7243 @item @code{CALL ALARM(NUMBER, HANDLER, STATUS)}
7244 @item @code{STATUS = ALARM(NUMBER, HANDLER)}
7245 @end multitable
7247 @item @emph{Arguments}:
7248 @multitable @columnfractions .15 .80
7249 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
7250 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
7251 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
7252 @code{INTEGER}. It is @code{INTENT(IN)}.
7253 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
7254 integer. It has @code{INTENT(OUT)}.
7255 @end multitable
7257 @item @emph{Return value}:
7258 The @code{SIGNAL} functions returns the value returned by @code{signal(2)}.
7260 @item @emph{Example}:
7261 @smallexample
7262 program test_signal
7263   intrinsic signal
7264   external handler_print
7266   call signal (12, handler_print)
7267   call signal (10, 1)
7269   call sleep (30)
7270 end program test_signal
7271 @end smallexample
7272 @end table
7277 @node SIN
7278 @section @code{SIN} --- Sine function 
7279 @findex @code{SIN} intrinsic
7280 @findex @code{DSIN} intrinsic
7281 @findex @code{ZSIN} intrinsic
7282 @findex @code{CDSIN} intrinsic
7283 @cindex trigonometric functions
7285 @table @asis
7286 @item @emph{Description}:
7287 @code{SIN(X)} computes the sine of @var{X}.
7289 @item @emph{Standard}:
7290 F77 and later
7292 @item @emph{Class}:
7293 Elemental function
7295 @item @emph{Syntax}:
7296 @code{X = SIN(X)}
7298 @item @emph{Arguments}:
7299 @multitable @columnfractions .15 .80
7300 @item @var{X} @tab The type shall be @code{REAL(*)} or
7301 @code{COMPLEX(*)}.
7302 @end multitable
7304 @item @emph{Return value}:
7305 The return value has same type and kind as @var{X}.
7307 @item @emph{Example}:
7308 @smallexample
7309 program test_sin
7310   real :: x = 0.0
7311   x = sin(x)
7312 end program test_sin
7313 @end smallexample
7315 @item @emph{Specific names}:
7316 @multitable @columnfractions .20 .20 .20 .40
7317 @item Name            @tab Argument          @tab Return type       @tab Standard
7318 @item @code{DSIN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
7319 @item @code{CSIN(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
7320 @item @code{ZSIN(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
7321 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
7322 @end multitable
7324 @item @emph{See also}:
7325 @ref{ASIN}
7326 @end table
7330 @node SINH
7331 @section @code{SINH} --- Hyperbolic sine function 
7332 @findex @code{SINH} intrinsic
7333 @findex @code{DSINH} intrinsic
7334 @cindex hyperbolic sine
7336 @table @asis
7337 @item @emph{Description}:
7338 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
7340 @item @emph{Standard}:
7341 F95 and later
7343 @item @emph{Class}:
7344 Elemental function
7346 @item @emph{Syntax}:
7347 @code{X = SINH(X)}
7349 @item @emph{Arguments}:
7350 @multitable @columnfractions .15 .80
7351 @item @var{X} @tab The type shall be @code{REAL(*)}.
7352 @end multitable
7354 @item @emph{Return value}:
7355 The return value is of type @code{REAL(*)}.
7357 @item @emph{Example}:
7358 @smallexample
7359 program test_sinh
7360   real(8) :: x = - 1.0_8
7361   x = sinh(x)
7362 end program test_sinh
7363 @end smallexample
7365 @item @emph{Specific names}:
7366 @multitable @columnfractions .20 .20 .20 .40
7367 @item Name            @tab Argument          @tab Return type       @tab Standard
7368 @item @code{DSINH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7369 @end multitable
7371 @item @emph{See also}:
7372 @ref{ASINH}
7373 @end table
7377 @node SIZE
7378 @section @code{SIZE} --- Determine the size of an array
7379 @findex @code{SIZE} intrinsic
7380 @cindex array manipulation
7382 Intrinsic implemented, documentation pending.
7384 @table @asis
7385 @item @emph{Description}:
7386 @item @emph{Standard}:
7387 F95 and later
7389 @item @emph{Class}:
7390 Inquiry function
7392 @item @emph{Syntax}:
7393 @item @emph{Arguments}:
7394 @item @emph{Return value}:
7395 @item @emph{Example}:
7396 @item @emph{See also}:
7397 @end table
7401 @node SNGL
7402 @section @code{SNGL} --- Convert double precision real to default real
7403 @findex @code{SNGL} intrinsic
7404 @cindex conversion function (real)
7406 @table @asis
7407 @item @emph{Description}:
7408 @code{SNGL(A)} converts the double precision real @var{A}
7409 to a default real value. This is an archaic form of @code{REAL}
7410 that is specific to one type for @var{A}.
7412 @item @emph{Standard}:
7413 GNU extension
7415 @item @emph{Class}:
7416 function
7418 @item @emph{Syntax}:
7419 @code{X = SNGL(A)}
7421 @item @emph{Arguments}:
7422 @multitable @columnfractions .15 .80
7423 @item @var{A} @tab The type shall be a double precision @code{REAL}.
7424 @end multitable
7426 @item @emph{Return value}:
7427 The return value is of type default @code{REAL}.
7429 @item @emph{See also}:
7430 @ref{DBLE}
7431 @end table
7435 @node SPACING
7436 @section @code{SPACING} --- Smallest distance between two numbers of a given type
7437 @findex @code{SPACING} intrinsic
7438 @cindex undocumented intrinsic 
7440 Intrinsic implemented, documentation pending.
7442 @table @asis
7443 @item @emph{Description}:
7444 @item @emph{Standard}:
7445 F95 and later
7447 @item @emph{Class}:
7448 Elemental function
7450 @item @emph{Syntax}:
7451 @item @emph{Arguments}:
7452 @item @emph{Return value}:
7453 @item @emph{Example}:
7454 @item @emph{See also}:
7455 @end table
7460 @node SPREAD
7461 @section @code{SPREAD} --- Add a dimension to an array
7462 @findex @code{SPREAD} intrinsic
7463 @cindex array manipulation
7465 Intrinsic implemented, documentation pending.
7467 @table @asis
7468 @item @emph{Description}:
7469 @item @emph{Standard}:
7470 F95 and later
7472 @item @emph{Class}:
7473 Transformational function
7475 @item @emph{Syntax}:
7476 @item @emph{Arguments}:
7477 @item @emph{Return value}:
7478 @item @emph{Example}:
7479 @item @emph{See also}:
7480 @end table
7485 @node SQRT
7486 @section @code{SQRT} --- Square-root function
7487 @findex @code{SQRT} intrinsic
7488 @findex @code{DSQRT} intrinsic
7489 @findex @code{CSQRT} intrinsic
7490 @findex @code{ZSQRT} intrinsic
7491 @findex @code{CDSQRT} intrinsic
7492 @cindex square-root
7494 @table @asis
7495 @item @emph{Description}:
7496 @code{SQRT(X)} computes the square root of @var{X}.
7498 @item @emph{Standard}:
7499 F77 and later
7501 @item @emph{Class}:
7502 Elemental function
7504 @item @emph{Syntax}:
7505 @code{X = SQRT(X)}
7507 @item @emph{Arguments}:
7508 @multitable @columnfractions .15 .80
7509 @item @var{X} @tab The type shall be @code{REAL(*)} or
7510 @code{COMPLEX(*)}.
7511 @end multitable
7513 @item @emph{Return value}:
7514 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
7515 The kind type parameter is the same as @var{X}.
7517 @item @emph{Example}:
7518 @smallexample
7519 program test_sqrt
7520   real(8) :: x = 2.0_8
7521   complex :: z = (1.0, 2.0)
7522   x = sqrt(x)
7523   z = sqrt(z)
7524 end program test_sqrt
7525 @end smallexample
7527 @item @emph{Specific names}:
7528 @multitable @columnfractions .20 .20 .20 .40
7529 @item Name             @tab Argument             @tab Return type          @tab Standard
7530 @item @code{DSQRT(X)}  @tab @code{REAL(8) X}     @tab @code{REAL(8)}       @tab F95 and later
7531 @item @code{CSQRT(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab F95 and later
7532 @item @code{ZSQRT(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab GNU extension
7533 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab GNU extension
7534 @end multitable
7535 @end table
7539 @node SRAND
7540 @section @code{SRAND} --- Reinitialize the random number generator
7541 @findex @code{SRAND} intrinsic
7542 @cindex random number
7544 @table @asis
7545 @item @emph{Description}:
7546 @code{SRAND} reinitializes the pseudo-random number generator
7547 called by @code{RAND} and @code{IRAND}. The new seed used by the
7548 generator is specified by the required argument @var{SEED}.
7550 @item @emph{Standard}:
7551 GNU extension
7553 @item @emph{Class}:
7554 non-elemental subroutine
7556 @item @emph{Syntax}:
7557 @code{CALL SRAND(SEED)}
7559 @item @emph{Arguments}:
7560 @multitable @columnfractions .15 .80
7561 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7562 @end multitable
7564 @item @emph{Return value}:
7565 Does not return.
7567 @item @emph{Example}:
7568 See @code{RAND} and @code{IRAND} for examples.
7570 @item @emph{Notes}:
7571 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7572 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7573 to generate pseudo-random numbers. Please note that in
7574 GNU Fortran, these two sets of intrinsics (@code{RAND},
7575 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7576 @code{RANDOM_SEED} on the other hand) access two independent
7577 pseudo-random number generators.
7579 @item @emph{See also}:
7580 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7582 @end table
7585 @node STAT
7586 @section @code{STAT} --- Get file status
7587 @findex @code{STAT} intrinsic
7588 @cindex file system operations
7590 @table @asis
7591 @item @emph{Description}:
7592 This function returns information about a file. No permissions are required on 
7593 the file itself, but execute (search) permission is required on all of the 
7594 directories in path that lead to the file.
7596 The elements that are obtained and stored in the array @code{BUFF}:
7597 @multitable @columnfractions .15 .80
7598 @item @code{buff(1)}   @tab  Device ID 
7599 @item @code{buff(2)}   @tab  Inode number 
7600 @item @code{buff(3)}   @tab  File mode 
7601 @item @code{buff(4)}   @tab  Number of links 
7602 @item @code{buff(5)}   @tab  Owner's uid 
7603 @item @code{buff(6)}   @tab  Owner's gid 
7604 @item @code{buff(7)}   @tab  ID of device containing directory entry for file (0 if not available) 
7605 @item @code{buff(8)}   @tab  File size (bytes) 
7606 @item @code{buff(9)}   @tab  Last access time 
7607 @item @code{buff(10)}  @tab  Last modification time 
7608 @item @code{buff(11)}  @tab  Last file status change time 
7609 @item @code{buff(12)}  @tab  Preferred I/O block size (-1 if not available) 
7610 @item @code{buff(13)}  @tab  Number of blocks allocated (-1 if not available)
7611 @end multitable
7613 Not all these elements are relevant on all systems. 
7614 If an element is not relevant, it is returned as 0.
7617 @item @emph{Standard}:
7618 GNU extension
7620 @item @emph{Class}:
7621 Non-elemental subroutine
7623 @item @emph{Syntax}:
7624 @code{CALL STAT(FILE,BUFF[,STATUS])}
7626 @item @emph{Arguments}:
7627 @multitable @columnfractions .15 .80
7628 @item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
7629 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
7630 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
7631                         on success and a system specific error code otherwise.
7632 @end multitable
7634 @item @emph{Example}:
7635 @smallexample
7636 PROGRAM test_stat
7637   INTEGER, DIMENSION(13) :: buff
7638   INTEGER :: status
7640   CALL STAT("/etc/passwd", buff, status)
7642   IF (status == 0) THEN
7643     WRITE (*, FMT="('Device ID:',               T30, I19)") buff(1)
7644     WRITE (*, FMT="('Inode number:',            T30, I19)") buff(2)
7645     WRITE (*, FMT="('File mode (octal):',       T30, O19)") buff(3)
7646     WRITE (*, FMT="('Number of links:',         T30, I19)") buff(4)
7647     WRITE (*, FMT="('Owner''s uid:',            T30, I19)") buff(5)
7648     WRITE (*, FMT="('Owner''s gid:',            T30, I19)") buff(6)
7649     WRITE (*, FMT="('Device where located:',    T30, I19)") buff(7)
7650     WRITE (*, FMT="('File size:',               T30, I19)") buff(8)
7651     WRITE (*, FMT="('Last access time:',        T30, A19)") CTIME(buff(9))
7652     WRITE (*, FMT="('Last modification time',   T30, A19)") CTIME(buff(10))
7653     WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
7654     WRITE (*, FMT="('Preferred block size:',    T30, I19)") buff(12)
7655     WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
7656   END IF
7657 END PROGRAM
7658 @end smallexample
7660 @item @emph{See also}:
7661 To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
7662 @end table
7666 @node SUM
7667 @section @code{SUM} --- Sum of array elements
7668 @findex @code{SUM} intrinsic
7669 @cindex array manipulation
7671 Intrinsic implemented, documentation pending.
7673 @table @asis
7674 @item @emph{Description}:
7675 @item @emph{Standard}:
7676 F95 and later
7678 @item @emph{Class}:
7679 Transformational function
7681 @item @emph{Syntax}:
7682 @item @emph{Arguments}:
7683 @item @emph{Return value}:
7684 @item @emph{Example}:
7685 @item @emph{See also}:
7686 @ref{PRODUCT}
7687 @end table
7692 @node SYMLNK
7693 @section @code{SYMLNK} --- Create a symbolic link
7694 @findex @code{SYMLNK} intrinsic
7695 @cindex file system operations
7697 Intrinsic implemented, documentation pending.
7699 @table @asis
7700 @item @emph{Description}:
7701 @item @emph{Standard}:
7702 @item @emph{Class}:
7703 GNU extension
7705 @item @emph{Syntax}:
7706 @item @emph{Arguments}:
7707 @item @emph{Return value}:
7708 @item @emph{Example}:
7709 @item @emph{See also}:
7710 @end table
7715 @node SYSTEM
7716 @section @code{SYSTEM} --- Execute a shell command
7717 @findex @code{SYSTEM} intrinsic
7718 @cindex undocumented intrinsic 
7720 Intrinsic implemented, documentation pending.
7722 @table @asis
7723 @item @emph{Description}:
7724 @item @emph{Standard}:
7725 GNU extension
7727 @item @emph{Class}:
7728 Subroutine
7730 @item @emph{Syntax}:
7731 @item @emph{Arguments}:
7732 @item @emph{Return value}:
7733 @item @emph{Example}:
7734 @item @emph{See also}:
7735 @end table
7740 @node SYSTEM_CLOCK
7741 @section @code{SYSTEM_CLOCK} --- Time function
7742 @findex @code{SYSTEM_CLOCK} intrinsic
7743 @cindex time functions
7745 Intrinsic implemented, documentation pending.
7747 @table @asis
7748 @item @emph{Description}:
7749 @item @emph{Standard}:
7750 F95 and later
7752 @item @emph{Class}:
7753 Subroutine
7755 @item @emph{Syntax}:
7756 @item @emph{Arguments}:
7757 @item @emph{Return value}:
7758 @item @emph{Example}:
7759 @item @emph{See also}:
7760 @end table
7764 @node TAN
7765 @section @code{TAN} --- Tangent function
7766 @findex @code{TAN} intrinsic
7767 @findex @code{DTAN} intrinsic
7768 @cindex trigonometric functions
7770 @table @asis
7771 @item @emph{Description}:
7772 @code{TAN(X)} computes the tangent of @var{X}.
7774 @item @emph{Standard}:
7775 F77 and later
7777 @item @emph{Class}:
7778 Elemental function
7780 @item @emph{Syntax}:
7781 @code{X = TAN(X)}
7783 @item @emph{Arguments}:
7784 @multitable @columnfractions .15 .80
7785 @item @var{X} @tab The type shall be @code{REAL(*)}.
7786 @end multitable
7788 @item @emph{Return value}:
7789 The return value is of type @code{REAL(*)}.  The kind type parameter is
7790 the same as @var{X}.
7792 @item @emph{Example}:
7793 @smallexample
7794 program test_tan
7795   real(8) :: x = 0.165_8
7796   x = tan(x)
7797 end program test_tan
7798 @end smallexample
7800 @item @emph{Specific names}:
7801 @multitable @columnfractions .20 .20 .20 .40
7802 @item Name            @tab Argument          @tab Return type       @tab Standard
7803 @item @code{DTAN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7804 @end multitable
7806 @item @emph{See also}:
7807 @ref{ATAN}
7808 @end table
7812 @node TANH
7813 @section @code{TANH} --- Hyperbolic tangent function 
7814 @findex @code{TANH} intrinsic
7815 @findex @code{DTANH} intrinsic
7816 @cindex hyperbolic tangent
7818 @table @asis
7819 @item @emph{Description}:
7820 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
7822 @item @emph{Standard}:
7823 F77 and later
7825 @item @emph{Class}:
7826 Elemental function
7828 @item @emph{Syntax}:
7829 @code{X = TANH(X)}
7831 @item @emph{Arguments}:
7832 @multitable @columnfractions .15 .80
7833 @item @var{X} @tab The type shall be @code{REAL(*)}.
7834 @end multitable
7836 @item @emph{Return value}:
7837 The return value is of type @code{REAL(*)} and lies in the range
7838 @math{ - 1 \leq tanh(x) \leq 1 }.
7840 @item @emph{Example}:
7841 @smallexample
7842 program test_tanh
7843   real(8) :: x = 2.1_8
7844   x = tanh(x)
7845 end program test_tanh
7846 @end smallexample
7848 @item @emph{Specific names}:
7849 @multitable @columnfractions .20 .20 .20 .40
7850 @item Name            @tab Argument          @tab Return type       @tab Standard
7851 @item @code{DTANH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7852 @end multitable
7854 @item @emph{See also}:
7855 @ref{ATANH}
7856 @end table
7860 @node TIME
7861 @section @code{TIME} --- Time function
7862 @findex @code{TIME} intrinsic
7863 @cindex time functions
7865 Intrinsic implemented, documentation pending.
7867 @table @asis
7868 @item @emph{Description}:
7869 @item @emph{Standard}:
7870 GNU extension
7872 @item @emph{Class}:
7873 Non-elemental function
7875 @item @emph{Syntax}:
7876 @item @emph{Arguments}:
7877 @item @emph{Return value}:
7878 @item @emph{Example}:
7879 @item @emph{See also}:
7880 @end table
7884 @node TINY
7885 @section @code{TINY} --- Smallest positive number of a real kind
7886 @findex @code{TINY} intrinsic
7887 @cindex tiny
7889 @table @asis
7890 @item @emph{Description}:
7891 @code{TINY(X)} returns the smallest positive (non zero) number
7892 in the model of the type of @code{X}.
7894 @item @emph{Standard}:
7895 F95 and later
7897 @item @emph{Class}:
7898 Elemental function
7900 @item @emph{Syntax}:
7901 @code{Y = TINY(X)}
7903 @item @emph{Arguments}:
7904 @multitable @columnfractions .15 .80
7905 @item @var{X} @tab shall be of type @code{REAL}.
7906 @end multitable
7908 @item @emph{Return value}:
7909 The return value is of the same type and kind as @var{X}
7911 @item @emph{Example}:
7912 See @code{HUGE} for an example.
7913 @end table
7917 @node TRANSFER
7918 @section @code{TRANSFER} --- Transfer bit patterns
7919 @findex @code{TRANSFER} intrinsic
7920 @cindex bit manipulation
7922 Intrinsic implemented, documentation pending.
7924 @table @asis
7925 @item @emph{Description}:
7926 @item @emph{Standard}:
7927 F95 and later
7929 @item @emph{Class}:
7930 Transformational function
7932 @item @emph{Syntax}:
7933 @item @emph{Arguments}:
7934 @item @emph{Return value}:
7935 @item @emph{Example}:
7936 @item @emph{See also}:
7937 @end table
7942 @node TRANSPOSE
7943 @section @code{TRANSPOSE} --- Transpose an array of rank two
7944 @findex @code{TRANSPOSE} intrinsic
7945 @cindex matrix manipulation
7947 Intrinsic implemented, documentation pending.
7949 @table @asis
7950 @item @emph{Description}:
7951 @item @emph{Standard}:
7952 F95 and later
7954 @item @emph{Class}:
7955 Transformational function
7957 @item @emph{Syntax}:
7958 @item @emph{Arguments}:
7959 @item @emph{Return value}:
7960 @item @emph{Example}:
7961 @item @emph{See also}:
7962 @end table
7967 @node TRIM
7968 @section @code{TRIM} --- Function to remove trailing blank characters of a string
7969 @findex @code{TRIM} intrinsic
7970 @cindex string manipulation
7972 Intrinsic implemented, documentation pending.
7974 @table @asis
7975 @item @emph{Description}:
7976 @item @emph{Standard}:
7977 F95 and later
7979 @item @emph{Class}:
7980 Transformational function
7982 @item @emph{Syntax}:
7983 @item @emph{Arguments}:
7984 @item @emph{Return value}:
7985 @item @emph{Example}:
7986 @item @emph{See also}:
7987 @end table
7992 @node UBOUND
7993 @section @code{UBOUND} --- Upper dimension bounds of an array
7994 @findex @code{UBOUND} intrinsic
7995 @cindex undocumented intrinsic 
7997 Intrinsic implemented, documentation pending.
7999 @table @asis
8000 @item @emph{Description}:
8002 @item @emph{Standard}:
8003 F95 and later
8005 @item @emph{Class}:
8006 Inquiry function
8008 @item @emph{Syntax}:
8009 @item @emph{Arguments}:
8010 @item @emph{Return value}:
8011 @item @emph{Example}:
8012 @item @emph{Specific names}:
8014 @item @emph{See also}:
8015 @ref{LBOUND}
8016 @end table
8021 @node UMASK
8022 @section @code{UMASK} --- Set the file creation mask
8023 @findex @code{UMASK} intrinsic
8024 @cindex file system operations
8026 Intrinsic implemented, documentation pending.
8028 @table @asis
8029 @item @emph{Description}:
8030 @item @emph{Standard}:
8031 GNU extension
8033 @item @emph{Class}:
8034 Subroutine
8036 @item @emph{Syntax}:
8037 @item @emph{Arguments}:
8038 @item @emph{Return value}:
8039 @item @emph{Example}:
8040 @item @emph{Specific names}:
8041 @item @emph{See also}:
8042 @end table
8047 @node UNLINK
8048 @section @code{UNLINK} --- Remove a file from the file system
8049 @findex @code{UNLINK} intrinsic
8050 @cindex file system operations
8052 Intrinsic implemented, documentation pending.
8054 @table @asis
8055 @item @emph{Description}:
8056 @item @emph{Standard}:
8057 GNU extension
8059 @item @emph{Class}:
8060 Subroutine
8062 @item @emph{Syntax}:
8063 @item @emph{Arguments}:
8064 @item @emph{Return value}:
8065 @item @emph{Example}:
8067 @item @emph{See also}:
8068 @ref{LINK}
8069 @end table
8074 @node UNMASK
8075 @section @code{UNMASK} --- (?)
8076 @findex @code{UNMASK} intrinsic
8077 @cindex undocumented intrinsic 
8079 Intrinsic implemented, documentation pending.
8081 @table @asis
8082 @item @emph{Description}:
8083 @item @emph{Standard}:
8084 @item @emph{Class}:
8085 @item @emph{Syntax}:
8086 @item @emph{Arguments}:
8087 @item @emph{Return value}:
8088 @item @emph{Example}:
8089 @item @emph{Specific names}:
8090 @item @emph{See also}:
8091 @end table
8096 @node UNPACK
8097 @section @code{UNPACK} --- Unpack an array of rank one into an array
8098 @findex @code{UNPACK} intrinsic
8099 @cindex array manipulation
8101 Intrinsic implemented, documentation pending.
8103 @table @asis
8104 @item @emph{Description}:
8105 @item @emph{Standard}:
8106 F95 and later
8108 @item @emph{Class}:
8109 Transformational function
8111 @item @emph{Syntax}:
8112 @item @emph{Arguments}:
8113 @item @emph{Return value}:
8114 @item @emph{Example}:
8116 @item @emph{See also}:
8117 @ref{PACK}
8118 @end table
8123 @node VERIFY
8124 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
8125 @findex @code{VERIFY} intrinsic
8126 @cindex string manipulation
8128 Intrinsic implemented, documentation pending.
8130 @table @asis
8131 @item @emph{Description}:
8132 @item @emph{Standard}:
8133 F95 and later
8135 @item @emph{Class}:
8136 Elemental function
8138 @item @emph{Syntax}:
8139 @item @emph{Arguments}:
8140 @item @emph{Return value}:
8141 @item @emph{Example}:
8142 @item @emph{Specific names}:
8143 @item @emph{See also}:
8144 @end table
8147 @node XOR
8148 @section @code{XOR} --- Bitwise logical exclusive OR
8149 @findex @code{XOR} intrinsic
8150 @cindex bit operations
8152 @table @asis
8153 @item @emph{Description}:
8154 Bitwise logical exclusive or. 
8156 This intrinsic routine is provided for backwards compatibility with 
8157 GNU Fortran 77.  For integer arguments, programmers should consider
8158 the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
8160 @item @emph{Standard}:
8161 GNU extension
8163 @item @emph{Class}:
8164 Non-elemental function
8166 @item @emph{Syntax}:
8167 @code{RESULT = XOR(X, Y)}
8169 @item @emph{Arguments}:
8170 @multitable @columnfractions .15 .80
8171 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8172 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8173 @end multitable
8175 @item @emph{Return value}:
8176 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
8177 after cross-promotion of the arguments.
8179 @item @emph{Example}:
8180 @smallexample
8181 PROGRAM test_xor
8182   LOGICAL :: T = .TRUE., F = .FALSE.
8183   INTEGER :: a, b
8184   DATA a / Z,'F' /, b / Z'3' /
8186   WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
8187   WRITE (*,*) XOR(a, b)
8188 END PROGRAM
8189 @end smallexample
8191 @item @emph{See also}:
8192 F95 elemental function: @ref{IEOR}
8193 @end table