OSDN Git Service

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