OSDN Git Service

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