OSDN Git Service

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