OSDN Git Service

PR c/29955
[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
1914 This intrinsic is provided in both subroutine and function forms; however,
1915 only one form can be used in any given program unit.
1916
1917 @item @emph{Standard}:
1918 GNU extension
1919
1920 @item @emph{Class}:
1921 Subroutine, non-elemental function
1922
1923 @item @emph{Syntax}:
1924 @multitable @columnfractions .80
1925 @item @code{CALL CHMOD(NAME, MODE[, STATUS])}
1926 @item @code{STATUS = CHMOD(NAME, MODE)}
1927 @end multitable
1928
1929 @item @emph{Arguments}:
1930 @multitable @columnfractions .15 .80
1931 @item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
1932 Trailing blanks are ignored unless the character @code{achar(0)} is
1933 present, then all characters up to and excluding @code{achar(0)} are
1934 used as the file name.
1935
1936 @item @var{MODE} @tab Scalar @code{CHARACTER} giving the file permission.
1937 @var{MODE} uses the same syntax as the @var{MODE} argument of
1938 @code{/bin/chmod}.
1939
1940 @item @var{STATUS} @tab (optional) scalar @code{INTEGER}, which is
1941 @code{0} on success and non-zero otherwise.
1942 @end multitable
1943
1944 @item @emph{Return value}:
1945 In either syntax, @var{STATUS} is set to @code{0} on success and non-zero
1946 otherwise.
1947
1948 @item @emph{Example}:
1949 @code{CHMOD} as subroutine
1950 @smallexample
1951 program chmod_test
1952   implicit none
1953   integer :: status
1954   call chmod('test.dat','u+x',status)
1955   print *, 'Status: ', status
1956 end program chmod_test
1957 @end smallexample
1958 @code{CHMOD} as non-elemental function:
1959 @smallexample
1960 program chmod_test
1961   implicit none
1962   integer :: status
1963   status = chmod('test.dat','u+x')
1964   print *, 'Status: ', status
1965 end program chmod_test
1966 @end smallexample
1967 @item @emph{Specific names}:
1968 @item @emph{See also}:
1969
1970 @end table
1971
1972
1973 @node CMPLX
1974 @section @code{CMPLX} --- Complex conversion function
1975 @findex @code{CMPLX} intrinsic
1976 @cindex CMPLX
1977
1978 @table @asis
1979 @item @emph{Description}:
1980 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1981 the real component.  If @var{Y} is present it is converted to the imaginary
1982 component.  If @var{Y} is not present then the imaginary component is set to
1983 0.0.  If @var{X} is complex then @var{Y} must not be present.
1984
1985 @item @emph{Standard}:
1986 F77 and later
1987
1988 @item @emph{Class}:
1989 Elemental function
1990
1991 @item @emph{Syntax}:
1992 @code{C = CMPLX(X[,Y[,KIND]])}
1993
1994 @item @emph{Arguments}:
1995 @multitable @columnfractions .15 .80
1996 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1997 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}.  May be @code{INTEGER(*)} or @code{REAL(*)}. 
1998 @item @var{KIND} @tab Optional scaler integer initialization expression.
1999 @end multitable
2000
2001 @item @emph{Return value}:
2002 The return value is of type @code{COMPLEX(*)}
2003
2004 @item @emph{Example}:
2005 @smallexample
2006 program test_cmplx
2007     integer :: i = 42
2008     real :: x = 3.14
2009     complex :: z
2010     z = cmplx(i, x)
2011     print *, z, cmplx(x)
2012 end program test_cmplx
2013 @end smallexample
2014 @end table
2015
2016
2017
2018 @node COMMAND_ARGUMENT_COUNT
2019 @section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
2020 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
2021 @cindex command line arguments
2022 @cindex getopt
2023
2024 @table @asis
2025 @item @emph{Description}:
2026 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
2027 command line when the containing program was invoked.
2028
2029 @item @emph{Standard}:
2030 F2003
2031
2032 @item @emph{Class}:
2033 Inquiry function
2034
2035 @item @emph{Syntax}:
2036 @code{I = COMMAND_ARGUMENT_COUNT()}
2037
2038 @item @emph{Arguments}:
2039 @multitable @columnfractions .15 .80
2040 @item None
2041 @end multitable
2042
2043 @item @emph{Return value}:
2044 The return value is of type @code{INTEGER(4)}
2045
2046 @item @emph{Example}:
2047 @smallexample
2048 program test_command_argument_count
2049     integer :: count
2050     count = command_argument_count()
2051     print *, count
2052 end program test_command_argument_count
2053 @end smallexample
2054
2055 @item @emph{See also}:
2056 @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
2057 @end table
2058
2059 @node CONJG
2060 @section @code{CONJG} --- Complex conjugate function 
2061 @findex @code{CONJG} intrinsic
2062 @findex @code{DCONJG} intrinsic
2063 @cindex complex conjugate
2064 @table @asis
2065 @item @emph{Description}:
2066 @code{CONJG(Z)} returns the conjugate of @var{Z}.  If @var{Z} is @code{(x, y)}
2067 then the result is @code{(x, -y)}
2068
2069 @item @emph{Standard}:
2070 F77 and later, has overloads that are GNU extensions
2071
2072 @item @emph{Class}:
2073 Elemental function
2074
2075 @item @emph{Syntax}:
2076 @code{Z = CONJG(Z)}
2077
2078 @item @emph{Arguments}:
2079 @multitable @columnfractions .15 .80
2080 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2081 @end multitable
2082
2083 @item @emph{Return value}:
2084 The return value is of type @code{COMPLEX(*)}.
2085
2086 @item @emph{Example}:
2087 @smallexample
2088 program test_conjg
2089     complex :: z = (2.0, 3.0)
2090     complex(8) :: dz = (2.71_8, -3.14_8)
2091     z= conjg(z)
2092     print *, z
2093     dz = dconjg(dz)
2094     print *, dz
2095 end program test_conjg
2096 @end smallexample
2097
2098 @item @emph{Specific names}:
2099 @multitable @columnfractions .20 .20 .20 .40
2100 @item Name             @tab Argument             @tab Return type          @tab Standard
2101 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z}  @tab @code{COMPLEX(8)}    @tab GNU extension
2102 @end multitable
2103 @end table
2104
2105
2106
2107 @node COS
2108 @section @code{COS} --- Cosine function 
2109 @findex @code{COS} intrinsic
2110 @findex @code{DCOS} intrinsic
2111 @findex @code{ZCOS} intrinsic
2112 @findex @code{CDCOS} intrinsic
2113 @cindex trigonometric functions
2114
2115 @table @asis
2116 @item @emph{Description}:
2117 @code{COS(X)} computes the cosine of @var{X}.
2118
2119 @item @emph{Standard}:
2120 F77 and later, has overloads that are GNU extensions
2121
2122 @item @emph{Class}:
2123 Elemental function
2124
2125 @item @emph{Syntax}:
2126 @code{X = COS(X)}
2127
2128 @item @emph{Arguments}:
2129 @multitable @columnfractions .15 .80
2130 @item @var{X} @tab The type shall be @code{REAL(*)} or
2131 @code{COMPLEX(*)}.
2132 @end multitable
2133
2134 @item @emph{Return value}:
2135 The return value is of type @code{REAL(*)} and it lies in the
2136 range @math{ -1 \leq \cos (x) \leq 1}.  The kind type
2137 parameter is the same as @var{X}.
2138
2139 @item @emph{Example}:
2140 @smallexample
2141 program test_cos
2142   real :: x = 0.0
2143   x = cos(x)
2144 end program test_cos
2145 @end smallexample
2146
2147 @item @emph{Specific names}:
2148 @multitable @columnfractions .20 .20 .20 .40
2149 @item Name            @tab Argument            @tab Return type       @tab Standard
2150 @item @code{DCOS(X)}  @tab @code{REAL(8) X}    @tab @code{REAL(8)}    @tab F77 and later
2151 @item @code{CCOS(X)}  @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2152 @item @code{ZCOS(X)}  @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2153 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2154 @end multitable
2155
2156 @item @emph{See also}:
2157 Inverse function: @ref{ACOS}
2158
2159 @end table
2160
2161
2162
2163 @node COSH
2164 @section @code{COSH} --- Hyperbolic cosine function 
2165 @findex @code{COSH} intrinsic
2166 @findex @code{DCOSH} intrinsic
2167 @cindex hyperbolic cosine
2168
2169 @table @asis
2170 @item @emph{Description}:
2171 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2172
2173 @item @emph{Standard}:
2174 F77 and later
2175
2176 @item @emph{Class}:
2177 Elemental function
2178
2179 @item @emph{Syntax}:
2180 @code{X = COSH(X)}
2181
2182 @item @emph{Arguments}:
2183 @multitable @columnfractions .15 .80
2184 @item @var{X} @tab The type shall be @code{REAL(*)}.
2185 @end multitable
2186
2187 @item @emph{Return value}:
2188 The return value is of type @code{REAL(*)} and it is positive
2189 (@math{ \cosh (x) \geq 0 }.
2190
2191 @item @emph{Example}:
2192 @smallexample
2193 program test_cosh
2194   real(8) :: x = 1.0_8
2195   x = cosh(x)
2196 end program test_cosh
2197 @end smallexample
2198
2199 @item @emph{Specific names}:
2200 @multitable @columnfractions .20 .20 .20 .40
2201 @item Name            @tab Argument          @tab Return type       @tab Standard
2202 @item @code{DCOSH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F77 and later
2203 @end multitable
2204
2205 @item @emph{See also}:
2206 Inverse function: @ref{ACOSH}
2207
2208 @end table
2209
2210
2211
2212 @node COUNT
2213 @section @code{COUNT} --- Count function
2214 @findex @code{COUNT} intrinsic
2215 @cindex count
2216
2217 @table @asis
2218 @item @emph{Description}:
2219 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2220 @var{MASK} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
2221 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
2222 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2223
2224 @item @emph{Standard}:
2225 F95 and later
2226
2227 @item @emph{Class}:
2228 transformational function
2229
2230 @item @emph{Syntax}:
2231 @code{I = COUNT(MASK[,DIM])}
2232
2233 @item @emph{Arguments}:
2234 @multitable @columnfractions .15 .80
2235 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2236 @item @var{DIM}  @tab The type shall be @code{INTEGER}.
2237 @end multitable
2238
2239 @item @emph{Return value}:
2240 The return value is of type @code{INTEGER} with rank equal to that of
2241 @var{MASK}.
2242
2243 @item @emph{Example}:
2244 @smallexample
2245 program test_count
2246     integer, dimension(2,3) :: a, b
2247     logical, dimension(2,3) :: mask
2248     a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2249     b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2250     print '(3i3)', a(1,:)
2251     print '(3i3)', a(2,:)
2252     print *
2253     print '(3i3)', b(1,:)
2254     print '(3i3)', b(2,:)
2255     print *
2256     mask = a.ne.b
2257     print '(3l3)', mask(1,:)
2258     print '(3l3)', mask(2,:)
2259     print *
2260     print '(3i3)', count(mask)
2261     print *
2262     print '(3i3)', count(mask, 1)
2263     print *
2264     print '(3i3)', count(mask, 2)
2265 end program test_count
2266 @end smallexample
2267 @end table
2268
2269
2270
2271 @node CPU_TIME
2272 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2273 @findex @code{CPU_TIME} intrinsic
2274 @cindex CPU_TIME
2275
2276 @table @asis
2277 @item @emph{Description}:
2278 Returns a @code{REAL} value representing the elapsed CPU time in seconds.  This
2279 is useful for testing segments of code to determine execution time.
2280
2281 @item @emph{Standard}:
2282 F95 and later
2283
2284 @item @emph{Class}:
2285 Subroutine
2286
2287 @item @emph{Syntax}:
2288 @code{CPU_TIME(X)}
2289
2290 @item @emph{Arguments}:
2291 @multitable @columnfractions .15 .80
2292 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2293 @end multitable
2294
2295 @item @emph{Return value}:
2296 None
2297
2298 @item @emph{Example}:
2299 @smallexample
2300 program test_cpu_time
2301     real :: start, finish
2302     call cpu_time(start)
2303         ! put code to test here
2304     call cpu_time(finish)
2305     print '("Time = ",f6.3," seconds.")',finish-start
2306 end program test_cpu_time
2307 @end smallexample
2308 @end table
2309
2310
2311
2312 @node CSHIFT
2313 @section @code{CSHIFT} --- Circular shift function
2314 @findex @code{CSHIFT} intrinsic
2315 @cindex bit manipulation
2316
2317 @table @asis
2318 @item @emph{Description}:
2319 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2320 @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
2321 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
2322 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2323 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2324 by @var{SHIFT} places.  If rank is greater than one, then all complete rank one
2325 sections of @var{ARRAY} along the given dimension are shifted.  Elements
2326 shifted out one end of each rank one section are shifted back in the other end.
2327
2328 @item @emph{Standard}:
2329 F95 and later
2330
2331 @item @emph{Class}:
2332 transformational function
2333
2334 @item @emph{Syntax}:
2335 @code{A = CSHIFT(A, SHIFT[,DIM])}
2336
2337 @item @emph{Arguments}:
2338 @multitable @columnfractions .15 .80
2339 @item @var{ARRAY}  @tab May be any type, not scaler.
2340 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2341 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2342 @end multitable
2343
2344 @item @emph{Return value}:
2345 Returns an array of same type and rank as the @var{ARRAY} argument.
2346
2347 @item @emph{Example}:
2348 @smallexample
2349 program test_cshift
2350     integer, dimension(3,3) :: a
2351     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2352     print '(3i3)', a(1,:)
2353     print '(3i3)', a(2,:)
2354     print '(3i3)', a(3,:)    
2355     a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2356     print *
2357     print '(3i3)', a(1,:)
2358     print '(3i3)', a(2,:)
2359     print '(3i3)', a(3,:)
2360 end program test_cshift
2361 @end smallexample
2362 @end table
2363
2364
2365 @node CTIME
2366 @section @code{CTIME} --- Convert a time into a string
2367 @findex @code{CTIME} intrinsic
2368 @cindex ctime subroutine 
2369
2370 @table @asis
2371 @item @emph{Description}:
2372 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2373 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2374 1995}, and returns that string into @var{S}.
2375
2376 If @code{CTIME} is invoked as a function, it can not be invoked as a
2377 subroutine, and vice versa.
2378
2379 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2380 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2381
2382 @item @emph{Standard}:
2383 GNU extension
2384
2385 @item @emph{Class}:
2386 Subroutine
2387
2388 @item @emph{Syntax}:
2389 @multitable @columnfractions .80
2390 @item @code{CALL CTIME(T,S)}.
2391 @item @code{S = CTIME(T)}, (not recommended).
2392 @end multitable
2393
2394 @item @emph{Arguments}:
2395 @multitable @columnfractions .15 .80
2396 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2397 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2398 @end multitable
2399
2400 @item @emph{Return value}:
2401 The converted date and time as a string.
2402
2403 @item @emph{Example}:
2404 @smallexample
2405 program test_ctime
2406     integer(8) :: i
2407     character(len=30) :: date
2408     i = time8()
2409
2410     ! Do something, main part of the program
2411     
2412     call ctime(i,date)
2413     print *, 'Program was started on ', date
2414 end program test_ctime
2415 @end smallexample
2416 @end table
2417
2418 @node DATE_AND_TIME
2419 @section @code{DATE_AND_TIME} --- Date and time subroutine
2420 @findex @code{DATE_AND_TIME} intrinsic
2421 @cindex DATE_AND_TIME
2422
2423 @table @asis
2424 @item @emph{Description}:
2425 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2426 time information from the real-time system clock.  @var{DATE} is
2427 @code{INTENT(OUT)} and has form ccyymmdd.  @var{TIME} is @code{INTENT(OUT)} and
2428 has form hhmmss.sss.  @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2429 representing the difference with respect to Coordinated Universal Time (UTC).
2430 Unavailable time and date parameters return blanks.
2431
2432 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2433
2434 @multitable @columnfractions .15 .30 .60
2435 @item @tab @code{VALUE(1)}: @tab The year
2436 @item @tab @code{VALUE(2)}: @tab The month
2437 @item @tab @code{VALUE(3)}: @tab The day of the month
2438 @item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
2439 @item @tab @code{VALUE(5)}: @tab The hour of the day
2440 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2441 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2442 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2443 @end multitable     
2444
2445 @item @emph{Standard}:
2446 F95 and later
2447
2448 @item @emph{Class}:
2449 Subroutine
2450
2451 @item @emph{Syntax}:
2452 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2453
2454 @item @emph{Arguments}:
2455 @multitable @columnfractions .15 .80
2456 @item @var{DATE}  @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2457 @item @var{TIME}  @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2458 @item @var{ZONE}  @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2459 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2460 @end multitable
2461
2462 @item @emph{Return value}:
2463 None
2464
2465 @item @emph{Example}:
2466 @smallexample
2467 program test_time_and_date
2468     character(8)  :: date
2469     character(10) :: time
2470     character(5)  :: zone
2471     integer,dimension(8) :: values
2472     ! using keyword arguments
2473     call date_and_time(date,time,zone,values)
2474     call date_and_time(DATE=date,ZONE=zone)
2475     call date_and_time(TIME=time)
2476     call date_and_time(VALUES=values)
2477     print '(a,2x,a,2x,a)', date, time, zone
2478     print '(8i5))', values
2479 end program test_time_and_date
2480 @end smallexample
2481 @end table
2482
2483
2484
2485 @node DBLE
2486 @section @code{DBLE} --- Double conversion function 
2487 @findex @code{DBLE} intrinsic
2488 @cindex double conversion
2489
2490 @table @asis
2491 @item @emph{Description}:
2492 @code{DBLE(X)} Converts @var{X} to double precision real type.
2493
2494 @item @emph{Standard}:
2495 F77 and later
2496
2497 @item @emph{Class}:
2498 Elemental function
2499
2500 @item @emph{Syntax}:
2501 @code{X = DBLE(X)}
2502
2503 @item @emph{Arguments}:
2504 @multitable @columnfractions .15 .80
2505 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2506 @end multitable
2507
2508 @item @emph{Return value}:
2509 The return value is of type double precision real.
2510
2511 @item @emph{Example}:
2512 @smallexample
2513 program test_dble
2514     real    :: x = 2.18
2515     integer :: i = 5
2516     complex :: z = (2.3,1.14)
2517     print *, dble(x), dble(i), dble(z)
2518 end program test_dble
2519 @end smallexample
2520
2521 @item @emph{See also}:
2522 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2523 @end table
2524
2525
2526
2527 @node DCMPLX
2528 @section @code{DCMPLX} --- Double complex conversion function
2529 @findex @code{DCMPLX} intrinsic
2530 @cindex DCMPLX
2531
2532 @table @asis
2533 @item @emph{Description}:
2534 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2535 converted to the real component.  If @var{Y} is present it is converted to the
2536 imaginary component.  If @var{Y} is not present then the imaginary component is
2537 set to 0.0.  If @var{X} is complex then @var{Y} must not be present.
2538
2539 @item @emph{Standard}:
2540 GNU extension
2541
2542 @item @emph{Class}:
2543 Elemental function
2544
2545 @item @emph{Syntax}:
2546 @code{C = DCMPLX(X)}
2547 @code{C = DCMPLX(X,Y)}
2548
2549 @item @emph{Arguments}:
2550 @multitable @columnfractions .15 .80
2551 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
2552 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}. 
2553 @end multitable
2554
2555 @item @emph{Return value}:
2556 The return value is of type @code{COMPLEX(8)}
2557
2558 @item @emph{Example}:
2559 @smallexample
2560 program test_dcmplx
2561     integer :: i = 42
2562     real :: x = 3.14
2563     complex :: z
2564     z = cmplx(i, x)
2565     print *, dcmplx(i)
2566     print *, dcmplx(x)
2567     print *, dcmplx(z)
2568     print *, dcmplx(x,i)
2569 end program test_dcmplx
2570 @end smallexample
2571 @end table
2572
2573
2574
2575 @node DFLOAT
2576 @section @code{DFLOAT} --- Double conversion function 
2577 @findex @code{DFLOAT} intrinsic
2578 @cindex double float conversion
2579
2580 @table @asis
2581 @item @emph{Description}:
2582 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2583
2584 @item @emph{Standard}:
2585 GNU extension
2586
2587 @item @emph{Class}:
2588 Elemental function
2589
2590 @item @emph{Syntax}:
2591 @code{X = DFLOAT(X)}
2592
2593 @item @emph{Arguments}:
2594 @multitable @columnfractions .15 .80
2595 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2596 @end multitable
2597
2598 @item @emph{Return value}:
2599 The return value is of type double precision real.
2600
2601 @item @emph{Example}:
2602 @smallexample
2603 program test_dfloat
2604     integer :: i = 5
2605     print *, dfloat(i)
2606 end program test_dfloat
2607 @end smallexample
2608
2609 @item @emph{See also}:
2610 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2611 @end table
2612
2613
2614
2615 @node DIGITS
2616 @section @code{DIGITS} --- Significant digits function
2617 @findex @code{DIGITS} intrinsic
2618 @cindex digits, significant
2619
2620 @table @asis
2621 @item @emph{Description}:
2622 @code{DIGITS(X)} returns the number of significant digits of the internal model
2623 representation of @var{X}.  For example, on a system using a 32-bit
2624 floating point representation, a default real number would likely return 24.
2625
2626 @item @emph{Standard}:
2627 F95 and later
2628
2629 @item @emph{Class}:
2630 Inquiry function
2631
2632 @item @emph{Syntax}:
2633 @code{C = DIGITS(X)}
2634
2635 @item @emph{Arguments}:
2636 @multitable @columnfractions .15 .80
2637 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2638 @end multitable
2639
2640 @item @emph{Return value}:
2641 The return value is of type @code{INTEGER}.
2642
2643 @item @emph{Example}:
2644 @smallexample
2645 program test_digits
2646     integer :: i = 12345
2647     real :: x = 3.143
2648     real(8) :: y = 2.33
2649     print *, digits(i)
2650     print *, digits(x)
2651     print *, digits(y)
2652 end program test_digits
2653 @end smallexample
2654 @end table
2655
2656
2657
2658 @node DIM
2659 @section @code{DIM} --- Dim function
2660 @findex @code{DIM} intrinsic
2661 @findex @code{IDIM} intrinsic
2662 @findex @code{DDIM} intrinsic
2663 @cindex dim
2664
2665 @table @asis
2666 @item @emph{Description}:
2667 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2668 otherwise returns zero.
2669
2670 @item @emph{Standard}:
2671 F77 and later
2672
2673 @item @emph{Class}:
2674 Elemental function
2675
2676 @item @emph{Syntax}:
2677 @code{X = DIM(X,Y)}
2678
2679 @item @emph{Arguments}:
2680 @multitable @columnfractions .15 .80
2681 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2682 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2683 @end multitable
2684
2685 @item @emph{Return value}:
2686 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2687
2688 @item @emph{Example}:
2689 @smallexample
2690 program test_dim
2691     integer :: i
2692     real(8) :: x
2693     i = dim(4, 15)
2694     x = dim(4.345_8, 2.111_8)
2695     print *, i
2696     print *, x
2697 end program test_dim
2698 @end smallexample
2699
2700 @item @emph{Specific names}:
2701 @multitable @columnfractions .20 .20 .20 .40
2702 @item Name             @tab Argument              @tab Return type       @tab Standard
2703 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2704 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y}    @tab @code{REAL(8)}    @tab F77 and later
2705 @end multitable
2706 @end table
2707
2708
2709
2710 @node DOT_PRODUCT
2711 @section @code{DOT_PRODUCT} --- Dot product function
2712 @findex @code{DOT_PRODUCT} intrinsic
2713 @cindex Dot product
2714
2715 @table @asis
2716 @item @emph{Description}:
2717 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2718 @var{X} and @var{Y}.  The two vectors may be either numeric or logical
2719 and must be arrays of rank one and of equal size. If the vectors are
2720 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2721 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the 
2722 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2723
2724 @item @emph{Standard}:
2725 F95 and later
2726
2727 @item @emph{Class}:
2728 transformational function
2729
2730 @item @emph{Syntax}:
2731 @code{S = DOT_PRODUCT(X,Y)}
2732
2733 @item @emph{Arguments}:
2734 @multitable @columnfractions .15 .80
2735 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2736 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2737 @end multitable
2738
2739 @item @emph{Return value}:
2740 If the arguments are numeric, the return value is a scaler of numeric type,
2741 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.  If the arguments are
2742 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2743
2744 @item @emph{Example}:
2745 @smallexample
2746 program test_dot_prod
2747     integer, dimension(3) :: a, b
2748     a = (/ 1, 2, 3 /)
2749     b = (/ 4, 5, 6 /)
2750     print '(3i3)', a
2751     print *
2752     print '(3i3)', b
2753     print *
2754     print *, dot_product(a,b)
2755 end program test_dot_prod
2756 @end smallexample
2757 @end table
2758
2759
2760
2761 @node DPROD
2762 @section @code{DPROD} --- Double product function
2763 @findex @code{DPROD} intrinsic
2764 @cindex Double product
2765
2766 @table @asis
2767 @item @emph{Description}:
2768 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2769
2770 @item @emph{Standard}:
2771 F77 and later
2772
2773 @item @emph{Class}:
2774 Elemental function
2775
2776 @item @emph{Syntax}:
2777 @code{D = DPROD(X,Y)}
2778
2779 @item @emph{Arguments}:
2780 @multitable @columnfractions .15 .80
2781 @item @var{X} @tab The type shall be @code{REAL}.
2782 @item @var{Y} @tab The type shall be @code{REAL}.
2783 @end multitable
2784
2785 @item @emph{Return value}:
2786 The return value is of type @code{REAL(8)}.
2787
2788 @item @emph{Example}:
2789 @smallexample
2790 program test_dprod
2791     integer :: i
2792     real :: x = 5.2
2793     real :: y = 2.3
2794     real(8) :: d
2795     d = dprod(x,y)
2796     print *, d
2797 end program test_dprod
2798 @end smallexample
2799 @end table
2800
2801
2802
2803 @node DREAL
2804 @section @code{DREAL} --- Double real part function
2805 @findex @code{DREAL} intrinsic
2806 @cindex Double real part
2807
2808 @table @asis
2809 @item @emph{Description}:
2810 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2811
2812 @item @emph{Standard}:
2813 GNU extension
2814
2815 @item @emph{Class}:
2816 Elemental function
2817
2818 @item @emph{Syntax}:
2819 @code{D = DREAL(Z)}
2820
2821 @item @emph{Arguments}:
2822 @multitable @columnfractions .15 .80
2823 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2824 @end multitable
2825
2826 @item @emph{Return value}:
2827 The return value is of type @code{REAL(8)}.
2828
2829 @item @emph{Example}:
2830 @smallexample
2831 program test_dreal
2832     complex(8) :: z = (1.3_8,7.2_8)
2833     print *, dreal(z)
2834 end program test_dreal
2835 @end smallexample
2836
2837 @item @emph{See also}:
2838 @ref{AIMAG}
2839
2840 @end table
2841
2842
2843
2844 @node DTIME
2845 @section @code{DTIME} --- Execution time subroutine (or function)
2846 @findex @code{DTIME} intrinsic
2847 @cindex dtime subroutine 
2848
2849 @table @asis
2850 @item @emph{Description}:
2851 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2852 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
2853 returns the user and system components of this time in @code{TARRAY(1)} and
2854 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2855 TARRAY(2)}.
2856
2857 Subsequent invocations of @code{DTIME} return values accumulated since the
2858 previous invocation.
2859
2860 On some systems, the underlying timings are represented using types with
2861 sufficiently small limits that overflows (wrap around) are possible, such as
2862 32-bit types. Therefore, the values returned by this intrinsic might be, or
2863 become, negative, or numerically less than previous values, during a single
2864 run of the compiled program.
2865
2866 If @code{DTIME} is invoked as a function, it can not be invoked as a
2867 subroutine, and vice versa.
2868
2869 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2870
2871 @multitable @columnfractions .15 .30 .60
2872 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2873 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2874 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2875 @end multitable
2876
2877 @item @emph{Standard}:
2878 GNU extension
2879
2880 @item @emph{Class}:
2881 Subroutine
2882
2883 @item @emph{Syntax}:
2884 @multitable @columnfractions .80
2885 @item @code{CALL DTIME(TARRAY, RESULT)}.
2886 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2887 @end multitable
2888
2889 @item @emph{Arguments}:
2890 @multitable @columnfractions .15 .80
2891 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2892 @item @var{RESULT}@tab The type shall be @code{REAL}.
2893 @end multitable
2894
2895 @item @emph{Return value}:
2896 Elapsed time in seconds since the start of program execution.
2897
2898 @item @emph{Example}:
2899 @smallexample
2900 program test_dtime
2901     integer(8) :: i, j
2902     real, dimension(2) :: tarray
2903     real :: result
2904     call dtime(tarray, result)
2905     print *, result
2906     print *, tarray(1)
2907     print *, tarray(2)   
2908     do i=1,100000000    ! Just a delay
2909         j = i * i - i
2910     end do
2911     call dtime(tarray, result)
2912     print *, result
2913     print *, tarray(1)
2914     print *, tarray(2)
2915 end program test_dtime
2916 @end smallexample
2917 @end table
2918
2919
2920
2921 @node EOSHIFT
2922 @section @code{EOSHIFT} --- End-off shift function
2923 @findex @code{EOSHIFT} intrinsic
2924 @cindex bit manipulation
2925
2926 @table @asis
2927 @item @emph{Description}:
2928 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2929 elements of @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is
2930 omitted it is taken to be @code{1}.  @var{DIM} is a scaler of type
2931 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2932 rank of @var{ARRAY}.  If the rank of @var{ARRAY} is one, then all elements of
2933 @var{ARRAY} are shifted by @var{SHIFT} places.  If rank is greater than one,
2934 then all complete rank one sections of @var{ARRAY} along the given dimension are
2935 shifted.  Elements shifted out one end of each rank one section are dropped.  If
2936 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2937 is copied back in the other end.  If @var{BOUNDARY} is not present then the
2938 following are copied in depending on the type of @var{ARRAY}.
2939
2940 @multitable @columnfractions .15 .80
2941 @item @emph{Array Type} @tab @emph{Boundary Value}
2942 @item Numeric  @tab 0 of the type and kind of @var{ARRAY}.
2943 @item Logical  @tab @code{.FALSE.}.
2944 @item Character(@var{len}) @tab @var{len} blanks.
2945 @end multitable
2946
2947 @item @emph{Standard}:
2948 F95 and later
2949
2950 @item @emph{Class}:
2951 transformational function
2952
2953 @item @emph{Syntax}:
2954 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2955
2956 @item @emph{Arguments}:
2957 @multitable @columnfractions .15 .80
2958 @item @var{ARRAY}  @tab May be any type, not scaler.
2959 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2960 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}. 
2961 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2962 @end multitable
2963
2964 @item @emph{Return value}:
2965 Returns an array of same type and rank as the @var{ARRAY} argument.
2966
2967 @item @emph{Example}:
2968 @smallexample
2969 program test_eoshift
2970     integer, dimension(3,3) :: a
2971     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2972     print '(3i3)', a(1,:)
2973     print '(3i3)', a(2,:)
2974     print '(3i3)', a(3,:)    
2975     a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2976     print *
2977     print '(3i3)', a(1,:)
2978     print '(3i3)', a(2,:)
2979     print '(3i3)', a(3,:)
2980 end program test_eoshift
2981 @end smallexample
2982 @end table
2983
2984
2985
2986 @node EPSILON
2987 @section @code{EPSILON} --- Epsilon function
2988 @findex @code{EPSILON} intrinsic
2989 @cindex epsilon, significant
2990
2991 @table @asis
2992 @item @emph{Description}:
2993 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2994
2995 @item @emph{Standard}:
2996 F95 and later
2997
2998 @item @emph{Class}:
2999 Inquiry function
3000
3001 @item @emph{Syntax}:
3002 @code{C = EPSILON(X)}
3003
3004 @item @emph{Arguments}:
3005 @multitable @columnfractions .15 .80
3006 @item @var{X} @tab The type shall be @code{REAL(*)}.
3007 @end multitable
3008
3009 @item @emph{Return value}:
3010 The return value is of same type as the argument.
3011
3012 @item @emph{Example}:
3013 @smallexample
3014 program test_epsilon
3015     real :: x = 3.143
3016     real(8) :: y = 2.33
3017     print *, EPSILON(x)
3018     print *, EPSILON(y)
3019 end program test_epsilon
3020 @end smallexample
3021 @end table
3022
3023
3024
3025 @node ERF
3026 @section @code{ERF} --- Error function 
3027 @findex @code{ERF} intrinsic
3028 @cindex error function
3029
3030 @table @asis
3031 @item @emph{Description}:
3032 @code{ERF(X)} computes the error function of @var{X}.
3033
3034 @item @emph{Standard}:
3035 GNU Extension
3036
3037 @item @emph{Class}:
3038 Elemental function
3039
3040 @item @emph{Syntax}:
3041 @code{X = ERF(X)}
3042
3043 @item @emph{Arguments}:
3044 @multitable @columnfractions .15 .80
3045 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3046 @end multitable
3047
3048 @item @emph{Return value}:
3049 The return value is a scalar of type @code{REAL(*)} and it is positive
3050 (@math{ - 1 \leq erf (x) \leq 1 }.
3051
3052 @item @emph{Example}:
3053 @smallexample
3054 program test_erf
3055   real(8) :: x = 0.17_8
3056   x = erf(x)
3057 end program test_erf
3058 @end smallexample
3059
3060 @item @emph{Specific names}:
3061 @multitable @columnfractions .20 .20 .20 .40
3062 @item Name            @tab Argument          @tab Return type       @tab Standard
3063 @item @code{DERF(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
3064 @end multitable
3065 @end table
3066
3067
3068
3069 @node ERFC
3070 @section @code{ERFC} --- Error function 
3071 @findex @code{ERFC} intrinsic
3072 @cindex error function
3073
3074 @table @asis
3075 @item @emph{Description}:
3076 @code{ERFC(X)} computes the complementary error function of @var{X}.
3077
3078 @item @emph{Standard}:
3079 GNU extension
3080
3081 @item @emph{Class}:
3082 Elemental function
3083
3084 @item @emph{Syntax}:
3085 @code{X = ERFC(X)}
3086
3087 @item @emph{Arguments}:
3088 @multitable @columnfractions .15 .80
3089 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3090 @end multitable
3091
3092 @item @emph{Return value}:
3093 The return value is a scalar of type @code{REAL(*)} and it is positive
3094 (@math{ 0 \leq erfc (x) \leq 2 }.
3095
3096 @item @emph{Example}:
3097 @smallexample
3098 program test_erfc
3099   real(8) :: x = 0.17_8
3100   x = erfc(x)
3101 end program test_erfc
3102 @end smallexample
3103
3104 @item @emph{Specific names}:
3105 @multitable @columnfractions .20 .20 .20 .40
3106 @item Name            @tab Argument          @tab Return type       @tab Standard
3107 @item @code{DERFC(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab GNU extension
3108 @end multitable
3109 @end table
3110
3111
3112
3113 @node ETIME
3114 @section @code{ETIME} --- Execution time subroutine (or function)
3115 @findex @code{ETIME} intrinsic
3116 @cindex time functions
3117
3118 @table @asis
3119 @item @emph{Description}:
3120 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3121 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
3122 returns the user and system components of this time in @code{TARRAY(1)} and
3123 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3124
3125 On some systems, the underlying timings are represented using types with
3126 sufficiently small limits that overflows (wrap around) are possible, such as
3127 32-bit types. Therefore, the values returned by this intrinsic might be, or
3128 become, negative, or numerically less than previous values, during a single
3129 run of the compiled program.
3130
3131 If @code{ETIME} is invoked as a function, it can not be invoked as a
3132 subroutine, and vice versa.
3133
3134 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3135
3136 @multitable @columnfractions .15 .30 .60
3137 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
3138 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
3139 @item @tab @code{RESULT}: @tab Run time since start in seconds.
3140 @end multitable
3141
3142 @item @emph{Standard}:
3143 GNU extension
3144
3145 @item @emph{Class}:
3146 Subroutine
3147
3148 @item @emph{Syntax}:
3149 @multitable @columnfractions .8
3150 @item @code{CALL ETIME(TARRAY, RESULT)}.
3151 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3152 @end multitable
3153
3154 @item @emph{Arguments}:
3155 @multitable @columnfractions .15 .80
3156 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3157 @item @var{RESULT}@tab The type shall be @code{REAL}.
3158 @end multitable
3159
3160 @item @emph{Return value}:
3161 Elapsed time in seconds since the start of program execution.
3162
3163 @item @emph{Example}:
3164 @smallexample
3165 program test_etime
3166     integer(8) :: i, j
3167     real, dimension(2) :: tarray
3168     real :: result
3169     call ETIME(tarray, result)
3170     print *, result
3171     print *, tarray(1)
3172     print *, tarray(2)   
3173     do i=1,100000000    ! Just a delay
3174         j = i * i - i
3175     end do
3176     call ETIME(tarray, result)
3177     print *, result
3178     print *, tarray(1)
3179     print *, tarray(2)
3180 end program test_etime
3181 @end smallexample
3182
3183 @item @emph{See also}:
3184 @ref{CPU_TIME}
3185
3186 @end table
3187
3188
3189
3190 @node EXIT
3191 @section @code{EXIT} --- Exit the program with status. 
3192 @findex @code{EXIT}
3193 @cindex exit
3194
3195 @table @asis
3196 @item @emph{Description}:
3197 @code{EXIT} causes immediate termination of the program with status.  If status
3198 is omitted it returns the canonical @emph{success} for the system.  All Fortran
3199 I/O units are closed. 
3200
3201 @item @emph{Standard}:
3202 GNU extension
3203
3204 @item @emph{Class}:
3205 Subroutine
3206
3207 @item @emph{Syntax}:
3208 @code{CALL EXIT([STATUS])}
3209
3210 @item @emph{Arguments}:
3211 @multitable @columnfractions .15 .80
3212 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3213 @end multitable
3214
3215 @item @emph{Return value}:
3216 @code{STATUS} is passed to the parent process on exit.
3217
3218 @item @emph{Example}:
3219 @smallexample
3220 program test_exit
3221   integer :: STATUS = 0
3222   print *, 'This program is going to exit.'
3223   call EXIT(STATUS)
3224 end program test_exit
3225 @end smallexample
3226
3227 @item @emph{See also}:
3228 @ref{ABORT}, @ref{KILL}
3229 @end table
3230
3231
3232
3233 @node EXP
3234 @section @code{EXP} --- Exponential function 
3235 @findex @code{EXP} intrinsic
3236 @findex @code{DEXP} intrinsic
3237 @findex @code{ZEXP} intrinsic
3238 @findex @code{CDEXP} intrinsic
3239 @cindex exponential
3240
3241 @table @asis
3242 @item @emph{Description}:
3243 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3244
3245 @item @emph{Standard}:
3246 F77 and later, has overloads that are GNU extensions
3247
3248 @item @emph{Class}:
3249 Elemental function
3250
3251 @item @emph{Syntax}:
3252 @code{X = EXP(X)}
3253
3254 @item @emph{Arguments}:
3255 @multitable @columnfractions .15 .80
3256 @item @var{X} @tab The type shall be @code{REAL(*)} or
3257 @code{COMPLEX(*)}.
3258 @end multitable
3259
3260 @item @emph{Return value}:
3261 The return value has same type and kind as @var{X}.
3262
3263 @item @emph{Example}:
3264 @smallexample
3265 program test_exp
3266   real :: x = 1.0
3267   x = exp(x)
3268 end program test_exp
3269 @end smallexample
3270
3271 @item @emph{Specific names}:
3272 @multitable @columnfractions .20 .20 .20 .40
3273 @item Name            @tab Argument             @tab Return type         @tab Standard
3274 @item @code{DEXP(X)}  @tab @code{REAL(8) X}     @tab @code{REAL(8)}      @tab F77 and later
3275 @item @code{CEXP(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}   @tab F77 and later
3276 @item @code{ZEXP(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}   @tab GNU extension
3277 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}   @tab GNU extension
3278 @end multitable
3279 @end table
3280
3281
3282
3283 @node EXPONENT
3284 @section @code{EXPONENT} --- Exponent function 
3285 @findex @code{EXPONENT} intrinsic
3286 @cindex exponent function
3287
3288 @table @asis
3289 @item @emph{Description}:
3290 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3291 is zero the value returned is zero. 
3292
3293 @item @emph{Standard}:
3294 F95 and later
3295
3296 @item @emph{Class}:
3297 Elemental function
3298
3299 @item @emph{Syntax}:
3300 @code{I = EXPONENT(X)}
3301
3302 @item @emph{Arguments}:
3303 @multitable @columnfractions .15 .80
3304 @item @var{X} @tab The type shall be @code{REAL(*)}.
3305 @end multitable
3306
3307 @item @emph{Return value}:
3308 The return value is of type default @code{INTEGER}.
3309
3310 @item @emph{Example}:
3311 @smallexample
3312 program test_exponent
3313   real :: x = 1.0
3314   integer :: i
3315   i = exponent(x)
3316   print *, i
3317   print *, exponent(0.0)
3318 end program test_exponent
3319 @end smallexample
3320 @end table
3321
3322
3323 @node FDATE
3324 @section @code{FDATE} --- Get the current time as a string
3325 @findex @code{FDATE} intrinsic
3326 @cindex fdate subroutine 
3327
3328 @table @asis
3329 @item @emph{Description}:
3330 @code{FDATE(DATE)} returns the current date (using the same format as
3331 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3332 TIME8())}.
3333
3334 If @code{FDATE} is invoked as a function, it can not be invoked as a
3335 subroutine, and vice versa.
3336
3337 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3338
3339 @item @emph{Standard}:
3340 GNU extension
3341
3342 @item @emph{Class}:
3343 Subroutine
3344
3345 @item @emph{Syntax}:
3346 @multitable @columnfractions .80
3347 @item @code{CALL FDATE(DATE)}.
3348 @item @code{DATE = FDATE()}, (not recommended).
3349 @end multitable
3350
3351 @item @emph{Arguments}:
3352 @multitable @columnfractions .15 .80
3353 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3354 @end multitable
3355
3356 @item @emph{Return value}:
3357 The current date and time as a string.
3358
3359 @item @emph{Example}:
3360 @smallexample
3361 program test_fdate
3362     integer(8) :: i, j
3363     character(len=30) :: date
3364     call fdate(date)
3365     print *, 'Program started on ', date
3366     do i = 1, 100000000 ! Just a delay
3367         j = i * i - i
3368     end do
3369     call fdate(date)
3370     print *, 'Program ended on ', date
3371 end program test_fdate
3372 @end smallexample
3373 @end table
3374
3375 @node FLOAT
3376
3377 @section @code{FLOAT} --- Convert integer to default real
3378 @findex @code{FLOAT} intrinsic
3379 @cindex conversion function (float)
3380
3381 @table @asis
3382 @item @emph{Description}:
3383 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3384
3385 @item @emph{Standard}:
3386 GNU extension
3387
3388 @item @emph{Class}:
3389 Elemental function
3390
3391 @item @emph{Syntax}:
3392 @code{X = FLOAT(I)}
3393
3394 @item @emph{Arguments}:
3395 @multitable @columnfractions .15 .80
3396 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3397 @end multitable
3398
3399 @item @emph{Return value}:
3400 The return value is of type default @code{REAL}
3401
3402 @item @emph{Example}:
3403 @smallexample
3404 program test_float
3405     integer :: i = 1
3406     if (float(i) /= 1.) call abort
3407 end program test_float
3408 @end smallexample
3409
3410 @item @emph{See also}:
3411 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3412 @end table
3413
3414
3415
3416 @node FGET
3417 @section @code{FGET} --- Read a single character in stream mode from stdin 
3418 @findex @code{FGET} intrinsic
3419 @cindex file operations
3420 @cindex stream operations
3421
3422 @table @asis
3423 @item @emph{Description}:
3424 Read a single character in stream mode from stdin by bypassing normal 
3425 formatted output. Stream I/O should not be mixed with normal record-oriented 
3426 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3427
3428 This intrinsic routine is provided for backwards compatibility with 
3429 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3430 Programmers should consider the use of new stream IO feature in new code 
3431 for future portability. See also @ref{Fortran 2003 status}.
3432
3433 @item @emph{Standard}:
3434 GNU extension
3435
3436 @item @emph{Class}:
3437 Non-elemental subroutine
3438
3439 @item @emph{Syntax}:
3440 @code{CALL fget(C[,STATUS])}
3441
3442 @item @emph{Arguments}:
3443 @multitable @columnfractions .15 .80
3444 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3445 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3446                         -1 on end-of-file and a system specific positive error code otherwise.
3447 @end multitable
3448
3449 @item @emph{Example}:
3450 @smallexample
3451 PROGRAM test_fget
3452   INTEGER, PARAMETER :: strlen = 100
3453   INTEGER :: status, i = 1
3454   CHARACTER(len=strlen) :: str = ""
3455
3456   WRITE (*,*) 'Enter text:'
3457   DO
3458     CALL fget(str(i:i), status)
3459     if (status /= 0 .OR. i > strlen) exit
3460     i = i + 1
3461   END DO
3462   WRITE (*,*) TRIM(str)
3463 END PROGRAM
3464 @end smallexample
3465
3466 @item @emph{See also}:
3467 @ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
3468 @end table
3469
3470
3471 @node FGETC
3472 @section @code{FGETC} --- Read a single character in stream mode
3473 @findex @code{FGETC} intrinsic
3474 @cindex file operations
3475 @cindex stream operations
3476
3477 @table @asis
3478 @item @emph{Description}:
3479 Read a single character in stream mode by bypassing normal formatted output. 
3480 Stream I/O should not be mixed with normal record-oriented (formatted or 
3481 unformatted) I/O on the same unit; the results are unpredictable.
3482
3483 This intrinsic routine is provided for backwards compatibility with 
3484 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3485 Programmers should consider the use of new stream IO feature in new code 
3486 for future portability. See also @ref{Fortran 2003 status}.
3487
3488 @item @emph{Standard}:
3489 GNU extension
3490
3491 @item @emph{Class}:
3492 Non-elemental subroutine
3493
3494 @item @emph{Syntax}:
3495 @code{CALL fgetc(UNIT,C[,STATUS])}
3496
3497 @item @emph{Arguments}:
3498 @multitable @columnfractions .15 .80
3499 @item @var{UNIT}   @tab The type shall be @code{INTEGER}.
3500 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3501 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3502                         -1 on end-of-file and a system specific positive error code otherwise.
3503 @end multitable
3504
3505 @item @emph{Example}:
3506 @smallexample
3507 PROGRAM test_fgetc
3508   INTEGER :: fd = 42, status
3509   CHARACTER :: c
3510
3511   OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3512   DO
3513     CALL fgetc(fd, c, status)
3514     IF (status /= 0) EXIT
3515     call fput(c)
3516   END DO
3517   CLOSE(UNIT=fd)
3518 END PROGRAM
3519 @end smallexample
3520
3521 @item @emph{See also}:
3522 @ref{FGET}, @ref{FPUT}, @ref{FPUTC}
3523 @end table
3524
3525
3526
3527 @node FLOOR
3528 @section @code{FLOOR} --- Integer floor function
3529 @findex @code{FLOOR} intrinsic
3530 @cindex floor
3531
3532 @table @asis
3533 @item @emph{Description}:
3534 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3535
3536 @item @emph{Standard}:
3537 F95 and later
3538
3539 @item @emph{Class}:
3540 Elemental function
3541
3542 @item @emph{Syntax}:
3543 @code{I = FLOOR(X[,KIND])}
3544
3545 @item @emph{Arguments}:
3546 @multitable @columnfractions .15 .80
3547 @item @var{X} @tab The type shall be @code{REAL(*)}.
3548 @item @var{KIND} @tab Optional scaler integer initialization expression.
3549 @end multitable
3550
3551 @item @emph{Return value}:
3552 The return value is of type @code{INTEGER(KIND)}
3553
3554 @item @emph{Example}:
3555 @smallexample
3556 program test_floor
3557     real :: x = 63.29
3558     real :: y = -63.59
3559     print *, floor(x) ! returns 63
3560     print *, floor(y) ! returns -64
3561 end program test_floor
3562 @end smallexample
3563
3564 @item @emph{See also}:
3565 @ref{CEILING}, @ref{NINT}
3566
3567 @end table
3568
3569
3570
3571 @node FLUSH
3572 @section @code{FLUSH} --- Flush I/O unit(s)
3573 @findex @code{FLUSH}
3574 @cindex flush
3575
3576 @table @asis
3577 @item @emph{Description}:
3578 Flushes Fortran unit(s) currently open for output. Without the optional
3579 argument, all units are flushed, otherwise just the unit specified.
3580
3581 @item @emph{Standard}:
3582 GNU extension
3583
3584 @item @emph{Class}:
3585 non-elemental subroutine
3586
3587 @item @emph{Syntax}:
3588 @code{CALL FLUSH(UNIT)}
3589
3590 @item @emph{Arguments}:
3591 @multitable @columnfractions .15 .80
3592 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3593 @end multitable
3594
3595 @item @emph{Note}:
3596 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3597 statement that should be preferred over the @code{FLUSH} intrinsic.
3598
3599 @end table
3600
3601
3602
3603 @node FNUM
3604 @section @code{FNUM} --- File number function
3605 @findex @code{FNUM} intrinsic
3606 @cindex fnum
3607
3608 @table @asis
3609 @item @emph{Description}:
3610 @code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
3611 open Fortran I/O unit @code{UNIT}.
3612
3613 @item @emph{Standard}:
3614 GNU extension
3615
3616 @item @emph{Class}:
3617 non-elemental function
3618
3619 @item @emph{Syntax}:
3620 @code{I = FNUM(UNIT)}
3621
3622 @item @emph{Arguments}:
3623 @multitable @columnfractions .15 .80
3624 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3625 @end multitable
3626
3627 @item @emph{Return value}:
3628 The return value is of type @code{INTEGER}
3629
3630 @item @emph{Example}:
3631 @smallexample
3632 program test_fnum
3633   integer :: i
3634   open (unit=10, status = "scratch")
3635   i = fnum(10)
3636   print *, i
3637   close (10)
3638 end program test_fnum
3639 @end smallexample
3640 @end table
3641
3642
3643
3644 @node FPUT
3645 @section @code{FPUT} --- Write a single character in stream mode to stdout 
3646 @findex @code{FPUT} intrinsic
3647 @cindex file operations
3648 @cindex stream operations
3649
3650 @table @asis
3651 @item @emph{Description}:
3652 Write a single character in stream mode to stdout by bypassing normal 
3653 formatted output. Stream I/O should not be mixed with normal record-oriented 
3654 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3655
3656 This intrinsic routine is provided for backwards compatibility with 
3657 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3658 Programmers should consider the use of new stream IO feature in new code 
3659 for future portability. See also @ref{Fortran 2003 status}.
3660
3661 @item @emph{Standard}:
3662 GNU extension
3663
3664 @item @emph{Class}:
3665 Non-elemental subroutine
3666
3667 @item @emph{Syntax}:
3668 @code{CALL fput(C[,STATUS])}
3669
3670 @item @emph{Arguments}:
3671 @multitable @columnfractions .15 .80
3672 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3673 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3674                         -1 on end-of-file and a system specific positive error code otherwise.
3675 @end multitable
3676
3677 @item @emph{Example}:
3678 @smallexample
3679 PROGRAM test_fput
3680   CHARACTER(len=*) :: str = "gfortran"
3681   INTEGER :: i
3682   DO i = 1, len_trim(str)
3683     CALL fput(str(i:i))
3684   END DO
3685 END PROGRAM
3686 @end smallexample
3687
3688 @item @emph{See also}:
3689 @ref{FPUTC}, @ref{FGET}, @ref{FGETC}
3690 @end table
3691
3692
3693
3694 @node FPUTC
3695 @section @code{FPUTC} --- Write a single character in stream mode
3696 @findex @code{FPUTC} intrinsic
3697 @cindex file operations
3698 @cindex stream operations
3699
3700 @table @asis
3701 @item @emph{Description}:
3702 Write a single character in stream mode by bypassing normal formatted 
3703 output. Stream I/O should not be mixed with normal record-oriented 
3704 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3705
3706 This intrinsic routine is provided for backwards compatibility with 
3707 @command{g77}.  GNU Fortran provides the Fortran 2003 Stream facility.
3708 Programmers should consider the use of new stream IO feature in new code 
3709 for future portability. See also @ref{Fortran 2003 status}.
3710
3711 @item @emph{Standard}:
3712 GNU extension
3713
3714 @item @emph{Class}:
3715 Non-elemental subroutine
3716
3717 @item @emph{Syntax}:
3718 @code{CALL fputc(UNIT,C[,STATUS])}
3719
3720 @item @emph{Arguments}:
3721 @multitable @columnfractions .15 .80
3722 @item @var{UNIT}   @tab The type shall be @code{INTEGER}.
3723 @item @var{C}      @tab The type shall be @code{CHARACTER}.
3724 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3725                         -1 on end-of-file and a system specific positive error code otherwise.
3726 @end multitable
3727
3728 @item @emph{Example}:
3729 @smallexample
3730 PROGRAM test_fputc
3731   CHARACTER(len=*) :: str = "gfortran"
3732   INTEGER :: fd = 42, i
3733
3734   OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3735   DO i = 1, len_trim(str)
3736     CALL fputc(fd, str(i:i))
3737   END DO
3738   CLOSE(fd)
3739 END PROGRAM
3740 @end smallexample
3741
3742 @item @emph{See also}:
3743 @ref{FPUT}, @ref{FGET}, @ref{FGETC}
3744 @end table
3745
3746
3747
3748 @node FRACTION
3749 @section @code{FRACTION} --- Fractional part of the model representation
3750 @findex @code{FRACTION} intrinsic
3751 @cindex fractional part
3752
3753 @table @asis
3754 @item @emph{Description}:
3755 @code{FRACTION(X)} returns the fractional part of the model
3756 representation of @code{X}.
3757
3758 @item @emph{Standard}:
3759 F95 and later
3760
3761 @item @emph{Class}:
3762 Elemental function
3763
3764 @item @emph{Syntax}:
3765 @code{Y = FRACTION(X)}
3766
3767 @item @emph{Arguments}:
3768 @multitable @columnfractions .15 .80
3769 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3770 @end multitable
3771
3772 @item @emph{Return value}:
3773 The return value is of the same type and kind as the argument.
3774 The fractional part of the model representation of @code{X} is returned;
3775 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3776
3777 @item @emph{Example}:
3778 @smallexample
3779 program test_fraction
3780   real :: x
3781   x = 178.1387e-4
3782   print *, fraction(x), x * radix(x)**(-exponent(x))
3783 end program test_fraction
3784 @end smallexample
3785
3786 @end table
3787
3788
3789
3790 @node FREE
3791 @section @code{FREE} --- Frees memory
3792 @findex @code{FREE} intrinsic
3793 @cindex FREE
3794
3795 @table @asis
3796 @item @emph{Description}:
3797 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3798 intrinsic is an extension intended to be used with Cray pointers, and is
3799 provided in GNU Fortran to allow user to compile legacy code. For
3800 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3801 @code{DEALLOCATE}.
3802
3803 @item @emph{Standard}:
3804 GNU extension
3805
3806 @item @emph{Class}:
3807 Subroutine
3808
3809 @item @emph{Syntax}:
3810 @code{FREE(PTR)}
3811
3812 @item @emph{Arguments}:
3813 @multitable @columnfractions .15 .80
3814 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3815 location of the memory that should be de-allocated.
3816 @end multitable
3817
3818 @item @emph{Return value}:
3819 None
3820
3821 @item @emph{Example}:
3822 See @code{MALLOC} for an example.
3823
3824 @item @emph{See also}:
3825 @ref{MALLOC}
3826 @end table
3827
3828
3829
3830
3831 @node FSTAT
3832 @section @code{FSTAT} --- Get file status
3833 @findex @code{FSTAT} intrinsic
3834 @cindex file system operations 
3835
3836 @table @asis
3837 @item @emph{Description}:
3838 @code{FSTAT} is identical to @ref{STAT}, except that information about an 
3839 already opened file is obtained.
3840
3841 The elements in @code{BUFF} are the same as described by @ref{STAT}.
3842
3843 @item @emph{Standard}:
3844 GNU extension
3845
3846 @item @emph{Class}:
3847 Non-elemental subroutine
3848
3849 @item @emph{Syntax}:
3850 @code{CALL fstat(UNIT,BUFF[,STATUS])}
3851
3852 @item @emph{Arguments}:
3853 @multitable @columnfractions .15 .80
3854 @item @var{UNIT}   @tab An open I/O unit number of type @code{INTEGER}.
3855 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
3856 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
3857                         on success and a system specific error code otherwise.
3858 @end multitable
3859
3860 @item @emph{Example}:
3861 See @ref{STAT} for an example.
3862
3863 @item @emph{See also}:
3864 To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
3865 @end table
3866
3867
3868
3869 @node FSEEK
3870 @section @code{FSEEK} --- Low level file positioning subroutine
3871 @findex @code{FSEEK} 
3872 @cindex file system functions
3873
3874 Not yet implemented in GNU Fortran.
3875
3876 @table @asis
3877 @item @emph{Description}:
3878
3879 @item @emph{Standard}:
3880 GNU extension
3881
3882 @item @emph{Class}:
3883 Subroutine
3884
3885 @item @emph{Syntax}:
3886 @item @emph{Arguments}:
3887 @item @emph{Return value}:
3888 @item @emph{Example}:
3889 @item @emph{Specific names}:
3890 @item @emph{See also}:
3891 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3892
3893 @end table
3894
3895
3896
3897 @node FTELL
3898 @section @code{FTELL} --- Current stream position
3899 @findex @code{FTELL} intrinsic
3900
3901 @table @asis
3902 @item @emph{Description}:
3903 Retrieves the current position within an open file.
3904
3905 This intrinsic is provided in both subroutine and function forms; however,
3906 only one form can be used in any given program unit.
3907
3908 @item @emph{Standard}:
3909 GNU extension
3910
3911 @item @emph{Class}:
3912 Subroutine, function
3913
3914 @item @emph{Syntax}:
3915 @multitable @columnfractions .80
3916 @item @code{CALL FTELL(UNIT, OFFSET)}
3917 @item @code{OFFSET = FTELL(UNIT)}
3918 @end multitable
3919
3920 @item @emph{Arguments}:
3921 @multitable @columnfractions .15 .80
3922 @item @var{OFFSET}  @tab Shall of type @code{INTEGER}.
3923 @item @var{UNIT}    @tab Shall of type @code{INTEGER}.
3924 @end multitable
3925
3926 @item @emph{Return value}:
3927 In either syntax, @var{OFFSET} is set to the current offset of unit
3928 number @var{UNIT}, or to @math{-1} if the unit is not currently open.
3929
3930 @item @emph{Example}:
3931 @smallexample
3932 PROGRAM test_ftell
3933   INTEGER :: i
3934   OPEN(10, FILE="temp.dat")
3935   CALL ftell(10,i)
3936   WRITE(*,*) i
3937 END PROGRAM
3938 @end smallexample
3939
3940 @item @emph{See also}:
3941 @ref{FSEEK}
3942 @end table
3943
3944
3945
3946 @node GETARG
3947 @section @code{GETARG} --- Get command line arguments
3948 @findex @code{GETARG} intrinsic
3949 @cindex command line arguments
3950 @cindex getopt
3951
3952 @table @asis
3953 @item @emph{Description}:
3954 Retrieve the @var{N}th argument that was passed on the
3955 command line when the containing program was invoked.
3956
3957 This intrinsic routine is provided for backwards compatibility with 
3958 GNU Fortran 77.  In new code, programmers should consider the use of 
3959 the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003 
3960 standard.
3961
3962 @item @emph{Standard}:
3963 GNU extension
3964
3965 @item @emph{Class}:
3966 Subroutine
3967
3968 @item @emph{Syntax}:
3969 @code{CALL GETARG(N,ARG)}
3970
3971 @item @emph{Arguments}:
3972 @multitable @columnfractions .15 .80
3973 @item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3974 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
3975 @end multitable
3976
3977 @item @emph{Return value}:
3978 After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th 
3979 command line argument. If @var{ARG} can not hold the argument, it is 
3980 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3981 arguments specified at the command line, @var{ARG} will be filled with blanks.
3982 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3983 that support this feature).
3984
3985 @item @emph{Example}:
3986 @smallexample
3987 PROGRAM test_getarg
3988   INTEGER :: i
3989   CHARACTER(len=32) :: arg
3990
3991   DO i = 1, iargc()
3992     CALL getarg(i, arg)
3993     WRITE (*,*) arg
3994   END DO
3995 END PROGRAM
3996 @end smallexample
3997
3998 @item @emph{See also}:
3999 GNU Fortran 77 compatibility function: @ref{IARGC}
4000
4001 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4002 @end table
4003
4004
4005
4006 @node GET_COMMAND
4007 @section @code{GET_COMMAND} --- Get the entire command line
4008 @findex @code{GET_COMMAND} intrinsic
4009 @cindex command line arguments
4010 @cindex getopt
4011
4012 @table @asis
4013 @item @emph{Description}:
4014 Retrieve the entire command line that was used to invoke the program.
4015
4016 @item @emph{Standard}:
4017 F2003
4018
4019 @item @emph{Class}:
4020 Subroutine
4021
4022 @item @emph{Syntax}:
4023 @code{CALL GET_COMMAND(CMD)}
4024
4025 @item @emph{Arguments}:
4026 @multitable @columnfractions .15 .80
4027 @item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}. 
4028 @end multitable
4029
4030 @item @emph{Return value}:
4031 Stores the entire command line that was used to invoke the program in @var{ARG}. 
4032 If @var{ARG} is not large enough, the command will be truncated. 
4033
4034 @item @emph{Example}:
4035 @smallexample
4036 PROGRAM test_get_command
4037   CHARACTER(len=255) :: cmd
4038   CALL get_command(cmd)
4039   WRITE (*,*) TRIM(cmd)
4040 END PROGRAM
4041 @end smallexample
4042
4043 @item @emph{See also}:
4044 @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4045 @end table
4046
4047
4048
4049 @node GET_COMMAND_ARGUMENT
4050 @section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
4051 @findex @code{GET_COMMAND_ARGUMENT} intrinsic
4052 @cindex command line arguments
4053 @cindex getopt
4054
4055 @table @asis
4056 @item @emph{Description}:
4057 Retrieve the @var{N}th argument that was passed on the
4058 command line when the containing program was invoked.
4059
4060 @item @emph{Standard}:
4061 F2003
4062
4063 @item @emph{Class}:
4064 Subroutine
4065
4066 @item @emph{Syntax}:
4067 @code{CALL GET_COMMAND_ARGUMENT(N,ARG)}
4068
4069 @item @emph{Arguments}:
4070 @multitable @columnfractions .15 .80
4071 @item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
4072 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
4073 @end multitable
4074
4075 @item @emph{Return value}:
4076 After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the 
4077 @var{N}th command line argument. If @var{ARG} can not hold the argument, it is 
4078 truncated to fit the length of @var{ARG}. If there are less than @var{N}
4079 arguments specified at the command line, @var{ARG} will be filled with blanks. 
4080 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
4081 that support this feature).
4082
4083 @item @emph{Example}:
4084 @smallexample
4085 PROGRAM test_get_command_argument
4086   INTEGER :: i
4087   CHARACTER(len=32) :: arg
4088
4089   i = 0
4090   DO
4091     CALL get_command_argument(i, arg)
4092     IF (LEN_TRIM(arg) == 0) EXIT
4093
4094     WRITE (*,*) TRIM(arg)
4095     i = i+1
4096   END DO
4097 END PROGRAM
4098 @end smallexample
4099
4100 @item @emph{See also}:
4101 @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
4102 @end table
4103
4104
4105
4106 @node GETCWD
4107 @section @code{GETCWD} --- Get current working directory
4108 @findex @code{GETCWD} intrinsic
4109 @cindex file system functions
4110
4111 @table @asis
4112 @item @emph{Description}:
4113 Get current working directory.
4114
4115 @item @emph{Standard}:
4116 GNU extension
4117
4118 @item @emph{Class}:
4119 Non-elemental subroutine.
4120
4121 @item @emph{Syntax}:
4122 @code{CALL getcwd(CWD[,STATUS])}
4123
4124 @item @emph{Arguments}:
4125 @multitable @columnfractions .15 .80
4126 @item @var{CWD}    @tab The type shall be @code{CHARACTER(*)}.
4127 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success, 
4128                         a system specific and non-zero error code otherwise.
4129 @end multitable
4130
4131 @item @emph{Example}:
4132 @smallexample
4133 PROGRAM test_getcwd
4134   CHARACTER(len=255) :: cwd
4135   CALL getcwd(cwd)
4136   WRITE(*,*) TRIM(cwd)
4137 END PROGRAM
4138 @end smallexample
4139
4140 @item @emph{See also}:
4141 @ref{CHDIR}
4142 @end table
4143
4144
4145
4146 @node GETENV
4147 @section @code{GETENV} --- Get an environmental variable
4148 @findex @code{GETENV} intrinsic
4149 @cindex environment variable
4150
4151 @table @asis
4152 @item @emph{Description}:
4153 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4154
4155 This intrinsic routine is provided for backwards compatibility with 
4156 GNU Fortran 77.  In new code, programmers should consider the use of 
4157 the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
4158 2003 standard.
4159
4160 @item @emph{Standard}:
4161 GNU extension
4162
4163 @item @emph{Class}:
4164 Subroutine
4165
4166 @item @emph{Syntax}:
4167 @code{CALL GETENV(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 getenv("HOME", homedir)
4185   WRITE (*,*) TRIM(homedir)
4186 END PROGRAM
4187 @end smallexample
4188
4189 @item @emph{See also}:
4190 @ref{GET_ENVIRONMENT_VARIABLE}
4191 @end table
4192
4193
4194
4195 @node GET_ENVIRONMENT_VARIABLE
4196 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
4197 @findex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
4198 @cindex environment variable
4199
4200 @table @asis
4201 @item @emph{Description}:
4202 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4203
4204 @item @emph{Standard}:
4205 F2003
4206
4207 @item @emph{Class}:
4208 Subroutine
4209
4210 @item @emph{Syntax}:
4211 @code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR,VALUE)}
4212
4213 @item @emph{Arguments}:
4214 @multitable @columnfractions .15 .80
4215 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
4216 @item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
4217 @end multitable
4218
4219 @item @emph{Return value}:
4220 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
4221 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4222 is not set, @var{VALUE} will be filled with blanks.
4223
4224 @item @emph{Example}:
4225 @smallexample
4226 PROGRAM test_getenv
4227   CHARACTER(len=255) :: homedir
4228   CALL get_environment_variable("HOME", homedir)
4229   WRITE (*,*) TRIM(homedir)
4230 END PROGRAM
4231 @end smallexample
4232 @end table
4233
4234
4235
4236 @node GETGID
4237 @section @code{GETGID} --- Group ID function
4238 @findex @code{GETGID} intrinsic
4239 @cindex GETGID
4240
4241 @table @asis
4242 @item @emph{Description}:
4243 Returns the numerical group ID of the current process.
4244
4245 @item @emph{Standard}:
4246 GNU extension
4247
4248 @item @emph{Class}:
4249 function
4250
4251 @item @emph{Syntax}:
4252 @code{I = GETGID()}
4253
4254 @item @emph{Return value}:
4255 The return value of @code{GETGID} is an @code{INTEGER} of the default
4256 kind.
4257
4258
4259 @item @emph{Example}:
4260 See @code{GETPID} for an example.
4261
4262 @item @emph{See also}:
4263 @ref{GETPID}, @ref{GETUID}
4264 @end table
4265
4266
4267
4268 @node GETLOG
4269 @section @code{GETLOG} --- Get login name
4270 @findex @code{GETLOG} intrinsic
4271
4272 @table @asis
4273 @item @emph{Description}:
4274 Gets the username under which the program is running.
4275
4276 @item @emph{Standard}:
4277 GNU extension
4278
4279 @item @emph{Class}:
4280 Subroutine
4281
4282 @item @emph{Syntax}:
4283 @code{CALL GETLOG(LOGIN)}
4284
4285 @item @emph{Arguments}:
4286 @multitable @columnfractions .15 .80
4287 @item @var{LOGIN} @tab Shall be of type @code{CHARACTER(*)}.
4288 @end multitable
4289
4290 @item @emph{Return value}:
4291 Stores the current user name in @var{LOGIN}.  (On systems where 
4292 the @code{getlogin(3)} function is not implemented, this will
4293 return a blank string.)
4294
4295 @item @emph{Example}:
4296 @smallexample
4297 PROGRAM TEST_GETLOG
4298   CHARACTER(32) :: login
4299   CALL GETLOG(login)
4300   WRITE(*,*) login
4301 END PROGRAM
4302 @end smallexample
4303
4304 @item @emph{See also}:
4305 @ref{GETUID}
4306 @end table
4307
4308
4309
4310 @node GETPID
4311 @section @code{GETPID} --- Process ID function
4312 @findex @code{GETPID} intrinsic
4313 @cindex GETPID
4314
4315 @table @asis
4316 @item @emph{Description}:
4317 Returns the numerical process identifier of the current process.
4318
4319 @item @emph{Standard}:
4320 GNU extension
4321
4322 @item @emph{Class}:
4323 function
4324
4325 @item @emph{Syntax}:
4326 @code{I = GETPID()}
4327
4328 @item @emph{Return value}:
4329 The return value of @code{GETPID} is an @code{INTEGER} of the default
4330 kind.
4331
4332
4333 @item @emph{Example}:
4334 @smallexample
4335 program info
4336   print *, "The current process ID is ", getpid()
4337   print *, "Your numerical user ID is ", getuid()
4338   print *, "Your numerical group ID is ", getgid()
4339 end program info
4340 @end smallexample
4341
4342 @item @emph{See also}:
4343 @ref{GETGID}, @ref{GETUID}
4344 @end table
4345
4346
4347
4348 @node GETUID
4349 @section @code{GETUID} --- User ID function
4350 @findex @code{GETUID} intrinsic
4351 @cindex GETUID
4352
4353 @table @asis
4354 @item @emph{Description}:
4355 Returns the numerical user ID of the current process.
4356
4357 @item @emph{Standard}:
4358 GNU extension
4359
4360 @item @emph{Class}:
4361 function
4362
4363 @item @emph{Syntax}:
4364 @code{GETUID()}
4365
4366 @item @emph{Return value}:
4367 The return value of @code{GETUID} is an @code{INTEGER} of the default
4368 kind.
4369
4370
4371 @item @emph{Example}:
4372 See @code{GETPID} for an example.
4373
4374 @item @emph{See also}:
4375 @ref{GETPID}, @ref{GETLOG}
4376 @end table
4377
4378
4379
4380 @node GMTIME
4381 @section @code{GMTIME} --- Convert time to GMT info
4382 @findex @code{GMTIME} 
4383 @cindex time function
4384
4385 Not yet implemented in GNU Fortran.
4386
4387 @table @asis
4388 @item @emph{Description}:
4389
4390 @item @emph{Standard}:
4391 GNU extension
4392
4393 @item @emph{Class}:
4394 Subroutine
4395
4396 @item @emph{Syntax}:
4397 @item @emph{Arguments}:
4398 @item @emph{Return value}:
4399 @item @emph{Example}:
4400 @item @emph{Specific names}:
4401 @item @emph{See also}:
4402
4403 @end table
4404
4405
4406
4407 @node HOSTNM
4408 @section @code{HOSTNM} --- Get system host name
4409 @findex @code{HOSTNM} intrinsic
4410
4411 @table @asis
4412 @item @emph{Description}:
4413 Retrieves the host name of the system on which the program is running.
4414
4415 This intrinsic is provided in both subroutine and function forms; however,
4416 only one form can be used in any given program unit.
4417
4418 @item @emph{Standard}:
4419 GNU extension
4420
4421 @item @emph{Class}:
4422 Subroutine, function
4423
4424 @item @emph{Syntax}:
4425 @multitable @columnfractions .80
4426 @item @code{CALL HOSTNM(NAME, STATUS)}
4427 @item @code{STATUS = HOSTNM(NAME)}
4428 @end multitable
4429
4430 @item @emph{Arguments}:
4431 @multitable @columnfractions .15 .80
4432 @item @var{NAME}    @tab Shall of type @code{CHARACTER(*)}.
4433 @item @var{STATUS}  @tab (Optional) status flag of type @code{INTEGER}.
4434                          Returns 0 on success, or a system specific error
4435                          code otherwise.
4436 @end multitable
4437
4438 @item @emph{Return value}:
4439 In either syntax, @var{NAME} is set to the current hostname if it can
4440 be obtained, or to a blank string otherwise.
4441
4442 @end table
4443
4444
4445
4446 @node HUGE
4447 @section @code{HUGE} --- Largest number of a kind
4448 @findex @code{HUGE} intrinsic
4449 @cindex huge
4450
4451 @table @asis
4452 @item @emph{Description}:
4453 @code{HUGE(X)} returns the largest number that is not an infinity in
4454 the model of the type of @code{X}.
4455
4456 @item @emph{Standard}:
4457 F95 and later
4458
4459 @item @emph{Class}:
4460 Elemental function
4461
4462 @item @emph{Syntax}:
4463 @code{Y = HUGE(X)}
4464
4465 @item @emph{Arguments}:
4466 @multitable @columnfractions .15 .80
4467 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
4468 @end multitable
4469
4470 @item @emph{Return value}:
4471 The return value is of the same type and kind as @var{X}
4472
4473 @item @emph{Example}:
4474 @smallexample
4475 program test_huge_tiny
4476   print *, huge(0), huge(0.0), huge(0.0d0)
4477   print *, tiny(0.0), tiny(0.0d0)
4478 end program test_huge_tiny
4479 @end smallexample
4480 @end table
4481
4482
4483
4484 @node IACHAR
4485 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence 
4486 @findex @code{IACHAR} intrinsic
4487 @cindex @acronym{ASCII} collating sequence
4488 @cindex conversion function (character)
4489
4490 @table @asis
4491 @item @emph{Description}:
4492 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4493 in the first character position of @code{C}.
4494
4495 @item @emph{Standard}:
4496 F95 and later
4497
4498 @item @emph{Class}:
4499 Elemental function
4500
4501 @item @emph{Syntax}:
4502 @code{I = IACHAR(C)}
4503
4504 @item @emph{Arguments}:
4505 @multitable @columnfractions .15 .80
4506 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4507 @end multitable
4508
4509 @item @emph{Return value}:
4510 The return value is of type @code{INTEGER} and of the default integer
4511 kind.
4512
4513 @item @emph{Example}:
4514 @smallexample
4515 program test_iachar
4516   integer i
4517   i = iachar(' ')
4518 end program test_iachar
4519 @end smallexample
4520
4521 @item @emph{See also}:
4522 @ref{CHAR},@ref{ICHAR}
4523
4524 @end table
4525
4526
4527 @node IAND
4528 @section @code{IAND} --- Bitwise logical and
4529 @findex @code{IAND} intrinsic
4530 @cindex bit operations
4531
4532 @table @asis
4533 @item @emph{Description}:
4534 Bitwise logical @code{AND}.
4535
4536 @item @emph{Standard}:
4537 F95 and later
4538
4539 @item @emph{Class}:
4540 Elemental function
4541
4542 @item @emph{Syntax}:
4543 @code{RESULT = IAND(X, Y)}
4544
4545 @item @emph{Arguments}:
4546 @multitable @columnfractions .15 .80
4547 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
4548 @item @var{Y} @tab The type shall be @code{INTEGER(*)}.
4549 @end multitable
4550
4551 @item @emph{Return value}:
4552 The return type is @code{INTEGER(*)} after cross-promotion of the arguments. 
4553
4554 @item @emph{Example}:
4555 @smallexample
4556 PROGRAM test_iand
4557   INTEGER :: a, b
4558   DATA a / Z'F' /, b / Z'3' /
4559   WRITE (*,*) IAND(a, b)
4560 END PROGRAM
4561 @end smallexample
4562
4563 @item @emph{See also}:
4564 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4565 @end table
4566
4567
4568
4569 @node IARGC
4570 @section @code{IARGC} --- Get the number of command line arguments
4571 @findex @code{IARGC} intrinsic
4572 @cindex command line arguments
4573 @cindex getopt
4574
4575 @table @asis
4576 @item @emph{Description}:
4577 @code{IARGC()} returns the number of arguments passed on the
4578 command line when the containing program was invoked.
4579
4580 This intrinsic routine is provided for backwards compatibility with 
4581 GNU Fortran 77.  In new code, programmers should consider the use of 
4582 the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003 
4583 standard.
4584
4585 @item @emph{Standard}:
4586 GNU extension
4587
4588 @item @emph{Class}:
4589 Non-elemental Function
4590
4591 @item @emph{Syntax}:
4592 @code{I = IARGC()}
4593
4594 @item @emph{Arguments}:
4595 None.
4596
4597 @item @emph{Return value}:
4598 The number of command line arguments, type @code{INTEGER(4)}.
4599
4600 @item @emph{Example}:
4601 See @ref{GETARG}
4602
4603 @item @emph{See also}:
4604 GNU Fortran 77 compatibility subroutine: @ref{GETARG}
4605
4606 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4607 @end table
4608
4609
4610
4611 @node IBCLR
4612 @section @code{IBCLR} --- Clear bit
4613 @findex @code{IBCLR} intrinsic
4614 @cindex bit operations
4615
4616 Intrinsic implemented, documentation pending.
4617
4618 @table @asis
4619 @item @emph{Description}:
4620 @item @emph{Standard}:
4621 F95 and later
4622
4623 @item @emph{Class}:
4624 Elemental function
4625
4626 @item @emph{Syntax}:
4627 @item @emph{Arguments}:
4628 @item @emph{Return value}:
4629 @item @emph{Example}:
4630 @item @emph{Specific names}:
4631
4632 @item @emph{See also}:
4633 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4634 @end table
4635
4636
4637
4638
4639 @node IBITS
4640 @section @code{IBITS} --- Bit extraction
4641 @findex @code{IBITS} intrinsic
4642 @cindex bit operations
4643
4644 Intrinsic implemented, documentation pending.
4645
4646 @table @asis
4647 @item @emph{Description}:
4648 @item @emph{Standard}:
4649 F95 and later
4650
4651 @item @emph{Class}:
4652 Elemental function
4653
4654 @item @emph{Syntax}:
4655 @item @emph{Arguments}:
4656 @item @emph{Return value}:
4657 @item @emph{Example}:
4658 @item @emph{Specific names}:
4659 @item @emph{See also}:
4660 @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4661
4662 @end table
4663
4664
4665
4666
4667 @node IBSET
4668 @section @code{IBSET} --- Set bit
4669 @findex @code{IBSET} intrinsic
4670 @cindex bit operations
4671
4672 Intrinsic implemented, documentation pending.
4673
4674 @table @asis
4675 @item @emph{Description}:
4676 @item @emph{Standard}:
4677 F95 and later
4678
4679 @item @emph{Class}:
4680 Elemental function
4681
4682 @item @emph{Syntax}:
4683 @item @emph{Arguments}:
4684 @item @emph{Return value}:
4685 @item @emph{Example}:
4686 @item @emph{Specific names}:
4687
4688 @item @emph{See also}:
4689 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4690
4691 @end table
4692
4693
4694
4695 @node ICHAR
4696 @section @code{ICHAR} --- Character-to-integer conversion function
4697 @findex @code{ICHAR} intrinsic
4698 @cindex conversion function (character)
4699
4700 @table @asis
4701 @item @emph{Description}:
4702 @code{ICHAR(C)} returns the code for the character in the first character
4703 position of @code{C} in the system's native character set.
4704 The correspondence between characters and their codes is not necessarily
4705 the same across different GNU Fortran implementations.
4706
4707 @item @emph{Standard}:
4708 F95 and later
4709
4710 @item @emph{Class}:
4711 Elemental function
4712
4713 @item @emph{Syntax}:
4714 @code{I = ICHAR(C)}
4715
4716 @item @emph{Arguments}:
4717 @multitable @columnfractions .15 .80
4718 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4719 @end multitable
4720
4721 @item @emph{Return value}:
4722 The return value is of type @code{INTEGER} and of the default integer
4723 kind.
4724
4725 @item @emph{Example}:
4726 @smallexample
4727 program test_ichar
4728   integer i
4729   i = ichar(' ')
4730 end program test_ichar
4731 @end smallexample
4732
4733 @item @emph{Note}:
4734 No intrinsic exists to convert a printable character string to a numerical
4735 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4736 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4737 value 154.
4738
4739 Instead, you can use internal-file I/O to do this kind of conversion. For
4740 example:
4741 @smallexample
4742 program read_val
4743   integer value
4744   character(len=10) string
4745
4746   string = '154'
4747   read (string,'(I10)') value
4748   print *, value
4749 end program read_val
4750 @end smallexample
4751 @end table
4752
4753 @node IDATE
4754 @section @code{IDATE} --- Get current local time subroutine (day/month/year) 
4755 @findex @code{IDATE} intrinsic
4756
4757 @table @asis
4758 @item @emph{Description}:
4759 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the  
4760 current local time. The day (in the range 1-31), month (in the range 1-12), 
4761 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively. 
4762 The year has four significant digits.
4763
4764 @item @emph{Standard}:
4765 GNU extension
4766
4767 @item @emph{Class}:
4768 Subroutine
4769
4770 @item @emph{Syntax}:
4771 @code{CALL IDATE(TARRAY)}
4772
4773 @item @emph{Arguments}:
4774 @multitable @columnfractions .15 .80
4775 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4776 the kind shall be the default integer kind.
4777 @end multitable
4778
4779 @item @emph{Return value}:
4780 Does not return.
4781
4782 @item @emph{Example}:
4783 @smallexample
4784 program test_idate
4785   integer, dimension(3) :: tarray
4786   call idate(tarray)
4787   print *, tarray(1)
4788   print *, tarray(2)
4789   print *, tarray(3)
4790 end program test_idate
4791 @end smallexample
4792 @end table
4793
4794
4795
4796 @node IEOR
4797 @section @code{IEOR} --- Bitwise logical exclusive or
4798 @findex @code{IEOR} intrinsic
4799 @cindex bit operations
4800
4801 Intrinsic implemented, documentation pending.
4802
4803 @table @asis
4804 @item @emph{Description}:
4805 @item @emph{Standard}:
4806 F95 and later
4807
4808 @item @emph{Class}:
4809 Elemental function
4810
4811 @item @emph{Syntax}:
4812 @item @emph{Arguments}:
4813 @item @emph{Return value}:
4814 @item @emph{Example}:
4815 @item @emph{Specific names}:
4816
4817 @item @emph{See also}:
4818 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4819 @end table
4820
4821
4822
4823
4824 @node IERRNO
4825 @section @code{IERRNO} --- Get the last system error number
4826 @findex @code{IERRNO} intrinsic
4827 @cindex undocumented intrinsic 
4828
4829 Intrinsic implemented, documentation pending.
4830
4831 @table @asis
4832 @item @emph{Description}:
4833 @item @emph{Standard}:
4834 GNU extension
4835
4836 @item @emph{Class}:
4837 @item @emph{Syntax}:
4838 @item @emph{Arguments}:
4839 @item @emph{Return value}:
4840 @item @emph{Example}:
4841
4842 @item @emph{See also}:
4843 @ref{PERROR}
4844 @end table
4845
4846
4847
4848
4849 @node INDEX
4850 @section @code{INDEX} --- Position of a substring within a string
4851 @findex @code{INDEX} intrinsic
4852 @cindex undocumented intrinsic 
4853
4854 Intrinsic implemented, documentation pending.
4855
4856 @table @asis
4857 @item @emph{Description}:
4858 @item @emph{Standard}:
4859 F77 and later
4860
4861 @item @emph{Class}:
4862 Elemental function
4863
4864 @item @emph{Syntax}:
4865 @item @emph{Arguments}:
4866 @item @emph{Return value}:
4867 @item @emph{Example}:
4868 @item @emph{Specific names}:
4869 @item @emph{See also}:
4870 @end table
4871
4872
4873
4874
4875 @node INT
4876 @section @code{INT} --- Convert to integer type
4877 @findex @code{INT} intrinsic
4878 @findex @code{IFIX} intrinsic
4879 @findex @code{IDINT} intrinsic
4880 @cindex conversion function (integer)
4881
4882 @table @asis
4883 @item @emph{Description}:
4884 Convert to integer type
4885
4886 @item @emph{Standard}:
4887 F77 and later
4888
4889 @item @emph{Class}:
4890 Elemental function
4891
4892 @item @emph{Syntax}:
4893 @multitable @columnfractions .30 .80
4894 @item @code{X = INT(X)}
4895 @item @code{X = INT(X, KIND)}
4896 @end multitable
4897
4898 @item @emph{Arguments}:
4899 @multitable @columnfractions .15 .80
4900 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or @code{COMPLEX(*)}
4901 @item @var{KIND}  @tab (Optional) @var{KIND} shall be a scalar integer.
4902 @end multitable
4903
4904 @item @emph{Return value}:
4905 These functions return a @code{INTEGER(*)} variable or array under 
4906 the following rules: 
4907
4908 @table @asis
4909 @item (A)
4910 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X} 
4911 @item (B)
4912 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}. 
4913 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed 
4914 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4915 @item (C)
4916 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4917 @end table
4918
4919 @item @emph{Example}:
4920 @smallexample
4921 program test_int
4922   integer :: i = 42
4923   complex :: z = (-3.7, 1.0)
4924   print *, int(i)
4925   print *, int(z), int(z,8)
4926 end program
4927 @end smallexample
4928
4929 @item @emph{Specific names}:
4930 @multitable @columnfractions .20 .20 .20 .40
4931 @item Name             @tab Argument            @tab Return type       @tab Standard
4932 @item @code{IFIX(X)}   @tab @code{REAL(4) X}    @tab @code{INTEGER}    @tab F77 and later
4933 @item @code{IDINT(X)}  @tab @code{REAL(8) X}    @tab @code{INTEGER}    @tab F77 and later
4934 @end multitable
4935
4936 @comment @item @emph{See also}:
4937 @end table
4938
4939
4940
4941
4942 @node IOR
4943 @section @code{IOR} --- Bitwise logical or
4944 @findex @code{IOR} intrinsic
4945 @cindex bit operations
4946
4947 Intrinsic implemented, documentation pending.
4948
4949 @table @asis
4950 @item @emph{Description}:
4951 @item @emph{Standard}:
4952 F95 and later
4953
4954 @item @emph{Class}:
4955 Elemental function
4956
4957 @item @emph{Syntax}:
4958 @item @emph{Arguments}:
4959 @item @emph{Return value}:
4960 @item @emph{Example}:
4961 @item @emph{Specific names}:
4962
4963 @item @emph{See also}:
4964 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4965 @end table
4966
4967
4968
4969
4970 @node IRAND
4971 @section @code{IRAND} --- Integer pseudo-random number
4972 @findex @code{IRAND} intrinsic
4973 @cindex random number
4974
4975 @table @asis
4976 @item @emph{Description}:
4977 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
4978 distribution between 0 and a system-dependent limit (which is in most
4979 cases 2147483647). If @var{FLAG} is 0, the next number
4980 in the current sequence is returned; if @var{FLAG} is 1, the generator
4981 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
4982 it is used as a new seed with @code{SRAND}.
4983
4984 @item @emph{Standard}:
4985 GNU extension
4986
4987 @item @emph{Class}:
4988 non-elemental function
4989
4990 @item @emph{Syntax}:
4991 @code{I = IRAND(FLAG)}
4992
4993 @item @emph{Arguments}:
4994 @multitable @columnfractions .15 .80
4995 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
4996 @end multitable
4997
4998 @item @emph{Return value}:
4999 The return value is of @code{INTEGER(kind=4)} type.
5000
5001 @item @emph{Example}:
5002 @smallexample
5003 program test_irand
5004   integer,parameter :: seed = 86456
5005   
5006   call srand(seed)
5007   print *, irand(), irand(), irand(), irand()
5008   print *, irand(seed), irand(), irand(), irand()
5009 end program test_irand
5010 @end smallexample
5011
5012 @end table
5013
5014
5015
5016 @node ISHFT
5017 @section @code{ISHFT} --- Shift bits
5018 @findex @code{ISHFT} intrinsic
5019 @cindex bit manipulation
5020
5021 Intrinsic implemented, documentation pending.
5022
5023 @table @asis
5024 @item @emph{Description}:
5025 @item @emph{Standard}:
5026 F95 and later
5027
5028 @item @emph{Class}:
5029 Elemental function
5030
5031 @item @emph{Syntax}:
5032 @item @emph{Arguments}:
5033 @item @emph{Return value}:
5034 @item @emph{Example}:
5035 @item @emph{Specific names}:
5036
5037 @item @emph{See also}:
5038 @ref{ISHFTC}
5039 @end table
5040
5041
5042
5043
5044 @node ISHFTC
5045 @section @code{ISHFTC} --- Shift bits circularly
5046 @findex @code{ISHFTC} intrinsic
5047 @cindex bit manipulation
5048
5049 Intrinsic implemented, documentation pending.
5050
5051 @table @asis
5052 @item @emph{Description}:
5053 @item @emph{Standard}:
5054 F95 and later
5055
5056 @item @emph{Class}:
5057 Elemental function
5058
5059 @item @emph{Syntax}:
5060 @item @emph{Arguments}:
5061 @item @emph{Return value}:
5062 @item @emph{Example}:
5063 @item @emph{Specific names}:
5064
5065 @item @emph{See also}:
5066 @ref{ISHFT}
5067 @end table
5068
5069
5070
5071 @node ITIME
5072 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds) 
5073 @findex @code{ITIME} intrinsic
5074
5075 @table @asis
5076 @item @emph{Description}:
5077 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the  
5078 current local time. The hour (in the range 1-24), minute (in the range 1-60), 
5079 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY}, 
5080 respectively.
5081
5082 @item @emph{Standard}:
5083 GNU extension
5084
5085 @item @emph{Class}:
5086 Subroutine
5087
5088 @item @emph{Syntax}:
5089 @code{CALL ITIME(TARRAY)}
5090
5091 @item @emph{Arguments}:
5092 @multitable @columnfractions .15 .80
5093 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
5094 and the kind shall be the default integer kind.
5095 @end multitable
5096
5097 @item @emph{Return value}:
5098 Does not return.
5099
5100
5101 @item @emph{Example}:
5102 @smallexample
5103 program test_itime
5104   integer, dimension(3) :: tarray
5105   call itime(tarray)
5106   print *, tarray(1)
5107   print *, tarray(2)
5108   print *, tarray(3)
5109 end program test_itime
5110 @end smallexample
5111 @end table
5112
5113
5114
5115 @node KILL
5116 @section @code{KILL} --- Send a signal to a process
5117 @findex @code{KILL} intrinsic
5118 @cindex undocumented intrinsic 
5119
5120 Intrinsic implemented, documentation pending.
5121
5122 @table @asis
5123 @item @emph{Description}:
5124 @item @emph{Standard}:
5125 GNU extension
5126
5127 @item @emph{Class}:
5128 Subroutine
5129
5130 @item @emph{Syntax}:
5131 @item @emph{Arguments}:
5132 @item @emph{Return value}:
5133 @item @emph{Example}:
5134 @item @emph{Specific names}:
5135
5136 @item @emph{See also}:
5137 @ref{ABORT}, @ref{EXIT}
5138 @end table
5139
5140
5141
5142 @node KIND
5143 @section @code{KIND} --- Kind of an entity
5144 @findex @code{KIND} intrinsic
5145
5146 @table @asis
5147 @item @emph{Description}:
5148 @code{KIND(X)} returns the kind value of the entity @var{X}.
5149
5150 @item @emph{Standard}:
5151 F95 and later
5152
5153 @item @emph{Class}:
5154 Inquiry function
5155
5156 @item @emph{Syntax}:
5157 @code{K = KIND(X)}
5158
5159 @item @emph{Arguments}:
5160 @multitable @columnfractions .15 .80
5161 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
5162 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
5163 @end multitable
5164
5165 @item @emph{Return value}:
5166 The return value is a scalar of type @code{INTEGER} and of the default
5167 integer kind.
5168
5169 @item @emph{Example}:
5170 @smallexample
5171 program test_kind
5172   integer,parameter :: kc = kind(' ')
5173   integer,parameter :: kl = kind(.true.)
5174
5175   print *, "The default character kind is ", kc
5176   print *, "The default logical kind is ", kl
5177 end program test_kind
5178 @end smallexample
5179
5180 @end table
5181
5182
5183
5184 @node LBOUND
5185 @section @code{LBOUND} --- Lower dimension bounds of an array
5186 @findex @code{LBOUND} intrinsic
5187 @cindex undocumented intrinsic 
5188
5189 Intrinsic implemented, documentation pending.
5190
5191 @table @asis
5192 @item @emph{Description}:
5193 @item @emph{Standard}:
5194 F95 and later
5195
5196 @item @emph{Class}:
5197 Inquiry function
5198
5199 @item @emph{Syntax}:
5200 @item @emph{Arguments}:
5201 @item @emph{Return value}:
5202 @item @emph{Example}:
5203 @item @emph{See also}:
5204 @ref{UBOUND}
5205 @end table
5206
5207
5208
5209
5210 @node LEN
5211 @section @code{LEN} --- Length of a character entity
5212 @findex @code{LEN} intrinsic
5213 @cindex undocumented intrinsic 
5214
5215 Intrinsic implemented, documentation pending.
5216
5217 @table @asis
5218 @item @emph{Description}:
5219 @item @emph{Standard}:
5220 F77 and later
5221
5222 @item @emph{Class}:
5223 Inquiry function
5224
5225 @item @emph{Syntax}:
5226 @item @emph{Arguments}:
5227 @item @emph{Return value}:
5228 @item @emph{Example}:
5229 @item @emph{Specific names}:
5230
5231 @item @emph{See also}:
5232 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
5233 @end table
5234
5235
5236
5237
5238 @node LEN_TRIM
5239 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
5240 @findex @code{LEN_TRIM} intrinsic
5241 @cindex undocumented intrinsic 
5242
5243 Intrinsic implemented, documentation pending.
5244
5245 @table @asis
5246 @item @emph{Description}:
5247 @item @emph{Standard}:
5248 F95 and later
5249
5250 @item @emph{Class}:
5251 Elemental function
5252
5253 @item @emph{Syntax}:
5254 @item @emph{Arguments}:
5255 @item @emph{Return value}:
5256 @item @emph{Example}:
5257
5258 @item @emph{See also}:
5259 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
5260 @end table
5261
5262
5263
5264
5265 @node LGE
5266 @section @code{LGE} --- Lexical greater than or equal
5267 @findex @code{LGE} intrinsic
5268 @cindex comparison (lexical)
5269
5270 Intrinsic implemented, documentation pending.
5271
5272 @table @asis
5273 @item @emph{Description}:
5274 @item @emph{Standard}:
5275 F77 and later
5276
5277 @item @emph{Class}:
5278 Elemental function
5279
5280 @item @emph{Syntax}:
5281 @item @emph{Arguments}:
5282 @item @emph{Return value}:
5283 @item @emph{Example}:
5284
5285 @item @emph{See also}:
5286 @ref{LGT}, @ref{LLE}, @ref{LLT}
5287 @end table
5288
5289
5290
5291
5292 @node LGT
5293 @section @code{LGT} --- Lexical greater than
5294 @findex @code{LGT} intrinsic
5295 @cindex comparison (lexical)
5296
5297 Intrinsic implemented, documentation pending.
5298
5299 @table @asis
5300 @item @emph{Description}:
5301 @item @emph{Standard}:
5302 F77 and later
5303
5304 @item @emph{Class}:
5305 Elemental function
5306
5307 @item @emph{Syntax}:
5308 @item @emph{Arguments}:
5309 @item @emph{Return value}:
5310 @item @emph{Example}:
5311
5312 @item @emph{See also}:
5313 @ref{LGE}, @ref{LLE}, @ref{LLT}
5314 @end table
5315
5316
5317
5318
5319 @node LINK
5320 @section @code{LINK} --- Create a hard link
5321 @findex @code{LINK} intrinsic
5322 @cindex file system operations
5323
5324 Intrinsic implemented, documentation pending.
5325
5326 @table @asis
5327 @item @emph{Description}:
5328 @item @emph{Standard}:
5329 GNU extension
5330
5331 @item @emph{Class}:
5332 Subroutine
5333
5334 @item @emph{Syntax}:
5335 @item @emph{Arguments}:
5336 @item @emph{Return value}:
5337 @item @emph{Example}:
5338 @item @emph{Specific names}:
5339
5340 @item @emph{See also}:
5341 @ref{UNLINK}
5342 @end table
5343
5344
5345
5346
5347 @node LLE
5348 @section @code{LLE} --- Lexical less than or equal
5349 @findex @code{LLE} intrinsic
5350 @cindex comparison (lexical)
5351
5352 Intrinsic implemented, documentation pending.
5353
5354 @table @asis
5355 @item @emph{Description}:
5356 @item @emph{Standard}:
5357 F77 and later
5358
5359 @item @emph{Class}:
5360 Elemental function
5361
5362 @item @emph{Syntax}:
5363 @item @emph{Arguments}:
5364 @item @emph{Return value}:
5365 @item @emph{Example}:
5366
5367 @item @emph{See also}:
5368 @ref{LGE}, @ref{LGT}, @ref{LLT}
5369 @end table
5370
5371
5372
5373
5374 @node LLT
5375 @section @code{LLT} --- Lexical less than
5376 @findex @code{LLT} intrinsic
5377 @cindex comparison (lexical)
5378
5379 Intrinsic implemented, documentation pending.
5380
5381 @table @asis
5382 @item @emph{Description}:
5383 @item @emph{Standard}:
5384 F77 and later
5385
5386 @item @emph{Class}:
5387 Elemental function
5388
5389 @item @emph{Syntax}:
5390 @item @emph{Arguments}:
5391 @item @emph{Return value}:
5392 @item @emph{Example}:
5393
5394 @item @emph{See also}:
5395 @ref{LGE}, @ref{LGT}, @ref{LLE}
5396 @end table
5397
5398
5399
5400
5401 @node LNBLNK
5402 @section @code{LNBLNK} --- Index of the last non-blank character in a string
5403 @findex @code{LNBLNK} intrinsic
5404 @cindex undocumented intrinsic 
5405
5406 Intrinsic implemented, documentation pending.
5407
5408 @table @asis
5409 @item @emph{Description}:
5410 @item @emph{Standard}:
5411 GNU extension
5412
5413 @item @emph{Class}:
5414 @item @emph{Syntax}:
5415 @item @emph{Arguments}:
5416 @item @emph{Return value}:
5417 @item @emph{Example}:
5418 @item @emph{Specific names}:
5419
5420 @item @emph{See also}:
5421 @ref{INDEX}
5422 @end table
5423
5424
5425
5426
5427 @node LOC
5428 @section @code{LOC} --- Returns the address of a variable
5429 @findex @code{LOC} intrinsic
5430 @cindex loc
5431
5432 @table @asis
5433 @item @emph{Description}:
5434 @code{LOC(X)} returns the address of @var{X} as an integer.
5435
5436 @item @emph{Standard}:
5437 GNU extension
5438
5439 @item @emph{Class}:
5440 Inquiry function
5441
5442 @item @emph{Syntax}:
5443 @code{I = LOC(X)}
5444
5445 @item @emph{Arguments}:
5446 @multitable @columnfractions .15 .80
5447 @item @var{X} @tab Variable of any type.
5448 @end multitable
5449
5450 @item @emph{Return value}:
5451 The return value is of type @code{INTEGER(n)}, where @code{n} is the
5452 size (in bytes) of a memory address on the target machine.
5453
5454 @item @emph{Example}:
5455 @smallexample
5456 program test_loc
5457   integer :: i
5458   real :: r
5459   i = loc(r)
5460   print *, i
5461 end program test_loc
5462 @end smallexample
5463 @end table
5464
5465 @node LOG
5466 @section @code{LOG} --- Logarithm function
5467 @findex @code{LOG} intrinsic
5468 @findex @code{ALOG} intrinsic
5469 @findex @code{DLOG} intrinsic
5470 @findex @code{CLOG} intrinsic
5471 @findex @code{ZLOG} intrinsic
5472 @findex @code{CDLOG} intrinsic
5473 @cindex logarithm
5474
5475 @table @asis
5476 @item @emph{Description}:
5477 @code{LOG(X)} computes the logarithm of @var{X}.
5478
5479 @item @emph{Standard}:
5480 F77 and later
5481
5482 @item @emph{Class}:
5483 Elemental function
5484
5485 @item @emph{Syntax}:
5486 @code{X = LOG(X)}
5487
5488 @item @emph{Arguments}:
5489 @multitable @columnfractions .15 .80
5490 @item @var{X} @tab The type shall be @code{REAL(*)} or
5491 @code{COMPLEX(*)}.
5492 @end multitable
5493
5494 @item @emph{Return value}:
5495 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5496 The kind type parameter is the same as @var{X}.
5497
5498 @item @emph{Example}:
5499 @smallexample
5500 program test_log
5501   real(8) :: x = 1.0_8
5502   complex :: z = (1.0, 2.0)
5503   x = log(x)
5504   z = log(z)
5505 end program test_log
5506 @end smallexample
5507
5508 @item @emph{Specific names}:
5509 @multitable @columnfractions .20 .20 .20 .40
5510 @item Name            @tab Argument          @tab Return type       @tab Standard
5511 @item @code{ALOG(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab f95, gnu
5512 @item @code{DLOG(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
5513 @item @code{CLOG(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
5514 @item @code{ZLOG(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
5515 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
5516 @end multitable
5517 @end table
5518
5519
5520
5521 @node LOG10
5522 @section @code{LOG10} --- Base 10 logarithm function
5523 @findex @code{LOG10} intrinsic
5524 @findex @code{ALOG10} intrinsic
5525 @findex @code{DLOG10} intrinsic
5526 @cindex logarithm
5527
5528 @table @asis
5529 @item @emph{Description}:
5530 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5531
5532 @item @emph{Standard}:
5533 F77 and later
5534
5535 @item @emph{Class}:
5536 Elemental function
5537
5538 @item @emph{Syntax}:
5539 @code{X = LOG10(X)}
5540
5541 @item @emph{Arguments}:
5542 @multitable @columnfractions .15 .80
5543 @item @var{X} @tab The type shall be @code{REAL(*)} or
5544 @code{COMPLEX(*)}.
5545 @end multitable
5546
5547 @item @emph{Return value}:
5548 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5549 The kind type parameter is the same as @var{X}.
5550
5551 @item @emph{Example}:
5552 @smallexample
5553 program test_log10
5554   real(8) :: x = 10.0_8
5555   x = log10(x)
5556 end program test_log10
5557 @end smallexample
5558
5559 @item @emph{Specific names}:
5560 @multitable @columnfractions .20 .20 .20 .40
5561 @item Name            @tab Argument          @tab Return type       @tab Standard
5562 @item @code{ALOG10(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab F95 and later
5563 @item @code{DLOG10(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
5564 @end multitable
5565 @end table
5566
5567
5568 @node LOGICAL
5569 @section @code{LOGICAL} --- Convert to logical type
5570 @findex @code{LOGICAL} intrinsic
5571 @cindex conversion function (logical)
5572
5573 Intrinsic implemented, documentation pending.
5574
5575 @table @asis
5576 @item @emph{Description}:
5577 @item @emph{Standard}:
5578 F95 and later
5579
5580 @item @emph{Class}:
5581 Elemental function
5582
5583 @item @emph{Syntax}:
5584 @item @emph{Arguments}:
5585 @item @emph{Return value}:
5586 @item @emph{Example}:
5587 @item @emph{Specific names}:
5588 @item @emph{See also}:
5589 @end table
5590
5591
5592
5593
5594 @node LSHIFT
5595 @section @code{LSHIFT} --- Left shift bits
5596 @findex @code{LSHIFT} 
5597 @cindex bit manipulation
5598
5599 Not yet implemented in GNU Fortran.
5600
5601 @table @asis
5602 @item @emph{Description}:
5603
5604 @item @emph{Standard}:
5605 GNU extension
5606
5607 @item @emph{Class}:
5608 Function
5609
5610 @item @emph{Syntax}:
5611 @item @emph{Arguments}:
5612 @item @emph{Return value}:
5613 @item @emph{Example}:
5614 @item @emph{Specific names}:
5615 @item @emph{See also}:
5616
5617 @end table
5618
5619
5620 @node LSTAT
5621 @section @code{LSTAT} --- Get file status
5622 @findex @code{LSTAT} intrinsic
5623 @cindex file system operations 
5624
5625 @table @asis
5626 @item @emph{Description}:
5627 @code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link, 
5628 then the link itself is statted, not the file that it refers to.
5629
5630 The elements in @code{BUFF} are the same as described by @ref{STAT}.
5631
5632 @item @emph{Standard}:
5633 GNU extension
5634
5635 @item @emph{Class}:
5636 Non-elemental subroutine
5637
5638 @item @emph{Syntax}:
5639 @code{CALL LSTAT(FILE,BUFF[,STATUS])}
5640
5641 @item @emph{Arguments}:
5642 @multitable @columnfractions .15 .80
5643 @item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
5644 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
5645 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
5646                         on success and a system specific error code otherwise.
5647 @end multitable
5648
5649 @item @emph{Example}:
5650 See @ref{STAT} for an example.
5651
5652 @item @emph{See also}:
5653 To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
5654 @end table
5655
5656
5657
5658 @node LTIME
5659 @section @code{LTIME} --- Convert time to local time info
5660 @findex @code{LTIME} 
5661 @cindex time function
5662
5663 Not yet implemented in GNU Fortran.
5664
5665 @table @asis
5666 @item @emph{Description}:
5667
5668 @item @emph{Standard}:
5669 GNU extension
5670
5671 @item @emph{Class}:
5672 Subroutine
5673
5674 @item @emph{Syntax}:
5675 @item @emph{Arguments}:
5676 @item @emph{Return value}:
5677 @item @emph{Example}:
5678 @item @emph{Specific names}:
5679 @item @emph{See also}:
5680
5681 @end table
5682
5683
5684
5685 @node MALLOC
5686 @section @code{MALLOC} --- Allocate dynamic memory
5687 @findex @code{MALLOC} intrinsic
5688 @cindex MALLOC
5689
5690 @table @asis
5691 @item @emph{Description}:
5692 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5693 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5694 is an extension intended to be used with Cray pointers, and is provided
5695 in GNU Fortran to allow the user to compile legacy code. For new code
5696 using Fortran 95 pointers, the memory allocation intrinsic is
5697 @code{ALLOCATE}.
5698
5699 @item @emph{Standard}:
5700 GNU extension
5701
5702 @item @emph{Class}:
5703 non-elemental function
5704
5705 @item @emph{Syntax}:
5706 @code{PTR = MALLOC(SIZE)}
5707
5708 @item @emph{Arguments}:
5709 @multitable @columnfractions .15 .80
5710 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5711 @end multitable
5712
5713 @item @emph{Return value}:
5714 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5715 variables of type @code{INTEGER(K)} have the same size as
5716 C pointers (@code{sizeof(void *)}).
5717
5718 @item @emph{Example}:
5719 The following example demonstrates the use of @code{MALLOC} and
5720 @code{FREE} with Cray pointers. This example is intended to run on
5721 32-bit systems, where the default integer kind is suitable to store
5722 pointers; on 64-bit systems, ptr_x would need to be declared as
5723 @code{integer(kind=8)}.
5724
5725 @smallexample
5726 program test_malloc
5727   integer i
5728   integer ptr_x
5729   real*8 x(*), z
5730   pointer(ptr_x,x)
5731
5732   ptr_x = malloc(20*8)
5733   do i = 1, 20
5734     x(i) = sqrt(1.0d0 / i)
5735   end do
5736   z = 0
5737   do i = 1, 20
5738     z = z + x(i)
5739     print *, z
5740   end do
5741   call free(ptr_x)
5742 end program test_malloc
5743 @end smallexample
5744
5745 @item @emph{See also}:
5746 @ref{FREE}
5747 @end table
5748
5749
5750 @node MATMUL
5751 @section @code{MATMUL} --- matrix multiplication
5752 @findex @code{MATMUL} intrinsic
5753 @cindex matrix operations
5754
5755 Intrinsic implemented, documentation pending.
5756
5757 @table @asis
5758 @item @emph{Description}:
5759 @item @emph{Standard}:
5760 F95 and later
5761
5762 @item @emph{Class}:
5763 Transformational function
5764
5765 @item @emph{Syntax}:
5766 @item @emph{Arguments}:
5767 @item @emph{Return value}:
5768 @item @emph{Example}:
5769 @item @emph{See also}:
5770 @end table
5771
5772
5773 @node MAX
5774 @section @code{MAX} --- Maximum value of an argument list
5775 @findex @code{MAX} intrinsic
5776 @cindex undocumented intrinsic 
5777
5778 Intrinsic implemented, documentation pending.
5779
5780 @table @asis
5781 @item @emph{Description}:
5782 @item @emph{Standard}:
5783 F77 and later
5784
5785 @item @emph{Class}:
5786 Elemental function
5787
5788 @item @emph{Syntax}:
5789 @item @emph{Arguments}:
5790 @item @emph{Return value}:
5791 @item @emph{Example}:
5792
5793 @item @emph{Specific names}:
5794 @multitable @columnfractions .20 .20 .20 .40
5795 @item Name             @tab Argument            @tab Return type         @tab Standard
5796 @item @code{MAX0(I)}   @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)}   @tab F77 and later
5797 @item @code{AMAX0(I)}  @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
5798 @item @code{MAX1(X)}   @tab @code{REAL(*) X}    @tab @code{INT(MAX(X))}  @tab F77 and later
5799 @item @code{AMAX1(X)}  @tab @code{REAL(4)    X} @tab @code{REAL(4)}      @tab F77 and later
5800 @item @code{DMAX1(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}      @tab F77 and later
5801 @end multitable
5802
5803 @item @emph{See also}:
5804 @ref{MAXLOC} @ref{MAXVAL}
5805 @end table
5806
5807
5808 @node MAXEXPONENT
5809 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
5810 @findex @code{MAXEXPONENT} intrinsic
5811 @cindex MAXEXPONENT
5812
5813 @table @asis
5814 @item @emph{Description}:
5815 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
5816 type of @code{X}.
5817
5818 @item @emph{Standard}:
5819 F95 and later
5820
5821 @item @emph{Class}:
5822 Inquiry function
5823
5824 @item @emph{Syntax}:
5825 @code{I = MAXEXPONENT(X)}
5826
5827 @item @emph{Arguments}:
5828 @multitable @columnfractions .15 .80
5829 @item @var{X} @tab shall be of type @code{REAL}.
5830 @end multitable
5831
5832 @item @emph{Return value}:
5833 The return value is of type @code{INTEGER} and of the default integer
5834 kind.
5835
5836 @item @emph{Example}:
5837 @smallexample
5838 program exponents
5839   real(kind=4) :: x
5840   real(kind=8) :: y
5841
5842   print *, minexponent(x), maxexponent(x)
5843   print *, minexponent(y), maxexponent(y)
5844 end program exponents
5845 @end smallexample
5846 @end table
5847
5848
5849 @node MAXLOC
5850 @section @code{MAXLOC} --- Location of the maximum value within an array
5851 @findex @code{MAXLOC} intrinsic
5852 @cindex undocumented intrinsic 
5853
5854 Intrinsic implemented, documentation pending.
5855
5856 @table @asis
5857 @item @emph{Description}:
5858 @item @emph{Standard}:
5859 F95 and later
5860
5861 @item @emph{Class}:
5862 Transformational function
5863
5864 @item @emph{Syntax}:
5865 @item @emph{Arguments}:
5866 @item @emph{Return value}:
5867 @item @emph{Example}:
5868 @item @emph{See also}:
5869 @ref{MAX}, @ref{MAXVAL}
5870 @end table
5871
5872
5873
5874 @node MAXVAL
5875 @section @code{MAXVAL} --- Maximum value of an array
5876 @findex @code{MAXVAL} intrinsic
5877 @cindex undocumented intrinsic 
5878
5879 Intrinsic implemented, documentation pending.
5880
5881 @table @asis
5882 @item @emph{Description}:
5883 @item @emph{Standard}:
5884
5885
5886 @item @emph{Class}:
5887 Transformational function
5888
5889 @item @emph{Syntax}:
5890 @item @emph{Arguments}:
5891 @item @emph{Return value}:
5892 @item @emph{Example}:
5893 @item @emph{Specific names}:
5894
5895 @item @emph{See also}:
5896 @ref{MAX}, @ref{MAXLOC}
5897 @end table
5898
5899
5900
5901
5902 @node MERGE
5903 @section @code{MERGE} --- Merge arrays
5904 @findex @code{MERGE} intrinsic
5905 @cindex undocumented intrinsic 
5906
5907 Intrinsic implemented, documentation pending.
5908
5909 @table @asis
5910 @item @emph{Description}:
5911 @item @emph{Standard}:
5912 F95 and later
5913
5914 @item @emph{Class}:
5915 elemental function
5916
5917 @item @emph{Syntax}:
5918 @item @emph{Arguments}:
5919 @item @emph{Return value}:
5920 @item @emph{Example}:
5921 @item @emph{Specific names}:
5922 @item @emph{See also}:
5923 @end table
5924
5925
5926 @node MIN
5927 @section @code{MIN} --- Minimum value of an argument list
5928 @findex @code{MIN} intrinsic
5929 @cindex undocumented intrinsic 
5930
5931 Intrinsic implemented, documentation pending.
5932
5933 @table @asis
5934 @item @emph{Description}:
5935 @item @emph{Standard}:
5936 F77 and later
5937
5938 @item @emph{Class}:
5939 Elemental function
5940
5941 @item @emph{Syntax}:
5942 @item @emph{Arguments}:
5943 @item @emph{Return value}:
5944 @item @emph{Example}:
5945
5946 @item @emph{Specific names}:
5947 @multitable @columnfractions .20 .20 .20 .40
5948 @item Name             @tab Argument            @tab Return type         @tab Standard
5949 @item @code{MIN0(I)}   @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)}   @tab F77 and later
5950 @item @code{AMIN0(I)}  @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
5951 @item @code{MIN1(X)}   @tab @code{REAL(*) X}    @tab @code{INT(MIN(X))}  @tab F77 and later
5952 @item @code{AMIN1(X)}  @tab @code{REAL(4)    X} @tab @code{REAL(4)}      @tab F77 and later
5953 @item @code{DMIN1(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}      @tab F77 and later
5954 @end multitable
5955
5956 @item @emph{See also}:
5957 @ref{MINLOC}, @ref{MINVAL}
5958 @end table
5959
5960 @node MINEXPONENT
5961 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
5962 @findex @code{MINEXPONENT} intrinsic
5963 @cindex MINEXPONENT
5964
5965 @table @asis
5966 @item @emph{Description}:
5967 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
5968 type of @code{X}.
5969
5970 @item @emph{Standard}:
5971 F95 and later
5972
5973 @item @emph{Class}:
5974 Inquiry function
5975
5976 @item @emph{Syntax}:
5977 @code{I = MINEXPONENT(X)}
5978
5979 @item @emph{Arguments}:
5980 @multitable @columnfractions .15 .80
5981 @item @var{X} @tab shall be of type @code{REAL}.
5982 @end multitable
5983
5984 @item @emph{Return value}:
5985 The return value is of type @code{INTEGER} and of the default integer
5986 kind.
5987
5988 @item @emph{Example}:
5989 See @code{MAXEXPONENT} for an example.
5990 @end table
5991
5992
5993 @node MINLOC
5994 @section @code{MINLOC} --- Location of the minimum value within an array
5995 @findex @code{MINLOC} intrinsic
5996 @cindex undocumented intrinsic 
5997
5998 Intrinsic implemented, documentation pending.
5999
6000 @table @asis
6001 @item @emph{Description}:
6002 @item @emph{Standard}:
6003 F95 and later
6004
6005 @item @emph{Class}:
6006 Transformational function
6007
6008 @item @emph{Syntax}:
6009 @item @emph{Arguments}:
6010 @item @emph{Return value}:
6011 @item @emph{Example}:
6012
6013 @item @emph{See also}:
6014 @ref{MIN}, @ref{MINVAL}
6015
6016 @end table
6017
6018
6019 @node MINVAL
6020 @section @code{MINVAL} --- Minimum value of an array
6021 @findex @code{MINVAL} intrinsic
6022 @cindex undocumented intrinsic 
6023
6024 Intrinsic implemented, documentation pending.
6025
6026 @table @asis
6027 @item @emph{Description}:
6028 @item @emph{Standard}:
6029 F95 and later
6030
6031 @item @emph{Class}:
6032 Transformational function
6033
6034 @item @emph{Syntax}:
6035 @item @emph{Arguments}:
6036 @item @emph{Return value}:
6037 @item @emph{Example}:
6038
6039 @item @emph{See also}:
6040 @ref{MIN}, @ref{MINLOC}
6041 @end table
6042
6043
6044
6045
6046 @node MOD
6047 @section @code{MOD} --- Remainder function
6048 @findex @code{MOD} intrinsic
6049 @findex @code{AMOD} intrinsic
6050 @findex @code{DMOD} intrinsic
6051 @cindex remainder
6052
6053 @table @asis
6054 @item @emph{Description}:
6055 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
6056 calculated as @code{A - (INT(A/P) * P)}.
6057
6058 @item @emph{Standard}:
6059 F77 and later
6060
6061 @item @emph{Class}:
6062 Elemental function
6063
6064 @item @emph{Syntax}:
6065 @code{X = MOD(A,P)}
6066
6067 @item @emph{Arguments}:
6068 @multitable @columnfractions .15 .80
6069 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6070 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
6071 equal to zero
6072 @end multitable
6073
6074 @item @emph{Return value}:
6075 The kind of the return value is the result of cross-promoting
6076 the kinds of the arguments.
6077
6078 @item @emph{Example}:
6079 @smallexample
6080 program test_mod
6081   print *, mod(17,3)
6082   print *, mod(17.5,5.5)
6083   print *, mod(17.5d0,5.5)
6084   print *, mod(17.5,5.5d0)
6085
6086   print *, mod(-17,3)
6087   print *, mod(-17.5,5.5)
6088   print *, mod(-17.5d0,5.5)
6089   print *, mod(-17.5,5.5d0)
6090
6091   print *, mod(17,-3)
6092   print *, mod(17.5,-5.5)
6093   print *, mod(17.5d0,-5.5)
6094   print *, mod(17.5,-5.5d0)
6095 end program test_mod
6096 @end smallexample
6097
6098 @item @emph{Specific names}:
6099 @multitable @columnfractions .20 .20 .20 .40
6100 @item Name             @tab Arguments      @tab Return type    @tab Standard
6101 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
6102 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
6103 @end multitable
6104 @end table
6105
6106
6107
6108 @node MODULO
6109 @section @code{MODULO} --- Modulo function
6110 @findex @code{MODULO} intrinsic
6111 @cindex modulo
6112
6113 @table @asis
6114 @item @emph{Description}:
6115 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
6116
6117 @item @emph{Standard}:
6118 F95 and later
6119
6120 @item @emph{Class}:
6121 Elemental function
6122
6123 @item @emph{Syntax}:
6124 @code{X = MODULO(A,P)}
6125
6126 @item @emph{Arguments}:
6127 @multitable @columnfractions .15 .80
6128 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6129 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
6130 @end multitable
6131
6132 @item @emph{Return value}:
6133 The type and kind of the result are those of the arguments.
6134 @table @asis
6135 @item If @var{A} and @var{P} are of type @code{INTEGER}:
6136 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
6137 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
6138 (exclusive).
6139 @item If @var{A} and @var{P} are of type @code{REAL}:
6140 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
6141 @end table
6142 In all cases, if @var{P} is zero the result is processor-dependent.
6143
6144 @item @emph{Example}:
6145 @smallexample
6146 program test_modulo
6147   print *, modulo(17,3)
6148   print *, modulo(17.5,5.5)
6149
6150   print *, modulo(-17,3)
6151   print *, modulo(-17.5,5.5)
6152
6153   print *, modulo(17,-3)
6154   print *, modulo(17.5,-5.5)
6155 end program test_mod
6156 @end smallexample
6157
6158 @end table
6159
6160
6161
6162 @node MVBITS
6163 @section @code{MVBITS} --- Move bits from one integer to another
6164 @findex @code{MVBITS} intrinsic
6165 @cindex bit operations
6166
6167 Intrinsic implemented, documentation pending.
6168
6169 @table @asis
6170 @item @emph{Description}:
6171 @item @emph{Standard}:
6172 F95 and later
6173
6174 @item @emph{Class}:
6175 Elemental subroutine
6176
6177 @item @emph{Syntax}:
6178 @item @emph{Arguments}:
6179 @item @emph{Return value}:
6180 @item @emph{Example}:
6181 @item @emph{See also}:
6182 @end table
6183
6184
6185
6186
6187 @node MOVE_ALLOC
6188 @section @code{MOVE_ALLOC} --- Move allocation from one object to another
6189 @findex @code{MOVE_ALLOC} intrinsic
6190 @cindex MOVE_ALLOC
6191
6192 @table @asis
6193 @item @emph{Description}:
6194 @code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
6195 @var{DEST}.  @var{SRC} will become deallocated in the process.
6196
6197 @item @emph{Standard}:
6198 F2003 and later
6199
6200 @item @emph{Class}:
6201 Subroutine
6202
6203 @item @emph{Syntax}:
6204 @code{CALL MOVE_ALLOC(SRC, DEST)}
6205
6206 @item @emph{Arguments}:
6207 @multitable @columnfractions .15 .80
6208 @item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be of any type and kind.
6209 @item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be of the same type, kind and rank as @var{SRC}
6210 @end multitable
6211
6212 @item @emph{Return value}:
6213 None
6214
6215 @item @emph{Example}:
6216 @smallexample
6217 program test_move_alloc
6218     integer, allocatable :: a(:), b(:)
6219
6220     allocate(a(3))
6221     a = [ 1, 2, 3 ]
6222     call move_alloc(a, b)
6223     print *, allocated(a), allocated(b)
6224     print *, b
6225 end program test_move_alloc
6226 @end smallexample
6227 @end table
6228
6229
6230
6231 @node NEAREST
6232 @section @code{NEAREST} --- Nearest representable number
6233 @findex @code{NEAREST} intrinsic
6234 @cindex processor-representable number
6235
6236 @table @asis
6237 @item @emph{Description}:
6238 @code{NEAREST(X, S)} returns the processor-representable number nearest
6239 to @code{X} in the direction indicated by the sign of @code{S}.
6240
6241 @item @emph{Standard}:
6242 F95 and later
6243
6244 @item @emph{Class}:
6245 Elemental function
6246
6247 @item @emph{Syntax}:
6248 @code{Y = NEAREST(X, S)}
6249
6250 @item @emph{Arguments}:
6251 @multitable @columnfractions .15 .80
6252 @item @var{X} @tab shall be of type @code{REAL}.
6253 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
6254 not equal to zero.
6255 @end multitable
6256
6257 @item @emph{Return value}:
6258 The return value is of the same type as @code{X}. If @code{S} is
6259 positive, @code{NEAREST} returns the processor-representable number
6260 greater than @code{X} and nearest to it. If @code{S} is negative,
6261 @code{NEAREST} returns the processor-representable number smaller than
6262 @code{X} and nearest to it.
6263
6264 @item @emph{Example}:
6265 @smallexample
6266 program test_nearest
6267   real :: x, y
6268   x = nearest(42.0, 1.0)
6269   y = nearest(42.0, -1.0)
6270   write (*,"(3(G20.15))") x, y, x - y
6271 end program test_nearest
6272 @end smallexample
6273 @end table
6274
6275
6276
6277 @node NEW_LINE
6278 @section @code{NEW_LINE} --- New line character
6279 @findex @code{NEW_LINE} intrinsic
6280 @findex @code{NEW_LINE} intrinsic
6281
6282 @table @asis
6283 @item @emph{Description}:
6284 @code{NEW_LINE(C)} returns the new-line character
6285
6286 @item @emph{Standard}:
6287 F2003 and later
6288
6289 @item @emph{Class}:
6290 Elemental function
6291
6292 @item @emph{Syntax}:
6293 @code{C = NEW_LINE(C)}
6294
6295 @item @emph{Arguments}:
6296 @multitable @columnfractions .15 .80
6297 @item @var{C}    @tab The argument shall be a scalar or array of the
6298                       type @code{CHARACTER}.
6299 @end multitable
6300
6301 @item @emph{Return value}:
6302 Returns a @var{CHARACTER} scalar of length one with the new-line character of
6303 the same kind as parameter @var{C}.
6304
6305 @item @emph{Example}:
6306 @smallexample
6307 program newline
6308   implicit none
6309   write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
6310 end program newline
6311 @end smallexample
6312 @end table
6313
6314
6315
6316 @node NINT
6317 @section @code{NINT} --- Nearest whole number
6318 @findex @code{NINT} intrinsic
6319 @findex @code{IDNINT} intrinsic
6320 @cindex whole number
6321
6322 @table @asis
6323 @item @emph{Description}:
6324 @code{NINT(X)} rounds its argument to the nearest whole number.
6325
6326 @item @emph{Standard}:
6327 F77 and later
6328
6329 @item @emph{Class}:
6330 Elemental function
6331
6332 @item @emph{Syntax}:
6333 @code{X = NINT(X)}
6334
6335 @item @emph{Arguments}:
6336 @multitable @columnfractions .15 .80
6337 @item @var{X}    @tab The type of the argument shall be @code{REAL}.
6338 @end multitable
6339
6340 @item @emph{Return value}:
6341 Returns @var{A} with the fractional portion of its magnitude eliminated by
6342 rounding to the nearest whole number and with its sign preserved,
6343 converted to an @code{INTEGER} of the default kind.
6344
6345 @item @emph{Example}:
6346 @smallexample
6347 program test_nint
6348   real(4) x4
6349   real(8) x8
6350   x4 = 1.234E0_4
6351   x8 = 4.321_8
6352   print *, nint(x4), idnint(x8)
6353 end program test_nint
6354 @end smallexample
6355
6356 @item @emph{Specific names}:
6357 @multitable @columnfractions .33 .33 .33
6358 @item Name             @tab Argument         @tab Standard
6359 @item @code{IDNINT(X)} @tab @code{REAL(8)}   @tab F95 and later
6360 @end multitable
6361
6362 @item @emph{See also}:
6363 @ref{CEILING}, @ref{FLOOR}
6364
6365 @end table
6366
6367
6368 @node NOT
6369 @section @code{NOT} --- Logical negation
6370 @findex @code{NOT} intrinsic
6371 @cindex logical operations
6372
6373 Intrinsic implemented, documentation pending.
6374
6375 @table @asis
6376 @item @emph{Description}:
6377 @item @emph{Standard}:
6378 F77 and later
6379
6380 @item @emph{Class}:
6381 Elemental function
6382
6383 @item @emph{Syntax}:
6384 @item @emph{Arguments}:
6385 @item @emph{Return value}:
6386 @item @emph{Example}:
6387 @item @emph{See also}:
6388 @end table
6389
6390
6391
6392
6393 @node NULL
6394 @section @code{NULL} --- Function that returns an disassociated pointer
6395 @findex @code{NULL} intrinsic
6396 @cindex undocumented intrinsic 
6397
6398 Intrinsic implemented, documentation pending.
6399
6400 @table @asis
6401 @item @emph{Description}:
6402 @item @emph{Standard}:
6403 F95 and later
6404
6405 @item @emph{Class}:
6406 Transformational function
6407
6408 @item @emph{Syntax}:
6409 @item @emph{Arguments}:
6410 @item @emph{Return value}:
6411 @item @emph{Example}:
6412 @item @emph{See also}:
6413 @ref{ASSOCIATED}
6414 @end table
6415
6416
6417
6418
6419 @node OR
6420 @section @code{OR} --- Bitwise logical OR
6421 @findex @code{OR} intrinsic
6422 @cindex bit operations
6423
6424 @table @asis
6425 @item @emph{Description}:
6426 Bitwise logical @code{OR}.
6427
6428 This intrinsic routine is provided for backwards compatibility with 
6429 GNU Fortran 77.  For integer arguments, programmers should consider
6430 the use of the @ref{IOR} intrinsic defined by the Fortran standard.
6431
6432 @item @emph{Standard}:
6433 GNU extension
6434
6435 @item @emph{Class}:
6436 Non-elemental function
6437
6438 @item @emph{Syntax}:
6439 @code{RESULT = OR(X, Y)}
6440
6441 @item @emph{Arguments}:
6442 @multitable @columnfractions .15 .80
6443 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6444 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6445 @end multitable
6446
6447 @item @emph{Return value}:
6448 The return type is either @code{INTEGER(*)} or @code{LOGICAL} 
6449 after cross-promotion of the arguments.
6450
6451 @item @emph{Example}:
6452 @smallexample
6453 PROGRAM test_or
6454   LOGICAL :: T = .TRUE., F = ..FALSE.
6455   INTEGER :: a, b
6456   DATA a / Z'F' /, b / Z'3' /
6457
6458   WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
6459   WRITE (*,*) OR(a, b)
6460 END PROGRAM
6461 @end smallexample
6462
6463 @item @emph{See also}:
6464 F95 elemental function: @ref{IOR}
6465 @end table
6466
6467
6468
6469
6470 @node PACK
6471 @section @code{PACK} --- Pack an array into an array of rank one
6472 @findex @code{PACK} intrinsic
6473 @cindex undocumented intrinsic 
6474
6475 Intrinsic implemented, documentation pending.
6476
6477 @table @asis
6478 @item @emph{Description}:
6479 @item @emph{Standard}:
6480 F95 and later
6481
6482 @item @emph{Class}:
6483 Transformational function
6484
6485 @item @emph{Syntax}:
6486 @item @emph{Arguments}:
6487 @item @emph{Return value}:
6488 @item @emph{Example}:
6489 @item @emph{Specific names}:
6490 @item @emph{See also}:
6491 @ref{UNPACK}
6492 @end table
6493
6494
6495
6496
6497 @node PERROR
6498 @section @code{PERROR} --- Print system error message
6499 @findex @code{PERROR} intrinsic
6500 @cindex undocumented intrinsic 
6501
6502 Intrinsic implemented, documentation pending.
6503
6504 @table @asis
6505 @item @emph{Description}:
6506 @item @emph{Standard}:
6507 GNU extension
6508
6509 @item @emph{Class}:
6510 Subroutine
6511
6512 @item @emph{Syntax}:
6513 @item @emph{Arguments}:
6514 @item @emph{Return value}:
6515 @item @emph{Example}:
6516 @item @emph{Specific names}:
6517 @item @emph{See also}:
6518 @ref{IERRNO}
6519 @end table
6520
6521
6522
6523
6524 @node PRECISION
6525 @section @code{PRECISION} --- Decimal precision of a real kind
6526 @findex @code{PRECISION} intrinsic
6527 @cindex PRECISION
6528
6529 @table @asis
6530 @item @emph{Description}:
6531 @code{PRECISION(X)} returns the decimal precision in the model of the
6532 type of @code{X}.
6533
6534 @item @emph{Standard}:
6535 F95 and later
6536
6537 @item @emph{Class}:
6538 Inquiry function
6539
6540 @item @emph{Syntax}:
6541 @code{I = PRECISION(X)}
6542
6543 @item @emph{Arguments}:
6544 @multitable @columnfractions .15 .80
6545 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6546 @end multitable
6547
6548 @item @emph{Return value}:
6549 The return value is of type @code{INTEGER} and of the default integer
6550 kind.
6551
6552 @item @emph{Example}:
6553 @smallexample
6554 program prec_and_range
6555   real(kind=4) :: x(2)
6556   complex(kind=8) :: y
6557
6558   print *, precision(x), range(x)
6559   print *, precision(y), range(y)
6560 end program prec_and_range
6561 @end smallexample
6562 @end table
6563
6564
6565
6566 @node PRESENT
6567 @section @code{PRESENT} --- Determine whether an optional argument is specified
6568 @findex @code{PRESENT} intrinsic
6569 @cindex undocumented intrinsic 
6570
6571 Intrinsic implemented, documentation pending.
6572
6573 @table @asis
6574 @item @emph{Description}:
6575 @item @emph{Standard}:
6576 F95 and later
6577
6578 @item @emph{Class}:
6579 Inquiry function
6580
6581 @item @emph{Syntax}:
6582 @item @emph{Arguments}:
6583 @item @emph{Return value}:
6584 @item @emph{Example}:
6585 @item @emph{See also}:
6586 @end table
6587
6588
6589
6590
6591 @node PRODUCT
6592 @section @code{PRODUCT} --- Product of array elements
6593 @findex @code{PRODUCT} intrinsic
6594 @cindex undocumented intrinsic 
6595
6596 Intrinsic implemented, documentation pending.
6597
6598 @table @asis
6599 @item @emph{Description}:
6600 @item @emph{Standard}:
6601 F95 and later
6602
6603 @item @emph{Class}:
6604 Transformational function
6605
6606 @item @emph{Syntax}:
6607 @item @emph{Arguments}:
6608 @item @emph{Return value}:
6609 @item @emph{Example}:
6610 @item @emph{Specific names}:
6611 @item @emph{See also}:
6612 @ref{SUM}
6613 @end table
6614
6615
6616
6617
6618 @node RADIX
6619 @section @code{RADIX} --- Base of a model number
6620 @findex @code{RADIX} intrinsic
6621 @cindex base
6622
6623 @table @asis
6624 @item @emph{Description}:
6625 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
6626
6627 @item @emph{Standard}:
6628 F95 and later
6629
6630 @item @emph{Class}:
6631 Inquiry function
6632
6633 @item @emph{Syntax}:
6634 @code{R = RADIX(X)}
6635
6636 @item @emph{Arguments}:
6637 @multitable @columnfractions .15 .80
6638 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
6639 @end multitable
6640
6641 @item @emph{Return value}:
6642 The return value is a scalar of type @code{INTEGER} and of the default
6643 integer kind.
6644
6645 @item @emph{Example}:
6646 @smallexample
6647 program test_radix
6648   print *, "The radix for the default integer kind is", radix(0)
6649   print *, "The radix for the default real kind is", radix(0.0)
6650 end program test_radix
6651 @end smallexample
6652
6653 @end table
6654
6655
6656
6657 @node RANDOM_NUMBER
6658 @section @code{RANDOM_NUMBER} --- Pseudo-random number
6659 @findex @code{RANDOM_NUMBER} intrinsic
6660 @cindex random numbers
6661
6662 Intrinsic implemented, documentation pending.
6663
6664 @table @asis
6665 @item @emph{Description}:
6666 @item @emph{Standard}:
6667 F95 and later
6668
6669 @item @emph{Class}:
6670 Elemental subroutine
6671
6672 @item @emph{Syntax}:
6673 @item @emph{Arguments}:
6674 @item @emph{Return value}:
6675 @item @emph{Example}:
6676 @item @emph{See also}:
6677 @ref{RANDOM_SEED}
6678 @end table
6679
6680
6681
6682
6683 @node RANDOM_SEED
6684 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6685 @findex @code{RANDOM_SEED} intrinsic
6686 @cindex random numbers
6687
6688 Intrinsic implemented, documentation pending.
6689
6690 @table @asis
6691 @item @emph{Description}:
6692 @item @emph{Standard}:
6693 F95 and later
6694
6695 @item @emph{Class}:
6696 Subroutine
6697
6698 @item @emph{Syntax}:
6699 @item @emph{Arguments}:
6700 @item @emph{Return value}:
6701 @item @emph{Example}:
6702 @item @emph{See also}:
6703 @ref{RANDOM_NUMBER}
6704 @end table
6705
6706
6707
6708
6709 @node RAND
6710 @section @code{RAND} --- Real pseudo-random number
6711 @findex @code{RAND} intrinsic
6712 @findex @code{RAN} intrinsic
6713 @cindex random number
6714
6715 @table @asis
6716 @item @emph{Description}:
6717 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6718 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6719 in the current sequence is returned; if @var{FLAG} is 1, the generator
6720 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6721 it is used as a new seed with @code{SRAND}.
6722
6723 @item @emph{Standard}:
6724 GNU extension
6725
6726 @item @emph{Class}:
6727 non-elemental function
6728
6729 @item @emph{Syntax}:
6730 @code{X = RAND(FLAG)}
6731
6732 @item @emph{Arguments}:
6733 @multitable @columnfractions .15 .80
6734 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6735 @end multitable
6736
6737 @item @emph{Return value}:
6738 The return value is of @code{REAL} type and the default kind.
6739
6740 @item @emph{Example}:
6741 @smallexample
6742 program test_rand
6743   integer,parameter :: seed = 86456
6744   
6745   call srand(seed)
6746   print *, rand(), rand(), rand(), rand()
6747   print *, rand(seed), rand(), rand(), rand()
6748 end program test_rand
6749 @end smallexample
6750
6751 @item @emph{Note}:
6752 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6753 provided as an alias for @code{RAND}.
6754
6755 @item @emph{See also}:
6756 @ref{SRAND}, @ref{RANDOM_NUMBER}
6757
6758 @end table
6759
6760
6761
6762 @node RANGE
6763 @section @code{RANGE} --- Decimal exponent range of a real kind
6764 @findex @code{RANGE} intrinsic
6765 @cindex RANGE
6766
6767 @table @asis
6768 @item @emph{Description}:
6769 @code{RANGE(X)} returns the decimal exponent range in the model of the
6770 type of @code{X}.
6771
6772 @item @emph{Standard}:
6773 F95 and later
6774
6775 @item @emph{Class}:
6776 Inquiry function
6777
6778 @item @emph{Syntax}:
6779 @code{I = RANGE(X)}
6780
6781 @item @emph{Arguments}:
6782 @multitable @columnfractions .15 .80
6783 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6784 @end multitable
6785
6786 @item @emph{Return value}:
6787 The return value is of type @code{INTEGER} and of the default integer
6788 kind.
6789
6790 @item @emph{Example}:
6791 See @code{PRECISION} for an example.
6792 @end table
6793
6794
6795
6796 @node RAN
6797 @section @code{RAN} --- Real pseudo-random number
6798 @findex @code{RAN} intrinsic
6799 @cindex random number
6800
6801 @table @asis
6802 @item @emph{Standard}:
6803 GNU extension
6804
6805 @item @emph{See also}:
6806 @ref{RAND}, @ref{RANDOM_NUMBER}
6807 @end table
6808
6809
6810
6811 @node REAL
6812 @section @code{REAL} --- Convert to real type 
6813 @findex @code{REAL} intrinsic
6814 @findex @code{REALPART} intrinsic
6815 @cindex true values
6816
6817 @table @asis
6818 @item @emph{Description}:
6819 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type.  The
6820 @code{REALPART(X)} function is provided for compatibility with @command{g77},
6821 and its use is strongly discouraged.
6822
6823 @item @emph{Standard}:
6824 F77 and later
6825
6826 @item @emph{Class}:
6827 Elemental function
6828
6829 @item @emph{Syntax}:
6830 @multitable @columnfractions .30 .80
6831 @item @code{X = REAL(X)}
6832 @item @code{X = REAL(X, KIND)}
6833 @item @code{X = REALPART(Z)}
6834 @end multitable
6835
6836 @item @emph{Arguments}:
6837 @multitable @columnfractions .15 .80
6838 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or  
6839 @code{COMPLEX(*)}.
6840 @item @var{KIND}  @tab (Optional) @var{KIND} shall be a scalar integer.
6841 @end multitable
6842
6843 @item @emph{Return value}:
6844 These functions return a @code{REAL(*)} variable or array under
6845 the following rules: 
6846
6847 @table @asis
6848 @item (A)
6849 @code{REAL(X)} is converted to a default real type if @var{X} is an 
6850 integer or real variable.
6851 @item (B)
6852 @code{REAL(X)} is converted to a real type with the kind type parameter
6853 of @var{X} if @var{X} is a complex variable.
6854 @item (C)
6855 @code{REAL(X, KIND)} is converted to a real type with kind type
6856 parameter @var{KIND} if @var{X} is a complex, integer, or real
6857 variable.
6858 @end table
6859
6860 @item @emph{Example}:
6861 @smallexample
6862 program test_real
6863   complex :: x = (1.0, 2.0)
6864   print *, real(x), real(x,8), realpart(x)
6865 end program test_real
6866 @end smallexample
6867
6868 @item @emph{See also}:
6869 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
6870
6871 @end table
6872
6873
6874 @node RENAME
6875 @section @code{RENAME} --- Rename a file
6876 @findex @code{RENAME} intrinsic
6877 @cindex file system operations
6878
6879 Intrinsic implemented, documentation pending.
6880
6881 @table @asis
6882 @item @emph{Description}:
6883 @item @emph{Standard}:
6884 GNU extension
6885
6886 @item @emph{Class}:
6887 Subroutine
6888
6889 @item @emph{Syntax}:
6890 @item @emph{Arguments}:
6891 @item @emph{Return value}:
6892 @item @emph{Example}:
6893 @item @emph{See also}:
6894 @end table
6895
6896
6897
6898
6899 @node REPEAT
6900 @section @code{REPEAT} --- Repeated string concatenation 
6901 @findex @code{REPEAT} intrinsic
6902 @cindex string manipulation
6903
6904 Intrinsic implemented, documentation pending.
6905
6906 @table @asis
6907 @item @emph{Description}:
6908 @item @emph{Standard}:
6909 F95 and later
6910
6911 @item @emph{Class}:
6912 Transformational function
6913
6914 @item @emph{Syntax}:
6915 @item @emph{Arguments}:
6916 @item @emph{Return value}:
6917 @item @emph{Example}:
6918 @item @emph{See also}:
6919 @end table
6920
6921
6922
6923
6924 @node RESHAPE
6925 @section @code{RESHAPE} --- Function to reshape an array
6926 @findex @code{RESHAPE} intrinsic
6927 @cindex array manipulation
6928
6929 Intrinsic implemented, documentation pending.
6930
6931 @table @asis
6932 @item @emph{Description}:
6933 @item @emph{Standard}:
6934 F95 and later
6935
6936 @item @emph{Class}:
6937 Transformational function
6938
6939 @item @emph{Syntax}:
6940 @item @emph{Arguments}:
6941 @item @emph{Return value}:
6942 @item @emph{Example}:
6943 @item @emph{See also}:
6944 @ref{SHAPE}
6945 @end table
6946
6947
6948
6949 @node RRSPACING
6950 @section @code{RRSPACING} --- Reciprocal of the relative spacing
6951 @findex @code{RRSPACING} intrinsic
6952
6953 @table @asis
6954 @item @emph{Description}:
6955 @code{RRSPACING(X)} returns the  reciprocal of the relative spacing of
6956 model numbers near @var{X}.
6957
6958 @item @emph{Standard}:
6959 F95 and later
6960
6961 @item @emph{Class}:
6962 Elemental function
6963
6964 @item @emph{Syntax}:
6965 @code{Y = RRSPACING(X)}
6966
6967 @item @emph{Arguments}:
6968 @multitable @columnfractions .15 .80
6969 @item @var{X} @tab shall be of type @code{REAL}.
6970 @end multitable
6971
6972 @item @emph{Return value}:
6973 The return value is of the same type and kind as @var{X}.
6974 The value returned is equal to
6975 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
6976
6977 @end table
6978
6979
6980
6981 @node RSHIFT
6982 @section @code{RSHIFT} --- Right shift bits
6983 @findex @code{RSHIFT} 
6984 @cindex bit manipulation
6985
6986 Not yet implemented in GNU Fortran.
6987
6988 @table @asis
6989 @item @emph{Description}:
6990
6991 @item @emph{Standard}:
6992 GNU extension
6993
6994 @item @emph{Class}:
6995 Function
6996
6997 @item @emph{Syntax}:
6998 @item @emph{Arguments}:
6999 @item @emph{Return value}:
7000 @item @emph{Example}:
7001 @item @emph{See also}:
7002
7003 @end table
7004
7005
7006
7007 @node SCALE
7008 @section @code{SCALE} --- Scale a real value
7009 @findex @code{SCALE} intrinsic
7010
7011 @table @asis
7012 @item @emph{Description}:
7013 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
7014
7015 @item @emph{Standard}:
7016 F95 and later
7017
7018 @item @emph{Class}:
7019 Elemental function
7020
7021 @item @emph{Syntax}:
7022 @code{Y = SCALE(X, I)}
7023
7024 @item @emph{Arguments}:
7025 @multitable @columnfractions .15 .80
7026 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
7027 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
7028 @end multitable
7029
7030 @item @emph{Return value}:
7031 The return value is of the same type and kind as @var{X}.
7032 Its value is @code{X * RADIX(X)**I}.
7033
7034 @item @emph{Example}:
7035 @smallexample
7036 program test_scale
7037   real :: x = 178.1387e-4
7038   integer :: i = 5
7039   print *, scale(x,i), x*radix(x)**i
7040 end program test_scale
7041 @end smallexample
7042
7043 @end table
7044
7045
7046 @node SCAN
7047 @section @code{SCAN} --- Scan a string for the presence of a set of characters
7048 @findex @code{SCAN} intrinsic
7049 @cindex string manipulation
7050
7051 Intrinsic implemented, documentation pending.
7052
7053 @table @asis
7054 @item @emph{Description}:
7055 @item @emph{Standard}:
7056 F95 and later
7057
7058 @item @emph{Class}:
7059 Elemental function
7060
7061 @item @emph{Syntax}:
7062 @item @emph{Arguments}:
7063 @item @emph{Return value}:
7064 @item @emph{Example}:
7065 @item @emph{See also}:
7066 @end table
7067
7068
7069
7070
7071 @node SECNDS
7072 @section @code{SECNDS} --- Time function
7073 @findex @code{SECNDS} intrinsic
7074 @cindex SECNDS
7075
7076 @table @asis
7077 @item @emph{Description}:
7078 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
7079 @var{X} is a reference time, also in seconds. If this is zero, the time in
7080 seconds from midnight is returned. This function is non-standard and its
7081 use is discouraged.
7082
7083 @item @emph{Standard}:
7084 GNU extension
7085
7086 @item @emph{Class}:
7087 function
7088
7089 @item @emph{Syntax}:
7090 @code{T = SECNDS (X)}
7091
7092 @item @emph{Arguments}:
7093 @multitable @columnfractions .15 .80
7094 @item Name        @tab Type
7095 @item @var{T}     @tab REAL(4)
7096 @item @var{X}     @tab REAL(4)
7097 @end multitable
7098
7099 @item @emph{Return value}:
7100 None
7101
7102 @item @emph{Example}:
7103 @smallexample
7104 program test_secnds
7105     real(4) :: t1, t2
7106     print *, secnds (0.0)   ! seconds since midnight
7107     t1 = secnds (0.0)       ! reference time
7108     do i = 1, 10000000      ! do something
7109     end do
7110     t2 = secnds (t1)        ! elapsed time
7111     print *, "Something took ", t2, " seconds."
7112 end program test_secnds
7113 @end smallexample
7114 @end table
7115
7116
7117
7118 @node SELECTED_INT_KIND
7119 @section @code{SELECTED_INT_KIND} --- Choose integer kind
7120 @findex @code{SELECTED_INT_KIND} intrinsic
7121 @cindex integer kind
7122
7123 @table @asis
7124 @item @emph{Description}:
7125 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
7126 type that can represent all values ranging from @math{-10^I} (exclusive)
7127 to @math{10^I} (exclusive). If there is no integer kind that accommodates
7128 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
7129
7130 @item @emph{Standard}:
7131 F95 and later
7132
7133 @item @emph{Class}:
7134 Transformational function
7135
7136 @item @emph{Syntax}:
7137 @multitable @columnfractions .30 .80
7138 @item @code{J = SELECTED_INT_KIND(I)}
7139 @end multitable
7140
7141 @item @emph{Arguments}:
7142 @multitable @columnfractions .15 .80
7143 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
7144 @end multitable
7145
7146 @item @emph{Example}:
7147 @smallexample
7148 program large_integers
7149   integer,parameter :: k5 = selected_int_kind(5)
7150   integer,parameter :: k15 = selected_int_kind(15)
7151   integer(kind=k5) :: i5
7152   integer(kind=k15) :: i15
7153
7154   print *, huge(i5), huge(i15)
7155
7156   ! The following inequalities are always true
7157   print *, huge(i5) >= 10_k5**5-1
7158   print *, huge(i15) >= 10_k15**15-1
7159 end program large_integers
7160 @end smallexample
7161 @end table
7162
7163
7164
7165 @node SELECTED_REAL_KIND
7166 @section @code{SELECTED_REAL_KIND} --- Choose real kind
7167 @findex @code{SELECTED_REAL_KIND} intrinsic
7168 @cindex real kind
7169
7170 @table @asis
7171 @item @emph{Description}:
7172 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
7173 with decimal precision greater of at least @code{P} digits and exponent
7174 range greater at least @code{R}. 
7175
7176 @item @emph{Standard}:
7177 F95 and later
7178
7179 @item @emph{Class}:
7180 Transformational function
7181
7182 @item @emph{Syntax}:
7183 @multitable @columnfractions .30 .80
7184 @item @code{I = SELECTED_REAL_KIND(P,R)}
7185 @end multitable
7186
7187 @item @emph{Arguments}:
7188 @multitable @columnfractions .15 .80
7189 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7190 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7191 @end multitable
7192 At least one argument shall be present.
7193
7194 @item @emph{Return value}:
7195
7196 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
7197 a real data type with decimal precision of at least @code{P} digits and a
7198 decimal exponent range of at least @code{R}. If more than one real data
7199 type meet the criteria, the kind of the data type with the smallest
7200 decimal precision is returned. If no real data type matches the criteria,
7201 the result is
7202 @table @asis
7203 @item -1 if the processor does not support a real data type with a
7204 precision greater than or equal to @code{P}
7205 @item -2 if the processor does not support a real type with an exponent
7206 range greater than or equal to @code{R}
7207 @item -3 if neither is supported.
7208 @end table
7209
7210 @item @emph{Example}:
7211 @smallexample
7212 program real_kinds
7213   integer,parameter :: p6 = selected_real_kind(6)
7214   integer,parameter :: p10r100 = selected_real_kind(10,100)
7215   integer,parameter :: r400 = selected_real_kind(r=400)
7216   real(kind=p6) :: x
7217   real(kind=p10r100) :: y
7218   real(kind=r400) :: z
7219
7220   print *, precision(x), range(x)
7221   print *, precision(y), range(y)
7222   print *, precision(z), range(z)
7223 end program real_kinds
7224 @end smallexample
7225 @end table
7226
7227
7228
7229 @node SET_EXPONENT
7230 @section @code{SET_EXPONENT} --- Set the exponent of the model
7231 @findex @code{SET_EXPONENT} intrinsic
7232 @cindex exponent
7233
7234 @table @asis
7235 @item @emph{Description}:
7236 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
7237 is that that of @var{X} and whose exponent part if @var{I}.
7238
7239 @item @emph{Standard}:
7240 F95 and later
7241
7242 @item @emph{Class}:
7243 Elemental function
7244
7245 @item @emph{Syntax}:
7246 @code{Y = SET_EXPONENT(X, I)}
7247
7248 @item @emph{Arguments}:
7249 @multitable @columnfractions .15 .80
7250 @item @var{X} @tab shall be of type @code{REAL}.
7251 @item @var{I} @tab shall be of type @code{INTEGER}.
7252 @end multitable
7253
7254 @item @emph{Return value}:
7255 The return value is of the same type and kind as @var{X}.
7256 The real number whose fractional part
7257 is that that of @var{X} and whose exponent part if @var{I} is returned;
7258 it is @code{FRACTION(X) * RADIX(X)**I}.
7259
7260 @item @emph{Example}:
7261 @smallexample
7262 program test_setexp
7263   real :: x = 178.1387e-4
7264   integer :: i = 17
7265   print *, set_exponent(x), fraction(x) * radix(x)**i
7266 end program test_setexp
7267 @end smallexample
7268
7269 @end table
7270
7271
7272
7273 @node SHAPE
7274 @section @code{SHAPE} --- Determine the shape of an array
7275 @findex @code{SHAPE} intrinsic
7276 @cindex array manipulation
7277
7278 Intrinsic implemented, documentation pending.
7279
7280 @table @asis
7281 @item @emph{Description}:
7282 @item @emph{Standard}:
7283 F95 and later
7284
7285 @item @emph{Class}:
7286 Inquiry function
7287
7288 @item @emph{Syntax}:
7289 @item @emph{Arguments}:
7290 @item @emph{Return value}:
7291 @item @emph{Example}:
7292 @item @emph{See also}:
7293 @ref{RESHAPE}
7294 @end table
7295
7296
7297
7298
7299 @node SIGN
7300 @section @code{SIGN} --- Sign copying function
7301 @findex @code{SIGN} intrinsic
7302 @findex @code{ISIGN} intrinsic
7303 @findex @code{DSIGN} intrinsic
7304 @cindex sign copying
7305
7306 @table @asis
7307 @item @emph{Description}:
7308 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
7309
7310 @item @emph{Standard}:
7311 F77 and later
7312
7313 @item @emph{Class}:
7314 Elemental function
7315
7316 @item @emph{Syntax}:
7317 @code{X = SIGN(A,B)}
7318
7319 @item @emph{Arguments}:
7320 @multitable @columnfractions .15 .80
7321 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
7322 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
7323 @end multitable
7324
7325 @item @emph{Return value}:
7326 The kind of the return value is that of @var{A} and @var{B}.
7327 If @math{B\ge 0} then the result is @code{ABS(A)}, else
7328 it is @code{-ABS(A)}.
7329
7330 @item @emph{Example}:
7331 @smallexample
7332 program test_sign
7333   print *, sign(-12,1)
7334   print *, sign(-12,0)
7335   print *, sign(-12,-1)
7336
7337   print *, sign(-12.,1.)
7338   print *, sign(-12.,0.)
7339   print *, sign(-12.,-1.)
7340 end program test_sign
7341 @end smallexample
7342
7343 @item @emph{Specific names}:
7344 @multitable @columnfractions .20 .20 .20 .40
7345 @item Name              @tab Arguments      @tab Return type    @tab Standard
7346 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
7347 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
7348 @end multitable
7349 @end table
7350
7351
7352
7353 @node SIGNAL
7354 @section @code{SIGNAL} --- Signal handling subroutine (or function)
7355 @findex @code{SIGNAL} intrinsic
7356 @cindex SIGNAL subroutine 
7357
7358 @table @asis
7359 @item @emph{Description}:
7360 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
7361 @var{HANDLER} to be executed with a single integer argument when signal
7362 @var{NUMBER} occurs.  If @var{HANDLER} is an integer, it can be used to
7363 turn off handling of signal @var{NUMBER} or revert to its default
7364 action.  See @code{signal(2)}.
7365
7366 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
7367 is supplied, it is set to the value returned by @code{signal(2)}.
7368
7369 @item @emph{Standard}:
7370 GNU extension
7371
7372 @item @emph{Class}:
7373 subroutine, non-elemental function
7374
7375 @item @emph{Syntax}:
7376 @multitable @columnfractions .30 .80
7377 @item @code{CALL ALARM(NUMBER, HANDLER)}
7378 @item @code{CALL ALARM(NUMBER, HANDLER, STATUS)}
7379 @item @code{STATUS = ALARM(NUMBER, HANDLER)}
7380 @end multitable
7381
7382 @item @emph{Arguments}:
7383 @multitable @columnfractions .15 .80
7384 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
7385 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
7386 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
7387 @code{INTEGER}. It is @code{INTENT(IN)}.
7388 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
7389 integer. It has @code{INTENT(OUT)}.
7390 @end multitable
7391
7392 @item @emph{Return value}:
7393 The @code{SIGNAL} functions returns the value returned by @code{signal(2)}.
7394
7395 @item @emph{Example}:
7396 @smallexample
7397 program test_signal
7398   intrinsic signal
7399   external handler_print
7400
7401   call signal (12, handler_print)
7402   call signal (10, 1)
7403
7404   call sleep (30)
7405 end program test_signal
7406 @end smallexample
7407 @end table
7408
7409
7410
7411
7412 @node SIN
7413 @section @code{SIN} --- Sine function 
7414 @findex @code{SIN} intrinsic
7415 @findex @code{DSIN} intrinsic
7416 @findex @code{ZSIN} intrinsic
7417 @findex @code{CDSIN} intrinsic
7418 @cindex trigonometric functions
7419
7420 @table @asis
7421 @item @emph{Description}:
7422 @code{SIN(X)} computes the sine of @var{X}.
7423
7424 @item @emph{Standard}:
7425 F77 and later
7426
7427 @item @emph{Class}:
7428 Elemental function
7429
7430 @item @emph{Syntax}:
7431 @code{X = SIN(X)}
7432
7433 @item @emph{Arguments}:
7434 @multitable @columnfractions .15 .80
7435 @item @var{X} @tab The type shall be @code{REAL(*)} or
7436 @code{COMPLEX(*)}.
7437 @end multitable
7438
7439 @item @emph{Return value}:
7440 The return value has same type and kind as @var{X}.
7441
7442 @item @emph{Example}:
7443 @smallexample
7444 program test_sin
7445   real :: x = 0.0
7446   x = sin(x)
7447 end program test_sin
7448 @end smallexample
7449
7450 @item @emph{Specific names}:
7451 @multitable @columnfractions .20 .20 .20 .40
7452 @item Name            @tab Argument          @tab Return type       @tab Standard
7453 @item @code{DSIN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
7454 @item @code{CSIN(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
7455 @item @code{ZSIN(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
7456 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
7457 @end multitable
7458
7459 @item @emph{See also}:
7460 @ref{ASIN}
7461 @end table
7462
7463
7464
7465 @node SINH
7466 @section @code{SINH} --- Hyperbolic sine function 
7467 @findex @code{SINH} intrinsic
7468 @findex @code{DSINH} intrinsic
7469 @cindex hyperbolic sine
7470
7471 @table @asis
7472 @item @emph{Description}:
7473 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
7474
7475 @item @emph{Standard}:
7476 F95 and later
7477
7478 @item @emph{Class}:
7479 Elemental function
7480
7481 @item @emph{Syntax}:
7482 @code{X = SINH(X)}
7483
7484 @item @emph{Arguments}:
7485 @multitable @columnfractions .15 .80
7486 @item @var{X} @tab The type shall be @code{REAL(*)}.
7487 @end multitable
7488
7489 @item @emph{Return value}:
7490 The return value is of type @code{REAL(*)}.
7491
7492 @item @emph{Example}:
7493 @smallexample
7494 program test_sinh
7495   real(8) :: x = - 1.0_8
7496   x = sinh(x)
7497 end program test_sinh
7498 @end smallexample
7499
7500 @item @emph{Specific names}:
7501 @multitable @columnfractions .20 .20 .20 .40
7502 @item Name            @tab Argument          @tab Return type       @tab Standard
7503 @item @code{DSINH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7504 @end multitable
7505
7506 @item @emph{See also}:
7507 @ref{ASINH}
7508 @end table
7509
7510
7511
7512 @node SIZE
7513 @section @code{SIZE} --- Determine the size of an array
7514 @findex @code{SIZE} intrinsic
7515 @cindex array manipulation
7516
7517 Intrinsic implemented, documentation pending.
7518
7519 @table @asis
7520 @item @emph{Description}:
7521 @item @emph{Standard}:
7522 F95 and later
7523
7524 @item @emph{Class}:
7525 Inquiry function
7526
7527 @item @emph{Syntax}:
7528 @item @emph{Arguments}:
7529 @item @emph{Return value}:
7530 @item @emph{Example}:
7531 @item @emph{See also}:
7532 @end table
7533
7534
7535
7536 @node SNGL
7537 @section @code{SNGL} --- Convert double precision real to default real
7538 @findex @code{SNGL} intrinsic
7539 @cindex conversion function (real)
7540
7541 @table @asis
7542 @item @emph{Description}:
7543 @code{SNGL(A)} converts the double precision real @var{A}
7544 to a default real value. This is an archaic form of @code{REAL}
7545 that is specific to one type for @var{A}.
7546
7547 @item @emph{Standard}:
7548 GNU extension
7549
7550 @item @emph{Class}:
7551 function
7552
7553 @item @emph{Syntax}:
7554 @code{X = SNGL(A)}
7555
7556 @item @emph{Arguments}:
7557 @multitable @columnfractions .15 .80
7558 @item @var{A} @tab The type shall be a double precision @code{REAL}.
7559 @end multitable
7560
7561 @item @emph{Return value}:
7562 The return value is of type default @code{REAL}.
7563
7564 @item @emph{See also}:
7565 @ref{DBLE}
7566 @end table
7567
7568
7569
7570 @node SPACING
7571 @section @code{SPACING} --- Smallest distance between two numbers of a given type
7572 @findex @code{SPACING} intrinsic
7573 @cindex undocumented intrinsic 
7574
7575 Intrinsic implemented, documentation pending.
7576
7577 @table @asis
7578 @item @emph{Description}:
7579 @item @emph{Standard}:
7580 F95 and later
7581
7582 @item @emph{Class}:
7583 Elemental function
7584
7585 @item @emph{Syntax}:
7586 @item @emph{Arguments}:
7587 @item @emph{Return value}:
7588 @item @emph{Example}:
7589 @item @emph{See also}:
7590 @end table
7591
7592
7593
7594
7595 @node SPREAD
7596 @section @code{SPREAD} --- Add a dimension to an array
7597 @findex @code{SPREAD} intrinsic
7598 @cindex array manipulation
7599
7600 Intrinsic implemented, documentation pending.
7601
7602 @table @asis
7603 @item @emph{Description}:
7604 @item @emph{Standard}:
7605 F95 and later
7606
7607 @item @emph{Class}:
7608 Transformational function
7609
7610 @item @emph{Syntax}:
7611 @item @emph{Arguments}:
7612 @item @emph{Return value}:
7613 @item @emph{Example}:
7614 @item @emph{See also}:
7615 @end table
7616
7617
7618
7619
7620 @node SQRT
7621 @section @code{SQRT} --- Square-root function
7622 @findex @code{SQRT} intrinsic
7623 @findex @code{DSQRT} intrinsic
7624 @findex @code{CSQRT} intrinsic
7625 @findex @code{ZSQRT} intrinsic
7626 @findex @code{CDSQRT} intrinsic
7627 @cindex square-root
7628
7629 @table @asis
7630 @item @emph{Description}:
7631 @code{SQRT(X)} computes the square root of @var{X}.
7632
7633 @item @emph{Standard}:
7634 F77 and later
7635
7636 @item @emph{Class}:
7637 Elemental function
7638
7639 @item @emph{Syntax}:
7640 @code{X = SQRT(X)}
7641
7642 @item @emph{Arguments}:
7643 @multitable @columnfractions .15 .80
7644 @item @var{X} @tab The type shall be @code{REAL(*)} or
7645 @code{COMPLEX(*)}.
7646 @end multitable
7647
7648 @item @emph{Return value}:
7649 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
7650 The kind type parameter is the same as @var{X}.
7651
7652 @item @emph{Example}:
7653 @smallexample
7654 program test_sqrt
7655   real(8) :: x = 2.0_8
7656   complex :: z = (1.0, 2.0)
7657   x = sqrt(x)
7658   z = sqrt(z)
7659 end program test_sqrt
7660 @end smallexample
7661
7662 @item @emph{Specific names}:
7663 @multitable @columnfractions .20 .20 .20 .40
7664 @item Name             @tab Argument             @tab Return type          @tab Standard
7665 @item @code{DSQRT(X)}  @tab @code{REAL(8) X}     @tab @code{REAL(8)}       @tab F95 and later
7666 @item @code{CSQRT(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab F95 and later
7667 @item @code{ZSQRT(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab GNU extension
7668 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab GNU extension
7669 @end multitable
7670 @end table
7671
7672
7673
7674 @node SRAND
7675 @section @code{SRAND} --- Reinitialize the random number generator
7676 @findex @code{SRAND} intrinsic
7677 @cindex random number
7678
7679 @table @asis
7680 @item @emph{Description}:
7681 @code{SRAND} reinitializes the pseudo-random number generator
7682 called by @code{RAND} and @code{IRAND}. The new seed used by the
7683 generator is specified by the required argument @var{SEED}.
7684
7685 @item @emph{Standard}:
7686 GNU extension
7687
7688 @item @emph{Class}:
7689 non-elemental subroutine
7690
7691 @item @emph{Syntax}:
7692 @code{CALL SRAND(SEED)}
7693
7694 @item @emph{Arguments}:
7695 @multitable @columnfractions .15 .80
7696 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7697 @end multitable
7698
7699 @item @emph{Return value}:
7700 Does not return.
7701
7702 @item @emph{Example}:
7703 See @code{RAND} and @code{IRAND} for examples.
7704
7705 @item @emph{Notes}:
7706 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7707 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7708 to generate pseudo-random numbers. Please note that in
7709 GNU Fortran, these two sets of intrinsics (@code{RAND},
7710 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7711 @code{RANDOM_SEED} on the other hand) access two independent
7712 pseudo-random number generators.
7713
7714 @item @emph{See also}:
7715 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7716
7717 @end table
7718
7719
7720 @node STAT
7721 @section @code{STAT} --- Get file status
7722 @findex @code{STAT} intrinsic
7723 @cindex file system operations
7724
7725 @table @asis
7726 @item @emph{Description}:
7727 This function returns information about a file. No permissions are required on 
7728 the file itself, but execute (search) permission is required on all of the 
7729 directories in path that lead to the file.
7730
7731 The elements that are obtained and stored in the array @code{BUFF}:
7732 @multitable @columnfractions .15 .80
7733 @item @code{buff(1)}   @tab  Device ID 
7734 @item @code{buff(2)}   @tab  Inode number 
7735 @item @code{buff(3)}   @tab  File mode 
7736 @item @code{buff(4)}   @tab  Number of links 
7737 @item @code{buff(5)}   @tab  Owner's uid 
7738 @item @code{buff(6)}   @tab  Owner's gid 
7739 @item @code{buff(7)}   @tab  ID of device containing directory entry for file (0 if not available) 
7740 @item @code{buff(8)}   @tab  File size (bytes) 
7741 @item @code{buff(9)}   @tab  Last access time 
7742 @item @code{buff(10)}  @tab  Last modification time 
7743 @item @code{buff(11)}  @tab  Last file status change time 
7744 @item @code{buff(12)}  @tab  Preferred I/O block size (-1 if not available) 
7745 @item @code{buff(13)}  @tab  Number of blocks allocated (-1 if not available)
7746 @end multitable
7747
7748 Not all these elements are relevant on all systems. 
7749 If an element is not relevant, it is returned as 0.
7750
7751
7752 @item @emph{Standard}:
7753 GNU extension
7754
7755 @item @emph{Class}:
7756 Non-elemental subroutine
7757
7758 @item @emph{Syntax}:
7759 @code{CALL STAT(FILE,BUFF[,STATUS])}
7760
7761 @item @emph{Arguments}:
7762 @multitable @columnfractions .15 .80
7763 @item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
7764 @item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
7765 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
7766                         on success and a system specific error code otherwise.
7767 @end multitable
7768
7769 @item @emph{Example}:
7770 @smallexample
7771 PROGRAM test_stat
7772   INTEGER, DIMENSION(13) :: buff
7773   INTEGER :: status
7774
7775   CALL STAT("/etc/passwd", buff, status)
7776
7777   IF (status == 0) THEN
7778     WRITE (*, FMT="('Device ID:',               T30, I19)") buff(1)
7779     WRITE (*, FMT="('Inode number:',            T30, I19)") buff(2)
7780     WRITE (*, FMT="('File mode (octal):',       T30, O19)") buff(3)
7781     WRITE (*, FMT="('Number of links:',         T30, I19)") buff(4)
7782     WRITE (*, FMT="('Owner''s uid:',            T30, I19)") buff(5)
7783     WRITE (*, FMT="('Owner''s gid:',            T30, I19)") buff(6)
7784     WRITE (*, FMT="('Device where located:',    T30, I19)") buff(7)
7785     WRITE (*, FMT="('File size:',               T30, I19)") buff(8)
7786     WRITE (*, FMT="('Last access time:',        T30, A19)") CTIME(buff(9))
7787     WRITE (*, FMT="('Last modification time',   T30, A19)") CTIME(buff(10))
7788     WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
7789     WRITE (*, FMT="('Preferred block size:',    T30, I19)") buff(12)
7790     WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
7791   END IF
7792 END PROGRAM
7793 @end smallexample
7794
7795 @item @emph{See also}:
7796 To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
7797 @end table
7798
7799
7800
7801 @node SUM
7802 @section @code{SUM} --- Sum of array elements
7803 @findex @code{SUM} intrinsic
7804 @cindex array manipulation
7805
7806 Intrinsic implemented, documentation pending.
7807
7808 @table @asis
7809 @item @emph{Description}:
7810 @item @emph{Standard}:
7811 F95 and later
7812
7813 @item @emph{Class}:
7814 Transformational function
7815
7816 @item @emph{Syntax}:
7817 @item @emph{Arguments}:
7818 @item @emph{Return value}:
7819 @item @emph{Example}:
7820 @item @emph{See also}:
7821 @ref{PRODUCT}
7822 @end table
7823
7824
7825
7826
7827 @node SYMLNK
7828 @section @code{SYMLNK} --- Create a symbolic link
7829 @findex @code{SYMLNK} intrinsic
7830 @cindex file system operations
7831
7832 Intrinsic implemented, documentation pending.
7833
7834 @table @asis
7835 @item @emph{Description}:
7836 @item @emph{Standard}:
7837 @item @emph{Class}:
7838 GNU extension
7839
7840 @item @emph{Syntax}:
7841 @item @emph{Arguments}:
7842 @item @emph{Return value}:
7843 @item @emph{Example}:
7844 @item @emph{See also}:
7845 @end table
7846
7847
7848
7849
7850 @node SYSTEM
7851 @section @code{SYSTEM} --- Execute a shell command
7852 @findex @code{SYSTEM} intrinsic
7853 @cindex undocumented intrinsic 
7854
7855 Intrinsic implemented, documentation pending.
7856
7857 @table @asis
7858 @item @emph{Description}:
7859 @item @emph{Standard}:
7860 GNU extension
7861
7862 @item @emph{Class}:
7863 Subroutine
7864
7865 @item @emph{Syntax}:
7866 @item @emph{Arguments}:
7867 @item @emph{Return value}:
7868 @item @emph{Example}:
7869 @item @emph{See also}:
7870 @end table
7871
7872
7873
7874
7875 @node SYSTEM_CLOCK
7876 @section @code{SYSTEM_CLOCK} --- Time function
7877 @findex @code{SYSTEM_CLOCK} intrinsic
7878 @cindex time functions
7879
7880 Intrinsic implemented, documentation pending.
7881
7882 @table @asis
7883 @item @emph{Description}:
7884 @item @emph{Standard}:
7885 F95 and later
7886
7887 @item @emph{Class}:
7888 Subroutine
7889
7890 @item @emph{Syntax}:
7891 @item @emph{Arguments}:
7892 @item @emph{Return value}:
7893 @item @emph{Example}:
7894 @item @emph{See also}:
7895 @end table
7896
7897
7898
7899 @node TAN
7900 @section @code{TAN} --- Tangent function
7901 @findex @code{TAN} intrinsic
7902 @findex @code{DTAN} intrinsic
7903 @cindex trigonometric functions
7904
7905 @table @asis
7906 @item @emph{Description}:
7907 @code{TAN(X)} computes the tangent of @var{X}.
7908
7909 @item @emph{Standard}:
7910 F77 and later
7911
7912 @item @emph{Class}:
7913 Elemental function
7914
7915 @item @emph{Syntax}:
7916 @code{X = TAN(X)}
7917
7918 @item @emph{Arguments}:
7919 @multitable @columnfractions .15 .80
7920 @item @var{X} @tab The type shall be @code{REAL(*)}.
7921 @end multitable
7922
7923 @item @emph{Return value}:
7924 The return value is of type @code{REAL(*)}.  The kind type parameter is
7925 the same as @var{X}.
7926
7927 @item @emph{Example}:
7928 @smallexample
7929 program test_tan
7930   real(8) :: x = 0.165_8
7931   x = tan(x)
7932 end program test_tan
7933 @end smallexample
7934
7935 @item @emph{Specific names}:
7936 @multitable @columnfractions .20 .20 .20 .40
7937 @item Name            @tab Argument          @tab Return type       @tab Standard
7938 @item @code{DTAN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7939 @end multitable
7940
7941 @item @emph{See also}:
7942 @ref{ATAN}
7943 @end table
7944
7945
7946
7947 @node TANH
7948 @section @code{TANH} --- Hyperbolic tangent function 
7949 @findex @code{TANH} intrinsic
7950 @findex @code{DTANH} intrinsic
7951 @cindex hyperbolic tangent
7952
7953 @table @asis
7954 @item @emph{Description}:
7955 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
7956
7957 @item @emph{Standard}:
7958 F77 and later
7959
7960 @item @emph{Class}:
7961 Elemental function
7962
7963 @item @emph{Syntax}:
7964 @code{X = TANH(X)}
7965
7966 @item @emph{Arguments}:
7967 @multitable @columnfractions .15 .80
7968 @item @var{X} @tab The type shall be @code{REAL(*)}.
7969 @end multitable
7970
7971 @item @emph{Return value}:
7972 The return value is of type @code{REAL(*)} and lies in the range
7973 @math{ - 1 \leq tanh(x) \leq 1 }.
7974
7975 @item @emph{Example}:
7976 @smallexample
7977 program test_tanh
7978   real(8) :: x = 2.1_8
7979   x = tanh(x)
7980 end program test_tanh
7981 @end smallexample
7982
7983 @item @emph{Specific names}:
7984 @multitable @columnfractions .20 .20 .20 .40
7985 @item Name            @tab Argument          @tab Return type       @tab Standard
7986 @item @code{DTANH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab F95 and later
7987 @end multitable
7988
7989 @item @emph{See also}:
7990 @ref{ATANH}
7991 @end table
7992
7993
7994
7995 @node TIME
7996 @section @code{TIME} --- Time function
7997 @findex @code{TIME} intrinsic
7998 @cindex time functions
7999
8000 Intrinsic implemented, documentation pending.
8001
8002 @table @asis
8003 @item @emph{Description}:
8004 @item @emph{Standard}:
8005 GNU extension
8006
8007 @item @emph{Class}:
8008 Non-elemental function
8009
8010 @item @emph{Syntax}:
8011 @item @emph{Arguments}:
8012 @item @emph{Return value}:
8013 @item @emph{Example}:
8014 @item @emph{See also}:
8015 @end table
8016
8017
8018
8019 @node TINY
8020 @section @code{TINY} --- Smallest positive number of a real kind
8021 @findex @code{TINY} intrinsic
8022 @cindex tiny
8023
8024 @table @asis
8025 @item @emph{Description}:
8026 @code{TINY(X)} returns the smallest positive (non zero) number
8027 in the model of the type of @code{X}.
8028
8029 @item @emph{Standard}:
8030 F95 and later
8031
8032 @item @emph{Class}:
8033 Elemental function
8034
8035 @item @emph{Syntax}:
8036 @code{Y = TINY(X)}
8037
8038 @item @emph{Arguments}:
8039 @multitable @columnfractions .15 .80
8040 @item @var{X} @tab shall be of type @code{REAL}.
8041 @end multitable
8042
8043 @item @emph{Return value}:
8044 The return value is of the same type and kind as @var{X}
8045
8046 @item @emph{Example}:
8047 See @code{HUGE} for an example.
8048 @end table
8049
8050
8051
8052 @node TRANSFER
8053 @section @code{TRANSFER} --- Transfer bit patterns
8054 @findex @code{TRANSFER} intrinsic
8055 @cindex bit manipulation
8056
8057 Intrinsic implemented, documentation pending.
8058
8059 @table @asis
8060 @item @emph{Description}:
8061 @item @emph{Standard}:
8062 F95 and later
8063
8064 @item @emph{Class}:
8065 Transformational function
8066
8067 @item @emph{Syntax}:
8068 @item @emph{Arguments}:
8069 @item @emph{Return value}:
8070 @item @emph{Example}:
8071 @item @emph{See also}:
8072 @end table
8073
8074
8075
8076
8077 @node TRANSPOSE
8078 @section @code{TRANSPOSE} --- Transpose an array of rank two
8079 @findex @code{TRANSPOSE} intrinsic
8080 @cindex matrix manipulation
8081
8082 Intrinsic implemented, documentation pending.
8083
8084 @table @asis
8085 @item @emph{Description}:
8086 @item @emph{Standard}:
8087 F95 and later
8088
8089 @item @emph{Class}:
8090 Transformational function
8091
8092 @item @emph{Syntax}:
8093 @item @emph{Arguments}:
8094 @item @emph{Return value}:
8095 @item @emph{Example}:
8096 @item @emph{See also}:
8097 @end table
8098
8099
8100
8101
8102 @node TRIM
8103 @section @code{TRIM} --- Function to remove trailing blank characters of a string
8104 @findex @code{TRIM} intrinsic
8105 @cindex string manipulation
8106
8107 Intrinsic implemented, documentation pending.
8108
8109 @table @asis
8110 @item @emph{Description}:
8111 @item @emph{Standard}:
8112 F95 and later
8113
8114 @item @emph{Class}:
8115 Transformational function
8116
8117 @item @emph{Syntax}:
8118 @item @emph{Arguments}:
8119 @item @emph{Return value}:
8120 @item @emph{Example}:
8121 @item @emph{See also}:
8122 @end table
8123
8124
8125
8126
8127 @node UBOUND
8128 @section @code{UBOUND} --- Upper dimension bounds of an array
8129 @findex @code{UBOUND} intrinsic
8130 @cindex undocumented intrinsic 
8131
8132 Intrinsic implemented, documentation pending.
8133
8134 @table @asis
8135 @item @emph{Description}:
8136
8137 @item @emph{Standard}:
8138 F95 and later
8139
8140 @item @emph{Class}:
8141 Inquiry function
8142
8143 @item @emph{Syntax}:
8144 @item @emph{Arguments}:
8145 @item @emph{Return value}:
8146 @item @emph{Example}:
8147 @item @emph{Specific names}:
8148
8149 @item @emph{See also}:
8150 @ref{LBOUND}
8151 @end table
8152
8153
8154
8155
8156 @node UMASK
8157 @section @code{UMASK} --- Set the file creation mask
8158 @findex @code{UMASK} intrinsic
8159 @cindex file system operations
8160
8161 Intrinsic implemented, documentation pending.
8162
8163 @table @asis
8164 @item @emph{Description}:
8165 @item @emph{Standard}:
8166 GNU extension
8167
8168 @item @emph{Class}:
8169 Subroutine
8170
8171 @item @emph{Syntax}:
8172 @item @emph{Arguments}:
8173 @item @emph{Return value}:
8174 @item @emph{Example}:
8175 @item @emph{Specific names}:
8176 @item @emph{See also}:
8177 @end table
8178
8179
8180
8181
8182 @node UNLINK
8183 @section @code{UNLINK} --- Remove a file from the file system
8184 @findex @code{UNLINK} intrinsic
8185 @cindex file system operations
8186
8187 Intrinsic implemented, documentation pending.
8188
8189 @table @asis
8190 @item @emph{Description}:
8191 @item @emph{Standard}:
8192 GNU extension
8193
8194 @item @emph{Class}:
8195 Subroutine
8196
8197 @item @emph{Syntax}:
8198 @item @emph{Arguments}:
8199 @item @emph{Return value}:
8200 @item @emph{Example}:
8201
8202 @item @emph{See also}:
8203 @ref{LINK}
8204 @end table
8205
8206
8207
8208
8209 @node UNMASK
8210 @section @code{UNMASK} --- (?)
8211 @findex @code{UNMASK} intrinsic
8212 @cindex undocumented intrinsic 
8213
8214 Intrinsic implemented, documentation pending.
8215
8216 @table @asis
8217 @item @emph{Description}:
8218 @item @emph{Standard}:
8219 @item @emph{Class}:
8220 @item @emph{Syntax}:
8221 @item @emph{Arguments}:
8222 @item @emph{Return value}:
8223 @item @emph{Example}:
8224 @item @emph{Specific names}:
8225 @item @emph{See also}:
8226 @end table
8227
8228
8229
8230
8231 @node UNPACK
8232 @section @code{UNPACK} --- Unpack an array of rank one into an array
8233 @findex @code{UNPACK} intrinsic
8234 @cindex array manipulation
8235
8236 Intrinsic implemented, documentation pending.
8237
8238 @table @asis
8239 @item @emph{Description}:
8240 @item @emph{Standard}:
8241 F95 and later
8242
8243 @item @emph{Class}:
8244 Transformational function
8245
8246 @item @emph{Syntax}:
8247 @item @emph{Arguments}:
8248 @item @emph{Return value}:
8249 @item @emph{Example}:
8250
8251 @item @emph{See also}:
8252 @ref{PACK}
8253 @end table
8254
8255
8256
8257
8258 @node VERIFY
8259 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
8260 @findex @code{VERIFY} intrinsic
8261 @cindex string manipulation
8262
8263 Intrinsic implemented, documentation pending.
8264
8265 @table @asis
8266 @item @emph{Description}:
8267 @item @emph{Standard}:
8268 F95 and later
8269
8270 @item @emph{Class}:
8271 Elemental function
8272
8273 @item @emph{Syntax}:
8274 @item @emph{Arguments}:
8275 @item @emph{Return value}:
8276 @item @emph{Example}:
8277 @item @emph{Specific names}:
8278 @item @emph{See also}:
8279 @end table
8280
8281
8282 @node XOR
8283 @section @code{XOR} --- Bitwise logical exclusive OR
8284 @findex @code{XOR} intrinsic
8285 @cindex bit operations
8286
8287 @table @asis
8288 @item @emph{Description}:
8289 Bitwise logical exclusive or. 
8290
8291 This intrinsic routine is provided for backwards compatibility with 
8292 GNU Fortran 77.  For integer arguments, programmers should consider
8293 the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
8294
8295 @item @emph{Standard}:
8296 GNU extension
8297
8298 @item @emph{Class}:
8299 Non-elemental function
8300
8301 @item @emph{Syntax}:
8302 @code{RESULT = XOR(X, Y)}
8303
8304 @item @emph{Arguments}:
8305 @multitable @columnfractions .15 .80
8306 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8307 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8308 @end multitable
8309
8310 @item @emph{Return value}:
8311 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
8312 after cross-promotion of the arguments.
8313
8314 @item @emph{Example}:
8315 @smallexample
8316 PROGRAM test_xor
8317   LOGICAL :: T = .TRUE., F = .FALSE.
8318   INTEGER :: a, b
8319   DATA a / Z,'F' /, b / Z'3' /
8320
8321   WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
8322   WRITE (*,*) XOR(a, b)
8323 END PROGRAM
8324 @end smallexample
8325
8326 @item @emph{See also}:
8327 F95 elemental function: @ref{IEOR}
8328 @end table
8329
8330