OSDN Git Service

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