2 Copyright (C) 2005, 2006, 2007
3 Free Software Foundation, Inc.
4 This is part of the GNU Fortran manual.
5 For copying conditions, see the file gfortran.texi.
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.
16 Some basic guidelines for editing this document:
18 (1) The intrinsic procedures are to be listed in alphabetical order.
19 (2) The generic name is to be used.
20 (3) The specific names are included in the function index and in a
21 table at the end of the node (See ABS entry).
22 (4) Try to maintain the same style for each entry.
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}
37 @node Intrinsic Procedures
38 @chapter Intrinsic Procedures
39 @cindex intrinsic procedures
41 This portion of the document is incomplete and undergoing massive expansion
42 and editing. All contributions and corrections are strongly encouraged.
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'.
47 @comment Missing intrinsics (double check with #19292)
52 * Introduction: Introduction to Intrinsics
53 * @code{ABORT}: ABORT, Abort the program
54 * @code{ABS}: ABS, Absolute value
55 * @code{ACCESS}: ACCESS, Checks file access modes
56 * @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
57 * @code{ACOS}: ACOS, Arccosine function
58 * @code{ACOSH}: ACOSH, Hyperbolic arccosine function
59 * @code{ADJUSTL}: ADJUSTL, Left adjust a string
60 * @code{ADJUSTR}: ADJUSTR, Right adjust a string
61 * @code{AIMAG}: AIMAG, Imaginary part of complex number
62 * @code{AINT}: AINT, Truncate to a whole number
63 * @code{ALARM}: ALARM, Set an alarm clock
64 * @code{ALL}: ALL, Determine if all values are true
65 * @code{ALLOCATED}: ALLOCATED, Status of allocatable entity
66 * @code{AND}: AND, Bitwise logical AND
67 * @code{ANINT}: ANINT, Nearest whole number
68 * @code{ANY}: ANY, Determine if any values are true
69 * @code{ASIN}: ASIN, Arcsine function
70 * @code{ASINH}: ASINH, Hyperbolic arcsine function
71 * @code{ASSOCIATED}: ASSOCIATED, Status of a pointer or pointer/target pair
72 * @code{ATAN}: ATAN, Arctangent function
73 * @code{ATAN2}: ATAN2, Arctangent function
74 * @code{ATANH}: ATANH, Hyperbolic arctangent function
75 * @code{BESJ0}: BESJ0, Bessel function of the first kind of order 0
76 * @code{BESJ1}: BESJ1, Bessel function of the first kind of order 1
77 * @code{BESJN}: BESJN, Bessel function of the first kind
78 * @code{BESY0}: BESY0, Bessel function of the second kind of order 0
79 * @code{BESY1}: BESY1, Bessel function of the second kind of order 1
80 * @code{BESYN}: BESYN, Bessel function of the second kind
81 * @code{BIT_SIZE}: BIT_SIZE, Bit size inquiry function
82 * @code{BTEST}: BTEST, Bit test function
83 * @code{CEILING}: CEILING, Integer ceiling function
84 * @code{CHAR}: CHAR, Integer-to-character conversion function
85 * @code{CHDIR}: CHDIR, Change working directory
86 * @code{CHMOD}: CHMOD, Change access permissions of files
87 * @code{CMPLX}: CMPLX, Complex conversion function
88 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Get number of command line arguments
89 * @code{CONJG}: CONJG, Complex conjugate function
90 * @code{COS}: COS, Cosine function
91 * @code{COSH}: COSH, Hyperbolic cosine function
92 * @code{COUNT}: COUNT, Count occurrences of TRUE in an array
93 * @code{CPU_TIME}: CPU_TIME, CPU time subroutine
94 * @code{CSHIFT}: CSHIFT, Circular array shift function
95 * @code{CTIME}: CTIME, Subroutine (or function) to convert a time into a string
96 * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
97 * @code{DBLE}: DBLE, Double precision conversion function
98 * @code{DCMPLX}: DCMPLX, Double complex conversion function
99 * @code{DFLOAT}: DFLOAT, Double precision conversion function
100 * @code{DIGITS}: DIGITS, Significant digits function
101 * @code{DIM}: DIM, Dim function
102 * @code{DOT_PRODUCT}: DOT_PRODUCT, Dot product function
103 * @code{DPROD}: DPROD, Double product function
104 * @code{DREAL}: DREAL, Double real part function
105 * @code{DTIME}: DTIME, Execution time subroutine (or function)
106 * @code{EOSHIFT}: EOSHIFT, End-off shift function
107 * @code{EPSILON}: EPSILON, Epsilon function
108 * @code{ERF}: ERF, Error function
109 * @code{ERFC}: ERFC, Complementary error function
110 * @code{ETIME}: ETIME, Execution time subroutine (or function)
111 * @code{EXIT}: EXIT, Exit the program with status.
112 * @code{EXP}: EXP, Exponential function
113 * @code{EXPONENT}: EXPONENT, Exponent function
114 * @code{FDATE}: FDATE, Subroutine (or function) to get the current time as a string
115 * @code{FGET}: FGET, Read a single character in stream mode from stdin
116 * @code{FGETC}: FGETC, Read a single character in stream mode
117 * @code{FLOAT}: FLOAT, Convert integer to default real
118 * @code{FLOOR}: FLOOR, Integer floor function
119 * @code{FLUSH}: FLUSH, Flush I/O unit(s)
120 * @code{FNUM}: FNUM, File number function
121 * @code{FPUT}: FPUT, Write a single character in stream mode to stdout
122 * @code{FPUTC}: FPUTC, Write a single character in stream mode
123 * @code{FRACTION}: FRACTION, Fractional part of the model representation
124 * @code{FREE}: FREE, Memory de-allocation subroutine
125 * @code{FSEEK}: FSEEK, Low level file positioning subroutine
126 * @code{FSTAT}: FSTAT, Get file status
127 * @code{FTELL}: FTELL, Current stream position
128 * @code{GETARG}: GETARG, Get command line arguments
129 * @code{GET_COMMAND}: GET_COMMAND, Get the entire command line
130 * @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Get command line arguments
131 * @code{GETCWD}: GETCWD, Get current working directory
132 * @code{GETENV}: GETENV, Get an environmental variable
133 * @code{GET_ENVIRONMENT_VARIABLE}: GET_ENVIRONMENT_VARIABLE, Get an environmental variable
134 * @code{GETGID}: GETGID, Group ID function
135 * @code{GETLOG}: GETLOG, Get login name
136 * @code{GETPID}: GETPID, Process ID function
137 * @code{GETUID}: GETUID, User ID function
138 * @code{GMTIME}: GMTIME, Convert time to GMT info
139 * @code{HOSTNM}: HOSTNM, Get system host name
140 * @code{HUGE}: HUGE, Largest number of a kind
141 * @code{IACHAR}: IACHAR, Code in @acronym{ASCII} collating sequence
142 * @code{IAND}: IAND, Bitwise logical and
143 * @code{IARGC}: IARGC, Get the number of command line arguments
144 * @code{IBCLR}: IBCLR, Clear bit
145 * @code{IBITS}: IBITS, Bit extraction
146 * @code{IBSET}: IBSET, Set bit
147 * @code{ICHAR}: ICHAR, Character-to-integer conversion function
148 * @code{IDATE}: IDATE, Current local time (day/month/year)
149 * @code{IEOR}: IEOR, Bitwise logical exclusive or
150 * @code{IERRNO}: IERRNO, Function to get the last system error number
151 * @code{INDEX}: INDEX, Position of a substring within a string
152 * @code{INT}: INT, Convert to integer type
153 * @code{IOR}: IOR, Bitwise logical or
154 * @code{IRAND}: IRAND, Integer pseudo-random number
155 * @code{ISHFT}: ISHFT, Shift bits
156 * @code{ISHFTC}: ISHFTC, Shift bits circularly
157 * @code{ITIME}: ITIME, Current local time (hour/minutes/seconds)
158 * @code{KILL}: KILL, Send a signal to a process
159 * @code{KIND}: KIND, Kind of an entity
160 * @code{LBOUND}: LBOUND, Lower dimension bounds of an array
161 * @code{LEN}: LEN, Length of a character entity
162 * @code{LEN_TRIM}: LEN_TRIM, Length of a character entity without trailing blank characters
163 * @code{LGE}: LGE, Lexical greater than or equal
164 * @code{LGT}: LGT, Lexical greater than
165 * @code{LINK}: LINK, Create a hard link
166 * @code{LLE}: LLE, Lexical less than or equal
167 * @code{LLT}: LLT, Lexical less than
168 * @code{LNBLNK}: LNBLNK, Index of the last non-blank character in a string
169 * @code{LOC}: LOC, Returns the address of a variable
170 * @code{LOG}: LOG, Logarithm function
171 * @code{LOG10}: LOG10, Base 10 logarithm function
172 * @code{LOGICAL}: LOGICAL, Convert to logical type
173 * @code{LSHIFT}: LSHIFT, Left shift bits
174 * @code{LSTAT}: LSTAT, Get file status
175 * @code{LTIME}: LTIME, Convert time to local time info
176 * @code{MALLOC}: MALLOC, Dynamic memory allocation function
177 * @code{MATMUL}: MATMUL, matrix multiplication
178 * @code{MAX}: MAX, Maximum value of an argument list
179 * @code{MAXEXPONENT}: MAXEXPONENT, Maximum exponent of a real kind
180 * @code{MAXLOC}: MAXLOC, Location of the maximum value within an array
181 * @code{MAXVAL}: MAXVAL, Maximum value of an array
182 * @code{MERGE}: MERGE, Merge arrays
183 * @code{MIN}: MIN, Minimum value of an argument list
184 * @code{MINEXPONENT}: MINEXPONENT, Minimum exponent of a real kind
185 * @code{MINLOC}: MINLOC, Location of the minimum value within an array
186 * @code{MINVAL}: MINVAL, Minimum value of an array
187 * @code{MOD}: MOD, Remainder function
188 * @code{MODULO}: MODULO, Modulo function
189 * @code{MOVE_ALLOC}: MOVE_ALLOC, Move allocation from one object to another
190 * @code{MVBITS}: MVBITS, Move bits from one integer to another
191 * @code{NEAREST}: NEAREST, Nearest representable number
192 * @code{NEW_LINE}: NEW_LINE, New line character
193 * @code{NINT}: NINT, Nearest whole number
194 * @code{NOT}: NOT, Logical negation
195 * @code{NULL}: NULL, Function that returns an disassociated pointer
196 * @code{OR}: OR, Bitwise logical OR
197 * @code{PACK}: PACK, Pack an array into an array of rank one
198 * @code{PERROR}: PERROR, Print system error message
199 * @code{PRECISION}: PRECISION, Decimal precision of a real kind
200 * @code{PRESENT}: PRESENT, Determine whether an optional argument is specified
201 * @code{PRODUCT}: PRODUCT, Product of array elements
202 * @code{RADIX}: RADIX, Base of a data model
203 * @code{RANDOM_NUMBER}: RANDOM_NUMBER, Pseudo-random number
204 * @code{RANDOM_SEED}: RANDOM_SEED, Initialize a pseudo-random number sequence
205 * @code{RAND}: RAND, Real pseudo-random number
206 * @code{RANGE}: RANGE, Decimal exponent range of a real kind
207 * @code{RAN}: RAN, Real pseudo-random number
208 * @code{REAL}: REAL, Convert to real type
209 * @code{RENAME}: RENAME, Rename a file
210 * @code{REPEAT}: REPEAT, Repeated string concatenation
211 * @code{RESHAPE}: RESHAPE, Function to reshape an array
212 * @code{RRSPACING}: RRSPACING, Reciprocal of the relative spacing
213 * @code{RSHIFT}: RSHIFT, Right shift bits
214 * @code{SCALE}: SCALE, Scale a real value
215 * @code{SCAN}: SCAN, Scan a string for the presence of a set of characters
216 * @code{SECNDS}: SECNDS, Time function
217 @comment * @code{SECOND}: SECOND, (?)
218 @comment * @code{SECONDS}: SECONDS, (?)
219 * @code{SELECTED_INT_KIND}: SELECTED_INT_KIND, Choose integer kind
220 * @code{SELECTED_REAL_KIND}: SELECTED_REAL_KIND, Choose real kind
221 * @code{SET_EXPONENT}: SET_EXPONENT, Set the exponent of the model
222 * @code{SHAPE}: SHAPE, Determine the shape of an array
223 * @code{SIGN}: SIGN, Sign copying function
224 * @code{SIGNAL}: SIGNAL, Signal handling subroutine (or function)
225 * @code{SIN}: SIN, Sine function
226 * @code{SINH}: SINH, Hyperbolic sine function
227 * @code{SIZE}: SIZE, Function to determine the size of an array
228 * @code{SNGL}: SNGL, Convert double precision real to default real
229 * @code{SPACING}: SPACING, Smallest distance between two numbers of a given type
230 * @code{SPREAD}: SPREAD, Add a dimension to an array
231 * @code{SQRT}: SQRT, Square-root function
232 * @code{SRAND}: SRAND, Reinitialize the random number generator
233 * @code{STAT}: STAT, Get file status
234 * @code{SUM}: SUM, Sum of array elements
235 * @code{SYMLNK}: SYMLNK, Create a symbolic link
236 * @code{SYSTEM}: SYSTEM, Execute a shell command
237 * @code{SYSTEM_CLOCK}: SYSTEM_CLOCK, Time function
238 * @code{TAN}: TAN, Tangent function
239 * @code{TANH}: TANH, Hyperbolic tangent function
240 * @code{TIME}: TIME, Time function
241 * @code{TINY}: TINY, Smallest positive number of a real kind
242 * @code{TRANSFER}: TRANSFER, Transfer bit patterns
243 * @code{TRANSPOSE}: TRANSPOSE, Transpose an array of rank two
244 * @code{TRIM}: TRIM, Function to remove trailing blank characters of a string
245 * @code{UBOUND}: UBOUND, Upper dimension bounds of an array
246 * @code{UMASK}: UMASK, Set the file creation mask
247 * @code{UNLINK}: UNLINK, Remove a file from the file system
248 * @code{UNMASK}: UNMASK, (?)
249 * @code{UNPACK}: UNPACK, Unpack an array of rank one into an array
250 * @code{VERIFY}: VERIFY, Scan a string for the absence of a set of characters
251 * @code{XOR}: XOR, Bitwise logical exclusive or
254 @node Introduction to Intrinsics
255 @section Introduction to intrinsic procedures
257 The intrinsic procedures provided by GNU Fortran include all of the
258 intrinsic procedures required by the Fortran 95 standard, a set of
259 intrinsic procedures for backwards compatibility with G77, and a small
260 selection of intrinsic procedures from the Fortran 2003 standard. Any
261 conflict between a description here and a description in either the
262 Fortran 95 standard or the Fortran 2003 standard is unintentional, and
263 the standard(s) should be considered authoritative.
265 The enumeration of the @code{KIND} type parameter is processor defined in
266 the Fortran 95 standard. GNU Fortran defines the default integer type and
267 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
268 respectively. The standard mandates that both data types shall have
269 another kind, which have more precision. On typical target architectures
270 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
271 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
272 In the description of generic intrinsic procedures, the kind type parameter
273 will be specified by @code{KIND=*}, and in the description of specific
274 names for an intrinsic procedure the kind type parameter will be explicitly
275 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
276 brevity the optional @code{KIND=} syntax will be omitted.
278 Many of the intrinsic procedures take one or more optional arguments.
279 This document follows the convention used in the Fortran 95 standard,
280 and denotes such arguments by square brackets.
282 GNU Fortran offers the @option{-std=f95} and @option{-std=gnu} options,
283 which can be used to restrict the set of intrinsic procedures to a
284 given standard. By default, @command{gfortran} sets the @option{-std=gnu}
285 option, and so all intrinsic procedures described here are accepted. There
286 is one caveat. For a select group of intrinsic procedures, @command{g77}
287 implemented both a function and a subroutine. Both classes
288 have been implemented in @command{gfortran} for backwards compatibility
289 with @command{g77}. It is noted here that these functions and subroutines
290 cannot be intermixed in a given subprogram. In the descriptions that follow,
291 the applicable standard for each intrinsic procedure is noted.
296 @section @code{ABORT} --- Abort the program
297 @cindex @code{ABORT} intrinsic
301 @item @emph{Description}:
302 @code{ABORT} causes immediate termination of the program. On operating
303 systems that support a core dump, @code{ABORT} will produce a core dump,
304 which is suitable for debugging purposes.
306 @item @emph{Standard}:
310 non-elemental subroutine
315 @item @emph{Return value}:
318 @item @emph{Example}:
321 integer :: i = 1, j = 2
322 if (i /= j) call abort
323 end program test_abort
326 @item @emph{See also}:
327 @ref{EXIT}, @ref{KILL}
333 @section @code{ABS} --- Absolute value
334 @cindex @code{ABS} intrinsic
335 @cindex @code{CABS} intrinsic
336 @cindex @code{DABS} intrinsic
337 @cindex @code{IABS} intrinsic
338 @cindex @code{ZABS} intrinsic
339 @cindex @code{CDABS} intrinsic
340 @cindex absolute value
343 @item @emph{Description}:
344 @code{ABS(X)} computes the absolute value of @code{X}.
346 @item @emph{Standard}:
347 F77 and later, has overloads that are GNU extensions
355 @item @emph{Arguments}:
356 @multitable @columnfractions .15 .80
357 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
358 @code{REAL(*)}, or @code{COMPLEX(*)}.
361 @item @emph{Return value}:
362 The return value is of the same type and
363 kind as the argument except the return value is @code{REAL(*)} for a
364 @code{COMPLEX(*)} argument.
366 @item @emph{Example}:
371 complex :: z = (-1.e0,0.e0)
378 @item @emph{Specific names}:
379 @multitable @columnfractions .20 .20 .20 .40
380 @item Name @tab Argument @tab Return type @tab Standard
381 @item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab F77 and later
382 @item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
383 @item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
384 @item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
385 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
391 @section @code{ACCESS} --- Checks file access modes
392 @cindex @code{ACCESS}
393 @cindex file system operations
396 @item @emph{Description}:
397 @code{ACCESS(NAME, MODE)} checks whether the file @var{NAME}
398 exists, is readable, writable or executable. Except for the
399 executable check, @code{ACCESS} can be replaced by
400 Fortran 95's @code{INQUIRE}.
402 @item @emph{Standard}:
409 @code{I = ACCESS(NAME, MODE)}
411 @item @emph{Arguments}:
412 @multitable @columnfractions .15 .80
413 @item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
414 Tailing blank are ignored unless the character @code{achar(0)} is
415 present, then all characters up to and excluding @code{achar(0)} are
417 @item @var{MODE} @tab Scalar @code{CHARACTER} with the file access mode,
418 may be any concatenation of @code{"r"} (readable), @code{"w"} (writable)
419 and @code{"x"} (executable), or @code{" "} to check for existence.
422 @item @emph{Return value}:
423 Returns a scalar @code{INTEGER}, which is @code{0} if the file is
424 accessable in the given mode; otherwise or if an invalid argument
425 has been given for @code{MODE} the value @code{1} is returned.
427 @item @emph{Example}:
431 character(len=*), parameter :: file = 'test.dat'
432 character(len=*), parameter :: file2 = 'test.dat '//achar(0)
433 if(access(file,' ') == 0) print *, trim(file),' is exists'
434 if(access(file,'r') == 0) print *, trim(file),' is readable'
435 if(access(file,'w') == 0) print *, trim(file),' is writable'
436 if(access(file,'x') == 0) print *, trim(file),' is executable'
437 if(access(file2,'rwx') == 0) &
438 print *, trim(file2),' is readable, writable and executable'
439 end program access_test
441 @item @emph{Specific names}:
442 @item @emph{See also}:
448 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
449 @cindex @code{ACHAR} intrinsic
450 @cindex @acronym{ASCII} collating sequence
453 @item @emph{Description}:
454 @code{ACHAR(I)} returns the character located at position @code{I}
455 in the @acronym{ASCII} collating sequence.
457 @item @emph{Standard}:
466 @item @emph{Arguments}:
467 @multitable @columnfractions .15 .80
468 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
471 @item @emph{Return value}:
472 The return value is of type @code{CHARACTER} with a length of one. The
473 kind type parameter is the same as @code{KIND('A')}.
475 @item @emph{Example}:
480 end program test_achar
487 @section @code{ACOS} --- Arccosine function
488 @cindex @code{ACOS} intrinsic
489 @cindex @code{DACOS} intrinsic
490 @cindex trigonometric functions (inverse)
493 @item @emph{Description}:
494 @code{ACOS(X)} computes the arccosine of @var{X} (inverse of @code{COS(X)}).
496 @item @emph{Standard}:
505 @item @emph{Arguments}:
506 @multitable @columnfractions .15 .80
507 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
511 @item @emph{Return value}:
512 The return value is of type @code{REAL(*)} and it lies in the
513 range @math{ 0 \leq \acos(x) \leq \pi}. The kind type parameter
514 is the same as @var{X}.
516 @item @emph{Example}:
519 real(8) :: x = 0.866_8
521 end program test_acos
524 @item @emph{Specific names}:
525 @multitable @columnfractions .20 .20 .20 .40
526 @item Name @tab Argument @tab Return type @tab Standard
527 @item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
530 @item @emph{See also}:
531 Inverse function: @ref{COS}
537 @section @code{ACOSH} --- Hyperbolic arccosine function
538 @cindex @code{ACOSH} intrinsic
539 @cindex hyperbolic arccosine
540 @cindex hyperbolic cosine (inverse)
543 @item @emph{Description}:
544 @code{ACOSH(X)} computes the area hyperbolic cosine of @var{X} (inverse of @code{COSH(X)}).
546 @item @emph{Standard}:
555 @item @emph{Arguments}:
556 @multitable @columnfractions .15 .80
557 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
558 greater or equal to one.
561 @item @emph{Return value}:
562 The return value is of type @code{REAL(*)} and it lies in the
563 range @math{0 \leq \acosh (x) \leq \infty}.
565 @item @emph{Example}:
568 REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
573 @item @emph{See also}:
574 Inverse function: @ref{COSH}
580 @section @code{ADJUSTL} --- Left adjust a string
581 @cindex @code{ADJUSTL} intrinsic
582 @cindex adjust string
585 @item @emph{Description}:
586 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
587 Spaces are inserted at the end of the string as needed.
589 @item @emph{Standard}:
596 @code{STR = ADJUSTL(STR)}
598 @item @emph{Arguments}:
599 @multitable @columnfractions .15 .80
600 @item @var{STR} @tab The type shall be @code{CHARACTER}.
603 @item @emph{Return value}:
604 The return value is of type @code{CHARACTER} where leading spaces
605 are removed and the same number of spaces are inserted on the end
608 @item @emph{Example}:
611 character(len=20) :: str = ' gfortran'
614 end program test_adjustl
621 @section @code{ADJUSTR} --- Right adjust a string
622 @cindex @code{ADJUSTR} intrinsic
623 @cindex adjust string
626 @item @emph{Description}:
627 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
628 Spaces are inserted at the start of the string as needed.
630 @item @emph{Standard}:
637 @code{STR = ADJUSTR(STR)}
639 @item @emph{Arguments}:
640 @multitable @columnfractions .15 .80
641 @item @var{STR} @tab The type shall be @code{CHARACTER}.
644 @item @emph{Return value}:
645 The return value is of type @code{CHARACTER} where trailing spaces
646 are removed and the same number of spaces are inserted at the start
649 @item @emph{Example}:
652 character(len=20) :: str = 'gfortran'
655 end program test_adjustr
662 @section @code{AIMAG} --- Imaginary part of complex number
663 @cindex @code{AIMAG} intrinsic
664 @cindex @code{DIMAG} intrinsic
665 @cindex @code{IMAG} intrinsic
666 @cindex @code{IMAGPART} intrinsic
667 @cindex imaginary part of a complex number
670 @item @emph{Description}:
671 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
672 The @code{IMAG(Z)} and @code{IMAGPART(Z)} intrinsic functions are provided
673 for compatibility with @command{g77}, and their use in new code is
674 strongly discouraged.
676 @item @emph{Standard}:
677 F77 and later, has overloads that are GNU extensions
685 @item @emph{Arguments}:
686 @multitable @columnfractions .15 .80
687 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
690 @item @emph{Return value}:
691 The return value is of type real with the
692 kind type parameter of the argument.
694 @item @emph{Example}:
699 z4 = cmplx(1.e0_4, 0.e0_4)
700 z8 = cmplx(0.e0_8, 1.e0_8)
701 print *, aimag(z4), dimag(z8)
702 end program test_aimag
705 @item @emph{Specific names}:
706 @multitable @columnfractions .20 .20 .20 .40
707 @item Name @tab Argument @tab Return type @tab Standard
708 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)} @tab GNU extension
709 @item @code{IMAG(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
710 @item @code{IMAGPART(Z)} @tab @code{COMPLEX(*) Z} @tab @code{REAL(*)} @tab GNU extension
717 @section @code{AINT} --- Truncate to a whole number
718 @cindex @code{AINT} intrinsic
719 @cindex @code{DINT} intrinsic
723 @item @emph{Description}:
724 @code{AINT(X [, KIND])} truncates its argument to a whole number.
726 @item @emph{Standard}:
733 @code{X = AINT(X [, KIND])}
735 @item @emph{Arguments}:
736 @multitable @columnfractions .15 .80
737 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
738 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
739 initialization expression.
742 @item @emph{Return value}:
743 The return value is of type real with the kind type parameter of the
744 argument if the optional @var{KIND} is absent; otherwise, the kind
745 type parameter will be given by @var{KIND}. If the magnitude of
746 @var{X} is less than one, then @code{AINT(X)} returns zero. If the
747 magnitude is equal to or greater than one, then it returns the largest
748 whole number that does not exceed its magnitude. The sign is the same
749 as the sign of @var{X}.
751 @item @emph{Example}:
758 print *, aint(x4), dint(x8)
760 end program test_aint
763 @item @emph{Specific names}:
764 @multitable @columnfractions .20 .20 .20 .40
765 @item Name @tab Argument @tab Return type @tab Standard
766 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
773 @section @code{ALARM} --- Execute a routine after a given delay
774 @cindex @code{ALARM} intrinsic
777 @item @emph{Description}:
778 @code{ALARM(SECONDS, HANDLER [, STATUS])} causes external subroutine @var{HANDLER}
779 to be executed after a delay of @var{SECONDS} by using @code{alarm(1)} to
780 set up a signal and @code{signal(2)} to catch it. If @var{STATUS} is
781 supplied, it will be returned with the number of seconds remaining until
782 any previously scheduled alarm was due to be delivered, or zero if there
783 was no previously scheduled alarm.
785 @item @emph{Standard}:
792 @code{CALL ALARM(SECONDS, HANDLER [, STATUS])}
794 @item @emph{Arguments}:
795 @multitable @columnfractions .15 .80
796 @item @var{SECONDS} @tab The type of the argument shall be a scalar
797 @code{INTEGER}. It is @code{INTENT(IN)}.
798 @item @var{HANDLER} @tab Signal handler (@code{INTEGER FUNCTION} or
799 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
800 @code{INTEGER}. It is @code{INTENT(IN)}.
801 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
802 @code{INTEGER} variable. It is @code{INTENT(OUT)}.
805 @item @emph{Example}:
808 external handler_print
810 call alarm (3, handler_print, i)
813 end program test_alarm
815 This will cause the external routine @var{handler_print} to be called
822 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true
823 @cindex @code{ALL} intrinsic
827 @item @emph{Description}:
828 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
829 in the array along dimension @var{DIM}.
831 @item @emph{Standard}:
835 transformational function
838 @code{L = ALL(MASK [, DIM])}
840 @item @emph{Arguments}:
841 @multitable @columnfractions .15 .80
842 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
843 it shall not be scalar.
844 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
845 with a value that lies between one and the rank of @var{MASK}.
848 @item @emph{Return value}:
849 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
850 the kind type parameter is the same as the kind type parameter of
851 @var{MASK}. If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
852 an array with the rank of @var{MASK} minus 1. The shape is determined from
853 the shape of @var{MASK} where the @var{DIM} dimension is elided.
857 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
858 It also is true if @var{MASK} has zero size; otherwise, it is false.
860 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
861 to @code{ALL(MASK)}. If the rank is greater than one, then @code{ALL(MASK,DIM)}
862 is determined by applying @code{ALL} to the array sections.
865 @item @emph{Example}:
869 l = all((/.true., .true., .true./))
874 integer a(2,3), b(2,3)
878 print *, all(a .eq. b, 1)
879 print *, all(a .eq. b, 2)
880 end subroutine section
888 @section @code{ALLOCATED} --- Status of an allocatable entity
889 @cindex @code{ALLOCATED} intrinsic
890 @cindex allocation status
893 @item @emph{Description}:
894 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
896 @item @emph{Standard}:
903 @code{L = ALLOCATED(X)}
905 @item @emph{Arguments}:
906 @multitable @columnfractions .15 .80
907 @item @var{X} @tab The argument shall be an @code{ALLOCATABLE} array.
910 @item @emph{Return value}:
911 The return value is a scalar @code{LOGICAL} with the default logical
912 kind type parameter. If @var{X} is allocated, @code{ALLOCATED(X)}
913 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.}
915 @item @emph{Example}:
917 program test_allocated
919 real(4), allocatable :: x(:)
920 if (allocated(x) .eqv. .false.) allocate(x(i))
921 end program test_allocated
927 @section @code{AND} --- Bitwise logical AND
928 @cindex @code{AND} intrinsic
929 @cindex bit operations
932 @item @emph{Description}:
933 Bitwise logical @code{AND}.
935 This intrinsic routine is provided for backwards compatibility with
936 GNU Fortran 77. For integer arguments, programmers should consider
937 the use of the @ref{IAND} intrinsic defined by the Fortran standard.
939 @item @emph{Standard}:
943 Non-elemental function
946 @code{RESULT = AND(X, Y)}
948 @item @emph{Arguments}:
949 @multitable @columnfractions .15 .80
950 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
951 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
954 @item @emph{Return value}:
955 The return type is either @code{INTEGER(*)} or @code{LOGICAL} after
956 cross-promotion of the arguments.
958 @item @emph{Example}:
961 LOGICAL :: T = .TRUE., F = ..FALSE.
963 DATA a / Z'F' /, b / Z'3' /
965 WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
966 WRITE (*,*) AND(a, b)
970 @item @emph{See also}:
971 F95 elemental function: @ref{IAND}
977 @section @code{ANINT} --- Nearest whole number
978 @cindex @code{ANINT} intrinsic
979 @cindex @code{DNINT} intrinsic
983 @item @emph{Description}:
984 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
986 @item @emph{Standard}:
994 @code{X = ANINT(X, KIND)}
996 @item @emph{Arguments}:
997 @multitable @columnfractions .15 .80
998 @item @var{X} @tab The type of the argument shall be @code{REAL(*)}.
999 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
1000 initialization expression.
1003 @item @emph{Return value}:
1004 The return value is of type real with the kind type parameter of the
1005 argument if the optional @var{KIND} is absent; otherwise, the kind
1006 type parameter will be given by @var{KIND}. If @var{X} is greater than
1007 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
1008 less than or equal to zero, then it returns @code{AINT(X-0.5)}.
1010 @item @emph{Example}:
1017 print *, anint(x4), dnint(x8)
1019 end program test_anint
1022 @item @emph{Specific names}:
1023 @multitable @columnfractions .20 .20 .20 .40
1024 @item Name @tab Argument @tab Return type @tab Standard
1025 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1032 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true
1033 @cindex @code{ANY} intrinsic
1037 @item @emph{Description}:
1038 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
1039 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
1041 @item @emph{Standard}:
1045 transformational function
1047 @item @emph{Syntax}:
1048 @code{L = ANY(MASK)}
1049 @code{L = ANY(MASK, DIM)}
1051 @item @emph{Arguments}:
1052 @multitable @columnfractions .15 .80
1053 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
1054 it shall not be scalar.
1055 @item @var{DIM} @tab (Optional) @var{DIM} shall be a scalar integer
1056 with a value that lies between one and the rank of @var{MASK}.
1059 @item @emph{Return value}:
1060 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
1061 the kind type parameter is the same as the kind type parameter of
1062 @var{MASK}. If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
1063 an array with the rank of @var{MASK} minus 1. The shape is determined from
1064 the shape of @var{MASK} where the @var{DIM} dimension is elided.
1068 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
1069 otherwise, it is false. It also is false if @var{MASK} has zero size.
1071 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
1072 to @code{ANY(MASK)}. If the rank is greater than one, then @code{ANY(MASK,DIM)}
1073 is determined by applying @code{ANY} to the array sections.
1076 @item @emph{Example}:
1080 l = any((/.true., .true., .true./))
1085 integer a(2,3), b(2,3)
1089 print *, any(a .eq. b, 1)
1090 print *, any(a .eq. b, 2)
1091 end subroutine section
1092 end program test_any
1099 @section @code{ASIN} --- Arcsine function
1100 @cindex @code{ASIN} intrinsic
1101 @cindex @code{DASIN} intrinsic
1102 @cindex trigonometric functions (inverse)
1105 @item @emph{Description}:
1106 @code{ASIN(X)} computes the arcsine of its @var{X} (inverse of @code{SIN(X)}).
1108 @item @emph{Standard}:
1114 @item @emph{Syntax}:
1117 @item @emph{Arguments}:
1118 @multitable @columnfractions .15 .80
1119 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
1123 @item @emph{Return value}:
1124 The return value is of type @code{REAL(*)} and it lies in the
1125 range @math{-\pi / 2 \leq \asin (x) \leq \pi / 2}. The kind type
1126 parameter is the same as @var{X}.
1128 @item @emph{Example}:
1131 real(8) :: x = 0.866_8
1133 end program test_asin
1136 @item @emph{Specific names}:
1137 @multitable @columnfractions .20 .20 .20 .40
1138 @item Name @tab Argument @tab Return type @tab Standard
1139 @item @code{DASIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1142 @item @emph{See also}:
1143 Inverse function: @ref{SIN}
1149 @section @code{ASINH} --- Hyperbolic arcsine function
1150 @cindex @code{ASINH} intrinsic
1151 @cindex hyperbolic arcsine
1152 @cindex hyperbolic sine (inverse)
1155 @item @emph{Description}:
1156 @code{ASINH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{SINH(X)}).
1158 @item @emph{Standard}:
1164 @item @emph{Syntax}:
1167 @item @emph{Arguments}:
1168 @multitable @columnfractions .15 .80
1169 @item @var{X} @tab The type shall be @code{REAL(*)}, with @var{X} a real number.
1172 @item @emph{Return value}:
1173 The return value is of type @code{REAL(*)} and it lies in the
1174 range @math{-\infty \leq \asinh (x) \leq \infty}.
1176 @item @emph{Example}:
1179 REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1180 WRITE (*,*) ASINH(x)
1184 @item @emph{See also}:
1185 Inverse function: @ref{SINH}
1191 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair
1192 @cindex @code{ASSOCIATED} intrinsic
1193 @cindex pointer status
1196 @item @emph{Description}:
1197 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
1198 or if @var{PTR} is associated with the target @var{TGT}.
1200 @item @emph{Standard}:
1206 @item @emph{Syntax}:
1207 @code{L = ASSOCIATED(PTR)}
1208 @code{L = ASSOCIATED(PTR [, TGT])}
1210 @item @emph{Arguments}:
1211 @multitable @columnfractions .15 .80
1212 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
1213 it can be of any type.
1214 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
1215 a @code{TARGET}. It must have the same type, kind type parameter, and
1216 array rank as @var{PTR}.
1218 The status of neither @var{PTR} nor @var{TGT} can be undefined.
1220 @item @emph{Return value}:
1221 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
1222 There are several cases:
1224 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
1225 is true if @var{PTR} is associated with a target; otherwise, it returns false.
1226 @item (B) If @var{TGT} is present and a scalar target, the result is true if
1228 is not a 0 sized storage sequence and the target associated with @var{PTR}
1229 occupies the same storage units. If @var{PTR} is disassociated, then the
1231 @item (C) If @var{TGT} is present and an array target, the result is true if
1232 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
1233 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
1234 @var{PTR} occupy the same storage units in array element order.
1235 As in case(B), the result is false, if @var{PTR} is disassociated.
1236 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
1237 target associated with @var{PTR} and the target associated with @var{TGT}
1238 are not 0 sized storage sequences and occupy the same storage units.
1239 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1240 @item (E) If @var{TGT} is present and an array pointer, the result is true if
1241 target associated with @var{PTR} and the target associated with @var{TGT}
1242 have the same shape, are not 0 sized arrays, are arrays whose elements are
1243 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
1244 storage units in array element order.
1245 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
1248 @item @emph{Example}:
1250 program test_associated
1252 real, target :: tgt(2) = (/1., 2./)
1253 real, pointer :: ptr(:)
1255 if (associated(ptr) .eqv. .false.) call abort
1256 if (associated(ptr,tgt) .eqv. .false.) call abort
1257 end program test_associated
1260 @item @emph{See also}:
1267 @section @code{ATAN} --- Arctangent function
1268 @cindex @code{ATAN} intrinsic
1269 @cindex @code{DATAN} intrinsic
1270 @cindex trigonometric functions (inverse)
1273 @item @emph{Description}:
1274 @code{ATAN(X)} computes the arctangent of @var{X}.
1276 @item @emph{Standard}:
1282 @item @emph{Syntax}:
1285 @item @emph{Arguments}:
1286 @multitable @columnfractions .15 .80
1287 @item @var{X} @tab The type shall be @code{REAL(*)}.
1290 @item @emph{Return value}:
1291 The return value is of type @code{REAL(*)} and it lies in the
1292 range @math{ - \pi / 2 \leq \atan (x) \leq \pi / 2}.
1294 @item @emph{Example}:
1297 real(8) :: x = 2.866_8
1299 end program test_atan
1302 @item @emph{Specific names}:
1303 @multitable @columnfractions .20 .20 .20 .40
1304 @item Name @tab Argument @tab Return type @tab Standard
1305 @item @code{DATAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1308 @item @emph{See also}:
1309 Inverse function: @ref{TAN}
1316 @section @code{ATAN2} --- Arctangent function
1317 @cindex @code{ATAN2} intrinsic
1318 @cindex @code{DATAN2} intrinsic
1319 @cindex trigonometric functions (inverse)
1322 @item @emph{Description}:
1323 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
1325 @item @emph{Standard}:
1331 @item @emph{Syntax}:
1332 @code{X = ATAN2(Y,X)}
1334 @item @emph{Arguments}:
1335 @multitable @columnfractions .15 .80
1336 @item @var{Y} @tab The type shall be @code{REAL(*)}.
1337 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
1338 If @var{Y} is zero, then @var{X} must be nonzero.
1341 @item @emph{Return value}:
1342 The return value has the same type and kind type parameter as @var{Y}.
1343 It is the principal value of the complex number @math{X + i Y}. If
1344 @var{X} is nonzero, then it lies in the range @math{-\pi \le \atan (x) \leq \pi}.
1345 The sign is positive if @var{Y} is positive. If @var{Y} is zero, then
1346 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
1347 is negative. Finally, if @var{X} is zero, then the magnitude of the result
1350 @item @emph{Example}:
1353 real(4) :: x = 1.e0_4, y = 0.5e0_4
1355 end program test_atan2
1358 @item @emph{Specific names}:
1359 @multitable @columnfractions .20 .20 .20 .40
1360 @item Name @tab Argument @tab Return type @tab Standard
1361 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
1368 @section @code{ATANH} --- Hyperbolic arctangent function
1369 @cindex @code{ASINH} intrinsic
1370 @cindex hyperbolic arctangent
1371 @cindex hyperbolic tangent (inverse)
1374 @item @emph{Description}:
1375 @code{ATANH(X)} computes the area hyperbolic sine of @var{X} (inverse of @code{TANH(X)}).
1377 @item @emph{Standard}:
1383 @item @emph{Syntax}:
1386 @item @emph{Arguments}:
1387 @multitable @columnfractions .15 .80
1388 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude
1389 that is less than or equal to one.
1392 @item @emph{Return value}:
1393 The return value is of type @code{REAL(*)} and it lies in the
1394 range @math{-\infty \leq \atanh(x) \leq \infty}.
1396 @item @emph{Example}:
1399 REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
1400 WRITE (*,*) ATANH(x)
1404 @item @emph{See also}:
1405 Inverse function: @ref{TANH}
1412 @section @code{BESJ0} --- Bessel function of the first kind of order 0
1413 @cindex @code{BESJ0} intrinsic
1414 @cindex @code{DBESJ0} intrinsic
1418 @item @emph{Description}:
1419 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
1422 @item @emph{Standard}:
1428 @item @emph{Syntax}:
1431 @item @emph{Arguments}:
1432 @multitable @columnfractions .15 .80
1433 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1436 @item @emph{Return value}:
1437 The return value is of type @code{REAL(*)} and it lies in the
1438 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
1440 @item @emph{Example}:
1443 real(8) :: x = 0.0_8
1445 end program test_besj0
1448 @item @emph{Specific names}:
1449 @multitable @columnfractions .20 .20 .20 .40
1450 @item Name @tab Argument @tab Return type @tab Standard
1451 @item @code{DBESJ0(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1458 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1459 @cindex @code{BESJ1} intrinsic
1460 @cindex @code{DBESJ1} intrinsic
1464 @item @emph{Description}:
1465 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1468 @item @emph{Standard}:
1474 @item @emph{Syntax}:
1477 @item @emph{Arguments}:
1478 @multitable @columnfractions .15 .80
1479 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1482 @item @emph{Return value}:
1483 The return value is of type @code{REAL(*)} and it lies in the
1484 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1486 @item @emph{Example}:
1489 real(8) :: x = 1.0_8
1491 end program test_besj1
1494 @item @emph{Specific names}:
1495 @multitable @columnfractions .20 .20 .20 .40
1496 @item Name @tab Argument @tab Return type @tab Standard
1497 @item @code{DBESJ1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1504 @section @code{BESJN} --- Bessel function of the first kind
1505 @cindex @code{BESJN} intrinsic
1506 @cindex @code{DBESJN} intrinsic
1510 @item @emph{Description}:
1511 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1514 @item @emph{Standard}:
1520 @item @emph{Syntax}:
1521 @code{Y = BESJN(N, X)}
1523 @item @emph{Arguments}:
1524 @multitable @columnfractions .15 .80
1525 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1526 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1529 @item @emph{Return value}:
1530 The return value is a scalar of type @code{REAL(*)}.
1532 @item @emph{Example}:
1535 real(8) :: x = 1.0_8
1537 end program test_besjn
1540 @item @emph{Specific names}:
1541 @multitable @columnfractions .20 .20 .20 .40
1542 @item Name @tab Argument @tab Return type @tab Standard
1543 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1544 @item @tab @code{REAL(8) X} @tab @tab
1551 @section @code{BESY0} --- Bessel function of the second kind of order 0
1552 @cindex @code{BESY0} intrinsic
1553 @cindex @code{DBESY0} intrinsic
1557 @item @emph{Description}:
1558 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1561 @item @emph{Standard}:
1567 @item @emph{Syntax}:
1570 @item @emph{Arguments}:
1571 @multitable @columnfractions .15 .80
1572 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1575 @item @emph{Return value}:
1576 The return value is a scalar of type @code{REAL(*)}.
1578 @item @emph{Example}:
1581 real(8) :: x = 0.0_8
1583 end program test_besy0
1586 @item @emph{Specific names}:
1587 @multitable @columnfractions .20 .20 .20 .40
1588 @item Name @tab Argument @tab Return type @tab Standard
1589 @item @code{DBESY0(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1596 @section @code{BESY1} --- Bessel function of the second kind of order 1
1597 @cindex @code{BESY1} intrinsic
1598 @cindex @code{DBESY1} intrinsic
1602 @item @emph{Description}:
1603 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1606 @item @emph{Standard}:
1612 @item @emph{Syntax}:
1615 @item @emph{Arguments}:
1616 @multitable @columnfractions .15 .80
1617 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1620 @item @emph{Return value}:
1621 The return value is a scalar of type @code{REAL(*)}.
1623 @item @emph{Example}:
1626 real(8) :: x = 1.0_8
1628 end program test_besy1
1631 @item @emph{Specific names}:
1632 @multitable @columnfractions .20 .20 .20 .40
1633 @item Name @tab Argument @tab Return type @tab Standard
1634 @item @code{DBESY1(X)}@tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
1641 @section @code{BESYN} --- Bessel function of the second kind
1642 @cindex @code{BESYN} intrinsic
1643 @cindex @code{DBESYN} intrinsic
1647 @item @emph{Description}:
1648 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1651 @item @emph{Standard}:
1657 @item @emph{Syntax}:
1658 @code{Y = BESYN(N, X)}
1660 @item @emph{Arguments}:
1661 @multitable @columnfractions .15 .80
1662 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1663 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1666 @item @emph{Return value}:
1667 The return value is a scalar of type @code{REAL(*)}.
1669 @item @emph{Example}:
1672 real(8) :: x = 1.0_8
1674 end program test_besyn
1677 @item @emph{Specific names}:
1678 @multitable @columnfractions .20 .20 .20 .40
1679 @item Name @tab Argument @tab Return type @tab Standard
1680 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)} @tab GNU extension
1681 @item @tab @code{REAL(8) X} @tab @tab
1688 @section @code{BIT_SIZE} --- Bit size inquiry function
1689 @cindex @code{BIT_SIZE} intrinsic
1690 @cindex bit size of a variable
1691 @cindex size of a variable, in bits
1694 @item @emph{Description}:
1695 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1696 represented by the type of @var{I}.
1698 @item @emph{Standard}:
1704 @item @emph{Syntax}:
1705 @code{I = BIT_SIZE(I)}
1707 @item @emph{Arguments}:
1708 @multitable @columnfractions .15 .80
1709 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1712 @item @emph{Return value}:
1713 The return value is of type @code{INTEGER(*)}
1715 @item @emph{Example}:
1717 program test_bit_size
1722 end program test_bit_size
1729 @section @code{BTEST} --- Bit test function
1730 @cindex @code{BTEST} intrinsic
1731 @cindex bit operations
1734 @item @emph{Description}:
1735 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1738 @item @emph{Standard}:
1744 @item @emph{Syntax}:
1745 @code{I = BTEST(I,POS)}
1747 @item @emph{Arguments}:
1748 @multitable @columnfractions .15 .80
1749 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1750 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1753 @item @emph{Return value}:
1754 The return value is of type @code{LOGICAL}
1756 @item @emph{Example}:
1759 integer :: i = 32768 + 1024 + 64
1763 bool = btest(i, pos)
1766 end program test_btest
1773 @section @code{CEILING} --- Integer ceiling function
1774 @cindex @code{CEILING} intrinsic
1778 @item @emph{Description}:
1779 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1781 @item @emph{Standard}:
1787 @item @emph{Syntax}:
1788 @code{I = CEILING(X[,KIND])}
1790 @item @emph{Arguments}:
1791 @multitable @columnfractions .15 .80
1792 @item @var{X} @tab The type shall be @code{REAL(*)}.
1793 @item @var{KIND} @tab (Optional) scalar integer initialization expression.
1796 @item @emph{Return value}:
1797 The return value is of type @code{INTEGER(KIND)}
1799 @item @emph{Example}:
1801 program test_ceiling
1804 print *, ceiling(x) ! returns 64
1805 print *, ceiling(y) ! returns -63
1806 end program test_ceiling
1809 @item @emph{See also}:
1810 @ref{FLOOR}, @ref{NINT}
1817 @section @code{CHAR} --- Character conversion function
1818 @cindex @code{CHAR} intrinsic
1819 @cindex conversion function (character)
1822 @item @emph{Description}:
1823 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1825 @item @emph{Standard}:
1831 @item @emph{Syntax}:
1832 @code{C = CHAR(I[,KIND])}
1834 @item @emph{Arguments}:
1835 @multitable @columnfractions .15 .80
1836 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1837 @item @var{KIND} @tab Optional scaler integer initialization expression.
1840 @item @emph{Return value}:
1841 The return value is of type @code{CHARACTER(1)}
1843 @item @emph{Example}:
1849 print *, i, c ! returns 'J'
1850 end program test_char
1853 @item @emph{See also}:
1854 @ref{ACHAR}, @ref{ICHAR}, @ref{IACHAR}
1860 @section @code{CHDIR} --- Change working directory
1861 @cindex @code{CHDIR} intrinsic
1862 @cindex file system operations
1865 @item @emph{Description}:
1866 Change current working directory to a specified @var{PATH}.
1868 @item @emph{Standard}:
1872 Non-elemental subroutine
1874 @item @emph{Syntax}:
1875 @code{CALL chdir(PATH[,STATUS])}
1877 @item @emph{Arguments}:
1878 @multitable @columnfractions .15 .80
1879 @item @var{PATH} @tab The type shall be @code{CHARACTER(*)} and shall
1880 specify a valid path within the file system.
1881 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
1882 a system specific and non-zero error code otherwise.
1885 @item @emph{Example}:
1888 CHARACTER(len=255) :: path
1890 WRITE(*,*) TRIM(path)
1893 WRITE(*,*) TRIM(path)
1897 @item @emph{See also}:
1904 @section @code{CHMOD} --- Change access permissions of files
1905 @cindex @code{CHMOD} intrinsic
1906 @cindex file system operations
1909 @item @emph{Description}:
1910 @code{CHMOD} changes the permissions of a file. This function invokes
1911 @code{/bin/chmod} and might therefore not work on all platforms.
1913 This intrinsic is provided in both subroutine and function forms; however,
1914 only one form can be used in any given program unit.
1916 @item @emph{Standard}:
1920 Subroutine, non-elemental function
1922 @item @emph{Syntax}:
1923 @multitable @columnfractions .80
1924 @item @code{CALL CHMOD(NAME, MODE[, STATUS])}
1925 @item @code{STATUS = CHMOD(NAME, MODE)}
1928 @item @emph{Arguments}:
1929 @multitable @columnfractions .15 .80
1930 @item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
1931 Trailing blanks are ignored unless the character @code{achar(0)} is
1932 present, then all characters up to and excluding @code{achar(0)} are
1933 used as the file name.
1935 @item @var{MODE} @tab Scalar @code{CHARACTER} giving the file permission.
1936 @var{MODE} uses the same syntax as the @var{MODE} argument of
1939 @item @var{STATUS} @tab (optional) scalar @code{INTEGER}, which is
1940 @code{0} on success and non-zero otherwise.
1943 @item @emph{Return value}:
1944 In either syntax, @var{STATUS} is set to @code{0} on success and non-zero
1947 @item @emph{Example}:
1948 @code{CHMOD} as subroutine
1953 call chmod('test.dat','u+x',status)
1954 print *, 'Status: ', status
1955 end program chmod_test
1957 @code{CHMOD} as non-elemental function:
1962 status = chmod('test.dat','u+x')
1963 print *, 'Status: ', status
1964 end program chmod_test
1966 @item @emph{Specific names}:
1967 @item @emph{See also}:
1973 @section @code{CMPLX} --- Complex conversion function
1974 @cindex @code{CMPLX} intrinsic
1975 @cindex complex numbers, conversion to
1978 @item @emph{Description}:
1979 @code{CMPLX(X[,Y[,KIND]])} returns a complex number where @var{X} is converted to
1980 the real component. If @var{Y} is present it is converted to the imaginary
1981 component. If @var{Y} is not present then the imaginary component is set to
1982 0.0. If @var{X} is complex then @var{Y} must not be present.
1984 @item @emph{Standard}:
1990 @item @emph{Syntax}:
1991 @code{C = CMPLX(X[,Y[,KIND]])}
1993 @item @emph{Arguments}:
1994 @multitable @columnfractions .15 .80
1995 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)},
1996 or @code{COMPLEX(*)}.
1997 @item @var{Y} @tab Optional, allowed if @var{X} is not
1998 @code{COMPLEX(*)}. May be @code{INTEGER(*)}
2000 @item @var{KIND} @tab Optional scaler integer initialization expression.
2003 @item @emph{Return value}:
2004 The return value is of type @code{COMPLEX(*)}
2006 @item @emph{Example}:
2013 print *, z, cmplx(x)
2014 end program test_cmplx
2020 @node COMMAND_ARGUMENT_COUNT
2021 @section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
2022 @cindex @code{COMMAND_ARGUMENT_COUNT} intrinsic
2023 @cindex command-line arguments, to program
2026 @item @emph{Description}:
2027 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
2028 command line when the containing program was invoked.
2030 @item @emph{Standard}:
2036 @item @emph{Syntax}:
2037 @code{I = COMMAND_ARGUMENT_COUNT()}
2039 @item @emph{Arguments}:
2040 @multitable @columnfractions .15 .80
2044 @item @emph{Return value}:
2045 The return value is of type @code{INTEGER(4)}
2047 @item @emph{Example}:
2049 program test_command_argument_count
2051 count = command_argument_count()
2053 end program test_command_argument_count
2056 @item @emph{See also}:
2057 @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
2061 @section @code{CONJG} --- Complex conjugate function
2062 @cindex @code{CONJG} intrinsic
2063 @cindex @code{DCONJG} intrinsic
2064 @cindex complex conjugate
2066 @item @emph{Description}:
2067 @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)}
2068 then the result is @code{(x, -y)}
2070 @item @emph{Standard}:
2071 F77 and later, has overloads that are GNU extensions
2076 @item @emph{Syntax}:
2079 @item @emph{Arguments}:
2080 @multitable @columnfractions .15 .80
2081 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
2084 @item @emph{Return value}:
2085 The return value is of type @code{COMPLEX(*)}.
2087 @item @emph{Example}:
2090 complex :: z = (2.0, 3.0)
2091 complex(8) :: dz = (2.71_8, -3.14_8)
2096 end program test_conjg
2099 @item @emph{Specific names}:
2100 @multitable @columnfractions .20 .20 .20 .40
2101 @item Name @tab Argument @tab Return type @tab Standard
2102 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab GNU extension
2109 @section @code{COS} --- Cosine function
2110 @cindex @code{COS} intrinsic
2111 @cindex @code{DCOS} intrinsic
2112 @cindex @code{ZCOS} intrinsic
2113 @cindex @code{CDCOS} intrinsic
2114 @cindex trigonometric functions
2117 @item @emph{Description}:
2118 @code{COS(X)} computes the cosine of @var{X}.
2120 @item @emph{Standard}:
2121 F77 and later, has overloads that are GNU extensions
2126 @item @emph{Syntax}:
2129 @item @emph{Arguments}:
2130 @multitable @columnfractions .15 .80
2131 @item @var{X} @tab The type shall be @code{REAL(*)} or
2135 @item @emph{Return value}:
2136 The return value is of type @code{REAL(*)} and it lies in the
2137 range @math{ -1 \leq \cos (x) \leq 1}. The kind type
2138 parameter is the same as @var{X}.
2140 @item @emph{Example}:
2145 end program test_cos
2148 @item @emph{Specific names}:
2149 @multitable @columnfractions .20 .20 .20 .40
2150 @item Name @tab Argument @tab Return type @tab Standard
2151 @item @code{DCOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2152 @item @code{CCOS(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
2153 @item @code{ZCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2154 @item @code{CDCOS(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
2157 @item @emph{See also}:
2158 Inverse function: @ref{ACOS}
2165 @section @code{COSH} --- Hyperbolic cosine function
2166 @cindex @code{COSH} intrinsic
2167 @cindex @code{DCOSH} intrinsic
2168 @cindex hyperbolic cosine
2171 @item @emph{Description}:
2172 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
2174 @item @emph{Standard}:
2180 @item @emph{Syntax}:
2183 @item @emph{Arguments}:
2184 @multitable @columnfractions .15 .80
2185 @item @var{X} @tab The type shall be @code{REAL(*)}.
2188 @item @emph{Return value}:
2189 The return value is of type @code{REAL(*)} and it is positive
2190 (@math{ \cosh (x) \geq 0 }.
2192 @item @emph{Example}:
2195 real(8) :: x = 1.0_8
2197 end program test_cosh
2200 @item @emph{Specific names}:
2201 @multitable @columnfractions .20 .20 .20 .40
2202 @item Name @tab Argument @tab Return type @tab Standard
2203 @item @code{DCOSH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
2206 @item @emph{See also}:
2207 Inverse function: @ref{ACOSH}
2214 @section @code{COUNT} --- Count function
2215 @cindex @code{COUNT} intrinsic
2219 @item @emph{Description}:
2220 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
2221 @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2222 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2223 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
2225 @item @emph{Standard}:
2229 transformational function
2231 @item @emph{Syntax}:
2232 @code{I = COUNT(MASK[,DIM])}
2234 @item @emph{Arguments}:
2235 @multitable @columnfractions .15 .80
2236 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
2237 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2240 @item @emph{Return value}:
2241 The return value is of type @code{INTEGER} with rank equal to that of
2244 @item @emph{Example}:
2247 integer, dimension(2,3) :: a, b
2248 logical, dimension(2,3) :: mask
2249 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
2250 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
2251 print '(3i3)', a(1,:)
2252 print '(3i3)', a(2,:)
2254 print '(3i3)', b(1,:)
2255 print '(3i3)', b(2,:)
2258 print '(3l3)', mask(1,:)
2259 print '(3l3)', mask(2,:)
2261 print '(3i3)', count(mask)
2263 print '(3i3)', count(mask, 1)
2265 print '(3i3)', count(mask, 2)
2266 end program test_count
2273 @section @code{CPU_TIME} --- CPU elapsed time in seconds
2274 @cindex @code{CPU_TIME} intrinsic
2275 @cindex time, elapsed
2276 @cindex elapsed time
2279 @item @emph{Description}:
2280 Returns a @code{REAL} value representing the elapsed CPU time in seconds. This
2281 is useful for testing segments of code to determine execution time.
2283 @item @emph{Standard}:
2289 @item @emph{Syntax}:
2292 @item @emph{Arguments}:
2293 @multitable @columnfractions .15 .80
2294 @item @var{X} @tab The type shall be @code{REAL} with @code{INTENT(OUT)}.
2297 @item @emph{Return value}:
2300 @item @emph{Example}:
2302 program test_cpu_time
2303 real :: start, finish
2304 call cpu_time(start)
2305 ! put code to test here
2306 call cpu_time(finish)
2307 print '("Time = ",f6.3," seconds.")',finish-start
2308 end program test_cpu_time
2315 @section @code{CSHIFT} --- Circular shift function
2316 @cindex @code{CSHIFT} intrinsic
2317 @cindex bit operations
2320 @item @emph{Description}:
2321 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
2322 @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is
2323 taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the
2324 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
2325 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
2326 by @var{SHIFT} places. If rank is greater than one, then all complete rank one
2327 sections of @var{ARRAY} along the given dimension are shifted. Elements
2328 shifted out one end of each rank one section are shifted back in the other end.
2330 @item @emph{Standard}:
2334 transformational function
2336 @item @emph{Syntax}:
2337 @code{A = CSHIFT(A, SHIFT[,DIM])}
2339 @item @emph{Arguments}:
2340 @multitable @columnfractions .15 .80
2341 @item @var{ARRAY} @tab May be any type, not scaler.
2342 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2343 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2346 @item @emph{Return value}:
2347 Returns an array of same type and rank as the @var{ARRAY} argument.
2349 @item @emph{Example}:
2352 integer, dimension(3,3) :: a
2353 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2354 print '(3i3)', a(1,:)
2355 print '(3i3)', a(2,:)
2356 print '(3i3)', a(3,:)
2357 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
2359 print '(3i3)', a(1,:)
2360 print '(3i3)', a(2,:)
2361 print '(3i3)', a(3,:)
2362 end program test_cshift
2368 @section @code{CTIME} --- Convert a time into a string
2369 @cindex @code{CTIME} intrinsic
2370 @cindex time, conversion function
2373 @item @emph{Description}:
2374 @code{CTIME(T,S)} converts @var{T}, a system time value, such as returned
2375 by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14
2376 1995}, and returns that string into @var{S}.
2378 If @code{CTIME} is invoked as a function, it can not be invoked as a
2379 subroutine, and vice versa.
2381 @var{T} is an @code{INTENT(IN)} @code{INTEGER(KIND=8)} variable.
2382 @var{S} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
2384 @item @emph{Standard}:
2390 @item @emph{Syntax}:
2391 @multitable @columnfractions .80
2392 @item @code{CALL CTIME(T,S)}.
2393 @item @code{S = CTIME(T)}, (not recommended).
2396 @item @emph{Arguments}:
2397 @multitable @columnfractions .15 .80
2398 @item @var{S}@tab The type shall be of type @code{CHARACTER}.
2399 @item @var{T}@tab The type shall be of type @code{INTEGER(KIND=8)}.
2402 @item @emph{Return value}:
2403 The converted date and time as a string.
2405 @item @emph{Example}:
2409 character(len=30) :: date
2412 ! Do something, main part of the program
2415 print *, 'Program was started on ', date
2416 end program test_ctime
2421 @section @code{DATE_AND_TIME} --- Date and time subroutine
2422 @cindex @code{DATE_AND_TIME} intrinsic
2423 @cindex date, current
2424 @cindex current date
2425 @cindex time, current
2426 @cindex current time
2429 @item @emph{Description}:
2430 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
2431 time information from the real-time system clock. @var{DATE} is
2432 @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and
2433 has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
2434 representing the difference with respect to Coordinated Universal Time (UTC).
2435 Unavailable time and date parameters return blanks.
2437 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
2439 @multitable @columnfractions .15 .30 .60
2440 @item @tab @code{VALUE(1)}: @tab The year
2441 @item @tab @code{VALUE(2)}: @tab The month
2442 @item @tab @code{VALUE(3)}: @tab The day of the month
2443 @item @tab @code{VALUE(4)}: @tab Time difference with UTC in minutes
2444 @item @tab @code{VALUE(5)}: @tab The hour of the day
2445 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
2446 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
2447 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
2450 @item @emph{Standard}:
2456 @item @emph{Syntax}:
2457 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
2459 @item @emph{Arguments}:
2460 @multitable @columnfractions .15 .80
2461 @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
2462 @item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
2463 @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
2464 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
2467 @item @emph{Return value}:
2470 @item @emph{Example}:
2472 program test_time_and_date
2473 character(8) :: date
2474 character(10) :: time
2475 character(5) :: zone
2476 integer,dimension(8) :: values
2477 ! using keyword arguments
2478 call date_and_time(date,time,zone,values)
2479 call date_and_time(DATE=date,ZONE=zone)
2480 call date_and_time(TIME=time)
2481 call date_and_time(VALUES=values)
2482 print '(a,2x,a,2x,a)', date, time, zone
2483 print '(8i5))', values
2484 end program test_time_and_date
2491 @section @code{DBLE} --- Double conversion function
2492 @cindex @code{DBLE} intrinsic
2493 @cindex double conversion
2496 @item @emph{Description}:
2497 @code{DBLE(X)} Converts @var{X} to double precision real type.
2499 @item @emph{Standard}:
2505 @item @emph{Syntax}:
2508 @item @emph{Arguments}:
2509 @multitable @columnfractions .15 .80
2510 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)},
2511 or @code{COMPLEX(*)}.
2514 @item @emph{Return value}:
2515 The return value is of type double precision real.
2517 @item @emph{Example}:
2522 complex :: z = (2.3,1.14)
2523 print *, dble(x), dble(i), dble(z)
2524 end program test_dble
2527 @item @emph{See also}:
2528 @ref{DFLOAT}, @ref{FLOAT}, @ref{REAL}
2534 @section @code{DCMPLX} --- Double complex conversion function
2535 @cindex @code{DCMPLX} intrinsic
2536 @cindex complex numbers, conversion to
2539 @item @emph{Description}:
2540 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
2541 converted to the real component. If @var{Y} is present it is converted to the
2542 imaginary component. If @var{Y} is not present then the imaginary component is
2543 set to 0.0. If @var{X} is complex then @var{Y} must not be present.
2545 @item @emph{Standard}:
2551 @item @emph{Syntax}:
2552 @code{C = DCMPLX(X)}
2553 @code{C = DCMPLX(X,Y)}
2555 @item @emph{Arguments}:
2556 @multitable @columnfractions .15 .80
2557 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)},
2558 or @code{COMPLEX(*)}.
2559 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be
2560 @code{INTEGER(*)} or @code{REAL(*)}.
2563 @item @emph{Return value}:
2564 The return value is of type @code{COMPLEX(8)}
2566 @item @emph{Example}:
2576 print *, dcmplx(x,i)
2577 end program test_dcmplx
2584 @section @code{DFLOAT} --- Double conversion function
2585 @cindex @code{DFLOAT} intrinsic
2586 @cindex double float conversion
2589 @item @emph{Description}:
2590 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
2592 @item @emph{Standard}:
2598 @item @emph{Syntax}:
2599 @code{X = DFLOAT(X)}
2601 @item @emph{Arguments}:
2602 @multitable @columnfractions .15 .80
2603 @item @var{X} @tab The type shall be @code{INTEGER(*)}.
2606 @item @emph{Return value}:
2607 The return value is of type double precision real.
2609 @item @emph{Example}:
2614 end program test_dfloat
2617 @item @emph{See also}:
2618 @ref{DBLE}, @ref{FLOAT}, @ref{REAL}
2624 @section @code{DIGITS} --- Significant digits function
2625 @cindex @code{DIGITS} intrinsic
2626 @cindex digits, significant
2629 @item @emph{Description}:
2630 @code{DIGITS(X)} returns the number of significant digits of the internal model
2631 representation of @var{X}. For example, on a system using a 32-bit
2632 floating point representation, a default real number would likely return 24.
2634 @item @emph{Standard}:
2640 @item @emph{Syntax}:
2641 @code{C = DIGITS(X)}
2643 @item @emph{Arguments}:
2644 @multitable @columnfractions .15 .80
2645 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
2648 @item @emph{Return value}:
2649 The return value is of type @code{INTEGER}.
2651 @item @emph{Example}:
2654 integer :: i = 12345
2660 end program test_digits
2667 @section @code{DIM} --- Dim function
2668 @cindex @code{DIM} intrinsic
2669 @cindex @code{IDIM} intrinsic
2670 @cindex @code{DDIM} intrinsic
2674 @item @emph{Description}:
2675 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
2676 otherwise returns zero.
2678 @item @emph{Standard}:
2684 @item @emph{Syntax}:
2687 @item @emph{Arguments}:
2688 @multitable @columnfractions .15 .80
2689 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2690 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2693 @item @emph{Return value}:
2694 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2696 @item @emph{Example}:
2702 x = dim(4.345_8, 2.111_8)
2705 end program test_dim
2708 @item @emph{Specific names}:
2709 @multitable @columnfractions .20 .20 .20 .40
2710 @item Name @tab Argument @tab Return type @tab Standard
2711 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab F77 and later
2712 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y} @tab @code{REAL(8)} @tab F77 and later
2719 @section @code{DOT_PRODUCT} --- Dot product function
2720 @cindex @code{DOT_PRODUCT} intrinsic
2724 @item @emph{Description}:
2725 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2726 @var{X} and @var{Y}. The two vectors may be either numeric or logical
2727 and must be arrays of rank one and of equal size. If the vectors are
2728 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2729 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the
2730 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2732 @item @emph{Standard}:
2736 transformational function
2738 @item @emph{Syntax}:
2739 @code{S = DOT_PRODUCT(X,Y)}
2741 @item @emph{Arguments}:
2742 @multitable @columnfractions .15 .80
2743 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2744 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2747 @item @emph{Return value}:
2748 If the arguments are numeric, the return value is a scaler of numeric type,
2749 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}. If the arguments are
2750 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2752 @item @emph{Example}:
2754 program test_dot_prod
2755 integer, dimension(3) :: a, b
2762 print *, dot_product(a,b)
2763 end program test_dot_prod
2770 @section @code{DPROD} --- Double product function
2771 @cindex @code{DPROD} intrinsic
2772 @cindex double-precision product
2775 @item @emph{Description}:
2776 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2778 @item @emph{Standard}:
2784 @item @emph{Syntax}:
2785 @code{D = DPROD(X,Y)}
2787 @item @emph{Arguments}:
2788 @multitable @columnfractions .15 .80
2789 @item @var{X} @tab The type shall be @code{REAL}.
2790 @item @var{Y} @tab The type shall be @code{REAL}.
2793 @item @emph{Return value}:
2794 The return value is of type @code{REAL(8)}.
2796 @item @emph{Example}:
2805 end program test_dprod
2812 @section @code{DREAL} --- Double real part function
2813 @cindex @code{DREAL} intrinsic
2814 @cindex double-precision real part
2817 @item @emph{Description}:
2818 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2820 @item @emph{Standard}:
2826 @item @emph{Syntax}:
2829 @item @emph{Arguments}:
2830 @multitable @columnfractions .15 .80
2831 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2834 @item @emph{Return value}:
2835 The return value is of type @code{REAL(8)}.
2837 @item @emph{Example}:
2840 complex(8) :: z = (1.3_8,7.2_8)
2842 end program test_dreal
2845 @item @emph{See also}:
2853 @section @code{DTIME} --- Execution time subroutine (or function)
2854 @cindex @code{DTIME} intrinsic
2855 @cindex time, elapsed
2856 @cindex elapsed time
2859 @item @emph{Description}:
2860 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2861 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
2862 returns the user and system components of this time in @code{TARRAY(1)} and
2863 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2866 Subsequent invocations of @code{DTIME} return values accumulated since the
2867 previous invocation.
2869 On some systems, the underlying timings are represented using types with
2870 sufficiently small limits that overflows (wrap around) are possible, such as
2871 32-bit types. Therefore, the values returned by this intrinsic might be, or
2872 become, negative, or numerically less than previous values, during a single
2873 run of the compiled program.
2875 If @code{DTIME} is invoked as a function, it can not be invoked as a
2876 subroutine, and vice versa.
2878 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2880 @multitable @columnfractions .15 .30 .60
2881 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2882 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2883 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2886 @item @emph{Standard}:
2892 @item @emph{Syntax}:
2893 @multitable @columnfractions .80
2894 @item @code{CALL DTIME(TARRAY, RESULT)}.
2895 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2898 @item @emph{Arguments}:
2899 @multitable @columnfractions .15 .80
2900 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2901 @item @var{RESULT}@tab The type shall be @code{REAL}.
2904 @item @emph{Return value}:
2905 Elapsed time in seconds since the start of program execution.
2907 @item @emph{Example}:
2911 real, dimension(2) :: tarray
2913 call dtime(tarray, result)
2917 do i=1,100000000 ! Just a delay
2920 call dtime(tarray, result)
2924 end program test_dtime
2931 @section @code{EOSHIFT} --- End-off shift function
2932 @cindex @code{EOSHIFT} intrinsic
2933 @cindex bit operations
2936 @item @emph{Description}:
2937 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2938 elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is
2939 omitted it is taken to be @code{1}. @var{DIM} is a scaler of type
2940 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2941 rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of
2942 @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
2943 then all complete rank one sections of @var{ARRAY} along the given dimension are
2944 shifted. Elements shifted out one end of each rank one section are dropped. If
2945 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2946 is copied back in the other end. If @var{BOUNDARY} is not present then the
2947 following are copied in depending on the type of @var{ARRAY}.
2949 @multitable @columnfractions .15 .80
2950 @item @emph{Array Type} @tab @emph{Boundary Value}
2951 @item Numeric @tab 0 of the type and kind of @var{ARRAY}.
2952 @item Logical @tab @code{.FALSE.}.
2953 @item Character(@var{len}) @tab @var{len} blanks.
2956 @item @emph{Standard}:
2960 transformational function
2962 @item @emph{Syntax}:
2963 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2965 @item @emph{Arguments}:
2966 @multitable @columnfractions .15 .80
2967 @item @var{ARRAY} @tab May be any type, not scaler.
2968 @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
2969 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
2970 @item @var{DIM} @tab The type shall be @code{INTEGER}.
2973 @item @emph{Return value}:
2974 Returns an array of same type and rank as the @var{ARRAY} argument.
2976 @item @emph{Example}:
2978 program test_eoshift
2979 integer, dimension(3,3) :: a
2980 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2981 print '(3i3)', a(1,:)
2982 print '(3i3)', a(2,:)
2983 print '(3i3)', a(3,:)
2984 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2986 print '(3i3)', a(1,:)
2987 print '(3i3)', a(2,:)
2988 print '(3i3)', a(3,:)
2989 end program test_eoshift
2996 @section @code{EPSILON} --- Epsilon function
2997 @cindex @code{EPSILON} intrinsic
2998 @cindex epsilon, significant
3001 @item @emph{Description}:
3002 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
3004 @item @emph{Standard}:
3010 @item @emph{Syntax}:
3011 @code{C = EPSILON(X)}
3013 @item @emph{Arguments}:
3014 @multitable @columnfractions .15 .80
3015 @item @var{X} @tab The type shall be @code{REAL(*)}.
3018 @item @emph{Return value}:
3019 The return value is of same type as the argument.
3021 @item @emph{Example}:
3023 program test_epsilon
3028 end program test_epsilon
3035 @section @code{ERF} --- Error function
3036 @cindex @code{ERF} intrinsic
3037 @cindex error function
3040 @item @emph{Description}:
3041 @code{ERF(X)} computes the error function of @var{X}.
3043 @item @emph{Standard}:
3049 @item @emph{Syntax}:
3052 @item @emph{Arguments}:
3053 @multitable @columnfractions .15 .80
3054 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3057 @item @emph{Return value}:
3058 The return value is a scalar of type @code{REAL(*)} and it is positive
3059 (@math{ - 1 \leq erf (x) \leq 1 }.
3061 @item @emph{Example}:
3064 real(8) :: x = 0.17_8
3066 end program test_erf
3069 @item @emph{Specific names}:
3070 @multitable @columnfractions .20 .20 .20 .40
3071 @item Name @tab Argument @tab Return type @tab Standard
3072 @item @code{DERF(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
3079 @section @code{ERFC} --- Error function
3080 @cindex @code{ERFC} intrinsic
3081 @cindex error function
3084 @item @emph{Description}:
3085 @code{ERFC(X)} computes the complementary error function of @var{X}.
3087 @item @emph{Standard}:
3093 @item @emph{Syntax}:
3096 @item @emph{Arguments}:
3097 @multitable @columnfractions .15 .80
3098 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
3101 @item @emph{Return value}:
3102 The return value is a scalar of type @code{REAL(*)} and it is positive
3103 (@math{ 0 \leq erfc (x) \leq 2 }.
3105 @item @emph{Example}:
3108 real(8) :: x = 0.17_8
3110 end program test_erfc
3113 @item @emph{Specific names}:
3114 @multitable @columnfractions .20 .20 .20 .40
3115 @item Name @tab Argument @tab Return type @tab Standard
3116 @item @code{DERFC(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU extension
3123 @section @code{ETIME} --- Execution time subroutine (or function)
3124 @cindex @code{ETIME} intrinsic
3125 @cindex time, elapsed
3128 @item @emph{Description}:
3129 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
3130 since the start of the process's execution in @var{RESULT}. @var{TARRAY}
3131 returns the user and system components of this time in @code{TARRAY(1)} and
3132 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
3134 On some systems, the underlying timings are represented using types with
3135 sufficiently small limits that overflows (wrap around) are possible, such as
3136 32-bit types. Therefore, the values returned by this intrinsic might be, or
3137 become, negative, or numerically less than previous values, during a single
3138 run of the compiled program.
3140 If @code{ETIME} is invoked as a function, it can not be invoked as a
3141 subroutine, and vice versa.
3143 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
3145 @multitable @columnfractions .15 .30 .60
3146 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
3147 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
3148 @item @tab @code{RESULT}: @tab Run time since start in seconds.
3151 @item @emph{Standard}:
3157 @item @emph{Syntax}:
3158 @multitable @columnfractions .8
3159 @item @code{CALL ETIME(TARRAY, RESULT)}.
3160 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
3163 @item @emph{Arguments}:
3164 @multitable @columnfractions .15 .80
3165 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
3166 @item @var{RESULT}@tab The type shall be @code{REAL}.
3169 @item @emph{Return value}:
3170 Elapsed time in seconds since the start of program execution.
3172 @item @emph{Example}:
3176 real, dimension(2) :: tarray
3178 call ETIME(tarray, result)
3182 do i=1,100000000 ! Just a delay
3185 call ETIME(tarray, result)
3189 end program test_etime
3192 @item @emph{See also}:
3200 @section @code{EXIT} --- Exit the program with status.
3201 @cindex @code{EXIT} intrinsic
3202 @cindex exit program
3205 @item @emph{Description}:
3206 @code{EXIT} causes immediate termination of the program with status. If status
3207 is omitted it returns the canonical @emph{success} for the system. All Fortran
3208 I/O units are closed.
3210 @item @emph{Standard}:
3216 @item @emph{Syntax}:
3217 @code{CALL EXIT([STATUS])}
3219 @item @emph{Arguments}:
3220 @multitable @columnfractions .15 .80
3221 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
3224 @item @emph{Return value}:
3225 @code{STATUS} is passed to the parent process on exit.
3227 @item @emph{Example}:
3230 integer :: STATUS = 0
3231 print *, 'This program is going to exit.'
3233 end program test_exit
3236 @item @emph{See also}:
3237 @ref{ABORT}, @ref{KILL}
3243 @section @code{EXP} --- Exponential function
3244 @cindex @code{EXP} intrinsic
3245 @cindex @code{DEXP} intrinsic
3246 @cindex @code{ZEXP} intrinsic
3247 @cindex @code{CDEXP} intrinsic
3251 @item @emph{Description}:
3252 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
3254 @item @emph{Standard}:
3255 F77 and later, has overloads that are GNU extensions
3260 @item @emph{Syntax}:
3263 @item @emph{Arguments}:
3264 @multitable @columnfractions .15 .80
3265 @item @var{X} @tab The type shall be @code{REAL(*)} or
3269 @item @emph{Return value}:
3270 The return value has same type and kind as @var{X}.
3272 @item @emph{Example}:
3277 end program test_exp
3280 @item @emph{Specific names}:
3281 @multitable @columnfractions .20 .20 .20 .40
3282 @item Name @tab Argument @tab Return type @tab Standard
3283 @item @code{DEXP(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
3284 @item @code{CEXP(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F77 and later
3285 @item @code{ZEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3286 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
3293 @section @code{EXPONENT} --- Exponent function
3294 @cindex @code{EXPONENT} intrinsic
3295 @cindex exponent part of a real number
3298 @item @emph{Description}:
3299 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
3300 is zero the value returned is zero.
3302 @item @emph{Standard}:
3308 @item @emph{Syntax}:
3309 @code{I = EXPONENT(X)}
3311 @item @emph{Arguments}:
3312 @multitable @columnfractions .15 .80
3313 @item @var{X} @tab The type shall be @code{REAL(*)}.
3316 @item @emph{Return value}:
3317 The return value is of type default @code{INTEGER}.
3319 @item @emph{Example}:
3321 program test_exponent
3326 print *, exponent(0.0)
3327 end program test_exponent
3333 @section @code{FDATE} --- Get the current time as a string
3334 @cindex @code{FDATE} intrinsic
3335 @cindex time, current
3336 @cindex current time
3337 @cindex date, current
3338 @cindex current date
3341 @item @emph{Description}:
3342 @code{FDATE(DATE)} returns the current date (using the same format as
3343 @code{CTIME}) in @var{DATE}. It is equivalent to @code{CALL CTIME(DATE,
3346 If @code{FDATE} is invoked as a function, it can not be invoked as a
3347 subroutine, and vice versa.
3349 @var{DATE} is an @code{INTENT(OUT)} @code{CHARACTER} variable.
3351 @item @emph{Standard}:
3357 @item @emph{Syntax}:
3358 @multitable @columnfractions .80
3359 @item @code{CALL FDATE(DATE)}.
3360 @item @code{DATE = FDATE()}, (not recommended).
3363 @item @emph{Arguments}:
3364 @multitable @columnfractions .15 .80
3365 @item @var{DATE}@tab The type shall be of type @code{CHARACTER}.
3368 @item @emph{Return value}:
3369 The current date as a string.
3371 @item @emph{Example}:
3375 character(len=30) :: date
3377 print *, 'Program started on ', date
3378 do i = 1, 100000000 ! Just a delay
3382 print *, 'Program ended on ', date
3383 end program test_fdate
3389 @section @code{FLOAT} --- Convert integer to default real
3390 @cindex @code{FLOAT} intrinsic
3391 @cindex conversion function (float)
3394 @item @emph{Description}:
3395 @code{FLOAT(I)} converts the integer @var{I} to a default real value.
3397 @item @emph{Standard}:
3403 @item @emph{Syntax}:
3406 @item @emph{Arguments}:
3407 @multitable @columnfractions .15 .80
3408 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
3411 @item @emph{Return value}:
3412 The return value is of type default @code{REAL}
3414 @item @emph{Example}:
3418 if (float(i) /= 1.) call abort
3419 end program test_float
3422 @item @emph{See also}:
3423 @ref{DBLE}, @ref{DFLOAT}, @ref{REAL}
3429 @section @code{FGET} --- Read a single character in stream mode from stdin
3430 @cindex @code{FGET} intrinsic
3431 @cindex file operations
3432 @cindex stream operations
3435 @item @emph{Description}:
3436 Read a single character in stream mode from stdin by bypassing normal
3437 formatted output. Stream I/O should not be mixed with normal record-oriented
3438 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3440 This intrinsic routine is provided for backwards compatibility with
3441 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3442 Programmers should consider the use of new stream IO feature in new code
3443 for future portability. See also @ref{Fortran 2003 status}.
3445 @item @emph{Standard}:
3449 Non-elemental subroutine
3451 @item @emph{Syntax}:
3452 @code{CALL FGET(C[,STATUS])}
3454 @item @emph{Arguments}:
3455 @multitable @columnfractions .15 .80
3456 @item @var{C} @tab The type shall be @code{CHARACTER}.
3457 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3458 -1 on end-of-file and a system specific positive error code otherwise.
3461 @item @emph{Example}:
3464 INTEGER, PARAMETER :: strlen = 100
3465 INTEGER :: status, i = 1
3466 CHARACTER(len=strlen) :: str = ""
3468 WRITE (*,*) 'Enter text:'
3470 CALL fget(str(i:i), status)
3471 if (status /= 0 .OR. i > strlen) exit
3474 WRITE (*,*) TRIM(str)
3478 @item @emph{See also}:
3479 @ref{FGETC}, @ref{FPUT}, @ref{FPUTC}
3484 @section @code{FGETC} --- Read a single character in stream mode
3485 @cindex @code{FGETC} intrinsic
3486 @cindex file operations
3487 @cindex stream operations
3490 @item @emph{Description}:
3491 Read a single character in stream mode by bypassing normal formatted output.
3492 Stream I/O should not be mixed with normal record-oriented (formatted or
3493 unformatted) I/O on the same unit; the results are unpredictable.
3495 This intrinsic routine is provided for backwards compatibility with
3496 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3497 Programmers should consider the use of new stream IO feature in new code
3498 for future portability. See also @ref{Fortran 2003 status}.
3500 @item @emph{Standard}:
3504 Non-elemental subroutine
3506 @item @emph{Syntax}:
3507 @code{CALL FGETC(UNIT,C[,STATUS])}
3509 @item @emph{Arguments}:
3510 @multitable @columnfractions .15 .80
3511 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3512 @item @var{C} @tab The type shall be @code{CHARACTER}.
3513 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3514 -1 on end-of-file and a system specific positive error code otherwise.
3517 @item @emph{Example}:
3520 INTEGER :: fd = 42, status
3523 OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
3525 CALL fgetc(fd, c, status)
3526 IF (status /= 0) EXIT
3533 @item @emph{See also}:
3534 @ref{FGET}, @ref{FPUT}, @ref{FPUTC}
3540 @section @code{FLOOR} --- Integer floor function
3541 @cindex @code{FLOOR} intrinsic
3545 @item @emph{Description}:
3546 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
3548 @item @emph{Standard}:
3554 @item @emph{Syntax}:
3555 @code{I = FLOOR(X[,KIND])}
3557 @item @emph{Arguments}:
3558 @multitable @columnfractions .15 .80
3559 @item @var{X} @tab The type shall be @code{REAL(*)}.
3560 @item @var{KIND} @tab Optional scaler integer initialization expression.
3563 @item @emph{Return value}:
3564 The return value is of type @code{INTEGER(KIND)}
3566 @item @emph{Example}:
3571 print *, floor(x) ! returns 63
3572 print *, floor(y) ! returns -64
3573 end program test_floor
3576 @item @emph{See also}:
3577 @ref{CEILING}, @ref{NINT}
3584 @section @code{FLUSH} --- Flush I/O unit(s)
3585 @cindex @code{FLUSH} intrinsic
3586 @cindex flush output files
3589 @item @emph{Description}:
3590 Flushes Fortran unit(s) currently open for output. Without the optional
3591 argument, all units are flushed, otherwise just the unit specified.
3593 @item @emph{Standard}:
3597 non-elemental subroutine
3599 @item @emph{Syntax}:
3600 @code{CALL FLUSH(UNIT)}
3602 @item @emph{Arguments}:
3603 @multitable @columnfractions .15 .80
3604 @item @var{UNIT} @tab (Optional) The type shall be @code{INTEGER}.
3608 Beginning with the Fortran 2003 standard, there is a @code{FLUSH}
3609 statement that should be preferred over the @code{FLUSH} intrinsic.
3616 @section @code{FNUM} --- File number function
3617 @cindex @code{FNUM} intrinsic
3621 @item @emph{Description}:
3622 @code{FNUM(UNIT)} returns the POSIX file descriptor number corresponding to the
3623 open Fortran I/O unit @code{UNIT}.
3625 @item @emph{Standard}:
3629 non-elemental function
3631 @item @emph{Syntax}:
3632 @code{I = FNUM(UNIT)}
3634 @item @emph{Arguments}:
3635 @multitable @columnfractions .15 .80
3636 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3639 @item @emph{Return value}:
3640 The return value is of type @code{INTEGER}
3642 @item @emph{Example}:
3646 open (unit=10, status = "scratch")
3650 end program test_fnum
3657 @section @code{FPUT} --- Write a single character in stream mode to stdout
3658 @cindex @code{FPUT} intrinsic
3659 @cindex file operations
3660 @cindex stream operations
3663 @item @emph{Description}:
3664 Write a single character in stream mode to stdout by bypassing normal
3665 formatted output. Stream I/O should not be mixed with normal record-oriented
3666 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3668 This intrinsic routine is provided for backwards compatibility with
3669 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3670 Programmers should consider the use of new stream IO feature in new code
3671 for future portability. See also @ref{Fortran 2003 status}.
3673 @item @emph{Standard}:
3677 Non-elemental subroutine
3679 @item @emph{Syntax}:
3680 @code{CALL FPUT(C[,STATUS])}
3682 @item @emph{Arguments}:
3683 @multitable @columnfractions .15 .80
3684 @item @var{C} @tab The type shall be @code{CHARACTER}.
3685 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3686 -1 on end-of-file and a system specific positive error code otherwise.
3689 @item @emph{Example}:
3692 CHARACTER(len=*) :: str = "gfortran"
3694 DO i = 1, len_trim(str)
3700 @item @emph{See also}:
3701 @ref{FPUTC}, @ref{FGET}, @ref{FGETC}
3707 @section @code{FPUTC} --- Write a single character in stream mode
3708 @cindex @code{FPUTC} intrinsic
3709 @cindex file operations
3710 @cindex stream operations
3713 @item @emph{Description}:
3714 Write a single character in stream mode by bypassing normal formatted
3715 output. Stream I/O should not be mixed with normal record-oriented
3716 (formatted or unformatted) I/O on the same unit; the results are unpredictable.
3718 This intrinsic routine is provided for backwards compatibility with
3719 @command{g77}. GNU Fortran provides the Fortran 2003 Stream facility.
3720 Programmers should consider the use of new stream IO feature in new code
3721 for future portability. See also @ref{Fortran 2003 status}.
3723 @item @emph{Standard}:
3727 Non-elemental subroutine
3729 @item @emph{Syntax}:
3730 @code{CALL FPUTC(UNIT,C[,STATUS])}
3732 @item @emph{Arguments}:
3733 @multitable @columnfractions .15 .80
3734 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
3735 @item @var{C} @tab The type shall be @code{CHARACTER}.
3736 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}. Returns 0 on success,
3737 -1 on end-of-file and a system specific positive error code otherwise.
3740 @item @emph{Example}:
3743 CHARACTER(len=*) :: str = "gfortran"
3744 INTEGER :: fd = 42, i
3746 OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
3747 DO i = 1, len_trim(str)
3748 CALL fputc(fd, str(i:i))
3754 @item @emph{See also}:
3755 @ref{FPUT}, @ref{FGET}, @ref{FGETC}
3761 @section @code{FRACTION} --- Fractional part of the model representation
3762 @cindex @code{FRACTION} intrinsic
3763 @cindex fractional part
3766 @item @emph{Description}:
3767 @code{FRACTION(X)} returns the fractional part of the model
3768 representation of @code{X}.
3770 @item @emph{Standard}:
3776 @item @emph{Syntax}:
3777 @code{Y = FRACTION(X)}
3779 @item @emph{Arguments}:
3780 @multitable @columnfractions .15 .80
3781 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
3784 @item @emph{Return value}:
3785 The return value is of the same type and kind as the argument.
3786 The fractional part of the model representation of @code{X} is returned;
3787 it is @code{X * RADIX(X)**(-EXPONENT(X))}.
3789 @item @emph{Example}:
3791 program test_fraction
3794 print *, fraction(x), x * radix(x)**(-exponent(x))
3795 end program test_fraction
3803 @section @code{FREE} --- Frees memory
3804 @cindex @code{FREE} intrinsic
3805 @cindex Cray pointers
3808 @item @emph{Description}:
3809 Frees memory previously allocated by @code{MALLOC()}. The @code{FREE}
3810 intrinsic is an extension intended to be used with Cray pointers, and is
3811 provided in GNU Fortran to allow user to compile legacy code. For
3812 new code using Fortran 95 pointers, the memory de-allocation intrinsic is
3815 @item @emph{Standard}:
3821 @item @emph{Syntax}:
3824 @item @emph{Arguments}:
3825 @multitable @columnfractions .15 .80
3826 @item @var{PTR} @tab The type shall be @code{INTEGER}. It represents the
3827 location of the memory that should be de-allocated.
3830 @item @emph{Return value}:
3833 @item @emph{Example}:
3834 See @code{MALLOC} for an example.
3836 @item @emph{See also}:
3844 @section @code{FSTAT} --- Get file status
3845 @cindex @code{FSTAT} intrinsic
3846 @cindex file system operations
3849 @item @emph{Description}:
3850 @code{FSTAT} is identical to @ref{STAT}, except that information about an
3851 already opened file is obtained.
3853 The elements in @code{BUFF} are the same as described by @ref{STAT}.
3855 @item @emph{Standard}:
3859 Non-elemental subroutine
3861 @item @emph{Syntax}:
3862 @code{CALL fstat(UNIT,BUFF[,STATUS])}
3864 @item @emph{Arguments}:
3865 @multitable @columnfractions .15 .80
3866 @item @var{UNIT} @tab An open I/O unit number of type @code{INTEGER}.
3867 @item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
3868 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
3869 on success and a system specific error code otherwise.
3872 @item @emph{Example}:
3873 See @ref{STAT} for an example.
3875 @item @emph{See also}:
3876 To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
3882 @section @code{FSEEK} --- Low level file positioning subroutine
3883 @cindex @code{FSEEK} intrinsic
3884 @cindex file system operations
3886 Not yet implemented in GNU Fortran.
3889 @item @emph{Description}:
3891 @item @emph{Standard}:
3897 @item @emph{Syntax}:
3898 @item @emph{Arguments}:
3899 @item @emph{Return value}:
3900 @item @emph{Example}:
3901 @item @emph{Specific names}:
3902 @item @emph{See also}:
3903 @uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
3910 @section @code{FTELL} --- Current stream position
3911 @cindex @code{FTELL} intrinsic
3914 @item @emph{Description}:
3915 Retrieves the current position within an open file.
3917 This intrinsic is provided in both subroutine and function forms; however,
3918 only one form can be used in any given program unit.
3920 @item @emph{Standard}:
3924 Subroutine, function
3926 @item @emph{Syntax}:
3927 @multitable @columnfractions .80
3928 @item @code{CALL FTELL(UNIT, OFFSET)}
3929 @item @code{OFFSET = FTELL(UNIT)}
3932 @item @emph{Arguments}:
3933 @multitable @columnfractions .15 .80
3934 @item @var{OFFSET} @tab Shall of type @code{INTEGER}.
3935 @item @var{UNIT} @tab Shall of type @code{INTEGER}.
3938 @item @emph{Return value}:
3939 In either syntax, @var{OFFSET} is set to the current offset of unit
3940 number @var{UNIT}, or to @math{-1} if the unit is not currently open.
3942 @item @emph{Example}:
3946 OPEN(10, FILE="temp.dat")
3952 @item @emph{See also}:
3959 @section @code{GETARG} --- Get command line arguments
3960 @cindex @code{GETARG} intrinsic
3961 @cindex command-line arguments, to program
3964 @item @emph{Description}:
3965 Retrieve the @var{N}th argument that was passed on the
3966 command line when the containing program was invoked.
3968 This intrinsic routine is provided for backwards compatibility with
3969 GNU Fortran 77. In new code, programmers should consider the use of
3970 the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003
3973 @item @emph{Standard}:
3979 @item @emph{Syntax}:
3980 @code{CALL GETARG(N,ARG)}
3982 @item @emph{Arguments}:
3983 @multitable @columnfractions .15 .80
3984 @item @var{N} @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
3985 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
3988 @item @emph{Return value}:
3989 After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th
3990 command line argument. If @var{ARG} can not hold the argument, it is
3991 truncated to fit the length of @var{ARG}. If there are less than @var{N}
3992 arguments specified at the command line, @var{ARG} will be filled with blanks.
3993 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
3994 that support this feature).
3996 @item @emph{Example}:
4000 CHARACTER(len=32) :: arg
4009 @item @emph{See also}:
4010 GNU Fortran 77 compatibility function: @ref{IARGC}
4012 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT},
4013 @ref{COMMAND_ARGUMENT_COUNT}
4019 @section @code{GET_COMMAND} --- Get the entire command line
4020 @cindex @code{GET_COMMAND} intrinsic
4021 @cindex command-line arguments, to program
4024 @item @emph{Description}:
4025 Retrieve the entire command line that was used to invoke the program.
4027 @item @emph{Standard}:
4033 @item @emph{Syntax}:
4034 @code{CALL GET_COMMAND(CMD)}
4036 @item @emph{Arguments}:
4037 @multitable @columnfractions .15 .80
4038 @item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}.
4041 @item @emph{Return value}:
4042 Stores the entire command line that was used to invoke the program in @var{ARG}.
4043 If @var{ARG} is not large enough, the command will be truncated.
4045 @item @emph{Example}:
4047 PROGRAM test_get_command
4048 CHARACTER(len=255) :: cmd
4049 CALL get_command(cmd)
4050 WRITE (*,*) TRIM(cmd)
4054 @item @emph{See also}:
4055 @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
4060 @node GET_COMMAND_ARGUMENT
4061 @section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
4062 @cindex @code{GET_COMMAND_ARGUMENT} intrinsic
4063 @cindex command-line arguments, to program
4066 @item @emph{Description}:
4067 Retrieve the @var{N}th argument that was passed on the
4068 command line when the containing program was invoked.
4070 @item @emph{Standard}:
4076 @item @emph{Syntax}:
4077 @code{CALL GET_COMMAND_ARGUMENT(N,ARG)}
4079 @item @emph{Arguments}:
4080 @multitable @columnfractions .15 .80
4081 @item @var{N} @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
4082 @item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
4085 @item @emph{Return value}:
4086 After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the
4087 @var{N}th command line argument. If @var{ARG} can not hold the argument, it is
4088 truncated to fit the length of @var{ARG}. If there are less than @var{N}
4089 arguments specified at the command line, @var{ARG} will be filled with blanks.
4090 If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
4091 that support this feature).
4093 @item @emph{Example}:
4095 PROGRAM test_get_command_argument
4097 CHARACTER(len=32) :: arg
4101 CALL get_command_argument(i, arg)
4102 IF (LEN_TRIM(arg) == 0) EXIT
4104 WRITE (*,*) TRIM(arg)
4110 @item @emph{See also}:
4111 @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
4117 @section @code{GETCWD} --- Get current working directory
4118 @cindex @code{GETCWD} intrinsic
4119 @cindex file system operations
4122 @item @emph{Description}:
4123 Get current working directory.
4125 @item @emph{Standard}:
4129 Non-elemental subroutine.
4131 @item @emph{Syntax}:
4132 @code{CALL GETCWD(CWD[,STATUS])}
4134 @item @emph{Arguments}:
4135 @multitable @columnfractions .15 .80
4136 @item @var{CWD} @tab The type shall be @code{CHARACTER(*)}.
4137 @item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
4138 a system specific and non-zero error code otherwise.
4141 @item @emph{Example}:
4144 CHARACTER(len=255) :: cwd
4146 WRITE(*,*) TRIM(cwd)
4150 @item @emph{See also}:
4157 @section @code{GETENV} --- Get an environmental variable
4158 @cindex @code{GETENV} intrinsic
4159 @cindex environment variable
4162 @item @emph{Description}:
4163 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4165 This intrinsic routine is provided for backwards compatibility with
4166 GNU Fortran 77. In new code, programmers should consider the use of
4167 the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
4170 @item @emph{Standard}:
4176 @item @emph{Syntax}:
4177 @code{CALL GETENV(ENVVAR,VALUE)}
4179 @item @emph{Arguments}:
4180 @multitable @columnfractions .15 .80
4181 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}.
4182 @item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
4185 @item @emph{Return value}:
4186 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is
4187 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4188 is not set, @var{VALUE} will be filled with blanks.
4190 @item @emph{Example}:
4193 CHARACTER(len=255) :: homedir
4194 CALL getenv("HOME", homedir)
4195 WRITE (*,*) TRIM(homedir)
4199 @item @emph{See also}:
4200 @ref{GET_ENVIRONMENT_VARIABLE}
4205 @node GET_ENVIRONMENT_VARIABLE
4206 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
4207 @cindex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
4208 @cindex environment variable
4211 @item @emph{Description}:
4212 Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
4214 @item @emph{Standard}:
4220 @item @emph{Syntax}:
4221 @code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR,VALUE)}
4223 @item @emph{Arguments}:
4224 @multitable @columnfractions .15 .80
4225 @item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}.
4226 @item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
4229 @item @emph{Return value}:
4230 Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is
4231 not large enough to hold the data, it is truncated. If @var{ENVVAR}
4232 is not set, @var{VALUE} will be filled with blanks.
4234 @item @emph{Example}:
4237 CHARACTER(len=255) :: homedir
4238 CALL get_environment_variable("HOME", homedir)
4239 WRITE (*,*) TRIM(homedir)
4247 @section @code{GETGID} --- Group ID function
4248 @cindex @code{GETGID} intrinsic
4249 @cindex file system operations
4252 @item @emph{Description}:
4253 Returns the numerical group ID of the current process.
4255 @item @emph{Standard}:
4261 @item @emph{Syntax}:
4264 @item @emph{Return value}:
4265 The return value of @code{GETGID} is an @code{INTEGER} of the default
4269 @item @emph{Example}:
4270 See @code{GETPID} for an example.
4272 @item @emph{See also}:
4273 @ref{GETPID}, @ref{GETUID}
4279 @section @code{GETLOG} --- Get login name
4280 @cindex @code{GETLOG} intrinsic
4283 @item @emph{Description}:
4284 Gets the username under which the program is running.
4286 @item @emph{Standard}:
4292 @item @emph{Syntax}:
4293 @code{CALL GETLOG(LOGIN)}
4295 @item @emph{Arguments}:
4296 @multitable @columnfractions .15 .80
4297 @item @var{LOGIN} @tab Shall be of type @code{CHARACTER(*)}.
4300 @item @emph{Return value}:
4301 Stores the current user name in @var{LOGIN}. (On systems where
4302 the @code{getlogin(3)} function is not implemented, this will
4303 return a blank string.)
4305 @item @emph{Example}:
4308 CHARACTER(32) :: login
4314 @item @emph{See also}:
4321 @section @code{GETPID} --- Process ID function
4322 @cindex @code{GETPID} intrinsic
4323 @cindex process ID, current
4326 @item @emph{Description}:
4327 Returns the numerical process identifier of the current process.
4329 @item @emph{Standard}:
4335 @item @emph{Syntax}:
4338 @item @emph{Return value}:
4339 The return value of @code{GETPID} is an @code{INTEGER} of the default
4343 @item @emph{Example}:
4346 print *, "The current process ID is ", getpid()
4347 print *, "Your numerical user ID is ", getuid()
4348 print *, "Your numerical group ID is ", getgid()
4352 @item @emph{See also}:
4353 @ref{GETGID}, @ref{GETUID}
4359 @section @code{GETUID} --- User ID function
4360 @cindex @code{GETUID} intrinsic
4361 @cindex user ID, current
4364 @item @emph{Description}:
4365 Returns the numerical user ID of the current process.
4367 @item @emph{Standard}:
4373 @item @emph{Syntax}:
4376 @item @emph{Return value}:
4377 The return value of @code{GETUID} is an @code{INTEGER} of the default
4381 @item @emph{Example}:
4382 See @code{GETPID} for an example.
4384 @item @emph{See also}:
4385 @ref{GETPID}, @ref{GETLOG}
4391 @section @code{GMTIME} --- Convert time to GMT info
4392 @cindex @code{GMTIME} intrinsic
4393 @cindex time, conversion function
4395 Not yet implemented in GNU Fortran.
4398 @item @emph{Description}:
4400 @item @emph{Standard}:
4406 @item @emph{Syntax}:
4407 @item @emph{Arguments}:
4408 @item @emph{Return value}:
4409 @item @emph{Example}:
4410 @item @emph{Specific names}:
4411 @item @emph{See also}:
4418 @section @code{HOSTNM} --- Get system host name
4419 @cindex @code{HOSTNM} intrinsic
4422 @item @emph{Description}:
4423 Retrieves the host name of the system on which the program is running.
4425 This intrinsic is provided in both subroutine and function forms; however,
4426 only one form can be used in any given program unit.
4428 @item @emph{Standard}:
4432 Subroutine, function
4434 @item @emph{Syntax}:
4435 @multitable @columnfractions .80
4436 @item @code{CALL HOSTNM(NAME, STATUS)}
4437 @item @code{STATUS = HOSTNM(NAME)}
4440 @item @emph{Arguments}:
4441 @multitable @columnfractions .15 .80
4442 @item @var{NAME} @tab Shall of type @code{CHARACTER(*)}.
4443 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
4444 Returns 0 on success, or a system specific error
4448 @item @emph{Return value}:
4449 In either syntax, @var{NAME} is set to the current hostname if it can
4450 be obtained, or to a blank string otherwise.
4457 @section @code{HUGE} --- Largest number of a kind
4458 @cindex @code{HUGE} intrinsic
4462 @item @emph{Description}:
4463 @code{HUGE(X)} returns the largest number that is not an infinity in
4464 the model of the type of @code{X}.
4466 @item @emph{Standard}:
4472 @item @emph{Syntax}:
4475 @item @emph{Arguments}:
4476 @multitable @columnfractions .15 .80
4477 @item @var{X} @tab shall be of type @code{REAL} or @code{INTEGER}.
4480 @item @emph{Return value}:
4481 The return value is of the same type and kind as @var{X}
4483 @item @emph{Example}:
4485 program test_huge_tiny
4486 print *, huge(0), huge(0.0), huge(0.0d0)
4487 print *, tiny(0.0), tiny(0.0d0)
4488 end program test_huge_tiny
4495 @section @code{IACHAR} --- Code in @acronym{ASCII} collating sequence
4496 @cindex @code{IACHAR} intrinsic
4497 @cindex @acronym{ASCII} collating sequence
4498 @cindex conversion function (character)
4501 @item @emph{Description}:
4502 @code{IACHAR(C)} returns the code for the @acronym{ASCII} character
4503 in the first character position of @code{C}.
4505 @item @emph{Standard}:
4511 @item @emph{Syntax}:
4512 @code{I = IACHAR(C)}
4514 @item @emph{Arguments}:
4515 @multitable @columnfractions .15 .80
4516 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4519 @item @emph{Return value}:
4520 The return value is of type @code{INTEGER} and of the default integer
4523 @item @emph{Example}:
4528 end program test_iachar
4531 @item @emph{See also}:
4532 @ref{CHAR},@ref{ICHAR}
4538 @section @code{IAND} --- Bitwise logical and
4539 @cindex @code{IAND} intrinsic
4540 @cindex bit operations
4543 @item @emph{Description}:
4544 Bitwise logical @code{AND}.
4546 @item @emph{Standard}:
4552 @item @emph{Syntax}:
4553 @code{RESULT = IAND(I, J)}
4555 @item @emph{Arguments}:
4556 @multitable @columnfractions .15 .80
4557 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4558 @item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
4559 kind as @var{I}. (As a GNU extension, different kinds are also
4563 @item @emph{Return value}:
4564 The return type is @code{INTEGER(*)}, of the same kind as the
4565 arguments. (If the argument kinds differ, it is of the same kind as
4566 the larger argument.)
4568 @item @emph{Example}:
4572 DATA a / Z'F' /, b / Z'3' /
4573 WRITE (*,*) IAND(a, b)
4577 @item @emph{See also}:
4578 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4584 @section @code{IARGC} --- Get the number of command line arguments
4585 @cindex @code{IARGC} intrinsic
4586 @cindex command-line arguments, to program
4589 @item @emph{Description}:
4590 @code{IARGC()} returns the number of arguments passed on the
4591 command line when the containing program was invoked.
4593 This intrinsic routine is provided for backwards compatibility with
4594 GNU Fortran 77. In new code, programmers should consider the use of
4595 the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003
4598 @item @emph{Standard}:
4602 Non-elemental Function
4604 @item @emph{Syntax}:
4607 @item @emph{Arguments}:
4610 @item @emph{Return value}:
4611 The number of command line arguments, type @code{INTEGER(4)}.
4613 @item @emph{Example}:
4616 @item @emph{See also}:
4617 GNU Fortran 77 compatibility subroutine: @ref{GETARG}
4619 F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT},
4620 @ref{COMMAND_ARGUMENT_COUNT}
4626 @section @code{IBCLR} --- Clear bit
4627 @cindex @code{IBCLR} intrinsic
4628 @cindex bit operations
4631 @item @emph{Description}:
4632 @code{IBCLR} returns the value of @var{I} with the bit at position
4633 @var{POS} set to zero.
4635 @item @emph{Standard}:
4641 @item @emph{Syntax}:
4642 @code{RESULT = IBCLR(I, POS)}
4644 @item @emph{Arguments}:
4645 @multitable @columnfractions .15 .80
4646 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4647 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4650 @item @emph{Return value}:
4651 The return value is of type @code{INTEGER(*)} and of the same kind as
4654 @item @emph{See also}:
4655 @ref{IBITS}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4661 @section @code{IBITS} --- Bit extraction
4662 @cindex @code{IBITS} intrinsic
4663 @cindex bit operations
4666 @item @emph{Description}:
4667 @code{IBITS} extracts a field of length @var{LEN} from @var{I},
4668 starting from bit position @var{POS} and extending left for @var{LEN}
4669 bits. The result is right-justified and the remaining bits are
4670 zeroed. The value of @code{POS+LEN} must be less than or equal to the
4671 value @code{BIT_SIZE(I)}.
4673 @item @emph{Standard}:
4679 @item @emph{Syntax}:
4680 @code{RESULT = IBITS(I, POS, LEN)}
4682 @item @emph{Arguments}:
4683 @multitable @columnfractions .15 .80
4684 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4685 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4686 @item @var{LEN} @tab The type shall be @code{INTEGER(*)}.
4689 @item @emph{Return value}:
4690 The return value is of type @code{INTEGER(*)} and of the same kind as
4693 @item @emph{See also}:
4694 @ref{BIT_SIZE}, @ref{IBCLR}, @ref{IBSET}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4700 @section @code{IBSET} --- Set bit
4701 @cindex @code{IBSET} intrinsic
4702 @cindex bit operations
4705 @item @emph{Description}:
4706 @code{IBSET} returns the value of @var{I} with the bit at position
4707 @var{POS} set to one.
4709 @item @emph{Standard}:
4715 @item @emph{Syntax}:
4716 @code{RESULT = IBSET(I, POS)}
4718 @item @emph{Arguments}:
4719 @multitable @columnfractions .15 .80
4720 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4721 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
4724 @item @emph{Return value}:
4725 The return value is of type @code{INTEGER(*)} and of the same kind as
4728 @item @emph{See also}:
4729 @ref{IBCLR}, @ref{IBITS}, @ref{IAND}, @ref{IOR}, @ref{IEOR}
4735 @section @code{ICHAR} --- Character-to-integer conversion function
4736 @cindex @code{ICHAR} intrinsic
4737 @cindex conversion function (character)
4740 @item @emph{Description}:
4741 @code{ICHAR(C)} returns the code for the character in the first character
4742 position of @code{C} in the system's native character set.
4743 The correspondence between characters and their codes is not necessarily
4744 the same across different GNU Fortran implementations.
4746 @item @emph{Standard}:
4752 @item @emph{Syntax}:
4755 @item @emph{Arguments}:
4756 @multitable @columnfractions .15 .80
4757 @item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
4760 @item @emph{Return value}:
4761 The return value is of type @code{INTEGER} and of the default integer
4764 @item @emph{Example}:
4769 end program test_ichar
4773 No intrinsic exists to convert a printable character string to a numerical
4774 value. For example, there is no intrinsic that, given the @code{CHARACTER}
4775 value 154, returns an @code{INTEGER} or @code{REAL} value with the
4778 Instead, you can use internal-file I/O to do this kind of conversion. For
4783 character(len=10) string
4786 read (string,'(I10)') value
4788 end program read_val
4793 @section @code{IDATE} --- Get current local time subroutine (day/month/year)
4794 @cindex @code{IDATE} intrinsic
4797 @item @emph{Description}:
4798 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
4799 current local time. The day (in the range 1-31), month (in the range 1-12),
4800 and year appear in elements 1, 2, and 3 of @var{TARRAY}, respectively.
4801 The year has four significant digits.
4803 @item @emph{Standard}:
4809 @item @emph{Syntax}:
4810 @code{CALL IDATE(TARRAY)}
4812 @item @emph{Arguments}:
4813 @multitable @columnfractions .15 .80
4814 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)} and
4815 the kind shall be the default integer kind.
4818 @item @emph{Return value}:
4821 @item @emph{Example}:
4824 integer, dimension(3) :: tarray
4829 end program test_idate
4836 @section @code{IEOR} --- Bitwise logical exclusive or
4837 @cindex @code{IEOR} intrinsic
4838 @cindex bit operations
4841 @item @emph{Description}:
4842 @code{IEOR} returns the bitwise boolean exclusive-OR of @var{I} and
4845 @item @emph{Standard}:
4851 @item @emph{Syntax}:
4852 @code{RESULT = IEOR(I, J)}
4854 @item @emph{Arguments}:
4855 @multitable @columnfractions .15 .80
4856 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
4857 @item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
4858 kind as @var{I}. (As a GNU extension, different kinds are also
4862 @item @emph{Return value}:
4863 The return type is @code{INTEGER(*)}, of the same kind as the
4864 arguments. (If the argument kinds differ, it is of the same kind as
4865 the larger argument.)
4867 @item @emph{See also}:
4868 @ref{IOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
4874 @section @code{IERRNO} --- Get the last system error number
4875 @cindex @code{IERRNO} intrinsic
4878 @item @emph{Description}:
4879 Returns the last system error number, as given by the C @code{errno()}
4882 @item @emph{Standard}:
4888 @item @emph{Syntax}:
4891 @item @emph{Arguments}:
4894 @item @emph{Return value}:
4895 The return value is of type @code{INTEGER} and of the default integer
4898 @item @emph{See also}:
4905 @section @code{INDEX} --- Position of a substring within a string
4906 @cindex @code{INDEX} intrinsic
4909 @item @emph{Description}:
4910 Returns the position of the start of the first occurrence of string
4911 @var{SUBSTRING} as a substring in @var{STRING}, counting from one. If
4912 @var{SUBSTRING} is not present in @var{STRING}, zero is returned. If
4913 the @var{BACK} argument is present and true, the return value is the
4914 start of the last occurrence rather than the first.
4916 @item @emph{Standard}:
4922 @item @emph{Syntax}:
4923 @code{I = INDEX(STRING, SUBSTRING [, BACK])}
4925 @item @emph{Arguments}:
4926 @multitable @columnfractions .15 .80
4927 @item @var{STRING} @tab Shall be a scalar @code{CHARACTER(*)}, with
4929 @item @var{SUBSTRING} @tab Shall be a scalar @code{CHARACTER(*)}, with
4931 @item @var{BACK} @tab (Optional) Shall be a scalar @code{LOGICAL(*)}, with
4935 @item @emph{Return value}:
4936 The return value is of type @code{INTEGER} and of the default integer
4939 @item @emph{See also}:
4945 @section @code{INT} --- Convert to integer type
4946 @cindex @code{INT} intrinsic
4947 @cindex @code{IFIX} intrinsic
4948 @cindex @code{IDINT} intrinsic
4949 @cindex conversion function (integer)
4952 @item @emph{Description}:
4953 Convert to integer type
4955 @item @emph{Standard}:
4961 @item @emph{Syntax}:
4962 @multitable @columnfractions .30 .80
4963 @item @code{X = INT(X)}
4964 @item @code{X = INT(X, KIND)}
4967 @item @emph{Arguments}:
4968 @multitable @columnfractions .15 .80
4969 @item @var{X} @tab shall be of type @code{INTEGER(*)}, @code{REAL(*)} or
4970 @code{COMPLEX(*)} @item @var{KIND} @tab (Optional) @var{KIND} shall be
4974 @item @emph{Return value}:
4975 These functions return a @code{INTEGER(*)} variable or array under
4976 the following rules:
4980 If @var{X} is of type @code{INTEGER(*)}, @code{INT(X) = X}
4982 If @var{X} is of type @code{REAL(*)} and @math{|X| < 1} @code{INT(X)} equals @var{0}.
4983 If @math{|X| \geq 1}, then @code{INT(X)} equals the largest integer that does not exceed
4984 the range of @var{X} and whose sign is the same as the sign of @var{X}.
4986 If @var{X} is of type @code{COMPLEX(*)}, rule B is applied to the real part of X.
4989 @item @emph{Example}:
4993 complex :: z = (-3.7, 1.0)
4995 print *, int(z), int(z,8)
4999 @item @emph{Specific names}:
5000 @multitable @columnfractions .20 .20 .20 .40
5001 @item Name @tab Argument @tab Return type @tab Standard
5002 @item @code{IFIX(X)} @tab @code{REAL(4) X} @tab @code{INTEGER} @tab F77 and later
5003 @item @code{IDINT(X)} @tab @code{REAL(8) X} @tab @code{INTEGER} @tab F77 and later
5006 @comment @item @emph{See also}:
5012 @section @code{IOR} --- Bitwise logical or
5013 @cindex @code{IOR} intrinsic
5014 @cindex bit operations
5017 @item @emph{Description}:
5018 @code{IEOR} returns the bitwise boolean OR of @var{I} and
5021 @item @emph{Standard}:
5027 @item @emph{Syntax}:
5028 @code{RESULT = IEOR(I, J)}
5030 @item @emph{Arguments}:
5031 @multitable @columnfractions .15 .80
5032 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
5033 @item @var{J} @tab The type shall be @code{INTEGER(*)}, of the same
5034 kind as @var{I}. (As a GNU extension, different kinds are also
5038 @item @emph{Return value}:
5039 The return type is @code{INTEGER(*)}, of the same kind as the
5040 arguments. (If the argument kinds differ, it is of the same kind as
5041 the larger argument.)
5043 @item @emph{See also}:
5044 @ref{IEOR}, @ref{IAND}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
5051 @section @code{IRAND} --- Integer pseudo-random number
5052 @cindex @code{IRAND} intrinsic
5053 @cindex random numbers
5056 @item @emph{Description}:
5057 @code{IRAND(FLAG)} returns a pseudo-random number from a uniform
5058 distribution between 0 and a system-dependent limit (which is in most
5059 cases 2147483647). If @var{FLAG} is 0, the next number
5060 in the current sequence is returned; if @var{FLAG} is 1, the generator
5061 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
5062 it is used as a new seed with @code{SRAND}.
5064 @item @emph{Standard}:
5068 non-elemental function
5070 @item @emph{Syntax}:
5071 @code{I = IRAND(FLAG)}
5073 @item @emph{Arguments}:
5074 @multitable @columnfractions .15 .80
5075 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
5078 @item @emph{Return value}:
5079 The return value is of @code{INTEGER(kind=4)} type.
5081 @item @emph{Example}:
5084 integer,parameter :: seed = 86456
5087 print *, irand(), irand(), irand(), irand()
5088 print *, irand(seed), irand(), irand(), irand()
5089 end program test_irand
5097 @section @code{ISHFT} --- Shift bits
5098 @cindex @code{ISHFT} intrinsic
5099 @cindex bit operations
5102 @item @emph{Description}:
5103 @code{ISHFT} returns a value corresponding to @var{I} with all of the
5104 bits shifted @var{SHIFT} places. A value of @var{SHIFT} greater than
5105 zero corresponds to a left shift, a value of zero corresponds to no
5106 shift, and a value less than zero corresponds to a right shift. If the
5107 absolute value of @var{SHIFT} is greater than @code{BIT_SIZE(I)}, the
5108 value is undefined. Bits shifted out from the left end or right end are
5109 lost; zeros are shifted in from the opposite end.
5111 @item @emph{Standard}:
5117 @item @emph{Syntax}:
5118 @code{RESULT = ISHFT(I, SHIFT)}
5120 @item @emph{Arguments}:
5121 @multitable @columnfractions .15 .80
5122 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
5123 @item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5126 @item @emph{Return value}:
5127 The return value is of type @code{INTEGER(*)} and of the same kind as
5130 @item @emph{See also}:
5138 @section @code{ISHFTC} --- Shift bits circularly
5139 @cindex @code{ISHFTC} intrinsic
5140 @cindex bit operations
5143 @item @emph{Description}:
5144 @code{ISHFTC} returns a value corresponding to @var{I} with the
5145 rightmost @var{SIZE} bits shifted circularly @var{SHIFT} places; that
5146 is, bits shifted out one end are shifted into the opposite end. A value
5147 of @var{SHIFT} greater than zero corresponds to a left shift, a value of
5148 zero corresponds to no shift, and a value less than zero corresponds to
5149 a right shift. The absolute value of @var{SHIFT} must be less than
5150 @var{SIZE}. If the @var{SIZE} argument is omitted, it is taken to be
5151 equivalent to @code{BIT_SIZE(I)}.
5153 @item @emph{Standard}:
5159 @item @emph{Syntax}:
5160 @code{RESULT = ISHFTC(I, SHIFT [, SIZE])}
5162 @item @emph{Arguments}:
5163 @multitable @columnfractions .15 .80
5164 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
5165 @item @var{SHIFT} @tab The type shall be @code{INTEGER(*)}.
5166 @item @var{SIZE} @tab (Optional) The type shall be @code{INTEGER(*)};
5167 the value must be greater than zero and less than or equal to
5171 @item @emph{Return value}:
5172 The return value is of type @code{INTEGER(*)} and of the same kind as
5175 @item @emph{See also}:
5182 @section @code{ITIME} --- Get current local time subroutine (hour/minutes/seconds)
5183 @cindex @code{ITIME} intrinsic
5186 @item @emph{Description}:
5187 @code{IDATE(TARRAY)} Fills @var{TARRAY} with the numerical values at the
5188 current local time. The hour (in the range 1-24), minute (in the range 1-60),
5189 and seconds (in the range 1-60) appear in elements 1, 2, and 3 of @var{TARRAY},
5192 @item @emph{Standard}:
5198 @item @emph{Syntax}:
5199 @code{CALL ITIME(TARRAY)}
5201 @item @emph{Arguments}:
5202 @multitable @columnfractions .15 .80
5203 @item @var{TARRAY} @tab The type shall be @code{INTEGER, DIMENSION(3)}
5204 and the kind shall be the default integer kind.
5207 @item @emph{Return value}:
5211 @item @emph{Example}:
5214 integer, dimension(3) :: tarray
5219 end program test_itime
5226 @section @code{KILL} --- Send a signal to a process
5227 @cindex @code{KILL} intrinsic
5230 @item @emph{Description}:
5231 @item @emph{Standard}:
5232 Sends the signal specified by @var{SIGNAL} to the process @var{PID}.
5238 @item @emph{Syntax}:
5239 @code{CALL KILL(PID, SIGNAL [, STATUS])}
5241 @item @emph{Arguments}:
5242 @multitable @columnfractions .15 .80
5243 @item @var{PID} @tab Shall be a scalar @code{INTEGER}, with
5245 @item @var{SIGNAL} @tab Shall be a scalar @code{INTEGER}, with
5247 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)} or
5248 @code{INTEGER(8)}. Returns 0 on success, or a
5249 system-specific error code otherwise.
5252 @item @emph{See also}:
5253 @ref{ABORT}, @ref{EXIT}
5259 @section @code{KIND} --- Kind of an entity
5260 @cindex @code{KIND} intrinsic
5263 @item @emph{Description}:
5264 @code{KIND(X)} returns the kind value of the entity @var{X}.
5266 @item @emph{Standard}:
5272 @item @emph{Syntax}:
5275 @item @emph{Arguments}:
5276 @multitable @columnfractions .15 .80
5277 @item @var{X} @tab Shall be of type @code{LOGICAL}, @code{INTEGER},
5278 @code{REAL}, @code{COMPLEX} or @code{CHARACTER}.
5281 @item @emph{Return value}:
5282 The return value is a scalar of type @code{INTEGER} and of the default
5285 @item @emph{Example}:
5288 integer,parameter :: kc = kind(' ')
5289 integer,parameter :: kl = kind(.true.)
5291 print *, "The default character kind is ", kc
5292 print *, "The default logical kind is ", kl
5293 end program test_kind
5301 @section @code{LBOUND} --- Lower dimension bounds of an array
5302 @cindex @code{LBOUND} intrinsic
5305 @item @emph{Description}:
5306 Returns the lower bounds of an array, or a single lower bound
5307 along the @var{DIM} dimension.
5308 @item @emph{Standard}:
5314 @item @emph{Syntax}:
5315 @code{I = LBOUND(ARRAY [, DIM])}
5317 @item @emph{Arguments}:
5318 @multitable @columnfractions .15 .80
5319 @item @var{ARRAY} @tab Shall be an array, of any type.
5320 @item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER(*)}.
5323 @item @emph{Return value}:
5324 If @var{DIM} is absent, the result is an array of the lower bounds of
5325 @var{ARRAY}. If @var{DIM} is present, the result is a scalar
5326 corresponding to the lower bound of the array along that dimension. If
5327 @var{ARRAY} is an expression rather than a whole array or array
5328 structure component, or if it has a zero extent along the relevant
5329 dimension, the lower bound is taken to be 1.
5331 @item @emph{See also}:
5338 @section @code{LEN} --- Length of a character entity
5339 @cindex @code{LEN} intrinsic
5342 @item @emph{Description}:
5343 Returns the length of a character string. If @var{STRING} is an array,
5344 the length of an element of @var{STRING} is returned. Note that
5345 @var{STRING} need not be defined when this intrinsic is invoked, since
5346 only the length, not the content, of @var{STRING} is needed.
5348 @item @emph{Standard}:
5354 @item @emph{Syntax}:
5355 @code{L = LEN(STRING)}
5357 @item @emph{Arguments}:
5358 @multitable @columnfractions .15 .80
5359 @item @var{STRING} @tab Shall be a scalar or array of type
5360 @code{CHARACTER(*)}, with @code{INTENT(IN)}
5363 @item @emph{Return value}:
5364 The return value is an @code{INTEGER} of the default kind.
5366 @item @emph{See also}:
5367 @ref{LEN_TRIM}, @ref{ADJUSTL}, @ref{ADJUSTR}
5373 @section @code{LEN_TRIM} --- Length of a character entity without trailing blank characters
5374 @cindex @code{LEN_TRIM} intrinsic
5377 @item @emph{Description}:
5378 Returns the length of a character string, ignoring any trailing blanks.
5380 @item @emph{Standard}:
5386 @item @emph{Syntax}:
5387 @code{L = LEN_TRIM(STRING)}
5389 @item @emph{Arguments}:
5390 @multitable @columnfractions .15 .80
5391 @item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER(*)},
5392 with @code{INTENT(IN)}
5395 @item @emph{Return value}:
5396 The return value is of @code{INTEGER(kind=4)} type.
5398 @item @emph{See also}:
5399 @ref{LEN}, @ref{ADJUSTL}, @ref{ADJUSTR}
5405 @section @code{LGE} --- Lexical greater than or equal
5406 @cindex @code{LGE} intrinsic
5407 @cindex comparison (lexical)
5408 @cindex lexical comparison
5411 @item @emph{Description}:
5412 Determines whether one string is lexically greater than or equal to
5413 another string, where the two strings are interpreted as containing
5414 ASCII character codes. If the String A and String B are not the same
5415 length, the shorter is compared as if spaces were appended to it to form
5416 a value that has the same length as the longer.
5418 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5419 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5420 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5421 that the latter use the processor's character ordering (which is not
5422 ASCII on some targets), whereas the former always use the ASCII
5425 @item @emph{Standard}:
5431 @item @emph{Syntax}:
5432 @code{L = LGE(STRING_A, STRING_B)}
5434 @item @emph{Arguments}:
5435 @multitable @columnfractions .15 .80
5436 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5437 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5440 @item @emph{Return value}:
5441 Returns @code{.TRUE.} if @code{STRING_A >= STRING_B}, and @code{.FALSE.}
5442 otherwise, based on the ASCII ordering.
5444 @item @emph{See also}:
5445 @ref{LGT}, @ref{LLE}, @ref{LLT}
5451 @section @code{LGT} --- Lexical greater than
5452 @cindex @code{LGT} intrinsic
5453 @cindex comparison (lexical)
5454 @cindex lexical comparison
5457 @item @emph{Description}:
5458 Determines whether one string is lexically greater than another string,
5459 where the two strings are interpreted as containing ASCII character
5460 codes. If the String A and String B are not the same length, the
5461 shorter is compared as if spaces were appended to it to form a value
5462 that has the same length as the longer.
5464 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5465 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5466 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5467 that the latter use the processor's character ordering (which is not
5468 ASCII on some targets), whereas the former always use the ASCII
5471 @item @emph{Standard}:
5477 @item @emph{Syntax}:
5478 @code{L = LGT(STRING_A, STRING_B)}
5480 @item @emph{Arguments}:
5481 @multitable @columnfractions .15 .80
5482 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5483 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5486 @item @emph{Return value}:
5487 Returns @code{.TRUE.} if @code{STRING_A > STRING_B}, and @code{.FALSE.}
5488 otherwise, based on the ASCII ordering.
5490 @item @emph{See also}:
5491 @ref{LGE}, @ref{LLE}, @ref{LLT}
5497 @section @code{LINK} --- Create a hard link
5498 @cindex @code{LINK} intrinsic
5499 @cindex file system operations
5502 @item @emph{Description}:
5503 Makes a (hard) link from file @var{PATH1} to @var{PATH2}. A null
5504 character (@code{CHAR(0)}) can be used to mark the end of the names in
5505 @var{PATH1} and @var{PATH2}; otherwise, trailing blanks in the file
5506 names are ignored. If the @var{STATUS} argument is supplied, it
5507 contains 0 on success or a nonzero error code upon return; see
5510 @item @emph{Standard}:
5516 @item @emph{Syntax}:
5517 @code{CALL LINK(PATH1, PATH2 [, STATUS])}
5519 @item @emph{Arguments}:
5520 @multitable @columnfractions .15 .80
5521 @item @var{PATH1} @tab Shall be of default @code{CHARACTER} type.
5522 @item @var{PATH2} @tab Shall be of default @code{CHARACTER} type.
5523 @item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
5526 @item @emph{See also}:
5533 @section @code{LLE} --- Lexical less than or equal
5534 @cindex @code{LLE} intrinsic
5535 @cindex comparison (lexical)
5536 @cindex lexical comparison
5539 @item @emph{Description}:
5540 Determines whether one string is lexically less than or equal to another
5541 string, where the two strings are interpreted as containing ASCII
5542 character codes. If the String A and String B are not the same length,
5543 the shorter is compared as if spaces were appended to it to form a value
5544 that has the same length as the longer.
5546 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5547 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5548 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5549 that the latter use the processor's character ordering (which is not
5550 ASCII on some targets), whereas the former always use the ASCII
5553 @item @emph{Standard}:
5559 @item @emph{Syntax}:
5560 @code{L = LLE(STRING_A, STRING_B)}
5562 @item @emph{Arguments}:
5563 @multitable @columnfractions .15 .80
5564 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5565 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5568 @item @emph{Return value}:
5569 Returns @code{.TRUE.} if @code{STRING_A <= STRING_B}, and @code{.FALSE.}
5570 otherwise, based on the ASCII ordering.
5572 @item @emph{See also}:
5573 @ref{LGE}, @ref{LGT}, @ref{LLT}
5579 @section @code{LLT} --- Lexical less than
5580 @cindex @code{LLT} intrinsic
5581 @cindex comparison (lexical)
5582 @cindex lexical comparison
5584 Intrinsic implemented, documentation pending.
5587 @item @emph{Description}:
5588 Determines whether one string is lexically less than another string,
5589 where the two strings are interpreted as containing ASCII character
5590 codes. If the String A and String B are not the same length, the
5591 shorter is compared as if spaces were appended to it to form a value
5592 that has the same length as the longer.
5594 In general, the lexical comparison intrinsics @code{LGE}, @code{LGT},
5595 @code{LLE}, and @code{LLT} differ from the corresponding intrinsic
5596 operators @code{.GE.}, @code{.GT.}, @code{.LE.}, and @code{.LT.}, in
5597 that the latter use the processor's character ordering (which is not
5598 ASCII on some targets), whereas the former always use the ASCII
5601 @item @emph{Standard}:
5607 @item @emph{Syntax}:
5608 @code{L = LLT(STRING_A, STRING_B)}
5610 @item @emph{Arguments}:
5611 @multitable @columnfractions .15 .80
5612 @item @var{STRING_A} @tab Shall be of default @code{CHARACTER} type.
5613 @item @var{STRING_B} @tab Shall be of default @code{CHARACTER} type.
5616 @item @emph{Return value}:
5617 Returns @code{.TRUE.} if @code{STRING_A < STRING_B}, and @code{.FALSE.}
5618 otherwise, based on the ASCII ordering.
5620 @item @emph{See also}:
5621 @ref{LGE}, @ref{LGT}, @ref{LLE}
5627 @section @code{LNBLNK} --- Index of the last non-blank character in a string
5628 @cindex @code{LNBLNK} intrinsic
5631 @item @emph{Description}:
5632 Returns the length of a character string, ignoring any trailing blanks.
5633 This is identical to the standard @code{LEN_TRIM} intrinsic, and is only
5634 included for backwards compatibility.
5636 @item @emph{Standard}:
5642 @item @emph{Syntax}:
5643 @code{L = LNBLNK(STRING)}
5645 @item @emph{Arguments}:
5646 @multitable @columnfractions .15 .80
5647 @item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER(*)},
5648 with @code{INTENT(IN)}
5651 @item @emph{Return value}:
5652 The return value is of @code{INTEGER(kind=4)} type.
5654 @item @emph{See also}:
5655 @ref{INDEX}, @ref{LEN_TRIM}
5661 @section @code{LOC} --- Returns the address of a variable
5662 @cindex @code{LOC} intrinsic
5663 @cindex location of a variable in memory
5666 @item @emph{Description}:
5667 @code{LOC(X)} returns the address of @var{X} as an integer.
5669 @item @emph{Standard}:
5675 @item @emph{Syntax}:
5678 @item @emph{Arguments}:
5679 @multitable @columnfractions .15 .80
5680 @item @var{X} @tab Variable of any type.
5683 @item @emph{Return value}:
5684 The return value is of type @code{INTEGER}, with a @code{KIND}
5685 corresponding to the size (in bytes) of a memory address on the target
5688 @item @emph{Example}:
5695 end program test_loc
5702 @section @code{LOG} --- Logarithm function
5703 @cindex @code{LOG} intrinsic
5704 @cindex @code{ALOG} intrinsic
5705 @cindex @code{DLOG} intrinsic
5706 @cindex @code{CLOG} intrinsic
5707 @cindex @code{ZLOG} intrinsic
5708 @cindex @code{CDLOG} intrinsic
5712 @item @emph{Description}:
5713 @code{LOG(X)} computes the logarithm of @var{X}.
5715 @item @emph{Standard}:
5721 @item @emph{Syntax}:
5724 @item @emph{Arguments}:
5725 @multitable @columnfractions .15 .80
5726 @item @var{X} @tab The type shall be @code{REAL(*)} or
5730 @item @emph{Return value}:
5731 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5732 The kind type parameter is the same as @var{X}.
5734 @item @emph{Example}:
5737 real(8) :: x = 1.0_8
5738 complex :: z = (1.0, 2.0)
5741 end program test_log
5744 @item @emph{Specific names}:
5745 @multitable @columnfractions .20 .20 .20 .40
5746 @item Name @tab Argument @tab Return type @tab Standard
5747 @item @code{ALOG(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab f95, gnu
5748 @item @code{DLOG(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
5749 @item @code{CLOG(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
5750 @item @code{ZLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5751 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
5758 @section @code{LOG10} --- Base 10 logarithm function
5759 @cindex @code{LOG10} intrinsic
5760 @cindex @code{ALOG10} intrinsic
5761 @cindex @code{DLOG10} intrinsic
5765 @item @emph{Description}:
5766 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
5768 @item @emph{Standard}:
5774 @item @emph{Syntax}:
5777 @item @emph{Arguments}:
5778 @multitable @columnfractions .15 .80
5779 @item @var{X} @tab The type shall be @code{REAL(*)} or
5783 @item @emph{Return value}:
5784 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
5785 The kind type parameter is the same as @var{X}.
5787 @item @emph{Example}:
5790 real(8) :: x = 10.0_8
5792 end program test_log10
5795 @item @emph{Specific names}:
5796 @multitable @columnfractions .20 .20 .20 .40
5797 @item Name @tab Argument @tab Return type @tab Standard
5798 @item @code{ALOG10(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F95 and later
5799 @item @code{DLOG10(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
5806 @section @code{LOGICAL} --- Convert to logical type
5807 @cindex @code{LOGICAL} intrinsic
5808 @cindex conversion function (logical)
5810 Intrinsic implemented, documentation pending.
5813 @item @emph{Description}:
5814 @item @emph{Standard}:
5820 @item @emph{Syntax}:
5821 @item @emph{Arguments}:
5822 @item @emph{Return value}:
5823 @item @emph{Example}:
5824 @item @emph{Specific names}:
5825 @item @emph{See also}:
5832 @section @code{LSHIFT} --- Left shift bits
5833 @cindex @code{LSHIFT} intrinsic
5834 @cindex bit operations
5836 Intrinsic implemented, documentation pending.
5839 @item @emph{Description}:
5841 @item @emph{Standard}:
5847 @item @emph{Syntax}:
5848 @item @emph{Arguments}:
5849 @item @emph{Return value}:
5850 @item @emph{Example}:
5851 @item @emph{Specific names}:
5852 @item @emph{See also}:
5858 @section @code{LSTAT} --- Get file status
5859 @cindex @code{LSTAT} intrinsic
5860 @cindex file system operations
5863 @item @emph{Description}:
5864 @code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link,
5865 then the link itself is statted, not the file that it refers to.
5867 The elements in @code{BUFF} are the same as described by @ref{STAT}.
5869 @item @emph{Standard}:
5873 Non-elemental subroutine
5875 @item @emph{Syntax}:
5876 @code{CALL LSTAT(FILE,BUFF[,STATUS])}
5878 @item @emph{Arguments}:
5879 @multitable @columnfractions .15 .80
5880 @item @var{FILE} @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
5881 @item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
5882 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
5883 on success and a system specific error code otherwise.
5886 @item @emph{Example}:
5887 See @ref{STAT} for an example.
5889 @item @emph{See also}:
5890 To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
5896 @section @code{LTIME} --- Convert time to local time info
5897 @cindex @code{LTIME} intrinsic
5898 @cindex time, conversion function
5900 Intrinsic implemented, documentation pending.
5903 @item @emph{Description}:
5905 @item @emph{Standard}:
5911 @item @emph{Syntax}:
5912 @item @emph{Arguments}:
5913 @item @emph{Return value}:
5914 @item @emph{Example}:
5915 @item @emph{Specific names}:
5916 @item @emph{See also}:
5923 @section @code{MALLOC} --- Allocate dynamic memory
5924 @cindex @code{MALLOC} intrinsic
5925 @cindex Cray pointers
5928 @item @emph{Description}:
5929 @code{MALLOC(SIZE)} allocates @var{SIZE} bytes of dynamic memory and
5930 returns the address of the allocated memory. The @code{MALLOC} intrinsic
5931 is an extension intended to be used with Cray pointers, and is provided
5932 in GNU Fortran to allow the user to compile legacy code. For new code
5933 using Fortran 95 pointers, the memory allocation intrinsic is
5936 @item @emph{Standard}:
5940 non-elemental function
5942 @item @emph{Syntax}:
5943 @code{PTR = MALLOC(SIZE)}
5945 @item @emph{Arguments}:
5946 @multitable @columnfractions .15 .80
5947 @item @var{SIZE} @tab The type shall be @code{INTEGER(*)}.
5950 @item @emph{Return value}:
5951 The return value is of type @code{INTEGER(K)}, with @var{K} such that
5952 variables of type @code{INTEGER(K)} have the same size as
5953 C pointers (@code{sizeof(void *)}).
5955 @item @emph{Example}:
5956 The following example demonstrates the use of @code{MALLOC} and
5957 @code{FREE} with Cray pointers. This example is intended to run on
5958 32-bit systems, where the default integer kind is suitable to store
5959 pointers; on 64-bit systems, ptr_x would need to be declared as
5960 @code{integer(kind=8)}.
5969 ptr_x = malloc(20*8)
5971 x(i) = sqrt(1.0d0 / i)
5979 end program test_malloc
5982 @item @emph{See also}:
5988 @section @code{MATMUL} --- matrix multiplication
5989 @cindex @code{MATMUL} intrinsic
5990 @cindex matrix operations
5992 Intrinsic implemented, documentation pending.
5995 @item @emph{Description}:
5996 @item @emph{Standard}:
6000 Transformational function
6002 @item @emph{Syntax}:
6003 @item @emph{Arguments}:
6004 @item @emph{Return value}:
6005 @item @emph{Example}:
6006 @item @emph{See also}:
6011 @section @code{MAX} --- Maximum value of an argument list
6012 @cindex @code{MAX} intrinsic
6013 @cindex undocumented intrinsic
6015 Intrinsic implemented, documentation pending.
6018 @item @emph{Description}:
6019 @item @emph{Standard}:
6025 @item @emph{Syntax}:
6026 @item @emph{Arguments}:
6027 @item @emph{Return value}:
6028 @item @emph{Example}:
6030 @item @emph{Specific names}:
6031 @multitable @columnfractions .20 .20 .20 .40
6032 @item Name @tab Argument @tab Return type @tab Standard
6033 @item @code{MAX0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
6034 @item @code{AMAX0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MAX(X))} @tab F77 and later
6035 @item @code{MAX1(X)} @tab @code{REAL(*) X} @tab @code{INT(MAX(X))} @tab F77 and later
6036 @item @code{AMAX1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
6037 @item @code{DMAX1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6040 @item @emph{See also}:
6041 @ref{MAXLOC} @ref{MAXVAL}
6046 @section @code{MAXEXPONENT} --- Maximum exponent of a real kind
6047 @cindex @code{MAXEXPONENT} intrinsic
6048 @cindex maximum exponent
6049 @cindex exponent, maximum
6052 @item @emph{Description}:
6053 @code{MAXEXPONENT(X)} returns the maximum exponent in the model of the
6056 @item @emph{Standard}:
6062 @item @emph{Syntax}:
6063 @code{I = MAXEXPONENT(X)}
6065 @item @emph{Arguments}:
6066 @multitable @columnfractions .15 .80
6067 @item @var{X} @tab shall be of type @code{REAL}.
6070 @item @emph{Return value}:
6071 The return value is of type @code{INTEGER} and of the default integer
6074 @item @emph{Example}:
6080 print *, minexponent(x), maxexponent(x)
6081 print *, minexponent(y), maxexponent(y)
6082 end program exponents
6088 @section @code{MAXLOC} --- Location of the maximum value within an array
6089 @cindex @code{MAXLOC} intrinsic
6090 @cindex undocumented intrinsic
6092 Intrinsic implemented, documentation pending.
6095 @item @emph{Description}:
6096 @item @emph{Standard}:
6100 Transformational function
6102 @item @emph{Syntax}:
6103 @item @emph{Arguments}:
6104 @item @emph{Return value}:
6105 @item @emph{Example}:
6106 @item @emph{See also}:
6107 @ref{MAX}, @ref{MAXVAL}
6113 @section @code{MAXVAL} --- Maximum value of an array
6114 @cindex @code{MAXVAL} intrinsic
6115 @cindex undocumented intrinsic
6117 Intrinsic implemented, documentation pending.
6120 @item @emph{Description}:
6121 @item @emph{Standard}:
6125 Transformational function
6127 @item @emph{Syntax}:
6128 @item @emph{Arguments}:
6129 @item @emph{Return value}:
6130 @item @emph{Example}:
6131 @item @emph{Specific names}:
6133 @item @emph{See also}:
6134 @ref{MAX}, @ref{MAXLOC}
6141 @section @code{MERGE} --- Merge arrays
6142 @cindex @code{MERGE} intrinsic
6143 @cindex undocumented intrinsic
6145 Intrinsic implemented, documentation pending.
6148 @item @emph{Description}:
6149 @item @emph{Standard}:
6155 @item @emph{Syntax}:
6156 @item @emph{Arguments}:
6157 @item @emph{Return value}:
6158 @item @emph{Example}:
6159 @item @emph{Specific names}:
6160 @item @emph{See also}:
6165 @section @code{MIN} --- Minimum value of an argument list
6166 @cindex @code{MIN} intrinsic
6167 @cindex undocumented intrinsic
6169 Intrinsic implemented, documentation pending.
6172 @item @emph{Description}:
6173 @item @emph{Standard}:
6179 @item @emph{Syntax}:
6180 @item @emph{Arguments}:
6181 @item @emph{Return value}:
6182 @item @emph{Example}:
6184 @item @emph{Specific names}:
6185 @multitable @columnfractions .20 .20 .20 .40
6186 @item Name @tab Argument @tab Return type @tab Standard
6187 @item @code{MIN0(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab F77 and later
6188 @item @code{AMIN0(I)} @tab @code{INTEGER(4) I} @tab @code{REAL(MIN(X))} @tab F77 and later
6189 @item @code{MIN1(X)} @tab @code{REAL(*) X} @tab @code{INT(MIN(X))} @tab F77 and later
6190 @item @code{AMIN1(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab F77 and later
6191 @item @code{DMIN1(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F77 and later
6194 @item @emph{See also}:
6195 @ref{MINLOC}, @ref{MINVAL}
6199 @section @code{MINEXPONENT} --- Minimum exponent of a real kind
6200 @cindex @code{MINEXPONENT} intrinsic
6201 @cindex minimum exponent
6202 @cindex exponent, minimum
6205 @item @emph{Description}:
6206 @code{MINEXPONENT(X)} returns the minimum exponent in the model of the
6209 @item @emph{Standard}:
6215 @item @emph{Syntax}:
6216 @code{I = MINEXPONENT(X)}
6218 @item @emph{Arguments}:
6219 @multitable @columnfractions .15 .80
6220 @item @var{X} @tab shall be of type @code{REAL}.
6223 @item @emph{Return value}:
6224 The return value is of type @code{INTEGER} and of the default integer
6227 @item @emph{Example}:
6228 See @code{MAXEXPONENT} for an example.
6233 @section @code{MINLOC} --- Location of the minimum value within an array
6234 @cindex @code{MINLOC} intrinsic
6235 @cindex undocumented intrinsic
6237 Intrinsic implemented, documentation pending.
6240 @item @emph{Description}:
6241 @item @emph{Standard}:
6245 Transformational function
6247 @item @emph{Syntax}:
6248 @item @emph{Arguments}:
6249 @item @emph{Return value}:
6250 @item @emph{Example}:
6252 @item @emph{See also}:
6253 @ref{MIN}, @ref{MINVAL}
6259 @section @code{MINVAL} --- Minimum value of an array
6260 @cindex @code{MINVAL} intrinsic
6261 @cindex undocumented intrinsic
6263 Intrinsic implemented, documentation pending.
6266 @item @emph{Description}:
6267 @item @emph{Standard}:
6271 Transformational function
6273 @item @emph{Syntax}:
6274 @item @emph{Arguments}:
6275 @item @emph{Return value}:
6276 @item @emph{Example}:
6278 @item @emph{See also}:
6279 @ref{MIN}, @ref{MINLOC}
6286 @section @code{MOD} --- Remainder function
6287 @cindex @code{MOD} intrinsic
6288 @cindex @code{AMOD} intrinsic
6289 @cindex @code{DMOD} intrinsic
6293 @item @emph{Description}:
6294 @code{MOD(A,P)} computes the remainder of the division of A by P. It is
6295 calculated as @code{A - (INT(A/P) * P)}.
6297 @item @emph{Standard}:
6303 @item @emph{Syntax}:
6306 @item @emph{Arguments}:
6307 @multitable @columnfractions .15 .80
6308 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6309 @item @var{P} @tab shall be a scalar of the same type as @var{A} and not
6313 @item @emph{Return value}:
6314 The kind of the return value is the result of cross-promoting
6315 the kinds of the arguments.
6317 @item @emph{Example}:
6321 print *, mod(17.5,5.5)
6322 print *, mod(17.5d0,5.5)
6323 print *, mod(17.5,5.5d0)
6326 print *, mod(-17.5,5.5)
6327 print *, mod(-17.5d0,5.5)
6328 print *, mod(-17.5,5.5d0)
6331 print *, mod(17.5,-5.5)
6332 print *, mod(17.5d0,-5.5)
6333 print *, mod(17.5,-5.5d0)
6334 end program test_mod
6337 @item @emph{Specific names}:
6338 @multitable @columnfractions .20 .20 .20 .40
6339 @item Name @tab Arguments @tab Return type @tab Standard
6340 @item @code{AMOD(A,P)} @tab @code{REAL(4)} @tab @code{REAL(4)} @tab F95 and later
6341 @item @code{DMOD(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab F95 and later
6348 @section @code{MODULO} --- Modulo function
6349 @cindex @code{MODULO} intrinsic
6353 @item @emph{Description}:
6354 @code{MODULO(A,P)} computes the @var{A} modulo @var{P}.
6356 @item @emph{Standard}:
6362 @item @emph{Syntax}:
6363 @code{X = MODULO(A,P)}
6365 @item @emph{Arguments}:
6366 @multitable @columnfractions .15 .80
6367 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
6368 @item @var{P} @tab shall be a scalar of the same type and kind as @var{A}
6371 @item @emph{Return value}:
6372 The type and kind of the result are those of the arguments.
6374 @item If @var{A} and @var{P} are of type @code{INTEGER}:
6375 @code{MODULO(A,P)} has the value @var{R} such that @code{A=Q*P+R}, where
6376 @var{Q} is an integer and @var{R} is between 0 (inclusive) and @var{P}
6378 @item If @var{A} and @var{P} are of type @code{REAL}:
6379 @code{MODULO(A,P)} has the value of @code{A - FLOOR (A / P) * P}.
6381 In all cases, if @var{P} is zero the result is processor-dependent.
6383 @item @emph{Example}:
6386 print *, modulo(17,3)
6387 print *, modulo(17.5,5.5)
6389 print *, modulo(-17,3)
6390 print *, modulo(-17.5,5.5)
6392 print *, modulo(17,-3)
6393 print *, modulo(17.5,-5.5)
6394 end program test_mod
6402 @section @code{MVBITS} --- Move bits from one integer to another
6403 @cindex @code{MVBITS} intrinsic
6404 @cindex bit operations
6406 Intrinsic implemented, documentation pending.
6409 @item @emph{Description}:
6410 @item @emph{Standard}:
6414 Elemental subroutine
6416 @item @emph{Syntax}:
6417 @item @emph{Arguments}:
6418 @item @emph{Return value}:
6419 @item @emph{Example}:
6420 @item @emph{See also}:
6427 @section @code{MOVE_ALLOC} --- Move allocation from one object to another
6428 @cindex @code{MOVE_ALLOC} intrinsic
6429 @cindex moving allocation
6430 @cindex allocation, moving
6433 @item @emph{Description}:
6434 @code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
6435 @var{DEST}. @var{SRC} will become deallocated in the process.
6437 @item @emph{Standard}:
6443 @item @emph{Syntax}:
6444 @code{CALL MOVE_ALLOC(SRC, DEST)}
6446 @item @emph{Arguments}:
6447 @multitable @columnfractions .15 .80
6448 @item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be
6449 of any type and kind.
6450 @item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be
6451 of the same type, kind and rank as @var{SRC}
6454 @item @emph{Return value}:
6457 @item @emph{Example}:
6459 program test_move_alloc
6460 integer, allocatable :: a(:), b(:)
6464 call move_alloc(a, b)
6465 print *, allocated(a), allocated(b)
6467 end program test_move_alloc
6474 @section @code{NEAREST} --- Nearest representable number
6475 @cindex @code{NEAREST} intrinsic
6476 @cindex processor-representable number
6479 @item @emph{Description}:
6480 @code{NEAREST(X, S)} returns the processor-representable number nearest
6481 to @code{X} in the direction indicated by the sign of @code{S}.
6483 @item @emph{Standard}:
6489 @item @emph{Syntax}:
6490 @code{Y = NEAREST(X, S)}
6492 @item @emph{Arguments}:
6493 @multitable @columnfractions .15 .80
6494 @item @var{X} @tab shall be of type @code{REAL}.
6495 @item @var{S} @tab (Optional) shall be of type @code{REAL} and
6499 @item @emph{Return value}:
6500 The return value is of the same type as @code{X}. If @code{S} is
6501 positive, @code{NEAREST} returns the processor-representable number
6502 greater than @code{X} and nearest to it. If @code{S} is negative,
6503 @code{NEAREST} returns the processor-representable number smaller than
6504 @code{X} and nearest to it.
6506 @item @emph{Example}:
6508 program test_nearest
6510 x = nearest(42.0, 1.0)
6511 y = nearest(42.0, -1.0)
6512 write (*,"(3(G20.15))") x, y, x - y
6513 end program test_nearest
6520 @section @code{NEW_LINE} --- New line character
6521 @cindex @code{NEW_LINE} intrinsic
6522 @cindex @code{NEW_LINE} intrinsic
6525 @item @emph{Description}:
6526 @code{NEW_LINE(C)} returns the new-line character
6528 @item @emph{Standard}:
6534 @item @emph{Syntax}:
6535 @code{C = NEW_LINE(C)}
6537 @item @emph{Arguments}:
6538 @multitable @columnfractions .15 .80
6539 @item @var{C} @tab The argument shall be a scalar or array of the
6540 type @code{CHARACTER}.
6543 @item @emph{Return value}:
6544 Returns a @var{CHARACTER} scalar of length one with the new-line character of
6545 the same kind as parameter @var{C}.
6547 @item @emph{Example}:
6551 write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
6559 @section @code{NINT} --- Nearest whole number
6560 @cindex @code{NINT} intrinsic
6561 @cindex @code{IDNINT} intrinsic
6562 @cindex whole number
6565 @item @emph{Description}:
6566 @code{NINT(X)} rounds its argument to the nearest whole number.
6568 @item @emph{Standard}:
6574 @item @emph{Syntax}:
6577 @item @emph{Arguments}:
6578 @multitable @columnfractions .15 .80
6579 @item @var{X} @tab The type of the argument shall be @code{REAL}.
6582 @item @emph{Return value}:
6583 Returns @var{A} with the fractional portion of its magnitude eliminated by
6584 rounding to the nearest whole number and with its sign preserved,
6585 converted to an @code{INTEGER} of the default kind.
6587 @item @emph{Example}:
6594 print *, nint(x4), idnint(x8)
6595 end program test_nint
6598 @item @emph{Specific names}:
6599 @multitable @columnfractions .33 .33 .33
6600 @item Name @tab Argument @tab Standard
6601 @item @code{IDNINT(X)} @tab @code{REAL(8)} @tab F95 and later
6604 @item @emph{See also}:
6605 @ref{CEILING}, @ref{FLOOR}
6611 @section @code{NOT} --- Logical negation
6612 @cindex @code{NOT} intrinsic
6613 @cindex logical operations
6615 Intrinsic implemented, documentation pending.
6618 @item @emph{Description}:
6619 @item @emph{Standard}:
6625 @item @emph{Syntax}:
6626 @item @emph{Arguments}:
6627 @item @emph{Return value}:
6628 @item @emph{Example}:
6629 @item @emph{See also}:
6636 @section @code{NULL} --- Function that returns an disassociated pointer
6637 @cindex @code{NULL} intrinsic
6638 @cindex undocumented intrinsic
6640 Intrinsic implemented, documentation pending.
6643 @item @emph{Description}:
6644 @item @emph{Standard}:
6648 Transformational function
6650 @item @emph{Syntax}:
6651 @item @emph{Arguments}:
6652 @item @emph{Return value}:
6653 @item @emph{Example}:
6654 @item @emph{See also}:
6662 @section @code{OR} --- Bitwise logical OR
6663 @cindex @code{OR} intrinsic
6664 @cindex bit operations
6667 @item @emph{Description}:
6668 Bitwise logical @code{OR}.
6670 This intrinsic routine is provided for backwards compatibility with
6671 GNU Fortran 77. For integer arguments, programmers should consider
6672 the use of the @ref{IOR} intrinsic defined by the Fortran standard.
6674 @item @emph{Standard}:
6678 Non-elemental function
6680 @item @emph{Syntax}:
6681 @code{RESULT = OR(X, Y)}
6683 @item @emph{Arguments}:
6684 @multitable @columnfractions .15 .80
6685 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6686 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
6689 @item @emph{Return value}:
6690 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
6691 after cross-promotion of the arguments.
6693 @item @emph{Example}:
6696 LOGICAL :: T = .TRUE., F = ..FALSE.
6698 DATA a / Z'F' /, b / Z'3' /
6700 WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
6701 WRITE (*,*) OR(a, b)
6705 @item @emph{See also}:
6706 F95 elemental function: @ref{IOR}
6713 @section @code{PACK} --- Pack an array into an array of rank one
6714 @cindex @code{PACK} intrinsic
6715 @cindex undocumented intrinsic
6717 Intrinsic implemented, documentation pending.
6720 @item @emph{Description}:
6721 @item @emph{Standard}:
6725 Transformational function
6727 @item @emph{Syntax}:
6728 @item @emph{Arguments}:
6729 @item @emph{Return value}:
6730 @item @emph{Example}:
6731 @item @emph{Specific names}:
6732 @item @emph{See also}:
6740 @section @code{PERROR} --- Print system error message
6741 @cindex @code{PERROR} intrinsic
6742 @cindex undocumented intrinsic
6744 Intrinsic implemented, documentation pending.
6747 @item @emph{Description}:
6748 @item @emph{Standard}:
6754 @item @emph{Syntax}:
6755 @item @emph{Arguments}:
6756 @item @emph{Return value}:
6757 @item @emph{Example}:
6758 @item @emph{Specific names}:
6759 @item @emph{See also}:
6767 @section @code{PRECISION} --- Decimal precision of a real kind
6768 @cindex @code{PRECISION} intrinsic
6769 @cindex precision of a real variable
6772 @item @emph{Description}:
6773 @code{PRECISION(X)} returns the decimal precision in the model of the
6776 @item @emph{Standard}:
6782 @item @emph{Syntax}:
6783 @code{I = PRECISION(X)}
6785 @item @emph{Arguments}:
6786 @multitable @columnfractions .15 .80
6787 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
6790 @item @emph{Return value}:
6791 The return value is of type @code{INTEGER} and of the default integer
6794 @item @emph{Example}:
6796 program prec_and_range
6797 real(kind=4) :: x(2)
6798 complex(kind=8) :: y
6800 print *, precision(x), range(x)
6801 print *, precision(y), range(y)
6802 end program prec_and_range
6809 @section @code{PRESENT} --- Determine whether an optional argument is specified
6810 @cindex @code{PRESENT} intrinsic
6811 @cindex undocumented intrinsic
6813 Intrinsic implemented, documentation pending.
6816 @item @emph{Description}:
6817 @item @emph{Standard}:
6823 @item @emph{Syntax}:
6824 @item @emph{Arguments}:
6825 @item @emph{Return value}:
6826 @item @emph{Example}:
6827 @item @emph{See also}:
6834 @section @code{PRODUCT} --- Product of array elements
6835 @cindex @code{PRODUCT} intrinsic
6836 @cindex undocumented intrinsic
6838 Intrinsic implemented, documentation pending.
6841 @item @emph{Description}:
6842 @item @emph{Standard}:
6846 Transformational function
6848 @item @emph{Syntax}:
6849 @item @emph{Arguments}:
6850 @item @emph{Return value}:
6851 @item @emph{Example}:
6852 @item @emph{Specific names}:
6853 @item @emph{See also}:
6861 @section @code{RADIX} --- Base of a model number
6862 @cindex @code{RADIX} intrinsic
6866 @item @emph{Description}:
6867 @code{RADIX(X)} returns the base of the model representing the entity @var{X}.
6869 @item @emph{Standard}:
6875 @item @emph{Syntax}:
6878 @item @emph{Arguments}:
6879 @multitable @columnfractions .15 .80
6880 @item @var{X} @tab Shall be of type @code{INTEGER} or @code{REAL}
6883 @item @emph{Return value}:
6884 The return value is a scalar of type @code{INTEGER} and of the default
6887 @item @emph{Example}:
6890 print *, "The radix for the default integer kind is", radix(0)
6891 print *, "The radix for the default real kind is", radix(0.0)
6892 end program test_radix
6900 @section @code{RANDOM_NUMBER} --- Pseudo-random number
6901 @cindex @code{RANDOM_NUMBER} intrinsic
6902 @cindex random numbers
6904 Intrinsic implemented, documentation pending.
6907 @item @emph{Description}:
6908 @item @emph{Standard}:
6912 Elemental subroutine
6914 @item @emph{Syntax}:
6915 @item @emph{Arguments}:
6916 @item @emph{Return value}:
6917 @item @emph{Example}:
6918 @item @emph{See also}:
6926 @section @code{RANDOM_SEED} --- Initialize a pseudo-random number sequence
6927 @cindex @code{RANDOM_SEED} intrinsic
6928 @cindex random numbers
6930 Intrinsic implemented, documentation pending.
6933 @item @emph{Description}:
6934 @item @emph{Standard}:
6940 @item @emph{Syntax}:
6941 @item @emph{Arguments}:
6942 @item @emph{Return value}:
6943 @item @emph{Example}:
6944 @item @emph{See also}:
6952 @section @code{RAND} --- Real pseudo-random number
6953 @cindex @code{RAND} intrinsic
6954 @cindex @code{RAN} intrinsic
6955 @cindex random numbers
6958 @item @emph{Description}:
6959 @code{RAND(FLAG)} returns a pseudo-random number from a uniform
6960 distribution between 0 and 1. If @var{FLAG} is 0, the next number
6961 in the current sequence is returned; if @var{FLAG} is 1, the generator
6962 is restarted by @code{CALL SRAND(0)}; if @var{FLAG} has any other value,
6963 it is used as a new seed with @code{SRAND}.
6965 @item @emph{Standard}:
6969 non-elemental function
6971 @item @emph{Syntax}:
6972 @code{X = RAND(FLAG)}
6974 @item @emph{Arguments}:
6975 @multitable @columnfractions .15 .80
6976 @item @var{FLAG} @tab shall be a scalar @code{INTEGER} of kind 4.
6979 @item @emph{Return value}:
6980 The return value is of @code{REAL} type and the default kind.
6982 @item @emph{Example}:
6985 integer,parameter :: seed = 86456
6988 print *, rand(), rand(), rand(), rand()
6989 print *, rand(seed), rand(), rand(), rand()
6990 end program test_rand
6994 For compatibility with HP FORTRAN 77/iX, the @code{RAN} intrinsic is
6995 provided as an alias for @code{RAND}.
6997 @item @emph{See also}:
6998 @ref{SRAND}, @ref{RANDOM_NUMBER}
7005 @section @code{RANGE} --- Decimal exponent range of a real kind
7006 @cindex @code{RANGE} intrinsic
7007 @cindex range of a real variable
7010 @item @emph{Description}:
7011 @code{RANGE(X)} returns the decimal exponent range in the model of the
7014 @item @emph{Standard}:
7020 @item @emph{Syntax}:
7023 @item @emph{Arguments}:
7024 @multitable @columnfractions .15 .80
7025 @item @var{X} @tab shall be of type @code{REAL} or @code{COMPLEX}.
7028 @item @emph{Return value}:
7029 The return value is of type @code{INTEGER} and of the default integer
7032 @item @emph{Example}:
7033 See @code{PRECISION} for an example.
7039 @section @code{RAN} --- Real pseudo-random number
7040 @cindex @code{RAN} intrinsic
7041 @cindex random numbers
7044 @item @emph{Standard}:
7047 @item @emph{See also}:
7048 @ref{RAND}, @ref{RANDOM_NUMBER}
7054 @section @code{REAL} --- Convert to real type
7055 @cindex @code{REAL} intrinsic
7056 @cindex @code{REALPART} intrinsic
7060 @item @emph{Description}:
7061 @code{REAL(X [, KIND])} converts its argument @var{X} to a real type. The
7062 @code{REALPART(X)} function is provided for compatibility with @command{g77},
7063 and its use is strongly discouraged.
7065 @item @emph{Standard}:
7071 @item @emph{Syntax}:
7072 @multitable @columnfractions .30 .80
7073 @item @code{X = REAL(X)}
7074 @item @code{X = REAL(X, KIND)}
7075 @item @code{X = REALPART(Z)}
7078 @item @emph{Arguments}:
7079 @multitable @columnfractions .15 .80
7080 @item @var{X} @tab shall be @code{INTEGER(*)}, @code{REAL(*)}, or
7082 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer.
7085 @item @emph{Return value}:
7086 These functions return a @code{REAL(*)} variable or array under
7087 the following rules:
7091 @code{REAL(X)} is converted to a default real type if @var{X} is an
7092 integer or real variable.
7094 @code{REAL(X)} is converted to a real type with the kind type parameter
7095 of @var{X} if @var{X} is a complex variable.
7097 @code{REAL(X, KIND)} is converted to a real type with kind type
7098 parameter @var{KIND} if @var{X} is a complex, integer, or real
7102 @item @emph{Example}:
7105 complex :: x = (1.0, 2.0)
7106 print *, real(x), real(x,8), realpart(x)
7107 end program test_real
7110 @item @emph{See also}:
7111 @ref{DBLE}, @ref{DFLOAT}, @ref{FLOAT}
7117 @section @code{RENAME} --- Rename a file
7118 @cindex @code{RENAME} intrinsic
7119 @cindex file system operations
7121 Intrinsic implemented, documentation pending.
7124 @item @emph{Description}:
7125 @item @emph{Standard}:
7131 @item @emph{Syntax}:
7132 @item @emph{Arguments}:
7133 @item @emph{Return value}:
7134 @item @emph{Example}:
7135 @item @emph{See also}:
7142 @section @code{REPEAT} --- Repeated string concatenation
7143 @cindex @code{REPEAT} intrinsic
7144 @cindex string manipulation
7146 Intrinsic implemented, documentation pending.
7149 @item @emph{Description}:
7150 @item @emph{Standard}:
7154 Transformational function
7156 @item @emph{Syntax}:
7157 @item @emph{Arguments}:
7158 @item @emph{Return value}:
7159 @item @emph{Example}:
7160 @item @emph{See also}:
7167 @section @code{RESHAPE} --- Function to reshape an array
7168 @cindex @code{RESHAPE} intrinsic
7169 @cindex array manipulation
7171 Intrinsic implemented, documentation pending.
7174 @item @emph{Description}:
7175 @item @emph{Standard}:
7179 Transformational function
7181 @item @emph{Syntax}:
7182 @item @emph{Arguments}:
7183 @item @emph{Return value}:
7184 @item @emph{Example}:
7185 @item @emph{See also}:
7192 @section @code{RRSPACING} --- Reciprocal of the relative spacing
7193 @cindex @code{RRSPACING} intrinsic
7196 @item @emph{Description}:
7197 @code{RRSPACING(X)} returns the reciprocal of the relative spacing of
7198 model numbers near @var{X}.
7200 @item @emph{Standard}:
7206 @item @emph{Syntax}:
7207 @code{Y = RRSPACING(X)}
7209 @item @emph{Arguments}:
7210 @multitable @columnfractions .15 .80
7211 @item @var{X} @tab shall be of type @code{REAL}.
7214 @item @emph{Return value}:
7215 The return value is of the same type and kind as @var{X}.
7216 The value returned is equal to
7217 @code{ABS(FRACTION(X)) * FLOAT(RADIX(X))**DIGITS(X)}.
7224 @section @code{RSHIFT} --- Right shift bits
7225 @cindex @code{RSHIFT} intrinsic
7226 @cindex bit operations
7228 Intrinsic implemented, documentation pending.
7231 @item @emph{Description}:
7233 @item @emph{Standard}:
7239 @item @emph{Syntax}:
7240 @item @emph{Arguments}:
7241 @item @emph{Return value}:
7242 @item @emph{Example}:
7243 @item @emph{See also}:
7250 @section @code{SCALE} --- Scale a real value
7251 @cindex @code{SCALE} intrinsic
7254 @item @emph{Description}:
7255 @code{SCALE(X,I)} returns @code{X * RADIX(X)**I}.
7257 @item @emph{Standard}:
7263 @item @emph{Syntax}:
7264 @code{Y = SCALE(X, I)}
7266 @item @emph{Arguments}:
7267 @multitable @columnfractions .15 .80
7268 @item @var{X} @tab The type of the argument shall be a @code{REAL}.
7269 @item @var{I} @tab The type of the argument shall be a @code{INTEGER}.
7272 @item @emph{Return value}:
7273 The return value is of the same type and kind as @var{X}.
7274 Its value is @code{X * RADIX(X)**I}.
7276 @item @emph{Example}:
7279 real :: x = 178.1387e-4
7281 print *, scale(x,i), x*radix(x)**i
7282 end program test_scale
7289 @section @code{SCAN} --- Scan a string for the presence of a set of characters
7290 @cindex @code{SCAN} intrinsic
7291 @cindex string manipulation
7293 Intrinsic implemented, documentation pending.
7296 @item @emph{Description}:
7297 @item @emph{Standard}:
7303 @item @emph{Syntax}:
7304 @item @emph{Arguments}:
7305 @item @emph{Return value}:
7306 @item @emph{Example}:
7307 @item @emph{See also}:
7314 @section @code{SECNDS} --- Time function
7315 @cindex @code{SECNDS} intrinsic
7316 @cindex time, current
7317 @cindex current time
7320 @item @emph{Description}:
7321 @code{SECNDS(X)} gets the time in seconds from the real-time system clock.
7322 @var{X} is a reference time, also in seconds. If this is zero, the time in
7323 seconds from midnight is returned. This function is non-standard and its
7326 @item @emph{Standard}:
7332 @item @emph{Syntax}:
7333 @code{T = SECNDS (X)}
7335 @item @emph{Arguments}:
7336 @multitable @columnfractions .15 .80
7337 @item Name @tab Type
7338 @item @var{T} @tab REAL(4)
7339 @item @var{X} @tab REAL(4)
7342 @item @emph{Return value}:
7345 @item @emph{Example}:
7349 print *, secnds (0.0) ! seconds since midnight
7350 t1 = secnds (0.0) ! reference time
7351 do i = 1, 10000000 ! do something
7353 t2 = secnds (t1) ! elapsed time
7354 print *, "Something took ", t2, " seconds."
7355 end program test_secnds
7361 @node SELECTED_INT_KIND
7362 @section @code{SELECTED_INT_KIND} --- Choose integer kind
7363 @cindex @code{SELECTED_INT_KIND} intrinsic
7364 @cindex integer kind
7367 @item @emph{Description}:
7368 @code{SELECTED_INT_KIND(I)} return the kind value of the smallest integer
7369 type that can represent all values ranging from @math{-10^I} (exclusive)
7370 to @math{10^I} (exclusive). If there is no integer kind that accommodates
7371 this range, @code{SELECTED_INT_KIND} returns @math{-1}.
7373 @item @emph{Standard}:
7377 Transformational function
7379 @item @emph{Syntax}:
7380 @multitable @columnfractions .30 .80
7381 @item @code{J = SELECTED_INT_KIND(I)}
7384 @item @emph{Arguments}:
7385 @multitable @columnfractions .15 .80
7386 @item @var{I} @tab shall be a scalar and of type @code{INTEGER}.
7389 @item @emph{Example}:
7391 program large_integers
7392 integer,parameter :: k5 = selected_int_kind(5)
7393 integer,parameter :: k15 = selected_int_kind(15)
7394 integer(kind=k5) :: i5
7395 integer(kind=k15) :: i15
7397 print *, huge(i5), huge(i15)
7399 ! The following inequalities are always true
7400 print *, huge(i5) >= 10_k5**5-1
7401 print *, huge(i15) >= 10_k15**15-1
7402 end program large_integers
7408 @node SELECTED_REAL_KIND
7409 @section @code{SELECTED_REAL_KIND} --- Choose real kind
7410 @cindex @code{SELECTED_REAL_KIND} intrinsic
7414 @item @emph{Description}:
7415 @code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
7416 with decimal precision greater of at least @code{P} digits and exponent
7417 range greater at least @code{R}.
7419 @item @emph{Standard}:
7423 Transformational function
7425 @item @emph{Syntax}:
7426 @multitable @columnfractions .30 .80
7427 @item @code{I = SELECTED_REAL_KIND(P,R)}
7430 @item @emph{Arguments}:
7431 @multitable @columnfractions .15 .80
7432 @item @var{P} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7433 @item @var{R} @tab (Optional) shall be a scalar and of type @code{INTEGER}.
7435 At least one argument shall be present.
7437 @item @emph{Return value}:
7439 @code{SELECTED_REAL_KIND} returns the value of the kind type parameter of
7440 a real data type with decimal precision of at least @code{P} digits and a
7441 decimal exponent range of at least @code{R}. If more than one real data
7442 type meet the criteria, the kind of the data type with the smallest
7443 decimal precision is returned. If no real data type matches the criteria,
7446 @item -1 if the processor does not support a real data type with a
7447 precision greater than or equal to @code{P}
7448 @item -2 if the processor does not support a real type with an exponent
7449 range greater than or equal to @code{R}
7450 @item -3 if neither is supported.
7453 @item @emph{Example}:
7456 integer,parameter :: p6 = selected_real_kind(6)
7457 integer,parameter :: p10r100 = selected_real_kind(10,100)
7458 integer,parameter :: r400 = selected_real_kind(r=400)
7460 real(kind=p10r100) :: y
7461 real(kind=r400) :: z
7463 print *, precision(x), range(x)
7464 print *, precision(y), range(y)
7465 print *, precision(z), range(z)
7466 end program real_kinds
7473 @section @code{SET_EXPONENT} --- Set the exponent of the model
7474 @cindex @code{SET_EXPONENT} intrinsic
7475 @cindex exponent part of a real number
7478 @item @emph{Description}:
7479 @code{SET_EXPONENT(X, I)} returns the real number whose fractional part
7480 is that that of @var{X} and whose exponent part is @var{I}.
7482 @item @emph{Standard}:
7488 @item @emph{Syntax}:
7489 @code{Y = SET_EXPONENT(X, I)}
7491 @item @emph{Arguments}:
7492 @multitable @columnfractions .15 .80
7493 @item @var{X} @tab shall be of type @code{REAL}.
7494 @item @var{I} @tab shall be of type @code{INTEGER}.
7497 @item @emph{Return value}:
7498 The return value is of the same type and kind as @var{X}.
7499 The real number whose fractional part
7500 is that that of @var{X} and whose exponent part if @var{I} is returned;
7501 it is @code{FRACTION(X) * RADIX(X)**I}.
7503 @item @emph{Example}:
7506 real :: x = 178.1387e-4
7508 print *, set_exponent(x), fraction(x) * radix(x)**i
7509 end program test_setexp
7517 @section @code{SHAPE} --- Determine the shape of an array
7518 @cindex @code{SHAPE} intrinsic
7519 @cindex array manipulation
7521 Intrinsic implemented, documentation pending.
7524 @item @emph{Description}:
7525 @item @emph{Standard}:
7531 @item @emph{Syntax}:
7532 @item @emph{Arguments}:
7533 @item @emph{Return value}:
7534 @item @emph{Example}:
7535 @item @emph{See also}:
7543 @section @code{SIGN} --- Sign copying function
7544 @cindex @code{SIGN} intrinsic
7545 @cindex @code{ISIGN} intrinsic
7546 @cindex @code{DSIGN} intrinsic
7547 @cindex sign copying
7550 @item @emph{Description}:
7551 @code{SIGN(A,B)} returns the value of @var{A} with the sign of @var{B}.
7553 @item @emph{Standard}:
7559 @item @emph{Syntax}:
7560 @code{X = SIGN(A,B)}
7562 @item @emph{Arguments}:
7563 @multitable @columnfractions .15 .80
7564 @item @var{A} @tab shall be a scalar of type @code{INTEGER} or @code{REAL}
7565 @item @var{B} @tab shall be a scalar of the same type and kind as @var{A}
7568 @item @emph{Return value}:
7569 The kind of the return value is that of @var{A} and @var{B}.
7570 If @math{B\ge 0} then the result is @code{ABS(A)}, else
7571 it is @code{-ABS(A)}.
7573 @item @emph{Example}:
7576 print *, sign(-12,1)
7577 print *, sign(-12,0)
7578 print *, sign(-12,-1)
7580 print *, sign(-12.,1.)
7581 print *, sign(-12.,0.)
7582 print *, sign(-12.,-1.)
7583 end program test_sign
7586 @item @emph{Specific names}:
7587 @multitable @columnfractions .20 .20 .20 .40
7588 @item Name @tab Arguments @tab Return type @tab Standard
7589 @item @code{ISIGN(A,P)} @tab @code{INTEGER(4)} @tab @code{INTEGER(4)} @tab f95, gnu
7590 @item @code{DSIGN(A,P)} @tab @code{REAL(8)} @tab @code{REAL(8)} @tab f95, gnu
7597 @section @code{SIGNAL} --- Signal handling subroutine (or function)
7598 @cindex @code{SIGNAL} intrinsic
7599 @cindex signal handling
7602 @item @emph{Description}:
7603 @code{SIGNAL(NUMBER, HANDLER [, STATUS])} causes external subroutine
7604 @var{HANDLER} to be executed with a single integer argument when signal
7605 @var{NUMBER} occurs. If @var{HANDLER} is an integer, it can be used to
7606 turn off handling of signal @var{NUMBER} or revert to its default
7607 action. See @code{signal(2)}.
7609 If @code{SIGNAL} is called as a subroutine and the @var{STATUS} argument
7610 is supplied, it is set to the value returned by @code{signal(2)}.
7612 @item @emph{Standard}:
7616 subroutine, non-elemental function
7618 @item @emph{Syntax}:
7619 @multitable @columnfractions .30 .80
7620 @item @code{CALL SIGNAL(NUMBER, HANDLER)}
7621 @item @code{CALL SIGNAL(NUMBER, HANDLER, STATUS)}
7622 @item @code{STATUS = SIGNAL(NUMBER, HANDLER)}
7625 @item @emph{Arguments}:
7626 @multitable @columnfractions .15 .80
7627 @item @var{NUMBER} @tab shall be a scalar integer, with @code{INTENT(IN)}
7628 @item @var{HANDLER}@tab Signal handler (@code{INTEGER FUNCTION} or
7629 @code{SUBROUTINE}) or dummy/global @code{INTEGER} scalar.
7630 @code{INTEGER}. It is @code{INTENT(IN)}.
7631 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
7632 integer. It has @code{INTENT(OUT)}.
7635 @item @emph{Return value}:
7636 The @code{SIGNAL} function returns the value returned by @code{signal(2)}.
7638 @item @emph{Example}:
7642 external handler_print
7644 call signal (12, handler_print)
7648 end program test_signal
7656 @section @code{SIN} --- Sine function
7657 @cindex @code{SIN} intrinsic
7658 @cindex @code{DSIN} intrinsic
7659 @cindex @code{ZSIN} intrinsic
7660 @cindex @code{CDSIN} intrinsic
7661 @cindex trigonometric functions
7664 @item @emph{Description}:
7665 @code{SIN(X)} computes the sine of @var{X}.
7667 @item @emph{Standard}:
7673 @item @emph{Syntax}:
7676 @item @emph{Arguments}:
7677 @multitable @columnfractions .15 .80
7678 @item @var{X} @tab The type shall be @code{REAL(*)} or
7682 @item @emph{Return value}:
7683 The return value has same type and kind as @var{X}.
7685 @item @emph{Example}:
7690 end program test_sin
7693 @item @emph{Specific names}:
7694 @multitable @columnfractions .20 .20 .20 .40
7695 @item Name @tab Argument @tab Return type @tab Standard
7696 @item @code{DSIN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
7697 @item @code{CSIN(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab f95, gnu
7698 @item @code{ZSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
7699 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab f95, gnu
7702 @item @emph{See also}:
7709 @section @code{SINH} --- Hyperbolic sine function
7710 @cindex @code{SINH} intrinsic
7711 @cindex @code{DSINH} intrinsic
7712 @cindex hyperbolic sine
7715 @item @emph{Description}:
7716 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
7718 @item @emph{Standard}:
7724 @item @emph{Syntax}:
7727 @item @emph{Arguments}:
7728 @multitable @columnfractions .15 .80
7729 @item @var{X} @tab The type shall be @code{REAL(*)}.
7732 @item @emph{Return value}:
7733 The return value is of type @code{REAL(*)}.
7735 @item @emph{Example}:
7738 real(8) :: x = - 1.0_8
7740 end program test_sinh
7743 @item @emph{Specific names}:
7744 @multitable @columnfractions .20 .20 .20 .40
7745 @item Name @tab Argument @tab Return type @tab Standard
7746 @item @code{DSINH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7749 @item @emph{See also}:
7756 @section @code{SIZE} --- Determine the size of an array
7757 @cindex @code{SIZE} intrinsic
7758 @cindex array manipulation
7760 Intrinsic implemented, documentation pending.
7763 @item @emph{Description}:
7764 @item @emph{Standard}:
7770 @item @emph{Syntax}:
7771 @item @emph{Arguments}:
7772 @item @emph{Return value}:
7773 @item @emph{Example}:
7774 @item @emph{See also}:
7780 @section @code{SNGL} --- Convert double precision real to default real
7781 @cindex @code{SNGL} intrinsic
7782 @cindex conversion function (real)
7785 @item @emph{Description}:
7786 @code{SNGL(A)} converts the double precision real @var{A}
7787 to a default real value. This is an archaic form of @code{REAL}
7788 that is specific to one type for @var{A}.
7790 @item @emph{Standard}:
7796 @item @emph{Syntax}:
7799 @item @emph{Arguments}:
7800 @multitable @columnfractions .15 .80
7801 @item @var{A} @tab The type shall be a double precision @code{REAL}.
7804 @item @emph{Return value}:
7805 The return value is of type default @code{REAL}.
7807 @item @emph{See also}:
7814 @section @code{SPACING} --- Smallest distance between two numbers of a given type
7815 @cindex @code{SPACING} intrinsic
7816 @cindex undocumented intrinsic
7818 Intrinsic implemented, documentation pending.
7821 @item @emph{Description}:
7822 @item @emph{Standard}:
7828 @item @emph{Syntax}:
7829 @item @emph{Arguments}:
7830 @item @emph{Return value}:
7831 @item @emph{Example}:
7832 @item @emph{See also}:
7839 @section @code{SPREAD} --- Add a dimension to an array
7840 @cindex @code{SPREAD} intrinsic
7841 @cindex array manipulation
7843 Intrinsic implemented, documentation pending.
7846 @item @emph{Description}:
7847 @item @emph{Standard}:
7851 Transformational function
7853 @item @emph{Syntax}:
7854 @item @emph{Arguments}:
7855 @item @emph{Return value}:
7856 @item @emph{Example}:
7857 @item @emph{See also}:
7864 @section @code{SQRT} --- Square-root function
7865 @cindex @code{SQRT} intrinsic
7866 @cindex @code{DSQRT} intrinsic
7867 @cindex @code{CSQRT} intrinsic
7868 @cindex @code{ZSQRT} intrinsic
7869 @cindex @code{CDSQRT} intrinsic
7873 @item @emph{Description}:
7874 @code{SQRT(X)} computes the square root of @var{X}.
7876 @item @emph{Standard}:
7882 @item @emph{Syntax}:
7885 @item @emph{Arguments}:
7886 @multitable @columnfractions .15 .80
7887 @item @var{X} @tab The type shall be @code{REAL(*)} or
7891 @item @emph{Return value}:
7892 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
7893 The kind type parameter is the same as @var{X}.
7895 @item @emph{Example}:
7898 real(8) :: x = 2.0_8
7899 complex :: z = (1.0, 2.0)
7902 end program test_sqrt
7905 @item @emph{Specific names}:
7906 @multitable @columnfractions .20 .20 .20 .40
7907 @item Name @tab Argument @tab Return type @tab Standard
7908 @item @code{DSQRT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
7909 @item @code{CSQRT(X)} @tab @code{COMPLEX(4) X} @tab @code{COMPLEX(4)} @tab F95 and later
7910 @item @code{ZSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7911 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X} @tab @code{COMPLEX(8)} @tab GNU extension
7918 @section @code{SRAND} --- Reinitialize the random number generator
7919 @cindex @code{SRAND} intrinsic
7920 @cindex random numbers
7923 @item @emph{Description}:
7924 @code{SRAND} reinitializes the pseudo-random number generator
7925 called by @code{RAND} and @code{IRAND}. The new seed used by the
7926 generator is specified by the required argument @var{SEED}.
7928 @item @emph{Standard}:
7932 non-elemental subroutine
7934 @item @emph{Syntax}:
7935 @code{CALL SRAND(SEED)}
7937 @item @emph{Arguments}:
7938 @multitable @columnfractions .15 .80
7939 @item @var{SEED} @tab shall be a scalar @code{INTEGER(kind=4)}.
7942 @item @emph{Return value}:
7945 @item @emph{Example}:
7946 See @code{RAND} and @code{IRAND} for examples.
7949 The Fortran 2003 standard specifies the intrinsic @code{RANDOM_SEED} to
7950 initialize the pseudo-random numbers generator and @code{RANDOM_NUMBER}
7951 to generate pseudo-random numbers. Please note that in
7952 GNU Fortran, these two sets of intrinsics (@code{RAND},
7953 @code{IRAND} and @code{SRAND} on the one hand, @code{RANDOM_NUMBER} and
7954 @code{RANDOM_SEED} on the other hand) access two independent
7955 pseudo-random number generators.
7957 @item @emph{See also}:
7958 @ref{RAND}, @ref{RANDOM_SEED}, @ref{RANDOM_NUMBER}
7964 @section @code{STAT} --- Get file status
7965 @cindex @code{STAT} intrinsic
7966 @cindex file system operations
7969 @item @emph{Description}:
7970 This function returns information about a file. No permissions are required on
7971 the file itself, but execute (search) permission is required on all of the
7972 directories in path that lead to the file.
7974 The elements that are obtained and stored in the array @code{BUFF}:
7975 @multitable @columnfractions .15 .80
7976 @item @code{buff(1)} @tab Device ID
7977 @item @code{buff(2)} @tab Inode number
7978 @item @code{buff(3)} @tab File mode
7979 @item @code{buff(4)} @tab Number of links
7980 @item @code{buff(5)} @tab Owner's uid
7981 @item @code{buff(6)} @tab Owner's gid
7982 @item @code{buff(7)} @tab ID of device containing directory entry for file (0 if not available)
7983 @item @code{buff(8)} @tab File size (bytes)
7984 @item @code{buff(9)} @tab Last access time
7985 @item @code{buff(10)} @tab Last modification time
7986 @item @code{buff(11)} @tab Last file status change time
7987 @item @code{buff(12)} @tab Preferred I/O block size (-1 if not available)
7988 @item @code{buff(13)} @tab Number of blocks allocated (-1 if not available)
7991 Not all these elements are relevant on all systems.
7992 If an element is not relevant, it is returned as 0.
7995 @item @emph{Standard}:
7999 Non-elemental subroutine
8001 @item @emph{Syntax}:
8002 @code{CALL STAT(FILE,BUFF[,STATUS])}
8004 @item @emph{Arguments}:
8005 @multitable @columnfractions .15 .80
8006 @item @var{FILE} @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
8007 @item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
8008 @item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
8009 on success and a system specific error code otherwise.
8012 @item @emph{Example}:
8015 INTEGER, DIMENSION(13) :: buff
8018 CALL STAT("/etc/passwd", buff, status)
8020 IF (status == 0) THEN
8021 WRITE (*, FMT="('Device ID:', T30, I19)") buff(1)
8022 WRITE (*, FMT="('Inode number:', T30, I19)") buff(2)
8023 WRITE (*, FMT="('File mode (octal):', T30, O19)") buff(3)
8024 WRITE (*, FMT="('Number of links:', T30, I19)") buff(4)
8025 WRITE (*, FMT="('Owner''s uid:', T30, I19)") buff(5)
8026 WRITE (*, FMT="('Owner''s gid:', T30, I19)") buff(6)
8027 WRITE (*, FMT="('Device where located:', T30, I19)") buff(7)
8028 WRITE (*, FMT="('File size:', T30, I19)") buff(8)
8029 WRITE (*, FMT="('Last access time:', T30, A19)") CTIME(buff(9))
8030 WRITE (*, FMT="('Last modification time', T30, A19)") CTIME(buff(10))
8031 WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
8032 WRITE (*, FMT="('Preferred block size:', T30, I19)") buff(12)
8033 WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
8038 @item @emph{See also}:
8039 To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
8045 @section @code{SUM} --- Sum of array elements
8046 @cindex @code{SUM} intrinsic
8047 @cindex array manipulation
8049 Intrinsic implemented, documentation pending.
8052 @item @emph{Description}:
8053 @item @emph{Standard}:
8057 Transformational function
8059 @item @emph{Syntax}:
8060 @item @emph{Arguments}:
8061 @item @emph{Return value}:
8062 @item @emph{Example}:
8063 @item @emph{See also}:
8071 @section @code{SYMLNK} --- Create a symbolic link
8072 @cindex @code{SYMLNK} intrinsic
8073 @cindex file system operations
8075 Intrinsic implemented, documentation pending.
8078 @item @emph{Description}:
8079 @item @emph{Standard}:
8083 @item @emph{Syntax}:
8084 @item @emph{Arguments}:
8085 @item @emph{Return value}:
8086 @item @emph{Example}:
8087 @item @emph{See also}:
8094 @section @code{SYSTEM} --- Execute a shell command
8095 @cindex @code{SYSTEM} intrinsic
8096 @cindex undocumented intrinsic
8098 Intrinsic implemented, documentation pending.
8101 @item @emph{Description}:
8102 @item @emph{Standard}:
8108 @item @emph{Syntax}:
8109 @item @emph{Arguments}:
8110 @item @emph{Return value}:
8111 @item @emph{Example}:
8112 @item @emph{See also}:
8119 @section @code{SYSTEM_CLOCK} --- Time function
8120 @cindex @code{SYSTEM_CLOCK} intrinsic
8121 @cindex time, current
8122 @cindex current time
8124 Intrinsic implemented, documentation pending.
8127 @item @emph{Description}:
8128 @item @emph{Standard}:
8134 @item @emph{Syntax}:
8135 @item @emph{Arguments}:
8136 @item @emph{Return value}:
8137 @item @emph{Example}:
8138 @item @emph{See also}:
8144 @section @code{TAN} --- Tangent function
8145 @cindex @code{TAN} intrinsic
8146 @cindex @code{DTAN} intrinsic
8147 @cindex trigonometric functions
8150 @item @emph{Description}:
8151 @code{TAN(X)} computes the tangent of @var{X}.
8153 @item @emph{Standard}:
8159 @item @emph{Syntax}:
8162 @item @emph{Arguments}:
8163 @multitable @columnfractions .15 .80
8164 @item @var{X} @tab The type shall be @code{REAL(*)}.
8167 @item @emph{Return value}:
8168 The return value is of type @code{REAL(*)}. The kind type parameter is
8169 the same as @var{X}.
8171 @item @emph{Example}:
8174 real(8) :: x = 0.165_8
8176 end program test_tan
8179 @item @emph{Specific names}:
8180 @multitable @columnfractions .20 .20 .20 .40
8181 @item Name @tab Argument @tab Return type @tab Standard
8182 @item @code{DTAN(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
8185 @item @emph{See also}:
8192 @section @code{TANH} --- Hyperbolic tangent function
8193 @cindex @code{TANH} intrinsic
8194 @cindex @code{DTANH} intrinsic
8195 @cindex hyperbolic tangent
8198 @item @emph{Description}:
8199 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
8201 @item @emph{Standard}:
8207 @item @emph{Syntax}:
8210 @item @emph{Arguments}:
8211 @multitable @columnfractions .15 .80
8212 @item @var{X} @tab The type shall be @code{REAL(*)}.
8215 @item @emph{Return value}:
8216 The return value is of type @code{REAL(*)} and lies in the range
8217 @math{ - 1 \leq tanh(x) \leq 1 }.
8219 @item @emph{Example}:
8222 real(8) :: x = 2.1_8
8224 end program test_tanh
8227 @item @emph{Specific names}:
8228 @multitable @columnfractions .20 .20 .20 .40
8229 @item Name @tab Argument @tab Return type @tab Standard
8230 @item @code{DTANH(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab F95 and later
8233 @item @emph{See also}:
8240 @section @code{TIME} --- Time function
8241 @cindex @code{TIME} intrinsic
8242 @cindex time, current
8243 @cindex current time
8245 Intrinsic implemented, documentation pending.
8248 @item @emph{Description}:
8249 @item @emph{Standard}:
8253 Non-elemental function
8255 @item @emph{Syntax}:
8256 @item @emph{Arguments}:
8257 @item @emph{Return value}:
8258 @item @emph{Example}:
8259 @item @emph{See also}:
8265 @section @code{TINY} --- Smallest positive number of a real kind
8266 @cindex @code{TINY} intrinsic
8270 @item @emph{Description}:
8271 @code{TINY(X)} returns the smallest positive (non zero) number
8272 in the model of the type of @code{X}.
8274 @item @emph{Standard}:
8280 @item @emph{Syntax}:
8283 @item @emph{Arguments}:
8284 @multitable @columnfractions .15 .80
8285 @item @var{X} @tab shall be of type @code{REAL}.
8288 @item @emph{Return value}:
8289 The return value is of the same type and kind as @var{X}
8291 @item @emph{Example}:
8292 See @code{HUGE} for an example.
8298 @section @code{TRANSFER} --- Transfer bit patterns
8299 @cindex @code{TRANSFER} intrinsic
8300 @cindex bit operations
8302 Intrinsic implemented, documentation pending.
8305 @item @emph{Description}:
8306 @item @emph{Standard}:
8310 Transformational function
8312 @item @emph{Syntax}:
8313 @item @emph{Arguments}:
8314 @item @emph{Return value}:
8315 @item @emph{Example}:
8316 @item @emph{See also}:
8323 @section @code{TRANSPOSE} --- Transpose an array of rank two
8324 @cindex @code{TRANSPOSE} intrinsic
8325 @cindex matrix manipulation
8327 Intrinsic implemented, documentation pending.
8330 @item @emph{Description}:
8331 @item @emph{Standard}:
8335 Transformational function
8337 @item @emph{Syntax}:
8338 @item @emph{Arguments}:
8339 @item @emph{Return value}:
8340 @item @emph{Example}:
8341 @item @emph{See also}:
8348 @section @code{TRIM} --- Function to remove trailing blank characters of a string
8349 @cindex @code{TRIM} intrinsic
8350 @cindex string manipulation
8352 Intrinsic implemented, documentation pending.
8355 @item @emph{Description}:
8356 @item @emph{Standard}:
8360 Transformational function
8362 @item @emph{Syntax}:
8363 @item @emph{Arguments}:
8364 @item @emph{Return value}:
8365 @item @emph{Example}:
8366 @item @emph{See also}:
8372 @section @code{UBOUND} --- Upper dimension bounds of an array
8373 @cindex @code{UBOUND} intrinsic
8376 @item @emph{Description}:
8377 Returns the upper bounds of an array, or a single upper bound
8378 along the @var{DIM} dimension.
8379 @item @emph{Standard}:
8385 @item @emph{Syntax}:
8386 @code{I = UBOUND(ARRAY [, DIM])}
8388 @item @emph{Arguments}:
8389 @multitable @columnfractions .15 .80
8390 @item @var{ARRAY} @tab Shall be an array, of any type.
8391 @item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER(*)}.
8394 @item @emph{Return value}:
8395 If @var{DIM} is absent, the result is an array of the upper bounds of
8396 @var{ARRAY}. If @var{DIM} is present, the result is a scalar
8397 corresponding to the upper bound of the array along that dimension. If
8398 @var{ARRAY} is an expression rather than a whole array or array
8399 structure component, or if it has a zero extent along the relevant
8400 dimension, the upper bound is taken to be the number of elements along
8401 the relevant dimension.
8403 @item @emph{See also}:
8410 @section @code{UMASK} --- Set the file creation mask
8411 @cindex @code{UMASK} intrinsic
8412 @cindex file system operations
8414 Intrinsic implemented, documentation pending.
8417 @item @emph{Description}:
8418 @item @emph{Standard}:
8424 @item @emph{Syntax}:
8425 @item @emph{Arguments}:
8426 @item @emph{Return value}:
8427 @item @emph{Example}:
8428 @item @emph{Specific names}:
8429 @item @emph{See also}:
8435 @section @code{UNLINK} --- Remove a file from the file system
8436 @cindex @code{UNLINK} intrinsic
8437 @cindex file system operations
8440 @item @emph{Description}:
8441 Unlinks the file @var{PATH}. A null character (@code{CHAR(0)}) can be
8442 used to mark the end of the name in @var{PATH}; otherwise, trailing
8443 blanks in the file name are ignored. If the @var{STATUS} argument is
8444 supplied, it contains 0 on success or a nonzero error code upon return;
8447 @item @emph{Standard}:
8453 @item @emph{Syntax}:
8454 @code{CALL UNLINK(PATH [, STATUS])}
8456 @item @emph{Arguments}:
8457 @multitable @columnfractions .15 .80
8458 @item @var{PATH} @tab Shall be of default @code{CHARACTER} type.
8459 @item @var{STATUS} @tab (Optional) Shall be of default @code{INTEGER} type.
8462 @item @emph{See also}:
8469 @section @code{UNMASK} --- (?)
8470 @cindex @code{UNMASK} intrinsic
8471 @cindex undocumented intrinsic
8473 Intrinsic implemented, documentation pending.
8476 @item @emph{Description}:
8477 @item @emph{Standard}:
8479 @item @emph{Syntax}:
8480 @item @emph{Arguments}:
8481 @item @emph{Return value}:
8482 @item @emph{Example}:
8483 @item @emph{Specific names}:
8484 @item @emph{See also}:
8491 @section @code{UNPACK} --- Unpack an array of rank one into an array
8492 @cindex @code{UNPACK} intrinsic
8493 @cindex array manipulation
8495 Intrinsic implemented, documentation pending.
8498 @item @emph{Description}:
8499 @item @emph{Standard}:
8503 Transformational function
8505 @item @emph{Syntax}:
8506 @item @emph{Arguments}:
8507 @item @emph{Return value}:
8508 @item @emph{Example}:
8510 @item @emph{See also}:
8518 @section @code{VERIFY} --- Scan a string for the absence of a set of characters
8519 @cindex @code{VERIFY} intrinsic
8520 @cindex string manipulation
8522 Intrinsic implemented, documentation pending.
8525 @item @emph{Description}:
8526 @item @emph{Standard}:
8532 @item @emph{Syntax}:
8533 @item @emph{Arguments}:
8534 @item @emph{Return value}:
8535 @item @emph{Example}:
8536 @item @emph{Specific names}:
8537 @item @emph{See also}:
8542 @section @code{XOR} --- Bitwise logical exclusive OR
8543 @cindex @code{XOR} intrinsic
8544 @cindex bit operations
8547 @item @emph{Description}:
8548 Bitwise logical exclusive or.
8550 This intrinsic routine is provided for backwards compatibility with
8551 GNU Fortran 77. For integer arguments, programmers should consider
8552 the use of the @ref{IEOR} intrinsic defined by the Fortran standard.
8554 @item @emph{Standard}:
8558 Non-elemental function
8560 @item @emph{Syntax}:
8561 @code{RESULT = XOR(X, Y)}
8563 @item @emph{Arguments}:
8564 @multitable @columnfractions .15 .80
8565 @item @var{X} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8566 @item @var{Y} @tab The type shall be either @code{INTEGER(*)} or @code{LOGICAL}.
8569 @item @emph{Return value}:
8570 The return type is either @code{INTEGER(*)} or @code{LOGICAL}
8571 after cross-promotion of the arguments.
8573 @item @emph{Example}:
8576 LOGICAL :: T = .TRUE., F = .FALSE.
8578 DATA a / Z,'F' /, b / Z'3' /
8580 WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
8581 WRITE (*,*) XOR(a, b)
8585 @item @emph{See also}:
8586 F95 elemental function: @ref{IEOR}